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
3f02ee9b10872f071145390c7968cdf1514c1935
14,190,571,950,926
bf6ad6eb780f78e7908482cb7c938ab7a4a836e6
/src/ca/blakey/monte_carlo/MonteCarloSimTimeTest.java
e86d7f19a760441f54022e7965b041d0f1aa8cdb
[]
no_license
zacchaeusliang/MonteCarlo
https://github.com/zacchaeusliang/MonteCarlo
f52ad08d5359b584c2e25c48840ba7b5de3dcdf8
54171d91d4144668d06e431e03452935897f6377
refs/heads/master
2021-01-17T11:51:35.036000
2016-01-18T13:58:40
2016-01-18T13:58:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.blakey.monte_carlo; import java.security.NoSuchAlgorithmException; import ca.blakey.monte_carlo.model.GenerateUUID; import ca.blakey.monte_carlo.model.MonteCarloSim; public class MonteCarloSimTimeTest { public static void main(String[] args) throws NoSuchAlgorithmException{ String times = "["; int numTrials = 1000000; for(int i = 0;i<100; i++){ GenerateUUID uuidGenerator = new GenerateUUID(1); long seed = uuidGenerator.getSeed(0); int numVars = 2; MonteCarloSim mcs = new MonteCarloSim(seed, numTrials, numVars, "piROll"); mcs.run(); times = times+mcs.getExcecutionTime()+", "; numTrials = numTrials + 1000; } System.out.println(times); } }
UTF-8
Java
689
java
MonteCarloSimTimeTest.java
Java
[]
null
[]
package ca.blakey.monte_carlo; import java.security.NoSuchAlgorithmException; import ca.blakey.monte_carlo.model.GenerateUUID; import ca.blakey.monte_carlo.model.MonteCarloSim; public class MonteCarloSimTimeTest { public static void main(String[] args) throws NoSuchAlgorithmException{ String times = "["; int numTrials = 1000000; for(int i = 0;i<100; i++){ GenerateUUID uuidGenerator = new GenerateUUID(1); long seed = uuidGenerator.getSeed(0); int numVars = 2; MonteCarloSim mcs = new MonteCarloSim(seed, numTrials, numVars, "piROll"); mcs.run(); times = times+mcs.getExcecutionTime()+", "; numTrials = numTrials + 1000; } System.out.println(times); } }
689
0.730044
0.703919
23
28.956522
21.844267
76
false
false
0
0
0
0
0
0
2.173913
false
false
4
f457d879bc73aca3ab5661ee38199f312ac200f9
9,586,367,074,611
e5e6725e23258d17328892c7eb20cacd6da04435
/Prova_Questao01/src/br/edu/fescfafic/es/questao01/Disco.java
dbd0d210e3598732c4ab48d220f5dbff2ad9311c
[]
no_license
DamacenaBR/Apps_java
https://github.com/DamacenaBR/Apps_java
8a7cc1c8709e62964edff62d1f527908b2b9b132
4683bff98d8765e9f3aaa53229191590521700ff
refs/heads/master
2022-09-06T10:15:44.460000
2020-05-25T20:29:05
2020-05-25T20:29:05
266,849,153
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.edu.fescfafic.es.questao01; public abstract class Disco { public abstract String conecta(); }
UTF-8
Java
113
java
Disco.java
Java
[]
null
[]
package br.edu.fescfafic.es.questao01; public abstract class Disco { public abstract String conecta(); }
113
0.734513
0.716814
5
21.4
17.419529
39
false
false
0
0
0
0
0
0
0.4
false
false
4
ff2ec00287d91534079c56aa8995487b7aa894d3
22,316,650,079,888
b24818a948152b06c7d85ac442e9b37cb6becbbc
/src/main/java/com/ash/experiments/performance/whitespace/Class6590.java
ceaf434698a6360e3fcba5ca7a7bd5423e8d57a9
[]
no_license
ajorpheus/whitespace-perf-test
https://github.com/ajorpheus/whitespace-perf-test
d0797b6aa3eea1435eaa1032612f0874537c58b8
d2b695aa09c6066fbba0aceb230fa4e308670b32
refs/heads/master
2020-04-17T23:38:39.420000
2014-06-02T09:27:17
2014-06-02T09:27:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Class6590 {}
UTF-8
Java
41
java
Class6590.java
Java
[]
null
[]
public class Class6590 {}
41
0.487805
0.390244
1
25
0
25
false
false
0
0
0
0
0
0
0
false
false
4
1a6c7781778d155d771ba76bfcb94a7a05da8182
28,613,072,126,355
4c87f4b4b58fc63ce9c3cb1afdeafbcf795b493b
/UpperCaseRule.java
dd8b3ea13b3a38cdcacc87b1e90e199918ba34e1
[]
no_license
theawkwardchild/Wordlist-Maker
https://github.com/theawkwardchild/Wordlist-Maker
6f166c4de465b83daa97b89947d473404956f18a
6ba1b9f00a4991b8aa92f421a5765e7e445b20bb
refs/heads/master
2020-03-10T23:39:56.924000
2018-04-16T23:36:05
2018-04-16T23:36:05
129,645,571
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wordlistscraper; /** * @author nnewdorf */ public class UpperCaseRule extends Rule{ @Override public String processString(String s) { return s.toUpperCase(); } }
UTF-8
Java
199
java
UpperCaseRule.java
Java
[ { "context": "package wordlistscraper;\n\n/**\n * @author nnewdorf\n */\npublic class UpperCaseRule extends Rule{\n\n ", "end": 49, "score": 0.9995092153549194, "start": 41, "tag": "USERNAME", "value": "nnewdorf" } ]
null
[]
package wordlistscraper; /** * @author nnewdorf */ public class UpperCaseRule extends Rule{ @Override public String processString(String s) { return s.toUpperCase(); } }
199
0.648241
0.648241
13
14.307693
14.973744
43
false
false
0
0
0
0
0
0
0.153846
false
false
4
df391fef4d77064b0b0fc8014a350f7df6846ecf
20,615,843,053,540
6aafd415ba3aa2ee85c9ad40d55398847859e3f7
/src/java/coreservlet/createAppointmentServlet.java
a9be58dd48b011726b59eceb9179efc7d12ebbdd
[]
no_license
bananaqib/PinangSebatang
https://github.com/bananaqib/PinangSebatang
9105cf97e878fd266c99d7758ff52ab9f1d199f0
79070551058c960ab2d99f7285464f0bd04f7721
refs/heads/master
2021-09-03T12:06:32.403000
2018-01-08T23:47:22
2018-01-08T23:47:22
105,849,957
1
1
null
false
2018-01-08T23:47:23
2017-10-05T04:40:12
2017-11-22T19:54:43
2018-01-08T23:47:23
827
1
0
0
CSS
false
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package coreservlet; import connection.ConnectionManager; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import bean.LoginBean; import java.sql.*; /** * * @author kerol */ @WebServlet(name = "createAppointmentServlet", urlPatterns = {"/createAppointmentServlet"}) public class createAppointmentServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter pw = response.getWriter(); String connectionURL = "jdbc:mysql://localhost:3306/logintest"; Connection connection; Connection con = null; Statement statement = null; ResultSet resultSet = null; String firstNameDB = ""; String lastNameDB = ""; String matricDB = ""; HttpSession session = request.getSession(true); String usernamedb1 = (String) session.getAttribute("currentSessionUser"); try { con = ConnectionManager.createConnection(); statement = con.createStatement(); resultSet = statement.executeQuery("select FirstName,LastName,matric from users WHERE username = '" + usernamedb1 + "'"); while (resultSet.next()) { firstNameDB = resultSet.getString("FirstName"); lastNameDB = resultSet.getString("LastName"); matricDB = resultSet.getString("matric"); } String apmntMatric = matricDB; String apmntfullName = firstNameDB + " " + lastNameDB; String apmntType = request.getParameter("appType"); String apmntDate = request.getParameter("appDate"); String apmntDoc = request.getParameter("appDoc"); String apmntDescr = request.getParameter("appDescr"); String apmntStatus = "Pending"; Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", "1234"); PreparedStatement pst = connection.prepareStatement("insert into appointment(username,patient_name,matric,type,date,doctor,description,status) values(?,?,?,?,?,?,?,?)"); pst.setString(1, usernamedb1); pst.setString(2, apmntfullName); pst.setString(3, apmntMatric); pst.setString(4, apmntType); pst.setString(5, apmntDate); pst.setString(6, apmntDoc); pst.setString(7, apmntDescr); pst.setString(8, apmntStatus); int i = pst.executeUpdate(); if (i != 0) { pw.println("<script type=\'text/javascript\'>"); pw.println("alert('Appointment succesfully created');"); pw.println("location='./patientIndex.jsp'"); pw.println("</script>"); } else { pw.println("failed to insert the data"); } } catch (Exception e) { pw.println(e); } } }
UTF-8
Java
3,568
java
createAppointmentServlet.java
Java
[ { "context": "inBean;\r\nimport java.sql.*;\r\n\r\n/**\r\n *\r\n * @author kerol\r\n */\r\n@WebServlet(name = \"createAppointmentServlet\"", "end": 641, "score": 0.9335294365882874, "start": 636, "tag": "USERNAME", "value": "kerol" }, { "context": "e,LastName,matric from users WHERE ...
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package coreservlet; import connection.ConnectionManager; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import bean.LoginBean; import java.sql.*; /** * * @author kerol */ @WebServlet(name = "createAppointmentServlet", urlPatterns = {"/createAppointmentServlet"}) public class createAppointmentServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter pw = response.getWriter(); String connectionURL = "jdbc:mysql://localhost:3306/logintest"; Connection connection; Connection con = null; Statement statement = null; ResultSet resultSet = null; String firstNameDB = ""; String lastNameDB = ""; String matricDB = ""; HttpSession session = request.getSession(true); String usernamedb1 = (String) session.getAttribute("currentSessionUser"); try { con = ConnectionManager.createConnection(); statement = con.createStatement(); resultSet = statement.executeQuery("select FirstName,LastName,matric from users WHERE username = '" + usernamedb1 + "'"); while (resultSet.next()) { firstNameDB = resultSet.getString("FirstName"); lastNameDB = resultSet.getString("LastName"); matricDB = resultSet.getString("matric"); } String apmntMatric = matricDB; String apmntfullName = firstNameDB + " " + lastNameDB; String apmntType = request.getParameter("appType"); String apmntDate = request.getParameter("appDate"); String apmntDoc = request.getParameter("appDoc"); String apmntDescr = request.getParameter("appDescr"); String apmntStatus = "Pending"; Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", "1234"); PreparedStatement pst = connection.prepareStatement("insert into appointment(username,patient_name,matric,type,date,doctor,description,status) values(?,?,?,?,?,?,?,?)"); pst.setString(1, usernamedb1); pst.setString(2, apmntfullName); pst.setString(3, apmntMatric); pst.setString(4, apmntType); pst.setString(5, apmntDate); pst.setString(6, apmntDoc); pst.setString(7, apmntDescr); pst.setString(8, apmntStatus); int i = pst.executeUpdate(); if (i != 0) { pw.println("<script type=\'text/javascript\'>"); pw.println("alert('Appointment succesfully created');"); pw.println("location='./patientIndex.jsp'"); pw.println("</script>"); } else { pw.println("failed to insert the data"); } } catch (Exception e) { pw.println(e); } } }
3,568
0.617433
0.611827
88
38.545456
29.952959
181
false
false
0
0
0
0
0
0
1
false
false
4
3a8bc150649a7bfa6d3f9945de943578c3ebda65
23,983,097,423,693
79011edf596f0fd4c264a31d50ddb761493264ac
/src/test/java/com/gh/mygreen/xlsmapper/sample/dbdefinition/TableRecord.java
63c2bb8b3a595ea21fb5211b78c1f32b6150af92
[ "Apache-2.0" ]
permissive
mygreen/xlsmapper
https://github.com/mygreen/xlsmapper
401acb90d7edf6adfc5ad57dce144b99412275f7
2f4d51ccac3b709486c76a5155a2d0264a223358
refs/heads/master
2022-09-16T07:37:35.152000
2022-07-17T01:02:00
2022-07-17T01:02:00
26,218,090
39
21
Apache-2.0
false
2022-07-17T01:02:01
2014-11-05T12:16:20
2022-01-06T15:36:51
2022-07-17T01:02:00
52,114
28
12
4
Java
false
false
package com.gh.mygreen.xlsmapper.sample.dbdefinition; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import com.gh.mygreen.xlsmapper.annotation.XlsColumn; import com.gh.mygreen.xlsmapper.annotation.XlsIgnorable; import com.gh.mygreen.xlsmapper.annotation.XlsNestedRecords; import com.gh.mygreen.xlsmapper.util.CellPosition; import com.gh.mygreen.xlsmapper.util.IsEmptyBuilder; /** * 表の定義のレコード * @since 2.0 * @author T.TSUCHIE * */ public class TableRecord { /** * セルの座標 */ private Map<String, CellPosition> positions; /** * ラベル情報 */ private Map<String, String> labels; @NotNull @XlsColumn(columnName="種類(Table/View)") private TableCategory category; @NotEmpty @XlsColumn(columnName="表名(論理)") private String logicalName; @NotEmpty @XlsColumn(columnName="表名(物理)") private String phisicalName; @NotEmpty @XlsNestedRecords private List<@Valid ColumnRecord> columns; @XlsIgnorable public boolean isEmpty() { return IsEmptyBuilder.reflectionIsEmpty(this, "positions", "labels"); } public void addColumn(ColumnRecord record) { if(columns == null) { this.columns = new ArrayList<>(); } this.columns.add(record); } public Map<String, CellPosition> getPositions() { return positions; } public TableCategory getCategory() { return category; } public void setCategory(TableCategory category) { this.category = category; } public String getLogicalName() { return logicalName; } public void setLogicalName(String logicalName) { this.logicalName = logicalName; } public String getPhisicalName() { return phisicalName; } public void setPhisicalName(String phisicalName) { this.phisicalName = phisicalName; } public List<ColumnRecord> getColumns() { return columns; } public void setColumns(List<ColumnRecord> columns) { this.columns = columns; } }
UTF-8
Java
2,354
java
TableRecord.java
Java
[ { "context": "r;\r\n\r\n/**\r\n * 表の定義のレコード\r\n * @since 2.0\r\n * @author T.TSUCHIE\r\n *\r\n */\r\npublic class TableRecord {\r\n\r\n /**\r\n", "end": 599, "score": 0.9994931817054749, "start": 590, "tag": "NAME", "value": "T.TSUCHIE" } ]
null
[]
package com.gh.mygreen.xlsmapper.sample.dbdefinition; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import com.gh.mygreen.xlsmapper.annotation.XlsColumn; import com.gh.mygreen.xlsmapper.annotation.XlsIgnorable; import com.gh.mygreen.xlsmapper.annotation.XlsNestedRecords; import com.gh.mygreen.xlsmapper.util.CellPosition; import com.gh.mygreen.xlsmapper.util.IsEmptyBuilder; /** * 表の定義のレコード * @since 2.0 * @author T.TSUCHIE * */ public class TableRecord { /** * セルの座標 */ private Map<String, CellPosition> positions; /** * ラベル情報 */ private Map<String, String> labels; @NotNull @XlsColumn(columnName="種類(Table/View)") private TableCategory category; @NotEmpty @XlsColumn(columnName="表名(論理)") private String logicalName; @NotEmpty @XlsColumn(columnName="表名(物理)") private String phisicalName; @NotEmpty @XlsNestedRecords private List<@Valid ColumnRecord> columns; @XlsIgnorable public boolean isEmpty() { return IsEmptyBuilder.reflectionIsEmpty(this, "positions", "labels"); } public void addColumn(ColumnRecord record) { if(columns == null) { this.columns = new ArrayList<>(); } this.columns.add(record); } public Map<String, CellPosition> getPositions() { return positions; } public TableCategory getCategory() { return category; } public void setCategory(TableCategory category) { this.category = category; } public String getLogicalName() { return logicalName; } public void setLogicalName(String logicalName) { this.logicalName = logicalName; } public String getPhisicalName() { return phisicalName; } public void setPhisicalName(String phisicalName) { this.phisicalName = phisicalName; } public List<ColumnRecord> getColumns() { return columns; } public void setColumns(List<ColumnRecord> columns) { this.columns = columns; } }
2,354
0.644599
0.643728
98
21.428572
19.772688
77
false
false
0
0
0
0
0
0
0.357143
false
false
4
a2765beeaa149c4405385adb2430963e2be32a16
18,373,870,148,896
71a7ff9aaecb6dbe0e397b00408667a3ab70bb7f
/service-business/src/main/java/com/example/servicebusiness/service/TestDistributedService.java
792b17426450117b6b49c837ddda86f2d751ea00
[]
no_license
qizhi1a440/demo
https://github.com/qizhi1a440/demo
6111f96f71005e2d4d37c293e40ba330f4e8868b
ab9e17572f3116e9880f762aa9f43cc696afaaf9
refs/heads/master
2022-07-01T10:21:01.692000
2019-06-27T11:39:00
2019-06-27T11:39:00
192,510,594
0
0
null
false
2022-06-21T01:18:19
2019-06-18T09:39:21
2019-06-27T11:39:02
2022-06-21T01:18:18
5,046
0
0
4
Java
false
false
package com.example.servicebusiness.service; import io.seata.spring.annotation.GlobalTransactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TestDistributedService { @Autowired private HiService hiService; @Autowired private HaService haService; @GlobalTransactional() public String test(String name) { String ha=null; boolean flag=false; try { ha = haService.ha(name); }catch (Exception e){ System.out.println("haService异常了"); flag=true; //throw new RuntimeException("haService异常了"); } System.out.println("hahahahahahahahahahahahahahahaha"); try { String hi = hiService.add(name); }catch (Exception e){ System.out.println("hiService异常了"); flag=true; //throw new RuntimeException("hiService异常了"); } System.out.println("hihihihihihihihihihihihihiihihi"); if (flag){ throw new RuntimeException("插入数据异常了"); } return ha; } }
UTF-8
Java
1,196
java
TestDistributedService.java
Java
[]
null
[]
package com.example.servicebusiness.service; import io.seata.spring.annotation.GlobalTransactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TestDistributedService { @Autowired private HiService hiService; @Autowired private HaService haService; @GlobalTransactional() public String test(String name) { String ha=null; boolean flag=false; try { ha = haService.ha(name); }catch (Exception e){ System.out.println("haService异常了"); flag=true; //throw new RuntimeException("haService异常了"); } System.out.println("hahahahahahahahahahahahahahahaha"); try { String hi = hiService.add(name); }catch (Exception e){ System.out.println("hiService异常了"); flag=true; //throw new RuntimeException("hiService异常了"); } System.out.println("hihihihihihihihihihihihihiihihi"); if (flag){ throw new RuntimeException("插入数据异常了"); } return ha; } }
1,196
0.626079
0.626079
42
26.571428
19.940557
63
false
false
0
0
0
0
0
0
0.47619
false
false
4
4379850f1605d2dee7561541c08ee3ffbac3054c
6,219,112,645,399
5ff2d4d7057ec5d810b1abfd7008df0fa690c7b4
/app/src/main/java/com/borreguin/tiendapp/DB_Handlers/DBHandler_Clients.java
3877b9da9789cd9efc000d4861cf5c1a37e2d6d2
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Borreguin/TiendApp
https://github.com/Borreguin/TiendApp
e0e525863d49f0ea6ad3238b354baa819a4de5e6
fd287840e25d47f21b809bf1e3802d445b9efe0e
refs/heads/master
2021-01-21T11:37:14.131000
2017-10-03T18:11:34
2017-10-03T18:11:34
101,844,982
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.borreguin.tiendapp.DB_Handlers; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.os.ParcelFormatException; import com.borreguin.tiendapp.Class.Client; import com.borreguin.tiendapp.Class.Global; import java.text.ParseException; import java.util.ArrayList; import java.util.List; /** * Created by Roberto on 8/29/2017. * com.borreguin.tiendapp */ public class DBHandler_Clients extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 8; // Database Name private static final String DATABASE_NAME = "DB_infoClients"; // Table names private static final String TABLE_CLIENTS = "tbl_clients"; private static final String TABLE_METADATA = "tbl_metadata"; // Clients Table Columns names private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_DSCRP = "description"; private static final String KEY_ToPAY = "toPay"; private static final String KEY_ToRELY = "toRely"; private static final String KEY_ACCOUNT = "accountDetail"; private static final String KEY_DATE_UPDATE = "dateUpdate"; // Metadata values: private static final String KEY_KEY = "key"; private static final String KEY_VALUE = "value"; // Id for getting values in string constructor private static final int Idx_id_0 = 0, Idx_name_1 = 1, Idx_dscrp_2 = 2, Idx_toPay_3 = 3, Idx_toRely_4 =4, Idx_account_5 = 5, Idx_dateUpdate_6 =6; // Global values private Global global = new Global(); // Constructor public DBHandler_Clients(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // TABLE OF CLIENTS String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CLIENTS + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT," + KEY_DSCRP + " TEXT," + KEY_ToPAY + " FLOAT," + KEY_ToRELY + " INTEGER," + KEY_ACCOUNT + " INTEGER," + KEY_DATE_UPDATE + " TEXT" + ")"; /* TYPE Primary Description ID: Integer yes ID del cliente name: text Nombre del cliente description: text descripción del cliente toPay : Float Deuda del cliente toRely : Integer Se puede fiar al cliente? ( 0 -> false) account : Integer Numero de cuenta actual date_update: Text Fecha de actualización */ // For key and value table, KEY_ID is unique // TABLE METADATA_CLIENTS String CREATE_METADATA = "CREATE TABLE " + TABLE_METADATA + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_KEY + " STRING, " + KEY_VALUE + " STRING " + ")"; /* TYPE Primary Description ID: text yes ID del member detail: text detail document */ try { db.execSQL(CREATE_METADATA); }catch (SQLException e){ e.printStackTrace(); } try { db.execSQL(CREATE_CONTACTS_TABLE); }catch (SQLException e){ e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_CLIENTS); // Creating tables again onCreate(db); } // Adding new client public void addClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, client.getName()); // Client Name values.put(KEY_DSCRP, client.getDescription()); // Client Description values.put(KEY_ToPAY, client.getToPay()); // to Pay values.put(KEY_ToRELY, client.getToRely_int()); // to Give products values.put(KEY_ACCOUNT, client.getAccount()); // Account number values.put(KEY_DATE_UPDATE, client.getDate_update_string()); // Inserting Row db.insert(TABLE_CLIENTS, null, values); // Closing database connection db.close(); } // Getting one client using the name of the client public Client getClient(String ClientName) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_CLIENTS, new String[]{KEY_ID, KEY_NAME, KEY_DSCRP, KEY_ToPAY, KEY_ToRELY, KEY_ACCOUNT, KEY_DATE_UPDATE}, KEY_NAME + "=?", new String[]{ClientName}, null, null, null, null); if (cursor != null) cursor.moveToFirst(); if (cursor.getCount() == 0) { return new Client(); } try { Client contact = new Client( Integer.parseInt(cursor.getString(Idx_id_0)), cursor.getString(Idx_name_1), cursor.getString(Idx_dscrp_2), Float.parseFloat(cursor.getString(Idx_toPay_3)), Integer.parseInt(cursor.getString(Idx_toRely_4)), Integer.parseInt(cursor.getString(Idx_account_5)), cursor.getString(Idx_dateUpdate_6) ); cursor.close(); // return client return contact; }catch (ParseException e) { e.printStackTrace(); } return new Client(); } public Client getClient(int idClient) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_CLIENTS, new String[]{KEY_ID, KEY_NAME, KEY_DSCRP, KEY_ToPAY, KEY_ToRELY, KEY_ACCOUNT, KEY_DATE_UPDATE}, KEY_ID + "=?", new String[]{String.valueOf(idClient)}, null, null, null, null); if (cursor != null) cursor.moveToFirst(); if (cursor.getCount() == 0) { cursor.close(); db.close(); return new Client(); } try { Client contact = new Client( Integer.parseInt(cursor.getString(Idx_id_0)), cursor.getString(Idx_name_1), cursor.getString(Idx_dscrp_2), Float.parseFloat(cursor.getString(Idx_toPay_3)), Integer.parseInt(cursor.getString(Idx_toRely_4)), Integer.parseInt(cursor.getString(Idx_account_5)), cursor.getString(Idx_dateUpdate_6) ); cursor.close(); db.close(); // return client return contact; }catch (ParseException e) { e.printStackTrace(); } cursor.close(); db.close(); return new Client(); } // Getting All Clients public List<Client> getAllClients() { List<Client> clientList = new ArrayList<>(); // Select All Query String selectQuery = "SELECT * FROM " + TABLE_CLIENTS; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); //try { if(cursor.getCount()<=0){ Client temporal = new Client(global.id_temp, global.prefix + "", "", 0); clientList.add(temporal); cursor.close(); db.close(); return clientList; } // looping through all rows and adding to list if (cursor.moveToFirst()) { do { try { Client client = new Client(); client.setId(Integer.parseInt(cursor.getString(Idx_id_0))); client.setName(cursor.getString(Idx_name_1)); client.setDescription(cursor.getString(Idx_dscrp_2)); client.setToPay(Float.parseFloat(cursor.getString(Idx_toPay_3))); client.setToRely(Integer.parseInt(cursor.getString(Idx_toRely_4))); client.setAccount(Integer.parseInt(cursor.getString(Idx_account_5))); client.setDate_update(cursor.getString(Idx_dateUpdate_6)); // Adding contact to list clientList.add(client); }catch (Exception e){ e.printStackTrace(); } } while (cursor.moveToNext()); } cursor.close(); db.close(); //}catch (SQLException e){ // e.printStackTrace(); //}catch (Exception e){ // e.printStackTrace(); //} // return contact list return clientList; } // Getting clients Count public int getClientsCount() { String countQuery = "SELECT * FROM " + TABLE_CLIENTS; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); cursor.close(); db.close(); // return count return cursor.getCount(); } // Updating a client public int updateClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); client.update_date(); ContentValues values = new ContentValues(); values.put(KEY_NAME, client.getName()); values.put(KEY_DSCRP, client.getDescription()); values.put(KEY_ToPAY, client.getToPay()); values.put(KEY_ToRELY, client.getToRely_int()); values.put(KEY_ACCOUNT, client.getAccount()); values.put(KEY_DATE_UPDATE, client.getDate_update_string()); // updating row try { return db.update(TABLE_CLIENTS, values, KEY_ID + " = ?", new String[]{String.valueOf(client.getId())}); }catch (SQLException e){ e.printStackTrace(); } return 0; } // Deleting a client public void deleteClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_CLIENTS, KEY_ID + " = ?", new String[] { String.valueOf(client.getId()) }); db.close(); } }
UTF-8
Java
10,861
java
DBHandler_Clients.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Roberto on 8/29/2017.\n * com.borreguin.tiendapp\n */\n\npubl", "end": 522, "score": 0.9973630905151367, "start": 515, "tag": "NAME", "value": "Roberto" }, { "context": ";\n private static final String KEY_ToRELY...
null
[]
package com.borreguin.tiendapp.DB_Handlers; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.os.ParcelFormatException; import com.borreguin.tiendapp.Class.Client; import com.borreguin.tiendapp.Class.Global; import java.text.ParseException; import java.util.ArrayList; import java.util.List; /** * Created by Roberto on 8/29/2017. * com.borreguin.tiendapp */ public class DBHandler_Clients extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 8; // Database Name private static final String DATABASE_NAME = "DB_infoClients"; // Table names private static final String TABLE_CLIENTS = "tbl_clients"; private static final String TABLE_METADATA = "tbl_metadata"; // Clients Table Columns names private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_DSCRP = "description"; private static final String KEY_ToPAY = "toPay"; private static final String KEY_ToRELY = "toRely"; private static final String KEY_ACCOUNT = "accountDetail"; private static final String KEY_DATE_UPDATE = "dateUpdate"; // Metadata values: private static final String KEY_KEY = "key"; private static final String KEY_VALUE = "value"; // Id for getting values in string constructor private static final int Idx_id_0 = 0, Idx_name_1 = 1, Idx_dscrp_2 = 2, Idx_toPay_3 = 3, Idx_toRely_4 =4, Idx_account_5 = 5, Idx_dateUpdate_6 =6; // Global values private Global global = new Global(); // Constructor public DBHandler_Clients(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // TABLE OF CLIENTS String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CLIENTS + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT," + KEY_DSCRP + " TEXT," + KEY_ToPAY + " FLOAT," + KEY_ToRELY + " INTEGER," + KEY_ACCOUNT + " INTEGER," + KEY_DATE_UPDATE + " TEXT" + ")"; /* TYPE Primary Description ID: Integer yes ID del cliente name: text Nombre del cliente description: text descripción del cliente toPay : Float Deuda del cliente toRely : Integer Se puede fiar al cliente? ( 0 -> false) account : Integer Numero de cuenta actual date_update: Text Fecha de actualización */ // For key and value table, KEY_ID is unique // TABLE METADATA_CLIENTS String CREATE_METADATA = "CREATE TABLE " + TABLE_METADATA + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_KEY + " STRING, " + KEY_VALUE + " STRING " + ")"; /* TYPE Primary Description ID: text yes ID del member detail: text detail document */ try { db.execSQL(CREATE_METADATA); }catch (SQLException e){ e.printStackTrace(); } try { db.execSQL(CREATE_CONTACTS_TABLE); }catch (SQLException e){ e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_CLIENTS); // Creating tables again onCreate(db); } // Adding new client public void addClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, client.getName()); // Client Name values.put(KEY_DSCRP, client.getDescription()); // Client Description values.put(KEY_ToPAY, client.getToPay()); // to Pay values.put(KEY_ToRELY, client.getToRely_int()); // to Give products values.put(KEY_ACCOUNT, client.getAccount()); // Account number values.put(KEY_DATE_UPDATE, client.getDate_update_string()); // Inserting Row db.insert(TABLE_CLIENTS, null, values); // Closing database connection db.close(); } // Getting one client using the name of the client public Client getClient(String ClientName) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_CLIENTS, new String[]{KEY_ID, KEY_NAME, KEY_DSCRP, KEY_ToPAY, KEY_ToRELY, KEY_ACCOUNT, KEY_DATE_UPDATE}, KEY_NAME + "=?", new String[]{ClientName}, null, null, null, null); if (cursor != null) cursor.moveToFirst(); if (cursor.getCount() == 0) { return new Client(); } try { Client contact = new Client( Integer.parseInt(cursor.getString(Idx_id_0)), cursor.getString(Idx_name_1), cursor.getString(Idx_dscrp_2), Float.parseFloat(cursor.getString(Idx_toPay_3)), Integer.parseInt(cursor.getString(Idx_toRely_4)), Integer.parseInt(cursor.getString(Idx_account_5)), cursor.getString(Idx_dateUpdate_6) ); cursor.close(); // return client return contact; }catch (ParseException e) { e.printStackTrace(); } return new Client(); } public Client getClient(int idClient) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_CLIENTS, new String[]{KEY_ID, KEY_NAME, KEY_DSCRP, KEY_ToPAY, KEY_ToRELY, KEY_ACCOUNT, KEY_DATE_UPDATE}, KEY_ID + "=?", new String[]{String.valueOf(idClient)}, null, null, null, null); if (cursor != null) cursor.moveToFirst(); if (cursor.getCount() == 0) { cursor.close(); db.close(); return new Client(); } try { Client contact = new Client( Integer.parseInt(cursor.getString(Idx_id_0)), cursor.getString(Idx_name_1), cursor.getString(Idx_dscrp_2), Float.parseFloat(cursor.getString(Idx_toPay_3)), Integer.parseInt(cursor.getString(Idx_toRely_4)), Integer.parseInt(cursor.getString(Idx_account_5)), cursor.getString(Idx_dateUpdate_6) ); cursor.close(); db.close(); // return client return contact; }catch (ParseException e) { e.printStackTrace(); } cursor.close(); db.close(); return new Client(); } // Getting All Clients public List<Client> getAllClients() { List<Client> clientList = new ArrayList<>(); // Select All Query String selectQuery = "SELECT * FROM " + TABLE_CLIENTS; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); //try { if(cursor.getCount()<=0){ Client temporal = new Client(global.id_temp, global.prefix + "", "", 0); clientList.add(temporal); cursor.close(); db.close(); return clientList; } // looping through all rows and adding to list if (cursor.moveToFirst()) { do { try { Client client = new Client(); client.setId(Integer.parseInt(cursor.getString(Idx_id_0))); client.setName(cursor.getString(Idx_name_1)); client.setDescription(cursor.getString(Idx_dscrp_2)); client.setToPay(Float.parseFloat(cursor.getString(Idx_toPay_3))); client.setToRely(Integer.parseInt(cursor.getString(Idx_toRely_4))); client.setAccount(Integer.parseInt(cursor.getString(Idx_account_5))); client.setDate_update(cursor.getString(Idx_dateUpdate_6)); // Adding contact to list clientList.add(client); }catch (Exception e){ e.printStackTrace(); } } while (cursor.moveToNext()); } cursor.close(); db.close(); //}catch (SQLException e){ // e.printStackTrace(); //}catch (Exception e){ // e.printStackTrace(); //} // return contact list return clientList; } // Getting clients Count public int getClientsCount() { String countQuery = "SELECT * FROM " + TABLE_CLIENTS; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); cursor.close(); db.close(); // return count return cursor.getCount(); } // Updating a client public int updateClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); client.update_date(); ContentValues values = new ContentValues(); values.put(KEY_NAME, client.getName()); values.put(KEY_DSCRP, client.getDescription()); values.put(KEY_ToPAY, client.getToPay()); values.put(KEY_ToRELY, client.getToRely_int()); values.put(KEY_ACCOUNT, client.getAccount()); values.put(KEY_DATE_UPDATE, client.getDate_update_string()); // updating row try { return db.update(TABLE_CLIENTS, values, KEY_ID + " = ?", new String[]{String.valueOf(client.getId())}); }catch (SQLException e){ e.printStackTrace(); } return 0; } // Deleting a client public void deleteClient(Client client) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_CLIENTS, KEY_ID + " = ?", new String[] { String.valueOf(client.getId()) }); db.close(); } }
10,861
0.544986
0.540473
307
34.371334
24.458279
93
false
false
0
0
0
0
0
0
0.644951
false
false
4
87442e9ebd78945e28e5c5bc0d5ef8ec19b0dffe
33,088,428,075,968
2fb80e67d045fb75f2c60d347d56701acfb92841
/suntion-web-bankcard/src/main/java/com/suntion/bankcard/controller/ApiController.java
07ab3d13453fafed394029bdfb88daa3dc757fc7
[ "MIT" ]
permissive
suntion/suntion-springcloud-auth
https://github.com/suntion/suntion-springcloud-auth
dade30545b166e655786bad97a6a938d12d27e87
bf7dde78ced4469eae9956c0e13c4c517c4e04ed
refs/heads/master
2022-02-28T03:23:18.849000
2021-04-16T06:01:37
2021-04-16T06:01:37
174,449,745
0
0
MIT
false
2022-02-09T22:13:03
2019-03-08T01:46:04
2021-04-16T06:01:39
2022-02-09T22:13:01
170
0
0
2
Java
false
false
package com.suntion.bankcard.controller; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.suntion.bankcard.service.WithHoldService; import com.suntion.common.lang.ResponseEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; /** * @author suntion */ @RestController @RequestMapping("bankcard/api") public class ApiController { private final Logger logger = LoggerFactory.getLogger(ApiController.class); @Autowired WithHoldService withHoldService; @GetMapping("withhold/{idcard}/{amount}") @HystrixCommand(fallbackMethod = "error") public ResponseEntity withhold(@PathVariable String idcard, @PathVariable BigDecimal amount) { boolean falg = withHoldService.withHold(idcard, amount); if (falg) { logger.info("代扣结果成功"); return ResponseEntity.success(); } logger.info("代扣结果失败"); throw new RuntimeException("代扣结果失败"); } public ResponseEntity error(@PathVariable String phone, @PathVariable BigDecimal content) { //发起某个网络请求(可能失败) return ResponseEntity.failed().setResult("bankcard中发生熔断"); } }
UTF-8
Java
1,567
java
ApiController.java
Java
[ { "context": "ller;\n\nimport java.math.BigDecimal;\n/**\n * @author suntion\n */\n@RestController\n@RequestMapping(\"bankcard/api", "end": 631, "score": 0.9994871616363525, "start": 624, "tag": "USERNAME", "value": "suntion" } ]
null
[]
package com.suntion.bankcard.controller; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.suntion.bankcard.service.WithHoldService; import com.suntion.common.lang.ResponseEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; /** * @author suntion */ @RestController @RequestMapping("bankcard/api") public class ApiController { private final Logger logger = LoggerFactory.getLogger(ApiController.class); @Autowired WithHoldService withHoldService; @GetMapping("withhold/{idcard}/{amount}") @HystrixCommand(fallbackMethod = "error") public ResponseEntity withhold(@PathVariable String idcard, @PathVariable BigDecimal amount) { boolean falg = withHoldService.withHold(idcard, amount); if (falg) { logger.info("代扣结果成功"); return ResponseEntity.success(); } logger.info("代扣结果失败"); throw new RuntimeException("代扣结果失败"); } public ResponseEntity error(@PathVariable String phone, @PathVariable BigDecimal content) { //发起某个网络请求(可能失败) return ResponseEntity.failed().setResult("bankcard中发生熔断"); } }
1,567
0.752177
0.750837
42
34.547619
26.846302
98
false
false
0
0
0
0
0
0
0.547619
false
false
4
c4d9eb2233d2a3ba6fd2c920bf007180667903b0
24,300,925,014,124
742918b48c5b7387bb0e0084dbb3a5bad4444c16
/Androidpn/src/org/androidpn/server/xmpp/XmppServer.java
4b2757c25499bde8a1ecad0aeb709717ff2fc3cc
[ "Apache-2.0" ]
permissive
avideoChat/zgrujb
https://github.com/avideoChat/zgrujb
c76acf0467f233f54b7ecdefb2484f0208a57b9d
000d70a030ae6babd6f3538c6060b80de33318fc
refs/heads/master
2021-01-01T19:10:04.032000
2015-05-23T13:33:48
2015-05-23T13:33:48
35,427,008
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2010 Moduad Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.androidpn.server.xmpp; import org.androidpn.server.util.Config; import org.androidpn.server.xmpp.session.SessionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * This class starts the server as a standalone application using Spring configuration. * * @author Sehwan Noh (devnoh@gmail.com) */ public class XmppServer { private static final Log log = LogFactory.getLog(XmppServer.class); private static XmppServer instance; private ApplicationContext context; private String version = "0.5.0"; private String serverName; private String serverHomeDir; private boolean shuttingDown; /** * Returns the singleton instance of XmppServer. * * @return the server instance. */ public static XmppServer getInstance() { // return instance; if (instance == null) { synchronized (XmppServer.class) { instance = new XmppServer(); } } return instance; } /** * Constructor. Creates a server and starts it. */ public XmppServer() { if (instance != null) { throw new IllegalStateException("A server is already running"); } instance = this; start(); } /** * Starts the server using Spring configuration. */ public void start() { try { if (isStandAlone()) { Runtime.getRuntime().addShutdownHook(new ShutdownHookThread()); } // locateServer(); serverName = Config.getString("xmpp.domain", "127.0.0.1") .toLowerCase(); context = new ClassPathXmlApplicationContext("spring-config.xml"); log.info("Spring Configuration loaded."); log.info("Androidpn Server v" + version); } catch (Exception e) { e.printStackTrace(); shutdownServer(); } } /** * Stops the server. */ public void stop() { shutdownServer(); Thread shutdownThread = new ShutdownThread(); shutdownThread.setDaemon(true); shutdownThread.start(); } /** * Returns a Spring bean that has the given bean name. * * @param beanName * @return a Srping bean */ public Object getBean(String beanName) { return context.getBean(beanName); } /** * Returns the server name. * * @return the server name */ public String getServerName() { return serverName; } /** * Returns true if the server is being shutdown. * * @return true if the server is being down, false otherwise. */ public boolean isShuttingDown() { return shuttingDown; } /** * Returns if the server is running in standalone mode. * * @return true if the server is running in standalone mode, false otherwise. */ public boolean isStandAlone() { boolean standalone; try { standalone = Class .forName("org.androidpn.server.starter.ServerStarter") != null; } catch (ClassNotFoundException e) { standalone = false; } return standalone; } /* private void locateServer() throws FileNotFoundException { Context context = new WebAppContext(contexts, homeDir + File.separator + ); String baseDir = "F:/JavaÈí¼þ/Ó¦ÓÃÈí¼þ/Tomcat 6.0/webapps/ROOT"; log.debug("base.dir=" + baseDir); if (serverHomeDir == null) { try { File confDir = new File(baseDir, "conf"); if (confDir.exists()) { serverHomeDir = confDir.getParentFile().getCanonicalPath(); } } catch (FileNotFoundException fe) { // Ignore } catch (IOException ie) { // Ignore } } if (serverHomeDir == null) { System.err.println("Could not locate home."); throw new FileNotFoundException(); } else { Config.setProperty("server.home.dir", serverHomeDir); log.debug("server.home.dir=" + serverHomeDir); } }*/ private void shutdownServer() { shuttingDown = true; // Close all connections SessionManager.getInstance().closeAllSessions(); log.info("XmppServer stopped"); } private class ShutdownHookThread extends Thread { public void run() { shutdownServer(); log.info("Server halted"); System.err.println("Server halted"); } } private class ShutdownThread extends Thread { public void run() { try { Thread.sleep(5000); System.exit(0); } catch (InterruptedException e) { // Ignore } } } }
WINDOWS-1252
Java
5,891
java
XmppServer.java
Java
[ { "context": "lication using Spring configuration.\n *\n * @author Sehwan Noh (devnoh@gmail.com)\n */\npublic class XmppServer {\n", "end": 1235, "score": 0.9998890161514282, "start": 1225, "tag": "NAME", "value": "Sehwan Noh" }, { "context": "g Spring configuration.\n *\n * @author ...
null
[]
/* * Copyright (C) 2010 Moduad Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.androidpn.server.xmpp; import org.androidpn.server.util.Config; import org.androidpn.server.xmpp.session.SessionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * This class starts the server as a standalone application using Spring configuration. * * @author <NAME> (<EMAIL>) */ public class XmppServer { private static final Log log = LogFactory.getLog(XmppServer.class); private static XmppServer instance; private ApplicationContext context; private String version = "0.5.0"; private String serverName; private String serverHomeDir; private boolean shuttingDown; /** * Returns the singleton instance of XmppServer. * * @return the server instance. */ public static XmppServer getInstance() { // return instance; if (instance == null) { synchronized (XmppServer.class) { instance = new XmppServer(); } } return instance; } /** * Constructor. Creates a server and starts it. */ public XmppServer() { if (instance != null) { throw new IllegalStateException("A server is already running"); } instance = this; start(); } /** * Starts the server using Spring configuration. */ public void start() { try { if (isStandAlone()) { Runtime.getRuntime().addShutdownHook(new ShutdownHookThread()); } // locateServer(); serverName = Config.getString("xmpp.domain", "127.0.0.1") .toLowerCase(); context = new ClassPathXmlApplicationContext("spring-config.xml"); log.info("Spring Configuration loaded."); log.info("Androidpn Server v" + version); } catch (Exception e) { e.printStackTrace(); shutdownServer(); } } /** * Stops the server. */ public void stop() { shutdownServer(); Thread shutdownThread = new ShutdownThread(); shutdownThread.setDaemon(true); shutdownThread.start(); } /** * Returns a Spring bean that has the given bean name. * * @param beanName * @return a Srping bean */ public Object getBean(String beanName) { return context.getBean(beanName); } /** * Returns the server name. * * @return the server name */ public String getServerName() { return serverName; } /** * Returns true if the server is being shutdown. * * @return true if the server is being down, false otherwise. */ public boolean isShuttingDown() { return shuttingDown; } /** * Returns if the server is running in standalone mode. * * @return true if the server is running in standalone mode, false otherwise. */ public boolean isStandAlone() { boolean standalone; try { standalone = Class .forName("org.androidpn.server.starter.ServerStarter") != null; } catch (ClassNotFoundException e) { standalone = false; } return standalone; } /* private void locateServer() throws FileNotFoundException { Context context = new WebAppContext(contexts, homeDir + File.separator + ); String baseDir = "F:/JavaÈí¼þ/Ó¦ÓÃÈí¼þ/Tomcat 6.0/webapps/ROOT"; log.debug("base.dir=" + baseDir); if (serverHomeDir == null) { try { File confDir = new File(baseDir, "conf"); if (confDir.exists()) { serverHomeDir = confDir.getParentFile().getCanonicalPath(); } } catch (FileNotFoundException fe) { // Ignore } catch (IOException ie) { // Ignore } } if (serverHomeDir == null) { System.err.println("Could not locate home."); throw new FileNotFoundException(); } else { Config.setProperty("server.home.dir", serverHomeDir); log.debug("server.home.dir=" + serverHomeDir); } }*/ private void shutdownServer() { shuttingDown = true; // Close all connections SessionManager.getInstance().closeAllSessions(); log.info("XmppServer stopped"); } private class ShutdownHookThread extends Thread { public void run() { shutdownServer(); log.info("Server halted"); System.err.println("Server halted"); } } private class ShutdownThread extends Thread { public void run() { try { Thread.sleep(5000); System.exit(0); } catch (InterruptedException e) { // Ignore } } } }
5,878
0.592107
0.586324
205
27.678049
23.505344
87
false
false
0
0
0
0
0
0
0.370732
false
false
4
0a58996ea01ac00290f8843c99b83cb4c21baa48
17,669,495,498,910
f00752ac80df4f092b3ad21aac2f7ad92018918a
/src/main/java/rozetkaPages/HomePage.java
9d5bbbca0337c374ea990949ad715f0092319406
[]
no_license
OlehKrutsko/rozetkaFirstStep
https://github.com/OlehKrutsko/rozetkaFirstStep
eef3878fef741c11424879638199541fe413c0e1
ada3925be77ff2bdd6140f5cccdf30a78344c40e
refs/heads/master
2021-01-21T18:24:46.396000
2017-05-24T12:39:00
2017-05-24T12:39:00
92,043,503
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rozetkaPages; import static org.testng.Assert.assertTrue; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class HomePage extends BaseDriver { private final String homepage = "http://rozetka.com.ua/"; public HomePage() { super(); } public ResultPage search(String text) { WebElement findElement = getDriver().findElement(By.xpath(".//*[@id='rz-search']/form/div[1]/div[2]/input")); findElement.sendKeys(text); findElement.submit(); return new ResultPage(getDriver()); } public boolean isOpen() { return getDriver().getCurrentUrl().equals(homepage); } public void assertIsOpen() { assertTrue(isOpen(), "Home Page isn't open"); } }
UTF-8
Java
701
java
HomePage.java
Java
[]
null
[]
package rozetkaPages; import static org.testng.Assert.assertTrue; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class HomePage extends BaseDriver { private final String homepage = "http://rozetka.com.ua/"; public HomePage() { super(); } public ResultPage search(String text) { WebElement findElement = getDriver().findElement(By.xpath(".//*[@id='rz-search']/form/div[1]/div[2]/input")); findElement.sendKeys(text); findElement.submit(); return new ResultPage(getDriver()); } public boolean isOpen() { return getDriver().getCurrentUrl().equals(homepage); } public void assertIsOpen() { assertTrue(isOpen(), "Home Page isn't open"); } }
701
0.714693
0.71184
33
20.242424
24.655235
111
false
false
0
0
0
0
0
0
1.121212
false
false
4
fa257b187e9aeb342d94b3184828a6838865425d
592,705,512,016
c9c5345a9c9dcf973e8d21ee7dbd6458456ef80b
/POD-6/Audit-Management-Authentication/Audit-Severity/src/main/java/com/cts/AuditSeverity/pojo/AuditDetails.java
28688772fff7902873bbd746face87b2e919d0b2
[]
no_license
CDE20/MFPE_Projects
https://github.com/CDE20/MFPE_Projects
b66ca9bac32444724d73ed8ac31e48ffaa95f29f
6365d39d6d9116824cfef57dbc1d0d892e7b6283
refs/heads/main
2023-03-27T07:50:39.878000
2021-03-29T16:47:43
2021-03-29T16:47:43
352,068,783
6
22
null
false
2021-03-28T07:49:50
2021-03-27T12:35:42
2021-03-27T16:13:30
2021-03-28T07:49:16
5,839
0
1
2
Java
false
false
package com.cts.AuditSeverity.pojo; import java.util.Date; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * This POJO class is for AuditDetails * */ @Data @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class AuditDetails { /** * Variable auditType is used to store the type of Audit */ private String auditType; /** * Variable auditDate is used to store the Audit Date */ private Date auditDate; }
UTF-8
Java
555
java
AuditDetails.java
Java
[]
null
[]
package com.cts.AuditSeverity.pojo; import java.util.Date; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * This POJO class is for AuditDetails * */ @Data @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class AuditDetails { /** * Variable auditType is used to store the type of Audit */ private String auditType; /** * Variable auditDate is used to store the Audit Date */ private Date auditDate; }
555
0.704504
0.704504
31
15.903226
15.559158
57
false
false
0
0
0
0
0
0
0.645161
false
false
4
e78e1d0a1b35adfaf07f919256b19edd10b2b1de
12,936,441,563,462
3b73f69c23916225b27e4b6981a3551651f3e952
/src/main/java/org/resource/constant/FileSuffixName.java
3aaa58df3449cf9c76e94a7b9a0b5fce6a292ee7
[]
no_license
GitHubProgrammerShui/EasyResource
https://github.com/GitHubProgrammerShui/EasyResource
346770c35216e8a0423524cf1748c80177dadc1b
f7d397f8671c50d98fd785769bc765bb95601a12
refs/heads/master
2021-01-01T17:08:58.875000
2017-07-22T06:51:31
2017-07-22T06:51:31
98,012,263
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.resource.constant; public class FileSuffixName { /** * 将一个名称转换成标准的后缀名 * @param suffix 自定义后缀名 * @return 返回标准的带点的后缀名 */ public final static String createSuffix(String suffix){ suffix=suffix.toLowerCase(); if(suffix.startsWith(".")){ return suffix; }else{ return "."+suffix; } } /** * 返回一个后缀名的真实名称(将点去掉) * @param suffix 该名称一般传入FileSuffixName对象中的常量属性 * @return 传入的后缀名的真实名称 */ public final static String valueOf(String suffix){ if(suffix.startsWith(".")){ return suffix.substring(1); }else{ return suffix; } } }
UTF-8
Java
747
java
FileSuffixName.java
Java
[]
null
[]
package org.resource.constant; public class FileSuffixName { /** * 将一个名称转换成标准的后缀名 * @param suffix 自定义后缀名 * @return 返回标准的带点的后缀名 */ public final static String createSuffix(String suffix){ suffix=suffix.toLowerCase(); if(suffix.startsWith(".")){ return suffix; }else{ return "."+suffix; } } /** * 返回一个后缀名的真实名称(将点去掉) * @param suffix 该名称一般传入FileSuffixName对象中的常量属性 * @return 传入的后缀名的真实名称 */ public final static String valueOf(String suffix){ if(suffix.startsWith(".")){ return suffix.substring(1); }else{ return suffix; } } }
747
0.646566
0.644891
29
18.586206
15.347733
56
false
false
0
0
0
0
0
0
1.586207
false
false
4
f0cb6e3c42e0977cd43423f916d26150ff5ead1b
25,056,839,266,041
5e3d97643974ec7917ac2cbb9e574715601b7480
/moonlib/src/main/java/com/moon/lib/tools/BaseTools.java
090448a813704170307eb938b53becaea2221eb3
[]
no_license
istaru/PlayApp
https://github.com/istaru/PlayApp
1b5abb0b3056c3bf899d5193b1df03c3918613b5
098ac2792cdde30ab54f2ef2d41d755451ec1dec
refs/heads/master
2020-04-01T12:32:43.035000
2018-12-10T06:11:52
2018-12-10T06:11:59
153,212,378
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.moon.lib.tools; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Rect; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Environment; import android.text.ClipboardManager; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import java.io.File; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.Timer; import java.util.TimerTask; /** * 工具类 * Created by Moon on 2018/6/22. */ public class BaseTools { /** * 获取屏幕的宽度 */ public final static int getWindowsWidth(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; } /** * 获取屏幕的高度 */ public final static int getWindowsHeight(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; } /** * 判断是否有网络 * * @return 返回值 */ public static boolean isNetworkConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); @SuppressLint("MissingPermission") NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } } return false; } /** * px转化为dp */ public final static float pxChangeDp(float pxValue) { float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } /** * dp转化为px */ public final static float dpChangePx(float dpValue) { float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * 两位数 * * @param num * @return */ public static String double2Str(double num) { DecimalFormat df = new DecimalFormat("######0.00"); return df.format(num); } //对平台利率的数据处理 public static String dealRateString(String rate) { if (rate.contains("-")) { String strs[] = rate.split("-"); StringBuffer stringBuffer = new StringBuffer(""); for (String str : strs) { stringBuffer.append(double2Str(Double.valueOf(str.replace("%", "").trim()))+"%"); stringBuffer.append("-"); } if (stringBuffer.toString().endsWith("-")){ stringBuffer.deleteCharAt(stringBuffer.toString().length()-1); } return stringBuffer.toString(); } else { String str = rate.replace("%", ""); return double2Str(Double.valueOf(str))+"%"; } } /** * 设置添加屏幕的背景透明度 * * @param bgAlpha 屏幕透明度0.0-1.0 1表示完全不透明 */ public static void setBackgroundAlpha(Activity context, float bgAlpha) { WindowManager.LayoutParams lp = context.getWindow().getAttributes(); lp.alpha = bgAlpha; context.getWindow().setAttributes(lp); } /** * 复制文本 * * @param context * @param content * @return */ public static boolean copyText(Activity context, String content) { try { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(content); return true; } catch (Exception e) { return false; } } /** * 打开输入法 */ public final static void openInput(final EditText view) { Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } }, 500); } /** * 关闭输入法 */ public final static void closeInput(Activity context, EditText view) { InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 创建文件夹 * * @param fileName 文件夹的名称 * @return */ public static File makeFile(String fileName) { File appDir; if (!TextUtils.equals(fileName, "")) { appDir = new File(Environment.getExternalStorageDirectory(), Constants.FILE_NAME + "/" + fileName); } else { appDir = new File(Environment.getExternalStorageDirectory(), Constants.FILE_NAME); } if (!appDir.exists()) { appDir.mkdir(); } return appDir; } /** * 获取文件夹大小 * * @param file File实例 * @return long */ public static long getFolderSize(java.io.File file) { long size = 0; try { java.io.File[] fileList = file.listFiles(); for (int i = 0; i < fileList.length; i++) { if (fileList[i].isDirectory()) { size = size + getFolderSize(fileList[i]); } else { size = size + fileList[i].length(); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return size; } /** * 格式化单位 * * @param size * @return */ public static String getFormatSize(double size) { double kiloByte = size / 1024; if (kiloByte < 1) { return size + "B"; } double megaByte = kiloByte / 1024; if (megaByte < 1) { BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "KB"; } double gigaByte = megaByte / 1024; if (gigaByte < 1) { BigDecimal result2 = new BigDecimal(Double.toString(megaByte)); return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB"; } double teraBytes = gigaByte / 1024; if (teraBytes < 1) { BigDecimal result3 = new BigDecimal(Double.toString(gigaByte)); return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "GB"; } BigDecimal result4 = new BigDecimal(teraBytes); return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "TB"; } /** * 删除指定目录下文件及目录 * * @param filePath * @param deleteThisPath * @return */ public static void deleteFolderFile(String filePath, boolean deleteThisPath) { if (!TextUtils.isEmpty(filePath)) { try { File file = new File(filePath); if (file.isDirectory()) {// 处理目录 File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteFolderFile(files[i].getAbsolutePath(), true); } } if (deleteThisPath) { if (!file.isDirectory()) {// 如果是文件,删除 file.delete(); } else {// 目录 if (file.listFiles().length == 0) {// 目录下没有文件或者目录,删除 file.delete(); } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * 判断当前应用是否是debug状态 * * @param context * @return */ public static boolean isApkInDebug(Context context) { try { ApplicationInfo info = context.getApplicationInfo(); return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } catch (Exception e) { return false; } } /** * 判断权限是否获取 * * @param context * @param permissions * @return */ public static boolean checkPermission(Activity context, String[] permissions) { boolean flag = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//Android6.0以上的系统 for (int i = 0; i < permissions.length; i++) { if (context.checkSelfPermission(permissions[i]) != PackageManager.PERMISSION_GRANTED) {//还没有获取权限 flag = false; break; } else { flag = true; } } } return flag; } }
UTF-8
Java
9,831
java
BaseTools.java
Java
[ { "context": "ort java.util.TimerTask;\n\n/**\n * 工具类\n * Created by Moon on 2018/6/22.\n */\n\npublic class BaseTools {\n\n ", "end": 933, "score": 0.9327049255371094, "start": 929, "tag": "NAME", "value": "Moon" } ]
null
[]
package com.moon.lib.tools; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Rect; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Environment; import android.text.ClipboardManager; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import java.io.File; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.Timer; import java.util.TimerTask; /** * 工具类 * Created by Moon on 2018/6/22. */ public class BaseTools { /** * 获取屏幕的宽度 */ public final static int getWindowsWidth(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; } /** * 获取屏幕的高度 */ public final static int getWindowsHeight(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; } /** * 判断是否有网络 * * @return 返回值 */ public static boolean isNetworkConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); @SuppressLint("MissingPermission") NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } } return false; } /** * px转化为dp */ public final static float pxChangeDp(float pxValue) { float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } /** * dp转化为px */ public final static float dpChangePx(float dpValue) { float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * 两位数 * * @param num * @return */ public static String double2Str(double num) { DecimalFormat df = new DecimalFormat("######0.00"); return df.format(num); } //对平台利率的数据处理 public static String dealRateString(String rate) { if (rate.contains("-")) { String strs[] = rate.split("-"); StringBuffer stringBuffer = new StringBuffer(""); for (String str : strs) { stringBuffer.append(double2Str(Double.valueOf(str.replace("%", "").trim()))+"%"); stringBuffer.append("-"); } if (stringBuffer.toString().endsWith("-")){ stringBuffer.deleteCharAt(stringBuffer.toString().length()-1); } return stringBuffer.toString(); } else { String str = rate.replace("%", ""); return double2Str(Double.valueOf(str))+"%"; } } /** * 设置添加屏幕的背景透明度 * * @param bgAlpha 屏幕透明度0.0-1.0 1表示完全不透明 */ public static void setBackgroundAlpha(Activity context, float bgAlpha) { WindowManager.LayoutParams lp = context.getWindow().getAttributes(); lp.alpha = bgAlpha; context.getWindow().setAttributes(lp); } /** * 复制文本 * * @param context * @param content * @return */ public static boolean copyText(Activity context, String content) { try { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(content); return true; } catch (Exception e) { return false; } } /** * 打开输入法 */ public final static void openInput(final EditText view) { Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } }, 500); } /** * 关闭输入法 */ public final static void closeInput(Activity context, EditText view) { InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 创建文件夹 * * @param fileName 文件夹的名称 * @return */ public static File makeFile(String fileName) { File appDir; if (!TextUtils.equals(fileName, "")) { appDir = new File(Environment.getExternalStorageDirectory(), Constants.FILE_NAME + "/" + fileName); } else { appDir = new File(Environment.getExternalStorageDirectory(), Constants.FILE_NAME); } if (!appDir.exists()) { appDir.mkdir(); } return appDir; } /** * 获取文件夹大小 * * @param file File实例 * @return long */ public static long getFolderSize(java.io.File file) { long size = 0; try { java.io.File[] fileList = file.listFiles(); for (int i = 0; i < fileList.length; i++) { if (fileList[i].isDirectory()) { size = size + getFolderSize(fileList[i]); } else { size = size + fileList[i].length(); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return size; } /** * 格式化单位 * * @param size * @return */ public static String getFormatSize(double size) { double kiloByte = size / 1024; if (kiloByte < 1) { return size + "B"; } double megaByte = kiloByte / 1024; if (megaByte < 1) { BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "KB"; } double gigaByte = megaByte / 1024; if (gigaByte < 1) { BigDecimal result2 = new BigDecimal(Double.toString(megaByte)); return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB"; } double teraBytes = gigaByte / 1024; if (teraBytes < 1) { BigDecimal result3 = new BigDecimal(Double.toString(gigaByte)); return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "GB"; } BigDecimal result4 = new BigDecimal(teraBytes); return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "TB"; } /** * 删除指定目录下文件及目录 * * @param filePath * @param deleteThisPath * @return */ public static void deleteFolderFile(String filePath, boolean deleteThisPath) { if (!TextUtils.isEmpty(filePath)) { try { File file = new File(filePath); if (file.isDirectory()) {// 处理目录 File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteFolderFile(files[i].getAbsolutePath(), true); } } if (deleteThisPath) { if (!file.isDirectory()) {// 如果是文件,删除 file.delete(); } else {// 目录 if (file.listFiles().length == 0) {// 目录下没有文件或者目录,删除 file.delete(); } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * 判断当前应用是否是debug状态 * * @param context * @return */ public static boolean isApkInDebug(Context context) { try { ApplicationInfo info = context.getApplicationInfo(); return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } catch (Exception e) { return false; } } /** * 判断权限是否获取 * * @param context * @param permissions * @return */ public static boolean checkPermission(Activity context, String[] permissions) { boolean flag = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//Android6.0以上的系统 for (int i = 0; i < permissions.length; i++) { if (context.checkSelfPermission(permissions[i]) != PackageManager.PERMISSION_GRANTED) {//还没有获取权限 flag = false; break; } else { flag = true; } } } return flag; } }
9,831
0.566994
0.55992
311
29.453377
27.28998
134
false
false
0
0
0
0
0
0
0.405145
false
false
4
dde9a4f6fbdcbf08bd81a694e7bf4058a8d6dc1d
2,327,872,321,450
ea1f37b2948b7a085563080cc53a6f32831f034a
/Extract/Project/PIMDSWEB/src/java/Login.java
685fdc5ac7f45c32c132b582b91078e4e49c1eba
[]
no_license
0code0/JAVA
https://github.com/0code0/JAVA
7ce4673779fa2e33aa306904989b9efa5212a59d
b0f0e4b924ed741460945a625a3bde41de8fb48f
refs/heads/master
2021-01-24T20:02:09.715000
2018-02-28T07:33:29
2018-02-28T07:33:29
123,243,855
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import BusinessObject.User; import java.io.IOException; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author jaswinder */ public class Login extends HttpServlet { HttpSession httpsession; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); httpsession = request.getSession(); /** BusinessObject.User user = new User(); String Name = request.getParameter("username"); String Pass = request.getParameter("pass"); String UserName = ""; String Email = ""; String MobileNo = ""; String SeatNo = ""; String ExtentionNo = ""; String FullName = ""; if ((!Name.equals("")) && (!Pass.equals(""))) { String attributeGet = " "; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://ldap.dlh.st.com:389/"); DirContext ctx = null; try { ctx = new InitialDirContext(env); } catch (NamingException ex) { response.sendRedirect("/PIMDSWEB/index.jsp"); } if (ctx != null) { try { String UId = "uid=" + Name; SearchControls searchControl = new SearchControls(); searchControl.setSearchScope(2); NamingEnumeration namingEnumeration = ctx.search("dc=st,dc=com", UId, searchControl); while (namingEnumeration.hasMore()) { SearchResult searchResult = (SearchResult) namingEnumeration.next(); Attributes attributes = searchResult.getAttributes(); Attribute attribute = attributes.get("st-eduid"); attributeGet = (String) attribute.get(); Hashtable hashtable = new Hashtable(); hashtable.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory"); hashtable.put("java.naming.provider.url", "ldap://ldap.dlh.st.com:389"); hashtable.put("java.naming.security.principal", ("st-eduid=" + attributeGet + ",ou=people,dc=st,dc=com")); hashtable.put("java.naming.security.credentials", Pass); hashtable.put("java.naming.security.authentication", "simple"); try { InitialDirContext initialdircontext = new InitialDirContext(hashtable); SearchControls searchcontrols = new SearchControls(); searchcontrols.setSearchScope(2); String dcDetail = "dc=st,dc=com"; NamingEnumeration namingenumeration = initialdircontext.search(dcDetail, UId, searchcontrols); SearchResult searchresults = (SearchResult) namingenumeration.next(); Attributes attributess = searchresults.getAttributes(); Attribute mail = attributess.get("mail"); if (mail != null) { Email = "" + mail.get(); } Attribute uid = attributess.get("uid"); if (uid != null) { UserName = "" + uid.get(); } Attribute givenname = attributess.get("cn"); if (givenname != null) { FullName = "" + givenname.get(); } Attribute mobile = attributess.get("mobile"); if (mobile != null) { MobileNo = "" + mobile.get(); MobileNo = MobileNo.substring(4,MobileNo.length()); } user = BusinessLogic.UserBL.IsValidUser(UserName); if (user != null) { httpsession.setAttribute("UserName", UserName); httpsession.setAttribute("Email", Email); httpsession.setAttribute("Role", user.getRole()); httpsession.setAttribute("Image", user.getUrl()); httpsession.setAttribute("Id", user.getId()); httpsession.setAttribute("Name", FullName); httpsession.setAttribute("FromEmail", "jaswinder.singh@sgp.st.com"); httpsession.setAttribute("Password", "aezakmi0786@"); response.sendRedirect("/PIMDSWEB/DeshBoard.jsp"); } else { httpsession.setAttribute("UserName", UserName); httpsession.setAttribute("Email", Email); httpsession.setAttribute("Name", FullName); response.sendRedirect("/PIMDSWEB/OtherUsers/OtherUser.jsp"); } } catch (NamingException namingexception) { response.sendRedirect("/PIMDSWEB/index.jsp?UserNameAndPassword=InValid"); } } } catch (NamingException ex) { response.sendRedirect("/PIMDSWEB/index.jsp?UserNameAndPassword=InValid"); } } } else { response.sendRedirect("/PIMDSWEB/index.jsp"); } */ response.sendRedirect("/PIMDSWEB/index.jsp"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } }
UTF-8
Java
7,904
java
Login.java
Java
[ { "context": "javax.servlet.http.HttpSession;\n\n/**\n *\n * @author jaswinder\n */\npublic class Login extends HttpServlet {\n\n ", "end": 877, "score": 0.9995798468589783, "start": 868, "tag": "USERNAME", "value": "jaswinder" }, { "context": "er();\n String Name = request....
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import BusinessObject.User; import java.io.IOException; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author jaswinder */ public class Login extends HttpServlet { HttpSession httpsession; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); httpsession = request.getSession(); /** BusinessObject.User user = new User(); String Name = request.getParameter("username"); String Pass = request.getParameter("pass"); String UserName = ""; String Email = ""; String MobileNo = ""; String SeatNo = ""; String ExtentionNo = ""; String FullName = ""; if ((!Name.equals("")) && (!Pass.equals(""))) { String attributeGet = " "; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://ldap.dlh.st.com:389/"); DirContext ctx = null; try { ctx = new InitialDirContext(env); } catch (NamingException ex) { response.sendRedirect("/PIMDSWEB/index.jsp"); } if (ctx != null) { try { String UId = "uid=" + Name; SearchControls searchControl = new SearchControls(); searchControl.setSearchScope(2); NamingEnumeration namingEnumeration = ctx.search("dc=st,dc=com", UId, searchControl); while (namingEnumeration.hasMore()) { SearchResult searchResult = (SearchResult) namingEnumeration.next(); Attributes attributes = searchResult.getAttributes(); Attribute attribute = attributes.get("st-eduid"); attributeGet = (String) attribute.get(); Hashtable hashtable = new Hashtable(); hashtable.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory"); hashtable.put("java.naming.provider.url", "ldap://ldap.dlh.st.com:389"); hashtable.put("java.naming.security.principal", ("st-eduid=" + attributeGet + ",ou=people,dc=st,dc=com")); hashtable.put("java.naming.security.credentials", Pass); hashtable.put("java.naming.security.authentication", "simple"); try { InitialDirContext initialdircontext = new InitialDirContext(hashtable); SearchControls searchcontrols = new SearchControls(); searchcontrols.setSearchScope(2); String dcDetail = "dc=st,dc=com"; NamingEnumeration namingenumeration = initialdircontext.search(dcDetail, UId, searchcontrols); SearchResult searchresults = (SearchResult) namingenumeration.next(); Attributes attributess = searchresults.getAttributes(); Attribute mail = attributess.get("mail"); if (mail != null) { Email = "" + mail.get(); } Attribute uid = attributess.get("uid"); if (uid != null) { UserName = "" + uid.get(); } Attribute givenname = attributess.get("cn"); if (givenname != null) { FullName = "" + givenname.get(); } Attribute mobile = attributess.get("mobile"); if (mobile != null) { MobileNo = "" + mobile.get(); MobileNo = MobileNo.substring(4,MobileNo.length()); } user = BusinessLogic.UserBL.IsValidUser(UserName); if (user != null) { httpsession.setAttribute("UserName", UserName); httpsession.setAttribute("Email", Email); httpsession.setAttribute("Role", user.getRole()); httpsession.setAttribute("Image", user.getUrl()); httpsession.setAttribute("Id", user.getId()); httpsession.setAttribute("Name", FullName); httpsession.setAttribute("FromEmail", "<EMAIL>"); httpsession.setAttribute("Password", "<PASSWORD>@"); response.sendRedirect("/PIMDSWEB/DeshBoard.jsp"); } else { httpsession.setAttribute("UserName", UserName); httpsession.setAttribute("Email", Email); httpsession.setAttribute("Name", FullName); response.sendRedirect("/PIMDSWEB/OtherUsers/OtherUser.jsp"); } } catch (NamingException namingexception) { response.sendRedirect("/PIMDSWEB/index.jsp?UserNameAndPassword=InValid"); } } } catch (NamingException ex) { response.sendRedirect("/PIMDSWEB/index.jsp?UserNameAndPassword=InValid"); } } } else { response.sendRedirect("/PIMDSWEB/index.jsp"); } */ response.sendRedirect("/PIMDSWEB/index.jsp"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } }
7,884
0.542257
0.540486
193
39.953369
32.243614
130
false
false
0
0
0
0
0
0
0.65285
false
false
4
08a9e6d14a740358995d77c570d3bbb9e9fac16a
28,441,273,498,356
dd76d0b680549acb07278b2ecd387cb05ec84d64
/divestory-CFR/com/google/android/material/transformation/FabTransformationScrimBehavior.java
6b02b223c367932bc13622fefc3f922d0bc09205
[]
no_license
ryangardner/excursion-decompiling
https://github.com/ryangardner/excursion-decompiling
43c99a799ce75a417e636da85bddd5d1d9a9109c
4b6d11d6f118cdab31328c877c268f3d56b95c58
refs/heads/master
2023-07-02T13:32:30.872000
2021-08-09T19:33:37
2021-08-09T19:33:37
299,657,052
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Decompiled with CFR <Could not determine version>. * * Could not load the following classes: * android.animation.Animator * android.animation.Animator$AnimatorListener * android.animation.AnimatorListenerAdapter * android.animation.AnimatorSet * android.animation.ObjectAnimator * android.content.Context * android.util.AttributeSet * android.util.Property * android.view.MotionEvent * android.view.View */ package com.google.android.material.transformation; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.util.AttributeSet; import android.util.Property; import android.view.MotionEvent; import android.view.View; import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.animation.AnimatorSetCompat; import com.google.android.material.animation.MotionTiming; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.transformation.ExpandableTransformationBehavior; import java.util.ArrayList; import java.util.List; @Deprecated public class FabTransformationScrimBehavior extends ExpandableTransformationBehavior { public static final long COLLAPSE_DELAY = 0L; public static final long COLLAPSE_DURATION = 150L; public static final long EXPAND_DELAY = 75L; public static final long EXPAND_DURATION = 150L; private final MotionTiming collapseTiming = new MotionTiming(0L, 150L); private final MotionTiming expandTiming = new MotionTiming(75L, 150L); public FabTransformationScrimBehavior() { } public FabTransformationScrimBehavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); } private void createScrimAnimation(View view, boolean bl, boolean bl2, List<Animator> list, List<Animator.AnimatorListener> object) { object = bl ? this.expandTiming : this.collapseTiming; if (bl) { if (!bl2) { view.setAlpha(0.0f); } view = ObjectAnimator.ofFloat((Object)view, (Property)View.ALPHA, (float[])new float[]{1.0f}); } else { view = ObjectAnimator.ofFloat((Object)view, (Property)View.ALPHA, (float[])new float[]{0.0f}); } ((MotionTiming)object).apply((Animator)view); list.add((Animator)view); } @Override public boolean layoutDependsOn(CoordinatorLayout coordinatorLayout, View view, View view2) { return view2 instanceof FloatingActionButton; } @Override protected AnimatorSet onCreateExpandedStateChangeAnimation(View object, final View view, final boolean bl, boolean bl2) { object = new ArrayList(); this.createScrimAnimation(view, bl, bl2, (List<Animator>)object, new ArrayList<Animator.AnimatorListener>()); AnimatorSet animatorSet = new AnimatorSet(); AnimatorSetCompat.playTogether(animatorSet, (List<Animator>)object); animatorSet.addListener((Animator.AnimatorListener)new AnimatorListenerAdapter(){ public void onAnimationEnd(Animator animator2) { if (bl) return; view.setVisibility(4); } public void onAnimationStart(Animator animator2) { if (!bl) return; view.setVisibility(0); } }); return animatorSet; } @Override public boolean onTouchEvent(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) { return super.onTouchEvent(coordinatorLayout, view, motionEvent); } }
UTF-8
Java
3,711
java
FabTransformationScrimBehavior.java
Java
[]
null
[]
/* * Decompiled with CFR <Could not determine version>. * * Could not load the following classes: * android.animation.Animator * android.animation.Animator$AnimatorListener * android.animation.AnimatorListenerAdapter * android.animation.AnimatorSet * android.animation.ObjectAnimator * android.content.Context * android.util.AttributeSet * android.util.Property * android.view.MotionEvent * android.view.View */ package com.google.android.material.transformation; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.util.AttributeSet; import android.util.Property; import android.view.MotionEvent; import android.view.View; import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.animation.AnimatorSetCompat; import com.google.android.material.animation.MotionTiming; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.transformation.ExpandableTransformationBehavior; import java.util.ArrayList; import java.util.List; @Deprecated public class FabTransformationScrimBehavior extends ExpandableTransformationBehavior { public static final long COLLAPSE_DELAY = 0L; public static final long COLLAPSE_DURATION = 150L; public static final long EXPAND_DELAY = 75L; public static final long EXPAND_DURATION = 150L; private final MotionTiming collapseTiming = new MotionTiming(0L, 150L); private final MotionTiming expandTiming = new MotionTiming(75L, 150L); public FabTransformationScrimBehavior() { } public FabTransformationScrimBehavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); } private void createScrimAnimation(View view, boolean bl, boolean bl2, List<Animator> list, List<Animator.AnimatorListener> object) { object = bl ? this.expandTiming : this.collapseTiming; if (bl) { if (!bl2) { view.setAlpha(0.0f); } view = ObjectAnimator.ofFloat((Object)view, (Property)View.ALPHA, (float[])new float[]{1.0f}); } else { view = ObjectAnimator.ofFloat((Object)view, (Property)View.ALPHA, (float[])new float[]{0.0f}); } ((MotionTiming)object).apply((Animator)view); list.add((Animator)view); } @Override public boolean layoutDependsOn(CoordinatorLayout coordinatorLayout, View view, View view2) { return view2 instanceof FloatingActionButton; } @Override protected AnimatorSet onCreateExpandedStateChangeAnimation(View object, final View view, final boolean bl, boolean bl2) { object = new ArrayList(); this.createScrimAnimation(view, bl, bl2, (List<Animator>)object, new ArrayList<Animator.AnimatorListener>()); AnimatorSet animatorSet = new AnimatorSet(); AnimatorSetCompat.playTogether(animatorSet, (List<Animator>)object); animatorSet.addListener((Animator.AnimatorListener)new AnimatorListenerAdapter(){ public void onAnimationEnd(Animator animator2) { if (bl) return; view.setVisibility(4); } public void onAnimationStart(Animator animator2) { if (!bl) return; view.setVisibility(0); } }); return animatorSet; } @Override public boolean onTouchEvent(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) { return super.onTouchEvent(coordinatorLayout, view, motionEvent); } }
3,711
0.721638
0.712476
97
37.247421
31.48753
136
false
false
0
0
0
0
0
0
0.701031
false
false
4
02eaafbc2b7644ea20fed3cba1e49ad6538093ca
936,302,918,980
a8455483127253f8601418c55099c4c923ea1745
/Projects/project3/Water.java
43dacaa7925863d2a58e543903cece7ced4eab7a
[]
no_license
kurigohan/CSX-RIT-2013
https://github.com/kurigohan/CSX-RIT-2013
1e49a38350d088c5382881f3ef52207336f28ecb
a5726b30573a0e1dd3a8b6e06959ae3797106a3b
refs/heads/master
2021-01-01T08:55:45.326000
2014-03-28T22:07:59
2014-03-28T22:07:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * The Water class represents a water puzzle. The water puzzle poses the following problem: * * Assume you are at a lake and have a collection of empty jugs that can each hold different * amounts of water. The goal is to get a desired amount of water in any one of the jugs using * the shortest number of steps. A single step consists of one of the following actions: * * - Fill a single jug up to complete capacity by submerging it in the lake. * - Empty a single jug by dumping all water in the jug into the lake. * - Pour the contents of any one jug into another jug, without exceeding the capacity of the * jug being poured into. * * @author Andy Nguyen */ import java.util.ArrayList; public class Water implements Puzzle<ArrayList<Integer>>{ private int goalAmount = 0; private ArrayList<Integer> jugsCapacity = null; /** * Constructor for Water. * * @param myAmount goal amount * @param myJugs list of jugs */ public Water( int myAmount, ArrayList<Integer> myJugs ) { goalAmount = myAmount; jugsCapacity = myJugs; } /** * @return the starting jugs config (all jugs empty) */ public ArrayList<Integer> getStart(){ ArrayList<Integer> start = new ArrayList<Integer>( jugsCapacity.size() ); for( int i = 0; i < jugsCapacity.size(); ++i ) { start.add( 0 ); } return start; } /** * @return true if config contains the goal */ public boolean isGoal( ArrayList<Integer> config ){ return config.indexOf( goalAmount ) > -1 ? true : false ; } /** * Generate and return all direct neighbors for the given jugs config. * * * @param config puzzle config * @return the list of neighbors */ public ArrayList<ArrayList<Integer>> getNeighbors( ArrayList<Integer> config ) { // list of neighbor configs ArrayList<ArrayList<Integer>> neighbors = new ArrayList<ArrayList<Integer>>(); ArrayList<Integer> possibleConfig; int currentJug; for( int i = 0; i < config.size(); ++i ) { currentJug = config.get( i ); if( currentJug > 0 ) { // **** emptying the jug **** // restore the config to the original to the original given config possibleConfig = new ArrayList<Integer>( config ); possibleConfig.set( i, 0 ); neighbors.add( possibleConfig ); // **** pouring one jug into another jug **** int total; // total water amount after pouring int limit; // max capacity of the receiving jug int receiver; // current capacity of receiving jug int pourer; // capacity of pouring jug for( int j = 0; j < config.size(); ++j ) { if( j != i ) { // skip over the current jug pourer = currentJug; // restore the config to the original given config possibleConfig = new ArrayList<Integer>( config ); limit = jugsCapacity.get( j ); receiver = possibleConfig.get( j ); // check if the jug to fill is full if( receiver < limit ) { total = pourer + receiver; // check if pouring causes jug to exceed its capacity if( total > limit ) { receiver = limit; pourer = total - limit; } else{ receiver = total; pourer = 0; } possibleConfig.set( j, receiver ); possibleConfig.set( i, pourer ); neighbors.add( possibleConfig ); } // end inner foor loop } } // end outer for loop } if( currentJug < jugsCapacity.get(i) ) { // **** filling the jug **** possibleConfig = new ArrayList<Integer>( config ); possibleConfig.set( i, jugsCapacity.get( i ) ); neighbors.add( possibleConfig ); } } // end for loop that interates through the config return neighbors; } /** * Prints the solution to the puzzle. * * @param solution solution to print */ public void printSolution( ArrayList<ArrayList<Integer>> solution ) { int stepCount = 0; // step counter String str = ""; if( solution.size() > 0 ) { for( ArrayList<Integer> s : solution ) { str += "Step " + stepCount++ + ": "; for( Integer i : s ) { str += i + " "; } str += "\n"; } str = str.trim(); } else { str = "No solution."; } System.out.println( str ); } /** * @return string containing goalAmount and jugsCapacity. */ public String toString() { return "Goal: " + goalAmount + "\nJugs: " + jugsCapacity; } /** * Main method that gets arguments from the user and solves the puzzle. * * @param args command line arguments */ public static void main( String args[] ) throws NumberFormatException{ if( args.length > 1 ) { try{ int goal = Integer.parseInt( args[0] ); // create list of jugs from the command arguments ArrayList<Integer> jugs = new ArrayList<Integer>( args.length ); for( int i = 1; i < args.length; ++i ) { jugs.add( Integer.parseInt( args[i] ) ); } Water puzzle = new Water( goal, jugs ); Solver<ArrayList<Integer>> solver = new Solver<ArrayList<Integer>>( puzzle ); // find and print solution puzzle.printSolution( solver.solve() ); } catch( NumberFormatException e ) { System.err.println( "Invalid arguments." ); } } else { System.err.println( "Usage: java Water amount jug1 jug2 ..." ); } } } /* * Water.java * * Version: * $Id: Water.java,v 1.8 2013/11/23 01:18:44 andy Exp andy $ * * Revisions: * $Log: Water.java,v $ * Revision 1.8 2013/11/23 01:18:44 andy * Changed printSolution * * Revision 1.7 2013/11/23 00:25:40 andy * Changed some methods for efficiency * * Revision 1.6 2013/11/22 22:11:07 andy * Added printSolution and toString method. * * Revision 1.5 2013/11/22 21:51:10 andy * implement isGoal method * * Revision 1.4 2013/11/22 21:47:20 andy * testing * * Revision 1.3 2013/11/22 21:45:07 andy * Implemented methods * * Revision 1.2 2013/11/22 19:48:40 andy * Skeleton * * Revision 1.1 2013/11/21 20:59:46 andy * Initial revision * * */
UTF-8
Java
7,350
java
Water.java
Java
[ { "context": "of the \n * jug being poured into.\n *\n * @author Andy Nguyen\n */\n\nimport java.util.ArrayList;\n\npublic class Wa", "end": 684, "score": 0.9996696710586548, "start": 673, "tag": "NAME", "value": "Andy Nguyen" }, { "context": " \n * $Id: Water.java,v 1.8 2013/...
null
[]
/** * The Water class represents a water puzzle. The water puzzle poses the following problem: * * Assume you are at a lake and have a collection of empty jugs that can each hold different * amounts of water. The goal is to get a desired amount of water in any one of the jugs using * the shortest number of steps. A single step consists of one of the following actions: * * - Fill a single jug up to complete capacity by submerging it in the lake. * - Empty a single jug by dumping all water in the jug into the lake. * - Pour the contents of any one jug into another jug, without exceeding the capacity of the * jug being poured into. * * @author <NAME> */ import java.util.ArrayList; public class Water implements Puzzle<ArrayList<Integer>>{ private int goalAmount = 0; private ArrayList<Integer> jugsCapacity = null; /** * Constructor for Water. * * @param myAmount goal amount * @param myJugs list of jugs */ public Water( int myAmount, ArrayList<Integer> myJugs ) { goalAmount = myAmount; jugsCapacity = myJugs; } /** * @return the starting jugs config (all jugs empty) */ public ArrayList<Integer> getStart(){ ArrayList<Integer> start = new ArrayList<Integer>( jugsCapacity.size() ); for( int i = 0; i < jugsCapacity.size(); ++i ) { start.add( 0 ); } return start; } /** * @return true if config contains the goal */ public boolean isGoal( ArrayList<Integer> config ){ return config.indexOf( goalAmount ) > -1 ? true : false ; } /** * Generate and return all direct neighbors for the given jugs config. * * * @param config puzzle config * @return the list of neighbors */ public ArrayList<ArrayList<Integer>> getNeighbors( ArrayList<Integer> config ) { // list of neighbor configs ArrayList<ArrayList<Integer>> neighbors = new ArrayList<ArrayList<Integer>>(); ArrayList<Integer> possibleConfig; int currentJug; for( int i = 0; i < config.size(); ++i ) { currentJug = config.get( i ); if( currentJug > 0 ) { // **** emptying the jug **** // restore the config to the original to the original given config possibleConfig = new ArrayList<Integer>( config ); possibleConfig.set( i, 0 ); neighbors.add( possibleConfig ); // **** pouring one jug into another jug **** int total; // total water amount after pouring int limit; // max capacity of the receiving jug int receiver; // current capacity of receiving jug int pourer; // capacity of pouring jug for( int j = 0; j < config.size(); ++j ) { if( j != i ) { // skip over the current jug pourer = currentJug; // restore the config to the original given config possibleConfig = new ArrayList<Integer>( config ); limit = jugsCapacity.get( j ); receiver = possibleConfig.get( j ); // check if the jug to fill is full if( receiver < limit ) { total = pourer + receiver; // check if pouring causes jug to exceed its capacity if( total > limit ) { receiver = limit; pourer = total - limit; } else{ receiver = total; pourer = 0; } possibleConfig.set( j, receiver ); possibleConfig.set( i, pourer ); neighbors.add( possibleConfig ); } // end inner foor loop } } // end outer for loop } if( currentJug < jugsCapacity.get(i) ) { // **** filling the jug **** possibleConfig = new ArrayList<Integer>( config ); possibleConfig.set( i, jugsCapacity.get( i ) ); neighbors.add( possibleConfig ); } } // end for loop that interates through the config return neighbors; } /** * Prints the solution to the puzzle. * * @param solution solution to print */ public void printSolution( ArrayList<ArrayList<Integer>> solution ) { int stepCount = 0; // step counter String str = ""; if( solution.size() > 0 ) { for( ArrayList<Integer> s : solution ) { str += "Step " + stepCount++ + ": "; for( Integer i : s ) { str += i + " "; } str += "\n"; } str = str.trim(); } else { str = "No solution."; } System.out.println( str ); } /** * @return string containing goalAmount and jugsCapacity. */ public String toString() { return "Goal: " + goalAmount + "\nJugs: " + jugsCapacity; } /** * Main method that gets arguments from the user and solves the puzzle. * * @param args command line arguments */ public static void main( String args[] ) throws NumberFormatException{ if( args.length > 1 ) { try{ int goal = Integer.parseInt( args[0] ); // create list of jugs from the command arguments ArrayList<Integer> jugs = new ArrayList<Integer>( args.length ); for( int i = 1; i < args.length; ++i ) { jugs.add( Integer.parseInt( args[i] ) ); } Water puzzle = new Water( goal, jugs ); Solver<ArrayList<Integer>> solver = new Solver<ArrayList<Integer>>( puzzle ); // find and print solution puzzle.printSolution( solver.solve() ); } catch( NumberFormatException e ) { System.err.println( "Invalid arguments." ); } } else { System.err.println( "Usage: java Water amount jug1 jug2 ..." ); } } } /* * Water.java * * Version: * $Id: Water.java,v 1.8 2013/11/23 01:18:44 andy Exp andy $ * * Revisions: * $Log: Water.java,v $ * Revision 1.8 2013/11/23 01:18:44 andy * Changed printSolution * * Revision 1.7 2013/11/23 00:25:40 andy * Changed some methods for efficiency * * Revision 1.6 2013/11/22 22:11:07 andy * Added printSolution and toString method. * * Revision 1.5 2013/11/22 21:51:10 andy * implement isGoal method * * Revision 1.4 2013/11/22 21:47:20 andy * testing * * Revision 1.3 2013/11/22 21:45:07 andy * Implemented methods * * Revision 1.2 2013/11/22 19:48:40 andy * Skeleton * * Revision 1.1 2013/11/21 20:59:46 andy * Initial revision * * */
7,345
0.512925
0.491156
226
31.522123
26.917639
95
false
false
0
0
0
0
0
0
0.309735
false
false
4
ff65ba086c73a0085aa40153ba222abb79f4b4f6
26,671,746,928,168
83f3b2108d779d0e4186d2c8d684bde3038e2df4
/TabbedRadio/app/src/main/java/com/example/margus/tabbedradio/SettingsRepository.java
56ffa571e99e8f02b71316d84ba0b145413ad9d9
[]
no_license
margusmuru/Android_Practices
https://github.com/margusmuru/Android_Practices
e555631b196f984006653b5cc4eff6e6b65397ab
0d5520addd494257c5204400aec1846d110eb21a
refs/heads/master
2021-01-19T03:46:52.537000
2020-09-06T19:24:58
2020-09-06T19:24:58
87,333,451
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.margus.tabbedradio; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.support.annotation.RequiresPermission; import java.util.ArrayList; import java.util.List; /** * Created by Margus Muru on 07.05.2017. */ public class SettingsRepository { private Activity activity; public SettingsRepository(Activity activity){ this.activity = activity; } //could be removed if music view would use List<String> instead of String[]. // Didnt change that just in case! public String[] GetStationNames(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultNames = activity.getResources() .getString(R.string.save_station_names_default); String stationNames = sharedPref .getString(activity.getString(R.string.save_station_names), defaultNames); return stationNames.split(","); } public List<String> GetStationNamesAsList(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultNames = activity.getResources() .getString(R.string.save_station_names_default); String stationNames = sharedPref .getString(activity.getString(R.string.save_station_names), defaultNames); String[] result = stationNames.split(","); List<String> resultList = new ArrayList<>(); for(int i = 0; i < result.length;i++){ resultList.add(result[i]); } return resultList; } //could be removed if music view would use List<String> instead of String[]. // Didnt change that just in case! public String[] GetStationSources(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultUrls = activity.getResources() .getString(R.string.save_station_urls_default); String stationUrls = sharedPref .getString(activity.getString(R.string.save_station_urls), defaultUrls); return stationUrls.split(","); } public List<String> GetStationSourcesAsList(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultUrls = activity.getResources() .getString(R.string.save_station_urls_default); String stationUrls = sharedPref .getString(activity.getString(R.string.save_station_urls), defaultUrls); String[] result = stationUrls.split(","); List<String> resultList = new ArrayList<>(); for(int i = 0; i < result.length;i++){ resultList.add(result[i]); } return resultList; } public void SaveStationData(List<String> names, String destination){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); StringBuilder builder = new StringBuilder(); for(int i = 0; i < names.size(); i++){ builder.append(names.get(i) + ","); } editor.putString(destination, builder.toString()); editor.commit(); } }
UTF-8
Java
3,247
java
SettingsRepository.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Margus Muru on 07.05.2017.\n */\n\npublic class SettingsReposito", "end": 280, "score": 0.9998968839645386, "start": 269, "tag": "NAME", "value": "Margus Muru" } ]
null
[]
package com.example.margus.tabbedradio; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.support.annotation.RequiresPermission; import java.util.ArrayList; import java.util.List; /** * Created by <NAME> on 07.05.2017. */ public class SettingsRepository { private Activity activity; public SettingsRepository(Activity activity){ this.activity = activity; } //could be removed if music view would use List<String> instead of String[]. // Didnt change that just in case! public String[] GetStationNames(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultNames = activity.getResources() .getString(R.string.save_station_names_default); String stationNames = sharedPref .getString(activity.getString(R.string.save_station_names), defaultNames); return stationNames.split(","); } public List<String> GetStationNamesAsList(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultNames = activity.getResources() .getString(R.string.save_station_names_default); String stationNames = sharedPref .getString(activity.getString(R.string.save_station_names), defaultNames); String[] result = stationNames.split(","); List<String> resultList = new ArrayList<>(); for(int i = 0; i < result.length;i++){ resultList.add(result[i]); } return resultList; } //could be removed if music view would use List<String> instead of String[]. // Didnt change that just in case! public String[] GetStationSources(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultUrls = activity.getResources() .getString(R.string.save_station_urls_default); String stationUrls = sharedPref .getString(activity.getString(R.string.save_station_urls), defaultUrls); return stationUrls.split(","); } public List<String> GetStationSourcesAsList(){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); String defaultUrls = activity.getResources() .getString(R.string.save_station_urls_default); String stationUrls = sharedPref .getString(activity.getString(R.string.save_station_urls), defaultUrls); String[] result = stationUrls.split(","); List<String> resultList = new ArrayList<>(); for(int i = 0; i < result.length;i++){ resultList.add(result[i]); } return resultList; } public void SaveStationData(List<String> names, String destination){ SharedPreferences sharedPref = activity.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); StringBuilder builder = new StringBuilder(); for(int i = 0; i < names.size(); i++){ builder.append(names.get(i) + ","); } editor.putString(destination, builder.toString()); editor.commit(); } }
3,242
0.662458
0.65907
82
38.585365
27.189915
90
false
false
0
0
0
0
0
0
0.658537
false
false
4
be9869f95181942d7ab886deb0bbe01cd7ddffbe
14,439,680,095,335
064d44e30d5eace044a2e9d44f674f05a6925d72
/src/practice/com/hackerrank/practice/algorithm/sorting/InsertionSortPart1.java
4e1eac59c19efcd6915ef40b0891126ff802f22c
[]
no_license
emafazillah/Hackerrank
https://github.com/emafazillah/Hackerrank
2782ce1e420c6e9fcc0c66174030b93cb182f722
a70d132539fe8c934a792accab37132dc5c6afee
refs/heads/master
2021-01-12T18:33:52.254000
2019-11-12T16:33:14
2019-11-12T16:33:14
81,320,619
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hackerrank.practice.algorithm.sorting; //import java.util.Arrays; import java.util.Scanner; public class InsertionSortPart1 { static void insertionSort1(int n, int[] arr) { int i = 0; int shift = 0; while(i < n - 1) { for(int j = 0; j < n; j++) { if (j < n - 1) { if(arr[j] > arr[j + 1]) { shift = arr[j + 1]; arr[j + 1] = arr[j]; } else { if(j == 0) { if(arr[j] < arr[j + 1]) { ++i; } else if(arr[j] == arr[j + 1] && arr[j] > shift) { arr[j] = shift; ++i; } } else { if(arr[j] > arr[j - 1] && arr[j] < arr[j + 1]) { ++i; } else if(arr[j] == arr[j + 1] && arr[j - 1] > shift) { arr[j] = arr[j - 1]; } else if(arr[j] == arr[j + 1] && arr[j - 1] < shift) { arr[j] = shift; ++i; } } } } } //System.out.println(Arrays.toString(arr)); for (int j = 0; j < n; j++) { System.out.print(arr[j] + " "); } System.out.println(); if(i != n - 1) { i = 0; } } } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int[] arr = new int[n]; String[] arrItems = scanner.nextLine().split(" "); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); for (int i = 0; i < n; i++) { int arrItem = Integer.parseInt(arrItems[i]); arr[i] = arrItem; } insertionSort1(n, arr); scanner.close(); } }
UTF-8
Java
1,633
java
InsertionSortPart1.java
Java
[]
null
[]
package com.hackerrank.practice.algorithm.sorting; //import java.util.Arrays; import java.util.Scanner; public class InsertionSortPart1 { static void insertionSort1(int n, int[] arr) { int i = 0; int shift = 0; while(i < n - 1) { for(int j = 0; j < n; j++) { if (j < n - 1) { if(arr[j] > arr[j + 1]) { shift = arr[j + 1]; arr[j + 1] = arr[j]; } else { if(j == 0) { if(arr[j] < arr[j + 1]) { ++i; } else if(arr[j] == arr[j + 1] && arr[j] > shift) { arr[j] = shift; ++i; } } else { if(arr[j] > arr[j - 1] && arr[j] < arr[j + 1]) { ++i; } else if(arr[j] == arr[j + 1] && arr[j - 1] > shift) { arr[j] = arr[j - 1]; } else if(arr[j] == arr[j + 1] && arr[j - 1] < shift) { arr[j] = shift; ++i; } } } } } //System.out.println(Arrays.toString(arr)); for (int j = 0; j < n; j++) { System.out.print(arr[j] + " "); } System.out.println(); if(i != n - 1) { i = 0; } } } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int[] arr = new int[n]; String[] arrItems = scanner.nextLine().split(" "); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); for (int i = 0; i < n; i++) { int arrItem = Integer.parseInt(arrItems[i]); arr[i] = arrItem; } insertionSort1(n, arr); scanner.close(); } }
1,633
0.453154
0.423148
71
22
19.123762
63
false
false
0
0
0
0
0
0
3.464789
false
false
4
96bc71f8ed71c5409bf39a008b5250cc18ff8685
22,720,377,040,992
b4ae03966728e322929f2b23e674ec45fd896fe1
/src/main/java/competition/year2021/day20211107/Leetcode5918.java
18ac66e066d8e074f11605c67fb320e29ce6c338
[]
no_license
markey92/leetcode
https://github.com/markey92/leetcode
21b4024cdffa4685ee583f6da0d766d5b8bcd6fe
c6efae4ca1dfd94da56442c2b049333ca7cff4dd
refs/heads/master
2022-02-10T15:16:50.279000
2022-01-16T02:23:40
2022-01-16T02:23:40
210,847,391
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package competition.year2021.day20211107; import java.util.Arrays; /** * @ProjectName: leetcode * @Package: competition.day20211107 * @ClassName: Leetcode5918 * @Author: markey * @Description: * @Date: 2021/11/7 10:30 * @Version: 1.0 */ public class Leetcode5918 { public int countVowelSubstrings(String word) { int res = 0; boolean[] flag = new boolean[5]; for (int i = 0; i < word.length(); i++) { for (int j = i; j < word.length(); j++) { if (getIndex(word.charAt(j)) >= 0) { flag[getIndex(word.charAt(j))] = true; if (isMatch(flag)) { res++; } } else { break; } } Arrays.fill(flag, false); } return res; } public boolean isMatch(boolean[] flags) { for (int i = 0; i < flags.length; i++) { if (flags[i] == false) { return false; } } return true; } public int getIndex(char c) { switch (c) { case 'a' : return 0; case 'e' : return 1; case 'i' : return 2; case 'o' : return 3; case 'u' : return 4; default: return -1; } } }
UTF-8
Java
1,342
java
Leetcode5918.java
Java
[ { "context": "ay20211107\n * @ClassName: Leetcode5918\n * @Author: markey\n * @Description:\n * @Date: 2021/11/7 10:30\n * @Ve", "end": 182, "score": 0.9992887377738953, "start": 176, "tag": "USERNAME", "value": "markey" } ]
null
[]
package competition.year2021.day20211107; import java.util.Arrays; /** * @ProjectName: leetcode * @Package: competition.day20211107 * @ClassName: Leetcode5918 * @Author: markey * @Description: * @Date: 2021/11/7 10:30 * @Version: 1.0 */ public class Leetcode5918 { public int countVowelSubstrings(String word) { int res = 0; boolean[] flag = new boolean[5]; for (int i = 0; i < word.length(); i++) { for (int j = i; j < word.length(); j++) { if (getIndex(word.charAt(j)) >= 0) { flag[getIndex(word.charAt(j))] = true; if (isMatch(flag)) { res++; } } else { break; } } Arrays.fill(flag, false); } return res; } public boolean isMatch(boolean[] flags) { for (int i = 0; i < flags.length; i++) { if (flags[i] == false) { return false; } } return true; } public int getIndex(char c) { switch (c) { case 'a' : return 0; case 'e' : return 1; case 'i' : return 2; case 'o' : return 3; case 'u' : return 4; default: return -1; } } }
1,342
0.444113
0.405365
53
24.320755
15.594839
58
false
false
0
0
0
0
0
0
0.45283
false
false
4
ecb787298738f8c8abbd099e363b88136088769c
8,589,984,793
b1282be52a53465e28bc5aca81115182be680b62
/src/com/github/cuter44/muuga/user/servlet/Logout.java
275e1ec59207e41edf11ee618c585db03c790820
[]
no_license
someblue/login-demo-javaweb
https://github.com/someblue/login-demo-javaweb
1fc7f835e01efe5415a81d666f0d987bd550247b
d6013ad48ecd5009d78da8ff3db0e5bfda90d358
refs/heads/master
2017-03-24T13:53:49.612000
2014-11-14T03:05:20
2014-11-14T03:05:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.cuter44.muuga.user.servlet; import java.io.*; import java.security.PrivateKey; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.annotation.*; import com.github.cuter44.nyafx.dao.*; import com.github.cuter44.nyafx.crypto.*; import com.github.cuter44.nyafx.servlet.*; import static com.github.cuter44.nyafx.servlet.Params.notNull; import static com.github.cuter44.nyafx.servlet.Params.needLong; import static com.github.cuter44.nyafx.servlet.Params.getByteArray; import com.github.cuter44.muuga.Constants; import com.github.cuter44.muuga.user.model.*; import com.github.cuter44.muuga.user.core.*; import com.github.cuter44.muuga.user.exception.*; /** 登出 * 登出会清除所有终端上的操作凭证 * <pre style="font-size:12px"> <strong>请求</strong> POST /user/logout.api <strong>参数</strong> uid:long, uid 以下参数的其中一个: s:hex, session key pass:hex, RSA 加密的 UTF-8 编码的用户登录密码. <strong>响应</strong> application/json error: string, ="ok" <strong>例外</strong> parsed by {@link com.github.cuter44.muuga.sys.servlet.ExceptionHandler ExceptionHandler} <strong>样例</strong>暂无 * </pre> * */ @WebServlet("/user/logout.api") public class Logout extends HttpServlet { private static final String UID = "uid"; private static final String PASS = "pass"; private static final String S = "s"; protected UserDao userDao = UserDao.getInstance(); protected Authorizer authorizer = Authorizer.getInstance(); protected RSAKeyCache keyCache = RSAKeyCache.getInstance(); protected RSACrypto rsa = RSACrypto.getInstance(); @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); try { Long uid = needLong(req, UID); this.userDao.begin(); // logout by session key byte[] skey = getByteArray(req, S); if (skey != null) { this.authorizer.logoutViaSkey(uid, skey); this.userDao.commit(); Json.writeErrorOk(resp); return; } // else // logout by password byte[] pass = getByteArray(req, PASS); if (pass != null) { // key 检定 PrivateKey key = (PrivateKey)notNull(this.keyCache.get(uid)); pass = this.rsa.decrypt(pass, key); this.authorizer.logoutViaPass(uid, pass); this.userDao.commit(); Json.writeErrorOk(resp); return; } // else // parameter missing throw(new MissingParameterException("Pequires skey or pass")); } catch (Exception ex) { req.setAttribute(Constants.KEY_EXCEPTION, ex); req.getRequestDispatcher(Constants.URI_ERROR_HANDLER).forward(req, resp); } finally { this.userDao.close(); } return; } }
UTF-8
Java
3,502
java
Logout.java
Java
[ { "context": "package com.github.cuter44.muuga.user.servlet;\r\n\r\nimport java.io.*;\r\nimport ", "end": 26, "score": 0.6994247436523438, "start": 20, "tag": "USERNAME", "value": "uter44" }, { "context": " javax.servlet.annotation.*;\r\n\r\nimport com.github.cuter44.nyafx.dao.*;\r\n...
null
[]
package com.github.cuter44.muuga.user.servlet; import java.io.*; import java.security.PrivateKey; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.annotation.*; import com.github.cuter44.nyafx.dao.*; import com.github.cuter44.nyafx.crypto.*; import com.github.cuter44.nyafx.servlet.*; import static com.github.cuter44.nyafx.servlet.Params.notNull; import static com.github.cuter44.nyafx.servlet.Params.needLong; import static com.github.cuter44.nyafx.servlet.Params.getByteArray; import com.github.cuter44.muuga.Constants; import com.github.cuter44.muuga.user.model.*; import com.github.cuter44.muuga.user.core.*; import com.github.cuter44.muuga.user.exception.*; /** 登出 * 登出会清除所有终端上的操作凭证 * <pre style="font-size:12px"> <strong>请求</strong> POST /user/logout.api <strong>参数</strong> uid:long, uid 以下参数的其中一个: s:hex, session key pass:hex, RSA 加密的 UTF-8 编码的用户登录密码. <strong>响应</strong> application/json error: string, ="ok" <strong>例外</strong> parsed by {@link com.github.cuter44.muuga.sys.servlet.ExceptionHandler ExceptionHandler} <strong>样例</strong>暂无 * </pre> * */ @WebServlet("/user/logout.api") public class Logout extends HttpServlet { private static final String UID = "uid"; private static final String PASS = "<PASSWORD>"; private static final String S = "s"; protected UserDao userDao = UserDao.getInstance(); protected Authorizer authorizer = Authorizer.getInstance(); protected RSAKeyCache keyCache = RSAKeyCache.getInstance(); protected RSACrypto rsa = RSACrypto.getInstance(); @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); try { Long uid = needLong(req, UID); this.userDao.begin(); // logout by session key byte[] skey = getByteArray(req, S); if (skey != null) { this.authorizer.logoutViaSkey(uid, skey); this.userDao.commit(); Json.writeErrorOk(resp); return; } // else // logout by password byte[] pass = getByteArray(req, PASS); if (pass != null) { // key 检定 PrivateKey key = (PrivateKey)notNull(this.keyCache.get(uid)); pass = this.rsa.decrypt(pass, key); this.authorizer.logoutViaPass(uid, pass); this.userDao.commit(); Json.writeErrorOk(resp); return; } // else // parameter missing throw(new MissingParameterException("Pequires skey or pass")); } catch (Exception ex) { req.setAttribute(Constants.KEY_EXCEPTION, ex); req.getRequestDispatcher(Constants.URI_ERROR_HANDLER).forward(req, resp); } finally { this.userDao.close(); } return; } }
3,508
0.592113
0.583873
122
25.852459
22.490316
91
false
false
0
0
0
0
0
0
0.5
false
false
4
ca1e1d4daed0f2aaa527e3a1252f17e4058781c7
22,299,470,246,219
4a3fb8c9b965cb2948fe8c3b60e3d73a7ab58a7b
/Bozels/src/Actions/OpenAction.java
2e8f1260a26cc3e43e1075d45a3f881691598518
[ "MIT" ]
permissive
yang123vc/UGentProjects
https://github.com/yang123vc/UGentProjects
de75c3f13b53a44865db4722dae807a4fb03ce9e
5561ce3bb73d5bc5bf31bcda2be7e038514c7072
refs/heads/master
2020-06-21T23:04:49.947000
2017-02-19T16:50:42
2017-02-19T16:50:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package actions; import java.awt.event.ActionEvent; import java.io.File; import javax.swing.AbstractAction; import javax.swing.JFileChooser; import modellen.SpelModel; import reader.XMLParser; /** * * @author Titouan Vervack */ public class OpenAction extends AbstractAction { private File first = new File("leeg.xml"); private static final String PAD = "./etc/levels/"; private SpelModel model; //Lees het level in en selecteer standaard leeg.xml public OpenAction(SpelModel model) { this.model = model; putValue(NAME, "Open level"); } @Override public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(new java.io.File(PAD)); fc.setSelectedFile(first); fc.setDialogTitle("Level laden"); int knop = fc.showOpenDialog(null); if (knop == JFileChooser.APPROVE_OPTION) { new XMLParser(fc.getSelectedFile(), model, 1); } } }
UTF-8
Java
964
java
OpenAction.java
Java
[ { "context": "Model;\nimport reader.XMLParser;\n\n/**\n *\n * @author Titouan Vervack\n */\npublic class OpenAction extends AbstractActio", "end": 228, "score": 0.999873697757721, "start": 213, "tag": "NAME", "value": "Titouan Vervack" } ]
null
[]
package actions; import java.awt.event.ActionEvent; import java.io.File; import javax.swing.AbstractAction; import javax.swing.JFileChooser; import modellen.SpelModel; import reader.XMLParser; /** * * @author <NAME> */ public class OpenAction extends AbstractAction { private File first = new File("leeg.xml"); private static final String PAD = "./etc/levels/"; private SpelModel model; //Lees het level in en selecteer standaard leeg.xml public OpenAction(SpelModel model) { this.model = model; putValue(NAME, "Open level"); } @Override public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(new java.io.File(PAD)); fc.setSelectedFile(first); fc.setDialogTitle("Level laden"); int knop = fc.showOpenDialog(null); if (knop == JFileChooser.APPROVE_OPTION) { new XMLParser(fc.getSelectedFile(), model, 1); } } }
955
0.671162
0.670124
36
25.777779
19.98209
66
false
false
0
0
0
0
0
0
0.555556
false
false
4
b7854d5efcb23b0e70ff848337e18e5c9b955526
18,030,272,749,356
54712233955c20b1ca534a17f9cebe7a8e6b83c1
/Classwork/src/com/Windspinks/Classwork/Lesson_3/Application.java
4d67f808bf96f5e2b320134d8844612926e234b9
[]
no_license
windspinks/GTC-Java-2
https://github.com/windspinks/GTC-Java-2
e160bf2c1f9c1f4b5b3408b8d031b3856015ec4c
f5f67aeb1ddc7d0271c7fd3bd10c016ca7574612
refs/heads/master
2020-07-07T17:27:14.854000
2019-11-20T20:39:32
2019-11-20T20:39:32
203,421,214
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Windspinks.Classwork.Lesson_3; public class Application { private String firstName; private String lastName; private Integer age; private Character gender; private String[] siblings; private String[] parents; public Application() { } public Application(String firstName, String lastName, Integer age, Character gender, String[] siblings, String[] parents) { this.firstName = firstName; this.lastName = lastName; this.age = age; this.gender = gender; this.siblings = siblings; this.parents = parents; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Character getGender() { return gender; } public String getGenderFull() { switch (gender) { case 'M': return "Male"; case 'F': return "Female"; case 'N': return "Non-binary"; default: return "Other"; } } public void setGender(Character gender) { this.gender = gender; } public String[] getSiblings() { return siblings; } public void setSiblings(String[] siblings) { this.siblings = siblings; } public String[] getParents() { return parents; } public void setParents(String[] parents) { this.parents = parents; } }
UTF-8
Java
1,804
java
Application.java
Java
[ { "context": "}\n\n public Application(String firstName, String lastName, Integer age, Character gender, String[] siblings", "end": 337, "score": 0.5294225215911865, "start": 329, "tag": "NAME", "value": "lastName" }, { "context": "ings, String[] parents) {\n this.firstName...
null
[]
package com.Windspinks.Classwork.Lesson_3; public class Application { private String firstName; private String lastName; private Integer age; private Character gender; private String[] siblings; private String[] parents; public Application() { } public Application(String firstName, String lastName, Integer age, Character gender, String[] siblings, String[] parents) { this.firstName = firstName; this.lastName = lastName; this.age = age; this.gender = gender; this.siblings = siblings; this.parents = parents; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Character getGender() { return gender; } public String getGenderFull() { switch (gender) { case 'M': return "Male"; case 'F': return "Female"; case 'N': return "Non-binary"; default: return "Other"; } } public void setGender(Character gender) { this.gender = gender; } public String[] getSiblings() { return siblings; } public void setSiblings(String[] siblings) { this.siblings = siblings; } public String[] getParents() { return parents; } public void setParents(String[] parents) { this.parents = parents; } }
1,804
0.56929
0.568736
83
20.73494
19.021284
127
false
false
0
0
0
0
0
0
0.409639
false
false
4
fad21b63cbf859329086f7c53d4de273ec2ef7f5
2,568,390,503,392
04215292a027a0d28ec6fdd70023c98f8deaff8d
/src/priv/bajdcc/LALR1/grammar/type/ConvertToInt.java
e7719b7fc0d057b7166b02072bd5c01043b1fd52
[ "MIT" ]
permissive
wyh110536/jMiniLang
https://github.com/wyh110536/jMiniLang
4a5c2aed15dc88ddbea60badc079b08041213526
0115cd5a95e6f66bc07d64b285d0b6ec58198c8e
refs/heads/master
2021-07-01T05:35:43.440000
2017-09-17T14:21:09
2017-09-17T14:21:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package priv.bajdcc.LALR1.grammar.type; import java.math.BigDecimal; import java.math.BigInteger; import priv.bajdcc.util.lexer.token.Token; import priv.bajdcc.util.lexer.token.TokenType; /** * 【类型转换】转换为整数类型 * * @author bajdcc */ public class ConvertToInt implements ITokenConventer { @Override public Token convert(Token token) { TokenType type = token.kToken; switch (token.kToken) { case BOOL: case CHARACTER: case STRING: case DECIMAL: case INTEGER: token.object = getIntValue(token); if (token.kToken == TokenType.ERROR) { token.kToken = type; } else { token.kToken = TokenType.INTEGER; } break; default: break; } return token; } /** * 强制整数转换(值) * * @param token * 操作数 * @return 转换结果 */ private static BigInteger getIntValue(Token token) { switch (token.kToken) { case BOOL: boolean bool = (boolean) token.object; return bool ? BigInteger.ONE : BigInteger.ZERO; case CHARACTER: char ch = (char) token.object; return BigInteger.valueOf(ch); case STRING: String str = (String) token.object; try { return new BigInteger(str); } catch (NumberFormatException e) { token.kToken = TokenType.ERROR; } break; case INTEGER: return (BigInteger) token.object; case DECIMAL: BigDecimal decimal = (BigDecimal) token.object; return decimal.toBigInteger(); default: break; } return null; } }
UTF-8
Java
1,560
java
ConvertToInt.java
Java
[ { "context": "okenType;\r\n\r\n/**\r\n * 【类型转换】转换为整数类型\r\n *\r\n * @author bajdcc\r\n */\r\npublic class ConvertToInt implements IToken", "end": 243, "score": 0.9996197819709778, "start": 237, "tag": "USERNAME", "value": "bajdcc" } ]
null
[]
package priv.bajdcc.LALR1.grammar.type; import java.math.BigDecimal; import java.math.BigInteger; import priv.bajdcc.util.lexer.token.Token; import priv.bajdcc.util.lexer.token.TokenType; /** * 【类型转换】转换为整数类型 * * @author bajdcc */ public class ConvertToInt implements ITokenConventer { @Override public Token convert(Token token) { TokenType type = token.kToken; switch (token.kToken) { case BOOL: case CHARACTER: case STRING: case DECIMAL: case INTEGER: token.object = getIntValue(token); if (token.kToken == TokenType.ERROR) { token.kToken = type; } else { token.kToken = TokenType.INTEGER; } break; default: break; } return token; } /** * 强制整数转换(值) * * @param token * 操作数 * @return 转换结果 */ private static BigInteger getIntValue(Token token) { switch (token.kToken) { case BOOL: boolean bool = (boolean) token.object; return bool ? BigInteger.ONE : BigInteger.ZERO; case CHARACTER: char ch = (char) token.object; return BigInteger.valueOf(ch); case STRING: String str = (String) token.object; try { return new BigInteger(str); } catch (NumberFormatException e) { token.kToken = TokenType.ERROR; } break; case INTEGER: return (BigInteger) token.object; case DECIMAL: BigDecimal decimal = (BigDecimal) token.object; return decimal.toBigInteger(); default: break; } return null; } }
1,560
0.639148
0.638482
71
19.15493
15.287524
54
false
false
0
0
0
0
0
0
2.084507
false
false
4
d29edcfe1cf714bc1a7b1b1388b5bb01b7286692
25,744,034,010,370
1f078b7f1abbbe9b81b3df71c7bd5e0807414032
/Homework_Comparable_1/src/com/gmail/dev/surovtsev/yaroslav/Rectangle.java
03d33677a6a0039345d937b5c8e907354afe0e35
[]
no_license
Kjtlh20/JavaOOPPlus
https://github.com/Kjtlh20/JavaOOPPlus
19b1e9f2f77dfafd3a66190524b6db3ecc70173e
00cda1d40d0d406db184fb03b240c2f2772e835c
refs/heads/main
2023-08-01T09:26:39.660000
2021-09-21T17:36:02
2021-09-21T17:36:02
404,596,614
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gmail.dev.surovtsev.yaroslav; import java.util.Objects; public class Rectangle implements Comparable<Rectangle> { private int width; private int height; public Rectangle() { super(); } public Rectangle(int width, int height) { super(); this.width = width; this.height = height; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getSquare() { return height * width; } @Override public int compareTo(Rectangle o) { if (o == null) { throw new NullPointerException(); } if (this.getSquare() - o.getSquare() < 0) { return -1; } if (this.getSquare() - o.getSquare() > 0) { return 1; } if (this.width - o.width < 0) { return -1; } if (this.width - o.width > 0) { return 1; } return this.height - o.height; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Rectangle rectangle = (Rectangle) o; return width == rectangle.width && height == rectangle.height; } @Override public int hashCode() { return Objects.hash(width, height); } @Override public String toString() { return "Rectangle{" + "width=" + width + ", height=" + height + '}'; } }
UTF-8
Java
1,730
java
Rectangle.java
Java
[ { "context": "package com.gmail.dev.surovtsev.yaroslav;\n\nimport java.util.Objects;\n\npublic clas", "end": 31, "score": 0.6783770322799683, "start": 23, "tag": "USERNAME", "value": "urovtsev" } ]
null
[]
package com.gmail.dev.surovtsev.yaroslav; import java.util.Objects; public class Rectangle implements Comparable<Rectangle> { private int width; private int height; public Rectangle() { super(); } public Rectangle(int width, int height) { super(); this.width = width; this.height = height; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getSquare() { return height * width; } @Override public int compareTo(Rectangle o) { if (o == null) { throw new NullPointerException(); } if (this.getSquare() - o.getSquare() < 0) { return -1; } if (this.getSquare() - o.getSquare() > 0) { return 1; } if (this.width - o.width < 0) { return -1; } if (this.width - o.width > 0) { return 1; } return this.height - o.height; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Rectangle rectangle = (Rectangle) o; return width == rectangle.width && height == rectangle.height; } @Override public int hashCode() { return Objects.hash(width, height); } @Override public String toString() { return "Rectangle{" + "width=" + width + ", height=" + height + '}'; } }
1,730
0.513295
0.508671
79
20.898735
17.229351
70
false
false
0
0
0
0
0
0
0.379747
false
false
4
989fae01b5ae5dc17d27064c0795e68031f84de4
32,100,585,625,782
c8bcd9b551915560bf88b3c0b71e2b7c373779a1
/mnm-aggregator/src/main/java/com/shico/mnm/agg/components/AggTabPanel.java
9a2f3a20f045c9abe683cdf70bac4f77f5b689e9
[]
no_license
shirazconsult/stats-frontend
https://github.com/shirazconsult/stats-frontend
1c46cac7a9e320426aab8426636783d43388fb8b
d96f9c4d7d86c8ca776ea1f10db244d8bf19f47c
refs/heads/master
2021-01-25T08:49:31.966000
2013-06-03T15:13:58
2013-06-03T15:13:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shico.mnm.agg.components; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import com.shico.mnm.agg.client.AggChartDataProvider; import com.shico.mnm.agg.client.AggClientHandle; import com.shico.mnm.agg.client.AggSettingsController; import com.shico.mnm.agg.client.charts.HeapMemChartPortlet; import com.shico.mnm.agg.client.charts.LoadViewPortlet; import com.shico.mnm.agg.client.charts.NonHeapMemChartPortlet; import com.shico.mnm.agg.client.charts.ProcessingTimeTablePortlet; import com.shico.mnm.agg.model.AggRemoteSettingsDS; import com.shico.mnm.agg.model.AggregatorInfoDS; import com.shico.mnm.common.client.ChartDataProvider; import com.shico.mnm.common.client.ChildRunnable; import com.shico.mnm.common.client.ParentRunnable; import com.shico.mnm.common.component.PortalWin; import com.shico.mnm.common.event.DataEventType; import com.shico.mnm.common.event.DataLoadedEvent; import com.shico.mnm.common.event.EventBus; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.DSCallback; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.types.Side; import com.smartgwt.client.widgets.layout.PortalLayout; import com.smartgwt.client.widgets.layout.Portlet; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tab.Tab; import com.smartgwt.client.widgets.tab.TabSet; import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; public class AggTabPanel extends VLayout { private static final Logger logger = Logger.getLogger("AmqTabPanel"); AggChartDataProvider dataClient; AggSettingsController settingsController; TabSet container; VLayout settingsPanel; VLayout mainAdminPanel; VLayout monitorPanel; // BrokerInfoPortlet brokerInfoPortlet; boolean settingsLoaded = false; public AggTabPanel(final ChartDataProvider chartDataProvider, final AggSettingsController settingsController) { super(); this.settingsController = settingsController; this.dataClient = (AggChartDataProvider)chartDataProvider; ChildRunnable settingLoader = new ChildRunnable() { @Override public void doRun() { if(settingsController.useLocalStorage()){ logger.log(Level.INFO, "Loading settings from local storage."); settingsController.setSettingsMapFromLocalStorage(); String restUrl = (String)settingsController.getSetting(AggRemoteSettingsDS.AGGREGATORURL); settingsController.setAggregatorInfoDS(new AggregatorInfoDS(restUrl)); settingsLoaded = true; logger.log(Level.INFO, "Settings loaded from local storage."); getParent().done(); }else{ logger.log(Level.INFO, "Loading settings from server."); Criteria criteria = new Criteria(AggRemoteSettingsDS.APP, AggClientHandle.APP_NAME); settingsController.getSettingsDS().fetchData(criteria, new DSCallback() { @SuppressWarnings("rawtypes") @Override public void execute(DSResponse response, Object rawData, DSRequest request) { Map settings = response.getData()[0].toMap(); settingsController.setSettingsMap(settings); // instantiate datasources String restUrl = (String)settings.get(AggRemoteSettingsDS.AGGREGATORURL); settingsController.setAggregatorInfoDS(new AggregatorInfoDS(restUrl)); settingsLoaded = true; logger.log(Level.INFO, "Settings loaded from server."); getParent().done(); } }); } }; }; ParentRunnable parent = new ParentRunnable(settingLoader) { @Override public void doRun() { setup(); } }; parent.run(); } void setup(){ container = new TabSet(); // container.addTabSelectedHandler(new TabSelectedHandler() { // @Override // public void onTabSelected(TabSelectedEvent event) { // container.selectTab(0); // } // }); container.setTabBarPosition(Side.TOP); container.setTabBarAlign(Side.LEFT); Tab adminTab = new Tab("Admin"); adminTab.setPane(getAggMainAdminPanel()); adminTab.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { setAggMainAdminPanelPortal(); } }); container.addTab(adminTab); Tab monitorTab = new Tab("Monitor"); monitorTab.setPane(getMonitorPanel()); monitorTab.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { setMonitorPanelPortal(); } }); container.addTab(monitorTab); setWidth100(); addMember(container); } public VLayout getMonitorPanel(){ // Monitor Panel if(monitorPanel == null){ monitorPanel = new VLayout(); monitorPanel.setWidth100(); } return monitorPanel; } private void setMonitorPanelPortal(){ if(monitorPanel.getMembers().length == 0){ PortalLayout portalLayout = new PortalWin(2); HeapMemChartPortlet hmcp = new HeapMemChartPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(hmcp, 0, 0); NonHeapMemChartPortlet nhmcp = new NonHeapMemChartPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(nhmcp, 0, 1); LoadViewPortlet lvp = new LoadViewPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(lvp, 1, 0); ProcessingTimeTablePortlet pttp = new ProcessingTimeTablePortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(pttp, 1, 1); hmcp.setPortalContainer(portalLayout); nhmcp.setPortalContainer(portalLayout); lvp.setPortalContainer(portalLayout); pttp.setPortalContainer(portalLayout); monitorPanel.addMember(portalLayout); EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_CHART_SETTINGS_CHANGED_EVENT, settingsController.getSettingsMap())); } } public VLayout getAggMainAdminPanel(){ if(mainAdminPanel == null){ mainAdminPanel = new VLayout(); mainAdminPanel.setWidth100(); } return mainAdminPanel; } private void setAggMainAdminPanelPortal(){ if(mainAdminPanel.getMembers().length == 0){ PortalLayout portalLayout = new PortalWin(1); portalLayout.addPortlet(getAggregatorInfoPortlet(), 0, 0); portalLayout.addPortlet(getAggConfSettingsPortlet(), 0, 1); int height = getAggregatorInfoPortlet().getHeight() + getAggConfSettingsPortlet().getHeight(); portalLayout.setHeight(height); mainAdminPanel.addMember(portalLayout); PortalLayout aggSettingsPortal = getAggSettingsPortal(); height = height + aggSettingsPortal.getHeight(); mainAdminPanel.setHeight(height); mainAdminPanel.addMember(aggSettingsPortal); if(settingsLoaded){ // Because MainAdmin portal contains the brokerInfo portlet which needs to be notified of settings. EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_SETTINGS_LOADED_EVENT, settingsController.getSettingsMap())); EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_ADMIN_SETTINGS_CHANGED_EVENT, settingsController.getSettingsMap())); } } } private PortalLayout getAggSettingsPortal(){ PortalLayout portalLayout = new PortalWin(2); portalLayout.addPortlet(getAggAdminSettingsPortlet(), 0, 0); portalLayout.addPortlet(getAggChartSettingsPortlet(), 1, 0); portalLayout.setHeight(Math.max(getAggAdminSettingsPortlet().getHeight(), getAggChartSettingsPortlet().getHeight())); portalLayout.setHeight(getAggChartSettingsPortlet().getHeight()); return portalLayout; } AggChartSettingsPortlet aggChartSettingsPortlet; private Portlet getAggChartSettingsPortlet() { if(aggChartSettingsPortlet == null){ aggChartSettingsPortlet = new AggChartSettingsPortlet(settingsController); } return aggChartSettingsPortlet; } AggAdminSettingsPortlet aggAdminSettingsPortlet; private Portlet getAggAdminSettingsPortlet() { if(aggAdminSettingsPortlet == null){ aggAdminSettingsPortlet = new AggAdminSettingsPortlet(settingsController); } return aggAdminSettingsPortlet; } private AggregatorInfoPortlet aggregatorInfoPortlet; private Portlet getAggregatorInfoPortlet() { if(aggregatorInfoPortlet == null){ aggregatorInfoPortlet = new AggregatorInfoPortlet(settingsController); } return aggregatorInfoPortlet; } private AggConfSettingsPortlet aggConfSettingsPortlet; private AggConfSettingsPortlet getAggConfSettingsPortlet(){ if(aggConfSettingsPortlet == null){ aggConfSettingsPortlet = new AggConfSettingsPortlet(settingsController); } return aggConfSettingsPortlet; } }
UTF-8
Java
8,636
java
AggTabPanel.java
Java
[]
null
[]
package com.shico.mnm.agg.components; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import com.shico.mnm.agg.client.AggChartDataProvider; import com.shico.mnm.agg.client.AggClientHandle; import com.shico.mnm.agg.client.AggSettingsController; import com.shico.mnm.agg.client.charts.HeapMemChartPortlet; import com.shico.mnm.agg.client.charts.LoadViewPortlet; import com.shico.mnm.agg.client.charts.NonHeapMemChartPortlet; import com.shico.mnm.agg.client.charts.ProcessingTimeTablePortlet; import com.shico.mnm.agg.model.AggRemoteSettingsDS; import com.shico.mnm.agg.model.AggregatorInfoDS; import com.shico.mnm.common.client.ChartDataProvider; import com.shico.mnm.common.client.ChildRunnable; import com.shico.mnm.common.client.ParentRunnable; import com.shico.mnm.common.component.PortalWin; import com.shico.mnm.common.event.DataEventType; import com.shico.mnm.common.event.DataLoadedEvent; import com.shico.mnm.common.event.EventBus; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.DSCallback; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.types.Side; import com.smartgwt.client.widgets.layout.PortalLayout; import com.smartgwt.client.widgets.layout.Portlet; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tab.Tab; import com.smartgwt.client.widgets.tab.TabSet; import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; public class AggTabPanel extends VLayout { private static final Logger logger = Logger.getLogger("AmqTabPanel"); AggChartDataProvider dataClient; AggSettingsController settingsController; TabSet container; VLayout settingsPanel; VLayout mainAdminPanel; VLayout monitorPanel; // BrokerInfoPortlet brokerInfoPortlet; boolean settingsLoaded = false; public AggTabPanel(final ChartDataProvider chartDataProvider, final AggSettingsController settingsController) { super(); this.settingsController = settingsController; this.dataClient = (AggChartDataProvider)chartDataProvider; ChildRunnable settingLoader = new ChildRunnable() { @Override public void doRun() { if(settingsController.useLocalStorage()){ logger.log(Level.INFO, "Loading settings from local storage."); settingsController.setSettingsMapFromLocalStorage(); String restUrl = (String)settingsController.getSetting(AggRemoteSettingsDS.AGGREGATORURL); settingsController.setAggregatorInfoDS(new AggregatorInfoDS(restUrl)); settingsLoaded = true; logger.log(Level.INFO, "Settings loaded from local storage."); getParent().done(); }else{ logger.log(Level.INFO, "Loading settings from server."); Criteria criteria = new Criteria(AggRemoteSettingsDS.APP, AggClientHandle.APP_NAME); settingsController.getSettingsDS().fetchData(criteria, new DSCallback() { @SuppressWarnings("rawtypes") @Override public void execute(DSResponse response, Object rawData, DSRequest request) { Map settings = response.getData()[0].toMap(); settingsController.setSettingsMap(settings); // instantiate datasources String restUrl = (String)settings.get(AggRemoteSettingsDS.AGGREGATORURL); settingsController.setAggregatorInfoDS(new AggregatorInfoDS(restUrl)); settingsLoaded = true; logger.log(Level.INFO, "Settings loaded from server."); getParent().done(); } }); } }; }; ParentRunnable parent = new ParentRunnable(settingLoader) { @Override public void doRun() { setup(); } }; parent.run(); } void setup(){ container = new TabSet(); // container.addTabSelectedHandler(new TabSelectedHandler() { // @Override // public void onTabSelected(TabSelectedEvent event) { // container.selectTab(0); // } // }); container.setTabBarPosition(Side.TOP); container.setTabBarAlign(Side.LEFT); Tab adminTab = new Tab("Admin"); adminTab.setPane(getAggMainAdminPanel()); adminTab.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { setAggMainAdminPanelPortal(); } }); container.addTab(adminTab); Tab monitorTab = new Tab("Monitor"); monitorTab.setPane(getMonitorPanel()); monitorTab.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { setMonitorPanelPortal(); } }); container.addTab(monitorTab); setWidth100(); addMember(container); } public VLayout getMonitorPanel(){ // Monitor Panel if(monitorPanel == null){ monitorPanel = new VLayout(); monitorPanel.setWidth100(); } return monitorPanel; } private void setMonitorPanelPortal(){ if(monitorPanel.getMembers().length == 0){ PortalLayout portalLayout = new PortalWin(2); HeapMemChartPortlet hmcp = new HeapMemChartPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(hmcp, 0, 0); NonHeapMemChartPortlet nhmcp = new NonHeapMemChartPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(nhmcp, 0, 1); LoadViewPortlet lvp = new LoadViewPortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(lvp, 1, 0); ProcessingTimeTablePortlet pttp = new ProcessingTimeTablePortlet(dataClient, 0.45, 0.45); portalLayout.addPortlet(pttp, 1, 1); hmcp.setPortalContainer(portalLayout); nhmcp.setPortalContainer(portalLayout); lvp.setPortalContainer(portalLayout); pttp.setPortalContainer(portalLayout); monitorPanel.addMember(portalLayout); EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_CHART_SETTINGS_CHANGED_EVENT, settingsController.getSettingsMap())); } } public VLayout getAggMainAdminPanel(){ if(mainAdminPanel == null){ mainAdminPanel = new VLayout(); mainAdminPanel.setWidth100(); } return mainAdminPanel; } private void setAggMainAdminPanelPortal(){ if(mainAdminPanel.getMembers().length == 0){ PortalLayout portalLayout = new PortalWin(1); portalLayout.addPortlet(getAggregatorInfoPortlet(), 0, 0); portalLayout.addPortlet(getAggConfSettingsPortlet(), 0, 1); int height = getAggregatorInfoPortlet().getHeight() + getAggConfSettingsPortlet().getHeight(); portalLayout.setHeight(height); mainAdminPanel.addMember(portalLayout); PortalLayout aggSettingsPortal = getAggSettingsPortal(); height = height + aggSettingsPortal.getHeight(); mainAdminPanel.setHeight(height); mainAdminPanel.addMember(aggSettingsPortal); if(settingsLoaded){ // Because MainAdmin portal contains the brokerInfo portlet which needs to be notified of settings. EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_SETTINGS_LOADED_EVENT, settingsController.getSettingsMap())); EventBus.instance().fireEvent(new DataLoadedEvent(DataEventType.AGG_ADMIN_SETTINGS_CHANGED_EVENT, settingsController.getSettingsMap())); } } } private PortalLayout getAggSettingsPortal(){ PortalLayout portalLayout = new PortalWin(2); portalLayout.addPortlet(getAggAdminSettingsPortlet(), 0, 0); portalLayout.addPortlet(getAggChartSettingsPortlet(), 1, 0); portalLayout.setHeight(Math.max(getAggAdminSettingsPortlet().getHeight(), getAggChartSettingsPortlet().getHeight())); portalLayout.setHeight(getAggChartSettingsPortlet().getHeight()); return portalLayout; } AggChartSettingsPortlet aggChartSettingsPortlet; private Portlet getAggChartSettingsPortlet() { if(aggChartSettingsPortlet == null){ aggChartSettingsPortlet = new AggChartSettingsPortlet(settingsController); } return aggChartSettingsPortlet; } AggAdminSettingsPortlet aggAdminSettingsPortlet; private Portlet getAggAdminSettingsPortlet() { if(aggAdminSettingsPortlet == null){ aggAdminSettingsPortlet = new AggAdminSettingsPortlet(settingsController); } return aggAdminSettingsPortlet; } private AggregatorInfoPortlet aggregatorInfoPortlet; private Portlet getAggregatorInfoPortlet() { if(aggregatorInfoPortlet == null){ aggregatorInfoPortlet = new AggregatorInfoPortlet(settingsController); } return aggregatorInfoPortlet; } private AggConfSettingsPortlet aggConfSettingsPortlet; private AggConfSettingsPortlet getAggConfSettingsPortlet(){ if(aggConfSettingsPortlet == null){ aggConfSettingsPortlet = new AggConfSettingsPortlet(settingsController); } return aggConfSettingsPortlet; } }
8,636
0.759611
0.753126
253
33.134388
28.878609
140
false
false
0
0
0
0
0
0
2.687747
false
false
4
9733167a7411bfd3626982e9b017f05b4da20467
3,856,880,692,060
46bbd34310f3f2c3c56e12846a449888923ac552
/patterns/src/cmdANDobserver/command/LayTrainee.java
353c9c23620a289c973da0da624910bbab041270
[]
no_license
apiks/design-patterns
https://github.com/apiks/design-patterns
49ae05077e2d73a218e219917784c4355cdd2f83
7b7ca82c1bc1b42cc2eaff52122b1e122144f586
refs/heads/master
2021-05-24T09:30:35.949000
2020-06-19T14:20:11
2020-06-19T14:20:11
253,497,326
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cmdANDobserver.command; import cmdANDobserver.entities.Trainee; public class LayTrainee implements Command { private Trainee trainee; public LayTrainee(Trainee trainee){ this.trainee = trainee; } public void execute() { trainee.lay(); } }
UTF-8
Java
285
java
LayTrainee.java
Java
[]
null
[]
package cmdANDobserver.command; import cmdANDobserver.entities.Trainee; public class LayTrainee implements Command { private Trainee trainee; public LayTrainee(Trainee trainee){ this.trainee = trainee; } public void execute() { trainee.lay(); } }
285
0.691228
0.691228
14
19.428572
16.176325
44
false
false
0
0
0
0
0
0
0.357143
false
false
4
a76c8e3020a5f47a7fae6c72d97b8f95218c2972
9,826,885,223,508
ee1945b617786ddaf8b516befdecca045838f558
/src/company_project/model/DuplicateEmpNoCheckHandler.java
b7ec0689e83bd909e5d006715200ba4984b4d0b8
[]
no_license
Yoonwonju/company_project
https://github.com/Yoonwonju/company_project
c300f3569ca3ce5b3a9fc6dd478eef55b74d33a7
08a2b757d09815e0ac36d45e3eaaaebf0283faac
refs/heads/master
2023-01-03T08:03:07.857000
2020-11-03T09:39:49
2020-11-03T09:39:49
306,623,601
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package company_project.model; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; 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 company_project.dto.Employee; import company_project.service.EmployeeService; @WebServlet("/DuplicateEmpNoCheckHandler") public class DuplicateEmpNoCheckHandler extends HttpServlet { private static final long serialVersionUID = 1L; EmployeeService service; public void init(ServletConfig config) throws ServletException { service = new EmployeeService(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getMethod().equalsIgnoreCase("get")) { System.out.println("GET방식"); }else { System.out.println("POST방식"); int empNo = Integer.parseInt(request.getParameter("empNo").trim()); int res = service.duplicateEmpNo(empNo); System.out.println("res --> " + res); PrintWriter pw = response.getWriter(); pw.print(res); pw.flush(); } } }
UTF-8
Java
1,565
java
DuplicateEmpNoCheckHandler.java
Java
[]
null
[]
package company_project.model; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; 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 company_project.dto.Employee; import company_project.service.EmployeeService; @WebServlet("/DuplicateEmpNoCheckHandler") public class DuplicateEmpNoCheckHandler extends HttpServlet { private static final long serialVersionUID = 1L; EmployeeService service; public void init(ServletConfig config) throws ServletException { service = new EmployeeService(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getMethod().equalsIgnoreCase("get")) { System.out.println("GET방식"); }else { System.out.println("POST방식"); int empNo = Integer.parseInt(request.getParameter("empNo").trim()); int res = service.duplicateEmpNo(empNo); System.out.println("res --> " + res); PrintWriter pw = response.getWriter(); pw.print(res); pw.flush(); } } }
1,565
0.761079
0.760437
48
30.4375
30.375364
119
false
false
0
0
0
0
0
0
1.625
false
false
4
b0fdd208a968c32524d6eca1535d2fa3cb6c81eb
31,817,117,769,226
b64771c6b1709f2a4c527a91f8c7d1ed0bc23ff9
/synergyview-core/src/synergyviewcore/timebar/action/mediacontrol/AttachMediaAction.java
ed1fd7b3cb7f60f925eb866b1e14069fa8782a89
[ "BSD-3-Clause" ]
permissive
jamcnaughton/synergyview
https://github.com/jamcnaughton/synergyview
469721caca0c69fa390b2cfb1834c6a418d3e71b
0872fd4e6ee602accb014c2cad802a27a4d8cc79
refs/heads/master
2020-04-18T22:41:46.978000
2016-11-25T08:42:13
2016-11-25T08:42:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package synergyviewcore.timebar.action.mediacontrol; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import synergyviewcore.collections.ui.AbstractMediaCollectionControl; import synergyviewcore.media.model.MediaNode; import synergyviewcore.media.model.MediaRootNode; import synergyviewcore.navigation.NavigatorLabelProvider; import synergyviewcore.navigation.model.INode; import synergyviewcore.resource.ResourceLoader; import synergyviewcore.timebar.action.BaseTimeBarAction; import de.jaret.util.ui.timebars.swt.TimeBarViewer; /** * The Class AttachMediaAction. */ public class AttachMediaAction extends BaseTimeBarAction { /** The collection control. */ protected AbstractMediaCollectionControl collectionControl; /** The media folder. */ protected MediaRootNode mediaFolder; /** * Instantiates a new attach media action. * * @param tbv * the tbv * @param mediaFolder * the media folder * @param collectionControl * the collection control */ public AttachMediaAction(TimeBarViewer tbv, MediaRootNode mediaFolder, AbstractMediaCollectionControl collectionControl) { super(tbv); this.mediaFolder = mediaFolder; this.collectionControl = collectionControl; } /** * {@inheritDoc} */ public String getText() { return ResourceLoader.getString("TIMEBAR_MEDIA_CONTEXTMENU_CREATE"); } /* * (non-Javadoc) * * @see synergyviewcore.timebar.action.BaseTimeBarAction#init() */ @Override protected void init() { this.setEnabled(true); this.setAccelerator(SWT.ALT | 'A'); this.setToolTipText(ResourceLoader.getString("TIMEBAR_MEDIA_CONTEXTMENU_CREATE")); this.setImageDescriptor(ResourceLoader.getIconDescriptor("folder_add.png")); } /** * {@inheritDoc} */ public void run() { String[] arr = new String[0]; MediaNode mediaNode = this.showMediaSelection(arr, this._tbv.getParent()); collectionControl.addMedia(mediaNode); } /** * Show media selection. * * @param excludeItemList * the exclude item list * @param owner * the owner * @return the media node */ private MediaNode showMediaSelection(String[] excludeItemList, Composite owner) { List<INode> availableMediaList = mediaFolder.getMediaNodes(excludeItemList); if (availableMediaList.size() >= 0) { ElementListSelectionDialog dialog = new ElementListSelectionDialog(owner.getShell(), new NavigatorLabelProvider()); dialog.setMultipleSelection(false); dialog.setElements(availableMediaList.toArray(new INode[availableMediaList.size()])); dialog.setTitle(ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_TITLE")); dialog.open(); return ((MediaNode) dialog.getFirstResult()); } else { MessageDialog.openError(owner.getShell(), ResourceLoader.getString("DIALOG_ERROR_TITLE"), ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_NO_MEDIA")); return null; } } }
UTF-8
Java
3,196
java
AttachMediaAction.java
Java
[]
null
[]
package synergyviewcore.timebar.action.mediacontrol; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.ElementListSelectionDialog; import synergyviewcore.collections.ui.AbstractMediaCollectionControl; import synergyviewcore.media.model.MediaNode; import synergyviewcore.media.model.MediaRootNode; import synergyviewcore.navigation.NavigatorLabelProvider; import synergyviewcore.navigation.model.INode; import synergyviewcore.resource.ResourceLoader; import synergyviewcore.timebar.action.BaseTimeBarAction; import de.jaret.util.ui.timebars.swt.TimeBarViewer; /** * The Class AttachMediaAction. */ public class AttachMediaAction extends BaseTimeBarAction { /** The collection control. */ protected AbstractMediaCollectionControl collectionControl; /** The media folder. */ protected MediaRootNode mediaFolder; /** * Instantiates a new attach media action. * * @param tbv * the tbv * @param mediaFolder * the media folder * @param collectionControl * the collection control */ public AttachMediaAction(TimeBarViewer tbv, MediaRootNode mediaFolder, AbstractMediaCollectionControl collectionControl) { super(tbv); this.mediaFolder = mediaFolder; this.collectionControl = collectionControl; } /** * {@inheritDoc} */ public String getText() { return ResourceLoader.getString("TIMEBAR_MEDIA_CONTEXTMENU_CREATE"); } /* * (non-Javadoc) * * @see synergyviewcore.timebar.action.BaseTimeBarAction#init() */ @Override protected void init() { this.setEnabled(true); this.setAccelerator(SWT.ALT | 'A'); this.setToolTipText(ResourceLoader.getString("TIMEBAR_MEDIA_CONTEXTMENU_CREATE")); this.setImageDescriptor(ResourceLoader.getIconDescriptor("folder_add.png")); } /** * {@inheritDoc} */ public void run() { String[] arr = new String[0]; MediaNode mediaNode = this.showMediaSelection(arr, this._tbv.getParent()); collectionControl.addMedia(mediaNode); } /** * Show media selection. * * @param excludeItemList * the exclude item list * @param owner * the owner * @return the media node */ private MediaNode showMediaSelection(String[] excludeItemList, Composite owner) { List<INode> availableMediaList = mediaFolder.getMediaNodes(excludeItemList); if (availableMediaList.size() >= 0) { ElementListSelectionDialog dialog = new ElementListSelectionDialog(owner.getShell(), new NavigatorLabelProvider()); dialog.setMultipleSelection(false); dialog.setElements(availableMediaList.toArray(new INode[availableMediaList.size()])); dialog.setTitle(ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_TITLE")); dialog.open(); return ((MediaNode) dialog.getFirstResult()); } else { MessageDialog.openError(owner.getShell(), ResourceLoader.getString("DIALOG_ERROR_TITLE"), ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_NO_MEDIA")); return null; } } }
3,196
0.718398
0.717772
100
30.959999
30.666243
165
false
false
0
0
0
0
0
0
0.67
false
false
4
a36ae490481d15bb7937db888aa4b706b72ec608
11,716,670,842,241
0adccaebde1e1047283542317a4c0e03b0c63b4b
/api/src/main/java/cn/houhe/api/loan/mapper/ReceivableListExtMapper.java
47db9cecdd2c32dc3f124643b30d354fb6bd0ad6
[]
no_license
jolin198912/vechileflyloan
https://github.com/jolin198912/vechileflyloan
7b0bd23637845f4cc14cea26b5d3774cd52b43c9
f601c14960ae08a194f59d583b544d215c4dcf35
refs/heads/master
2021-06-23T06:48:25.461000
2017-08-30T07:39:21
2017-08-30T07:39:21
101,846,824
0
1
null
false
2017-08-30T07:55:37
2017-08-30T06:40:02
2017-08-30T06:55:19
2017-08-30T07:55:37
2,677
0
1
0
Java
null
null
package cn.houhe.api.loan.mapper; import cn.houhe.api.loan.entity.bo.ReceivableListObject; import cn.houhe.api.loan.web.bo.ReceivableListDto; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; import java.util.Calendar; import java.util.Date; import java.util.List; /** * MyBatis Mapper 接口 - 表:audit_person * @since 2017-04-07 18:44:32 */ public interface ReceivableListExtMapper { List<ReceivableListObject> selectReceivableList(@Param("dto") ReceivableListDto dto); int selectReceivableListCount(@Param("dto") ReceivableListDto dto); BigDecimal getPaiedAmount(@Param("loanid") Integer loanid, @Param("paydate")Date paydate); }
UTF-8
Java
670
java
ReceivableListExtMapper.java
Java
[]
null
[]
package cn.houhe.api.loan.mapper; import cn.houhe.api.loan.entity.bo.ReceivableListObject; import cn.houhe.api.loan.web.bo.ReceivableListDto; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; import java.util.Calendar; import java.util.Date; import java.util.List; /** * MyBatis Mapper 接口 - 表:audit_person * @since 2017-04-07 18:44:32 */ public interface ReceivableListExtMapper { List<ReceivableListObject> selectReceivableList(@Param("dto") ReceivableListDto dto); int selectReceivableListCount(@Param("dto") ReceivableListDto dto); BigDecimal getPaiedAmount(@Param("loanid") Integer loanid, @Param("paydate")Date paydate); }
670
0.783988
0.76284
23
27.826086
27.573856
91
false
false
0
0
0
0
0
0
0.652174
false
false
4
e23476d3e5f1a930b4d32a5b50a74f4f45a7c45c
32,950,989,152,810
67e1145d0dbc6ca8c16bde01b38a436233135ccd
/InstantMessenger_Server_java/src/instantMessenger_server/ServerTest.java
cd83601db15b9c712adde97ba87362414aaf4fe8
[]
no_license
ruhul-inonity/Instant-Messanger
https://github.com/ruhul-inonity/Instant-Messanger
c6af9b5c18af9b7013ed73b5902352c7d54fc7a0
f6193b90692a091e969a4a315253cfce43a686ab
refs/heads/master
2020-04-07T13:01:13.575000
2015-08-05T20:10:45
2015-08-05T20:10:45
40,266,420
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package instantMessenger_server; import javax.swing.JFrame; public class ServerTest { public static void main(String[] args) { Server choldong1 = new Server(); choldong1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); choldong1.startRunning(); } }
UTF-8
Java
261
java
ServerTest.java
Java
[]
null
[]
package instantMessenger_server; import javax.swing.JFrame; public class ServerTest { public static void main(String[] args) { Server choldong1 = new Server(); choldong1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); choldong1.startRunning(); } }
261
0.754789
0.743295
14
17.642857
18.9345
59
false
false
0
0
0
0
0
0
0.928571
false
false
4
d88a981a035f0e9e126816b6168ceaa732bdcc21
8,856,222,622,142
d3ac7a818c0b8dc21c0154ba1255da7a7ae33be2
/src/Java2/CircleApp.java
01193b1012de84ce0db294810b86c387e4508b7f
[]
no_license
carastoker/java-exercises
https://github.com/carastoker/java-exercises
799a0cf0b4de085eaa2c4ce471139a794cd29a5e
82aeb8d7835ff669f461876dd61c5f83641d18ca
refs/heads/master
2021-01-20T14:42:35.290000
2017-05-25T16:43:37
2017-05-25T16:43:37
90,650,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Java2; /** * Created by cstoker on 5/17/17. */ public class CircleApp { public static void main(String[] args) { Input otherInput = new Input(); System.out.println("What radius would you like your circle to have?"); } }
UTF-8
Java
261
java
CircleApp.java
Java
[ { "context": "package Java2;\n\n/**\n * Created by cstoker on 5/17/17.\n */\npublic class CircleApp {\n\n pub", "end": 41, "score": 0.9997060894966125, "start": 34, "tag": "USERNAME", "value": "cstoker" } ]
null
[]
package Java2; /** * Created by cstoker on 5/17/17. */ public class CircleApp { public static void main(String[] args) { Input otherInput = new Input(); System.out.println("What radius would you like your circle to have?"); } }
261
0.62069
0.597701
17
14.352942
21.616827
78
false
false
0
0
0
0
0
0
0.176471
false
false
4
d32fc86249e830728aeceb9572c39d50de207406
1,451,698,999,595
7de5256d438b008284981d929e02aa87ef1c6a87
/src/main/java/gov/nyc/dsny/smart/opsboard/commands/equipment/CommandUpdateEquipmentSnowReadiness.java
be9fc20820bf1c62c515d3947a5b5cd0d39e0c73
[]
no_license
dee342/ops-board-app
https://github.com/dee342/ops-board-app
86ac2cc91908d7d641db25d58d34281357fdd7de
ac17802a4dabfc1c971e25eb2ab3162d1b6ed37c
refs/heads/master
2020-12-24T05:40:06.707000
2016-11-11T16:02:55
2016-11-11T16:02:55
73,491,104
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gov.nyc.dsny.smart.opsboard.commands.equipment; import gov.nyc.dsny.smart.opsboard.OpsBoardError; import gov.nyc.dsny.smart.opsboard.commands.IMultiBoardCommandAnnotation; import gov.nyc.dsny.smart.opsboard.domain.board.Board; import gov.nyc.dsny.smart.opsboard.domain.equipment.BoardEquipment; import gov.nyc.dsny.smart.opsboard.domain.equipment.SnowReadiness; import gov.nyc.dsny.smart.opsboard.domain.tasks.BoardEquipmentAndTasks; import java.util.Date; import java.util.LinkedHashMap; import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.databind.ObjectMapper; /** * Command to update an equipment's bin load (e.g. material type, full, not full...). */ @IMultiBoardCommandAnnotation(commandName = "UpdateEquipmentSnowReadiness") public class CommandUpdateEquipmentSnowReadiness extends AbstractMultiBoardEquipmentCommand { private static final long serialVersionUID = 1L; private SnowReadiness snowReadiness; public CommandUpdateEquipmentSnowReadiness() { } public CommandUpdateEquipmentSnowReadiness(LinkedHashMap<String, Object> map) { super(map); ObjectMapper mapper = new ObjectMapper(); try { snowReadiness = mapper.readValue(map.get("snowReadiness").toString(), SnowReadiness.class); } catch (Exception e) { // Do nothing } } public CommandUpdateEquipmentSnowReadiness(String boardId, String systemUser, Date systemDateTime, String boardEquipmentId, String equipmentId, SnowReadiness snowReadiness, boolean fromIntegration) { super(boardId, systemUser, systemDateTime, boardEquipmentId, equipmentId, fromIntegration); if (snowReadiness != null) { this.snowReadiness = snowReadiness; } } @Override public void execute(Board board) throws OpsBoardError { // Execute logic BoardEquipmentAndTasks bets = board.getEquipmentOps().updateEquipmentSnowReadiness(getEquipmentId(), getSystemUser(), getSystemDateTime(), snowReadiness); // Update command updateEquipmentAndTasks(board, bets); // Create audit message createAuditMessage(board, bets.getBoardEquipment()); // Add command to history board.addCommandToHistory(this); } public SnowReadiness getSnowReadiness() { return snowReadiness; } public void setSnowReadiness(SnowReadiness snowReadiness) { this.snowReadiness = snowReadiness; } @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); builder.append("snowReadiness", snowReadiness); builder.append(super.toString()); return builder.toString(); } protected void createAuditMessage(Board board, BoardEquipment be) { StringBuilder sb = new StringBuilder(); sb.append("Updated Snow Readiness for equipment "); sb.append("[equipment:" + be.getEquipment().getId() + "]."); setAuditMessage(sb.toString()); } }
UTF-8
Java
2,808
java
CommandUpdateEquipmentSnowReadiness.java
Java
[]
null
[]
package gov.nyc.dsny.smart.opsboard.commands.equipment; import gov.nyc.dsny.smart.opsboard.OpsBoardError; import gov.nyc.dsny.smart.opsboard.commands.IMultiBoardCommandAnnotation; import gov.nyc.dsny.smart.opsboard.domain.board.Board; import gov.nyc.dsny.smart.opsboard.domain.equipment.BoardEquipment; import gov.nyc.dsny.smart.opsboard.domain.equipment.SnowReadiness; import gov.nyc.dsny.smart.opsboard.domain.tasks.BoardEquipmentAndTasks; import java.util.Date; import java.util.LinkedHashMap; import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.databind.ObjectMapper; /** * Command to update an equipment's bin load (e.g. material type, full, not full...). */ @IMultiBoardCommandAnnotation(commandName = "UpdateEquipmentSnowReadiness") public class CommandUpdateEquipmentSnowReadiness extends AbstractMultiBoardEquipmentCommand { private static final long serialVersionUID = 1L; private SnowReadiness snowReadiness; public CommandUpdateEquipmentSnowReadiness() { } public CommandUpdateEquipmentSnowReadiness(LinkedHashMap<String, Object> map) { super(map); ObjectMapper mapper = new ObjectMapper(); try { snowReadiness = mapper.readValue(map.get("snowReadiness").toString(), SnowReadiness.class); } catch (Exception e) { // Do nothing } } public CommandUpdateEquipmentSnowReadiness(String boardId, String systemUser, Date systemDateTime, String boardEquipmentId, String equipmentId, SnowReadiness snowReadiness, boolean fromIntegration) { super(boardId, systemUser, systemDateTime, boardEquipmentId, equipmentId, fromIntegration); if (snowReadiness != null) { this.snowReadiness = snowReadiness; } } @Override public void execute(Board board) throws OpsBoardError { // Execute logic BoardEquipmentAndTasks bets = board.getEquipmentOps().updateEquipmentSnowReadiness(getEquipmentId(), getSystemUser(), getSystemDateTime(), snowReadiness); // Update command updateEquipmentAndTasks(board, bets); // Create audit message createAuditMessage(board, bets.getBoardEquipment()); // Add command to history board.addCommandToHistory(this); } public SnowReadiness getSnowReadiness() { return snowReadiness; } public void setSnowReadiness(SnowReadiness snowReadiness) { this.snowReadiness = snowReadiness; } @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); builder.append("snowReadiness", snowReadiness); builder.append(super.toString()); return builder.toString(); } protected void createAuditMessage(Board board, BoardEquipment be) { StringBuilder sb = new StringBuilder(); sb.append("Updated Snow Readiness for equipment "); sb.append("[equipment:" + be.getEquipment().getId() + "]."); setAuditMessage(sb.toString()); } }
2,808
0.779202
0.77849
90
30.211111
30.924458
120
false
false
0
0
0
0
0
0
1.622222
false
false
4
d1995a7f2f70953cdedcf1d09d68d220c20677a2
13,005,160,976,156
bab534a800feb2444abed06b7f9244b2b1886235
/src/main/java/nl/jketelaar/project/sync/models/Host.java
ab7e14de26fdf2dbf5fa4104b28e071d864f284d
[]
no_license
JKetelaar/Project-Synchroniser
https://github.com/JKetelaar/Project-Synchroniser
9025042c1146675a4bad9ceab32b90f6ef8f4fbd
bf66a6cfb3bee5d7c39dfc20883386ade7321241
refs/heads/master
2021-04-15T18:27:07.874000
2018-04-30T11:24:11
2018-04-30T11:24:11
126,739,212
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.jketelaar.project.sync.models; /** * @author JKetelaar */ public class Host { private String host; private int port; private String username; private String basePath; public Host(String host, int port, String username, String basePath) { this.host = host; this.port = port; this.username = username; this.basePath = basePath; } public Host(String host, String username, String basePath) { this.host = host; this.port = 22; this.username = username; this.basePath = basePath; } public String getHost() { return host; } public Host setHost(String host) { this.host = host; return this; } public int getPort() { return port; } public Host setPort(int port) { this.port = port; return this; } public String getUsername() { return username; } public Host setUsername(String username) { this.username = username; return this; } public String getBasePath() { return basePath; } public Host setBasePath(String basePath) { this.basePath = basePath; return this; } }
UTF-8
Java
1,241
java
Host.java
Java
[ { "context": " nl.jketelaar.project.sync.models;\n\n/**\n * @author JKetelaar\n */\npublic class Host {\n\n private String hos", "end": 65, "score": 0.8028843998908997, "start": 58, "tag": "USERNAME", "value": "JKetela" }, { "context": "elaar.project.sync.models;\n\n/**\n * @autho...
null
[]
package nl.jketelaar.project.sync.models; /** * @author JKetelaar */ public class Host { private String host; private int port; private String username; private String basePath; public Host(String host, int port, String username, String basePath) { this.host = host; this.port = port; this.username = username; this.basePath = basePath; } public Host(String host, String username, String basePath) { this.host = host; this.port = 22; this.username = username; this.basePath = basePath; } public String getHost() { return host; } public Host setHost(String host) { this.host = host; return this; } public int getPort() { return port; } public Host setPort(int port) { this.port = port; return this; } public String getUsername() { return username; } public Host setUsername(String username) { this.username = username; return this; } public String getBasePath() { return basePath; } public Host setBasePath(String basePath) { this.basePath = basePath; return this; } }
1,241
0.580983
0.579371
62
19.016129
16.519287
74
false
false
0
0
0
0
0
0
0.483871
false
false
4
269975f9e150288a5661565af8dba8977438b0b1
19,567,871,031,043
f5114bdafba7fd7a2e8082076abedd671e086d6c
/VMConsole-API-OpenJDK-Linux/src/main/java/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
23ef78005bfd192480787f9cac77c93cb42c9612
[ "Apache-2.0" ]
permissive
tzfun/VmConsole-Api
https://github.com/tzfun/VmConsole-Api
c1f8dd688a9c90acbb891d5e4dae7def5f5324b7
20920d8310d417e8ca2af2cdbcaa4084d789d900
refs/heads/master
2023-04-13T09:47:48.693000
2023-04-07T14:04:07
2023-04-07T14:04:07
188,955,946
45
15
Apache-2.0
false
2023-04-07T14:04:08
2019-05-28T04:50:22
2022-09-23T02:45:11
2023-04-07T14:04:07
2,140
42
16
2
Java
false
false
/* * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.tools.doclets.formats.html; import java.io.*; import com.sun.javadoc.*; import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.util.DocPaths; import com.sun.tools.doclets.internal.toolkit.util.DocletAbortException; /** * Generate the Serialized Form Information Page. * * <p><b>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. * This code and its internal interfaces are subject to change or * deletion without notice.</b> * * @author Atul M Dambalkar */ public class SerializedFormWriterImpl extends SubWriterHolderWriter implements SerializedFormWriter { /** * @param configuration the configuration data for the doclet * @throws IOException * @throws DocletAbortException */ public SerializedFormWriterImpl(ConfigurationImpl configuration) throws IOException { super(configuration, DocPaths.SERIALIZED_FORM); } /** * Get the given header. * * @param header the header to write * @return the body content tree */ public Content getHeader(String header) { Content bodyTree = getBody(true, getWindowTitle(header)); addTop(bodyTree); addNavLinks(true, bodyTree); Content h1Content = new StringContent(header); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, h1Content); Content div = HtmlTree.DIV(HtmlStyle.header, heading); bodyTree.addContent(div); return bodyTree; } /** * Get the serialized form summaries header. * * @return the serialized form summary header tree */ public Content getSerializedSummariesHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the package serialized form header. * * @return the package serialized form header tree */ public Content getPackageSerializedHeader() { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); return li; } /** * Get the given package header. * * @param packageName the package header to write * @return a content tree for the package header */ public Content getPackageHeader(String packageName) { Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, packageLabel); heading.addContent(getSpace()); heading.addContent(packageName); return heading; } /** * Get the serialized class header. * * @return a content tree for the serialized class header */ public Content getClassSerializedHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the serializable class heading. * * @param classDoc the class being processed * @return a content tree for the class header */ public Content getClassHeader(ClassDoc classDoc) { Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc) .label(configuration.getClassName(classDoc))) : new StringContent(classDoc.qualifiedName()); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( classDoc.qualifiedName())); Content superClassLink = classDoc.superclassType() != null ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SERIALIZED_FORM, classDoc.superclassType())) : null; //Print the heading. Content className = superClassLink == null ? configuration.getResource( "doclet.Class_0_implements_serializable", classLink) : configuration.getResource( "doclet.Class_0_extends_implements_serializable", classLink, superClassLink); li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, className)); return li; } /** * Get the serial UID info header. * * @return a content tree for the serial uid info header */ public Content getSerialUIDInfoHeader() { HtmlTree dl = new HtmlTree(HtmlTag.DL); dl.addStyle(HtmlStyle.nameValue); return dl; } /** * Adds the serial UID info. * * @param header the header that will show up before the UID. * @param serialUID the serial UID to print. * @param serialUidTree the serial UID content tree to which the serial UID * content will be added */ public void addSerialUIDInfo(String header, String serialUID, Content serialUidTree) { Content headerContent = new StringContent(header); serialUidTree.addContent(HtmlTree.DT(headerContent)); Content serialContent = new StringContent(serialUID); serialUidTree.addContent(HtmlTree.DD(serialContent)); } /** * Get the class serialize content header. * * @return a content tree for the class serialize content header */ public Content getClassContentHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the serialized content tree section. * * @param serializedTreeContent the serialized content tree to be added * @return a div content tree */ public Content getSerializedContent(Content serializedTreeContent) { Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer, serializedTreeContent); return divContent; } /** * Add the footer. * * @param serializedTree the serialized tree to be added */ public void addFooter(Content serializedTree) { addNavLinks(false, serializedTree); addBottom(serializedTree); } /** * {@inheritDoc} */ public void printDocument(Content serializedTree) throws IOException { printHtmlDocument(null, true, serializedTree); } /** * Return an instance of a SerialFieldWriter. * * @return an instance of a SerialFieldWriter. */ public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) { return new HtmlSerialFieldWriter(this, classDoc); } /** * Return an instance of a SerialMethodWriter. * * @return an instance of a SerialMethodWriter. */ public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) { return new HtmlSerialMethodWriter(this, classDoc); } }
UTF-8
Java
8,152
java
SerializedFormWriterImpl.java
Java
[ { "context": " or\n * deletion without notice.</b>\n *\n * @author Atul M Dambalkar\n */\npublic class SerializedFormWriterImpl extends", "end": 1847, "score": 0.9997757077217102, "start": 1831, "tag": "NAME", "value": "Atul M Dambalkar" } ]
null
[]
/* * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.tools.doclets.formats.html; import java.io.*; import com.sun.javadoc.*; import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.util.DocPaths; import com.sun.tools.doclets.internal.toolkit.util.DocletAbortException; /** * Generate the Serialized Form Information Page. * * <p><b>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. * This code and its internal interfaces are subject to change or * deletion without notice.</b> * * @author <NAME> */ public class SerializedFormWriterImpl extends SubWriterHolderWriter implements SerializedFormWriter { /** * @param configuration the configuration data for the doclet * @throws IOException * @throws DocletAbortException */ public SerializedFormWriterImpl(ConfigurationImpl configuration) throws IOException { super(configuration, DocPaths.SERIALIZED_FORM); } /** * Get the given header. * * @param header the header to write * @return the body content tree */ public Content getHeader(String header) { Content bodyTree = getBody(true, getWindowTitle(header)); addTop(bodyTree); addNavLinks(true, bodyTree); Content h1Content = new StringContent(header); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, h1Content); Content div = HtmlTree.DIV(HtmlStyle.header, heading); bodyTree.addContent(div); return bodyTree; } /** * Get the serialized form summaries header. * * @return the serialized form summary header tree */ public Content getSerializedSummariesHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the package serialized form header. * * @return the package serialized form header tree */ public Content getPackageSerializedHeader() { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); return li; } /** * Get the given package header. * * @param packageName the package header to write * @return a content tree for the package header */ public Content getPackageHeader(String packageName) { Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, packageLabel); heading.addContent(getSpace()); heading.addContent(packageName); return heading; } /** * Get the serialized class header. * * @return a content tree for the serialized class header */ public Content getClassSerializedHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the serializable class heading. * * @param classDoc the class being processed * @return a content tree for the class header */ public Content getClassHeader(ClassDoc classDoc) { Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc) .label(configuration.getClassName(classDoc))) : new StringContent(classDoc.qualifiedName()); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( classDoc.qualifiedName())); Content superClassLink = classDoc.superclassType() != null ? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SERIALIZED_FORM, classDoc.superclassType())) : null; //Print the heading. Content className = superClassLink == null ? configuration.getResource( "doclet.Class_0_implements_serializable", classLink) : configuration.getResource( "doclet.Class_0_extends_implements_serializable", classLink, superClassLink); li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, className)); return li; } /** * Get the serial UID info header. * * @return a content tree for the serial uid info header */ public Content getSerialUIDInfoHeader() { HtmlTree dl = new HtmlTree(HtmlTag.DL); dl.addStyle(HtmlStyle.nameValue); return dl; } /** * Adds the serial UID info. * * @param header the header that will show up before the UID. * @param serialUID the serial UID to print. * @param serialUidTree the serial UID content tree to which the serial UID * content will be added */ public void addSerialUIDInfo(String header, String serialUID, Content serialUidTree) { Content headerContent = new StringContent(header); serialUidTree.addContent(HtmlTree.DT(headerContent)); Content serialContent = new StringContent(serialUID); serialUidTree.addContent(HtmlTree.DD(serialContent)); } /** * Get the class serialize content header. * * @return a content tree for the class serialize content header */ public Content getClassContentHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; } /** * Get the serialized content tree section. * * @param serializedTreeContent the serialized content tree to be added * @return a div content tree */ public Content getSerializedContent(Content serializedTreeContent) { Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer, serializedTreeContent); return divContent; } /** * Add the footer. * * @param serializedTree the serialized tree to be added */ public void addFooter(Content serializedTree) { addNavLinks(false, serializedTree); addBottom(serializedTree); } /** * {@inheritDoc} */ public void printDocument(Content serializedTree) throws IOException { printHtmlDocument(null, true, serializedTree); } /** * Return an instance of a SerialFieldWriter. * * @return an instance of a SerialFieldWriter. */ public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) { return new HtmlSerialFieldWriter(this, classDoc); } /** * Return an instance of a SerialMethodWriter. * * @return an instance of a SerialMethodWriter. */ public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) { return new HtmlSerialMethodWriter(this, classDoc); } }
8,142
0.66131
0.657139
239
33.108788
25.938547
88
false
false
0
0
0
0
0
0
0.405858
false
false
4
2a9664b37118af79f188107565f89e87edabb767
10,831,907,587,476
1c22be79cc6d895e3e73b2b64fe689c97767801a
/src/main/java/org/usfirst/frc/team980/Robot.java
242a603f39236924707f5abf35a2b944c2c5129d
[]
no_license
Team980/2016-Gradle
https://github.com/Team980/2016-Gradle
cb26bc329e559b917c902140c5fa88385228c1f2
ec1c8976e1c49aaae1f69f57b4b270c3b7df1333
refs/heads/master
2017-12-08T11:00:40.966000
2017-08-31T02:24:56
2017-08-31T02:24:56
79,159,689
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.usfirst.frc.team980; import edu.wpi.first.wpilibj.*; //TODO If we want to keep this friendly and nice for 2018 and beyond... //TODO ...we should move all the DriveTrain related stuff into CustomRobotDrive.java //TODO - :P //TODO btw this class is a mess public class Robot extends IterativeRobot { private Spark leftDriveTrain; private Spark rightDriveTrain; private Joystick driveJs; private Joystick driveWheel; private Joystick operatorJs; private Encoder leftDriveEnc; private Encoder rightDriveEnc; private PIDController leftSidePID; private PIDController rightSidePID; private CustomRobotDrive customRobotDrive; private BoulderArm robotArm; public Robot() { leftDriveTrain = new Spark(Parameters.leftMotorCh); rightDriveTrain = new Spark(Parameters.rightMotorCh); rightDriveTrain.setInverted(true); driveJs = new Joystick(Parameters.driveJsCh); driveWheel = new Joystick(Parameters.driveWheelCh); operatorJs = new Joystick(Parameters.armJsCh); leftDriveEnc = new Encoder(Parameters.leftEncChA, Parameters.leftEncChB, Parameters.leftEncInvert, CounterBase.EncodingType.k4X); leftDriveEnc.setDistancePerPulse((2 * (Constants.PI) * (Parameters.wheelRadius / Constants.inchesInFoot)) / (Parameters.encoderCounts)); leftDriveEnc.setPIDSourceType(PIDSourceType.kRate); rightDriveEnc = new Encoder(Parameters.rightEncChA, Parameters.rightEncChB, Parameters.rightEncInvert, CounterBase.EncodingType.k4X); rightDriveEnc.setDistancePerPulse((2 * (Constants.PI) * (Parameters.wheelRadius / Constants.inchesInFoot)) / (Parameters.encoderCounts)); rightDriveEnc.setPIDSourceType(PIDSourceType.kRate); leftSidePID = new PIDController(Parameters.leftPIDp, Parameters.leftPIDi, Parameters.leftPIDd, leftDriveEnc, leftDriveTrain); leftSidePID.setContinuous(); leftSidePID.setPercentTolerance(Parameters.pidPercentTolerance); rightSidePID = new PIDController(Parameters.rightPIDp, Parameters.rightPIDi, Parameters.rightPIDd, rightDriveEnc, rightDriveTrain); rightSidePID.setContinuous(); rightSidePID.setPercentTolerance(Parameters.pidPercentTolerance); customRobotDrive = new CustomRobotDrive(); robotArm = new BoulderArm(); } @Override public void robotInit() { super.robotInit(); } @Override public void disabledInit() { robotArm.disable(); } @Override public void autonomousInit() { super.autonomousInit(); } @Override public void autonomousPeriodic() { super.autonomousPeriodic(); } @Override public void teleopInit() { rightDriveEnc.reset(); leftDriveEnc.reset(); rightSidePID.enable(); leftSidePID.enable(); robotArm.enable(); } @Override public void teleopPeriodic() { customRobotDrive.drive(driveJs, driveWheel, leftDriveTrain, rightDriveTrain, leftSidePID, rightSidePID); robotArm.operate(operatorJs); System.out.println("left enc: " + leftDriveEnc.getRate()); System.out.println("left setpoint: " + leftSidePID.getSetpoint()); System.out.println("right enc: " + rightDriveEnc.getRate()); System.out.println("right setpoint: " + rightSidePID.getSetpoint()); } }
UTF-8
Java
3,409
java
Robot.java
Java
[]
null
[]
package org.usfirst.frc.team980; import edu.wpi.first.wpilibj.*; //TODO If we want to keep this friendly and nice for 2018 and beyond... //TODO ...we should move all the DriveTrain related stuff into CustomRobotDrive.java //TODO - :P //TODO btw this class is a mess public class Robot extends IterativeRobot { private Spark leftDriveTrain; private Spark rightDriveTrain; private Joystick driveJs; private Joystick driveWheel; private Joystick operatorJs; private Encoder leftDriveEnc; private Encoder rightDriveEnc; private PIDController leftSidePID; private PIDController rightSidePID; private CustomRobotDrive customRobotDrive; private BoulderArm robotArm; public Robot() { leftDriveTrain = new Spark(Parameters.leftMotorCh); rightDriveTrain = new Spark(Parameters.rightMotorCh); rightDriveTrain.setInverted(true); driveJs = new Joystick(Parameters.driveJsCh); driveWheel = new Joystick(Parameters.driveWheelCh); operatorJs = new Joystick(Parameters.armJsCh); leftDriveEnc = new Encoder(Parameters.leftEncChA, Parameters.leftEncChB, Parameters.leftEncInvert, CounterBase.EncodingType.k4X); leftDriveEnc.setDistancePerPulse((2 * (Constants.PI) * (Parameters.wheelRadius / Constants.inchesInFoot)) / (Parameters.encoderCounts)); leftDriveEnc.setPIDSourceType(PIDSourceType.kRate); rightDriveEnc = new Encoder(Parameters.rightEncChA, Parameters.rightEncChB, Parameters.rightEncInvert, CounterBase.EncodingType.k4X); rightDriveEnc.setDistancePerPulse((2 * (Constants.PI) * (Parameters.wheelRadius / Constants.inchesInFoot)) / (Parameters.encoderCounts)); rightDriveEnc.setPIDSourceType(PIDSourceType.kRate); leftSidePID = new PIDController(Parameters.leftPIDp, Parameters.leftPIDi, Parameters.leftPIDd, leftDriveEnc, leftDriveTrain); leftSidePID.setContinuous(); leftSidePID.setPercentTolerance(Parameters.pidPercentTolerance); rightSidePID = new PIDController(Parameters.rightPIDp, Parameters.rightPIDi, Parameters.rightPIDd, rightDriveEnc, rightDriveTrain); rightSidePID.setContinuous(); rightSidePID.setPercentTolerance(Parameters.pidPercentTolerance); customRobotDrive = new CustomRobotDrive(); robotArm = new BoulderArm(); } @Override public void robotInit() { super.robotInit(); } @Override public void disabledInit() { robotArm.disable(); } @Override public void autonomousInit() { super.autonomousInit(); } @Override public void autonomousPeriodic() { super.autonomousPeriodic(); } @Override public void teleopInit() { rightDriveEnc.reset(); leftDriveEnc.reset(); rightSidePID.enable(); leftSidePID.enable(); robotArm.enable(); } @Override public void teleopPeriodic() { customRobotDrive.drive(driveJs, driveWheel, leftDriveTrain, rightDriveTrain, leftSidePID, rightSidePID); robotArm.operate(operatorJs); System.out.println("left enc: " + leftDriveEnc.getRate()); System.out.println("left setpoint: " + leftSidePID.getSetpoint()); System.out.println("right enc: " + rightDriveEnc.getRate()); System.out.println("right setpoint: " + rightSidePID.getSetpoint()); } }
3,409
0.707539
0.704312
105
31.466667
36.052097
145
false
false
0
0
0
0
0
0
0.638095
false
false
4
3ccb6741b5657af9f771d90281b19a47ae99f2f5
24,481,313,610,956
7b742e48024886450fc470b7703cfb85640832b7
/app/models/Section.java
5ab57c74801bfeffaba3719c630cda8efd0e6998
[ "MIT" ]
permissive
superelitist/demschooltools
https://github.com/superelitist/demschooltools
abde13d190583278b6a7c40733bbd06fbccb6a41
228cb56b1f7161e66d0c82d919fd1703d43cb0bf
refs/heads/master
2020-05-24T10:07:40.756000
2019-05-13T13:27:11
2019-05-13T13:27:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package models; import java.util.*; import javax.persistence.*; import com.avaje.ebean.annotation.Where; import com.avaje.ebean.Ebean; import com.avaje.ebean.Expr; import com.avaje.ebean.RawSql; import com.avaje.ebean.RawSqlBuilder; import controllers.*; import com.fasterxml.jackson.annotation.*; import play.data.*; import play.data.validation.Constraints.*; import play.data.validation.ValidationError; import com.avaje.ebean.Model; import static play.libs.F.*; @Entity public class Section extends Model { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "section_id_seq") public Integer id; public String title = ""; public String num = ""; @OneToMany(mappedBy="section") @OrderBy("num ASC") @Where(clause = "${ta}.deleted = false") @JsonIgnore public List<Entry> entries; @ManyToOne() public Chapter chapter; public Boolean deleted; public static Finder<Integer,Section> find = new Finder<Integer,Section>( Section.class ); public static Section findById(int id) { return find.where().eq("chapter.organization", Organization.getByHost()) .eq("id", id).findUnique(); } public String getNumber() { return chapter.num + num; } public void updateFromForm(Form<Section> form) { title = form.field("title").value(); num = form.field("num").value(); chapter = Chapter.find.byId(Integer.parseInt(form.field("chapter.id").value())); String deleted_val = form.field("deleted").value(); deleted = deleted_val != null && deleted_val.equals("true"); save(); } public static Section create(Form<Section> form) { Section result = form.get(); result.updateFromForm(form); result.save(); return result; } }
UTF-8
Java
1,755
java
Section.java
Java
[]
null
[]
package models; import java.util.*; import javax.persistence.*; import com.avaje.ebean.annotation.Where; import com.avaje.ebean.Ebean; import com.avaje.ebean.Expr; import com.avaje.ebean.RawSql; import com.avaje.ebean.RawSqlBuilder; import controllers.*; import com.fasterxml.jackson.annotation.*; import play.data.*; import play.data.validation.Constraints.*; import play.data.validation.ValidationError; import com.avaje.ebean.Model; import static play.libs.F.*; @Entity public class Section extends Model { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "section_id_seq") public Integer id; public String title = ""; public String num = ""; @OneToMany(mappedBy="section") @OrderBy("num ASC") @Where(clause = "${ta}.deleted = false") @JsonIgnore public List<Entry> entries; @ManyToOne() public Chapter chapter; public Boolean deleted; public static Finder<Integer,Section> find = new Finder<Integer,Section>( Section.class ); public static Section findById(int id) { return find.where().eq("chapter.organization", Organization.getByHost()) .eq("id", id).findUnique(); } public String getNumber() { return chapter.num + num; } public void updateFromForm(Form<Section> form) { title = form.field("title").value(); num = form.field("num").value(); chapter = Chapter.find.byId(Integer.parseInt(form.field("chapter.id").value())); String deleted_val = form.field("deleted").value(); deleted = deleted_val != null && deleted_val.equals("true"); save(); } public static Section create(Form<Section> form) { Section result = form.get(); result.updateFromForm(form); result.save(); return result; } }
1,755
0.690598
0.690598
71
23.718309
21.439192
82
false
false
0
0
0
0
0
0
0.943662
false
false
4
394ec2d5c3bc4a61d32ba0b393830b2a5d09b3bc
1,108,101,627,290
cd99bd8bb825acddfee7f43d9c7a81bee75dbd69
/NotariatAdminCore/NotariatAdminDAL/src/main/java/com/allegoria/admin/dal/repositories/office/AdresseOfficeRepository.java
77b7d0408113c68c401da666ef0305d4147e3fb4
[]
no_license
Moussi/ThymLeafTemplateHTML5Integration
https://github.com/Moussi/ThymLeafTemplateHTML5Integration
8dfef233d467bcfd20a6f8d95e1acd78ee2c93c1
5beafd10fd11a41a64535a43e710d684ab3311d4
refs/heads/master
2020-04-17T10:11:57.706000
2015-01-19T20:09:22
2015-01-19T20:09:22
29,489,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.allegoria.admin.dal.repositories.office; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.allegoria.admin.dom.office.AdresseOffice; @Repository public interface AdresseOfficeRepository extends JpaRepository<AdresseOffice, Long> { }
UTF-8
Java
324
java
AdresseOfficeRepository.java
Java
[]
null
[]
package com.allegoria.admin.dal.repositories.office; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.allegoria.admin.dom.office.AdresseOffice; @Repository public interface AdresseOfficeRepository extends JpaRepository<AdresseOffice, Long> { }
324
0.842593
0.842593
12
26
24.644135
61
false
false
0
0
0
0
0
0
0.583333
false
false
4
c2cadfe0277e1dc78ced9863bfd789ba716fc18e
1,460,288,909,083
3305bee15a0974a1b1111eddc90fc815b20354ac
/placement/moves/PMove.java
7bee93e27c20a09815ae196d78c8cddcc785d5cc
[]
no_license
Yashwanth4/PlacementApp
https://github.com/Yashwanth4/PlacementApp
11cb08bbaf671f09ef52a16dfce3cb21ef612564
366f7630e4b58f355c56b969b9ca05716c38a764
refs/heads/master
2023-03-17T14:22:14.746000
2020-06-22T16:35:04
2020-06-22T16:35:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package placement.moves; import placement.*; import placement.ui.*; /** * Title: PlacementApplet * Description: Animation of VLSI Module Placement * Copyright: Copyright (c) 2001 * Company: Lafayette College * @author John Nestor * @version 1.0 */ /** PMove objects represent different types of moves - each move type is a different subclass that must perform the move. Each subtype is a singleton object that is re-used on later move applications. To get a move, use the static method PMove.selectMove(). <br><br> A move goes through several steps: <ol> <LI>setup - assigns a move module, computes an offset if appropriate, but does not apply. <LI>apply - apply the move <LI>accept - mark move as accepted <LI>reject - mark move as rejected <LI>complete - mark move as completed (after this it is ignored) </ol> <br><br> Each move has a selection weight selectionWt; the sum of all selectionWts must be 1.0 <br><br> This class also supports range limited given an initial window, intial temperature and updated temperature during cooling. */ public abstract class PMove { private PMoveStatus moveStatus = PMoveStatus.MOVE_COMPLETE; // initialize as pending when we use selectMove private double acceptProbability = 0.0; private double acceptRandom = 0.0; protected int deltaCost = 0; protected PModule moveModule; private double selectionWt = 0.0; protected int offset = 0; /** array of move instances - each move has a selectionWt; the sum of all weights must be 1.0. Moves are initialized with some default weights - these can be changed with setSelectionWt() */ // alternative: sum weights and normalize on each try - then, weights don't // need to sum up! private static final PMove [] moveArray = { new PMoveV(0.35), new PMoveH(0.35), new PMoveRotate(0.1), new PMoveFlipH(0.1), new PMoveFlipV(0.1) }; private static PMoveHistory moveHistory = new PMoveHistory(); public static PMoveHistory getHistory() { return moveHistory; } public static void resetHistory(int cost) { moveHistory.reset(cost); } abstract public UIMove getUIMove(); /** select and apply a move by walking through the moveArray and MoveWeights array. Note if a selectionWt entry is 0.0 that move will not be selected, which is what we want */ public static PMove selectMove(PModule pm) { PMove selMove; double r = Math.random(); double sp = 0.0; for (int i=0; i< moveArray.length; i++) { selMove = moveArray[i]; sp += selMove.selectionWt; if (r < sp) { selMove.setup(pm); return selMove; } } // if we get here it's an error, but salvage anyway selMove = moveArray[moveArray.length - 1]; selMove.setup(pm); return selMove; } /** used by subclass to add "rejected" string when necessary */ protected String moveString(String mstr) { mstr += " " + moveModule.getName(); if (moveStatus == PMoveStatus.ACCEPT_PENDING || moveStatus == PMoveStatus.REJECT_PENDING) mstr += " dCost=" + deltaCost; return mstr + " [" + moveStatus.toString() + "]"; } /** initialize a move - called for all subclasses */ protected PMove(double sw) { moveStatus = PMoveStatus.MOVE_COMPLETE; selectionWt = sw; } public int getOffset() { return offset; } public int getDeltaCost() { return deltaCost; } public PModule getMoveModule() { return moveModule; } public PMoveStatus getMoveStatus() { return moveStatus; } public double getAcceptProbability() { return acceptProbability; } public double getAcceptRandom() { return acceptRandom; } /** initialize move before applying - override to provide specifics (move direction, move etc. */ void setup(PModule pm) { moveModule = pm; moveStatus = PMoveStatus.MOVE_PENDING; } /** apply a move - override to do the move, but call super.apply() to update moveStatus */ public void apply() { if (moveStatus != PMoveStatus.MOVE_PENDING) System.out.println("PMove.apply(): must only apply NEW moves!"); else moveStatus = PMoveStatus.MOVE_APPLIED; } /** Downhill-only accept decision */ public boolean greedyAccept() { if (moveStatus != PMoveStatus.MOVE_APPLIED) { System.out.println("PMove.greedyAccept(): can't accept move unless applied first!"); return false; // really ought to throw an exception here! } if (deltaCost < 0) { accept(); return true; } else { reject(); return false; } } /** Use Metropolis algorithm to accept/reject a move. It should not be necessary to override this */ public boolean metropolisAccept(double temp) { if (moveStatus != PMoveStatus.MOVE_APPLIED) { System.out.println("PMove.metropolisAccept(): can't accept move unless applied first!"); return false; // really ought to throw an exception here! } if (deltaCost < 0 || temp == Double.POSITIVE_INFINITY) { acceptProbability = 1.0; acceptRandom = 1.0; accept(); return true; } else { acceptProbability = Math.exp( (double)(-deltaCost) / temp ); if (acceptProbability > 1.0) System.out.println("AWK! accept probability > 1!"); acceptRandom = Math.random(); if (acceptRandom < acceptProbability) { accept(); return true; } } reject(); return false; } public void accept() { if (moveStatus != PMoveStatus.MOVE_APPLIED) System.out.println("PMove.accept(): can't reject move unless applied first!"); else { moveStatus = PMoveStatus.ACCEPT_PENDING; moveHistory.add(new PMoveHistoryPoint(deltaCost,acceptProbability,acceptRandom)); } } public void reject() { if (moveStatus != PMoveStatus.MOVE_APPLIED) System.out.println("PMove.reject(): can't reject move unless applied first!"); else { moveStatus = PMoveStatus.REJECT_PENDING; moveHistory.add(new PMoveHistoryPoint(deltaCost,acceptProbability,acceptRandom)); } } /** mark a move as completed - must be overridden to reverse rejected * moves (after undo, overriding method should call super.complete() * to update state) */ public void complete() { if (moveStatus != PMoveStatus.ACCEPT_PENDING && moveStatus != PMoveStatus.REJECT_PENDING) System.out.println("PMove.complete(): accept/reject not pending!"); else { moveStatus = PMoveStatus.MOVE_COMPLETE; acceptProbability = -1.0; acceptRandom = -1.0; } } // windowing & range-limiting stuff private static int windowX = 0; private static int windowY = 0; private static double logT0 = 0.0; private static double windowScale = 1.0; public static void setWindow(int wx, int wy) { windowX = wx; windowY = wy; } public static void setT0(double t) { logT0 = Math.log(t); windowScale = 1.0; } public static void setT(double t) { if (t == Double.POSITIVE_INFINITY) windowScale = 1.0; else windowScale = Math.log(t) / logT0; } public static int genX() { if (windowScale <= 0) return 1; else return (int)(windowX * windowScale); } public static int genY() { if (windowScale <= 0) return 1; else return (int)(windowY * windowScale); } }
UTF-8
Java
7,251
java
PMove.java
Java
[ { "context": "2001\n * Company: Lafayette College\n * @author John Nestor\n * @version 1.0\n */\n/** PMove objects represent d", "end": 251, "score": 0.9998793601989746, "start": 240, "tag": "NAME", "value": "John Nestor" } ]
null
[]
package placement.moves; import placement.*; import placement.ui.*; /** * Title: PlacementApplet * Description: Animation of VLSI Module Placement * Copyright: Copyright (c) 2001 * Company: Lafayette College * @author <NAME> * @version 1.0 */ /** PMove objects represent different types of moves - each move type is a different subclass that must perform the move. Each subtype is a singleton object that is re-used on later move applications. To get a move, use the static method PMove.selectMove(). <br><br> A move goes through several steps: <ol> <LI>setup - assigns a move module, computes an offset if appropriate, but does not apply. <LI>apply - apply the move <LI>accept - mark move as accepted <LI>reject - mark move as rejected <LI>complete - mark move as completed (after this it is ignored) </ol> <br><br> Each move has a selection weight selectionWt; the sum of all selectionWts must be 1.0 <br><br> This class also supports range limited given an initial window, intial temperature and updated temperature during cooling. */ public abstract class PMove { private PMoveStatus moveStatus = PMoveStatus.MOVE_COMPLETE; // initialize as pending when we use selectMove private double acceptProbability = 0.0; private double acceptRandom = 0.0; protected int deltaCost = 0; protected PModule moveModule; private double selectionWt = 0.0; protected int offset = 0; /** array of move instances - each move has a selectionWt; the sum of all weights must be 1.0. Moves are initialized with some default weights - these can be changed with setSelectionWt() */ // alternative: sum weights and normalize on each try - then, weights don't // need to sum up! private static final PMove [] moveArray = { new PMoveV(0.35), new PMoveH(0.35), new PMoveRotate(0.1), new PMoveFlipH(0.1), new PMoveFlipV(0.1) }; private static PMoveHistory moveHistory = new PMoveHistory(); public static PMoveHistory getHistory() { return moveHistory; } public static void resetHistory(int cost) { moveHistory.reset(cost); } abstract public UIMove getUIMove(); /** select and apply a move by walking through the moveArray and MoveWeights array. Note if a selectionWt entry is 0.0 that move will not be selected, which is what we want */ public static PMove selectMove(PModule pm) { PMove selMove; double r = Math.random(); double sp = 0.0; for (int i=0; i< moveArray.length; i++) { selMove = moveArray[i]; sp += selMove.selectionWt; if (r < sp) { selMove.setup(pm); return selMove; } } // if we get here it's an error, but salvage anyway selMove = moveArray[moveArray.length - 1]; selMove.setup(pm); return selMove; } /** used by subclass to add "rejected" string when necessary */ protected String moveString(String mstr) { mstr += " " + moveModule.getName(); if (moveStatus == PMoveStatus.ACCEPT_PENDING || moveStatus == PMoveStatus.REJECT_PENDING) mstr += " dCost=" + deltaCost; return mstr + " [" + moveStatus.toString() + "]"; } /** initialize a move - called for all subclasses */ protected PMove(double sw) { moveStatus = PMoveStatus.MOVE_COMPLETE; selectionWt = sw; } public int getOffset() { return offset; } public int getDeltaCost() { return deltaCost; } public PModule getMoveModule() { return moveModule; } public PMoveStatus getMoveStatus() { return moveStatus; } public double getAcceptProbability() { return acceptProbability; } public double getAcceptRandom() { return acceptRandom; } /** initialize move before applying - override to provide specifics (move direction, move etc. */ void setup(PModule pm) { moveModule = pm; moveStatus = PMoveStatus.MOVE_PENDING; } /** apply a move - override to do the move, but call super.apply() to update moveStatus */ public void apply() { if (moveStatus != PMoveStatus.MOVE_PENDING) System.out.println("PMove.apply(): must only apply NEW moves!"); else moveStatus = PMoveStatus.MOVE_APPLIED; } /** Downhill-only accept decision */ public boolean greedyAccept() { if (moveStatus != PMoveStatus.MOVE_APPLIED) { System.out.println("PMove.greedyAccept(): can't accept move unless applied first!"); return false; // really ought to throw an exception here! } if (deltaCost < 0) { accept(); return true; } else { reject(); return false; } } /** Use Metropolis algorithm to accept/reject a move. It should not be necessary to override this */ public boolean metropolisAccept(double temp) { if (moveStatus != PMoveStatus.MOVE_APPLIED) { System.out.println("PMove.metropolisAccept(): can't accept move unless applied first!"); return false; // really ought to throw an exception here! } if (deltaCost < 0 || temp == Double.POSITIVE_INFINITY) { acceptProbability = 1.0; acceptRandom = 1.0; accept(); return true; } else { acceptProbability = Math.exp( (double)(-deltaCost) / temp ); if (acceptProbability > 1.0) System.out.println("AWK! accept probability > 1!"); acceptRandom = Math.random(); if (acceptRandom < acceptProbability) { accept(); return true; } } reject(); return false; } public void accept() { if (moveStatus != PMoveStatus.MOVE_APPLIED) System.out.println("PMove.accept(): can't reject move unless applied first!"); else { moveStatus = PMoveStatus.ACCEPT_PENDING; moveHistory.add(new PMoveHistoryPoint(deltaCost,acceptProbability,acceptRandom)); } } public void reject() { if (moveStatus != PMoveStatus.MOVE_APPLIED) System.out.println("PMove.reject(): can't reject move unless applied first!"); else { moveStatus = PMoveStatus.REJECT_PENDING; moveHistory.add(new PMoveHistoryPoint(deltaCost,acceptProbability,acceptRandom)); } } /** mark a move as completed - must be overridden to reverse rejected * moves (after undo, overriding method should call super.complete() * to update state) */ public void complete() { if (moveStatus != PMoveStatus.ACCEPT_PENDING && moveStatus != PMoveStatus.REJECT_PENDING) System.out.println("PMove.complete(): accept/reject not pending!"); else { moveStatus = PMoveStatus.MOVE_COMPLETE; acceptProbability = -1.0; acceptRandom = -1.0; } } // windowing & range-limiting stuff private static int windowX = 0; private static int windowY = 0; private static double logT0 = 0.0; private static double windowScale = 1.0; public static void setWindow(int wx, int wy) { windowX = wx; windowY = wy; } public static void setT0(double t) { logT0 = Math.log(t); windowScale = 1.0; } public static void setT(double t) { if (t == Double.POSITIVE_INFINITY) windowScale = 1.0; else windowScale = Math.log(t) / logT0; } public static int genX() { if (windowScale <= 0) return 1; else return (int)(windowX * windowScale); } public static int genY() { if (windowScale <= 0) return 1; else return (int)(windowY * windowScale); } }
7,246
0.674941
0.665701
228
30.789474
26.601171
111
false
false
0
0
0
0
0
0
0.798246
false
false
4
6dfef3ad3ba3bec349b0554e096290ef03b51164
27,839,978,080,938
ab3656abafd775b20f6e9f5a6e66dcdb29dd9fad
/src/pex4_middleearthmonopoly/Chest.java
f231f72e71475f6a882137cde58d3d3d4b30fa7c
[]
no_license
RhettFitchett/MiddleEarthMonopolyJava
https://github.com/RhettFitchett/MiddleEarthMonopolyJava
309d37582dc691a7b78526d47b8f3d2974f5d3e4
72c387722fe60ba67a5ffe3816e8648894a381cf
refs/heads/master
2020-03-13T22:33:37.844000
2018-04-27T16:34:08
2018-04-27T16:34:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pex4_middleearthmonopoly; /** * * @author Boba Rhett */ public class Chest extends Card{ public Chest(String nam, String descriptin, Double psX, Double psY) { super(nam, descriptin, psX, psY); } }
UTF-8
Java
425
java
Chest.java
Java
[ { "context": "ckage pex4_middleearthmonopoly;\n\n/**\n *\n * @author Boba Rhett\n */\npublic class Chest extends Card{\n \n pub", "end": 248, "score": 0.9998883008956909, "start": 238, "tag": "NAME", "value": "Boba Rhett" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pex4_middleearthmonopoly; /** * * @author <NAME> */ public class Chest extends Card{ public Chest(String nam, String descriptin, Double psX, Double psY) { super(nam, descriptin, psX, psY); } }
421
0.675294
0.672941
19
21.368422
25.140051
79
false
false
0
0
0
0
0
0
0.578947
false
false
4
a0d72b9cbc83432e113c53fb0012149e23dfb849
29,807,073,060,828
42afdf58237ea50436725d4940a526b79127bbea
/java-environment/Day2/src/basics/HelloWorld.java
1798767891a17c6ad37c11cfb938b2cddc5a0d1f
[]
no_license
LiliBag/8302021_RAP
https://github.com/LiliBag/8302021_RAP
9de26977cee5451720e50c2757d8e4e46cb8f5f5
8882f2a452e5cc75a882f1338b1823dd19b3cd89
refs/heads/main
2023-07-18T05:28:48.884000
2021-09-06T14:40:32
2021-09-06T14:40:32
403,927,624
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * The package declaration should be the * first line of every java file (save for * code comments) */ package basics; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
UTF-8
Java
237
java
HelloWorld.java
Java
[]
null
[]
/* * The package declaration should be the * first line of every java file (save for * code comments) */ package basics; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
237
0.696203
0.696203
12
18.75
16.713892
42
false
false
0
0
0
0
0
0
0.5
false
false
4
466ed2dcac1cfb8989c5217e04e34770422ce43b
21,182,778,751,893
f8290601c07a649cb5245d1d2ed02965be3777e3
/Q2/Main.java
e5209d9805a52ee8590cb72481fef2b98c32175f
[]
no_license
SquareSquire286/ENSE370-Practice-Exam2
https://github.com/SquareSquire286/ENSE370-Practice-Exam2
7535bfb721d636d9dc834bba7420ceb8d849e605
02813075394e16ebea62a3c05756499ec665087a
refs/heads/main
2023-03-09T00:01:25.038000
2021-03-01T23:45:20
2021-03-01T23:45:20
343,500,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Main { public static void main(String[] args) { AbstractVacationPackage vacation1 = new BasicDecorator(new NoFrillsDecorator(new VacationPackage())); System.out.println("Vacation 1:"); vacation1.displayCost(); vacation1.displayArrangements(); System.out.println(); AbstractVacationPackage vacation2 = new DeluxeDecorator(new BasicDecorator(new NoFrillsDecorator(new VacationPackage()))); System.out.println("Vacation 2:"); vacation2.displayCost(); vacation2.displayArrangements(); System.out.println(); return; } }
UTF-8
Java
553
java
Main.java
Java
[]
null
[]
public class Main { public static void main(String[] args) { AbstractVacationPackage vacation1 = new BasicDecorator(new NoFrillsDecorator(new VacationPackage())); System.out.println("Vacation 1:"); vacation1.displayCost(); vacation1.displayArrangements(); System.out.println(); AbstractVacationPackage vacation2 = new DeluxeDecorator(new BasicDecorator(new NoFrillsDecorator(new VacationPackage()))); System.out.println("Vacation 2:"); vacation2.displayCost(); vacation2.displayArrangements(); System.out.println(); return; } }
553
0.761302
0.746835
19
28.105263
32.068832
123
false
false
0
0
0
0
0
0
1.157895
false
false
4
5978d4ecd5dbb069e95c58a6709c024f562dcb87
4,664,334,537,591
659ab7ed7c7aab4ebdfddfd5731a5dd9f7687a23
/app/src/main/java/com/rainbow/kam/android_ble_control/ui/adapter/profile/ProfileAdapter.java
c0c5c8fa1e6e32a64f5a2d23a802fec17ba0ed61
[]
no_license
NeedPainkiller/Android-BLE-Control
https://github.com/NeedPainkiller/Android-BLE-Control
50d46608a4028bcc8f8ee6d1e1826c36bf03e7b4
f0d10c0f863bb998dc312ef5da65e6421e3d7216
refs/heads/master
2021-08-27T15:58:03.800000
2016-05-20T07:49:02
2016-05-20T07:49:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rainbow.kam.android_ble_control.ui.adapter.profile; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.google.common.collect.Lists; import com.rainbow.kam.android_ble_control.R; import com.rainbow.kam.android_ble_control.ui.adapter.ViewHolder; import com.rainbow.kam.ble_gatt_manager.GattAttributes; import java.util.List; import javax.inject.Inject; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by kam6512 on 2016-04-27. */ public class ProfileAdapter extends RecyclerView.Adapter<ViewHolder> { private final String uuidLabel; private static final int TYPE_SERVICE = 0; private static final int TYPE_CHARACTERISTIC = 1; private static int CURRENT_TYPE = TYPE_SERVICE; private List<BluetoothGattService> bluetoothGattServices = Lists.newArrayList(); private List<BluetoothGattCharacteristic> bluetoothGattCharacteristics = Lists.newArrayList(); private final OnGattItemClickListener onGattItemClickListener; @Inject public ProfileAdapter(Context context) { uuidLabel = context.getString(R.string.profile_uuid_label); this.onGattItemClickListener = (OnGattItemClickListener) context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); View view; if (viewType == TYPE_SERVICE) { view = layoutInflater.inflate(R.layout.i_profile_bluetooth_service, parent, false); return new ServiceViewHolder(view); } else if (viewType == TYPE_CHARACTERISTIC) { view = layoutInflater.inflate(R.layout.i_profile_bluetooth_characteristics, parent, false); return new CharacteristicViewHolder(view); } return null; } @Override public void onBindViewHolder(ViewHolder holder, int position) { int type = getItemViewType(position); if (type == TYPE_SERVICE) { holder.bindViews(bluetoothGattServices.get(position)); } else if (type == TYPE_CHARACTERISTIC) { holder.bindViews(bluetoothGattCharacteristics.get(position)); } } @Override public int getItemCount() { if (CURRENT_TYPE == TYPE_SERVICE) { return bluetoothGattServices.size(); } else { return bluetoothGattCharacteristics.size(); } } @Override public int getItemViewType(int position) { return CURRENT_TYPE; } public void setServiceList(List<BluetoothGattService> bluetoothGattServices) { this.bluetoothGattServices.clear(); this.bluetoothGattServices.addAll(bluetoothGattServices); showServiceList(); } public void setCharacteristicList(List<BluetoothGattCharacteristic> bluetoothGattCharacteristics) { this.bluetoothGattCharacteristics.clear(); this.bluetoothGattCharacteristics.addAll(bluetoothGattCharacteristics); showCharacteristic(); } public void showServiceList() { CURRENT_TYPE = TYPE_SERVICE; notifyDataSetChanged(); } public void showCharacteristic() { CURRENT_TYPE = TYPE_CHARACTERISTIC; notifyDataSetChanged(); } public boolean hasBackStack() { return CURRENT_TYPE == TYPE_CHARACTERISTIC; } private String splitUUID(String uuid) { return uuidLabel + uuid.trim().toUpperCase().replace(GattAttributes.UUID_LABEL, "").replace("0000", ""); } class ServiceViewHolder extends ViewHolder { @Bind(R.id.profile_service_name) TextView serviceTitle; @Bind(R.id.profile_service_UUID) TextView serviceUuid; @Bind(R.id.profile_service_type) TextView serviceType; public ServiceViewHolder(final View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void bindViews(final BluetoothGattService bluetoothGattService) { String uuid = bluetoothGattService.getUuid().toString(); String name = GattAttributes.resolveServiceName(uuid); String type = GattAttributes.resolveServiceType(bluetoothGattService.getType()); serviceTitle.setText(name); serviceUuid.setText(splitUUID(uuid)); serviceType.setText(type); } @OnClick(R.id.profile_item_service) void onServiceSelect() { onGattItemClickListener.onServiceClickListener(bluetoothGattServices.get(getLayoutPosition())); } } class CharacteristicViewHolder extends ViewHolder { @Bind(R.id.profile_characteristic_name) TextView characteristicTitle; @Bind(R.id.profile_characteristic_UUID) TextView characteristicUuid; public CharacteristicViewHolder(final View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void bindViews(final BluetoothGattCharacteristic bluetoothGattCharacteristic) { String uuid = bluetoothGattCharacteristic.getUuid().toString(); String name = GattAttributes.resolveCharacteristicName(uuid); characteristicTitle.setText(name); characteristicUuid.setText(splitUUID(uuid)); } @OnClick(R.id.profile_item_characteristic) void onCharacteristicSelect() { onGattItemClickListener.onCharacteristicClickListener(bluetoothGattCharacteristics.get(getLayoutPosition())); } } }
UTF-8
Java
5,787
java
ProfileAdapter.java
Java
[ { "context": "fe;\nimport butterknife.OnClick;\n\n/**\n * Created by kam6512 on 2016-04-27.\n */\npublic class ProfileAdapter ex", "end": 744, "score": 0.999540388584137, "start": 737, "tag": "USERNAME", "value": "kam6512" } ]
null
[]
package com.rainbow.kam.android_ble_control.ui.adapter.profile; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.google.common.collect.Lists; import com.rainbow.kam.android_ble_control.R; import com.rainbow.kam.android_ble_control.ui.adapter.ViewHolder; import com.rainbow.kam.ble_gatt_manager.GattAttributes; import java.util.List; import javax.inject.Inject; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by kam6512 on 2016-04-27. */ public class ProfileAdapter extends RecyclerView.Adapter<ViewHolder> { private final String uuidLabel; private static final int TYPE_SERVICE = 0; private static final int TYPE_CHARACTERISTIC = 1; private static int CURRENT_TYPE = TYPE_SERVICE; private List<BluetoothGattService> bluetoothGattServices = Lists.newArrayList(); private List<BluetoothGattCharacteristic> bluetoothGattCharacteristics = Lists.newArrayList(); private final OnGattItemClickListener onGattItemClickListener; @Inject public ProfileAdapter(Context context) { uuidLabel = context.getString(R.string.profile_uuid_label); this.onGattItemClickListener = (OnGattItemClickListener) context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); View view; if (viewType == TYPE_SERVICE) { view = layoutInflater.inflate(R.layout.i_profile_bluetooth_service, parent, false); return new ServiceViewHolder(view); } else if (viewType == TYPE_CHARACTERISTIC) { view = layoutInflater.inflate(R.layout.i_profile_bluetooth_characteristics, parent, false); return new CharacteristicViewHolder(view); } return null; } @Override public void onBindViewHolder(ViewHolder holder, int position) { int type = getItemViewType(position); if (type == TYPE_SERVICE) { holder.bindViews(bluetoothGattServices.get(position)); } else if (type == TYPE_CHARACTERISTIC) { holder.bindViews(bluetoothGattCharacteristics.get(position)); } } @Override public int getItemCount() { if (CURRENT_TYPE == TYPE_SERVICE) { return bluetoothGattServices.size(); } else { return bluetoothGattCharacteristics.size(); } } @Override public int getItemViewType(int position) { return CURRENT_TYPE; } public void setServiceList(List<BluetoothGattService> bluetoothGattServices) { this.bluetoothGattServices.clear(); this.bluetoothGattServices.addAll(bluetoothGattServices); showServiceList(); } public void setCharacteristicList(List<BluetoothGattCharacteristic> bluetoothGattCharacteristics) { this.bluetoothGattCharacteristics.clear(); this.bluetoothGattCharacteristics.addAll(bluetoothGattCharacteristics); showCharacteristic(); } public void showServiceList() { CURRENT_TYPE = TYPE_SERVICE; notifyDataSetChanged(); } public void showCharacteristic() { CURRENT_TYPE = TYPE_CHARACTERISTIC; notifyDataSetChanged(); } public boolean hasBackStack() { return CURRENT_TYPE == TYPE_CHARACTERISTIC; } private String splitUUID(String uuid) { return uuidLabel + uuid.trim().toUpperCase().replace(GattAttributes.UUID_LABEL, "").replace("0000", ""); } class ServiceViewHolder extends ViewHolder { @Bind(R.id.profile_service_name) TextView serviceTitle; @Bind(R.id.profile_service_UUID) TextView serviceUuid; @Bind(R.id.profile_service_type) TextView serviceType; public ServiceViewHolder(final View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void bindViews(final BluetoothGattService bluetoothGattService) { String uuid = bluetoothGattService.getUuid().toString(); String name = GattAttributes.resolveServiceName(uuid); String type = GattAttributes.resolveServiceType(bluetoothGattService.getType()); serviceTitle.setText(name); serviceUuid.setText(splitUUID(uuid)); serviceType.setText(type); } @OnClick(R.id.profile_item_service) void onServiceSelect() { onGattItemClickListener.onServiceClickListener(bluetoothGattServices.get(getLayoutPosition())); } } class CharacteristicViewHolder extends ViewHolder { @Bind(R.id.profile_characteristic_name) TextView characteristicTitle; @Bind(R.id.profile_characteristic_UUID) TextView characteristicUuid; public CharacteristicViewHolder(final View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void bindViews(final BluetoothGattCharacteristic bluetoothGattCharacteristic) { String uuid = bluetoothGattCharacteristic.getUuid().toString(); String name = GattAttributes.resolveCharacteristicName(uuid); characteristicTitle.setText(name); characteristicUuid.setText(splitUUID(uuid)); } @OnClick(R.id.profile_item_characteristic) void onCharacteristicSelect() { onGattItemClickListener.onCharacteristicClickListener(bluetoothGattCharacteristics.get(getLayoutPosition())); } } }
5,787
0.699844
0.696561
179
31.324022
30.816198
121
false
false
0
0
0
0
0
0
0.463687
false
false
4
9af2489c3bde27ef4c347b4ef27d73b74941ea05
12,438,225,314,396
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i58115.java
1d987bd9d06a92afb7816921c2b9850563615a62
[]
no_license
vincentclee/jvm-limits
https://github.com/vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711000
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package number_of_direct_superinterfaces; public interface i58115 {}
UTF-8
Java
69
java
i58115.java
Java
[]
null
[]
package number_of_direct_superinterfaces; public interface i58115 {}
69
0.826087
0.753623
3
22.333334
16.937796
41
false
false
0
0
0
0
0
0
0.333333
false
false
4
2768c7b6f6b2595d6e96882d9b72a6cc843f1169
11,312,943,924,133
3800ba9f271542209190a1ad83c4cfaa3de0dbb0
/src/test/java/com/edvantis/workopolis/VacanciesControllerTest.java
93d2272aa08eb8edf1b993a2f76e9fc7b3f7d730
[]
no_license
nero94/workopolis
https://github.com/nero94/workopolis
14b54237a977c92f8c53bb115cdca88e0638874c
62499c53145a360098c2d2530c95c3692004b1b0
refs/heads/master
2021-01-20T16:03:26.349000
2016-09-29T10:30:23
2016-09-29T10:30:23
68,387,609
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.edvantis.workopolis; import java.util.Properties; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import com.edvantis.workopolis.controller.HomeController; import com.edvantis.workopolis.controller.VacanciesController; import com.edvantis.workopolis.dao.employer.EmployerDAO; import com.edvantis.workopolis.dao.user.UserDAO; import com.edvantis.workopolis.dao.vacancy.VacancyDAO; import com.edvantis.workopolis.model.vacancy.Vacancy; import static org.mockito.Mockito.*; import static org.hamcrest.Matchers.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.springframework.http.MediaType; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; public class VacanciesControllerTest { public static class MockSecurityContext implements SecurityContext { private static final long serialVersionUID = -1386535243513362694L; private Authentication authentication; public MockSecurityContext(Authentication authentication) { this.authentication = authentication; } @Override public Authentication getAuthentication() { return this.authentication; } @Override public void setAuthentication(Authentication authentication) { this.authentication = authentication; } } private static final String VIEW_RESOLVER_PREFIX = "/WEB-INF/jsp/"; private static final String VIEW_RESOLVER_SUFFIX = ".jsp"; @Mock private VacancyDAO vacancyDAO; @Mock private EmployerDAO employerDAO; @Mock private UserDAO userDAO; @InjectMocks private VacanciesController vacanciesController; @InjectMocks private HomeController homeController; private MockMvc mockMvc; @Before public void setup(){ MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(vacanciesController) .setHandlerExceptionResolvers(exceptionResolver()) .setValidator(validator()) .setViewResolvers(viewResolver()) .build(); } private HandlerExceptionResolver exceptionResolver(){ SimpleMappingExceptionResolver exceptionResolver = new SimpleMappingExceptionResolver(); Properties exceptionMappings = new Properties(); exceptionMappings.put("java.lang.Exception", "error/error"); exceptionMappings.put("java.lang.RuntimeException", "error/error"); exceptionResolver.setExceptionMappings(exceptionMappings); Properties statusCodes = new Properties(); statusCodes.put("error/404", "404"); statusCodes.put("error/error", "500"); exceptionResolver.setStatusCodes(statusCodes); return exceptionResolver; } private LocalValidatorFactoryBean validator() { return new LocalValidatorFactoryBean(); } private ViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix(VIEW_RESOLVER_PREFIX); viewResolver.setSuffix(VIEW_RESOLVER_SUFFIX); return viewResolver; } @Test public void testVacancyDescription() throws Exception{ Integer id = 1; Vacancy vacancy = new Vacancy(); when(vacancyDAO.getVacancyById(id)).thenReturn(vacancy); this.mockMvc.perform(get("/vacancy/" + id)) .andExpect(status().isOk()) .andExpect(view().name("vacancyDescription")) .andExpect(model().attribute("vacancy", instanceOf(Vacancy.class))); } @Test public void testGetAddVacancy() throws Exception { this.mockMvc.perform(get("/add_vacancy")) .andExpect(status().isOk()) .andExpect(view().name("employer/add_vacancy")) .andExpect(forwardedUrl("/WEB-INF/jsp/employer/add_vacancy.jsp")) .andExpect(model().attribute("vacancy", hasProperty("id", instanceOf(Integer.class)))) .andExpect(model().attribute("vacancy", hasProperty("title", isEmptyOrNullString()))) .andExpect(model().attribute("vacancy", hasProperty("description", isEmptyOrNullString()))); verifyZeroInteractions(vacancyDAO); } @Test public void testErrorAddVacacny() throws Exception{ this.mockMvc.perform(post("/add_vacancy") .contentType(MediaType.ALL) .sessionAttr("vacancy", new Vacancy()) ) .andExpect(status().is5xxServerError()) .andExpect(forwardedUrl("/WEB-INF/jsp/error/error.jsp")); } @Test public void testPageNotFound() throws Exception{ this.mockMvc.perform(get("/not_ds")) .andExpect(status().is4xxClientError()); } }
UTF-8
Java
5,681
java
VacanciesControllerTest.java
Java
[]
null
[]
package com.edvantis.workopolis; import java.util.Properties; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import com.edvantis.workopolis.controller.HomeController; import com.edvantis.workopolis.controller.VacanciesController; import com.edvantis.workopolis.dao.employer.EmployerDAO; import com.edvantis.workopolis.dao.user.UserDAO; import com.edvantis.workopolis.dao.vacancy.VacancyDAO; import com.edvantis.workopolis.model.vacancy.Vacancy; import static org.mockito.Mockito.*; import static org.hamcrest.Matchers.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.springframework.http.MediaType; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; public class VacanciesControllerTest { public static class MockSecurityContext implements SecurityContext { private static final long serialVersionUID = -1386535243513362694L; private Authentication authentication; public MockSecurityContext(Authentication authentication) { this.authentication = authentication; } @Override public Authentication getAuthentication() { return this.authentication; } @Override public void setAuthentication(Authentication authentication) { this.authentication = authentication; } } private static final String VIEW_RESOLVER_PREFIX = "/WEB-INF/jsp/"; private static final String VIEW_RESOLVER_SUFFIX = ".jsp"; @Mock private VacancyDAO vacancyDAO; @Mock private EmployerDAO employerDAO; @Mock private UserDAO userDAO; @InjectMocks private VacanciesController vacanciesController; @InjectMocks private HomeController homeController; private MockMvc mockMvc; @Before public void setup(){ MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(vacanciesController) .setHandlerExceptionResolvers(exceptionResolver()) .setValidator(validator()) .setViewResolvers(viewResolver()) .build(); } private HandlerExceptionResolver exceptionResolver(){ SimpleMappingExceptionResolver exceptionResolver = new SimpleMappingExceptionResolver(); Properties exceptionMappings = new Properties(); exceptionMappings.put("java.lang.Exception", "error/error"); exceptionMappings.put("java.lang.RuntimeException", "error/error"); exceptionResolver.setExceptionMappings(exceptionMappings); Properties statusCodes = new Properties(); statusCodes.put("error/404", "404"); statusCodes.put("error/error", "500"); exceptionResolver.setStatusCodes(statusCodes); return exceptionResolver; } private LocalValidatorFactoryBean validator() { return new LocalValidatorFactoryBean(); } private ViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix(VIEW_RESOLVER_PREFIX); viewResolver.setSuffix(VIEW_RESOLVER_SUFFIX); return viewResolver; } @Test public void testVacancyDescription() throws Exception{ Integer id = 1; Vacancy vacancy = new Vacancy(); when(vacancyDAO.getVacancyById(id)).thenReturn(vacancy); this.mockMvc.perform(get("/vacancy/" + id)) .andExpect(status().isOk()) .andExpect(view().name("vacancyDescription")) .andExpect(model().attribute("vacancy", instanceOf(Vacancy.class))); } @Test public void testGetAddVacancy() throws Exception { this.mockMvc.perform(get("/add_vacancy")) .andExpect(status().isOk()) .andExpect(view().name("employer/add_vacancy")) .andExpect(forwardedUrl("/WEB-INF/jsp/employer/add_vacancy.jsp")) .andExpect(model().attribute("vacancy", hasProperty("id", instanceOf(Integer.class)))) .andExpect(model().attribute("vacancy", hasProperty("title", isEmptyOrNullString()))) .andExpect(model().attribute("vacancy", hasProperty("description", isEmptyOrNullString()))); verifyZeroInteractions(vacancyDAO); } @Test public void testErrorAddVacacny() throws Exception{ this.mockMvc.perform(post("/add_vacancy") .contentType(MediaType.ALL) .sessionAttr("vacancy", new Vacancy()) ) .andExpect(status().is5xxServerError()) .andExpect(forwardedUrl("/WEB-INF/jsp/error/error.jsp")); } @Test public void testPageNotFound() throws Exception{ this.mockMvc.perform(get("/not_ds")) .andExpect(status().is4xxClientError()); } }
5,681
0.759549
0.754093
179
30.703911
28.078831
95
false
false
0
0
0
0
0
0
1.547486
false
false
4
65298e0085553a2742e1b465a7489dbe9c1af8b5
5,179,730,623,487
587f654d73980143e2578738e283704c3cbe03ef
/BufferedReader.java
b5ff11642b5fe46cf0f0b80fc051fc734476da9f
[]
no_license
HussainFaizan/Core-Java-Programs
https://github.com/HussainFaizan/Core-Java-Programs
219afac9ef11c607c5fab155abf0a06e8ab20a10
0e6f1111dbf2b5e6d31a15264ce93f7211aaae96
refs/heads/master
2022-12-03T15:26:22.307000
2020-08-16T08:44:24
2020-08-16T08:44:24
255,864,351
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; class BufferedReader { public static void main(String[] args) { // BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a Name::"); String name = br.readLine(); System.out.println("Name is::" + name); } }
UTF-8
Java
357
java
BufferedReader.java
Java
[]
null
[]
import java.io.*; class BufferedReader { public static void main(String[] args) { // BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a Name::"); String name = br.readLine(); System.out.println("Name is::" + name); } }
357
0.714286
0.714286
12
28.833334
26.28952
78
false
false
0
0
0
0
0
0
1.5
false
false
4
a769ec3e97d360d0a17325743173f73d9cbd52f6
16,011,638,123,070
a102601805208987a2234b74ee20b679f3f97fdd
/androidManager/src/main/java/com/centit/app/cmipDataUtils/DataUtils.java
b0c70a0bb81e75d2743818f666ae63f8c820dc26
[ "Apache-2.0" ]
permissive
pzhpengpeng/message
https://github.com/pzhpengpeng/message
50b5324f52b93cddf56633459e811e12426d0e89
12c4f6fc418e31cc05228c2cab3eac795709d126
refs/heads/master
2021-08-14T10:46:37.463000
2017-11-15T12:50:29
2017-11-15T12:50:29
293,481,088
1
0
Apache-2.0
true
2020-09-07T09:23:10
2020-09-07T09:23:09
2020-09-07T09:23:06
2017-11-15T12:50:57
524
0
0
0
null
false
false
package com.centit.app.cmipDataUtils; public class DataUtils { }
UTF-8
Java
67
java
DataUtils.java
Java
[]
null
[]
package com.centit.app.cmipDataUtils; public class DataUtils { }
67
0.776119
0.776119
5
12.4
15.344054
37
false
false
0
0
0
0
0
0
0.2
false
false
4
38a0415ec8cb5c384163e30b3949e46744640b84
11,862,699,696,422
986dfc68e5fcd30624aee12ff0edc8df4bc6cacb
/jira-rest/src/main/java/at/ac/tuwien/dst/mms/jira/rest/model/JiraUser.java
987f46dcca41ab42c80a4f3a7e0d38408be99862
[]
no_license
x-lin/data-vis
https://github.com/x-lin/data-vis
2c16c35d396d365b16a2581e1ddb6a01cc685d13
f947d2481e19332ac35e3dd80b14b3c483b2d1cd
refs/heads/master
2021-01-21T12:59:28.121000
2016-05-13T09:24:21
2016-05-13T09:24:21
48,965,528
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.ac.tuwien.dst.mms.jira.rest.model; import java.io.Serializable; /** * Created by XLin on 09.03.2016. */ public class JiraUser implements Serializable { private String key; private String name; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "JiraUser{" + "key='" + key + '\'' + ", name='" + name + '\'' + '}'; } }
UTF-8
Java
552
java
JiraUser.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by XLin on 09.03.2016.\n */\npublic class JiraUser implemen", "end": 99, "score": 0.9965347051620483, "start": 95, "tag": "USERNAME", "value": "XLin" } ]
null
[]
package at.ac.tuwien.dst.mms.jira.rest.model; import java.io.Serializable; /** * Created by XLin on 09.03.2016. */ public class JiraUser implements Serializable { private String key; private String name; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "JiraUser{" + "key='" + key + '\'' + ", name='" + name + '\'' + '}'; } }
552
0.621377
0.606884
36
14.333333
14.116578
47
false
false
0
0
0
0
0
0
1.25
false
false
4
73f222382ff322e7153eddb18edb30e23be1f2d1
944,892,830,873
fc0949181555ca0b11bd28113f485c21ec812eff
/新建文件夹/1904-eeabc/src/com/rock/dao/impl/IUserDaoimpl.java
0cedd14a26b3cdee5efdf28591c0857bcbcd4349
[]
no_license
Devil-ReaperL/practice
https://github.com/Devil-ReaperL/practice
be16d488c63d83393c4ecef5f47fb8a62ff19928
c947652eff7e6028dc0126ecd7a6faaf49b37665
refs/heads/master
2020-06-02T09:33:58.734000
2019-06-10T07:23:03
2019-06-10T07:23:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rock.dao.impl; import com.rock.dao.IUserDao; import com.rock.entities.User; import com.rock.service.IUserService; import com.rock.util.JDBCUtil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class IUserDaoimpl implements IUserDao { Connection conn=JDBCUtil.getconnerction(); public boolean result(User user){ try { String sq="select * from userinfo where userid=? and user_password=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,user.getUserid()); pres.setString(2,user.getPassword()); ResultSet rs=pres.executeQuery(); if (rs.next()) return true; else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } @Override public boolean finduserid(String userid) { try { String sq="select * from userinfo where userid=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,userid); ResultSet rs=pres.executeQuery(); if (rs.next()) return true; else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } @Override public String[] findqa(String userid) { String []s=new String[2]; try { String sq="select * from userinfo where userid=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,userid); ResultSet rs=pres.executeQuery(); if (rs.next()) { s[0]=rs.getString("question"); s[1]=rs.getString("answer"); return s; } } catch (SQLException e) { e.printStackTrace(); } return null; } @Override public boolean revisionpwd(String userid,String password) { try { String sq="update userinfo set user_password=? where userid=? "; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(2,userid); pres.setString(1,password); int s=pres.executeUpdate(); if (s>0) { return true; } else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } }
UTF-8
Java
2,703
java
IUserDaoimpl.java
Java
[]
null
[]
package com.rock.dao.impl; import com.rock.dao.IUserDao; import com.rock.entities.User; import com.rock.service.IUserService; import com.rock.util.JDBCUtil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class IUserDaoimpl implements IUserDao { Connection conn=JDBCUtil.getconnerction(); public boolean result(User user){ try { String sq="select * from userinfo where userid=? and user_password=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,user.getUserid()); pres.setString(2,user.getPassword()); ResultSet rs=pres.executeQuery(); if (rs.next()) return true; else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } @Override public boolean finduserid(String userid) { try { String sq="select * from userinfo where userid=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,userid); ResultSet rs=pres.executeQuery(); if (rs.next()) return true; else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } @Override public String[] findqa(String userid) { String []s=new String[2]; try { String sq="select * from userinfo where userid=?"; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(1,userid); ResultSet rs=pres.executeQuery(); if (rs.next()) { s[0]=rs.getString("question"); s[1]=rs.getString("answer"); return s; } } catch (SQLException e) { e.printStackTrace(); } return null; } @Override public boolean revisionpwd(String userid,String password) { try { String sq="update userinfo set user_password=? where userid=? "; PreparedStatement pres=conn.prepareStatement(sq); pres.setString(2,userid); pres.setString(1,password); int s=pres.executeUpdate(); if (s>0) { return true; } else return false; } catch (SQLException e) { e.printStackTrace(); } return false; } }
2,703
0.523122
0.519423
97
25.86598
19.382545
82
false
false
0
0
0
0
0
0
0.546392
false
false
4
82df2926715cad5a5058d34b46fbe4035dd3beb2
8,615,704,421,905
880982c8234da998b401915dc1229cb217be6ad6
/src/edu/wctc/eligrow/Actions.java
64e30ff171dc7cd4e31e4041138f32a6bd1a7dc8
[]
no_license
ELigrow/ELigrowEncryption
https://github.com/ELigrow/ELigrowEncryption
5b5790cbf163f34612555bc4911c5b0a0b937269
c42f6ad2169be7f2fb01f8e138ea8d9fc9dd7575
refs/heads/master
2020-03-27T22:26:32.295000
2018-09-03T16:51:43
2018-09-03T16:51:43
147,231,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.wctc.eligrow; import java.io.*; /** * Class to hold each action that can be run by this program * @author eplig * @version 1.0 */ public class Actions { /** *Encrypts contents of file to another file * @param f String: Name of file method draws FROM * @param t String: Name of file method writes TO * @throws IOException */ public static void encrypt(String f, String t) throws IOException { BufferedReader reader = new BufferedReader( new FileReader(f)); String str = ""; String fullStr = ""; try { while ((str = reader.readLine()) != null) { fullStr += str; } } catch (FileNotFoundException e) { e.printStackTrace(); } reader.close(); char[] text = new char[1024]; try { text = fullStr.toCharArray(); } catch (NullPointerException e) { e.printStackTrace(); } for (int counter = 0; counter < text.length; counter++) { char character = text[counter]; int ascii = (int) character; int encryptedAscii = 0; char encryptedChar = 0; encryptedAscii = (158 - ascii); encryptedChar = (char) encryptedAscii; text[counter] = encryptedChar; PrintWriter outFile = new PrintWriter( new BufferedWriter( new FileWriter(t))); outFile.write(text); outFile.close(); } } /** * Decrypts contents from one file and places decrypted content in another file * @param f String: Name of file method draws FROM * @param t String: Name of file method writes TO * @throws IOException */ public static void decrypt(String f, String t) throws IOException { BufferedReader reader = new BufferedReader( new FileReader(f)); char[] text = new char[1024]; int counter=0; while((counter=reader.read(text)) != -1){ String readData = String.valueOf(text, 0, counter); } reader.close(); counter = 0; while (text[counter] > (int) 32) { char character = text[counter]; int ascii = (int) character; int unencryptedAscii = 0; char unencryptedChar = 0; unencryptedAscii = Math.abs(ascii - 158); unencryptedChar = (char) unencryptedAscii; text[counter] = unencryptedChar; counter++; } System.out.println(text); PrintWriter outFile = new PrintWriter( new BufferedWriter ( new FileWriter (t) ) ); outFile.write(text); outFile.close(); } }
UTF-8
Java
2,848
java
Actions.java
Java
[ { "context": " action that can be run by this program\n * @author eplig\n * @version 1.0\n */\npublic class Actions {\n\n /", "end": 127, "score": 0.9993622899055481, "start": 122, "tag": "USERNAME", "value": "eplig" } ]
null
[]
package edu.wctc.eligrow; import java.io.*; /** * Class to hold each action that can be run by this program * @author eplig * @version 1.0 */ public class Actions { /** *Encrypts contents of file to another file * @param f String: Name of file method draws FROM * @param t String: Name of file method writes TO * @throws IOException */ public static void encrypt(String f, String t) throws IOException { BufferedReader reader = new BufferedReader( new FileReader(f)); String str = ""; String fullStr = ""; try { while ((str = reader.readLine()) != null) { fullStr += str; } } catch (FileNotFoundException e) { e.printStackTrace(); } reader.close(); char[] text = new char[1024]; try { text = fullStr.toCharArray(); } catch (NullPointerException e) { e.printStackTrace(); } for (int counter = 0; counter < text.length; counter++) { char character = text[counter]; int ascii = (int) character; int encryptedAscii = 0; char encryptedChar = 0; encryptedAscii = (158 - ascii); encryptedChar = (char) encryptedAscii; text[counter] = encryptedChar; PrintWriter outFile = new PrintWriter( new BufferedWriter( new FileWriter(t))); outFile.write(text); outFile.close(); } } /** * Decrypts contents from one file and places decrypted content in another file * @param f String: Name of file method draws FROM * @param t String: Name of file method writes TO * @throws IOException */ public static void decrypt(String f, String t) throws IOException { BufferedReader reader = new BufferedReader( new FileReader(f)); char[] text = new char[1024]; int counter=0; while((counter=reader.read(text)) != -1){ String readData = String.valueOf(text, 0, counter); } reader.close(); counter = 0; while (text[counter] > (int) 32) { char character = text[counter]; int ascii = (int) character; int unencryptedAscii = 0; char unencryptedChar = 0; unencryptedAscii = Math.abs(ascii - 158); unencryptedChar = (char) unencryptedAscii; text[counter] = unencryptedChar; counter++; } System.out.println(text); PrintWriter outFile = new PrintWriter( new BufferedWriter ( new FileWriter (t) ) ); outFile.write(text); outFile.close(); } }
2,848
0.535112
0.525632
89
31.011236
19.711683
83
false
false
0
0
0
0
0
0
0.505618
false
false
4
287b3b83df87211eb80e044bf464682fcb2933b7
4,312,147,199,475
b33723bcc05238c0a8aca1d6d6aadb97e26cd4ac
/app/src/main/java/com/crashapps/soundservice/PLSoundPoolManager.java
2208675bc1b94b20cfb867dcd06acb5b23c1f640
[]
no_license
asystat/SoundService
https://github.com/asystat/SoundService
b062eec8d21bc381993a12583d641af581034c78
c3d2731491ea6db1e74f9460477143aa695ac45f
refs/heads/master
2021-01-10T13:57:02.986000
2016-01-25T20:16:21
2016-01-25T20:16:21
50,313,402
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.crashapps.soundservice; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import android.view.View; import java.util.HashMap; import java.util.Random; /** * Created by Perroloco on 1/24/16. */ public class PLSoundPoolManager { private static PLSoundPoolManager instance; private SoundPool soundPool; boolean loaded = false; AudioManager audioManager; int volume; HashMap<Integer, Integer> soundIds; private void PLSoundPoolManager(){ } public static PLSoundPoolManager get(){ if(instance == null) instance = new PLSoundPoolManager(); return instance; } public void init(Context context) { audioManager = (AudioManager) context.getApplicationContext().getSystemService(context.AUDIO_SERVICE); volume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); // Load the sounds soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() { @Override public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { loaded = true; } }); soundIds = new HashMap<Integer, Integer>(); soundIds.put(soundPool.load(context, R.raw.f1, 1), 0); soundIds.put(soundPool.load(context, R.raw.f2, 1), 0); soundIds.put(soundPool.load(context, R.raw.f3, 1), 0); soundIds.put(soundPool.load(context, R.raw.f4, 1), 0); soundIds.put(soundPool.load(context, R.raw.f5, 1), 0); soundIds.put(soundPool.load(context, R.raw.f6, 1), 0); soundIds.put(soundPool.load(context, R.raw.f7, 1), 0); soundIds.put(soundPool.load(context, R.raw.f8, 1), 0); soundIds.put(soundPool.load(context, R.raw.f9, 1), 0); } public void playSound() { // Is the sound loaded does it already play? if (loaded) { Random r = new Random(); Object[] values = soundIds.keySet().toArray(); int randomValue = (int)values[r.nextInt(values.length)]; soundPool.play(randomValue, volume, volume, 1, 0, 1f); } } public void playLoop() { // Is the sound loaded does it already play? if (loaded) { Random r = new Random(); Object[] values = soundIds.values().toArray(); int randomValue = (int)values[r.nextInt(values.length)]; // the sound will play for ever if we put the loop parameter -1 soundPool.play(randomValue, volume, volume, 1, -1, 1f); } } public void stopSound(View v) { soundPool.autoPause(); } }
UTF-8
Java
2,836
java
PLSoundPoolManager.java
Java
[ { "context": "shMap;\nimport java.util.Random;\n\n/**\n * Created by Perroloco on 1/24/16.\n */\npublic class PLSoundPoolManager {", "end": 242, "score": 0.9944401979446411, "start": 233, "tag": "USERNAME", "value": "Perroloco" } ]
null
[]
package com.crashapps.soundservice; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import android.view.View; import java.util.HashMap; import java.util.Random; /** * Created by Perroloco on 1/24/16. */ public class PLSoundPoolManager { private static PLSoundPoolManager instance; private SoundPool soundPool; boolean loaded = false; AudioManager audioManager; int volume; HashMap<Integer, Integer> soundIds; private void PLSoundPoolManager(){ } public static PLSoundPoolManager get(){ if(instance == null) instance = new PLSoundPoolManager(); return instance; } public void init(Context context) { audioManager = (AudioManager) context.getApplicationContext().getSystemService(context.AUDIO_SERVICE); volume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); // Load the sounds soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() { @Override public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { loaded = true; } }); soundIds = new HashMap<Integer, Integer>(); soundIds.put(soundPool.load(context, R.raw.f1, 1), 0); soundIds.put(soundPool.load(context, R.raw.f2, 1), 0); soundIds.put(soundPool.load(context, R.raw.f3, 1), 0); soundIds.put(soundPool.load(context, R.raw.f4, 1), 0); soundIds.put(soundPool.load(context, R.raw.f5, 1), 0); soundIds.put(soundPool.load(context, R.raw.f6, 1), 0); soundIds.put(soundPool.load(context, R.raw.f7, 1), 0); soundIds.put(soundPool.load(context, R.raw.f8, 1), 0); soundIds.put(soundPool.load(context, R.raw.f9, 1), 0); } public void playSound() { // Is the sound loaded does it already play? if (loaded) { Random r = new Random(); Object[] values = soundIds.keySet().toArray(); int randomValue = (int)values[r.nextInt(values.length)]; soundPool.play(randomValue, volume, volume, 1, 0, 1f); } } public void playLoop() { // Is the sound loaded does it already play? if (loaded) { Random r = new Random(); Object[] values = soundIds.values().toArray(); int randomValue = (int)values[r.nextInt(values.length)]; // the sound will play for ever if we put the loop parameter -1 soundPool.play(randomValue, volume, volume, 1, -1, 1f); } } public void stopSound(View v) { soundPool.autoPause(); } }
2,836
0.630465
0.615303
88
31.227272
26.836935
110
false
false
0
0
0
0
0
0
0.965909
false
false
4
0f536eb19804ef257c1460b1640d51f813ebf1a2
7,395,933,717,018
1eb698e8a3b551d4b12f0a608adcdf159599d2cb
/message-server-socket/src/main/java/com/rensea/message/server/spi/messagehandler/TaskNotifyMessageHandler.java
c427ab80d06e0355d7f527ebc112362d4d2b3241
[]
no_license
pippo1980/web-socket
https://github.com/pippo1980/web-socket
e1a2f24168c0d52da51bc5619e24358051b91652
844e7f3e2b7fb514b06241088263421e74d27433
refs/heads/master
2021-01-13T02:26:50.176000
2010-05-14T02:23:38
2010-05-14T02:23:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * project : message-server-socket * user created : pippo * date created : 2010-4-1 - 下午02:10:11 */ package com.rensea.message.server.spi.messagehandler; import org.springframework.stereotype.Component; import com.rensea.message.dto.MessageType; import com.rensea.message.dto.TaskNotifyMessage; import com.rensea.message.server.tcp.connection.Connection; import com.rensea.message.spi.MessageException; /** * @since 2010-4-1 * @author pippo */ @Component public class TaskNotifyMessageHandler extends MessageHandlerTemplate<TaskNotifyMessage> { @Override public void handle(Connection connection, TaskNotifyMessage message) throws MessageException { if (connection.getUserId().equals(message.getUserId())) { this.flush(connection, message); } } @Override public boolean isSupport(MessageType messageType) { return MessageType.TASK_NOTIFY_MESSAGE.equals(messageType); } }
UTF-8
Java
906
java
TaskNotifyMessageHandler.java
Java
[ { "context": " project : message-server-socket\n * user created : pippo\n * date created : 2010-4-1 - 下午02:10:11\n */\npacka", "end": 62, "score": 0.9996302723884583, "start": 57, "tag": "USERNAME", "value": "pippo" }, { "context": "ssageException;\n\n/**\n * @since 2010-4-1\n * @aut...
null
[]
/** * project : message-server-socket * user created : pippo * date created : 2010-4-1 - 下午02:10:11 */ package com.rensea.message.server.spi.messagehandler; import org.springframework.stereotype.Component; import com.rensea.message.dto.MessageType; import com.rensea.message.dto.TaskNotifyMessage; import com.rensea.message.server.tcp.connection.Connection; import com.rensea.message.spi.MessageException; /** * @since 2010-4-1 * @author pippo */ @Component public class TaskNotifyMessageHandler extends MessageHandlerTemplate<TaskNotifyMessage> { @Override public void handle(Connection connection, TaskNotifyMessage message) throws MessageException { if (connection.getUserId().equals(message.getUserId())) { this.flush(connection, message); } } @Override public boolean isSupport(MessageType messageType) { return MessageType.TASK_NOTIFY_MESSAGE.equals(messageType); } }
906
0.776053
0.756098
34
25.529411
27.077488
95
false
false
0
0
0
0
0
0
0.735294
false
false
4
d01de93a73cce2fe2fd6173268f3735036500243
23,046,794,542,318
f489ee0ddb9859461c7e0183c40c370bf26e780e
/src/agh/oop/pathfindingVisualizer/board/Colors.java
daaf3feb94439d689bf4b51d86819e2d222bc4a2
[]
no_license
alicenoknow/PathFindingVisualizer
https://github.com/alicenoknow/PathFindingVisualizer
a947eb69ab1a26aa8d2750530b78e06a63937a5f
4ff615a81c720a7d660f2c61778c3a42d41aaa29
refs/heads/master
2023-03-22T23:56:02.131000
2021-03-17T18:03:12
2021-03-17T18:03:12
332,551,689
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package agh.oop.pathfindingVisualizer.board; import javafx.scene.paint.Color; public class Colors { public final static Color EMPTY = Color.rgb(210,210,250); public final static Color WALL = Color.rgb(50,50,70); public final static Color SOURCE = Color.rgb(30,250,100); public final static Color DESTINATION = Color.rgb(250,20,80); public final static Color PATH = Color.rgb(250,200,30); public final static Color VISITED = Color.rgb(150,150,250); public final static Color PLAYER = Color.rgb(50,150,250); public final static Color STROKE = Color.rgb(0,0,0,0.6); public final static Color HIGHLIGHT_STROKE = Color.rgb(40,40,40,0.4); }
UTF-8
Java
674
java
Colors.java
Java
[]
null
[]
package agh.oop.pathfindingVisualizer.board; import javafx.scene.paint.Color; public class Colors { public final static Color EMPTY = Color.rgb(210,210,250); public final static Color WALL = Color.rgb(50,50,70); public final static Color SOURCE = Color.rgb(30,250,100); public final static Color DESTINATION = Color.rgb(250,20,80); public final static Color PATH = Color.rgb(250,200,30); public final static Color VISITED = Color.rgb(150,150,250); public final static Color PLAYER = Color.rgb(50,150,250); public final static Color STROKE = Color.rgb(0,0,0,0.6); public final static Color HIGHLIGHT_STROKE = Color.rgb(40,40,40,0.4); }
674
0.719585
0.618694
16
41.125
26.643187
73
false
false
0
0
0
0
0
0
1.9375
false
false
4
804b730a1f628d98e3f60fa99e2a5a0844898770
5,892,695,165,656
0ae3e1a40c7845ee9a6ab5db296be61f24bd27cd
/spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/tipping/categories/Category.java
9884ec195dc9c3b46c3fcd6d79ecba5b5a0c65f6
[ "MIT" ]
permissive
SpartanRefactoring/Main
https://github.com/SpartanRefactoring/Main
083efcb9385c07c9a2c2bff5c76dbfc34c08323f
158ab742d27dca1b42edb0b9858ae8753f4b22d1
refs/heads/mazter
2021-06-05T01:28:41.320000
2020-07-25T13:06:47
2020-07-25T13:06:47
52,981,257
40
10
null
false
2020-10-13T23:47:30
2016-03-02T17:11:22
2020-10-05T18:50:49
2020-10-13T23:47:29
156,303
97
56
158
Java
false
false
package il.org.spartan.spartanizer.tipping.categories; import java.util.Set; import il.org.spartan.spartanizer.plugin.Builder; import il.org.spartan.spartanizer.traversal.Toolboxes; /** Classification of tippers * @author Yossi Gil * @since Sep 28, 2016 */ public interface Category { default String description() { return Taxon.of(this).description(); } default Class<? extends Category> lowestCategory() { Class<? extends Category> $ = Category.class; for (final Taxon ¢ : Taxa.hierarchy.nodes()) if (¢.get().isInstance(this) && ¢.get() != getClass() && $.isAssignableFrom(¢.get())) $ = ¢.get(); return $; } /** Returns the preference group to which the tipper belongs to. This method * should be overridden for each tipper and should return one of the values of * {@link Taxon} * @return preference group this tipper belongs to */ default Taxon tipperGroup() { return Taxon.of(lowestCategory()); } interface Bloater extends Category { String ___ = "Make code as verbose as possible"; } interface Junit extends Category { String ___ = "Transformations for JunitTests"; } interface Collapse extends CommonFactorOut { String ___ = "Shorten code by merging two adjacent syntactical elements into one"; } /** A specialized {@link Collapse} carried out, by factoring out some common * element */ interface CommonFactorOut extends Theory.Java { // S2 String ___ = "Factor out a common syntactical element"; } interface Deadcode extends Theory.Logical { String ___ = "Eliminate code that is never executed"; } interface EarlyReturn extends Theory.Java { String ___ = "Early return"; } interface EmptyCycles extends Category { String ___ = "Eliminate code which seems whose functions look like CPU churn and nothing else"; } interface Idiomatic extends Category { String ___ = "Change expression to a more familiar structure (often shorter)"; } interface Inlining extends Theory.Java { String ___ = "Structural"; } interface Loops extends Theory.Java { String ___ = "Spartan use of Java loop syntax"; } interface Transformation extends Category { interface Reshape extends Transformation { String ___ = "Reshape a syntactical element, such as a for loop, to a simpler or smaller element of the same syntactical kind"; } interface Prune extends Transformation { interface Eliminate extends Prune { @SuppressWarnings("hiding") String ___ = "Eliminate a single distinguished syntatical element which does nothing, such as call to super() with no arguments"; } String ___ = "Prune an operation which does nothing, e.g., adding zero or multiplying by one"; } interface Remorph extends Transformation { String ___ = "Replace a syntactical elemnt such as 'while' and 'if', with another, such as for loop and ternarry"; } /** Use alphabetical, or some other ordering, when order does not matter */ interface Sort extends Transformation { String ___ = "Sorting of annotations, modifiers, commutative elements, etc"; } } interface Modular extends Category { String ___ = "Make modular changes to code"; } interface Nanos extends Category { String ___ = "Nanos"; } interface ScopeReduction extends Theory.Java { String ___ = "Reduction of scope to the smallest possible"; } interface Shortcircuit extends Theory.Java { String ___ = "Shortcut of control flow by combining unconditional sequencers, e.g., converting break into return"; } interface SyntacticBaggage extends Theory.Java { String ___ = "Remove syntactical element that contributes nothing to semantics"; } interface Ternarization extends CommonFactorOut { String ___ = "Convert conditional statement to the conditional, ?:, operator"; } interface Theory extends Category { interface Java extends Category.Theory { @SuppressWarnings("hiding") String ___ = "General Java simplifcations"; } String ___ = "Simplifcation using a theory of some kind"; interface Arithmetics extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite an arithmetical expressions in a more canonical form"; interface Numeric extends Arithmetics { @SuppressWarnings("hiding") String ___ = "Numeric simplfication of an arithmetical expression"; } interface Symbolic extends Arithmetics { @SuppressWarnings("hiding") String ___ = "Symbolic simplfication of an arithmetical expression"; } } interface Logical extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite a boolean expression in a more canonical form"; } interface Strings extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite a string expression in a more canonical form"; } } /** Generate marker declarations for plugin.xml. */ static void main(String[] args) { Set<Taxon> seen = an.empty.set(); System.out.println("<!-- Marker types -->"); System.out.println("<extension\n id=\"" + Builder.MARKER_TYPE + "\"\n" // + " name=\"Spartanize\"\n" // + " point=\"org.eclipse.core.resources.markers\">\n" // + " <super type=\"org.eclipse.core.resources.problemmarker\"/>\n" // + "</extension>"); for (final Taxon ¢ : Toolboxes.categoryMap.values()) { if (seen.contains(¢)) continue; seen.add(¢); System.out.println("<extension\n id=\"" + Builder.MARKER_TYPE + "." + ¢.label() + "\"\n" // + " name=\"" + ¢.label() + "\"\n" // + " point=\"org.eclipse.core.resources.markers\">\n" // + " <super type=\"" + Builder.MARKER_TYPE + "\"/>\n" // + "</extension>"); } System.out.println("<!-- Marker resolution: this is where the quick fixg menus gets bound to the\n" + " Java class which generates several quick fix for tips. -->"); System.out.println( "<extension point=\"org.eclipse.ui.ide.markerResolution\">\n <markerResolutionGenerator\n markerType=\"" + Builder.MARKER_TYPE + "\"\n" // + " class=\"il.org.spartan.spartanizer.plugin.QuickFixer\"\n" // + " />\n" // + "</extension>"); seen.clear(); for (final Taxon ¢ : Toolboxes.categoryMap.values()) { if (seen.contains(¢)) continue; seen.add(¢); System.out.println("<extension point=\"org.eclipse.ui.ide.markerResolution\">\n <markerResolutionGenerator\n markerType=\"" + Builder.MARKER_TYPE + "." + ¢.label() + "\"\n" // // TODO Roth: reference qf id + " class=\"il.org.spartan.spartanizer.plugin.QuickFixer\"\n" // + " />\n" // + "</extension>"); } } }
UTF-8
Java
6,879
java
Category.java
Java
[ { "context": "olboxes;\n\n/** Classification of tippers\n * @author Yossi Gil\n * @since Sep 28, 2016 */\npublic interface Catego", "end": 235, "score": 0.9998348355293274, "start": 226, "tag": "NAME", "value": "Yossi Gil" } ]
null
[]
package il.org.spartan.spartanizer.tipping.categories; import java.util.Set; import il.org.spartan.spartanizer.plugin.Builder; import il.org.spartan.spartanizer.traversal.Toolboxes; /** Classification of tippers * @author <NAME> * @since Sep 28, 2016 */ public interface Category { default String description() { return Taxon.of(this).description(); } default Class<? extends Category> lowestCategory() { Class<? extends Category> $ = Category.class; for (final Taxon ¢ : Taxa.hierarchy.nodes()) if (¢.get().isInstance(this) && ¢.get() != getClass() && $.isAssignableFrom(¢.get())) $ = ¢.get(); return $; } /** Returns the preference group to which the tipper belongs to. This method * should be overridden for each tipper and should return one of the values of * {@link Taxon} * @return preference group this tipper belongs to */ default Taxon tipperGroup() { return Taxon.of(lowestCategory()); } interface Bloater extends Category { String ___ = "Make code as verbose as possible"; } interface Junit extends Category { String ___ = "Transformations for JunitTests"; } interface Collapse extends CommonFactorOut { String ___ = "Shorten code by merging two adjacent syntactical elements into one"; } /** A specialized {@link Collapse} carried out, by factoring out some common * element */ interface CommonFactorOut extends Theory.Java { // S2 String ___ = "Factor out a common syntactical element"; } interface Deadcode extends Theory.Logical { String ___ = "Eliminate code that is never executed"; } interface EarlyReturn extends Theory.Java { String ___ = "Early return"; } interface EmptyCycles extends Category { String ___ = "Eliminate code which seems whose functions look like CPU churn and nothing else"; } interface Idiomatic extends Category { String ___ = "Change expression to a more familiar structure (often shorter)"; } interface Inlining extends Theory.Java { String ___ = "Structural"; } interface Loops extends Theory.Java { String ___ = "Spartan use of Java loop syntax"; } interface Transformation extends Category { interface Reshape extends Transformation { String ___ = "Reshape a syntactical element, such as a for loop, to a simpler or smaller element of the same syntactical kind"; } interface Prune extends Transformation { interface Eliminate extends Prune { @SuppressWarnings("hiding") String ___ = "Eliminate a single distinguished syntatical element which does nothing, such as call to super() with no arguments"; } String ___ = "Prune an operation which does nothing, e.g., adding zero or multiplying by one"; } interface Remorph extends Transformation { String ___ = "Replace a syntactical elemnt such as 'while' and 'if', with another, such as for loop and ternarry"; } /** Use alphabetical, or some other ordering, when order does not matter */ interface Sort extends Transformation { String ___ = "Sorting of annotations, modifiers, commutative elements, etc"; } } interface Modular extends Category { String ___ = "Make modular changes to code"; } interface Nanos extends Category { String ___ = "Nanos"; } interface ScopeReduction extends Theory.Java { String ___ = "Reduction of scope to the smallest possible"; } interface Shortcircuit extends Theory.Java { String ___ = "Shortcut of control flow by combining unconditional sequencers, e.g., converting break into return"; } interface SyntacticBaggage extends Theory.Java { String ___ = "Remove syntactical element that contributes nothing to semantics"; } interface Ternarization extends CommonFactorOut { String ___ = "Convert conditional statement to the conditional, ?:, operator"; } interface Theory extends Category { interface Java extends Category.Theory { @SuppressWarnings("hiding") String ___ = "General Java simplifcations"; } String ___ = "Simplifcation using a theory of some kind"; interface Arithmetics extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite an arithmetical expressions in a more canonical form"; interface Numeric extends Arithmetics { @SuppressWarnings("hiding") String ___ = "Numeric simplfication of an arithmetical expression"; } interface Symbolic extends Arithmetics { @SuppressWarnings("hiding") String ___ = "Symbolic simplfication of an arithmetical expression"; } } interface Logical extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite a boolean expression in a more canonical form"; } interface Strings extends Category.Theory { @SuppressWarnings("hiding") String ___ = "Rewrite a string expression in a more canonical form"; } } /** Generate marker declarations for plugin.xml. */ static void main(String[] args) { Set<Taxon> seen = an.empty.set(); System.out.println("<!-- Marker types -->"); System.out.println("<extension\n id=\"" + Builder.MARKER_TYPE + "\"\n" // + " name=\"Spartanize\"\n" // + " point=\"org.eclipse.core.resources.markers\">\n" // + " <super type=\"org.eclipse.core.resources.problemmarker\"/>\n" // + "</extension>"); for (final Taxon ¢ : Toolboxes.categoryMap.values()) { if (seen.contains(¢)) continue; seen.add(¢); System.out.println("<extension\n id=\"" + Builder.MARKER_TYPE + "." + ¢.label() + "\"\n" // + " name=\"" + ¢.label() + "\"\n" // + " point=\"org.eclipse.core.resources.markers\">\n" // + " <super type=\"" + Builder.MARKER_TYPE + "\"/>\n" // + "</extension>"); } System.out.println("<!-- Marker resolution: this is where the quick fixg menus gets bound to the\n" + " Java class which generates several quick fix for tips. -->"); System.out.println( "<extension point=\"org.eclipse.ui.ide.markerResolution\">\n <markerResolutionGenerator\n markerType=\"" + Builder.MARKER_TYPE + "\"\n" // + " class=\"il.org.spartan.spartanizer.plugin.QuickFixer\"\n" // + " />\n" // + "</extension>"); seen.clear(); for (final Taxon ¢ : Toolboxes.categoryMap.values()) { if (seen.contains(¢)) continue; seen.add(¢); System.out.println("<extension point=\"org.eclipse.ui.ide.markerResolution\">\n <markerResolutionGenerator\n markerType=\"" + Builder.MARKER_TYPE + "." + ¢.label() + "\"\n" // // TODO Roth: reference qf id + " class=\"il.org.spartan.spartanizer.plugin.QuickFixer\"\n" // + " />\n" // + "</extension>"); } } }
6,876
0.645885
0.644865
186
35.908604
35.314518
165
false
false
0
0
0
0
0
0
0.360215
false
false
4
1f64b3eeaee15e48713cb8907f8fe012754bcd42
7,911,329,793,093
2cb1fadfbefde40bcccb8ad271dc47bab46ea572
/framework-admin/src/main/java/com/framework/admin/job/task/TestTask.java
19416cae79f2e43b5092d5e32c9347c3618c46fe
[]
no_license
hanyuelei/fast-parent
https://github.com/hanyuelei/fast-parent
64b2767e0720b94d0a59e244e302477980b37e78
19c056bc387e41d6588e3903c261421530dd7f34
refs/heads/master
2022-10-01T10:55:42.317000
2020-01-09T06:23:22
2020-01-09T06:23:38
232,512,941
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.framework.admin.job.task; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; /** * 测试定时任务(演示Demo,可删除) * * testTask为spring bean的名称 * */ @Component("testTask") @Slf4j public class TestTask implements ITask { @Override public void run(String params){ log.info("TestTask定时任务正在执行,参数为:"+params); } @Override public void task(String params) { log.info("2222定时任务正在执行,参数为:"+params); } }
UTF-8
Java
526
java
TestTask.java
Java
[]
null
[]
package com.framework.admin.job.task; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; /** * 测试定时任务(演示Demo,可删除) * * testTask为spring bean的名称 * */ @Component("testTask") @Slf4j public class TestTask implements ITask { @Override public void run(String params){ log.info("TestTask定时任务正在执行,参数为:"+params); } @Override public void task(String params) { log.info("2222定时任务正在执行,参数为:"+params); } }
526
0.728507
0.71267
25
16.639999
16.567148
48
false
false
0
0
0
0
0
0
0.6
false
false
4
610b90b0169743470d2448eb55108cb0ac9bebcb
7,911,329,794,354
cb94dcc8571436b5bede0eb22fd507cc18fe74da
/src/com/profound/batch/AddBatch.java
24eb5bb6976bea55a40d0a454340e7b3f0274778
[]
no_license
Yogeshmokashe/Institute-Management-System
https://github.com/Yogeshmokashe/Institute-Management-System
f6a44526fa50e5c5a999743c8eb85c00d28b1d52
851ef15c49af45bebaa8634fd233b8795078ad70
refs/heads/master
2021-05-17T23:04:19.226000
2020-03-29T09:18:57
2020-03-29T09:18:57
250,993,167
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.profound.batch; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class AddBatch */ @WebServlet("/addBatch") public class AddBatch extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AddBatch() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub int batchId=Integer.parseInt(request.getParameter("batchId")); String batchName=request.getParameter("batchName"); String startDate=request.getParameter("startDate"); String endDate=request.getParameter("endDate"); int fees=Integer.parseInt(request.getParameter("fees")); int strength=Integer.parseInt(request.getParameter("strength")); Batch batch=new Batch(); batch.setBatchId(batchId); batch.setBatchName(batchName); batch.setStartDate(startDate); batch.setEnddate(endDate); batch.setFees(fees); batch.setStrength(strength); try { if(BatchDao.addBatch(batch)>0) { RequestDispatcher rd=request.getRequestDispatcher("displayBatches.jsp"); rd.forward(request, response); } } catch (ClassNotFoundException | SQLException e) { // TODO Auto-generated catch block PrintWriter out=response.getWriter(); } } }
UTF-8
Java
1,828
java
AddBatch.java
Java
[]
null
[]
package com.profound.batch; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class AddBatch */ @WebServlet("/addBatch") public class AddBatch extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AddBatch() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub int batchId=Integer.parseInt(request.getParameter("batchId")); String batchName=request.getParameter("batchName"); String startDate=request.getParameter("startDate"); String endDate=request.getParameter("endDate"); int fees=Integer.parseInt(request.getParameter("fees")); int strength=Integer.parseInt(request.getParameter("strength")); Batch batch=new Batch(); batch.setBatchId(batchId); batch.setBatchName(batchName); batch.setStartDate(startDate); batch.setEnddate(endDate); batch.setFees(fees); batch.setStrength(strength); try { if(BatchDao.addBatch(batch)>0) { RequestDispatcher rd=request.getRequestDispatcher("displayBatches.jsp"); rd.forward(request, response); } } catch (ClassNotFoundException | SQLException e) { // TODO Auto-generated catch block PrintWriter out=response.getWriter(); } } }
1,828
0.745624
0.74453
64
27.5625
24.344452
119
false
false
0
0
0
0
0
0
1.671875
false
false
4
1f4a318a18703404ec1d78975505102dcd3ec03f
5,669,356,883,507
576509bf910aa36921c4b2c9420b126d55876cb5
/src/lne/Write.java
eeeb401544cfe296cc1ba0049b041407c4999469
[ "Apache-2.0" ]
permissive
lnework/WebDemo
https://github.com/lnework/WebDemo
1b33d99e69d93d4ecb7d9bb127ee1ad692417a6b
8e2c0cb24882c16d4bb2e59816fc25a5195842fd
refs/heads/master
2020-04-07T04:12:55.578000
2018-11-18T03:16:12
2018-11-18T03:16:12
158,045,162
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lne; import java.io.IOException; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jdk.nashorn.internal.runtime.Context; /** * Servlet implementation class Write */ public class Write extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Write() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub Connection conn = null; PreparedStatement pstmt =null; Statement st = null; ResultSet rs = null; Enumeration<String> e = request.getParameterNames(); String sql ="INSERT INTO member_detail(id,myname,mobile,qq,number,sex,nation,place,idn,culture,rank0,joindate,class,job,fpeople,speople,tcount,valume,pcount,borndate,writedate,activedate,confirm1,confirm2)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String[] name = {"myname","mobile","qq","number","sex","nation","place","idn","culture","rank","joindate","class","job","fpeople","speople","tcount","valume","pcount"}; int i=0; try { conn = DataPool_User.ds.getConnection(); pstmt = conn.prepareStatement(sql); User u = (User) request.getSession().getAttribute("member"); pstmt.setInt(1, u.getId()); //设置id号,而id号为之前设置的 for(i=1;i<=name.length;i++){ String s = request.getParameter(name[i-1]); pstmt.setString(i+1, s); //System.out.println(i+1+name[i-1]+" : "+s); } //还没有写日期 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String borndate = request.getParameter("bornyear") + "-" + request.getParameter("bornmonth") + "-" + request.getParameter("bornday"); String writedate = request.getParameter("writeyear") + "-" + request.getParameter("writemonth") + "-" + request.getParameter("writeday"); String activedate = request.getParameter("activeyear") + "-" + request.getParameter("activemonth") + "-" + request.getParameter("activeday"); pstmt.setString(20, borndate); //System.out.println(borndate); pstmt.setString(21, writedate); //System.out.println(writedate); pstmt.setString(22, activedate); //System.out.println(borndate+" "+writedate+" "+activedate); pstmt.setString(23, "-1"); pstmt.setString(23, "-1"); pstmt.executeUpdate(); //执行提交 } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String p = request.getParameter("pcount"); int pcount = Integer.valueOf(p); //request.setAttribute("pcount", pcount); request.getSession().setAttribute("pcount", pcount); String t = request.getParameter("tcount"); int tcount = Integer.valueOf(t); //request.setAttribute("tcount", tcount); request.getSession().setAttribute("tcount", tcount); response.getWriter().println("是时候填写一些详细信息了..."); String time = "3;"; String url = request.getContextPath() + "/writepro.jsp"; String cmd = time + url; response.setHeader("refresh", cmd); //request.getRequestDispatcher(url).forward(request, response); //根据不同来显示 //我需要知道是哪个用户,且,还需要知道id号 } } /* //获取参数名 //String sql = "INSERT INTO member_detail(myname,mobile,qq,number,nation,place,idn,borndate,culture,class,job,writedate,fpeople,speople,activedate,valume,pcount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; //String sql = "INSERT INTO member_detail(myname,mobile,qq,number,sex,nation,place,idn,bornyear,bornmonth,bornday,culture,rank,class,job,writeyear,writemonth,writeday,fpeople,speople,activeyear,activemonth,activeday,tcount,valume,pcount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String sqls = "INSERT INTO " + this.getServletContext().getInitParameter("detail") ; String symbol = "("; String sqle = "VALUES"; String b = "{"; while(e.hasMoreElements()){ String s = (String) e.nextElement(); sqls = sqls + symbol + s; sqle = sqle + symbol + "?"; symbol = ","; System.out.println(s + ":" + request.getParameter(s)); b = b + '"' + s + '"' + ','; } sqls = sqls + ")"; sqle = sqle + ")"; String sql = sqls + sqle; System.out.println(sql); System.out.println(b); */
GB18030
Java
5,015
java
Write.java
Java
[ { "context": ",?,?,?,?,?,?,?,?,?,?,?,?,?)\";\n\t\tString[] name = {\"myname\",\"mobile\",\"qq\",\"number\",\"sex\",\"nation\",\"place", "end": 1741, "score": 0.5495755076408386, "start": 1739, "tag": "USERNAME", "value": "my" } ]
null
[]
package lne; import java.io.IOException; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jdk.nashorn.internal.runtime.Context; /** * Servlet implementation class Write */ public class Write extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Write() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub Connection conn = null; PreparedStatement pstmt =null; Statement st = null; ResultSet rs = null; Enumeration<String> e = request.getParameterNames(); String sql ="INSERT INTO member_detail(id,myname,mobile,qq,number,sex,nation,place,idn,culture,rank0,joindate,class,job,fpeople,speople,tcount,valume,pcount,borndate,writedate,activedate,confirm1,confirm2)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String[] name = {"myname","mobile","qq","number","sex","nation","place","idn","culture","rank","joindate","class","job","fpeople","speople","tcount","valume","pcount"}; int i=0; try { conn = DataPool_User.ds.getConnection(); pstmt = conn.prepareStatement(sql); User u = (User) request.getSession().getAttribute("member"); pstmt.setInt(1, u.getId()); //设置id号,而id号为之前设置的 for(i=1;i<=name.length;i++){ String s = request.getParameter(name[i-1]); pstmt.setString(i+1, s); //System.out.println(i+1+name[i-1]+" : "+s); } //还没有写日期 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String borndate = request.getParameter("bornyear") + "-" + request.getParameter("bornmonth") + "-" + request.getParameter("bornday"); String writedate = request.getParameter("writeyear") + "-" + request.getParameter("writemonth") + "-" + request.getParameter("writeday"); String activedate = request.getParameter("activeyear") + "-" + request.getParameter("activemonth") + "-" + request.getParameter("activeday"); pstmt.setString(20, borndate); //System.out.println(borndate); pstmt.setString(21, writedate); //System.out.println(writedate); pstmt.setString(22, activedate); //System.out.println(borndate+" "+writedate+" "+activedate); pstmt.setString(23, "-1"); pstmt.setString(23, "-1"); pstmt.executeUpdate(); //执行提交 } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String p = request.getParameter("pcount"); int pcount = Integer.valueOf(p); //request.setAttribute("pcount", pcount); request.getSession().setAttribute("pcount", pcount); String t = request.getParameter("tcount"); int tcount = Integer.valueOf(t); //request.setAttribute("tcount", tcount); request.getSession().setAttribute("tcount", tcount); response.getWriter().println("是时候填写一些详细信息了..."); String time = "3;"; String url = request.getContextPath() + "/writepro.jsp"; String cmd = time + url; response.setHeader("refresh", cmd); //request.getRequestDispatcher(url).forward(request, response); //根据不同来显示 //我需要知道是哪个用户,且,还需要知道id号 } } /* //获取参数名 //String sql = "INSERT INTO member_detail(myname,mobile,qq,number,nation,place,idn,borndate,culture,class,job,writedate,fpeople,speople,activedate,valume,pcount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; //String sql = "INSERT INTO member_detail(myname,mobile,qq,number,sex,nation,place,idn,bornyear,bornmonth,bornday,culture,rank,class,job,writeyear,writemonth,writeday,fpeople,speople,activeyear,activemonth,activeday,tcount,valume,pcount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String sqls = "INSERT INTO " + this.getServletContext().getInitParameter("detail") ; String symbol = "("; String sqle = "VALUES"; String b = "{"; while(e.hasMoreElements()){ String s = (String) e.nextElement(); sqls = sqls + symbol + s; sqle = sqle + symbol + "?"; symbol = ","; System.out.println(s + ":" + request.getParameter(s)); b = b + '"' + s + '"' + ','; } sqls = sqls + ")"; sqle = sqle + ")"; String sql = sqls + sqle; System.out.println(sql); System.out.println(b); */
5,015
0.688639
0.683316
130
36.584614
45.739021
298
false
false
0
0
0
0
0
0
3.207692
false
false
4
5b00cc75a7523a8b0a6469addd87da1107708e84
12,326,556,206,356
1ac27f2a40ec3c002a4c2aa55bd5b93cb9604aa3
/src/main/java/inei/additionalores/items/ingots/CakiumIngot.java
f2bdcf85ec005426ee64d4109a609b840bcd605f
[]
no_license
Inei1/AdditionalOres
https://github.com/Inei1/AdditionalOres
e56ebe8c145f184231228425e36aa2c7dbf11c24
61e163837e0da4c3cdde94bb0cf01801797db0d0
refs/heads/master
2021-04-06T20:40:45.832000
2018-03-15T23:31:08
2018-03-15T23:31:08
125,436,978
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package inei.additionalores.items.ingots; import net.minecraft.item.Item; public class CakiumIngot extends Item { }
UTF-8
Java
121
java
CakiumIngot.java
Java
[]
null
[]
package inei.additionalores.items.ingots; import net.minecraft.item.Item; public class CakiumIngot extends Item { }
121
0.785124
0.785124
8
14.125
17.919525
41
false
false
0
0
0
0
0
0
0.375
false
false
4
7b15736286a1240c5ac3626d19cd40842d449dbb
14,293,651,224,527
455b7ee89a32a4eb82796f222ad89d61777d77fe
/counter/src/application/Graph.java
75d9666210c787c1bc397c682b2ba1fd8eec3ee2
[]
no_license
jzheng13/fyp-securityanalysis
https://github.com/jzheng13/fyp-securityanalysis
5a56d7584c87ac48f325a39bdcf66df679a4c36a
b03ebe52a2ed567d0ff7323f79a3a5fab7b46759
refs/heads/master
2021-01-18T11:58:00.305000
2020-02-05T13:13:35
2020-02-05T13:13:35
68,421,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package application; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.Set; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import countermeasures.AGMetrics; import javax.swing.JTable; import javax.swing.JTextPane; public class Graph extends JPanel { private JTable table; /** * Create the panel. */ public Graph(AppFrame parent) { // this.setBounds(0, 0, 0, 0); this.setBounds(100, 100, 1312, 772); this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(null); JLabel lblMetricsIntro = new JLabel("Attack graph metrics"); lblMetricsIntro.setFont(new Font("Tahoma", Font.BOLD, 34)); lblMetricsIntro.setBounds(26, 28, 445, 41); this.add(lblMetricsIntro); JLabel instructions1 = new JLabel("The table below show the metrics of the resulting attack graph. The textbox show the minimum "); instructions1.setBounds(83, 89, 1146, 33); add(instructions1); JLabel instructions2 = new JLabel("countermeasures required to secure whole network of accounts."); instructions2.setBounds(83, 130, 1146, 33); add(instructions2); AGMetrics gMetrics = new AGMetrics("graphall.dot"); DefaultTableModel dtm = new DefaultTableModel(); dtm.setColumnIdentifiers(new String[] {"Metric", "Value"}); String[] metrics = {"No. of paths", "Mean path length", "Shortest path", "Mode path length", "Median path length", "Standard deviation", "Normalised mean" }; double[] values = {gMetrics.getNoPaths(), gMetrics.getMeanPath(), gMetrics.getShortestPath(), gMetrics.getMode(), gMetrics.getMedian(), gMetrics.getStdDev(), gMetrics.getNormMean() }; for (int i = 0; i < metrics.length; i++) { dtm.addRow(new Object[]{metrics[i], values[i]}); } Set<String> critSet = gMetrics.getMinCritSet(); System.out.println(critSet); JTextPane textPane = new JTextPane(); textPane.setText("Minimum countermeasures required: \n" + gMetrics.minCounter(critSet)); JScrollPane txtScrollPane = new JScrollPane(textPane); txtScrollPane.setBounds(726, 186, 503, 280); add(txtScrollPane); JButton btnFinish = new JButton("Finish"); btnFinish.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { parent.backToMain(); } }); btnFinish.setBounds(985, 585, 244, 41); this.add(btnFinish); table = new JTable(dtm); table.setRowHeight(30); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(83, 186, 503, 280); add(scrollPane); JButton btnBack = new JButton("< Back"); btnBack.setBounds(83, 587, 171, 41); add(btnBack); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { parent.addPanel(new Analysis(parent)); } }); JButton btnViewAG = new JButton("View attack graph"); btnViewAG.setBounds(325, 585, 316, 41); add(btnViewAG); btnViewAG.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Runtime rt = Runtime.getRuntime(); try { Process p = rt.exec("cmd.exe /c " + "ag1.svg", null, new File(System.getProperty("user.dir"))); } catch (IOException e) { System.err.format(e.getMessage()); } } }); } }
UTF-8
Java
3,505
java
Graph.java
Java
[]
null
[]
package application; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.Set; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import countermeasures.AGMetrics; import javax.swing.JTable; import javax.swing.JTextPane; public class Graph extends JPanel { private JTable table; /** * Create the panel. */ public Graph(AppFrame parent) { // this.setBounds(0, 0, 0, 0); this.setBounds(100, 100, 1312, 772); this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(null); JLabel lblMetricsIntro = new JLabel("Attack graph metrics"); lblMetricsIntro.setFont(new Font("Tahoma", Font.BOLD, 34)); lblMetricsIntro.setBounds(26, 28, 445, 41); this.add(lblMetricsIntro); JLabel instructions1 = new JLabel("The table below show the metrics of the resulting attack graph. The textbox show the minimum "); instructions1.setBounds(83, 89, 1146, 33); add(instructions1); JLabel instructions2 = new JLabel("countermeasures required to secure whole network of accounts."); instructions2.setBounds(83, 130, 1146, 33); add(instructions2); AGMetrics gMetrics = new AGMetrics("graphall.dot"); DefaultTableModel dtm = new DefaultTableModel(); dtm.setColumnIdentifiers(new String[] {"Metric", "Value"}); String[] metrics = {"No. of paths", "Mean path length", "Shortest path", "Mode path length", "Median path length", "Standard deviation", "Normalised mean" }; double[] values = {gMetrics.getNoPaths(), gMetrics.getMeanPath(), gMetrics.getShortestPath(), gMetrics.getMode(), gMetrics.getMedian(), gMetrics.getStdDev(), gMetrics.getNormMean() }; for (int i = 0; i < metrics.length; i++) { dtm.addRow(new Object[]{metrics[i], values[i]}); } Set<String> critSet = gMetrics.getMinCritSet(); System.out.println(critSet); JTextPane textPane = new JTextPane(); textPane.setText("Minimum countermeasures required: \n" + gMetrics.minCounter(critSet)); JScrollPane txtScrollPane = new JScrollPane(textPane); txtScrollPane.setBounds(726, 186, 503, 280); add(txtScrollPane); JButton btnFinish = new JButton("Finish"); btnFinish.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { parent.backToMain(); } }); btnFinish.setBounds(985, 585, 244, 41); this.add(btnFinish); table = new JTable(dtm); table.setRowHeight(30); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(83, 186, 503, 280); add(scrollPane); JButton btnBack = new JButton("< Back"); btnBack.setBounds(83, 587, 171, 41); add(btnBack); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { parent.addPanel(new Analysis(parent)); } }); JButton btnViewAG = new JButton("View attack graph"); btnViewAG.setBounds(325, 585, 316, 41); add(btnViewAG); btnViewAG.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Runtime rt = Runtime.getRuntime(); try { Process p = rt.exec("cmd.exe /c " + "ag1.svg", null, new File(System.getProperty("user.dir"))); } catch (IOException e) { System.err.format(e.getMessage()); } } }); } }
3,505
0.708131
0.673894
116
29.215517
25.412054
133
false
false
0
0
0
0
0
0
2.827586
false
false
4
b13a49beb1a306c16c52f6c8e95a2fe429a19406
33,732,673,192,364
6a41c157c63f598a2a0dd3d6457638500670dda3
/src/main/java/com/shetuan/dao/OrganizationAudioDao.java
6b8beafb1d576a049920c63aafecaf5ce0741802
[]
no_license
AndersonAnson/st_backend
https://github.com/AndersonAnson/st_backend
ad3e95618efa0409b6adc54739c7debbbcb6088a
2a68e0afe41de3bff9f0c9d415fed997509f2062
refs/heads/master
2022-12-23T18:41:54.306000
2019-09-16T02:00:24
2019-09-16T02:00:24
208,195,725
0
0
null
false
2022-12-16T12:13:17
2019-09-13T04:33:25
2019-09-16T02:38:35
2022-12-16T12:13:14
154
0
0
10
Java
false
false
package com.shetuan.dao; import com.shetuan.dao.BaseDao; import com.shetuan.entity.OrganizationAudio; public interface OrganizationAudioDao extends BaseDao<OrganizationAudio,Long>{ }
UTF-8
Java
183
java
OrganizationAudioDao.java
Java
[]
null
[]
package com.shetuan.dao; import com.shetuan.dao.BaseDao; import com.shetuan.entity.OrganizationAudio; public interface OrganizationAudioDao extends BaseDao<OrganizationAudio,Long>{ }
183
0.846995
0.846995
6
29.666666
26.69998
78
false
false
0
0
0
0
0
0
0.666667
false
false
4
b21096d3a83566ec47a9c379f3d1faf44beda751
9,612,136,855,714
6ac9ded0a1023aacca848a50a93ea3b3812ced4f
/SpringMVCHBNEmp/src/main/java/mvchbnemp/EmployeeController.java
64a36f42aee413ba35e4a0ec3f68a634e26fab3e
[]
no_license
Nikitha-K/Spring-HBN
https://github.com/Nikitha-K/Spring-HBN
981b9a2d79a688ee3c98a8b2444db1f52a31289a
c575e4eb8f16109e0e0f44ae0ea69b20df0242f8
refs/heads/master
2022-12-22T23:10:31.675000
2020-01-14T11:30:35
2020-01-14T11:30:35
233,825,472
0
0
null
false
2022-12-16T04:23:52
2020-01-14T11:23:59
2020-01-14T11:30:39
2022-12-16T04:23:51
11,518
0
0
6
Java
false
false
package mvchbnemp; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class EmployeeController { @Autowired EmployeeDao dao; @RequestMapping(value="/addemp",method = RequestMethod.GET) public String ShowAddEmployeeForm(){ return "AddEmployee"; } @RequestMapping(value="/addemp",method = RequestMethod.POST) public ModelAndView addEmployee(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.addEmployee(emp); mav.setViewName("redirect:viewemp"); return mav; } @RequestMapping(value="/viewemp") public ModelAndView getEmployee(){ ModelAndView mav = new ModelAndView(); List<Employee> list = dao.getEmployee(); mav.addObject("emp",list); mav.setViewName("ViewEmployee"); return mav; } @RequestMapping(value="/updateemp",method = RequestMethod.GET) public String ShowUpdateEmployeeForm(){ return "UpdateEmp"; } @RequestMapping(value="/updateemp",method = RequestMethod.POST) public ModelAndView updateemp(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.updateemp(emp); mav.setViewName("redirect:viewemp"); return mav; } @RequestMapping(value="/deleteemp",method = RequestMethod.GET) public String ShowDeleteEmployeeForm(){ return "DeleteEmp"; } @RequestMapping(value="/deleteemp",method = RequestMethod.POST) public ModelAndView deleteemp(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.deleteemp(emp); mav.setViewName("redirect:viewemp"); return mav; } }
UTF-8
Java
2,014
java
EmployeeController.java
Java
[]
null
[]
package mvchbnemp; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class EmployeeController { @Autowired EmployeeDao dao; @RequestMapping(value="/addemp",method = RequestMethod.GET) public String ShowAddEmployeeForm(){ return "AddEmployee"; } @RequestMapping(value="/addemp",method = RequestMethod.POST) public ModelAndView addEmployee(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.addEmployee(emp); mav.setViewName("redirect:viewemp"); return mav; } @RequestMapping(value="/viewemp") public ModelAndView getEmployee(){ ModelAndView mav = new ModelAndView(); List<Employee> list = dao.getEmployee(); mav.addObject("emp",list); mav.setViewName("ViewEmployee"); return mav; } @RequestMapping(value="/updateemp",method = RequestMethod.GET) public String ShowUpdateEmployeeForm(){ return "UpdateEmp"; } @RequestMapping(value="/updateemp",method = RequestMethod.POST) public ModelAndView updateemp(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.updateemp(emp); mav.setViewName("redirect:viewemp"); return mav; } @RequestMapping(value="/deleteemp",method = RequestMethod.GET) public String ShowDeleteEmployeeForm(){ return "DeleteEmp"; } @RequestMapping(value="/deleteemp",method = RequestMethod.POST) public ModelAndView deleteemp(@ModelAttribute("emp") Employee emp){ ModelAndView mav = new ModelAndView(); dao.deleteemp(emp); mav.setViewName("redirect:viewemp"); return mav; } }
2,014
0.712512
0.712512
70
26.742857
21.973156
65
false
false
0
0
0
0
0
0
2.457143
false
false
4
3e0585b75c4d2614c6a5daad178f18eb6e50b61b
8,847,632,696,756
8cdf197c36ddaa0412b1518bef75d217f24ce426
/src/main/java/com/pagoda/dao/StoreMapper.java
0c09411856ff517a8180663fdceefcd9be1c95cb
[]
no_license
litang18674798887/boot-mybatis
https://github.com/litang18674798887/boot-mybatis
0faf04e8657ce3766c63e8e9c665d2f3643bde37
e7305d5dad2e98a9e84f9cacc73bbbb166b85c6e
refs/heads/master
2020-03-06T15:23:10.109000
2018-12-13T15:40:24
2018-12-13T15:40:24
126,954,839
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pagoda.dao; import com.pagoda.bean.Store; import com.pagoda.utils.TkMapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; /** * @author : litang * @date : Create in 2018/3/26 */ public interface StoreMapper extends TkMapper<Store> { }
UTF-8
Java
300
java
StoreMapper.java
Java
[ { "context": "gframework.stereotype.Component;\n\n/**\n * @author : litang\n * @date : Create in 2018/3/26\n */\npublic interfa", "end": 207, "score": 0.9993538856506348, "start": 201, "tag": "USERNAME", "value": "litang" } ]
null
[]
package com.pagoda.dao; import com.pagoda.bean.Store; import com.pagoda.utils.TkMapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; /** * @author : litang * @date : Create in 2018/3/26 */ public interface StoreMapper extends TkMapper<Store> { }
300
0.763333
0.74
13
22.076923
18.726622
54
false
false
0
0
0
0
0
0
0.384615
false
false
4
4abb03bf90569fb358b9004acb6e8c914d478716
28,535,762,778,710
8adc53988198b81b89df67b20ac0d142891cb913
/server.java
6c6b6eff5a9dacb54bfd9da825f840cc925bd378
[]
no_license
sha3er94/UDP-Socket-Programming
https://github.com/sha3er94/UDP-Socket-Programming
ff8adb315c67f47f06518303c0757a25ac3a76e1
055e661085bfd814f74e84cfd3de1734bb844b43
refs/heads/master
2021-01-10T04:15:33.804000
2015-12-31T21:27:25
2015-12-31T21:27:25
48,862,647
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package socketprogrammingudp; import java.io.*; import java.net.*; import java.util.Scanner; class server extends Thread { private static String Port; public static void setPort(String Port) { server.Port = Port; } public static String getPort() { return Port; } public server() { } public server(int port) throws IOException { ServerSocket serverSocket; serverSocket = new ServerSocket(port); serverSocket.setSoTimeout(100000); } public static boolean isNumeric(String s) { return s.matches("[-+]?\\d*\\.?\\d+"); } public static void main(String args[]) throws Exception { Scanner s = new Scanner (System.in); System.out.println("Enter Port Number : "); Port = s.next(); while(isNumeric(Port)==false || Integer.parseInt(Port)<0){ System.out.println("Incorrect Port Number"); System.out.println("Please Enter Valid Port Number"); Port = s.next(); } setPort(Port); //server Server=new server(Integer.parseInt(Port)); //System.out.println(getPort()); while(true){ DatagramSocket serverSocket = new DatagramSocket(Integer.parseInt(Port)); byte[] receiveData = new byte[1024]; byte[] receiveData2 = new byte[1024]; byte[] sendData = new byte[1024]; while(true) { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); DatagramPacket receivePacket2 = new DatagramPacket(receiveData2, receiveData.length); serverSocket.receive(receivePacket2); String num1 = new String(receivePacket.getData()); String num2 = new String(receivePacket2.getData()); System.out.println("RECEIVED: " + num1); System.out.println("RECEIVED 2: " + num2); double number1 = Double.parseDouble(num1); System.out.println("Number 1 : "+number1); double number2 = Double.parseDouble(num2); System.out.println("Number 2 : "+number2); double sum = number1+number2; System.out.println("Sum : "+sum); String capitalizedSentence = ""+sum; InetAddress IPAddress = receivePacket.getAddress(); int port = receivePacket.getPort(); System.out.println("port 1 : "+port); try { Thread t = new server(port); t.start(); } catch(IOException e) { e.printStackTrace(); } //InetAddress IPAddress2 = receivePacket2.getAddress(); sendData = capitalizedSentence.getBytes(); DatagramPacket sendPacket =new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } } } }
UTF-8
Java
3,531
java
server.java
Java
[]
null
[]
package socketprogrammingudp; import java.io.*; import java.net.*; import java.util.Scanner; class server extends Thread { private static String Port; public static void setPort(String Port) { server.Port = Port; } public static String getPort() { return Port; } public server() { } public server(int port) throws IOException { ServerSocket serverSocket; serverSocket = new ServerSocket(port); serverSocket.setSoTimeout(100000); } public static boolean isNumeric(String s) { return s.matches("[-+]?\\d*\\.?\\d+"); } public static void main(String args[]) throws Exception { Scanner s = new Scanner (System.in); System.out.println("Enter Port Number : "); Port = s.next(); while(isNumeric(Port)==false || Integer.parseInt(Port)<0){ System.out.println("Incorrect Port Number"); System.out.println("Please Enter Valid Port Number"); Port = s.next(); } setPort(Port); //server Server=new server(Integer.parseInt(Port)); //System.out.println(getPort()); while(true){ DatagramSocket serverSocket = new DatagramSocket(Integer.parseInt(Port)); byte[] receiveData = new byte[1024]; byte[] receiveData2 = new byte[1024]; byte[] sendData = new byte[1024]; while(true) { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); DatagramPacket receivePacket2 = new DatagramPacket(receiveData2, receiveData.length); serverSocket.receive(receivePacket2); String num1 = new String(receivePacket.getData()); String num2 = new String(receivePacket2.getData()); System.out.println("RECEIVED: " + num1); System.out.println("RECEIVED 2: " + num2); double number1 = Double.parseDouble(num1); System.out.println("Number 1 : "+number1); double number2 = Double.parseDouble(num2); System.out.println("Number 2 : "+number2); double sum = number1+number2; System.out.println("Sum : "+sum); String capitalizedSentence = ""+sum; InetAddress IPAddress = receivePacket.getAddress(); int port = receivePacket.getPort(); System.out.println("port 1 : "+port); try { Thread t = new server(port); t.start(); } catch(IOException e) { e.printStackTrace(); } //InetAddress IPAddress2 = receivePacket2.getAddress(); sendData = capitalizedSentence.getBytes(); DatagramPacket sendPacket =new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } } } }
3,531
0.493628
0.481733
81
41.580246
26.833673
128
false
false
0
0
0
0
0
0
1.222222
false
false
4
d303ecd0168f322fc0cb6953df60f3325c540d46
14,216,341,781,928
1247f6b06891d4f440e0a4d7a18eae6337a45261
/src/trung/example/testapp1/MainActivity.java
76dc2ea53d84a0d3f7ddf6e015fb5fc3d2700a4a
[]
no_license
trungphps02724/trungphamtest
https://github.com/trungphps02724/trungphamtest
d96fff2fa5d61679b185af96162aea9a40c3a055
3208f77b98623ba1bda41663d49491502f72a97e
refs/heads/master
2021-01-22T02:40:25.777000
2017-09-03T08:09:48
2017-09-03T08:09:48
102,249,610
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package trung.example.testapp1; import Databasehelper.DataDAO; import Databasehelper.DbHelper; import StudentsDTO.Logins; import StudentsDTO.Students; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { DataDAO db; final Context context = this; EditText edtUer, edtPass; Button btnRegis, btnLog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new DataDAO(this); edtUer = (EditText) findViewById(R.id.edtUserName); edtPass = (EditText) findViewById(R.id.edtPassWord); btnLog = (Button) findViewById(R.id.btnLogin); btnRegis = (Button) findViewById(R.id.btnRegister); btnLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String user, pass; user = edtUer.getText().toString(); pass = edtPass.getText().toString(); if (user.trim().equals("") || pass.trim().equals("")) { Toast.makeText(getApplicationContext(), "Không được để trống", Toast.LENGTH_SHORT).show(); return; } if (db.Logins(user, pass)) { Intent intent = new Intent(MainActivity.this, ListStudentActivity.class); startActivity(intent); } else { Toast.makeText(getApplicationContext(), "Tài khoản hoặc mật khẩu không đúng", Toast.LENGTH_SHORT) .show(); } } }); btnRegis.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dal = new Dialog(context); dal.setTitle("Đăng ký tài khoản"); dal.setContentView(R.layout.dialog_register); dal.show(); final EditText edtDKUser = (EditText) dal.findViewById(R.id.edtDKUser); final EditText edtDKPass = (EditText) dal.findViewById(R.id.edtDKPass); final Button btnDK = (Button) dal.findViewById(R.id.btnDangKy); btnDK.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String tk, mk; tk = edtDKUser.getText().toString(); mk = edtDKPass.getText().toString(); try { Logins login = new Logins(); login.setUser(tk); login.setPass(mk); db.insertLogins(login); Toast.makeText(getApplicationContext(), "Đăng ký thành công", Toast.LENGTH_SHORT).show(); dal.dismiss(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Đăng ký thất bại", Toast.LENGTH_SHORT).show(); } } }); } }); } }
UTF-8
Java
2,772
java
MainActivity.java
Java
[ { "context": ");\n\t\t\t\t\t\t\tlogin.setUser(tk);\n\t\t\t\t\t\t\tlogin.setPass(mk);\n\t\t\t\t\t\t\tdb.insertLogins(login);\n\t\t\t\t\t\t\tToast.mak", "end": 2411, "score": 0.9958442449569702, "start": 2409, "tag": "PASSWORD", "value": "mk" } ]
null
[]
package trung.example.testapp1; import Databasehelper.DataDAO; import Databasehelper.DbHelper; import StudentsDTO.Logins; import StudentsDTO.Students; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { DataDAO db; final Context context = this; EditText edtUer, edtPass; Button btnRegis, btnLog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new DataDAO(this); edtUer = (EditText) findViewById(R.id.edtUserName); edtPass = (EditText) findViewById(R.id.edtPassWord); btnLog = (Button) findViewById(R.id.btnLogin); btnRegis = (Button) findViewById(R.id.btnRegister); btnLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String user, pass; user = edtUer.getText().toString(); pass = edtPass.getText().toString(); if (user.trim().equals("") || pass.trim().equals("")) { Toast.makeText(getApplicationContext(), "Không được để trống", Toast.LENGTH_SHORT).show(); return; } if (db.Logins(user, pass)) { Intent intent = new Intent(MainActivity.this, ListStudentActivity.class); startActivity(intent); } else { Toast.makeText(getApplicationContext(), "Tài khoản hoặc mật khẩu không đúng", Toast.LENGTH_SHORT) .show(); } } }); btnRegis.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dal = new Dialog(context); dal.setTitle("Đăng ký tài khoản"); dal.setContentView(R.layout.dialog_register); dal.show(); final EditText edtDKUser = (EditText) dal.findViewById(R.id.edtDKUser); final EditText edtDKPass = (EditText) dal.findViewById(R.id.edtDKPass); final Button btnDK = (Button) dal.findViewById(R.id.btnDangKy); btnDK.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String tk, mk; tk = edtDKUser.getText().toString(); mk = edtDKPass.getText().toString(); try { Logins login = new Logins(); login.setUser(tk); login.setPass(mk); db.insertLogins(login); Toast.makeText(getApplicationContext(), "Đăng ký thành công", Toast.LENGTH_SHORT).show(); dal.dismiss(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Đăng ký thất bại", Toast.LENGTH_SHORT).show(); } } }); } }); } }
2,772
0.690703
0.690337
93
28.376345
24.380899
102
false
false
0
0
0
0
0
0
3.462366
false
false
4
134220ce2b1fdd069f9f9549277e7eb1e2a776ea
14,336,600,892,781
f04972aab8383bf8924fbc02ec54027ec241e672
/src/main/java/web/controller/HelloController.java
d92bfc38bc625791c1d383900844104bdcadc152
[]
no_license
yong6768/WebFramework
https://github.com/yong6768/WebFramework
ffb4e69aa81f968c24cf047cfbdfdbff5f734b28
30f857f52e4aa937034547fca136ff31ef141b7e
refs/heads/master
2023-08-18T21:04:01.916000
2021-10-05T07:41:26
2021-10-05T07:41:26
398,823,966
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package web.controller; import framework.bean.Bean; import framework.servlet.handler.mvc.annotation.*; import lombok.AllArgsConstructor; import web.dao.HelloRequest; import web.service.HelloService; import javax.servlet.http.HttpServletRequest; @AllArgsConstructor @Controller @RequestMapping("/hello") public class HelloController { private final HelloService helloService; @Bean public HelloService helloService() { return new HelloService(); } @RequestMapping(value = "/world", method = RequestMethod.POST) @ResponseBody public Integer helloWorld( HttpServletRequest request, @RequestBody HelloRequest helloRequest ) { System.out.println("request = " + request); System.out.println("helloRequest = " + helloRequest); return 2000; // return "hello"; } @RequestMapping(value = "/world2", method = RequestMethod.GET) @ResponseBody public String helloWorld2 ( @RequestParam("hello") String hello, @RequestParam("age") int age ) { System.out.println("hello = " + hello); System.out.println("age = " + age); return hello+"-"+age; } }
UTF-8
Java
1,204
java
HelloController.java
Java
[]
null
[]
package web.controller; import framework.bean.Bean; import framework.servlet.handler.mvc.annotation.*; import lombok.AllArgsConstructor; import web.dao.HelloRequest; import web.service.HelloService; import javax.servlet.http.HttpServletRequest; @AllArgsConstructor @Controller @RequestMapping("/hello") public class HelloController { private final HelloService helloService; @Bean public HelloService helloService() { return new HelloService(); } @RequestMapping(value = "/world", method = RequestMethod.POST) @ResponseBody public Integer helloWorld( HttpServletRequest request, @RequestBody HelloRequest helloRequest ) { System.out.println("request = " + request); System.out.println("helloRequest = " + helloRequest); return 2000; // return "hello"; } @RequestMapping(value = "/world2", method = RequestMethod.GET) @ResponseBody public String helloWorld2 ( @RequestParam("hello") String hello, @RequestParam("age") int age ) { System.out.println("hello = " + hello); System.out.println("age = " + age); return hello+"-"+age; } }
1,204
0.66196
0.656977
44
26.363636
19.290943
66
false
false
0
0
0
0
0
0
0.454545
false
false
4
1e8a08b5cb4db60c8a2a15d74fcb5bbc9d93c64c
10,934,986,775,278
01f92b19ad77714f70ee8b059dbe2b7d94f50af7
/src/byui/cit260/monopofastPro/view/ChallengeMenuView.java
1a266f896bb073f50afd47032a84009f134322e7
[]
no_license
diazdaniel0526/monopofast
https://github.com/diazdaniel0526/monopofast
32d6f25b9a0b2f8aed841036775d749c7751be36
094eecbb81da78ebe77dbe1799663eaec3052ff0
refs/heads/master
2021-01-13T16:10:23.621000
2015-07-17T18:33:38
2015-07-17T18:33:38
35,437,203
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package byui.cit260.monopofastPro.view; //import java.util.Scanner; /** * * @author Galicia */ public class ChallengeMenuView extends View{ public ChallengeMenuView() { super("\n" + "\n------------------------------" + "\n | Challange Menu |" + "\n------------------------------" + "\nV – View Challenges" + "\nC - View Completed Challenges" + "\nQ – Quit" + "\n------------------------------"); } @Override public boolean doAction(Object obj) { String value = (String) obj; value = value.toUpperCase(); String selection = value; switch (selection) { case "V" : this.viewChallenges(); break; case "C" : this.viewCompletedChallenges(); break; case "Q" : return false; default: this.console.println("\n*** Invalid Selection *** Try Again"); break; } return true; } private void viewChallenges() { this.console.println("********************************************************"); this.console.println("\n* Challenge 1 *" + "\n* If it takes you _____ seconds to make a Son of *" + "\n* a Bacon Eater Sandwich, and there are 6 people *" + "\n* the ultimate fast food tycoon. After taking *" + "\n* control of each restaurant, you go to the next *" + "\n* ordering one, and you must wash your hands *" + "\n* (which takes _____ seconds), how long will it *" + "\n* take you complete all of the above? *"); this.console.println("********************************************************"); this.console.println("********************************************************"); this.console.println("\n* Challenge 2 *" + "\n* If it takes you _____ seconds to make a turnover,*" + "\n* _____ seconds to make mozzarella sticks, how *" + "\n* long will it take you to complete 3 turnovers, *" + "\n* and 2 mozzarella sticks? *"); this.console.println("********************************************************"); this.console.println("********************************************************"); this.console.println("\n* Challenge 3 *" + "\n* If it takes you _____ seconds to make a chocolate*" + "\n* milkshake, _____ seconds to make Plain McBurger. *" + "\n* How long will it take you to complete 6 Chocolate*" + "\n* milkshakes and 2 Plain McBurgers? *"); this.console.println("********************************************************"); } private void viewCompletedChallenges() { this.console.println("Display Challenges Completed"); } }
UTF-8
Java
3,719
java
ChallengeMenuView.java
Java
[ { "context": "//import java.util.Scanner;\r\n\r\n/**\r\n *\r\n * @author Galicia\r\n */\r\npublic class ChallengeMenuView extends View", "end": 291, "score": 0.9983162879943848, "start": 284, "tag": "NAME", "value": "Galicia" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package byui.cit260.monopofastPro.view; //import java.util.Scanner; /** * * @author Galicia */ public class ChallengeMenuView extends View{ public ChallengeMenuView() { super("\n" + "\n------------------------------" + "\n | Challange Menu |" + "\n------------------------------" + "\nV – View Challenges" + "\nC - View Completed Challenges" + "\nQ – Quit" + "\n------------------------------"); } @Override public boolean doAction(Object obj) { String value = (String) obj; value = value.toUpperCase(); String selection = value; switch (selection) { case "V" : this.viewChallenges(); break; case "C" : this.viewCompletedChallenges(); break; case "Q" : return false; default: this.console.println("\n*** Invalid Selection *** Try Again"); break; } return true; } private void viewChallenges() { this.console.println("********************************************************"); this.console.println("\n* Challenge 1 *" + "\n* If it takes you _____ seconds to make a Son of *" + "\n* a Bacon Eater Sandwich, and there are 6 people *" + "\n* the ultimate fast food tycoon. After taking *" + "\n* control of each restaurant, you go to the next *" + "\n* ordering one, and you must wash your hands *" + "\n* (which takes _____ seconds), how long will it *" + "\n* take you complete all of the above? *"); this.console.println("********************************************************"); this.console.println("********************************************************"); this.console.println("\n* Challenge 2 *" + "\n* If it takes you _____ seconds to make a turnover,*" + "\n* _____ seconds to make mozzarella sticks, how *" + "\n* long will it take you to complete 3 turnovers, *" + "\n* and 2 mozzarella sticks? *"); this.console.println("********************************************************"); this.console.println("********************************************************"); this.console.println("\n* Challenge 3 *" + "\n* If it takes you _____ seconds to make a chocolate*" + "\n* milkshake, _____ seconds to make Plain McBurger. *" + "\n* How long will it take you to complete 6 Chocolate*" + "\n* milkshakes and 2 Plain McBurgers? *"); this.console.println("********************************************************"); } private void viewCompletedChallenges() { this.console.println("Display Challenges Completed"); } }
3,719
0.377927
0.374966
90
39.299999
32.496307
89
false
false
0
0
0
0
0
0
0.411111
false
false
4
3ac8cf28de28c4d3f1c5a451a31af2a6c6940871
30,562,987,279,427
8c30e1e05f8beebd67860964cf958109817bdabb
/ApplicationDriver.java
48135f56c69ec10101cf4a94a629d8bb3a1a458e
[]
no_license
atsushii/ciccc_class
https://github.com/atsushii/ciccc_class
64524c67f16289fd11e7073670c6fd0f1ae6e8a3
2a0015725aa67fc91e3129c828157d06ba162c8c
refs/heads/master
2020-05-23T12:12:05.687000
2019-06-23T19:08:28
2019-06-23T19:08:28
186,752,268
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package assignment; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * @author miyamotoatsushi * implement each class */ public class ApplicationDriver { /** * implement each function */ public static void main(String[] args) { // problem0(); // problem1(); // problem2(); // problem3(); // problem4(); // problem5(); problem6(); } /** * print number which is repeated the most in the list */ public static void problem0() { ArrayList<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); System.out.println(Problem0.ReturnRepeatNumber(numberList)); } /** * print repeated number and how many times repeated */ public static void problem1() { ArrayList<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); Problem1.ReturnRepeatNumber(numberList); } /** * print distinct number */ public static void problem2() { List<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); System.out.println(Problem2.checkDistinctNumber(numberList)); } /** * print repeated number which is repeated only once */ public static void problem3() { List<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(123); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(5); numberList.add(1); numberList.add(1); System.out.println(Problem3.returnDistinctNumber(numberList)); } /** * print high avarage student info */ public static void problem4() { HashMap<String, List<String>> studentrDict = new HashMap<String, List<String>>(); List<String>firstNameList = new ArrayList<String>(); firstNameList.add("Alan"); firstNameList.add("Atsushi"); firstNameList.add("jeny"); List<String>lastNameList = new ArrayList<String>(); lastNameList.add("Kona"); lastNameList.add("Miyamoto"); lastNameList.add("Born"); List<String>addressList = new ArrayList<String>(); addressList.add("aaa@"); addressList.add("bbb@"); addressList.add("ccc@"); List<String>birthList = new ArrayList<String>(); birthList.add("19940304"); birthList.add("19940407"); birthList.add("19940505"); List<String>avarageList = new ArrayList<String>(); avarageList.add("80"); avarageList.add("100"); avarageList.add("10"); studentrDict.put("firstName", firstNameList); studentrDict.put("lastName", lastNameList); studentrDict.put("address", addressList); studentrDict.put("birth", birthList); studentrDict.put("avarage", avarageList); System.out.println(Problem4.returnHighAvarageStudent(studentrDict)); } /** * print dictionary which shows all the name the user has entered and how many times each name is repeated */ public static void problem5() { System.out.println(Problem5.returnName()); } /** * print sum of enter number */ public static void problem6() { System.out.println(Problem6.returnSumNumber()); } }
UTF-8
Java
4,043
java
ApplicationDriver.java
Java
[ { "context": "til.HashMap;\nimport java.util.List;\n/**\n * @author miyamotoatsushi\n * implement each class\n */\npublic class Applicat", "end": 139, "score": 0.8873255848884583, "start": 124, "tag": "USERNAME", "value": "miyamotoatsushi" }, { "context": "w ArrayList<String>();\n ...
null
[]
/** * */ package assignment; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * @author miyamotoatsushi * implement each class */ public class ApplicationDriver { /** * implement each function */ public static void main(String[] args) { // problem0(); // problem1(); // problem2(); // problem3(); // problem4(); // problem5(); problem6(); } /** * print number which is repeated the most in the list */ public static void problem0() { ArrayList<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); System.out.println(Problem0.ReturnRepeatNumber(numberList)); } /** * print repeated number and how many times repeated */ public static void problem1() { ArrayList<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); Problem1.ReturnRepeatNumber(numberList); } /** * print distinct number */ public static void problem2() { List<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(4); System.out.println(Problem2.checkDistinctNumber(numberList)); } /** * print repeated number which is repeated only once */ public static void problem3() { List<Integer> numberList = new ArrayList<Integer>(); numberList.add(5); numberList.add(3); numberList.add(123); numberList.add(123); numberList.add(123); numberList.add(3); numberList.add(5); numberList.add(3); numberList.add(5); numberList.add(1); numberList.add(1); System.out.println(Problem3.returnDistinctNumber(numberList)); } /** * print high avarage student info */ public static void problem4() { HashMap<String, List<String>> studentrDict = new HashMap<String, List<String>>(); List<String>firstNameList = new ArrayList<String>(); firstNameList.add("Alan"); firstNameList.add("Atsushi"); firstNameList.add("jeny"); List<String>lastNameList = new ArrayList<String>(); lastNameList.add("Kona"); lastNameList.add("Miyamoto"); lastNameList.add("Born"); List<String>addressList = new ArrayList<String>(); addressList.add("aaa@"); addressList.add("bbb@"); addressList.add("ccc@"); List<String>birthList = new ArrayList<String>(); birthList.add("19940304"); birthList.add("19940407"); birthList.add("19940505"); List<String>avarageList = new ArrayList<String>(); avarageList.add("80"); avarageList.add("100"); avarageList.add("10"); studentrDict.put("firstName", firstNameList); studentrDict.put("lastName", lastNameList); studentrDict.put("address", addressList); studentrDict.put("birth", birthList); studentrDict.put("avarage", avarageList); System.out.println(Problem4.returnHighAvarageStudent(studentrDict)); } /** * print dictionary which shows all the name the user has entered and how many times each name is repeated */ public static void problem5() { System.out.println(Problem5.returnName()); } /** * print sum of enter number */ public static void problem6() { System.out.println(Problem6.returnSumNumber()); } }
4,043
0.591887
0.567648
153
25.424837
20.923357
111
false
false
0
0
0
0
0
0
0.581699
false
false
4
456506979a90464a66a88f8a505c06c7a4053f02
26,551,487,893,913
dad42ff88823fcdedce6960d83afd43179d41638
/jtd-admin/src/main/java/com/jtd/web/po/TopDomain.java
6726af32711d89374e81cdf7aac1bc79094dc8da
[]
no_license
jtdhui/dsp
https://github.com/jtdhui/dsp
d7a0a38063fd1abc9a30a9eb37edb888ac67607f
93722f25bc41eda5c83371581ac7935d8a5d07f5
refs/heads/master
2020-03-23T11:35:41.625000
2018-07-19T03:04:09
2018-07-19T03:04:09
141,511,700
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jtd.web.po; import com.jtd.commons.entity.BaseEntity; public class TopDomain extends BaseEntity{ /** * */ private static final long serialVersionUID = 1L; private String domain; private String siteName; private Integer siteNum; private String priceRange; private Long flow; private Long channelId; private String webSiteType; private Long pid; private Integer maxPrice; private Integer minPrice; private String adxWebsiteType; private String parentid; private Integer manualEntry; public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain == null ? null : domain.trim(); } public String getSiteName() { return siteName; } public void setSiteName(String siteName) { this.siteName = siteName == null ? null : siteName.trim(); } public Integer getSiteNum() { return siteNum; } public void setSiteNum(Integer siteNum) { this.siteNum = siteNum; } public String getPriceRange() { return priceRange; } public void setPriceRange(String priceRange) { this.priceRange = priceRange == null ? null : priceRange.trim(); } public Long getFlow() { return flow; } public void setFlow(Long flow) { this.flow = flow; } public Long getChannelId() { return channelId; } public void setChannelId(Long channelId) { this.channelId = channelId; } public String getWebSiteType() { return webSiteType; } public void setWebSiteType(String webSiteType) { this.webSiteType = webSiteType == null ? null : webSiteType.trim(); } public Long getPid() { return pid; } public void setPid(Long pid) { this.pid = pid; } public Integer getMaxPrice() { return maxPrice; } public void setMaxPrice(Integer maxPrice) { this.maxPrice = maxPrice; } public Integer getMinPrice() { return minPrice; } public void setMinPrice(Integer minPrice) { this.minPrice = minPrice; } public String getAdxWebsiteType() { return adxWebsiteType; } public void setAdxWebsiteType(String adxWebsiteType) { this.adxWebsiteType = adxWebsiteType == null ? null : adxWebsiteType.trim(); } public String getParentid() { return parentid; } public void setParentid(String parentid) { this.parentid = parentid == null ? null : parentid.trim(); } public Integer getManualEntry() { return manualEntry; } public void setManualEntry(Integer manualEntry) { this.manualEntry = manualEntry; } }
UTF-8
Java
2,792
java
TopDomain.java
Java
[]
null
[]
package com.jtd.web.po; import com.jtd.commons.entity.BaseEntity; public class TopDomain extends BaseEntity{ /** * */ private static final long serialVersionUID = 1L; private String domain; private String siteName; private Integer siteNum; private String priceRange; private Long flow; private Long channelId; private String webSiteType; private Long pid; private Integer maxPrice; private Integer minPrice; private String adxWebsiteType; private String parentid; private Integer manualEntry; public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain == null ? null : domain.trim(); } public String getSiteName() { return siteName; } public void setSiteName(String siteName) { this.siteName = siteName == null ? null : siteName.trim(); } public Integer getSiteNum() { return siteNum; } public void setSiteNum(Integer siteNum) { this.siteNum = siteNum; } public String getPriceRange() { return priceRange; } public void setPriceRange(String priceRange) { this.priceRange = priceRange == null ? null : priceRange.trim(); } public Long getFlow() { return flow; } public void setFlow(Long flow) { this.flow = flow; } public Long getChannelId() { return channelId; } public void setChannelId(Long channelId) { this.channelId = channelId; } public String getWebSiteType() { return webSiteType; } public void setWebSiteType(String webSiteType) { this.webSiteType = webSiteType == null ? null : webSiteType.trim(); } public Long getPid() { return pid; } public void setPid(Long pid) { this.pid = pid; } public Integer getMaxPrice() { return maxPrice; } public void setMaxPrice(Integer maxPrice) { this.maxPrice = maxPrice; } public Integer getMinPrice() { return minPrice; } public void setMinPrice(Integer minPrice) { this.minPrice = minPrice; } public String getAdxWebsiteType() { return adxWebsiteType; } public void setAdxWebsiteType(String adxWebsiteType) { this.adxWebsiteType = adxWebsiteType == null ? null : adxWebsiteType.trim(); } public String getParentid() { return parentid; } public void setParentid(String parentid) { this.parentid = parentid == null ? null : parentid.trim(); } public Integer getManualEntry() { return manualEntry; } public void setManualEntry(Integer manualEntry) { this.manualEntry = manualEntry; } }
2,792
0.624284
0.623926
141
18.80851
19.786419
84
false
false
0
0
0
0
0
0
0.326241
false
false
9
b681d8e032b9560aea9cb70f3db4957fb9cfb829
29,961,691,918,288
e2e1afc468f4a5792ae28cc34b97d51e1ec93e19
/src/au/com/mineauz/PlayerSpy/storage/StoredItemStack.java
894cc95b60d3284b94933482d256976a6cc73552
[]
no_license
Schmoller/PlayerSpy
https://github.com/Schmoller/PlayerSpy
edbb671176fabdaacf3131e956edeb88f4b13bc7
01ef9d547fd6d55976589030fc4b573b6f461e30
refs/heads/master
2021-01-18T23:08:03.233000
2013-08-11T00:46:22
2013-08-11T00:46:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package au.com.mineauz.PlayerSpy.storage; import java.io.*; import org.bukkit.inventory.ItemStack; import au.com.mineauz.PlayerSpy.Records.RecordFormatException; public class StoredItemStack { public StoredItemStack(ItemStack stack) { if(stack != null) mItem = stack.clone(); else mItem = new ItemStack(0); } public ItemStack getItem() { return mItem; } public void writeItemStack(DataOutputStream stream) throws IOException { // item id stream.writeInt(mItem.getTypeId()); // item durability stream.writeShort(mItem.getDurability()); // item count stream.writeByte(mItem.getAmount()); // item metadata StoredItemMeta meta = new StoredItemMeta(mItem.getItemMeta()); meta.write(stream); } public static StoredItemStack readItemStack(DataInputStream stream) throws IOException, RecordFormatException { int itemId, amount; short durability; itemId = stream.readInt(); durability = stream.readShort(); amount = stream.readByte(); if(itemId < 0 || itemId > Short.MAX_VALUE) throw new RecordFormatException("Bad item id " + itemId); // TODO: I dont know yet why there are amounts less than 0 in transactions, but this is not a corrupting thing so it shall be allowed until a fix is found // if(amount < 0) // throw new RecordFormatException("Bad amount " + amount); ItemStack item = new ItemStack(itemId,amount,durability); StoredItemMeta meta = new StoredItemMeta(); meta.read(stream); item.setItemMeta(meta.getMeta()); return new StoredItemStack(item); } public int getSize() { StoredItemMeta meta = new StoredItemMeta(mItem.getItemMeta()); return 7 + meta.getSize(); } @Override public boolean equals( Object obj ) { if(!(obj instanceof StoredItemStack)) return false; StoredItemStack stack = (StoredItemStack)obj; return mItem.equals(stack.mItem); } private ItemStack mItem; }
UTF-8
Java
1,916
java
StoredItemStack.java
Java
[]
null
[]
package au.com.mineauz.PlayerSpy.storage; import java.io.*; import org.bukkit.inventory.ItemStack; import au.com.mineauz.PlayerSpy.Records.RecordFormatException; public class StoredItemStack { public StoredItemStack(ItemStack stack) { if(stack != null) mItem = stack.clone(); else mItem = new ItemStack(0); } public ItemStack getItem() { return mItem; } public void writeItemStack(DataOutputStream stream) throws IOException { // item id stream.writeInt(mItem.getTypeId()); // item durability stream.writeShort(mItem.getDurability()); // item count stream.writeByte(mItem.getAmount()); // item metadata StoredItemMeta meta = new StoredItemMeta(mItem.getItemMeta()); meta.write(stream); } public static StoredItemStack readItemStack(DataInputStream stream) throws IOException, RecordFormatException { int itemId, amount; short durability; itemId = stream.readInt(); durability = stream.readShort(); amount = stream.readByte(); if(itemId < 0 || itemId > Short.MAX_VALUE) throw new RecordFormatException("Bad item id " + itemId); // TODO: I dont know yet why there are amounts less than 0 in transactions, but this is not a corrupting thing so it shall be allowed until a fix is found // if(amount < 0) // throw new RecordFormatException("Bad amount " + amount); ItemStack item = new ItemStack(itemId,amount,durability); StoredItemMeta meta = new StoredItemMeta(); meta.read(stream); item.setItemMeta(meta.getMeta()); return new StoredItemStack(item); } public int getSize() { StoredItemMeta meta = new StoredItemMeta(mItem.getItemMeta()); return 7 + meta.getSize(); } @Override public boolean equals( Object obj ) { if(!(obj instanceof StoredItemStack)) return false; StoredItemStack stack = (StoredItemStack)obj; return mItem.equals(stack.mItem); } private ItemStack mItem; }
1,916
0.716597
0.713987
83
22.084337
26.415678
156
false
false
0
0
0
0
0
0
1.903614
false
false
9
a7b07dbbc9177d56473189cada722b41adc0beb7
17,910,013,642,234
f9b85d738e322970b6f374faa8eb79438c5b03bc
/BackofficeCore/BackofficeCoreUtil/src/com/sicpa/tt009/bacokffice/backofficecore/util/etc/ExcelReporter.java
cb8a3bf2ef11d1e8cc910b44d67078e93ff1b377
[]
no_license
jlucasfs/backoffice
https://github.com/jlucasfs/backoffice
e4d1aa84f9ba3734ac4fa6e4de0614ed00c7fe74
b3f114285ed1e8c5370bf93de6824dfc33394882
refs/heads/master
2020-03-23T03:54:46.734000
2018-10-17T23:34:28
2018-10-17T23:34:28
141,055,326
0
1
null
false
2018-10-17T23:30:55
2018-07-15T20:09:41
2018-07-15T22:02:12
2018-07-15T22:01:43
46,151
0
1
1
Java
false
null
package com.sicpa.tt009.bacokffice.backofficecore.util.etc; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class ExcelReporter { private List<String> fieldNames = new ArrayList<String>(); private Workbook workbook = null; private String workbookName = "workbook.xls"; public ExcelReporter(String workbookName) { setWorkbookName(workbookName); initialize(); } public ExcelReporter() { initialize(); } public void setWorkbookName(String workbookName) { this.workbookName = workbookName; } private void initialize() { setWorkbook(new HSSFWorkbook()); } void setWorkbook(Workbook workbook) { this.workbook = workbook; } Workbook getWorkbook() { return workbook; } public String getWorkbookName() { return workbookName; } public void closeWorksheet() { // Write the output to a file FileOutputStream fileOut; try { fileOut = new FileOutputStream(getWorkbookName()); getWorkbook().write(fileOut); fileOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public File getWorksheetFile() { // File f = new File(); getWorkbook(); return null; } public <T> void writeReportToExcel(List<T> data) throws Exception { Sheet sheet = getWorkbook().createSheet(data.get(0).getClass().getName()); setupFieldsForClass(data.get(0).getClass()); // Create a row and put some cells in it. Rows are 0 based. int rowCount = 0; int columnCount = 0; Row row = sheet.createRow(rowCount++); for (String fieldName : fieldNames) { Cell cel = row.createCell(columnCount++); cel.setCellValue(fieldName); } Class<? extends Object> clazz = data.get(0).getClass(); for (T t : data) { row = sheet.createRow(rowCount++); columnCount = 0; for (String fieldName : fieldNames) { Cell cel = row.createCell(columnCount); Method method = clazz.getMethod("get" + capitalize(fieldName)); Object value = method.invoke(t, (Object[]) null); if (value != null) { if (value instanceof String) { cel.setCellValue((String) value); } else if (value instanceof Long) { cel.setCellValue((Long) value); } else if (value instanceof Integer) { cel.setCellValue((Integer)value); }else if (value instanceof Double) { cel.setCellValue((Double) value); } } columnCount++; } } closeWorksheet(); } private boolean setupFieldsForClass(Class<?> clazz) throws Exception { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { fieldNames.add(fields[i].getName()); } return true; } public String capitalize(String string) { String capital = string.substring(0, 1).toUpperCase(); return capital + string.substring(1); } }
UTF-8
Java
3,190
java
ExcelReporter.java
Java
[]
null
[]
package com.sicpa.tt009.bacokffice.backofficecore.util.etc; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class ExcelReporter { private List<String> fieldNames = new ArrayList<String>(); private Workbook workbook = null; private String workbookName = "workbook.xls"; public ExcelReporter(String workbookName) { setWorkbookName(workbookName); initialize(); } public ExcelReporter() { initialize(); } public void setWorkbookName(String workbookName) { this.workbookName = workbookName; } private void initialize() { setWorkbook(new HSSFWorkbook()); } void setWorkbook(Workbook workbook) { this.workbook = workbook; } Workbook getWorkbook() { return workbook; } public String getWorkbookName() { return workbookName; } public void closeWorksheet() { // Write the output to a file FileOutputStream fileOut; try { fileOut = new FileOutputStream(getWorkbookName()); getWorkbook().write(fileOut); fileOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public File getWorksheetFile() { // File f = new File(); getWorkbook(); return null; } public <T> void writeReportToExcel(List<T> data) throws Exception { Sheet sheet = getWorkbook().createSheet(data.get(0).getClass().getName()); setupFieldsForClass(data.get(0).getClass()); // Create a row and put some cells in it. Rows are 0 based. int rowCount = 0; int columnCount = 0; Row row = sheet.createRow(rowCount++); for (String fieldName : fieldNames) { Cell cel = row.createCell(columnCount++); cel.setCellValue(fieldName); } Class<? extends Object> clazz = data.get(0).getClass(); for (T t : data) { row = sheet.createRow(rowCount++); columnCount = 0; for (String fieldName : fieldNames) { Cell cel = row.createCell(columnCount); Method method = clazz.getMethod("get" + capitalize(fieldName)); Object value = method.invoke(t, (Object[]) null); if (value != null) { if (value instanceof String) { cel.setCellValue((String) value); } else if (value instanceof Long) { cel.setCellValue((Long) value); } else if (value instanceof Integer) { cel.setCellValue((Integer)value); }else if (value instanceof Double) { cel.setCellValue((Double) value); } } columnCount++; } } closeWorksheet(); } private boolean setupFieldsForClass(Class<?> clazz) throws Exception { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { fieldNames.add(fields[i].getName()); } return true; } public String capitalize(String string) { String capital = string.substring(0, 1).toUpperCase(); return capital + string.substring(1); } }
3,190
0.7
0.695611
125
24.52
19.706079
76
false
false
0
0
0
0
0
0
2.144
false
false
9
f6b63e24726b3dccda2a39d9603b28bdf6b7424e
19,121,194,409,986
972e5282c1fa15fb90e92c609ec5efcf443a2ca0
/Human.java/src/Miscellaneous/Molecules/Oxygen.java
5e4dd2c099e1f734b8173647164cdb1680be569d
[]
no_license
adityataps/Human.java
https://github.com/adityataps/Human.java
25f7805e65ed36686e6f144784b6bdb6409df9b4
d8265a2949b9248bb046615197e52e12de47c83f
refs/heads/master
2020-05-15T06:37:51.664000
2019-05-16T17:33:23
2019-05-16T17:33:23
182,126,958
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Miscellaneous.Molecules; public class Oxygen { }
UTF-8
Java
58
java
Oxygen.java
Java
[]
null
[]
package Miscellaneous.Molecules; public class Oxygen { }
58
0.793103
0.793103
4
13.5
13.573872
32
false
false
0
0
0
0
0
0
0.25
false
false
9
a30f8ebc28cb1ec55ed9f368c6ba933dae0e4d9d
14,362,370,687,805
cf6f4f852d102185e10da7d08450703dd0ff4c11
/src/main/java/com/gg/proj/LoopedGamesLauncher.java
cd36ab97c0df0a9bf6de870d3264e848268695d9
[]
no_license
xxjokerx/AImastermindtest
https://github.com/xxjokerx/AImastermindtest
6092d9750d70ed4f47cb5d395f6f733c4d31e695
8ca55f3f4c8e22c68696f5c926a00eaeaf05ba75
refs/heads/master
2020-03-07T05:35:35.578000
2018-04-23T09:25:47
2018-04-23T09:25:47
127,300,299
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gg.proj; import java.util.ArrayList; public class LoopedGamesLauncher { private Configuration config; private ArrayList<Integer> numberOfTurnsList; private double averageGameLength; public LoopedGamesLauncher() { config = new Configuration(4, 6, 12); numberOfTurnsList = new ArrayList<Integer>(); averageGameLength = 0; } public void runTest(int param) { ListBuilder lb = new ListBuilder(config); ArrayList<String> fullCodeList = lb.getList(); for (String solutionCode : fullCodeList) { AutomatedGame ag = new AutomatedGame(solutionCode, config); ag.runGame(param); numberOfTurnsList.add(ag.getTurnCounter()); System.out.println(ag.toString()); } } public void analyseData() { double numberCodeInList = Math.pow(config.getNumberColors(), config.getNumberDigits()); double grandTotalNumberOfTurns = 0; for (Integer turns : numberOfTurnsList) { grandTotalNumberOfTurns += turns; } averageGameLength = grandTotalNumberOfTurns / numberCodeInList; System.out.println(grandTotalNumberOfTurns + " / " + numberCodeInList); } public void displayResult() { System.out.println("Nombre de tours moyen : " + averageGameLength); } }
UTF-8
Java
1,195
java
LoopedGamesLauncher.java
Java
[]
null
[]
package com.gg.proj; import java.util.ArrayList; public class LoopedGamesLauncher { private Configuration config; private ArrayList<Integer> numberOfTurnsList; private double averageGameLength; public LoopedGamesLauncher() { config = new Configuration(4, 6, 12); numberOfTurnsList = new ArrayList<Integer>(); averageGameLength = 0; } public void runTest(int param) { ListBuilder lb = new ListBuilder(config); ArrayList<String> fullCodeList = lb.getList(); for (String solutionCode : fullCodeList) { AutomatedGame ag = new AutomatedGame(solutionCode, config); ag.runGame(param); numberOfTurnsList.add(ag.getTurnCounter()); System.out.println(ag.toString()); } } public void analyseData() { double numberCodeInList = Math.pow(config.getNumberColors(), config.getNumberDigits()); double grandTotalNumberOfTurns = 0; for (Integer turns : numberOfTurnsList) { grandTotalNumberOfTurns += turns; } averageGameLength = grandTotalNumberOfTurns / numberCodeInList; System.out.println(grandTotalNumberOfTurns + " / " + numberCodeInList); } public void displayResult() { System.out.println("Nombre de tours moyen : " + averageGameLength); } }
1,195
0.743933
0.738912
43
26.790697
23.761957
89
false
false
0
0
0
0
0
0
1.837209
false
false
9
d430698b5c8d5cb5dbeb8b2e88e68f8f768457d9
14,362,370,688,732
f98cdd474e131a27c4113cd7b85618652c9faff8
/src/main/java/com/hiahiahia/cases/defense/path/PathCase10.java
dc2a71e7ea8af26d13a4b520a9a74cf9591eed86
[]
no_license
hiahiahi4/Java_SAST_TestCase_Suite
https://github.com/hiahiahi4/Java_SAST_TestCase_Suite
8e91e4fdfd6f78ec3060f03817856879d9d30fba
2ea935016ca8fe120326927b0ed8e0af99b2d98f
refs/heads/master
2023-09-05T06:02:16.630000
2021-11-23T09:14:31
2021-11-23T09:14:31
335,469,308
5
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hiahiahia.cases.defense.path; import org.apache.commons.io.FileUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.io.InputStream; @RestController public class PathCase10 { @RequestMapping("/path/case10") public void safe_upload(@RequestParam(value="file") MultipartFile file) throws IOException { uploadFile(file); } public void uploadFile(MultipartFile file) throws IOException { String fileName = file.getOriginalFilename(); /* * 防护方法:File对象获取绝对路径,进行startwith判断 */ File tmpFile = new File(fileName); if(!tmpFile.getCanonicalPath().startsWith("/tmp/")) { throw new IOException(); } try { InputStream in = file.getInputStream(); FileUtils.copyInputStreamToFile(in, tmpFile); // safe } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @RequestMapping("/path/case10_unsafe") public void unsafe_upload(@RequestParam(value="file") MultipartFile file) { String fileName = file.getOriginalFilename(); File targetFile = new File(fileName); try { InputStream in = file.getInputStream(); FileUtils.copyInputStreamToFile(in, targetFile); // unsafe } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
1,746
java
PathCase10.java
Java
[]
null
[]
package com.hiahiahia.cases.defense.path; import org.apache.commons.io.FileUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.io.InputStream; @RestController public class PathCase10 { @RequestMapping("/path/case10") public void safe_upload(@RequestParam(value="file") MultipartFile file) throws IOException { uploadFile(file); } public void uploadFile(MultipartFile file) throws IOException { String fileName = file.getOriginalFilename(); /* * 防护方法:File对象获取绝对路径,进行startwith判断 */ File tmpFile = new File(fileName); if(!tmpFile.getCanonicalPath().startsWith("/tmp/")) { throw new IOException(); } try { InputStream in = file.getInputStream(); FileUtils.copyInputStreamToFile(in, tmpFile); // safe } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @RequestMapping("/path/case10_unsafe") public void unsafe_upload(@RequestParam(value="file") MultipartFile file) { String fileName = file.getOriginalFilename(); File targetFile = new File(fileName); try { InputStream in = file.getInputStream(); FileUtils.copyInputStreamToFile(in, targetFile); // unsafe } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
1,746
0.659649
0.65614
49
33.897961
23.770369
96
false
false
0
0
0
0
0
0
0.55102
false
false
9
b3c0db4330abd70929aceab2df0f71dd785cef01
4,853,313,104,183
f0a417ea50c260a0306f87d5967a0342d1ba0e77
/app/src/main/java/br/com/franciscosens/exemplonavigationdrawer/models/Pokemon.java
99774501eac1186c5b7b36604d0004bf61b4e14c
[]
no_license
franciscosens/android-exemplo-navigation-drawer
https://github.com/franciscosens/android-exemplo-navigation-drawer
728ed16d7e02f9e31511da9b98efcd2f879cea8b
2361eb0dba0c3d3bb0aa3837a55c479d7b613003
refs/heads/master
2020-06-12T21:15:53.324000
2019-06-29T16:37:08
2019-06-29T16:37:08
194,427,290
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.franciscosens.exemplonavigationdrawer.models; public class Pokemon { }
UTF-8
Java
87
java
Pokemon.java
Java
[]
null
[]
package br.com.franciscosens.exemplonavigationdrawer.models; public class Pokemon { }
87
0.827586
0.827586
4
20.75
24.304064
60
false
false
0
0
0
0
0
0
0.25
false
false
9
76b95c8261c99a3ae5107975fb327f65eca8e4b3
17,265,768,588,660
a1296a70a1b9f41db02157aeb3aee806e418f75e
/src/main/java/spring/boot/aws/service/OrderProcessingService.java
f5131447a49f2671d0a47587c0d438290c9970d4
[]
no_license
faizakram/springboot-with-aws-sqs
https://github.com/faizakram/springboot-with-aws-sqs
24b20dddc9c96409a55c87ea19ac0757c8cf0dbc
5f06fea439b464cc7c9ef367b5070b6e38ecb7a2
refs/heads/master
2023-02-18T03:42:36.914000
2020-05-24T07:56:02
2020-05-24T07:56:02
266,442,909
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package spring.boot.aws.service; public interface OrderProcessingService { void createOrder(int itemNumber); }
UTF-8
Java
115
java
OrderProcessingService.java
Java
[]
null
[]
package spring.boot.aws.service; public interface OrderProcessingService { void createOrder(int itemNumber); }
115
0.8
0.8
7
15.428572
17.710829
41
false
false
0
0
0
0
0
0
0.428571
false
false
9
b1c3b04d106ea3162a90101b4d8649e959f0681c
17,265,768,589,783
ab0f271698d39e2b2064aa450e3a9bf10b2111f4
/src/pf/game/Card.java
cf726939565e7e4621fe4862b481e769ab554ef6
[]
no_license
torybash/PokerFramework
https://github.com/torybash/PokerFramework
e6eac47b742bede2416c9064670f927e9ae403ea
5df484165dfc2923fda213e5b921166f657d44d2
refs/heads/master
2021-01-09T20:01:01.418000
2016-07-30T20:41:13
2016-07-30T20:41:13
64,156,077
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pf.game; public class Card { public enum CardSuit{ SPADES, CLUBS, HEARTS, DIAMONDS } public CardSuit cardSuit; public int number; //1-13 public Card(){ } public Card(CardSuit suit, int num){ cardSuit = suit; number = num; } @Override public String toString() { return "Card[" + cardSuit + ":" + CardName() + "]"; } private String CardName(){ String name = ""; if (number < 9) name = "" + (number + 2); else if (number == 9) name = "J"; else if (number == 10) name = "Q"; else if (number == 11) name = "K"; else if (number == 12) name = "A"; return name; } public int compareTo(Card o1) { // TODO Auto-generated method stub if (number > o1.number) return 1; else if (number == o1.number) return 0; else return -1; } }
UTF-8
Java
791
java
Card.java
Java
[]
null
[]
package pf.game; public class Card { public enum CardSuit{ SPADES, CLUBS, HEARTS, DIAMONDS } public CardSuit cardSuit; public int number; //1-13 public Card(){ } public Card(CardSuit suit, int num){ cardSuit = suit; number = num; } @Override public String toString() { return "Card[" + cardSuit + ":" + CardName() + "]"; } private String CardName(){ String name = ""; if (number < 9) name = "" + (number + 2); else if (number == 9) name = "J"; else if (number == 10) name = "Q"; else if (number == 11) name = "K"; else if (number == 12) name = "A"; return name; } public int compareTo(Card o1) { // TODO Auto-generated method stub if (number > o1.number) return 1; else if (number == o1.number) return 0; else return -1; } }
791
0.596713
0.573957
44
16.977272
15.405856
53
false
false
0
0
0
0
0
0
1.704545
false
false
9
22dc8781d86d84ffd68e4f393fcb6f06d9199531
1,726,576,910,163
d221a55f8d88ff53d75b6a929c479fe24430381d
/Project Files/app/src/main/java/com/example/inventorymanagementapp/ApiHandler.java
b532b20705353f105d56fbe787b6bed3b08f4c92
[]
no_license
yt/cse3044spring2019p1_tyurdaer_hyalcin_egungor
https://github.com/yt/cse3044spring2019p1_tyurdaer_hyalcin_egungor
c707637cdc9b19a7a062272cfe0057a92d1a5642
2c24589261599e6ef0df0265959e9d64473d04f9
refs/heads/master
2020-04-25T16:08:17.638000
2019-06-18T08:29:09
2019-06-18T08:29:09
172,899,965
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.inventorymanagementapp; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.util.Log; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonArrayRequest; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOError; import java.util.HashMap; import java.util.Map; public class ApiHandler extends AsyncTask<String,String,JSONObject> { Context context; String email; String type; String card_no; final String url = "https://9gjgvaty2l.execute-api.eu-central-1.amazonaws.com/dev"; public ApiHandler(Context ctx){ context = ctx; } @Override protected JSONObject doInBackground(String... params) { this.type = params[0]; switch(type) { case "login": try { this.email = params[1]; String login_url = url + "/person/auth"; JSONObject jsonBody = new JSONObject(); jsonBody.put("email", params[1]); jsonBody.put("password", params[2]); httpPost(login_url,jsonBody); }catch (IOError e){ e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } break; case "register": try { String register_url = url + "/person"; JSONObject jsonBody = new JSONObject(); jsonBody.put("email", params[1]); jsonBody.put("password", params[2]); jsonBody.put("name", params[3]); jsonBody.put("surname", params[4]); httpPost(register_url,jsonBody); }catch (IOError e){ e.printStackTrace(); }catch (JSONException e) { e.printStackTrace(); } break; case "list_products": this.email = params[1]; String list_url = url + "/product?email=" + email; list_products(list_url); break; case "view_product": this.email = params[1]; this.card_no = params[2]; String view_url = url + "/product?cardno=" + this.card_no; httpGet(view_url); break; case "new_product": try { this.email = params[1]; this.card_no = params[3]; String new_product_url = url + "/product"; JSONObject jsonBody = new JSONObject(); jsonBody.put("username", params[1]); jsonBody.put("product_name", params[2]); jsonBody.put("card_no", params[3]); jsonBody.put("model_no", params[4]); jsonBody.put("price_buy", params[5]); jsonBody.put("price_sell", params[6]); jsonBody.put("place", params[7]); jsonBody.put("description", params[8]); jsonBody.put("quantity", params[9]); jsonBody.put("log", new JSONArray()); httpPost(new_product_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "update_product": try { this.email = params[1]; this.card_no = params[3]; String update_url = url + "/product"; JSONObject jsonBody = new JSONObject(); jsonBody.put("username", params[1]); jsonBody.put("product_name", params[2]); jsonBody.put("card_no", params[3]); jsonBody.put("model_no", params[4]); jsonBody.put("price_buy", params[5]); jsonBody.put("price_sell", params[6]); jsonBody.put("place", params[7]); jsonBody.put("description", params[8]); jsonBody.put("quantity", params[9]); httpPut(update_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "delete_product": this.email = params[1]; this.card_no = params[2]; String delete_url = url + "/product?cardno=" + this.card_no; httpDelete(delete_url); break; case "add_unit": try { this.email = params[1]; this.card_no = params[2]; String add_unit_url = url + "/product/log"; JSONObject jsonBody = new JSONObject(); jsonBody.put("card_no", this.card_no); jsonBody.put("customer", params[3]); jsonBody.put("quantity", Integer.parseInt(params[4])); jsonBody.put("date",params[5]); jsonBody.put("sob", true); Log.d("add_unit",jsonBody.toString()); httpPut(add_unit_url, jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "remove_unit": try { this.email = params[1]; this.card_no = params[2]; String remove_unit_url = url + "/product/log"; JSONObject jsonBody = new JSONObject(); jsonBody.put("card_no", this.card_no); jsonBody.put("customer", params[3]); jsonBody.put("quantity", Integer.parseInt(params[4])); jsonBody.put("date",params[5]); jsonBody.put("sob", false); httpPut(remove_unit_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "search": this.email = params[1]; String query = params[2]; String search_url; if (query.equals("")){ search_url = url + "/product?email=" + this.email; }else{ search_url = url + "/product/search?email=" + this.email + "&" + "query=" + query; } list_products(search_url); break; default: Log.e("Type Erorr","Type did not match!"); } return null; } private void list_products(String url) { JsonArrayRequest req = new JsonArrayRequest(url, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d("jsonarrayreq", response.toString()); LinearLayout tl = ((Activity)context).findViewById(R.id.all_products_table_layout); tl.removeAllViews(); View tablerow; TextView product_name_txt, card_no_txt, place_txt, quantity_txt; try { // Parsing json array response // loop through each json object for (int i = 0; i < response.length(); i++) { // Get json object from response JSONObject product = (JSONObject) response.get(i); // Parse json object String name = product.getString("modelName"); String quantity = product.getString("quantity"); final String cardNo = product.getString("cardNo"); final String username = product.getString("username"); String place = product.getString("place"); // Create table row for each product, add it to the list tablerow = View.inflate(context, R.layout.product_list_row, null); product_name_txt = tablerow.findViewById(R.id.product_name); card_no_txt= tablerow.findViewById(R.id.card_no); place_txt = tablerow.findViewById(R.id.place); quantity_txt = tablerow.findViewById(R.id.quantity); // initialize text views product_name_txt.setText(name); card_no_txt.setText(cardNo); place_txt.setText(place); quantity_txt.setText(quantity); // table row listener tablerow.setTag(i); tablerow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context,ProductView.class); intent.putExtra("email",username); intent.putExtra("c_no",cardNo); context.startActivity(intent); ((Activity)context).finish(); } }); //add TableRows to Layout tl.addView(tablerow); } } catch (JSONException e) { e.printStackTrace(); Toast.makeText(context, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d("jsonarrayError", "Error: " + error.getMessage()); Toast.makeText(context, error.getMessage(), Toast.LENGTH_SHORT).show(); } }); // Adding request to request queue MySingleton.getmInstance(context).addToRequestQue(req); } private void httpGet(String url){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Get Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Get Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpPost(String url, JSONObject jsonBody){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.POST, url, jsonBody, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Post Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Post Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpDelete(String url){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.DELETE, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Delete Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Delete Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpPut(String url, JSONObject jsonBody){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.PUT, url, jsonBody, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Put Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Put Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void processResponse(JSONObject response) throws JSONException { if (this.type.equals("login")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ListProducts.class); intent.putExtra("email",this.email); Toast.makeText(context, "Welcome " + this.email, Toast.LENGTH_SHORT).show(); context.startActivity(intent); ((Activity)context).finish(); } else{ Toast.makeText(context, "Login Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("register")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, Login.class); Toast.makeText(context, "Register Success!", Toast.LENGTH_LONG).show(); context.startActivity(intent); ((Activity)context).finish(); } else{ Toast.makeText(context, "Register Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("new_product")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ProductView.class); intent.putExtra("c_no", this.card_no); intent.putExtra("email", this.email); Toast.makeText(context, "Product added!", Toast.LENGTH_SHORT).show(); context.startActivity(intent); ((Activity)context).finish(); } else { Toast.makeText(context, "This product already in list!", Toast.LENGTH_LONG).show(); } }else if (this.type.equals("view_product")){ try { String fail = response.getString("result"); if (fail.equals("true") || fail.equals("false")) Toast.makeText(context, "View product failed!", Toast.LENGTH_SHORT).show(); }catch (JSONException e){ ((ProductView)context).fill(response); } }else if (this.type.equals(("delete_product"))){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ListProducts.class); intent.putExtra("email", this.email); context.startActivity(intent); ((Activity)context).finish(); }else { Toast.makeText(context, "Product Delete Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals(("update_product"))){ if (response.getString("result").equals("true")){ Toast.makeText(context, "Product Updated!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, ProductView.class); intent.putExtra("email", this.email); intent.putExtra("c_no", this.card_no); context.startActivity(intent); ((Activity)context).finish(); }else { Toast.makeText(context, "Product Update Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("add_unit") || this.type.equals("remove_unit")){ if (response.getString("result").equals("true")){ Toast.makeText(context, "Completed!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, ProductView.class); intent.putExtra("email", this.email); intent.putExtra("c_no", this.card_no); context.startActivity(intent); ((Activity)context).finish(); } } } }
UTF-8
Java
20,292
java
ApiHandler.java
Java
[ { "context": " final String username = product.getString(\"username\");\n String place =", "end": 8577, "score": 0.9978586435317993, "start": 8569, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.example.inventorymanagementapp; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.util.Log; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonArrayRequest; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOError; import java.util.HashMap; import java.util.Map; public class ApiHandler extends AsyncTask<String,String,JSONObject> { Context context; String email; String type; String card_no; final String url = "https://9gjgvaty2l.execute-api.eu-central-1.amazonaws.com/dev"; public ApiHandler(Context ctx){ context = ctx; } @Override protected JSONObject doInBackground(String... params) { this.type = params[0]; switch(type) { case "login": try { this.email = params[1]; String login_url = url + "/person/auth"; JSONObject jsonBody = new JSONObject(); jsonBody.put("email", params[1]); jsonBody.put("password", params[2]); httpPost(login_url,jsonBody); }catch (IOError e){ e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } break; case "register": try { String register_url = url + "/person"; JSONObject jsonBody = new JSONObject(); jsonBody.put("email", params[1]); jsonBody.put("password", params[2]); jsonBody.put("name", params[3]); jsonBody.put("surname", params[4]); httpPost(register_url,jsonBody); }catch (IOError e){ e.printStackTrace(); }catch (JSONException e) { e.printStackTrace(); } break; case "list_products": this.email = params[1]; String list_url = url + "/product?email=" + email; list_products(list_url); break; case "view_product": this.email = params[1]; this.card_no = params[2]; String view_url = url + "/product?cardno=" + this.card_no; httpGet(view_url); break; case "new_product": try { this.email = params[1]; this.card_no = params[3]; String new_product_url = url + "/product"; JSONObject jsonBody = new JSONObject(); jsonBody.put("username", params[1]); jsonBody.put("product_name", params[2]); jsonBody.put("card_no", params[3]); jsonBody.put("model_no", params[4]); jsonBody.put("price_buy", params[5]); jsonBody.put("price_sell", params[6]); jsonBody.put("place", params[7]); jsonBody.put("description", params[8]); jsonBody.put("quantity", params[9]); jsonBody.put("log", new JSONArray()); httpPost(new_product_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "update_product": try { this.email = params[1]; this.card_no = params[3]; String update_url = url + "/product"; JSONObject jsonBody = new JSONObject(); jsonBody.put("username", params[1]); jsonBody.put("product_name", params[2]); jsonBody.put("card_no", params[3]); jsonBody.put("model_no", params[4]); jsonBody.put("price_buy", params[5]); jsonBody.put("price_sell", params[6]); jsonBody.put("place", params[7]); jsonBody.put("description", params[8]); jsonBody.put("quantity", params[9]); httpPut(update_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "delete_product": this.email = params[1]; this.card_no = params[2]; String delete_url = url + "/product?cardno=" + this.card_no; httpDelete(delete_url); break; case "add_unit": try { this.email = params[1]; this.card_no = params[2]; String add_unit_url = url + "/product/log"; JSONObject jsonBody = new JSONObject(); jsonBody.put("card_no", this.card_no); jsonBody.put("customer", params[3]); jsonBody.put("quantity", Integer.parseInt(params[4])); jsonBody.put("date",params[5]); jsonBody.put("sob", true); Log.d("add_unit",jsonBody.toString()); httpPut(add_unit_url, jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "remove_unit": try { this.email = params[1]; this.card_no = params[2]; String remove_unit_url = url + "/product/log"; JSONObject jsonBody = new JSONObject(); jsonBody.put("card_no", this.card_no); jsonBody.put("customer", params[3]); jsonBody.put("quantity", Integer.parseInt(params[4])); jsonBody.put("date",params[5]); jsonBody.put("sob", false); httpPut(remove_unit_url,jsonBody); } catch (JSONException e) { e.printStackTrace(); } break; case "search": this.email = params[1]; String query = params[2]; String search_url; if (query.equals("")){ search_url = url + "/product?email=" + this.email; }else{ search_url = url + "/product/search?email=" + this.email + "&" + "query=" + query; } list_products(search_url); break; default: Log.e("Type Erorr","Type did not match!"); } return null; } private void list_products(String url) { JsonArrayRequest req = new JsonArrayRequest(url, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d("jsonarrayreq", response.toString()); LinearLayout tl = ((Activity)context).findViewById(R.id.all_products_table_layout); tl.removeAllViews(); View tablerow; TextView product_name_txt, card_no_txt, place_txt, quantity_txt; try { // Parsing json array response // loop through each json object for (int i = 0; i < response.length(); i++) { // Get json object from response JSONObject product = (JSONObject) response.get(i); // Parse json object String name = product.getString("modelName"); String quantity = product.getString("quantity"); final String cardNo = product.getString("cardNo"); final String username = product.getString("username"); String place = product.getString("place"); // Create table row for each product, add it to the list tablerow = View.inflate(context, R.layout.product_list_row, null); product_name_txt = tablerow.findViewById(R.id.product_name); card_no_txt= tablerow.findViewById(R.id.card_no); place_txt = tablerow.findViewById(R.id.place); quantity_txt = tablerow.findViewById(R.id.quantity); // initialize text views product_name_txt.setText(name); card_no_txt.setText(cardNo); place_txt.setText(place); quantity_txt.setText(quantity); // table row listener tablerow.setTag(i); tablerow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context,ProductView.class); intent.putExtra("email",username); intent.putExtra("c_no",cardNo); context.startActivity(intent); ((Activity)context).finish(); } }); //add TableRows to Layout tl.addView(tablerow); } } catch (JSONException e) { e.printStackTrace(); Toast.makeText(context, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d("jsonarrayError", "Error: " + error.getMessage()); Toast.makeText(context, error.getMessage(), Toast.LENGTH_SHORT).show(); } }); // Adding request to request queue MySingleton.getmInstance(context).addToRequestQue(req); } private void httpGet(String url){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Get Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Get Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpPost(String url, JSONObject jsonBody){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.POST, url, jsonBody, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Post Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Post Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpDelete(String url){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.DELETE, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Delete Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Delete Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void httpPut(String url, JSONObject jsonBody){ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest (Request.Method.PUT, url, jsonBody, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.v("Put Success", response.toString()); processResponse(response); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Put Error", error.toString()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); return params; } @Override public String getBodyContentType(){ return "application/json"; } }; MySingleton.getmInstance(context).addToRequestQue(jsonObjectRequest); } private void processResponse(JSONObject response) throws JSONException { if (this.type.equals("login")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ListProducts.class); intent.putExtra("email",this.email); Toast.makeText(context, "Welcome " + this.email, Toast.LENGTH_SHORT).show(); context.startActivity(intent); ((Activity)context).finish(); } else{ Toast.makeText(context, "Login Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("register")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, Login.class); Toast.makeText(context, "Register Success!", Toast.LENGTH_LONG).show(); context.startActivity(intent); ((Activity)context).finish(); } else{ Toast.makeText(context, "Register Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("new_product")){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ProductView.class); intent.putExtra("c_no", this.card_no); intent.putExtra("email", this.email); Toast.makeText(context, "Product added!", Toast.LENGTH_SHORT).show(); context.startActivity(intent); ((Activity)context).finish(); } else { Toast.makeText(context, "This product already in list!", Toast.LENGTH_LONG).show(); } }else if (this.type.equals("view_product")){ try { String fail = response.getString("result"); if (fail.equals("true") || fail.equals("false")) Toast.makeText(context, "View product failed!", Toast.LENGTH_SHORT).show(); }catch (JSONException e){ ((ProductView)context).fill(response); } }else if (this.type.equals(("delete_product"))){ if (response.getString("result").equals("true")){ Intent intent = new Intent(context, ListProducts.class); intent.putExtra("email", this.email); context.startActivity(intent); ((Activity)context).finish(); }else { Toast.makeText(context, "Product Delete Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals(("update_product"))){ if (response.getString("result").equals("true")){ Toast.makeText(context, "Product Updated!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, ProductView.class); intent.putExtra("email", this.email); intent.putExtra("c_no", this.card_no); context.startActivity(intent); ((Activity)context).finish(); }else { Toast.makeText(context, "Product Update Failed!", Toast.LENGTH_SHORT).show(); } }else if (this.type.equals("add_unit") || this.type.equals("remove_unit")){ if (response.getString("result").equals("true")){ Toast.makeText(context, "Completed!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, ProductView.class); intent.putExtra("email", this.email); intent.putExtra("c_no", this.card_no); context.startActivity(intent); ((Activity)context).finish(); } } } }
20,292
0.477775
0.475261
483
41.012421
25.345068
107
false
false
0
0
0
0
0
0
0.805383
false
false
9
4fd41567ba1c7f1a65cac767456baba9c71ad4dc
1,726,576,910,980
247f6b66c15793edf9f26e58e5a0fc4127bba45d
/src/main/java/org/openwms/common/transport/Barcode.java
6235fb62adfe68df5cc1439d75085220f0225935
[ "Apache-2.0" ]
permissive
hacku7/org.openwms.tms.movements_fork
https://github.com/hacku7/org.openwms.tms.movements_fork
c2d4eb29a2f6eace511aed596fe0892e33359060
af4e85d442447f68c7c84f46e8cbab4009eeffed
refs/heads/master
2023-08-10T20:14:30.573000
2021-10-09T20:22:41
2021-10-09T20:22:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2005-2021 the original author or authors. * * 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.openwms.common.transport; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.Objects; /** * A Barcode is a printable item with an unique identifier to label {@code TransportUnit}s. The identifier has a defined number of * characters whereas these characters are aligned either left or right. Non filled positions of a Barcode are padded with a so called * padding character. * * @author Heiko Scherrer * @GlossaryTerm */ @Embeddable public class Barcode implements Serializable { /** 'Identifier' of the {@code Barcode}. <p> <i>Note:</i>It is not guaranteed that this field must be unique. </p> */ @Column(name = "C_BARCODE") @NotEmpty private String value; /*~ ----------------------------- constructors ------------------- */ /** Dear JPA... */ protected Barcode() { } private Barcode(String value) { this.value = value; } /** * Simple factory method to replace default constructor in application logic (still needed for framework stuff). * * @param value The value of the {@code Barcode} as String * @return Formatted Barcode instance */ public static Barcode of(String value) { return new Barcode(value); } /*~ ----------------------------- methods ------------------- */ /** * Return the {@code Barcode} value. * * @return The value of the {@code Barcode} */ public String getValue() { return value; } /** * Set the {@code Barcode} value. * * @param value The value to set */ public void setValue(String value) { this.value = value; } /** * Return the value of the {@code Barcode} as String. * * @return As String * @see #getValue() */ @Override public String toString() { return value; } /** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Barcode barcode = (Barcode) o; return value.equals(barcode.value); } /** * {@inheritDoc} */ @Override public int hashCode() { return Objects.hash(value); } }
UTF-8
Java
2,982
java
Barcode.java
Java
[ { "context": "th a so called\n * padding character.\n *\n * @author Heiko Scherrer\n * @GlossaryTerm\n */\n@Embeddable\npublic class Bar", "end": 1148, "score": 0.9995637536048889, "start": 1134, "tag": "NAME", "value": "Heiko Scherrer" } ]
null
[]
/* * Copyright 2005-2021 the original author or authors. * * 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.openwms.common.transport; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.Objects; /** * A Barcode is a printable item with an unique identifier to label {@code TransportUnit}s. The identifier has a defined number of * characters whereas these characters are aligned either left or right. Non filled positions of a Barcode are padded with a so called * padding character. * * @author <NAME> * @GlossaryTerm */ @Embeddable public class Barcode implements Serializable { /** 'Identifier' of the {@code Barcode}. <p> <i>Note:</i>It is not guaranteed that this field must be unique. </p> */ @Column(name = "C_BARCODE") @NotEmpty private String value; /*~ ----------------------------- constructors ------------------- */ /** Dear JPA... */ protected Barcode() { } private Barcode(String value) { this.value = value; } /** * Simple factory method to replace default constructor in application logic (still needed for framework stuff). * * @param value The value of the {@code Barcode} as String * @return Formatted Barcode instance */ public static Barcode of(String value) { return new Barcode(value); } /*~ ----------------------------- methods ------------------- */ /** * Return the {@code Barcode} value. * * @return The value of the {@code Barcode} */ public String getValue() { return value; } /** * Set the {@code Barcode} value. * * @param value The value to set */ public void setValue(String value) { this.value = value; } /** * Return the value of the {@code Barcode} as String. * * @return As String * @see #getValue() */ @Override public String toString() { return value; } /** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Barcode barcode = (Barcode) o; return value.equals(barcode.value); } /** * {@inheritDoc} */ @Override public int hashCode() { return Objects.hash(value); } }
2,974
0.618042
0.614017
109
26.366972
28.454908
134
false
false
0
0
0
0
0
0
0.220183
false
false
9
aa083627b5ad2528f82bfec94afa69b8b4be0b15
8,478,265,502,415
a5972ba73727b6ecc9ee197970ffc65d88d9bbac
/src/test/java/br/com/danidr7/service/SaiyajinServiceTest.java
da92f45bdeee4567cbda849c6bc5bc2a3f0604cb
[]
no_license
danidr7/java-api-practice
https://github.com/danidr7/java-api-practice
46992c27241723af453cee2159daf95f43bd4a1e
de59bae2f211155f0ec4aafaf2f21145e64512bb
refs/heads/master
2021-07-04T15:16:10.420000
2019-10-02T02:11:02
2019-10-02T02:11:02
193,281,633
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.danidr7.service; import br.com.danidr7.domain.Saiyajin; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.HashSet; @RunWith(SpringRunner.class) @SpringBootTest public class SaiyajinServiceTest { @Autowired private SaiyajinService saiyajinService; @Test public void saveSaiyajin(){ Saiyajin saiyajin = new Saiyajin(); saiyajin.setName("Goku"); saiyajin.setAge(38); saiyajin.setSkills(new HashSet<String>(){{add("kamehameha");}}); saiyajin.setMaxLeval(7); saiyajinService.createSaiyajin(saiyajin); Saiyajin saiyajinB = saiyajinService.getSaiyajin(saiyajin.getName()); Assert.assertEquals(saiyajin.getName(), saiyajinB.getName()); Assert.assertEquals(saiyajin.getAge(), saiyajinB.getAge()); Assert.assertEquals(saiyajin.getSkills(), saiyajinB.getSkills()); Assert.assertEquals(saiyajin.getMaxLeval(), saiyajinB.getMaxLeval()); } }
UTF-8
Java
1,193
java
SaiyajinServiceTest.java
Java
[ { "context": "yajin = new Saiyajin();\n saiyajin.setName(\"Goku\");\n saiyajin.setAge(38);\n saiyajin.", "end": 624, "score": 0.8932773470878601, "start": 620, "tag": "NAME", "value": "Goku" } ]
null
[]
package br.com.danidr7.service; import br.com.danidr7.domain.Saiyajin; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.HashSet; @RunWith(SpringRunner.class) @SpringBootTest public class SaiyajinServiceTest { @Autowired private SaiyajinService saiyajinService; @Test public void saveSaiyajin(){ Saiyajin saiyajin = new Saiyajin(); saiyajin.setName("Goku"); saiyajin.setAge(38); saiyajin.setSkills(new HashSet<String>(){{add("kamehameha");}}); saiyajin.setMaxLeval(7); saiyajinService.createSaiyajin(saiyajin); Saiyajin saiyajinB = saiyajinService.getSaiyajin(saiyajin.getName()); Assert.assertEquals(saiyajin.getName(), saiyajinB.getName()); Assert.assertEquals(saiyajin.getAge(), saiyajinB.getAge()); Assert.assertEquals(saiyajin.getSkills(), saiyajinB.getSkills()); Assert.assertEquals(saiyajin.getMaxLeval(), saiyajinB.getMaxLeval()); } }
1,193
0.732607
0.727578
38
30.394737
25.744226
77
false
false
0
0
0
0
0
0
0.684211
false
false
9
d0766ee0f84e6cecb8c757d27caef59c6c55d6f5
13,932,873,968,535
27a9439ef47b03c69dfe98b0fc80e01db0a5bc64
/My Java Codes/Interface/Usecal.java
a846be169f9aba26190e44d5acfa40273a53d0ea
[]
no_license
harshit027/Codes
https://github.com/harshit027/Codes
4658a7a9ebf894017bd858ba52e022a553312bfa
b04d12a9e32d988033bbd26e80597d5db0495a3d
refs/heads/master
2020-06-04T03:55:37.118000
2017-01-13T06:46:13
2017-01-13T06:46:13
26,617,571
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; /*interface cal //available in f:\myjava\mypack { void add(); void subtract(); void getData(); void show(); }*/ class Calculator implements cal { double a,b,c; public void getData() { Scanner obj=new Scanner(System.in); System.out.println("Enter the numbers :"); a=obj.nextDouble(); b=obj.nextDouble(); } public void add() { System.out.println("Addition performed !"); c=a+b; } public void subtract() { System.out.println("Subtraction performed !"); c=a-b; } public void show() { System.out.println("Result="+c); } } class Usecal { public static void main(String args[]) { cal ref; Calculator c=new Calculator(); ref=c; c.getData(); c.add(); c.show(); } }
UTF-8
Java
755
java
Usecal.java
Java
[]
null
[]
import java.util.Scanner; /*interface cal //available in f:\myjava\mypack { void add(); void subtract(); void getData(); void show(); }*/ class Calculator implements cal { double a,b,c; public void getData() { Scanner obj=new Scanner(System.in); System.out.println("Enter the numbers :"); a=obj.nextDouble(); b=obj.nextDouble(); } public void add() { System.out.println("Addition performed !"); c=a+b; } public void subtract() { System.out.println("Subtraction performed !"); c=a-b; } public void show() { System.out.println("Result="+c); } } class Usecal { public static void main(String args[]) { cal ref; Calculator c=new Calculator(); ref=c; c.getData(); c.add(); c.show(); } }
755
0.623841
0.623841
53
13.264151
14.426327
48
false
false
0
0
0
0
0
0
1.264151
false
false
9
a57fdcd601c2352ce59816d5f199e61a2bbfc79b
23,742,579,267,447
c7c6dee3afd846845a98cd2051015ed7cc70ede9
/src/Assignment5/ModelYearComparator.java
93d074a9e3388412c2f802f276436bc8e0868ea7
[]
no_license
saraarnesen/TDA550-Assignments
https://github.com/saraarnesen/TDA550-Assignments
fb4d4796e706694cbd6e8dc7639ef048e416cf84
b92cdeab85df5d346aa20b46dfeddd307670f919
refs/heads/master
2020-09-10T08:25:09.170000
2020-01-09T17:27:52
2020-01-09T17:27:52
221,702,015
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Assignment5; import java.util.Comparator; /** * Comparator for comparing car model years */ public class ModelYearComparator extends AbstractComparator<Car> { /** * @param comparator other decorator possible null * @param ascending */ public ModelYearComparator(Comparator<Car> comparator, Order order) { super(comparator, order); } @Override public int doCompare(Car c1, Car c2) { int year1 = c1.getModelYear(); int year2 = c2.getModelYear(); if (year1 == year2) { return 0; } if (year1 > year2) { return 1; } return -1; } }
UTF-8
Java
572
java
ModelYearComparator.java
Java
[]
null
[]
package Assignment5; import java.util.Comparator; /** * Comparator for comparing car model years */ public class ModelYearComparator extends AbstractComparator<Car> { /** * @param comparator other decorator possible null * @param ascending */ public ModelYearComparator(Comparator<Car> comparator, Order order) { super(comparator, order); } @Override public int doCompare(Car c1, Car c2) { int year1 = c1.getModelYear(); int year2 = c2.getModelYear(); if (year1 == year2) { return 0; } if (year1 > year2) { return 1; } return -1; } }
572
0.687063
0.662587
29
18.758621
19.480593
70
false
false
0
0
0
0
0
0
1.448276
false
false
9
5feb3138b1cea4079cea71d81c1231b33ca5469e
10,075,993,329,882
8a710551801f96cf65fd3601b3680bcc29bc31a6
/src/test/IntegerAVLTree2Test.java
50c0cb78b2064154fc224279d8c9c7975736fc3f
[]
no_license
gromarion/avmc-avl_tree_test
https://github.com/gromarion/avmc-avl_tree_test
5bcc9aa046f077f487372b16f78cdf63d987f9f5
2ef490f5fc9b52100a9a8b71e5fb137f9bc59f7a
refs/heads/master
2021-01-01T05:20:39.215000
2016-04-22T11:04:10
2016-04-22T11:04:10
56,350,213
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import static org.junit.Assert.assertTrue; import org.junit.Test; import avmc.AVLTree2; public class IntegerAVLTree2Test { AVLTree2<Integer> createAVLTree() { return new AVLTree2<Integer>(); } // @Test // public void simpleInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // assertTrue(tree.getRoot().getDepth() == 1); // assertTrue(tree.getRoot().getData().equals(3)); // } // @Test // public void orderedInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(1); // tree.insert(2); // tree.insert(3); // AVLTree2<Integer>.Node<Integer> root = tree.getRoot(); // assertTrue(root.getData().equals(2)); // assertTrue(root.getLeft().getData().equals(1)); // assertTrue(root.getRight().getData().equals(3)); // } // @Test // public void disorderedInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // tree.insert(1); // tree.insert(2); // AVLTree2<Integer>.Node<Integer> root = tree.getRoot(); // assertTrue(root.getData().equals(2)); // assertTrue(root.getLeft().getData().equals(1)); // assertTrue(root.getRight().getData().equals(3)); // } // // @Test // public void searchFor2Test() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // tree.insert(1); // tree.insert(2); // assertTrue(tree.search(2)); // assertTrue(tree.search(1)); // assertTrue(tree.search(3)); // } @Test public void findMinTest() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(4); tree.insert(5); tree.insert(6); assertTrue(tree.findMin().equals(4)); tree.insert(1); tree.insert(2); tree.insert(3); assertTrue(tree.findMin().equals(1)); } @Test public void findMaxTest() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(3); tree.insert(2); tree.insert(1); assertTrue(tree.findMax().equals(3)); tree.insert(6); tree.insert(5); tree.insert(4); assertTrue(tree.findMax().equals(6)); } @Test public void test() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(2); tree.insert(4); tree.insert(1); tree.insert(3); assertTrue(tree.getDepth(tree.root) == 3); assertTrue(tree.root.getElement().equals(2)); tree.remove(2); assertTrue(tree.getDepth(tree.root) == 2); assertTrue(tree.root.getElement().equals(3)); } /* Métodos públicos * public boolean checkOrderingOfTree(AVLTree2.AvlNode<Integer> current) * -- public int getDepth(AVLTree2.AvlNode<Integer> n) * public boolean checkBalanceOfTree(AVLTree2.AvlNode<Integer> current) * public boolean contains(T x) * public void remove( T x ) * isEmpty * makeEmpty * max/min * height */ }
ISO-8859-1
Java
2,668
java
IntegerAVLTree2Test.java
Java
[]
null
[]
package test; import static org.junit.Assert.assertTrue; import org.junit.Test; import avmc.AVLTree2; public class IntegerAVLTree2Test { AVLTree2<Integer> createAVLTree() { return new AVLTree2<Integer>(); } // @Test // public void simpleInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // assertTrue(tree.getRoot().getDepth() == 1); // assertTrue(tree.getRoot().getData().equals(3)); // } // @Test // public void orderedInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(1); // tree.insert(2); // tree.insert(3); // AVLTree2<Integer>.Node<Integer> root = tree.getRoot(); // assertTrue(root.getData().equals(2)); // assertTrue(root.getLeft().getData().equals(1)); // assertTrue(root.getRight().getData().equals(3)); // } // @Test // public void disorderedInsertTest() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // tree.insert(1); // tree.insert(2); // AVLTree2<Integer>.Node<Integer> root = tree.getRoot(); // assertTrue(root.getData().equals(2)); // assertTrue(root.getLeft().getData().equals(1)); // assertTrue(root.getRight().getData().equals(3)); // } // // @Test // public void searchFor2Test() { // AVLTree2<Integer> tree = createAVLTree(); // tree.insert(3); // tree.insert(1); // tree.insert(2); // assertTrue(tree.search(2)); // assertTrue(tree.search(1)); // assertTrue(tree.search(3)); // } @Test public void findMinTest() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(4); tree.insert(5); tree.insert(6); assertTrue(tree.findMin().equals(4)); tree.insert(1); tree.insert(2); tree.insert(3); assertTrue(tree.findMin().equals(1)); } @Test public void findMaxTest() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(3); tree.insert(2); tree.insert(1); assertTrue(tree.findMax().equals(3)); tree.insert(6); tree.insert(5); tree.insert(4); assertTrue(tree.findMax().equals(6)); } @Test public void test() { AVLTree2<Integer> tree = createAVLTree(); tree.insert(2); tree.insert(4); tree.insert(1); tree.insert(3); assertTrue(tree.getDepth(tree.root) == 3); assertTrue(tree.root.getElement().equals(2)); tree.remove(2); assertTrue(tree.getDepth(tree.root) == 2); assertTrue(tree.root.getElement().equals(3)); } /* Métodos públicos * public boolean checkOrderingOfTree(AVLTree2.AvlNode<Integer> current) * -- public int getDepth(AVLTree2.AvlNode<Integer> n) * public boolean checkBalanceOfTree(AVLTree2.AvlNode<Integer> current) * public boolean contains(T x) * public void remove( T x ) * isEmpty * makeEmpty * max/min * height */ }
2,668
0.665416
0.641785
109
23.458715
18.006386
73
false
false
0
0
0
0
0
0
1.954128
false
false
9
72a5d6685065aed5214b9d9629ac048556e4aa9b
24,558,623,052,505
98f8bb935fb48f5eab88e4bf3e915da52cf56a93
/app/src/main/java/com/unimelb/marinig/bletracker/Interfaces/RadBeaconDotV11Locker.java
982c96f02465e350763543947b34628ad1c5083a
[]
no_license
Gabryxx7/RadBeacon-Configurator-Android
https://github.com/Gabryxx7/RadBeacon-Configurator-Android
147840b8f931101e2577540fe5a19789f11875e7
dea30e9d0493d6faacc9306f0f81eafd54f8038d
refs/heads/master
2022-11-29T12:40:00.858000
2020-08-05T13:42:53
2020-08-05T13:42:53
285,291,740
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.unimelb.marinig.bletracker.Interfaces; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattService; import com.unimelb.marinig.bletracker.Callbacks.RadBeaconLockGattCallback; import com.unimelb.marinig.bletracker.Model.ScannedDeviceRecord; public class RadBeaconDotV11Locker extends RadBeaconDotV11ActionWithPIN implements BeaconLocker { public RadBeaconDotV11Locker(BluetoothGatt bluetoothGatt, BluetoothGattService bluetoothGattService, RadBeaconLockGattCallback pBeaconLockGattCallback, String param1String) { super(bluetoothGatt, bluetoothGattService, pBeaconLockGattCallback, param1String, (byte)5); } public void lockBeacon(ScannedDeviceRecord pBeacon) { this.beacon = pBeacon; writeNextCharacteristicInQueue(); } }
UTF-8
Java
803
java
RadBeaconDotV11Locker.java
Java
[]
null
[]
package com.unimelb.marinig.bletracker.Interfaces; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattService; import com.unimelb.marinig.bletracker.Callbacks.RadBeaconLockGattCallback; import com.unimelb.marinig.bletracker.Model.ScannedDeviceRecord; public class RadBeaconDotV11Locker extends RadBeaconDotV11ActionWithPIN implements BeaconLocker { public RadBeaconDotV11Locker(BluetoothGatt bluetoothGatt, BluetoothGattService bluetoothGattService, RadBeaconLockGattCallback pBeaconLockGattCallback, String param1String) { super(bluetoothGatt, bluetoothGattService, pBeaconLockGattCallback, param1String, (byte)5); } public void lockBeacon(ScannedDeviceRecord pBeacon) { this.beacon = pBeacon; writeNextCharacteristicInQueue(); } }
803
0.826899
0.815691
18
43.666668
46.044662
178
false
false
0
0
0
0
0
0
0.833333
false
false
9
b8e8e13bf13fd1a1bba78952f990aa2cef282ca9
23,381,801,962,558
b6a6f445834984c2686073ee2b18465866253062
/Core/src/main/java/com/esenkubanychbekov/core/exceptions/CurrencyException.java
4d23e6142117e4ce14f2bd205898f67d266b574b
[]
no_license
esenkubanychbekov/financekg
https://github.com/esenkubanychbekov/financekg
b880ebe3349a7d9089e437d7aaa0a3c7aefffc89
e8a46b29b136383c4a3026c39d4368ce3e3c244b
refs/heads/master
2022-07-20T17:03:00.644000
2020-05-19T10:15:18
2020-05-19T10:15:18
263,698,943
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.esenkubanychbekov.core.exceptions; public class CurrencyNotExistException extends Exception { public CurrencyNotExistException() { } public CurrencyNotExistException(String massage) { super(massage); } public CurrencyNotExistException(String massage, Throwable cause) { super(massage, cause); } public CurrencyNotExistException(Throwable cause) { super(cause); } public CurrencyNotExistException(String massage, Throwable cause, boolean enableSupperssion, boolean writableStackTrace) { super(massage, cause, enableSupperssion, writableStackTrace); } }
UTF-8
Java
642
java
CurrencyException.java
Java
[]
null
[]
package com.esenkubanychbekov.core.exceptions; public class CurrencyNotExistException extends Exception { public CurrencyNotExistException() { } public CurrencyNotExistException(String massage) { super(massage); } public CurrencyNotExistException(String massage, Throwable cause) { super(massage, cause); } public CurrencyNotExistException(Throwable cause) { super(cause); } public CurrencyNotExistException(String massage, Throwable cause, boolean enableSupperssion, boolean writableStackTrace) { super(massage, cause, enableSupperssion, writableStackTrace); } }
642
0.73053
0.73053
23
26.913044
32.327015
126
false
false
0
0
0
0
0
0
0.565217
false
false
9
016299ca5b0528f0fec88fc9b9ecd54757542e1e
26,517,128,132,913
21a4a0ddd9d45c776f84a874eaa3426af944ab17
/src/test/java/de/csbdresden/denoiseg/command/TestPredictCommand.java
276ef1509d2e01ed3181cdecf75653f0ffa2f4cd
[ "BSD-2-Clause" ]
permissive
juglab/DenoiSeg_fiji
https://github.com/juglab/DenoiSeg_fiji
d5164a64fded1bab5148a6f4c6e01ae37c15fea3
4b5c9920a5b8eaa9dbe7d74e4ad32fa9883a26f4
refs/heads/master
2023-07-17T13:10:21.837000
2021-09-09T19:32:08
2021-09-09T19:32:08
271,231,337
2
1
BSD-2-Clause
false
2021-04-15T14:47:27
2020-06-10T09:11:26
2020-12-03T14:32:47
2021-04-15T14:47:26
60,580
1
1
1
Java
false
false
/*- * #%L * DenoiSeg plugin * %% * Copyright (C) 2019 - 2020 Center for Systems Biology Dresden * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * #L% */ package de.csbdresden.denoiseg.command; import net.imagej.ImageJ; import net.imagej.modelzoo.consumer.command.DefaultSingleImagePredictionCommand; import net.imglib2.RandomAccessibleInterval; import org.junit.Test; import org.scijava.command.CommandModule; import java.io.File; import java.io.IOException; import java.util.concurrent.ExecutionException; import static org.junit.Assert.assertNotNull; public class TestPredictCommand { @Test public void predictViaCommand() throws ExecutionException, InterruptedException, IOException { final ImageJ ij = new ImageJ(); String modelPath = getClass().getResource("/denoiseg-dummy.bioimage.io.zip").getPath(); RandomAccessibleInterval _input = ij.op().create().img(new int[]{20, 20}); CommandModule plugin = ij.command().run( DefaultSingleImagePredictionCommand.class, false ,"input", _input, "modelFile", new File(modelPath) ).get(); assertNotNull( plugin.getOutput("output") ); assertNotNull( plugin.getOutput("output1") ); ij.dispose(); } }
UTF-8
Java
2,508
java
TestPredictCommand.java
Java
[]
null
[]
/*- * #%L * DenoiSeg plugin * %% * Copyright (C) 2019 - 2020 Center for Systems Biology Dresden * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * #L% */ package de.csbdresden.denoiseg.command; import net.imagej.ImageJ; import net.imagej.modelzoo.consumer.command.DefaultSingleImagePredictionCommand; import net.imglib2.RandomAccessibleInterval; import org.junit.Test; import org.scijava.command.CommandModule; import java.io.File; import java.io.IOException; import java.util.concurrent.ExecutionException; import static org.junit.Assert.assertNotNull; public class TestPredictCommand { @Test public void predictViaCommand() throws ExecutionException, InterruptedException, IOException { final ImageJ ij = new ImageJ(); String modelPath = getClass().getResource("/denoiseg-dummy.bioimage.io.zip").getPath(); RandomAccessibleInterval _input = ij.op().create().img(new int[]{20, 20}); CommandModule plugin = ij.command().run( DefaultSingleImagePredictionCommand.class, false ,"input", _input, "modelFile", new File(modelPath) ).get(); assertNotNull( plugin.getOutput("output") ); assertNotNull( plugin.getOutput("output1") ); ij.dispose(); } }
2,508
0.744418
0.738038
63
37.809525
32.473606
95
false
false
0
0
0
0
0
0
1.111111
false
false
9
dbc4bbaaad5cf4d19fcb50d805430f3ef12551b4
14,319,421,020,710
ab4a3e64cb06328e05cd58ca81d13e81c3eaa333
/src/modelo/Fusion.java
dd24dba97fd74779cd83d967cd4c2f394d71b333
[]
no_license
espenia/tp2-yugioh
https://github.com/espenia/tp2-yugioh
36b54942e7ca35676d91d789e4ee7d40e3385009
2757af6603a208d0ca44ae667e26e1c2869aa6ec
refs/heads/master
2021-09-18T10:23:17.510000
2018-07-12T22:00:07
2018-07-12T22:00:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package modelo; import java.util.Map; public class Fusion { public Fusion() { } public void fusionDeTresMonstruos(CartaMonstruo primerSacrificio, CartaMonstruo segundoSacrificio, CartaMonstruo tercerSacrificio, Map<String,CartaMonstruo> mazoDeFusiones, Lado lado){ CartaDeFusion cartaDeFusion = new CartaDeFusion(mazoDeFusiones); lado.removerCartaMonstruo(primerSacrificio); lado.removerCartaMonstruo(segundoSacrificio); lado.removerCartaMonstruo(tercerSacrificio); cartaDeFusion.agregarSacrificio(primerSacrificio); cartaDeFusion.agregarSacrificio(segundoSacrificio); cartaDeFusion.agregarSacrificio(tercerSacrificio); CartaMonstruo monstruo = cartaDeFusion.realizarFusion(); lado.jugarCartaMonstruo(monstruo); } }
UTF-8
Java
779
java
Fusion.java
Java
[]
null
[]
package modelo; import java.util.Map; public class Fusion { public Fusion() { } public void fusionDeTresMonstruos(CartaMonstruo primerSacrificio, CartaMonstruo segundoSacrificio, CartaMonstruo tercerSacrificio, Map<String,CartaMonstruo> mazoDeFusiones, Lado lado){ CartaDeFusion cartaDeFusion = new CartaDeFusion(mazoDeFusiones); lado.removerCartaMonstruo(primerSacrificio); lado.removerCartaMonstruo(segundoSacrificio); lado.removerCartaMonstruo(tercerSacrificio); cartaDeFusion.agregarSacrificio(primerSacrificio); cartaDeFusion.agregarSacrificio(segundoSacrificio); cartaDeFusion.agregarSacrificio(tercerSacrificio); CartaMonstruo monstruo = cartaDeFusion.realizarFusion(); lado.jugarCartaMonstruo(monstruo); } }
779
0.790757
0.790757
24
30.458334
39.38483
185
false
false
0
0
0
0
0
0
1.5
false
false
9
accc864464357d7100a3044ff466c10f2856b2ee
19,765,439,503,998
cfc8cdeb2e4349df40a28842d486de73362dd6ac
/src/sudoku_Final/HyperSudoku.java
8bf09ff528c2fde9236e9a84a08e8a84e70302a1
[]
no_license
theomeli/Sudoku
https://github.com/theomeli/Sudoku
2ad6626b20b42791f1d2fbb957a2aa144fbc8fc7
fca9fec905dcd9c70a08c33aa859170a20c96569
refs/heads/master
2020-05-26T06:38:48.577000
2017-02-19T15:15:23
2017-02-19T15:52:02
82,467,523
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sudoku_Final; import java.awt.Frame; import javax.swing.JFrame; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Totoros */ public class HyperSudoku extends javax.swing.JDialog implements GameBoard{ /** * Creates new form Sudoku */ public HyperSudoku(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } HyperSudoku(JFrame jFrame, boolean b) { super(jFrame, b); throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void newGame(){ this.setVisible(true); } /** * 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() { board = new javax.swing.JPanel(); block11 = new javax.swing.JPanel(); cell11 = new javax.swing.JLabel(); cell12 = new javax.swing.JLabel(); cell13 = new javax.swing.JLabel(); cell21 = new javax.swing.JLabel(); cell22 = new javax.swing.JLabel(); cell23 = new javax.swing.JLabel(); cell31 = new javax.swing.JLabel(); cell32 = new javax.swing.JLabel(); cell33 = new javax.swing.JLabel(); block12 = new javax.swing.JPanel(); cell14 = new javax.swing.JLabel(); cell15 = new javax.swing.JLabel(); cell16 = new javax.swing.JLabel(); cell24 = new javax.swing.JLabel(); cell25 = new javax.swing.JLabel(); cell26 = new javax.swing.JLabel(); cell34 = new javax.swing.JLabel(); cell35 = new javax.swing.JLabel(); cell36 = new javax.swing.JLabel(); block13 = new javax.swing.JPanel(); cell17 = new javax.swing.JLabel(); cell18 = new javax.swing.JLabel(); cell19 = new javax.swing.JLabel(); cell27 = new javax.swing.JLabel(); cell28 = new javax.swing.JLabel(); cell29 = new javax.swing.JLabel(); cell37 = new javax.swing.JLabel(); cell38 = new javax.swing.JLabel(); cell39 = new javax.swing.JLabel(); block21 = new javax.swing.JPanel(); cell41 = new javax.swing.JLabel(); cell42 = new javax.swing.JLabel(); cell43 = new javax.swing.JLabel(); cell51 = new javax.swing.JLabel(); cell52 = new javax.swing.JLabel(); cell53 = new javax.swing.JLabel(); cell61 = new javax.swing.JLabel(); cell62 = new javax.swing.JLabel(); cell63 = new javax.swing.JLabel(); block22 = new javax.swing.JPanel(); cell44 = new javax.swing.JLabel(); cell45 = new javax.swing.JLabel(); cell46 = new javax.swing.JLabel(); cell54 = new javax.swing.JLabel(); cell55 = new javax.swing.JLabel(); cell56 = new javax.swing.JLabel(); cell64 = new javax.swing.JLabel(); cell65 = new javax.swing.JLabel(); cell66 = new javax.swing.JLabel(); block23 = new javax.swing.JPanel(); cell47 = new javax.swing.JLabel(); cell48 = new javax.swing.JLabel(); cell49 = new javax.swing.JLabel(); cell57 = new javax.swing.JLabel(); cell58 = new javax.swing.JLabel(); cell59 = new javax.swing.JLabel(); cell67 = new javax.swing.JLabel(); cell68 = new javax.swing.JLabel(); cell69 = new javax.swing.JLabel(); block31 = new javax.swing.JPanel(); cell71 = new javax.swing.JLabel(); cell72 = new javax.swing.JLabel(); cell73 = new javax.swing.JLabel(); cell81 = new javax.swing.JLabel(); cell82 = new javax.swing.JLabel(); cell83 = new javax.swing.JLabel(); cell91 = new javax.swing.JLabel(); cell92 = new javax.swing.JLabel(); cell93 = new javax.swing.JLabel(); block32 = new javax.swing.JPanel(); cell74 = new javax.swing.JLabel(); cell75 = new javax.swing.JLabel(); cell76 = new javax.swing.JLabel(); cell84 = new javax.swing.JLabel(); cell85 = new javax.swing.JLabel(); cell86 = new javax.swing.JLabel(); cell94 = new javax.swing.JLabel(); cell95 = new javax.swing.JLabel(); cell96 = new javax.swing.JLabel(); block33 = new javax.swing.JPanel(); cell77 = new javax.swing.JLabel(); cell78 = new javax.swing.JLabel(); cell79 = new javax.swing.JLabel(); cell87 = new javax.swing.JLabel(); cell88 = new javax.swing.JLabel(); cell89 = new javax.swing.JLabel(); cell97 = new javax.swing.JLabel(); cell98 = new javax.swing.JLabel(); cell99 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); help = new javax.swing.JButton(); statistics = new javax.swing.JButton(); exit = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("hyperSudoku"); setBackground(new java.awt.Color(0, 0, 0)); setMinimumSize(new java.awt.Dimension(795, 470)); board.setBorder(new javax.swing.border.MatteBorder(null)); board.setLayout(new java.awt.GridLayout(3, 3, 2, 2)); block11.setBorder(new javax.swing.border.MatteBorder(null)); block11.setMinimumSize(new java.awt.Dimension(152, 152)); block11.setPreferredSize(new java.awt.Dimension(152, 152)); block11.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell11.setBackground(new java.awt.Color(255, 255, 255)); cell11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell11.setOpaque(true); block11.add(cell11); cell12.setBackground(new java.awt.Color(255, 255, 255)); cell12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell12.setOpaque(true); block11.add(cell12); cell13.setBackground(new java.awt.Color(255, 255, 255)); cell13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell13.setOpaque(true); block11.add(cell13); cell21.setBackground(new java.awt.Color(255, 255, 255)); cell21.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell21.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell21.setOpaque(true); block11.add(cell21); cell22.setBackground(new java.awt.Color(51, 255, 255)); cell22.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell22.setForeground(new java.awt.Color(51, 255, 255)); cell22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell22.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell22.setOpaque(true); block11.add(cell22); cell23.setBackground(new java.awt.Color(51, 255, 255)); cell23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell23.setForeground(new java.awt.Color(51, 255, 255)); cell23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell23.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell23.setOpaque(true); block11.add(cell23); cell31.setBackground(new java.awt.Color(255, 255, 255)); cell31.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell31.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell31.setOpaque(true); block11.add(cell31); cell32.setBackground(new java.awt.Color(51, 255, 255)); cell32.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell32.setForeground(new java.awt.Color(51, 255, 255)); cell32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell32.setBorder(new javax.swing.border.MatteBorder(null)); cell32.setOpaque(true); block11.add(cell32); cell33.setBackground(new java.awt.Color(51, 255, 255)); cell33.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell33.setForeground(new java.awt.Color(51, 255, 255)); cell33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell33.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell33.setOpaque(true); block11.add(cell33); board.add(block11); block12.setBorder(new javax.swing.border.MatteBorder(null)); block12.setMinimumSize(new java.awt.Dimension(10, 152)); block12.setPreferredSize(new java.awt.Dimension(152, 152)); block12.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell14.setBackground(new java.awt.Color(255, 255, 255)); cell14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell14.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell14.setOpaque(true); block12.add(cell14); cell15.setBackground(new java.awt.Color(255, 255, 255)); cell15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell15.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell15.setOpaque(true); block12.add(cell15); cell16.setBackground(new java.awt.Color(255, 255, 255)); cell16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell16.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell16.setOpaque(true); block12.add(cell16); cell24.setBackground(new java.awt.Color(51, 255, 255)); cell24.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell24.setForeground(new java.awt.Color(51, 255, 255)); cell24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell24.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell24.setOpaque(true); block12.add(cell24); cell25.setBackground(new java.awt.Color(255, 255, 255)); cell25.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell25.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell25.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell25.setOpaque(true); block12.add(cell25); cell26.setBackground(new java.awt.Color(51, 255, 255)); cell26.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell26.setForeground(new java.awt.Color(51, 255, 255)); cell26.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell26.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell26.setOpaque(true); block12.add(cell26); cell34.setBackground(new java.awt.Color(51, 255, 255)); cell34.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell34.setForeground(new java.awt.Color(51, 255, 255)); cell34.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell34.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell34.setOpaque(true); block12.add(cell34); cell35.setBackground(new java.awt.Color(255, 255, 255)); cell35.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell35.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell35.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell35.setOpaque(true); block12.add(cell35); cell36.setBackground(new java.awt.Color(51, 255, 255)); cell36.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell36.setForeground(new java.awt.Color(51, 255, 255)); cell36.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell36.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell36.setOpaque(true); block12.add(cell36); board.add(block12); block13.setBorder(new javax.swing.border.MatteBorder(null)); block13.setMinimumSize(new java.awt.Dimension(152, 152)); block13.setPreferredSize(new java.awt.Dimension(152, 152)); block13.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell17.setBackground(new java.awt.Color(255, 255, 255)); cell17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell17.setOpaque(true); block13.add(cell17); cell18.setBackground(new java.awt.Color(255, 255, 255)); cell18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell18.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell18.setOpaque(true); block13.add(cell18); cell19.setBackground(new java.awt.Color(255, 255, 255)); cell19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell19.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell19.setOpaque(true); block13.add(cell19); cell27.setBackground(new java.awt.Color(51, 255, 255)); cell27.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell27.setForeground(new java.awt.Color(51, 255, 255)); cell27.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell27.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell27.setOpaque(true); block13.add(cell27); cell28.setBackground(new java.awt.Color(51, 255, 255)); cell28.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell28.setForeground(new java.awt.Color(51, 255, 255)); cell28.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell28.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell28.setOpaque(true); block13.add(cell28); cell29.setBackground(new java.awt.Color(255, 255, 255)); cell29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell29.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell29.setOpaque(true); block13.add(cell29); cell37.setBackground(new java.awt.Color(51, 255, 255)); cell37.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell37.setForeground(new java.awt.Color(51, 255, 255)); cell37.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell37.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell37.setOpaque(true); block13.add(cell37); cell38.setBackground(new java.awt.Color(51, 255, 255)); cell38.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell38.setForeground(new java.awt.Color(51, 255, 255)); cell38.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell38.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell38.setOpaque(true); block13.add(cell38); cell39.setBackground(new java.awt.Color(255, 255, 255)); cell39.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell39.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell39.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell39.setOpaque(true); block13.add(cell39); board.add(block13); block21.setBorder(new javax.swing.border.MatteBorder(null)); block21.setMinimumSize(new java.awt.Dimension(152, 152)); block21.setPreferredSize(new java.awt.Dimension(152, 152)); block21.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell41.setBackground(new java.awt.Color(255, 255, 255)); cell41.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell41.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell41.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell41.setOpaque(true); block21.add(cell41); cell42.setBackground(new java.awt.Color(51, 255, 255)); cell42.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell42.setForeground(new java.awt.Color(51, 255, 255)); cell42.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell42.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell42.setOpaque(true); block21.add(cell42); cell43.setBackground(new java.awt.Color(51, 255, 255)); cell43.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell43.setForeground(new java.awt.Color(51, 255, 255)); cell43.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell43.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell43.setOpaque(true); block21.add(cell43); cell51.setBackground(new java.awt.Color(255, 255, 255)); cell51.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell51.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell51.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell51.setOpaque(true); block21.add(cell51); cell52.setBackground(new java.awt.Color(255, 255, 255)); cell52.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell52.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell52.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell52.setOpaque(true); block21.add(cell52); cell53.setBackground(new java.awt.Color(255, 255, 255)); cell53.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell53.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell53.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell53.setOpaque(true); block21.add(cell53); cell61.setBackground(new java.awt.Color(255, 255, 255)); cell61.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell61.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell61.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell61.setOpaque(true); block21.add(cell61); cell62.setBackground(new java.awt.Color(51, 255, 255)); cell62.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell62.setForeground(new java.awt.Color(51, 255, 255)); cell62.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell62.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell62.setOpaque(true); block21.add(cell62); cell63.setBackground(new java.awt.Color(51, 255, 255)); cell63.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell63.setForeground(new java.awt.Color(51, 255, 255)); cell63.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell63.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell63.setOpaque(true); block21.add(cell63); board.add(block21); block22.setBorder(new javax.swing.border.MatteBorder(null)); block22.setMinimumSize(new java.awt.Dimension(152, 152)); block22.setPreferredSize(new java.awt.Dimension(152, 152)); block22.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell44.setBackground(new java.awt.Color(51, 255, 255)); cell44.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell44.setForeground(new java.awt.Color(51, 255, 255)); cell44.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell44.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell44.setOpaque(true); block22.add(cell44); cell45.setBackground(new java.awt.Color(255, 255, 255)); cell45.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell45.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell45.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell45.setOpaque(true); block22.add(cell45); cell46.setBackground(new java.awt.Color(51, 255, 255)); cell46.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell46.setForeground(new java.awt.Color(51, 255, 255)); cell46.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell46.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell46.setOpaque(true); block22.add(cell46); cell54.setBackground(new java.awt.Color(255, 255, 255)); cell54.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell54.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell54.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell54.setOpaque(true); block22.add(cell54); cell55.setBackground(new java.awt.Color(255, 255, 255)); cell55.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell55.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell55.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell55.setOpaque(true); block22.add(cell55); cell56.setBackground(new java.awt.Color(255, 255, 255)); cell56.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell56.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell56.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell56.setOpaque(true); block22.add(cell56); cell64.setBackground(new java.awt.Color(51, 255, 255)); cell64.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell64.setForeground(new java.awt.Color(51, 255, 255)); cell64.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell64.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell64.setOpaque(true); block22.add(cell64); cell65.setBackground(new java.awt.Color(255, 255, 255)); cell65.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell65.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell65.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell65.setOpaque(true); block22.add(cell65); cell66.setBackground(new java.awt.Color(51, 255, 255)); cell66.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell66.setForeground(new java.awt.Color(51, 255, 255)); cell66.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell66.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell66.setOpaque(true); block22.add(cell66); board.add(block22); block23.setBorder(new javax.swing.border.MatteBorder(null)); block23.setMinimumSize(new java.awt.Dimension(152, 152)); block23.setPreferredSize(new java.awt.Dimension(152, 152)); block23.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell47.setBackground(new java.awt.Color(51, 255, 255)); cell47.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell47.setForeground(new java.awt.Color(51, 255, 255)); cell47.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell47.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell47.setOpaque(true); block23.add(cell47); cell48.setBackground(new java.awt.Color(51, 255, 255)); cell48.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell48.setForeground(new java.awt.Color(51, 255, 255)); cell48.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell48.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell48.setOpaque(true); block23.add(cell48); cell49.setBackground(new java.awt.Color(255, 255, 255)); cell49.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell49.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell49.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell49.setOpaque(true); block23.add(cell49); cell57.setBackground(new java.awt.Color(255, 255, 255)); cell57.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell57.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell57.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell57.setOpaque(true); block23.add(cell57); cell58.setBackground(new java.awt.Color(255, 255, 255)); cell58.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell58.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell58.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell58.setOpaque(true); block23.add(cell58); cell59.setBackground(new java.awt.Color(255, 255, 255)); cell59.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell59.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell59.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell59.setOpaque(true); block23.add(cell59); cell67.setBackground(new java.awt.Color(51, 255, 255)); cell67.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell67.setForeground(new java.awt.Color(51, 255, 255)); cell67.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell67.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell67.setOpaque(true); block23.add(cell67); cell68.setBackground(new java.awt.Color(51, 255, 255)); cell68.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell68.setForeground(new java.awt.Color(51, 255, 255)); cell68.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell68.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell68.setOpaque(true); block23.add(cell68); cell69.setBackground(new java.awt.Color(255, 255, 255)); cell69.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell69.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell69.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell69.setOpaque(true); block23.add(cell69); board.add(block23); block31.setBorder(new javax.swing.border.MatteBorder(null)); block31.setMinimumSize(new java.awt.Dimension(152, 152)); block31.setPreferredSize(new java.awt.Dimension(152, 152)); block31.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell71.setBackground(new java.awt.Color(255, 255, 255)); cell71.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell71.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell71.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell71.setOpaque(true); block31.add(cell71); cell72.setBackground(new java.awt.Color(51, 255, 255)); cell72.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell72.setForeground(new java.awt.Color(51, 255, 255)); cell72.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell72.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell72.setOpaque(true); block31.add(cell72); cell73.setBackground(new java.awt.Color(51, 255, 255)); cell73.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell73.setForeground(new java.awt.Color(51, 255, 255)); cell73.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell73.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell73.setOpaque(true); block31.add(cell73); cell81.setBackground(new java.awt.Color(255, 255, 255)); cell81.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell81.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell81.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell81.setOpaque(true); block31.add(cell81); cell82.setBackground(new java.awt.Color(51, 255, 255)); cell82.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell82.setForeground(new java.awt.Color(51, 255, 255)); cell82.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell82.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell82.setOpaque(true); block31.add(cell82); cell83.setBackground(new java.awt.Color(51, 255, 255)); cell83.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell83.setForeground(new java.awt.Color(51, 255, 255)); cell83.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell83.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell83.setOpaque(true); block31.add(cell83); cell91.setBackground(new java.awt.Color(255, 255, 255)); cell91.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell91.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell91.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell91.setOpaque(true); block31.add(cell91); cell92.setBackground(new java.awt.Color(255, 255, 255)); cell92.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell92.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell92.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell92.setOpaque(true); block31.add(cell92); cell93.setBackground(new java.awt.Color(255, 255, 255)); cell93.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell93.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell93.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell93.setOpaque(true); block31.add(cell93); board.add(block31); block32.setBorder(new javax.swing.border.MatteBorder(null)); block32.setMinimumSize(new java.awt.Dimension(152, 152)); block32.setPreferredSize(new java.awt.Dimension(152, 152)); block32.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell74.setBackground(new java.awt.Color(51, 255, 255)); cell74.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell74.setForeground(new java.awt.Color(51, 255, 255)); cell74.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell74.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell74.setOpaque(true); block32.add(cell74); cell75.setBackground(new java.awt.Color(255, 255, 255)); cell75.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell75.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell75.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell75.setOpaque(true); block32.add(cell75); cell76.setBackground(new java.awt.Color(51, 255, 255)); cell76.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell76.setForeground(new java.awt.Color(51, 255, 255)); cell76.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell76.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell76.setOpaque(true); block32.add(cell76); cell84.setBackground(new java.awt.Color(51, 255, 255)); cell84.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell84.setForeground(new java.awt.Color(51, 255, 255)); cell84.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell84.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell84.setOpaque(true); block32.add(cell84); cell85.setBackground(new java.awt.Color(255, 255, 255)); cell85.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell85.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell85.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell85.setOpaque(true); block32.add(cell85); cell86.setBackground(new java.awt.Color(51, 255, 255)); cell86.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell86.setForeground(new java.awt.Color(51, 255, 255)); cell86.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell86.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell86.setOpaque(true); block32.add(cell86); cell94.setBackground(new java.awt.Color(255, 255, 255)); cell94.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell94.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell94.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell94.setOpaque(true); block32.add(cell94); cell95.setBackground(new java.awt.Color(255, 255, 255)); cell95.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell95.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell95.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell95.setOpaque(true); block32.add(cell95); cell96.setBackground(new java.awt.Color(255, 255, 255)); cell96.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell96.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell96.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell96.setOpaque(true); block32.add(cell96); board.add(block32); block33.setBorder(new javax.swing.border.MatteBorder(null)); block33.setMinimumSize(new java.awt.Dimension(152, 152)); block33.setPreferredSize(new java.awt.Dimension(152, 152)); block33.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell77.setBackground(new java.awt.Color(51, 255, 255)); cell77.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell77.setForeground(new java.awt.Color(51, 255, 255)); cell77.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell77.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell77.setOpaque(true); block33.add(cell77); cell78.setBackground(new java.awt.Color(51, 255, 255)); cell78.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell78.setForeground(new java.awt.Color(51, 255, 255)); cell78.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell78.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell78.setOpaque(true); block33.add(cell78); cell79.setBackground(new java.awt.Color(255, 255, 255)); cell79.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell79.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell79.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell79.setOpaque(true); block33.add(cell79); cell87.setBackground(new java.awt.Color(51, 255, 255)); cell87.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell87.setForeground(new java.awt.Color(51, 255, 255)); cell87.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell87.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell87.setOpaque(true); block33.add(cell87); cell88.setBackground(new java.awt.Color(51, 255, 255)); cell88.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell88.setForeground(new java.awt.Color(51, 255, 255)); cell88.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell88.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell88.setOpaque(true); block33.add(cell88); cell89.setBackground(new java.awt.Color(255, 255, 255)); cell89.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell89.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell89.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell89.setOpaque(true); block33.add(cell89); cell97.setBackground(new java.awt.Color(255, 255, 255)); cell97.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell97.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell97.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell97.setOpaque(true); block33.add(cell97); cell98.setBackground(new java.awt.Color(255, 255, 255)); cell98.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell98.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell98.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell98.setOpaque(true); block33.add(cell98); cell99.setBackground(new java.awt.Color(255, 255, 255)); cell99.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell99.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell99.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell99.setOpaque(true); block33.add(cell99); board.add(block33); jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton1.setText("1"); jButton1.setPreferredSize(new java.awt.Dimension(40, 40)); jButton1.setRequestFocusEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton2.setText("2"); jButton2.setPreferredSize(new java.awt.Dimension(40, 40)); jButton2.setRequestFocusEnabled(false); jButton3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton3.setText("3"); jButton3.setPreferredSize(new java.awt.Dimension(40, 40)); jButton3.setRequestFocusEnabled(false); jButton4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton4.setText("4"); jButton4.setPreferredSize(new java.awt.Dimension(40, 40)); jButton4.setRequestFocusEnabled(false); jButton5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton5.setText("5"); jButton5.setPreferredSize(new java.awt.Dimension(40, 40)); jButton5.setRequestFocusEnabled(false); jButton6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton6.setText("6"); jButton6.setPreferredSize(new java.awt.Dimension(40, 40)); jButton6.setRequestFocusEnabled(false); jButton7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton7.setText("7"); jButton7.setPreferredSize(new java.awt.Dimension(40, 40)); jButton7.setRequestFocusEnabled(false); jButton8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton8.setText("8"); jButton8.setPreferredSize(new java.awt.Dimension(40, 40)); jButton8.setRequestFocusEnabled(false); jButton9.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton9.setText("9"); jButton9.setPreferredSize(new java.awt.Dimension(40, 40)); jButton9.setRequestFocusEnabled(false); help.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N help.setText("Help"); help.setPreferredSize(new java.awt.Dimension(40, 40)); help.setRequestFocusEnabled(false); statistics.setText("Statistics"); statistics.setPreferredSize(new java.awt.Dimension(40, 40)); exit.setText("Exit"); exit.setPreferredSize(new java.awt.Dimension(40, 40)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(board, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(12, 12, 12) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(help, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(94, 94, 94) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(statistics, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE) .addComponent(exit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap(52, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(board, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(60, 60, 60) .addComponent(statistics, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(exit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(help, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(86, 86, 86)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Sudoku dialog = new Sudoku(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel block11; private javax.swing.JPanel block12; private javax.swing.JPanel block13; private javax.swing.JPanel block21; private javax.swing.JPanel block22; private javax.swing.JPanel block23; private javax.swing.JPanel block31; private javax.swing.JPanel block32; private javax.swing.JPanel block33; private javax.swing.JPanel board; private javax.swing.JLabel cell11; private javax.swing.JLabel cell12; private javax.swing.JLabel cell13; private javax.swing.JLabel cell14; private javax.swing.JLabel cell15; private javax.swing.JLabel cell16; private javax.swing.JLabel cell17; private javax.swing.JLabel cell18; private javax.swing.JLabel cell19; private javax.swing.JLabel cell21; private javax.swing.JLabel cell22; private javax.swing.JLabel cell23; private javax.swing.JLabel cell24; private javax.swing.JLabel cell25; private javax.swing.JLabel cell26; private javax.swing.JLabel cell27; private javax.swing.JLabel cell28; private javax.swing.JLabel cell29; private javax.swing.JLabel cell31; private javax.swing.JLabel cell32; private javax.swing.JLabel cell33; private javax.swing.JLabel cell34; private javax.swing.JLabel cell35; private javax.swing.JLabel cell36; private javax.swing.JLabel cell37; private javax.swing.JLabel cell38; private javax.swing.JLabel cell39; private javax.swing.JLabel cell41; private javax.swing.JLabel cell42; private javax.swing.JLabel cell43; private javax.swing.JLabel cell44; private javax.swing.JLabel cell45; private javax.swing.JLabel cell46; private javax.swing.JLabel cell47; private javax.swing.JLabel cell48; private javax.swing.JLabel cell49; private javax.swing.JLabel cell51; private javax.swing.JLabel cell52; private javax.swing.JLabel cell53; private javax.swing.JLabel cell54; private javax.swing.JLabel cell55; private javax.swing.JLabel cell56; private javax.swing.JLabel cell57; private javax.swing.JLabel cell58; private javax.swing.JLabel cell59; private javax.swing.JLabel cell61; private javax.swing.JLabel cell62; private javax.swing.JLabel cell63; private javax.swing.JLabel cell64; private javax.swing.JLabel cell65; private javax.swing.JLabel cell66; private javax.swing.JLabel cell67; private javax.swing.JLabel cell68; private javax.swing.JLabel cell69; private javax.swing.JLabel cell71; private javax.swing.JLabel cell72; private javax.swing.JLabel cell73; private javax.swing.JLabel cell74; private javax.swing.JLabel cell75; private javax.swing.JLabel cell76; private javax.swing.JLabel cell77; private javax.swing.JLabel cell78; private javax.swing.JLabel cell79; private javax.swing.JLabel cell81; private javax.swing.JLabel cell82; private javax.swing.JLabel cell83; private javax.swing.JLabel cell84; private javax.swing.JLabel cell85; private javax.swing.JLabel cell86; private javax.swing.JLabel cell87; private javax.swing.JLabel cell88; private javax.swing.JLabel cell89; private javax.swing.JLabel cell91; private javax.swing.JLabel cell92; private javax.swing.JLabel cell93; private javax.swing.JLabel cell94; private javax.swing.JLabel cell95; private javax.swing.JLabel cell96; private javax.swing.JLabel cell97; private javax.swing.JLabel cell98; private javax.swing.JLabel cell99; private javax.swing.JButton exit; private javax.swing.JButton help; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JButton statistics; // End of variables declaration//GEN-END:variables }
UTF-8
Java
56,769
java
HyperSudoku.java
Java
[ { "context": "e template in the editor.\n */\n\n\n\n/**\n *\n * @author Totoros\n */\npublic class HyperSudoku extends javax.", "end": 281, "score": 0.741809606552124, "start": 280, "tag": "USERNAME", "value": "T" }, { "context": "template in the editor.\n */\n\n\n\n/**\n *\n * @auth...
null
[]
package sudoku_Final; import java.awt.Frame; import javax.swing.JFrame; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Totoros */ public class HyperSudoku extends javax.swing.JDialog implements GameBoard{ /** * Creates new form Sudoku */ public HyperSudoku(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } HyperSudoku(JFrame jFrame, boolean b) { super(jFrame, b); throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void newGame(){ this.setVisible(true); } /** * 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() { board = new javax.swing.JPanel(); block11 = new javax.swing.JPanel(); cell11 = new javax.swing.JLabel(); cell12 = new javax.swing.JLabel(); cell13 = new javax.swing.JLabel(); cell21 = new javax.swing.JLabel(); cell22 = new javax.swing.JLabel(); cell23 = new javax.swing.JLabel(); cell31 = new javax.swing.JLabel(); cell32 = new javax.swing.JLabel(); cell33 = new javax.swing.JLabel(); block12 = new javax.swing.JPanel(); cell14 = new javax.swing.JLabel(); cell15 = new javax.swing.JLabel(); cell16 = new javax.swing.JLabel(); cell24 = new javax.swing.JLabel(); cell25 = new javax.swing.JLabel(); cell26 = new javax.swing.JLabel(); cell34 = new javax.swing.JLabel(); cell35 = new javax.swing.JLabel(); cell36 = new javax.swing.JLabel(); block13 = new javax.swing.JPanel(); cell17 = new javax.swing.JLabel(); cell18 = new javax.swing.JLabel(); cell19 = new javax.swing.JLabel(); cell27 = new javax.swing.JLabel(); cell28 = new javax.swing.JLabel(); cell29 = new javax.swing.JLabel(); cell37 = new javax.swing.JLabel(); cell38 = new javax.swing.JLabel(); cell39 = new javax.swing.JLabel(); block21 = new javax.swing.JPanel(); cell41 = new javax.swing.JLabel(); cell42 = new javax.swing.JLabel(); cell43 = new javax.swing.JLabel(); cell51 = new javax.swing.JLabel(); cell52 = new javax.swing.JLabel(); cell53 = new javax.swing.JLabel(); cell61 = new javax.swing.JLabel(); cell62 = new javax.swing.JLabel(); cell63 = new javax.swing.JLabel(); block22 = new javax.swing.JPanel(); cell44 = new javax.swing.JLabel(); cell45 = new javax.swing.JLabel(); cell46 = new javax.swing.JLabel(); cell54 = new javax.swing.JLabel(); cell55 = new javax.swing.JLabel(); cell56 = new javax.swing.JLabel(); cell64 = new javax.swing.JLabel(); cell65 = new javax.swing.JLabel(); cell66 = new javax.swing.JLabel(); block23 = new javax.swing.JPanel(); cell47 = new javax.swing.JLabel(); cell48 = new javax.swing.JLabel(); cell49 = new javax.swing.JLabel(); cell57 = new javax.swing.JLabel(); cell58 = new javax.swing.JLabel(); cell59 = new javax.swing.JLabel(); cell67 = new javax.swing.JLabel(); cell68 = new javax.swing.JLabel(); cell69 = new javax.swing.JLabel(); block31 = new javax.swing.JPanel(); cell71 = new javax.swing.JLabel(); cell72 = new javax.swing.JLabel(); cell73 = new javax.swing.JLabel(); cell81 = new javax.swing.JLabel(); cell82 = new javax.swing.JLabel(); cell83 = new javax.swing.JLabel(); cell91 = new javax.swing.JLabel(); cell92 = new javax.swing.JLabel(); cell93 = new javax.swing.JLabel(); block32 = new javax.swing.JPanel(); cell74 = new javax.swing.JLabel(); cell75 = new javax.swing.JLabel(); cell76 = new javax.swing.JLabel(); cell84 = new javax.swing.JLabel(); cell85 = new javax.swing.JLabel(); cell86 = new javax.swing.JLabel(); cell94 = new javax.swing.JLabel(); cell95 = new javax.swing.JLabel(); cell96 = new javax.swing.JLabel(); block33 = new javax.swing.JPanel(); cell77 = new javax.swing.JLabel(); cell78 = new javax.swing.JLabel(); cell79 = new javax.swing.JLabel(); cell87 = new javax.swing.JLabel(); cell88 = new javax.swing.JLabel(); cell89 = new javax.swing.JLabel(); cell97 = new javax.swing.JLabel(); cell98 = new javax.swing.JLabel(); cell99 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); help = new javax.swing.JButton(); statistics = new javax.swing.JButton(); exit = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("hyperSudoku"); setBackground(new java.awt.Color(0, 0, 0)); setMinimumSize(new java.awt.Dimension(795, 470)); board.setBorder(new javax.swing.border.MatteBorder(null)); board.setLayout(new java.awt.GridLayout(3, 3, 2, 2)); block11.setBorder(new javax.swing.border.MatteBorder(null)); block11.setMinimumSize(new java.awt.Dimension(152, 152)); block11.setPreferredSize(new java.awt.Dimension(152, 152)); block11.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell11.setBackground(new java.awt.Color(255, 255, 255)); cell11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell11.setOpaque(true); block11.add(cell11); cell12.setBackground(new java.awt.Color(255, 255, 255)); cell12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell12.setOpaque(true); block11.add(cell12); cell13.setBackground(new java.awt.Color(255, 255, 255)); cell13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell13.setOpaque(true); block11.add(cell13); cell21.setBackground(new java.awt.Color(255, 255, 255)); cell21.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell21.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell21.setOpaque(true); block11.add(cell21); cell22.setBackground(new java.awt.Color(51, 255, 255)); cell22.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell22.setForeground(new java.awt.Color(51, 255, 255)); cell22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell22.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell22.setOpaque(true); block11.add(cell22); cell23.setBackground(new java.awt.Color(51, 255, 255)); cell23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell23.setForeground(new java.awt.Color(51, 255, 255)); cell23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell23.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell23.setOpaque(true); block11.add(cell23); cell31.setBackground(new java.awt.Color(255, 255, 255)); cell31.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell31.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell31.setOpaque(true); block11.add(cell31); cell32.setBackground(new java.awt.Color(51, 255, 255)); cell32.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell32.setForeground(new java.awt.Color(51, 255, 255)); cell32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell32.setBorder(new javax.swing.border.MatteBorder(null)); cell32.setOpaque(true); block11.add(cell32); cell33.setBackground(new java.awt.Color(51, 255, 255)); cell33.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell33.setForeground(new java.awt.Color(51, 255, 255)); cell33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell33.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell33.setOpaque(true); block11.add(cell33); board.add(block11); block12.setBorder(new javax.swing.border.MatteBorder(null)); block12.setMinimumSize(new java.awt.Dimension(10, 152)); block12.setPreferredSize(new java.awt.Dimension(152, 152)); block12.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell14.setBackground(new java.awt.Color(255, 255, 255)); cell14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell14.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell14.setOpaque(true); block12.add(cell14); cell15.setBackground(new java.awt.Color(255, 255, 255)); cell15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell15.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell15.setOpaque(true); block12.add(cell15); cell16.setBackground(new java.awt.Color(255, 255, 255)); cell16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell16.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell16.setOpaque(true); block12.add(cell16); cell24.setBackground(new java.awt.Color(51, 255, 255)); cell24.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell24.setForeground(new java.awt.Color(51, 255, 255)); cell24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell24.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell24.setOpaque(true); block12.add(cell24); cell25.setBackground(new java.awt.Color(255, 255, 255)); cell25.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell25.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell25.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell25.setOpaque(true); block12.add(cell25); cell26.setBackground(new java.awt.Color(51, 255, 255)); cell26.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell26.setForeground(new java.awt.Color(51, 255, 255)); cell26.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell26.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell26.setOpaque(true); block12.add(cell26); cell34.setBackground(new java.awt.Color(51, 255, 255)); cell34.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell34.setForeground(new java.awt.Color(51, 255, 255)); cell34.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell34.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell34.setOpaque(true); block12.add(cell34); cell35.setBackground(new java.awt.Color(255, 255, 255)); cell35.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell35.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell35.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell35.setOpaque(true); block12.add(cell35); cell36.setBackground(new java.awt.Color(51, 255, 255)); cell36.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell36.setForeground(new java.awt.Color(51, 255, 255)); cell36.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell36.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell36.setOpaque(true); block12.add(cell36); board.add(block12); block13.setBorder(new javax.swing.border.MatteBorder(null)); block13.setMinimumSize(new java.awt.Dimension(152, 152)); block13.setPreferredSize(new java.awt.Dimension(152, 152)); block13.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell17.setBackground(new java.awt.Color(255, 255, 255)); cell17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell17.setOpaque(true); block13.add(cell17); cell18.setBackground(new java.awt.Color(255, 255, 255)); cell18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell18.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell18.setOpaque(true); block13.add(cell18); cell19.setBackground(new java.awt.Color(255, 255, 255)); cell19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell19.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell19.setOpaque(true); block13.add(cell19); cell27.setBackground(new java.awt.Color(51, 255, 255)); cell27.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell27.setForeground(new java.awt.Color(51, 255, 255)); cell27.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell27.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell27.setOpaque(true); block13.add(cell27); cell28.setBackground(new java.awt.Color(51, 255, 255)); cell28.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell28.setForeground(new java.awt.Color(51, 255, 255)); cell28.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell28.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell28.setOpaque(true); block13.add(cell28); cell29.setBackground(new java.awt.Color(255, 255, 255)); cell29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell29.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell29.setOpaque(true); block13.add(cell29); cell37.setBackground(new java.awt.Color(51, 255, 255)); cell37.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell37.setForeground(new java.awt.Color(51, 255, 255)); cell37.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell37.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell37.setOpaque(true); block13.add(cell37); cell38.setBackground(new java.awt.Color(51, 255, 255)); cell38.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell38.setForeground(new java.awt.Color(51, 255, 255)); cell38.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell38.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell38.setOpaque(true); block13.add(cell38); cell39.setBackground(new java.awt.Color(255, 255, 255)); cell39.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell39.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell39.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell39.setOpaque(true); block13.add(cell39); board.add(block13); block21.setBorder(new javax.swing.border.MatteBorder(null)); block21.setMinimumSize(new java.awt.Dimension(152, 152)); block21.setPreferredSize(new java.awt.Dimension(152, 152)); block21.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell41.setBackground(new java.awt.Color(255, 255, 255)); cell41.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell41.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell41.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell41.setOpaque(true); block21.add(cell41); cell42.setBackground(new java.awt.Color(51, 255, 255)); cell42.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell42.setForeground(new java.awt.Color(51, 255, 255)); cell42.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell42.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell42.setOpaque(true); block21.add(cell42); cell43.setBackground(new java.awt.Color(51, 255, 255)); cell43.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell43.setForeground(new java.awt.Color(51, 255, 255)); cell43.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell43.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell43.setOpaque(true); block21.add(cell43); cell51.setBackground(new java.awt.Color(255, 255, 255)); cell51.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell51.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell51.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell51.setOpaque(true); block21.add(cell51); cell52.setBackground(new java.awt.Color(255, 255, 255)); cell52.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell52.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell52.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell52.setOpaque(true); block21.add(cell52); cell53.setBackground(new java.awt.Color(255, 255, 255)); cell53.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell53.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell53.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell53.setOpaque(true); block21.add(cell53); cell61.setBackground(new java.awt.Color(255, 255, 255)); cell61.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell61.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell61.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell61.setOpaque(true); block21.add(cell61); cell62.setBackground(new java.awt.Color(51, 255, 255)); cell62.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell62.setForeground(new java.awt.Color(51, 255, 255)); cell62.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell62.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell62.setOpaque(true); block21.add(cell62); cell63.setBackground(new java.awt.Color(51, 255, 255)); cell63.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell63.setForeground(new java.awt.Color(51, 255, 255)); cell63.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell63.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell63.setOpaque(true); block21.add(cell63); board.add(block21); block22.setBorder(new javax.swing.border.MatteBorder(null)); block22.setMinimumSize(new java.awt.Dimension(152, 152)); block22.setPreferredSize(new java.awt.Dimension(152, 152)); block22.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell44.setBackground(new java.awt.Color(51, 255, 255)); cell44.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell44.setForeground(new java.awt.Color(51, 255, 255)); cell44.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell44.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell44.setOpaque(true); block22.add(cell44); cell45.setBackground(new java.awt.Color(255, 255, 255)); cell45.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell45.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell45.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell45.setOpaque(true); block22.add(cell45); cell46.setBackground(new java.awt.Color(51, 255, 255)); cell46.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell46.setForeground(new java.awt.Color(51, 255, 255)); cell46.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell46.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell46.setOpaque(true); block22.add(cell46); cell54.setBackground(new java.awt.Color(255, 255, 255)); cell54.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell54.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell54.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell54.setOpaque(true); block22.add(cell54); cell55.setBackground(new java.awt.Color(255, 255, 255)); cell55.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell55.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell55.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell55.setOpaque(true); block22.add(cell55); cell56.setBackground(new java.awt.Color(255, 255, 255)); cell56.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell56.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell56.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell56.setOpaque(true); block22.add(cell56); cell64.setBackground(new java.awt.Color(51, 255, 255)); cell64.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell64.setForeground(new java.awt.Color(51, 255, 255)); cell64.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell64.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell64.setOpaque(true); block22.add(cell64); cell65.setBackground(new java.awt.Color(255, 255, 255)); cell65.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell65.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell65.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell65.setOpaque(true); block22.add(cell65); cell66.setBackground(new java.awt.Color(51, 255, 255)); cell66.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell66.setForeground(new java.awt.Color(51, 255, 255)); cell66.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell66.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell66.setOpaque(true); block22.add(cell66); board.add(block22); block23.setBorder(new javax.swing.border.MatteBorder(null)); block23.setMinimumSize(new java.awt.Dimension(152, 152)); block23.setPreferredSize(new java.awt.Dimension(152, 152)); block23.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell47.setBackground(new java.awt.Color(51, 255, 255)); cell47.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell47.setForeground(new java.awt.Color(51, 255, 255)); cell47.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell47.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell47.setOpaque(true); block23.add(cell47); cell48.setBackground(new java.awt.Color(51, 255, 255)); cell48.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell48.setForeground(new java.awt.Color(51, 255, 255)); cell48.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell48.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell48.setOpaque(true); block23.add(cell48); cell49.setBackground(new java.awt.Color(255, 255, 255)); cell49.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell49.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell49.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell49.setOpaque(true); block23.add(cell49); cell57.setBackground(new java.awt.Color(255, 255, 255)); cell57.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell57.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell57.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell57.setOpaque(true); block23.add(cell57); cell58.setBackground(new java.awt.Color(255, 255, 255)); cell58.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell58.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell58.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell58.setOpaque(true); block23.add(cell58); cell59.setBackground(new java.awt.Color(255, 255, 255)); cell59.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell59.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell59.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell59.setOpaque(true); block23.add(cell59); cell67.setBackground(new java.awt.Color(51, 255, 255)); cell67.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell67.setForeground(new java.awt.Color(51, 255, 255)); cell67.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell67.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell67.setOpaque(true); block23.add(cell67); cell68.setBackground(new java.awt.Color(51, 255, 255)); cell68.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell68.setForeground(new java.awt.Color(51, 255, 255)); cell68.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell68.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell68.setOpaque(true); block23.add(cell68); cell69.setBackground(new java.awt.Color(255, 255, 255)); cell69.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell69.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell69.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell69.setOpaque(true); block23.add(cell69); board.add(block23); block31.setBorder(new javax.swing.border.MatteBorder(null)); block31.setMinimumSize(new java.awt.Dimension(152, 152)); block31.setPreferredSize(new java.awt.Dimension(152, 152)); block31.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell71.setBackground(new java.awt.Color(255, 255, 255)); cell71.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell71.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell71.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell71.setOpaque(true); block31.add(cell71); cell72.setBackground(new java.awt.Color(51, 255, 255)); cell72.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell72.setForeground(new java.awt.Color(51, 255, 255)); cell72.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell72.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell72.setOpaque(true); block31.add(cell72); cell73.setBackground(new java.awt.Color(51, 255, 255)); cell73.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell73.setForeground(new java.awt.Color(51, 255, 255)); cell73.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell73.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell73.setOpaque(true); block31.add(cell73); cell81.setBackground(new java.awt.Color(255, 255, 255)); cell81.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell81.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell81.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell81.setOpaque(true); block31.add(cell81); cell82.setBackground(new java.awt.Color(51, 255, 255)); cell82.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell82.setForeground(new java.awt.Color(51, 255, 255)); cell82.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell82.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell82.setOpaque(true); block31.add(cell82); cell83.setBackground(new java.awt.Color(51, 255, 255)); cell83.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell83.setForeground(new java.awt.Color(51, 255, 255)); cell83.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell83.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell83.setOpaque(true); block31.add(cell83); cell91.setBackground(new java.awt.Color(255, 255, 255)); cell91.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell91.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell91.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell91.setOpaque(true); block31.add(cell91); cell92.setBackground(new java.awt.Color(255, 255, 255)); cell92.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell92.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell92.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell92.setOpaque(true); block31.add(cell92); cell93.setBackground(new java.awt.Color(255, 255, 255)); cell93.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell93.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell93.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell93.setOpaque(true); block31.add(cell93); board.add(block31); block32.setBorder(new javax.swing.border.MatteBorder(null)); block32.setMinimumSize(new java.awt.Dimension(152, 152)); block32.setPreferredSize(new java.awt.Dimension(152, 152)); block32.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell74.setBackground(new java.awt.Color(51, 255, 255)); cell74.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell74.setForeground(new java.awt.Color(51, 255, 255)); cell74.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell74.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell74.setOpaque(true); block32.add(cell74); cell75.setBackground(new java.awt.Color(255, 255, 255)); cell75.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell75.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell75.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell75.setOpaque(true); block32.add(cell75); cell76.setBackground(new java.awt.Color(51, 255, 255)); cell76.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell76.setForeground(new java.awt.Color(51, 255, 255)); cell76.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell76.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell76.setOpaque(true); block32.add(cell76); cell84.setBackground(new java.awt.Color(51, 255, 255)); cell84.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell84.setForeground(new java.awt.Color(51, 255, 255)); cell84.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell84.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell84.setOpaque(true); block32.add(cell84); cell85.setBackground(new java.awt.Color(255, 255, 255)); cell85.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell85.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell85.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell85.setOpaque(true); block32.add(cell85); cell86.setBackground(new java.awt.Color(51, 255, 255)); cell86.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell86.setForeground(new java.awt.Color(51, 255, 255)); cell86.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell86.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell86.setOpaque(true); block32.add(cell86); cell94.setBackground(new java.awt.Color(255, 255, 255)); cell94.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell94.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell94.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell94.setOpaque(true); block32.add(cell94); cell95.setBackground(new java.awt.Color(255, 255, 255)); cell95.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell95.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell95.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell95.setOpaque(true); block32.add(cell95); cell96.setBackground(new java.awt.Color(255, 255, 255)); cell96.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell96.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell96.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell96.setOpaque(true); block32.add(cell96); board.add(block32); block33.setBorder(new javax.swing.border.MatteBorder(null)); block33.setMinimumSize(new java.awt.Dimension(152, 152)); block33.setPreferredSize(new java.awt.Dimension(152, 152)); block33.setLayout(new java.awt.GridLayout(3, 3, 1, 1)); cell77.setBackground(new java.awt.Color(51, 255, 255)); cell77.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell77.setForeground(new java.awt.Color(51, 255, 255)); cell77.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell77.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell77.setOpaque(true); block33.add(cell77); cell78.setBackground(new java.awt.Color(51, 255, 255)); cell78.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell78.setForeground(new java.awt.Color(51, 255, 255)); cell78.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell78.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell78.setOpaque(true); block33.add(cell78); cell79.setBackground(new java.awt.Color(255, 255, 255)); cell79.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell79.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell79.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell79.setOpaque(true); block33.add(cell79); cell87.setBackground(new java.awt.Color(51, 255, 255)); cell87.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell87.setForeground(new java.awt.Color(51, 255, 255)); cell87.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell87.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell87.setOpaque(true); block33.add(cell87); cell88.setBackground(new java.awt.Color(51, 255, 255)); cell88.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell88.setForeground(new java.awt.Color(51, 255, 255)); cell88.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell88.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell88.setOpaque(true); block33.add(cell88); cell89.setBackground(new java.awt.Color(255, 255, 255)); cell89.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell89.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell89.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell89.setOpaque(true); block33.add(cell89); cell97.setBackground(new java.awt.Color(255, 255, 255)); cell97.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell97.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell97.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell97.setOpaque(true); block33.add(cell97); cell98.setBackground(new java.awt.Color(255, 255, 255)); cell98.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell98.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell98.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell98.setOpaque(true); block33.add(cell98); cell99.setBackground(new java.awt.Color(255, 255, 255)); cell99.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N cell99.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cell99.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cell99.setOpaque(true); block33.add(cell99); board.add(block33); jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton1.setText("1"); jButton1.setPreferredSize(new java.awt.Dimension(40, 40)); jButton1.setRequestFocusEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton2.setText("2"); jButton2.setPreferredSize(new java.awt.Dimension(40, 40)); jButton2.setRequestFocusEnabled(false); jButton3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton3.setText("3"); jButton3.setPreferredSize(new java.awt.Dimension(40, 40)); jButton3.setRequestFocusEnabled(false); jButton4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton4.setText("4"); jButton4.setPreferredSize(new java.awt.Dimension(40, 40)); jButton4.setRequestFocusEnabled(false); jButton5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton5.setText("5"); jButton5.setPreferredSize(new java.awt.Dimension(40, 40)); jButton5.setRequestFocusEnabled(false); jButton6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton6.setText("6"); jButton6.setPreferredSize(new java.awt.Dimension(40, 40)); jButton6.setRequestFocusEnabled(false); jButton7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton7.setText("7"); jButton7.setPreferredSize(new java.awt.Dimension(40, 40)); jButton7.setRequestFocusEnabled(false); jButton8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton8.setText("8"); jButton8.setPreferredSize(new java.awt.Dimension(40, 40)); jButton8.setRequestFocusEnabled(false); jButton9.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton9.setText("9"); jButton9.setPreferredSize(new java.awt.Dimension(40, 40)); jButton9.setRequestFocusEnabled(false); help.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N help.setText("Help"); help.setPreferredSize(new java.awt.Dimension(40, 40)); help.setRequestFocusEnabled(false); statistics.setText("Statistics"); statistics.setPreferredSize(new java.awt.Dimension(40, 40)); exit.setText("Exit"); exit.setPreferredSize(new java.awt.Dimension(40, 40)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(board, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(12, 12, 12) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(help, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(94, 94, 94) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(statistics, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE) .addComponent(exit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap(52, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(board, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(60, 60, 60) .addComponent(statistics, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(exit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(help, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(86, 86, 86)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Sudoku.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Sudoku dialog = new Sudoku(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel block11; private javax.swing.JPanel block12; private javax.swing.JPanel block13; private javax.swing.JPanel block21; private javax.swing.JPanel block22; private javax.swing.JPanel block23; private javax.swing.JPanel block31; private javax.swing.JPanel block32; private javax.swing.JPanel block33; private javax.swing.JPanel board; private javax.swing.JLabel cell11; private javax.swing.JLabel cell12; private javax.swing.JLabel cell13; private javax.swing.JLabel cell14; private javax.swing.JLabel cell15; private javax.swing.JLabel cell16; private javax.swing.JLabel cell17; private javax.swing.JLabel cell18; private javax.swing.JLabel cell19; private javax.swing.JLabel cell21; private javax.swing.JLabel cell22; private javax.swing.JLabel cell23; private javax.swing.JLabel cell24; private javax.swing.JLabel cell25; private javax.swing.JLabel cell26; private javax.swing.JLabel cell27; private javax.swing.JLabel cell28; private javax.swing.JLabel cell29; private javax.swing.JLabel cell31; private javax.swing.JLabel cell32; private javax.swing.JLabel cell33; private javax.swing.JLabel cell34; private javax.swing.JLabel cell35; private javax.swing.JLabel cell36; private javax.swing.JLabel cell37; private javax.swing.JLabel cell38; private javax.swing.JLabel cell39; private javax.swing.JLabel cell41; private javax.swing.JLabel cell42; private javax.swing.JLabel cell43; private javax.swing.JLabel cell44; private javax.swing.JLabel cell45; private javax.swing.JLabel cell46; private javax.swing.JLabel cell47; private javax.swing.JLabel cell48; private javax.swing.JLabel cell49; private javax.swing.JLabel cell51; private javax.swing.JLabel cell52; private javax.swing.JLabel cell53; private javax.swing.JLabel cell54; private javax.swing.JLabel cell55; private javax.swing.JLabel cell56; private javax.swing.JLabel cell57; private javax.swing.JLabel cell58; private javax.swing.JLabel cell59; private javax.swing.JLabel cell61; private javax.swing.JLabel cell62; private javax.swing.JLabel cell63; private javax.swing.JLabel cell64; private javax.swing.JLabel cell65; private javax.swing.JLabel cell66; private javax.swing.JLabel cell67; private javax.swing.JLabel cell68; private javax.swing.JLabel cell69; private javax.swing.JLabel cell71; private javax.swing.JLabel cell72; private javax.swing.JLabel cell73; private javax.swing.JLabel cell74; private javax.swing.JLabel cell75; private javax.swing.JLabel cell76; private javax.swing.JLabel cell77; private javax.swing.JLabel cell78; private javax.swing.JLabel cell79; private javax.swing.JLabel cell81; private javax.swing.JLabel cell82; private javax.swing.JLabel cell83; private javax.swing.JLabel cell84; private javax.swing.JLabel cell85; private javax.swing.JLabel cell86; private javax.swing.JLabel cell87; private javax.swing.JLabel cell88; private javax.swing.JLabel cell89; private javax.swing.JLabel cell91; private javax.swing.JLabel cell92; private javax.swing.JLabel cell93; private javax.swing.JLabel cell94; private javax.swing.JLabel cell95; private javax.swing.JLabel cell96; private javax.swing.JLabel cell97; private javax.swing.JLabel cell98; private javax.swing.JLabel cell99; private javax.swing.JButton exit; private javax.swing.JButton help; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JButton statistics; // End of variables declaration//GEN-END:variables }
56,769
0.668146
0.603622
1,101
50.561306
32.984779
175
false
false
0
0
0
0
0
0
1.456857
false
false
9
72af1be2ef5973128acb4ba449ea5f6044604075
8,667,244,056,676
d1ce41e422fc315fed71afc2e8e504a3c6b446c9
/src/test/java/phome/bidtracker/store/BidStoreTest.java
1ad798e281237e385f1268f846166db8b1dc934d
[]
no_license
bithoven/BidTracker
https://github.com/bithoven/BidTracker
98039402e6552f5afa651b7304f81dc3335dcdd9
3d3349476fb9cb2d7101a5922cbae81e051c5d70
refs/heads/master
2021-01-20T22:28:27.779000
2016-03-23T02:27:06
2016-03-23T02:27:06
19,719,447
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package phome.bidtracker.store; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.junit.Before; import org.junit.Test; import phome.bidtracker.models.Bid; import phome.bidtracker.store.BidStore; import phome.bidtracker.store.BidStoreLockFree; import static junit.framework.Assert.*; public class BidStoreTest { private BidStore bidStore; private String itemId = UUID.randomUUID() + "-ID"; private String userId = UUID.randomUUID() + "-ID"; private double bidAmount = 5.0; private Bid bid= new Bid(itemId, userId, bidAmount); private ExecutorService executor = Executors.newCachedThreadPool(); // Tuple like class to hold bid and its result private static class ResultTuple{ boolean result; Bid bid; public ResultTuple(boolean result, Bid bid){ this.result = result; this.bid = bid; } } @Before public void setup(){ bidStore = new BidStoreLockFree(); } @Test public void accepts_a_brand_new_bid(){ assertTrue( bidStore.maybeSave(bid)); } @Test public void rejects_duplicate_bids(){ bidStore.maybeSave(bid); assertFalse( bidStore.maybeSave(bid)); } @Test public void rejects_lower_bids(){ bidStore.maybeSave(bid); Bid lowBid = new Bid(itemId, userId, bidAmount - 1.0d); assertFalse( bidStore.maybeSave(lowBid)); } @Test public void accepts_higher_bids(){ bidStore.maybeSave(bid); Bid highBid = new Bid(itemId, userId, bidAmount + 1.0d); assertTrue( bidStore.maybeSave(highBid)); } @Test public void rejects_equal_bid_by_another_user(){ bidStore.maybeSave(bid); Bid equalBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount); assertFalse( bidStore.maybeSave(equalBid)); } @Test public void retrieves_saved_bids_for_an_item_in_order_as_placed(){ bidStore.maybeSave(bid); Bid higherBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount + 1.0d); bidStore.maybeSave(higherBid); Bid[] bids = {bid, higherBid}; int cursor = 0; for (Bid currBid :bidStore.bidsForItem(itemId)) { assertEquals(currBid, bids[cursor++]); }; } @Test public void retrieves_highest_bid_as_winning_bid(){ bidStore.maybeSave(bid); Bid higherBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount + 1.0d); bidStore.maybeSave(higherBid); assertEquals(higherBid, bidStore.winningBid(itemId)); } @Test public void test_no_bids(){ assertNull(bidStore.bidsForItem(itemId)); } @Test public void test_no_winning_bid(){ assertNull(bidStore.winningBid(itemId)); } //Concurrency tests @Test public void accepts_exact_one_of_multiple_concurrent_equal_bids_on_same_item() throws InterruptedException, ExecutionException{ //Callable bid task with dynamic userId but equal bid amount on the same item Callable<Boolean> task = new Callable<Boolean>() { @Override public Boolean call() throws Exception { String currUserId = UUID.randomUUID() + "-ID"; return bidStore.maybeSave(new Bid(itemId, currUserId, bidAmount)); } }; //Runs 100 equal bids in parallel and fetches the result for each int success = 0; List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(); for (int i = 0; i < 100; i++) { futures.add( executor.submit(task)); } for ( Future<Boolean> future : futures) { if(future.get()) success++; } assertEquals(1, success); } @Test public void saves_and_retrieves_winning_bid_correctly_on_concurrent_unequal_bid_placement_on_same_item() throws InterruptedException, ExecutionException{ //Callable bid task with dynamic userId but equal bid amount on the same item Callable<ResultTuple> task = new Callable<ResultTuple>() { @Override public ResultTuple call() throws Exception { String currUserId = UUID.randomUUID() + "-ID"; Bid currBid = new Bid(itemId, currUserId, bidAmount + Math.random()); return new ResultTuple(bidStore.maybeSave(currBid), currBid); } }; //Runs 100 equal bids in parallel and make sure they complete List<Future<ResultTuple>> futures = new ArrayList<Future<ResultTuple>>(); for (int i = 0; i < 100; i++) { futures.add( executor.submit(task)); } Bid maxBid = null; for ( Future<ResultTuple> future : futures) { ResultTuple resBidTuple = future.get(); if(resBidTuple.result){ if(maxBid == null || maxBid.getAmount() < resBidTuple.bid.getAmount()) maxBid = resBidTuple.bid; } } assertEquals(maxBid, bidStore.winningBid(itemId)); } }
UTF-8
Java
4,727
java
BidStoreTest.java
Java
[]
null
[]
package phome.bidtracker.store; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.junit.Before; import org.junit.Test; import phome.bidtracker.models.Bid; import phome.bidtracker.store.BidStore; import phome.bidtracker.store.BidStoreLockFree; import static junit.framework.Assert.*; public class BidStoreTest { private BidStore bidStore; private String itemId = UUID.randomUUID() + "-ID"; private String userId = UUID.randomUUID() + "-ID"; private double bidAmount = 5.0; private Bid bid= new Bid(itemId, userId, bidAmount); private ExecutorService executor = Executors.newCachedThreadPool(); // Tuple like class to hold bid and its result private static class ResultTuple{ boolean result; Bid bid; public ResultTuple(boolean result, Bid bid){ this.result = result; this.bid = bid; } } @Before public void setup(){ bidStore = new BidStoreLockFree(); } @Test public void accepts_a_brand_new_bid(){ assertTrue( bidStore.maybeSave(bid)); } @Test public void rejects_duplicate_bids(){ bidStore.maybeSave(bid); assertFalse( bidStore.maybeSave(bid)); } @Test public void rejects_lower_bids(){ bidStore.maybeSave(bid); Bid lowBid = new Bid(itemId, userId, bidAmount - 1.0d); assertFalse( bidStore.maybeSave(lowBid)); } @Test public void accepts_higher_bids(){ bidStore.maybeSave(bid); Bid highBid = new Bid(itemId, userId, bidAmount + 1.0d); assertTrue( bidStore.maybeSave(highBid)); } @Test public void rejects_equal_bid_by_another_user(){ bidStore.maybeSave(bid); Bid equalBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount); assertFalse( bidStore.maybeSave(equalBid)); } @Test public void retrieves_saved_bids_for_an_item_in_order_as_placed(){ bidStore.maybeSave(bid); Bid higherBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount + 1.0d); bidStore.maybeSave(higherBid); Bid[] bids = {bid, higherBid}; int cursor = 0; for (Bid currBid :bidStore.bidsForItem(itemId)) { assertEquals(currBid, bids[cursor++]); }; } @Test public void retrieves_highest_bid_as_winning_bid(){ bidStore.maybeSave(bid); Bid higherBid = new Bid(itemId, UUID.randomUUID() + "-ID", bidAmount + 1.0d); bidStore.maybeSave(higherBid); assertEquals(higherBid, bidStore.winningBid(itemId)); } @Test public void test_no_bids(){ assertNull(bidStore.bidsForItem(itemId)); } @Test public void test_no_winning_bid(){ assertNull(bidStore.winningBid(itemId)); } //Concurrency tests @Test public void accepts_exact_one_of_multiple_concurrent_equal_bids_on_same_item() throws InterruptedException, ExecutionException{ //Callable bid task with dynamic userId but equal bid amount on the same item Callable<Boolean> task = new Callable<Boolean>() { @Override public Boolean call() throws Exception { String currUserId = UUID.randomUUID() + "-ID"; return bidStore.maybeSave(new Bid(itemId, currUserId, bidAmount)); } }; //Runs 100 equal bids in parallel and fetches the result for each int success = 0; List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(); for (int i = 0; i < 100; i++) { futures.add( executor.submit(task)); } for ( Future<Boolean> future : futures) { if(future.get()) success++; } assertEquals(1, success); } @Test public void saves_and_retrieves_winning_bid_correctly_on_concurrent_unequal_bid_placement_on_same_item() throws InterruptedException, ExecutionException{ //Callable bid task with dynamic userId but equal bid amount on the same item Callable<ResultTuple> task = new Callable<ResultTuple>() { @Override public ResultTuple call() throws Exception { String currUserId = UUID.randomUUID() + "-ID"; Bid currBid = new Bid(itemId, currUserId, bidAmount + Math.random()); return new ResultTuple(bidStore.maybeSave(currBid), currBid); } }; //Runs 100 equal bids in parallel and make sure they complete List<Future<ResultTuple>> futures = new ArrayList<Future<ResultTuple>>(); for (int i = 0; i < 100; i++) { futures.add( executor.submit(task)); } Bid maxBid = null; for ( Future<ResultTuple> future : futures) { ResultTuple resBidTuple = future.get(); if(resBidTuple.result){ if(maxBid == null || maxBid.getAmount() < resBidTuple.bid.getAmount()) maxBid = resBidTuple.bid; } } assertEquals(maxBid, bidStore.winningBid(itemId)); } }
4,727
0.702348
0.696636
181
25.116022
24.914059
128
false
false
0
0
0
0
0
0
2.248619
false
false
9
2a9e819b7be461768c65d9310934bbd2a821294f
29,703,993,828,473
5aecad12c5db6e7beff850479487aa7aef6e507b
/ImperativeVsDeclarative/src/com/adamcarter/Main.java
c1bf065fc25972d3f5f8eb95fceafef6294951b0
[]
no_license
vtboyarc/Java-Practice
https://github.com/vtboyarc/Java-Practice
5931431681c59af643fd404f48de8af1900eaf8b
9b829052d61d284a9a97e67f2b84483cf737abea
refs/heads/master
2021-06-05T10:28:40.249000
2019-03-10T23:22:20
2019-03-10T23:22:20
38,170,793
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.adamcarter; import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) { List<String> ingredients = Arrays.asList( "flour", "salt", "baking powder", "butter", "eggs", "milk" ); // this is declarative programming - which is used in functional programming // it is more descriptive, verbose // boolean hasEggs = false; // for (String ingredient : ingredients) { // if (ingredient.equals("eggs")) { // hasEggs = true; // break; // } // } // if (hasEggs) { // System.out.println("Sorry, it has eggs"); // } // imperative programming, we can skip the above code and get same results, like so: if (ingredients.contains("eggs")) { System.out.println("Sorry, it has eggs"); } // succinct way of printing each ingredient using a lambda ingredients.forEach(ingredient -> System.out.println(ingredient)); } }
UTF-8
Java
1,153
java
Main.java
Java
[ { "context": "package com.adamcarter;\n\nimport java.util.Arrays;\nimport java.util.List;", "end": 22, "score": 0.8545103073120117, "start": 12, "tag": "USERNAME", "value": "adamcarter" } ]
null
[]
package com.adamcarter; import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) { List<String> ingredients = Arrays.asList( "flour", "salt", "baking powder", "butter", "eggs", "milk" ); // this is declarative programming - which is used in functional programming // it is more descriptive, verbose // boolean hasEggs = false; // for (String ingredient : ingredients) { // if (ingredient.equals("eggs")) { // hasEggs = true; // break; // } // } // if (hasEggs) { // System.out.println("Sorry, it has eggs"); // } // imperative programming, we can skip the above code and get same results, like so: if (ingredients.contains("eggs")) { System.out.println("Sorry, it has eggs"); } // succinct way of printing each ingredient using a lambda ingredients.forEach(ingredient -> System.out.println(ingredient)); } }
1,153
0.525585
0.525585
42
26.452381
23.930656
92
false
false
0
0
0
0
0
0
0.47619
false
false
9
fb547343a83be1d76d0ced6bf1a3fe8fc5279147
31,619,549,247,319
4ed413ed169457d1fbb6940baeecb68b4f218e7c
/src/contacts/Contact.java
896c3ebb60c10c7f8caaf446e796ad4996fde1bc
[]
no_license
ravisingh10/network-messaging
https://github.com/ravisingh10/network-messaging
2ac01f88c7517eceefeb0fa6169c771a005f32f4
700e157fc88889a8087ee2ec28924758b49ecdb1
refs/heads/master
2020-05-18T11:50:00.604000
2019-05-01T09:02:45
2019-05-01T09:02:45
184,390,236
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package contacts; public class Contact { private String username; private String completeAddress; public Contact(String username, String completeAddress) { this.username = username; this.completeAddress = completeAddress; } public Contact(String username, String ip, int port){ this.username = username; this.completeAddress = getCompleteAddress(ip, port); } private String getCompleteAddress(String ip , int port){ return (username + "@" + ip + ":"+ port); } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getCompleteAddress() { return completeAddress; } public void setCompleteAddress(String completeAddress) { this.completeAddress = completeAddress; } }
UTF-8
Java
888
java
Contact.java
Java
[ { "context": " String completeAddress) {\n this.username = username;\n this.completeAddress = completeAddress;\n", "end": 202, "score": 0.9971749782562256, "start": 194, "tag": "USERNAME", "value": "username" }, { "context": "ame, String ip, int port){\n this.use...
null
[]
package contacts; public class Contact { private String username; private String completeAddress; public Contact(String username, String completeAddress) { this.username = username; this.completeAddress = completeAddress; } public Contact(String username, String ip, int port){ this.username = username; this.completeAddress = getCompleteAddress(ip, port); } private String getCompleteAddress(String ip , int port){ return (username + "@" + ip + ":"+ port); } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getCompleteAddress() { return completeAddress; } public void setCompleteAddress(String completeAddress) { this.completeAddress = completeAddress; } }
888
0.654279
0.654279
36
23.666666
21.725561
61
false
false
0
0
0
0
0
0
0.472222
false
false
9
200f38d59c115b162e001d0a330a5d0b34b0a3fd
21,397,527,103,280
ec416419dd088c6b76415f56490a104660540a01
/projekt/sk/mato/kuchy/pridajzapas.java
ae68afbf460af72471d22b57a7f726aba6c79ed1
[]
no_license
widerules/coachnote
https://github.com/widerules/coachnote
abe1fd1279c8180e19180a2939be5540657097f2
dfca2e333a4acb3d64e6b3031309700c6d7cac1a
refs/heads/master
2021-01-20T15:41:41.415000
2012-06-01T21:39:57
2012-06-01T21:39:57
41,127,736
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sk.mato.kuchy; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; public class pridajzapas extends Activity { private Trening trening; private InputStream akt; private sqlPomoc dbhraci = new sqlPomoc(this, "hraci", null, 1); private ArrayList<Hrac> hraci = new ArrayList<Hrac>(); private String A = "nic", B = "nic"; private ArrayList<Hrac> dochadzka; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // nacitaj try { akt = openFileInput("trening.xml"); hraci = dbhraci.dajCeluDb(); trening = OXml.nacitajTrening(akt, hraci); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } setContentView(R.layout.pridajzapas); dochadzka = trening.getHracov(); final ArrayList<String> dochadzkaString = new ArrayList<String>(); //dochadzkaString.add("----"); for (Hrac hrac : dochadzka) { dochadzkaString.add(hrac.getMeno() + " " + hrac.getPriezvisko()); } if (dochadzkaString.size() < 2) { // na toto musi mat aspon 2 hracov! finish(); } final Spinner teamA = (Spinner) findViewById(R.id.teamB); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, dochadzkaString); teamA.setAdapter(adapter); teamA.setSelection(Adapter.NO_SELECTION); final Spinner teamB = (Spinner) findViewById(R.id.teamA); ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, dochadzkaString); teamB.setAdapter(adapter2); teamA.setSelection(Adapter.NO_SELECTION); teamB.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View arg1, int pos, long arg3) { // TODO Auto-generated method stub B = parent.getItemAtPosition(pos).toString(); /*if (A==B && !A.equals("----")) { AlertDialog alertDialog = new AlertDialog.Builder( pridajzapas.this).create(); alertDialog.setTitle("POZOR"); alertDialog.setMessage("nemoze hrat sam so sebou!"); alertDialog.setButton("exit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { B="nic"; teamB.setSelection(0); } }); alertDialog.show(); } */ if (A==B) { if (pos+1 <= dochadzkaString.size()-1 ) teamA.setSelection(pos+1); else if (pos!=0) teamA.setSelection(pos-1); } } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub B = "nic"; } } ); teamA.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View arg1, int pos, long arg3) { // TODO Auto-generated method stub A = parent.getItemAtPosition(pos).toString(); if (A==B) { if (pos+1 <= dochadzkaString.size()-1 ) teamB.setSelection(pos+1); else if (pos!=0) teamB.setSelection(pos-1); } } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub A = "nic"; } }); Button odosli = (Button) findViewById(R.id.odosliZapas); odosli.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub if (A.equals("nic") || B.equals("nic") || A.equals("----") || B.equals("----") ) { AlertDialog alertDialog = new AlertDialog.Builder( pridajzapas.this).create(); alertDialog.setTitle("POZOR"); alertDialog.setMessage("nezadany aspon jeden z hracov!"); alertDialog.setButton("exit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.show(); return; } Hrac a = null,b = null; for (Hrac s : dochadzka) { if (A.equals( s.getMeno() + " " + s.getPriezvisko() )) a=s; if (B.equals( s.getMeno() + " " + s.getPriezvisko() )) b=s; } if (a==null || b==null) return; Dvojhra novy = new Dvojhra(a, b); trening.addZapasy(novy); //uloz trening try { OXml.vytvorNovyTrening(trening); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finish(); } }); } }
UTF-8
Java
4,882
java
pridajzapas.java
Java
[]
null
[]
package sk.mato.kuchy; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; public class pridajzapas extends Activity { private Trening trening; private InputStream akt; private sqlPomoc dbhraci = new sqlPomoc(this, "hraci", null, 1); private ArrayList<Hrac> hraci = new ArrayList<Hrac>(); private String A = "nic", B = "nic"; private ArrayList<Hrac> dochadzka; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // nacitaj try { akt = openFileInput("trening.xml"); hraci = dbhraci.dajCeluDb(); trening = OXml.nacitajTrening(akt, hraci); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } setContentView(R.layout.pridajzapas); dochadzka = trening.getHracov(); final ArrayList<String> dochadzkaString = new ArrayList<String>(); //dochadzkaString.add("----"); for (Hrac hrac : dochadzka) { dochadzkaString.add(hrac.getMeno() + " " + hrac.getPriezvisko()); } if (dochadzkaString.size() < 2) { // na toto musi mat aspon 2 hracov! finish(); } final Spinner teamA = (Spinner) findViewById(R.id.teamB); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, dochadzkaString); teamA.setAdapter(adapter); teamA.setSelection(Adapter.NO_SELECTION); final Spinner teamB = (Spinner) findViewById(R.id.teamA); ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, dochadzkaString); teamB.setAdapter(adapter2); teamA.setSelection(Adapter.NO_SELECTION); teamB.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View arg1, int pos, long arg3) { // TODO Auto-generated method stub B = parent.getItemAtPosition(pos).toString(); /*if (A==B && !A.equals("----")) { AlertDialog alertDialog = new AlertDialog.Builder( pridajzapas.this).create(); alertDialog.setTitle("POZOR"); alertDialog.setMessage("nemoze hrat sam so sebou!"); alertDialog.setButton("exit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { B="nic"; teamB.setSelection(0); } }); alertDialog.show(); } */ if (A==B) { if (pos+1 <= dochadzkaString.size()-1 ) teamA.setSelection(pos+1); else if (pos!=0) teamA.setSelection(pos-1); } } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub B = "nic"; } } ); teamA.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View arg1, int pos, long arg3) { // TODO Auto-generated method stub A = parent.getItemAtPosition(pos).toString(); if (A==B) { if (pos+1 <= dochadzkaString.size()-1 ) teamB.setSelection(pos+1); else if (pos!=0) teamB.setSelection(pos-1); } } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub A = "nic"; } }); Button odosli = (Button) findViewById(R.id.odosliZapas); odosli.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub if (A.equals("nic") || B.equals("nic") || A.equals("----") || B.equals("----") ) { AlertDialog alertDialog = new AlertDialog.Builder( pridajzapas.this).create(); alertDialog.setTitle("POZOR"); alertDialog.setMessage("nezadany aspon jeden z hracov!"); alertDialog.setButton("exit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.show(); return; } Hrac a = null,b = null; for (Hrac s : dochadzka) { if (A.equals( s.getMeno() + " " + s.getPriezvisko() )) a=s; if (B.equals( s.getMeno() + " " + s.getPriezvisko() )) b=s; } if (a==null || b==null) return; Dvojhra novy = new Dvojhra(a, b); trening.addZapasy(novy); //uloz trening try { OXml.vytvorNovyTrening(trening); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finish(); } }); } }
4,882
0.665711
0.661204
169
27.887573
21.597017
87
false
false
0
0
0
0
0
0
3.544379
false
false
9
2ee2c1c3d08326138e38db0979e53ddd1f7fbd5a
32,744,830,665,674
8266c80ca8980ece6f5004337662d903add3a7eb
/siscoespos-persistencia-spring-mybatis/src/test/java/com/utm/siscoespos/XDaoTest.java
13f160f2727d86ce284ddd08a7aac8e2a0c905e0
[]
no_license
GilHernandezLedesma/proyecto-reyes-mybatis
https://github.com/GilHernandezLedesma/proyecto-reyes-mybatis
fe2cab5ac1875bd9ae42cc79277b4e202ed82f28
720cff3c42d51569da9a880f090b7c821a0d8bb0
refs/heads/master
2018-05-18T13:35:41.564000
2017-06-02T17:21:20
2017-06-02T17:21:20
93,222,107
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.utm.siscoespos; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import javax.inject.Inject; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.utm.siscoespos.persistencia.dao.DocumentoDao; import com.utm.siscoespos.persistencia.dao.DocumentoDaoImpl; import com.utm.siscoespos.persistencia.dao.PersonaDao; import com.utm.siscoespos.persistencia.dao.PersonaDaoImpl; import com.utm.siscoespos.persistencia.dao.XDao; import com.utm.siscoespos.persistencia.dominio.Documento; import com.utm.siscoespos.persistencia.dominio.Persona; import com.utm.siscoespos.persistencia.dominio.X; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/applicationContext.xml"}) public class XDaoTest { @Inject private XDao xDao; @BeforeClass public static void inicializa() { } @Ignore @SuppressWarnings("deprecation") @Test public void crearX() { X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNotNull(objetoXBD); assertEquals(objetoXBD.getNombre(), objetoX.getNombre()); } @Ignore @Test public void actualizarPersona(){ X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); objetoX.setNombre("Objeto X modificado"); xDao.actualizar(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNotNull(objetoXBD); assertEquals(objetoXBD.getNombre(), objetoX.getNombre()); } @Ignore @Test public void eliminarPersona(){ X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); xDao.eliminar(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNull(objetoXBD); } @Ignore @Test public void obtenerX(){ List<X> lista=xDao.obtener(); Integer total = lista.size(); X objetoX = new X(); objetoX.setNombre("Objeto X1"); xDao.crear(objetoX); objetoX = new X(); objetoX.setNombre("Objeto X2"); xDao.crear(objetoX); lista=xDao.obtener(); Integer total2 = lista.size(); assertEquals(2, total2-total); } }
UTF-8
Java
2,581
java
XDaoTest.java
Java
[]
null
[]
package com.utm.siscoespos; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import javax.inject.Inject; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.utm.siscoespos.persistencia.dao.DocumentoDao; import com.utm.siscoespos.persistencia.dao.DocumentoDaoImpl; import com.utm.siscoespos.persistencia.dao.PersonaDao; import com.utm.siscoespos.persistencia.dao.PersonaDaoImpl; import com.utm.siscoespos.persistencia.dao.XDao; import com.utm.siscoespos.persistencia.dominio.Documento; import com.utm.siscoespos.persistencia.dominio.Persona; import com.utm.siscoespos.persistencia.dominio.X; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/applicationContext.xml"}) public class XDaoTest { @Inject private XDao xDao; @BeforeClass public static void inicializa() { } @Ignore @SuppressWarnings("deprecation") @Test public void crearX() { X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNotNull(objetoXBD); assertEquals(objetoXBD.getNombre(), objetoX.getNombre()); } @Ignore @Test public void actualizarPersona(){ X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); objetoX.setNombre("Objeto X modificado"); xDao.actualizar(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNotNull(objetoXBD); assertEquals(objetoXBD.getNombre(), objetoX.getNombre()); } @Ignore @Test public void eliminarPersona(){ X objetoX = new X(); objetoX.setNombre("Objeto X"); xDao.crear(objetoX); xDao.eliminar(objetoX); X objetoXBD = xDao.obtenerPorId(objetoX.getId()); assertNull(objetoXBD); } @Ignore @Test public void obtenerX(){ List<X> lista=xDao.obtener(); Integer total = lista.size(); X objetoX = new X(); objetoX.setNombre("Objeto X1"); xDao.crear(objetoX); objetoX = new X(); objetoX.setNombre("Objeto X2"); xDao.crear(objetoX); lista=xDao.obtener(); Integer total2 = lista.size(); assertEquals(2, total2-total); } }
2,581
0.736924
0.733824
113
21.831858
19.309727
71
false
false
0
0
0
0
0
0
1.79646
false
false
9
ed092ebe568fd55e896b854746d50d9553f58f95
3,083,786,565,555
2ad9cf0eb727f6cb57686ff72f9261645414d998
/src/encapsulation13/ThisReservedWord.java
dbf592abedf97e2e5304fc6a4ae975d8f948487e
[]
no_license
suggom/JavaBasicAppMe
https://github.com/suggom/JavaBasicAppMe
7176c6676e2253ca5b2169ae3ee3031c44ab550a
bbf2100b796ce49543eead7b65f0ea77213a1fbb
refs/heads/main
2022-12-27T08:24:17.874000
2020-10-16T11:28:24
2020-10-16T11:28:24
303,964,271
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package encapsulation13; public class ThisReservedWord { //this. x항상 인스턴스형 메소드 안에서만 사용가능 //인스턴스형 멤버 int instanceVar,anotherInstanceVar; void instanceMethod() { System.out.println(this.staticVar); //[경고]정적인 방법으로 접근해야됨 } //정적멤버 static int staticVar; static void staticMethod() { } void initialize( int instanceVar,int another, int staticVar){ this.instanceVar=instanceVar; anotherInstanceVar=another; //this.staticVar=staticVar; ThisReservedWord.staticVar = staticVar; } public static void main(String[] args) { ThisReservedWord reserved = new ThisReservedWord(); reserved.initialize(10, 100, 1000); System.out.println("[멤버 변수 초기화 후]"); System.out.println("reserved.instanceVar:"+ reserved.instanceVar); System.out.println("reserved.anotherInstanceVar:"+ reserved.anotherInstanceVar); System.out.println("ThisReservedWord.staticVar:"+ staticVar); } }
UTF-8
Java
995
java
ThisReservedWord.java
Java
[]
null
[]
package encapsulation13; public class ThisReservedWord { //this. x항상 인스턴스형 메소드 안에서만 사용가능 //인스턴스형 멤버 int instanceVar,anotherInstanceVar; void instanceMethod() { System.out.println(this.staticVar); //[경고]정적인 방법으로 접근해야됨 } //정적멤버 static int staticVar; static void staticMethod() { } void initialize( int instanceVar,int another, int staticVar){ this.instanceVar=instanceVar; anotherInstanceVar=another; //this.staticVar=staticVar; ThisReservedWord.staticVar = staticVar; } public static void main(String[] args) { ThisReservedWord reserved = new ThisReservedWord(); reserved.initialize(10, 100, 1000); System.out.println("[멤버 변수 초기화 후]"); System.out.println("reserved.instanceVar:"+ reserved.instanceVar); System.out.println("reserved.anotherInstanceVar:"+ reserved.anotherInstanceVar); System.out.println("ThisReservedWord.staticVar:"+ staticVar); } }
995
0.74916
0.736842
31
27.806452
20.693491
82
false
false
0
0
0
0
0
0
1.967742
false
false
9
a4e0ad5f77a33ae887476b4b5b4073af10bc7ed0
33,861,522,162,117
e235f743ad9bb9b78791fe29119d5defb918951c
/Inheritance/TriangleMain2.java
64c38e4bde5116a37f69aff9602efad05d608390
[]
no_license
rakeshkamble826/Hefshinejavaprogram
https://github.com/rakeshkamble826/Hefshinejavaprogram
27b5f5f900e0f7479e78255422dbd41043cba7ab
98db1a69965388720e0527f9fa2f49ce8af6590a
refs/heads/master
2023-01-06T10:50:08.593000
2020-11-02T17:58:55
2020-11-02T17:58:55
291,300,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Inheritance; public class TriangleMain2 { public static void main(String[] args) { new Square2(); new Rectangle2(); new Triangle3(); Square2 s=new Square2(); s.area(); Rectangle2 r=new Rectangle2(); r.area(); Triangle3 t=new Triangle3(); t.area(); } }
UTF-8
Java
331
java
TriangleMain2.java
Java
[]
null
[]
package Inheritance; public class TriangleMain2 { public static void main(String[] args) { new Square2(); new Rectangle2(); new Triangle3(); Square2 s=new Square2(); s.area(); Rectangle2 r=new Rectangle2(); r.area(); Triangle3 t=new Triangle3(); t.area(); } }
331
0.561934
0.531722
24
11.708333
12.249079
42
false
false
0
0
0
0
0
0
1.875
false
false
9
d0eeb33932ce64f0820385f54636c06698e40704
33,449,205,309,923
3c3c79b617fc465855addf379969ecd969677615
/src/main/java/com/che/recharge/pojo/RechargeAccountPayReply.java
7963f5728024cc6b6326d23bc5cd764ceca77e4b
[]
no_license
847164886/bian-web-api
https://github.com/847164886/bian-web-api
d09bc712e1bbcb3476f1f552976a0f3ddb31f25d
5e39e62ee3424bc77e6d6849da99ffb7b04546c3
refs/heads/master
2022-12-22T03:25:31.216000
2019-11-04T01:11:15
2019-11-04T01:11:15
218,495,563
2
0
null
false
2022-12-16T06:23:32
2019-10-30T09:56:13
2021-04-17T07:32:05
2022-12-16T06:23:32
544
2
0
19
Java
false
false
package com.che.recharge.pojo; import java.util.Date; import java.util.List; import com.che.common.web.Reply; import lombok.Data; import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper=false) public class RechargeAccountPayReply extends Reply { private static final long serialVersionUID = -349341599589508314L; private List<AccountPayRecord> accountPayRecords; @Data @EqualsAndHashCode(callSuper=false) public static final class AccountPayRecord { private String bussinessDes; // 业务描述 private String amount; // 使用金额数 private String create_time; // 余额使用时间 } }
UTF-8
Java
665
java
RechargeAccountPayReply.java
Java
[]
null
[]
package com.che.recharge.pojo; import java.util.Date; import java.util.List; import com.che.common.web.Reply; import lombok.Data; import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper=false) public class RechargeAccountPayReply extends Reply { private static final long serialVersionUID = -349341599589508314L; private List<AccountPayRecord> accountPayRecords; @Data @EqualsAndHashCode(callSuper=false) public static final class AccountPayRecord { private String bussinessDes; // 业务描述 private String amount; // 使用金额数 private String create_time; // 余额使用时间 } }
665
0.738583
0.710236
30
19.166666
19.689394
67
false
false
0
0
0
0
0
0
1.066667
false
false
9
e31d43f7cc140c71cdf6ecb52b5f757dd7be537b
25,314,537,251,592
24663b3307612c71445fe522e2909219fdd65255
/src/test/java/io/vertx/micrometer/backend/PrometheusTestHelper.java
3235d8a094c7c3a22b0e4c8dc2b92d94e5056cd5
[ "Apache-2.0" ]
permissive
vert-x3/vertx-micrometer-metrics
https://github.com/vert-x3/vertx-micrometer-metrics
8f3c7f8c205c6a92e82bc1b4abcd40d3241eb9b6
7ba5460e26f0fa27f8dcb67f4a0a57741a187410
refs/heads/master
2023-08-17T20:50:53.879000
2023-08-01T11:04:59
2023-08-01T11:04:59
116,847,882
44
36
Apache-2.0
false
2023-09-12T09:35:47
2018-01-09T17:26:45
2023-09-07T17:54:48
2023-09-12T09:35:45
706
43
31
3
Java
false
false
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.vertx.micrometer.backend; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpClientResponse; import io.vertx.core.http.HttpMethod; import io.vertx.core.parsetools.RecordParser; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * @author Joel Takvorian */ public final class PrometheusTestHelper { private static final int DEFAULT_MAX_ATTEMPS = 10; private static final long DEFAULT_SLEEP_BEFORE_RETRY_MS = 100; private PrometheusTestHelper() { } public static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<Buffer> bodyReader) { tryConnect(vertx, context, port, host, requestURI, bodyReader, DEFAULT_MAX_ATTEMPS, DEFAULT_SLEEP_BEFORE_RETRY_MS); } public static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<Buffer> bodyReader, int maxAttempts, long sleepBeforeRetryMs) { tryConnect(vertx, context, port, host, requestURI, res -> { context.assertEquals(200, res.statusCode()); res.bodyHandler(bodyReader); }, maxAttempts, sleepBeforeRetryMs, 0); } public static Set<String> getMetricNames(Vertx vertx, TestContext context, int port, String host, String requestURI, long timeout) { return getMetricNames(vertx, context, port, host, requestURI, timeout, DEFAULT_MAX_ATTEMPS, DEFAULT_SLEEP_BEFORE_RETRY_MS); } public static Set<String> getMetricNames(Vertx vertx, TestContext context, int port, String host, String requestURI, long timeout, int maxAttempts, long sleepBeforeRetryMs) { Async async = context.async(); Set<String> metrics = Collections.synchronizedSet(new HashSet<>()); tryConnect(vertx, context, port, host, requestURI, resp -> { context.assertEquals(200, resp.statusCode()); RecordParser parser = RecordParser.newDelimited("\n", resp); parser.exceptionHandler(context::fail).endHandler(v -> { async.countDown(); }).handler(buffer -> { String line = buffer.toString(); if (line.startsWith("# TYPE")) { metrics.add(line.split(" ")[2]); } }); }, maxAttempts, sleepBeforeRetryMs, 0); async.await(timeout); return metrics; } private static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<HttpClientResponse> respHandler, int maxAttempts, long sleepBeforeRetryMs, int attempt) { vertx.createHttpClient().request(HttpMethod.GET, port, host, requestURI).compose(req -> req.send().compose(resp -> { respHandler.handle(resp); return Future.succeededFuture(); }) ).onFailure(cause -> { if (attempt < maxAttempts) { vertx.setTimer(sleepBeforeRetryMs, l -> { tryConnect(vertx, context, port, host, requestURI, respHandler, maxAttempts, sleepBeforeRetryMs, attempt + 1); }); } else { context.fail(cause); } }); } }
UTF-8
Java
4,609
java
PrometheusTestHelper.java
Java
[ { "context": "til.HashSet;\nimport java.util.Set;\n\n/**\n * @author Joel Takvorian\n */\npublic final class PrometheusTestHelper {\n p", "end": 1148, "score": 0.9998692870140076, "start": 1134, "tag": "NAME", "value": "Joel Takvorian" } ]
null
[]
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.vertx.micrometer.backend; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpClientResponse; import io.vertx.core.http.HttpMethod; import io.vertx.core.parsetools.RecordParser; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * @author <NAME> */ public final class PrometheusTestHelper { private static final int DEFAULT_MAX_ATTEMPS = 10; private static final long DEFAULT_SLEEP_BEFORE_RETRY_MS = 100; private PrometheusTestHelper() { } public static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<Buffer> bodyReader) { tryConnect(vertx, context, port, host, requestURI, bodyReader, DEFAULT_MAX_ATTEMPS, DEFAULT_SLEEP_BEFORE_RETRY_MS); } public static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<Buffer> bodyReader, int maxAttempts, long sleepBeforeRetryMs) { tryConnect(vertx, context, port, host, requestURI, res -> { context.assertEquals(200, res.statusCode()); res.bodyHandler(bodyReader); }, maxAttempts, sleepBeforeRetryMs, 0); } public static Set<String> getMetricNames(Vertx vertx, TestContext context, int port, String host, String requestURI, long timeout) { return getMetricNames(vertx, context, port, host, requestURI, timeout, DEFAULT_MAX_ATTEMPS, DEFAULT_SLEEP_BEFORE_RETRY_MS); } public static Set<String> getMetricNames(Vertx vertx, TestContext context, int port, String host, String requestURI, long timeout, int maxAttempts, long sleepBeforeRetryMs) { Async async = context.async(); Set<String> metrics = Collections.synchronizedSet(new HashSet<>()); tryConnect(vertx, context, port, host, requestURI, resp -> { context.assertEquals(200, resp.statusCode()); RecordParser parser = RecordParser.newDelimited("\n", resp); parser.exceptionHandler(context::fail).endHandler(v -> { async.countDown(); }).handler(buffer -> { String line = buffer.toString(); if (line.startsWith("# TYPE")) { metrics.add(line.split(" ")[2]); } }); }, maxAttempts, sleepBeforeRetryMs, 0); async.await(timeout); return metrics; } private static void tryConnect(Vertx vertx, TestContext context, int port, String host, String requestURI, Handler<HttpClientResponse> respHandler, int maxAttempts, long sleepBeforeRetryMs, int attempt) { vertx.createHttpClient().request(HttpMethod.GET, port, host, requestURI).compose(req -> req.send().compose(resp -> { respHandler.handle(resp); return Future.succeededFuture(); }) ).onFailure(cause -> { if (attempt < maxAttempts) { vertx.setTimer(sleepBeforeRetryMs, l -> { tryConnect(vertx, context, port, host, requestURI, respHandler, maxAttempts, sleepBeforeRetryMs, attempt + 1); }); } else { context.fail(cause); } }); } }
4,601
0.593404
0.588414
115
39.078262
29.603216
137
false
false
0
0
0
0
0
0
1.043478
false
false
9
a56287c033c8db259f992fe5d24ef48906821ca6
11,081,015,636,244
87c6cfa80c5ad3a1a00cfd09d99c79c02deca0d1
/src/main/java/spring/web/common/exception/NormalException.java
b0c057db509461eaaa3504310ce6e70fd64a0802
[]
no_license
Bugu2015/spring-web-common
https://github.com/Bugu2015/spring-web-common
fa60370ac274d4264725194955b47b0a924241d2
16071770c788c4eb85ba03421d117d99f7fd9a28
refs/heads/master
2022-10-18T23:10:40.492000
2019-08-08T08:11:35
2019-08-08T08:11:35
200,845,772
0
0
null
false
2022-10-19T01:12:09
2019-08-06T12:20:47
2019-08-08T08:13:11
2022-10-19T01:12:06
48
0
0
8
Java
false
false
package spring.web.common.exception; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import spring.web.common.enums.BaseEnum; public class NormalException extends BaseException { private static final Log log = LogFactory.getLog(NormalException.class); public NormalException(BaseEnum baseEnum) { super(baseEnum); } public NormalException(BaseEnum baseEnum, Exception e) { super(baseEnum); log.debug(e); } }
UTF-8
Java
494
java
NormalException.java
Java
[]
null
[]
package spring.web.common.exception; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import spring.web.common.enums.BaseEnum; public class NormalException extends BaseException { private static final Log log = LogFactory.getLog(NormalException.class); public NormalException(BaseEnum baseEnum) { super(baseEnum); } public NormalException(BaseEnum baseEnum, Exception e) { super(baseEnum); log.debug(e); } }
494
0.730769
0.730769
20
23.700001
23.520416
76
false
false
0
0
0
0
0
0
0.45
false
false
9
d482ff0ff8d83df67302c6b9722c3a8b66e02457
38,646,115,753,604
8f334a7171e41490420a7d308c90640531cbb66a
/app/src/main/java/com/cxxt/mickys/playwithme/view/activity/IntroActivity.java
3082e3cbb740c637fb185fd187198319e3fe088d
[ "Apache-2.0" ]
permissive
huangyz0918/PlayGo
https://github.com/huangyz0918/PlayGo
eb494edc622af48cd5e869fe930d29b116c6e2c4
70f1eea46f46f89860406fd9ffde53e480171e54
refs/heads/master
2018-12-30T13:53:56.828000
2018-06-05T12:07:44
2018-06-05T12:07:44
84,689,750
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2018 YiZheng Huang * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cxxt.mickys.playwithme.view.activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.FloatRange; import android.support.annotation.Nullable; import android.view.View; import com.cxxt.mickys.playwithme.R; import agency.tango.materialintroscreen.MaterialIntroActivity; import agency.tango.materialintroscreen.MessageButtonBehaviour; import agency.tango.materialintroscreen.SlideFragmentBuilder; /** * Created by huangyz0918 on 2018/2/21. * 引导页面 * * @author huangyz0918 */ public class IntroActivity extends MaterialIntroActivity { private boolean isFirstIn = false; // private boolean isRooted = false; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkFirst(); // setGoGuide(); } private void setGoHome() { Intent i = new Intent(this, LoginActivity.class); startActivity(i); finish(); } private void setGoGuide() { getBackButtonTranslationWrapper() .setEnterTranslation((View view, @FloatRange(from = 0, to = 1.0) float percentage) -> { view.setAlpha(percentage); }); /* * 设置第1个引导页面 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.colorPrimary) .buttonsColor(R.color.ripple_red) .title("认知") .description("信息爆照年代,是否怀念线下生活?") .build()); /* * 设置第2个引导页面 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.ripple_red) .buttonsColor(R.color.colorPrimary) .title("交友") .description("志同道合的朋友,其实就在你身边") .build()); /* * 设置第3个引导页面 * 必要的权限请求 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.colorPrimary) .buttonsColor(R.color.ripple_red) .title("开始") .description("进入约玩,开启现充人生!") .build(), new MessageButtonBehaviour((View v) -> { startActivity(new Intent(this, LoginActivity.class)); }, "进入")); } private void checkFirst() { SharedPreferences preferences = getSharedPreferences("Hello", MODE_PRIVATE); isFirstIn = preferences.getBoolean("isFirstIn", true); if (!isFirstIn) { setGoHome(); } else { setGoGuide(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("isFirstIn", false); editor.apply(); } } @Override public void onFinish() { super.onFinish(); startActivity(new Intent(this, LoginActivity.class)); } }
UTF-8
Java
3,672
java
IntroActivity.java
Java
[ { "context": "/*\n * Copyright 2018 YiZheng Huang\n *\n * Licensed under the Apache License, Version ", "end": 34, "score": 0.9998154044151306, "start": 21, "tag": "NAME", "value": "YiZheng Huang" }, { "context": "troscreen.SlideFragmentBuilder;\n\n/**\n * Created by huangyz0918 on 2...
null
[]
/* * Copyright 2018 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cxxt.mickys.playwithme.view.activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.FloatRange; import android.support.annotation.Nullable; import android.view.View; import com.cxxt.mickys.playwithme.R; import agency.tango.materialintroscreen.MaterialIntroActivity; import agency.tango.materialintroscreen.MessageButtonBehaviour; import agency.tango.materialintroscreen.SlideFragmentBuilder; /** * Created by huangyz0918 on 2018/2/21. * 引导页面 * * @author huangyz0918 */ public class IntroActivity extends MaterialIntroActivity { private boolean isFirstIn = false; // private boolean isRooted = false; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkFirst(); // setGoGuide(); } private void setGoHome() { Intent i = new Intent(this, LoginActivity.class); startActivity(i); finish(); } private void setGoGuide() { getBackButtonTranslationWrapper() .setEnterTranslation((View view, @FloatRange(from = 0, to = 1.0) float percentage) -> { view.setAlpha(percentage); }); /* * 设置第1个引导页面 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.colorPrimary) .buttonsColor(R.color.ripple_red) .title("认知") .description("信息爆照年代,是否怀念线下生活?") .build()); /* * 设置第2个引导页面 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.ripple_red) .buttonsColor(R.color.colorPrimary) .title("交友") .description("志同道合的朋友,其实就在你身边") .build()); /* * 设置第3个引导页面 * 必要的权限请求 * */ addSlide(new SlideFragmentBuilder() .backgroundColor(R.color.colorPrimary) .buttonsColor(R.color.ripple_red) .title("开始") .description("进入约玩,开启现充人生!") .build(), new MessageButtonBehaviour((View v) -> { startActivity(new Intent(this, LoginActivity.class)); }, "进入")); } private void checkFirst() { SharedPreferences preferences = getSharedPreferences("Hello", MODE_PRIVATE); isFirstIn = preferences.getBoolean("isFirstIn", true); if (!isFirstIn) { setGoHome(); } else { setGoGuide(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("isFirstIn", false); editor.apply(); } } @Override public void onFinish() { super.onFinish(); startActivity(new Intent(this, LoginActivity.class)); } }
3,665
0.619714
0.611429
116
29.172413
23.724815
103
false
false
0
0
0
0
0
0
0.422414
false
false
9
bc71b64d8470f21c46f741422686edb93fca9b9e
38,646,115,753,121
cd96fd28b59ad57a65a4e28045155331f4b418a5
/src/nl/ansuz/android/steam/vo/economy/ItemQualityNamesVO.java
fd9ec4c79eb0a532c97058ab25b02d565435d21d
[]
no_license
SKYnv/dota2-api-wrapper
https://github.com/SKYnv/dota2-api-wrapper
143394ed90b453827b27b30cf6d849066e30b33d
9f945173f188c8587988870dcdbdcf53351e564c
refs/heads/master
2021-01-17T10:21:38.659000
2013-10-03T13:08:32
2013-10-03T13:08:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.ansuz.android.steam.vo.economy; import com.google.gson.annotations.SerializedName; /** * * @author Wijnand Warren */ public class ItemQualityNamesVO { @SerializedName("normal") public String normal; @SerializedName("genuine") public String genuine; @SerializedName("vStringage") public String vStringage; @SerializedName("unusual") public String unusual; @SerializedName("unique") public String unique; @SerializedName("community") public String community; @SerializedName("developer") public String developer; @SerializedName("selfmade") public String selfmade; @SerializedName("customized") public String customized; @SerializedName("strange") public String strange; @SerializedName("completed") public String completed; @SerializedName("haunted") public String haunted; @SerializedName("tournament") public String tournament; }
UTF-8
Java
901
java
ItemQualityNamesVO.java
Java
[ { "context": "on.annotations.SerializedName;\n\n/**\n * \n * @author Wijnand Warren\n */\npublic class ItemQualityNamesVO {\n\n\t@Serializ", "end": 129, "score": 0.999855637550354, "start": 115, "tag": "NAME", "value": "Wijnand Warren" } ]
null
[]
package nl.ansuz.android.steam.vo.economy; import com.google.gson.annotations.SerializedName; /** * * @author <NAME> */ public class ItemQualityNamesVO { @SerializedName("normal") public String normal; @SerializedName("genuine") public String genuine; @SerializedName("vStringage") public String vStringage; @SerializedName("unusual") public String unusual; @SerializedName("unique") public String unique; @SerializedName("community") public String community; @SerializedName("developer") public String developer; @SerializedName("selfmade") public String selfmade; @SerializedName("customized") public String customized; @SerializedName("strange") public String strange; @SerializedName("completed") public String completed; @SerializedName("haunted") public String haunted; @SerializedName("tournament") public String tournament; }
893
0.749168
0.749168
50
17.02
13.691588
50
false
false
0
0
0
0
0
0
1.08
false
false
9
a1983f924960005f8d4192f23d5149ff0e3e3301
38,242,388,835,686
ca9b74f57aea79f7f8213c3a6bda9049de7a0f7a
/src/main/java/com/gionee/uaam2/util/IdObjectIncreaseUtil.java
720aa9fff01bf427eaf54090960ef0cdaba36dd7
[]
no_license
shenshuangxi/uaam2
https://github.com/shenshuangxi/uaam2
d560ecd5117b04c529b4511ca1e311d8e717effc
141d897ca6c80dad2c078e8f2f091a969b98a6e6
refs/heads/master
2021-01-19T07:29:05.070000
2017-04-07T12:43:07
2017-04-07T12:43:07
87,544,419
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gionee.uaam2.util; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; import com.gionee.uaam2.dao.LdapDao; import com.gionee.uaam2.mode.ldap.IdObject; @Component public class IdObjectIncreaseUtil implements ApplicationContextAware { public static final Long idSegment = 5l; public static Map<String,Map<Long,Long>> idMap = new HashMap<String, Map<Long,Long>>(); private static ApplicationContext applicationContext; public static String increaseId(String objName){ Long currentIdCount = 0l; Long maxIdCount = 5l; if(idMap.containsKey(objName)){ Entry<Long, Long> idEntry = idMap.get(objName).entrySet().iterator().next(); currentIdCount = idEntry.getKey(); maxIdCount = idEntry.getValue(); if(currentIdCount+1>=maxIdCount){ currentIdCount = maxIdCount; maxIdCount = maxIdCount + idSegment; IdObject idObject = new IdObject(); idObject.setName(objName.toLowerCase()); idObject.setIdCount(maxIdCount); LdapDao ldapDao = (LdapDao) applicationContext.getBean("ldapDao"); ldapDao.update(idObject); }else{ currentIdCount++; } }else{ IdObject idObject = new IdObject(); idObject.setName(objName.toLowerCase()); LdapDao ldapDao = (LdapDao) applicationContext.getBean("ldapDao"); List<IdObject> idObjects = ldapDao.find(idObject); if(idObjects!=null&&idObjects.size()==1){ currentIdCount = idObjects.get(0).getIdCount()+1+idSegment; maxIdCount = currentIdCount + idSegment; idObject.setIdCount(maxIdCount); ldapDao.update(idObject); } } Map<Long,Long> countMap = new HashMap<Long, Long>(); countMap.put(currentIdCount, maxIdCount); idMap.put(objName, countMap); return currentIdCount+""; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { IdObjectIncreaseUtil.applicationContext = applicationContext; } }
UTF-8
Java
2,157
java
IdObjectIncreaseUtil.java
Java
[]
null
[]
package com.gionee.uaam2.util; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; import com.gionee.uaam2.dao.LdapDao; import com.gionee.uaam2.mode.ldap.IdObject; @Component public class IdObjectIncreaseUtil implements ApplicationContextAware { public static final Long idSegment = 5l; public static Map<String,Map<Long,Long>> idMap = new HashMap<String, Map<Long,Long>>(); private static ApplicationContext applicationContext; public static String increaseId(String objName){ Long currentIdCount = 0l; Long maxIdCount = 5l; if(idMap.containsKey(objName)){ Entry<Long, Long> idEntry = idMap.get(objName).entrySet().iterator().next(); currentIdCount = idEntry.getKey(); maxIdCount = idEntry.getValue(); if(currentIdCount+1>=maxIdCount){ currentIdCount = maxIdCount; maxIdCount = maxIdCount + idSegment; IdObject idObject = new IdObject(); idObject.setName(objName.toLowerCase()); idObject.setIdCount(maxIdCount); LdapDao ldapDao = (LdapDao) applicationContext.getBean("ldapDao"); ldapDao.update(idObject); }else{ currentIdCount++; } }else{ IdObject idObject = new IdObject(); idObject.setName(objName.toLowerCase()); LdapDao ldapDao = (LdapDao) applicationContext.getBean("ldapDao"); List<IdObject> idObjects = ldapDao.find(idObject); if(idObjects!=null&&idObjects.size()==1){ currentIdCount = idObjects.get(0).getIdCount()+1+idSegment; maxIdCount = currentIdCount + idSegment; idObject.setIdCount(maxIdCount); ldapDao.update(idObject); } } Map<Long,Long> countMap = new HashMap<Long, Long>(); countMap.put(currentIdCount, maxIdCount); idMap.put(objName, countMap); return currentIdCount+""; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { IdObjectIncreaseUtil.applicationContext = applicationContext; } }
2,157
0.753825
0.749189
66
31.681818
22.844772
88
false
false
0
0
0
0
0
0
2.575758
false
false
9