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
79c196dda6b48fabceb10b7d2c30ad9d08257dc2
16,733,192,602,804
0be558621988f38e096a3dcea090b3234871dad0
/src/main/java/com/web/vehiclerouting/optaplanner/domain/timewindowed/TimeWindowedCustomer.java
d2550af1c075f4eb03acd3141a7ffcebe48e0029
[]
no_license
mchhaily/vrp
https://github.com/mchhaily/vrp
a27da251b1d71722d0c6d01b4557df298933fa86
bbd9cf52d74572160d6270656077a982b1a475b9
refs/heads/master
2021-05-27T15:19:36.705000
2014-07-07T01:52:22
2014-07-07T01:52:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2012 JBoss Inc * * 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.web.vehiclerouting.optaplanner.domain.timewindowed; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.web.vehiclerouting.optaplanner.domain.Customer; @XStreamAlias("VrpTimeWindowedCustomer") public class TimeWindowedCustomer extends Customer { // Times are multiplied by 1000 to avoid floating point arithmetic rounding errors private int milliReadyTime; private int milliDueTime; private int milliServiceDuration; // Shadow variable private Integer milliArrivalTime; public int getMilliReadyTime() { return milliReadyTime; } public void setMilliReadyTime(int milliReadyTime) { this.milliReadyTime = milliReadyTime; } public int getMilliDueTime() { return milliDueTime; } public void setMilliDueTime(int milliDueTime) { this.milliDueTime = milliDueTime; } public int getMilliServiceDuration() { return milliServiceDuration; } public void setMilliServiceDuration(int milliServiceDuration) { this.milliServiceDuration = milliServiceDuration; } public Integer getMilliArrivalTime() { return milliArrivalTime; } public void setMilliArrivalTime(Integer milliArrivalTime) { this.milliArrivalTime = milliArrivalTime; } // ************************************************************************ // Complex methods // ************************************************************************ public String getTimeWindowLabel() { return milliReadyTime + "-" + milliDueTime; } public Integer getDepartureTime() { if (milliArrivalTime == null) { return null; } return Math.max(milliArrivalTime, milliReadyTime) + milliServiceDuration; } public boolean isArrivalBeforeReadyTime() { return milliArrivalTime != null && milliArrivalTime < milliReadyTime; } public boolean isArrivalAfterDueTime() { return milliArrivalTime != null && milliDueTime < milliArrivalTime; } @Override public TimeWindowedCustomer getNextCustomer() { return (TimeWindowedCustomer) super.getNextCustomer(); } }
UTF-8
Java
2,822
java
TimeWindowedCustomer.java
Java
[]
null
[]
/* * Copyright 2012 JBoss Inc * * 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.web.vehiclerouting.optaplanner.domain.timewindowed; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.web.vehiclerouting.optaplanner.domain.Customer; @XStreamAlias("VrpTimeWindowedCustomer") public class TimeWindowedCustomer extends Customer { // Times are multiplied by 1000 to avoid floating point arithmetic rounding errors private int milliReadyTime; private int milliDueTime; private int milliServiceDuration; // Shadow variable private Integer milliArrivalTime; public int getMilliReadyTime() { return milliReadyTime; } public void setMilliReadyTime(int milliReadyTime) { this.milliReadyTime = milliReadyTime; } public int getMilliDueTime() { return milliDueTime; } public void setMilliDueTime(int milliDueTime) { this.milliDueTime = milliDueTime; } public int getMilliServiceDuration() { return milliServiceDuration; } public void setMilliServiceDuration(int milliServiceDuration) { this.milliServiceDuration = milliServiceDuration; } public Integer getMilliArrivalTime() { return milliArrivalTime; } public void setMilliArrivalTime(Integer milliArrivalTime) { this.milliArrivalTime = milliArrivalTime; } // ************************************************************************ // Complex methods // ************************************************************************ public String getTimeWindowLabel() { return milliReadyTime + "-" + milliDueTime; } public Integer getDepartureTime() { if (milliArrivalTime == null) { return null; } return Math.max(milliArrivalTime, milliReadyTime) + milliServiceDuration; } public boolean isArrivalBeforeReadyTime() { return milliArrivalTime != null && milliArrivalTime < milliReadyTime; } public boolean isArrivalAfterDueTime() { return milliArrivalTime != null && milliDueTime < milliArrivalTime; } @Override public TimeWindowedCustomer getNextCustomer() { return (TimeWindowedCustomer) super.getNextCustomer(); } }
2,822
0.663359
0.659107
95
28.705263
26.039595
86
false
false
0
0
0
0
0
0
0.284211
false
false
11
d2f8e5d6949b95123bd90e611abfdad3c151774a
16,733,192,604,430
0052503af79adec9f7ec5d1a0ce92c6820953f9b
/src/com/googlecode/tda367/denty/core/level/.svn/text-base/Level.java.svn-base
d6bb31e9916a105ed240c01b1d6339d98c7ea566
[]
no_license
kirayatail/tda367-denty
https://github.com/kirayatail/tda367-denty
9f17e219e18f990ebbeda285a8c6c315ca01adc4
2658714f701eef6326e7400e00b081d7ff7b0e3f
refs/heads/master
2021-01-06T20:41:41.526000
2013-03-14T12:35:10
2013-03-14T12:35:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.googlecode.tda367.denty.core.level; import java.awt.Dimension; import java.awt.Point; import java.util.List; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.World; import com.googlecode.tda367.denty.core.camera.Camera; import com.googlecode.tda367.denty.core.dynamicbody.DynamicBody; import com.googlecode.tda367.denty.core.dynamicbody.MoveableBody; /** * Interface for the level, interfacing with DentyModel and the view classes. * */ public interface Level { public void placeBlock(int x, int y); public void throwNewBlock(float x, float y, Vec2 force); public void releaseBodies(float x1, float y1, float x2, float y2); public void update(); public void restart(); public boolean isAreaFree(float x1, float y1, float x2, float y2); public boolean canReleaseBody(float x1, float y1, float x2, float y2); public boolean canAddBlock(); public String getName(); public Dimension getDimension(); public Point getDentyStartPosition(); public Point getGoalPosition(); public int getMaxAvailableBlocks(); public int getBlocksAvailableFromStart(); public String getTiledMapPath(); public Camera getCamera(); public World getWorld(); public MoveableBody getDenty(); public List<DynamicBody> getDynamicBodies(); }
UTF-8
Java
1,329
Level.java.svn-base
Java
[]
null
[]
package com.googlecode.tda367.denty.core.level; import java.awt.Dimension; import java.awt.Point; import java.util.List; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.World; import com.googlecode.tda367.denty.core.camera.Camera; import com.googlecode.tda367.denty.core.dynamicbody.DynamicBody; import com.googlecode.tda367.denty.core.dynamicbody.MoveableBody; /** * Interface for the level, interfacing with DentyModel and the view classes. * */ public interface Level { public void placeBlock(int x, int y); public void throwNewBlock(float x, float y, Vec2 force); public void releaseBodies(float x1, float y1, float x2, float y2); public void update(); public void restart(); public boolean isAreaFree(float x1, float y1, float x2, float y2); public boolean canReleaseBody(float x1, float y1, float x2, float y2); public boolean canAddBlock(); public String getName(); public Dimension getDimension(); public Point getDentyStartPosition(); public Point getGoalPosition(); public int getMaxAvailableBlocks(); public int getBlocksAvailableFromStart(); public String getTiledMapPath(); public Camera getCamera(); public World getWorld(); public MoveableBody getDenty(); public List<DynamicBody> getDynamicBodies(); }
1,329
0.735892
0.714823
56
21.732143
23.346376
77
false
false
0
0
0
0
0
0
1.071429
false
false
11
f1165a8f1e4989b9da4728335063b51067f1bda0
16,956,530,908,750
ced210b5a899301ea186bef5eb22d3fcd8522eb5
/insta_mypage/src/service/UsersServiceImpl.java
9475cc5536cd5033958818159c8fb91321ab0d54
[]
no_license
hoonsbory/instaProject
https://github.com/hoonsbory/instaProject
9e988e153488242a706fd88394af74322184ba41
82624b71410a3eb3d77fa9d861d3db3725b116cc
refs/heads/master
2020-07-26T20:25:39.453000
2019-09-27T07:50:07
2019-09-27T07:50:07
208,756,544
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package service; import java.util.List; import dao.UsersDAO; import vo.UsersVO; public class UsersServiceImpl implements UsersService { UsersDAO dao; public UsersServiceImpl() {} public UsersServiceImpl(UsersDAO dao) { this.dao = dao; } @Override public List<UsersVO> searchAllUsers() { // TODO Auto-generated method stub return dao.searchAllUsers(); } @Override public int loginUser(UsersVO vo) { // TODO Auto-generated method stub return dao.loginUser(vo); } @Override public int addUser(UsersVO vo) { // TODO Auto-generated method stub return dao.insertUser(vo); } @Override public int dropUser(int id) { // TODO Auto-generated method stub return dao.deleteUser(id); } @Override public List<String> searchUserAllImgs(int id) { // TODO Auto-generated method stub return dao.searchUserAllImgs(id); } @Override public UsersVO searchUser(int id) { // TODO Auto-generated method stub return dao.searchUser(id); } @Override public int updateUserEmailName(UsersVO vo) { // TODO Auto-generated method stub return (dao.updateUser("email",vo.getEmail(),vo.getId())*dao.updateUser("name",vo.getName(),vo.getId())); } @Override public int updateUserPassword(UsersVO vo) { // TODO Auto-generated method stub return dao.updateUser("password",vo.getPassword(),vo.getId()); } @Override public int updateUserImg(UsersVO vo) { // TODO Auto-generated method stub return dao.updateUser("img",vo.getImg(),vo.getId()); } }
UTF-8
Java
1,557
java
UsersServiceImpl.java
Java
[]
null
[]
package service; import java.util.List; import dao.UsersDAO; import vo.UsersVO; public class UsersServiceImpl implements UsersService { UsersDAO dao; public UsersServiceImpl() {} public UsersServiceImpl(UsersDAO dao) { this.dao = dao; } @Override public List<UsersVO> searchAllUsers() { // TODO Auto-generated method stub return dao.searchAllUsers(); } @Override public int loginUser(UsersVO vo) { // TODO Auto-generated method stub return dao.loginUser(vo); } @Override public int addUser(UsersVO vo) { // TODO Auto-generated method stub return dao.insertUser(vo); } @Override public int dropUser(int id) { // TODO Auto-generated method stub return dao.deleteUser(id); } @Override public List<String> searchUserAllImgs(int id) { // TODO Auto-generated method stub return dao.searchUserAllImgs(id); } @Override public UsersVO searchUser(int id) { // TODO Auto-generated method stub return dao.searchUser(id); } @Override public int updateUserEmailName(UsersVO vo) { // TODO Auto-generated method stub return (dao.updateUser("email",vo.getEmail(),vo.getId())*dao.updateUser("name",vo.getName(),vo.getId())); } @Override public int updateUserPassword(UsersVO vo) { // TODO Auto-generated method stub return dao.updateUser("password",vo.getPassword(),vo.getId()); } @Override public int updateUserImg(UsersVO vo) { // TODO Auto-generated method stub return dao.updateUser("img",vo.getImg(),vo.getId()); } }
1,557
0.687861
0.687861
68
20.897058
20.252914
107
false
false
0
0
0
0
0
0
1.411765
false
false
11
bbf06c1e80042f6652d0d09dc3570c06652fccbe
8,821,862,831,082
dff1ddbd01efb9df798f4a71edd4c6f5a33fb360
/src/main/java/br/avaliatri/AvaliatriApplication.java
f7cb498393021025f41787a4214e509b10d4ba51
[]
no_license
RennanPrysthon/avaliatri_api
https://github.com/RennanPrysthon/avaliatri_api
0b83966cc71c83ee386a2bc4112c129d306133ec
bd52f66754b66e3856d837dead1f8eee6540e61d
refs/heads/master
2022-09-23T03:21:04.634000
2020-06-06T00:28:10
2020-06-06T00:28:10
259,072,776
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.avaliatri; import br.avaliatri.enums.Perfil; import br.avaliatri.models.Usuario; import br.avaliatri.repositories.UsuarioRepository; import br.avaliatri.services.DatabaseInstantiate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.core.env.Environment; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import java.util.logging.Level; import java.util.logging.Logger; @SpringBootApplication public class AvaliatriApplication extends SpringBootServletInitializer implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(AvaliatriApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(AvaliatriApplication.class); } private static final Logger logger = Logger.getLogger(AvaliatriApplication.class.getName()); @Autowired private Environment env; @Autowired private DatabaseInstantiate db; @Autowired private UsuarioRepository usuarioRepository; @Autowired private BCryptPasswordEncoder pe; @Override public void run(String... args) throws Exception { logger.log(Level.INFO, "Iniciando projeto " + env.getProperty("app.name") + " no profile: " + env.getProperty("spring.profiles.active")); if (env.getProperty("spring.profiles.active").contains("test")) { db.init(); } } }
UTF-8
Java
1,732
java
AvaliatriApplication.java
Java
[]
null
[]
package br.avaliatri; import br.avaliatri.enums.Perfil; import br.avaliatri.models.Usuario; import br.avaliatri.repositories.UsuarioRepository; import br.avaliatri.services.DatabaseInstantiate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.core.env.Environment; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import java.util.logging.Level; import java.util.logging.Logger; @SpringBootApplication public class AvaliatriApplication extends SpringBootServletInitializer implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(AvaliatriApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(AvaliatriApplication.class); } private static final Logger logger = Logger.getLogger(AvaliatriApplication.class.getName()); @Autowired private Environment env; @Autowired private DatabaseInstantiate db; @Autowired private UsuarioRepository usuarioRepository; @Autowired private BCryptPasswordEncoder pe; @Override public void run(String... args) throws Exception { logger.log(Level.INFO, "Iniciando projeto " + env.getProperty("app.name") + " no profile: " + env.getProperty("spring.profiles.active")); if (env.getProperty("spring.profiles.active").contains("test")) { db.init(); } } }
1,732
0.821594
0.821594
47
35.851063
31.972048
139
false
false
0
0
0
0
0
0
1.191489
false
false
11
2d8ce970c45ca5e122fa1c2f84025f7a584fb76a
23,811,298,712,518
97670ebe3548358c384c1f4442c8a05cd62a5c20
/Backend/src/Restaurant/restaurantDB.java
9a6fb4d26ca245112232eb81a4a63f72c961ffee
[]
no_license
nyilkhan/We.Travel
https://github.com/nyilkhan/We.Travel
a24bf3496974be21b09627267dfbbdab7144b55a
190a1bf67867bdb28d3abb81588ff991ead10033
refs/heads/master
2022-07-22T17:33:05.423000
2019-05-31T02:26:08
2019-05-31T02:26:08
189,511,806
0
0
null
false
2022-06-21T01:12:06
2019-05-31T02:13:53
2019-05-31T02:27:07
2022-06-21T01:12:03
129,165
0
0
4
Swift
false
false
package Restaurant; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; 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 com.google.gson.Gson; @WebServlet("/restaurantDB") public class restaurantDB extends HttpServlet { private static final long serialVersionUID = 1L; public restaurantDB() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { StringBuilder sb = new StringBuilder(); BufferedReader br = request.getReader(); try { String line = ""; while((line = br.readLine()) != null) { sb.append(line).append('\n'); } }finally { br.close(); } String info = sb.toString(); Gson gson = new Gson(); restaurantInfo RI = gson.fromJson(info, restaurantInfo.class); String name = RI.name; String price = RI.price; String rating = RI.rating; String image = RI.image; String url = RI.url; String address = RI.address; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PrintWriter pr = response.getWriter(); String info_back = null; try { Class.forName("com.mysql.cj.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://csci201-final.cmudegxvolac.us-east-2.rds.amazonaws.com/csci201?user=csci201&password=jeffereymiller"); ps = conn.prepareStatement("INSERT INTO Restaurant(name,address,rating,price,image,link) VALUES (?,?,?,?,?,?)"); ps.setString(1, name); ps.setString(2, address); ps.setString(3, rating); ps.setString(4, price); ps.setString(5, image); ps.setString(6, url); ps.execute(); info_back = "{info: \"Restaurant added to database\"}"; pr.print(info_back); ps.close(); }catch (SQLException sqle) { System.out.println("sqle: " + sqle.getMessage()); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
UTF-8
Java
2,255
java
restaurantDB.java
Java
[ { "context": "inal.cmudegxvolac.us-east-2.rds.amazonaws.com/csci201?user=csci201&password=jeffereymiller\");\n\t\t\tps =", "end": 1654, "score": 0.6710995435714722, "start": 1653, "tag": "USERNAME", "value": "2" }, { "context": "gxvolac.us-east-2.rds.amazonaws.com/csci201?user=csci201&password=jeffereymiller\");\n\t\t\tps = conn.prepareSt", "end": 1669, "score": 0.8168346881866455, "start": 1663, "tag": "USERNAME", "value": "sci201" }, { "context": "2.rds.amazonaws.com/csci201?user=csci201&password=jeffereymiller\");\n\t\t\tps = conn.prepareStatement(\"INSERT INTO Res", "end": 1693, "score": 0.9652719497680664, "start": 1679, "tag": "PASSWORD", "value": "jeffereymiller" } ]
null
[]
package Restaurant; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; 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 com.google.gson.Gson; @WebServlet("/restaurantDB") public class restaurantDB extends HttpServlet { private static final long serialVersionUID = 1L; public restaurantDB() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { StringBuilder sb = new StringBuilder(); BufferedReader br = request.getReader(); try { String line = ""; while((line = br.readLine()) != null) { sb.append(line).append('\n'); } }finally { br.close(); } String info = sb.toString(); Gson gson = new Gson(); restaurantInfo RI = gson.fromJson(info, restaurantInfo.class); String name = RI.name; String price = RI.price; String rating = RI.rating; String image = RI.image; String url = RI.url; String address = RI.address; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; PrintWriter pr = response.getWriter(); String info_back = null; try { Class.forName("com.mysql.cj.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://csci201-final.cmudegxvolac.us-east-2.rds.amazonaws.com/csci201?user=csci201&password=<PASSWORD>"); ps = conn.prepareStatement("INSERT INTO Restaurant(name,address,rating,price,image,link) VALUES (?,?,?,?,?,?)"); ps.setString(1, name); ps.setString(2, address); ps.setString(3, rating); ps.setString(4, price); ps.setString(5, image); ps.setString(6, url); ps.execute(); info_back = "{info: \"Restaurant added to database\"}"; pr.print(info_back); ps.close(); }catch (SQLException sqle) { System.out.println("sqle: " + sqle.getMessage()); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
2,251
0.705987
0.698448
84
25.845238
25.672615
154
false
false
0
0
0
0
0
0
2.285714
false
false
11
055b6e1a9505153a923d5fd02cc9ad20ab743dff
28,922,309,810,797
62d8ad3266544b459a8751f7f760653d246c47b8
/java/src/main/java/Leetcode/GoogleMock/OnsiteQ3.java
9ea3eeb78e4496af64ed8fd2bc8696e977d5e718
[]
no_license
ymlai87416/algorithm_practice
https://github.com/ymlai87416/algorithm_practice
9311f9f54625f6a706d9432d6b0a5ca6be9b73b9
f04daba988982f45e63623e76b1953e8b56fbfad
refs/heads/master
2023-04-15T23:30:34.137000
2023-03-30T23:05:21
2023-03-30T23:05:21
58,758,540
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Leetcode.GoogleMock; import java.util.*; public class OnsiteQ3 { public boolean canConvert(String str1, String str2) { HashMap<Character, Character> rule = new HashMap<>(); boolean[] ok = new boolean[26]; boolean str1Full26= true; for (int i = 0; i < 26; i++) { ok[i] = false; } for (int i = 0; i < str1.length(); i++) { char s = str1.charAt(i); ok[s-'a'] = true; } for (int i = 0; i < 26; i++) { if(!ok[i]){ str1Full26 = false; break; } } boolean str2Full26= true; for (int i = 0; i < 26; i++) { ok[i] = false; } for (int i = 0; i < str2.length(); i++) { char s = str2.charAt(i); ok[s-'a'] = true; } for (int i = 0; i < 26; i++) { if(!ok[i]){ str2Full26 = false; break; } } //if a full mapping, return false if difference if(str1Full26 && str2Full26 ) return str1.compareTo(str2) == 0; for (int i = 0; i < str1.length(); i++) { char s = str1.charAt(i); char t = str2.charAt(i); if(!rule.containsKey(s)) rule.put(s, t); //check if(rule.get(s) != t) return false; } return true; } public static void main(String[] args){ OnsiteQ3 s = new OnsiteQ3(); System.out.println(s.canConvert("aabcc", "ccdee")); System.out.println(s.canConvert("leetcode", "codeleet")); System.out.println(s.canConvert("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz")); System.out.println(s.canConvert("abcdefghijklmnopqrstuvwxyz", "bcdefghijklmnopqrstuvwxyza")); } }
UTF-8
Java
1,851
java
OnsiteQ3.java
Java
[]
null
[]
package Leetcode.GoogleMock; import java.util.*; public class OnsiteQ3 { public boolean canConvert(String str1, String str2) { HashMap<Character, Character> rule = new HashMap<>(); boolean[] ok = new boolean[26]; boolean str1Full26= true; for (int i = 0; i < 26; i++) { ok[i] = false; } for (int i = 0; i < str1.length(); i++) { char s = str1.charAt(i); ok[s-'a'] = true; } for (int i = 0; i < 26; i++) { if(!ok[i]){ str1Full26 = false; break; } } boolean str2Full26= true; for (int i = 0; i < 26; i++) { ok[i] = false; } for (int i = 0; i < str2.length(); i++) { char s = str2.charAt(i); ok[s-'a'] = true; } for (int i = 0; i < 26; i++) { if(!ok[i]){ str2Full26 = false; break; } } //if a full mapping, return false if difference if(str1Full26 && str2Full26 ) return str1.compareTo(str2) == 0; for (int i = 0; i < str1.length(); i++) { char s = str1.charAt(i); char t = str2.charAt(i); if(!rule.containsKey(s)) rule.put(s, t); //check if(rule.get(s) != t) return false; } return true; } public static void main(String[] args){ OnsiteQ3 s = new OnsiteQ3(); System.out.println(s.canConvert("aabcc", "ccdee")); System.out.println(s.canConvert("leetcode", "codeleet")); System.out.println(s.canConvert("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz")); System.out.println(s.canConvert("abcdefghijklmnopqrstuvwxyz", "bcdefghijklmnopqrstuvwxyza")); } }
1,851
0.481902
0.454889
65
27.461538
22.602299
101
false
false
0
0
0
0
0
0
0.753846
false
false
11
c094ada9435b4ec564c9975f8f53b254af7113f9
30,666,066,534,070
9268552410aa0a94e306f9ad4cec66260de72acf
/ump/src/main/java/com/hhz/ump/web/webim/UserMessageAction.java
a8dd9b01c5a58051719b58fdf93cd265f2a8a6e8
[]
no_license
cckmit/um
https://github.com/cckmit/um
29b8a77ed4c65b3e46294ca7ab8d40e01397cc63
ded448223a88996057858eed5178a4794b6f995b
refs/heads/master
2023-03-16T13:41:47.047000
2013-05-12T10:18:25
2013-05-12T10:18:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hhz.ump.web.webim; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.springframework.beans.factory.annotation.Autowired; import org.springside.modules.orm.Page; import org.springside.modules.security.springsecurity.SpringSecurityUtils; import org.springside.modules.web.struts2.Struts2Utils; import com.hhz.core.utils.DateOperator; import com.hhz.core.utils.RandomUtils; import com.hhz.core.web.CrudActionSupport; import com.hhz.ump.dao.webim.UserMessageManager; import com.hhz.ump.entity.webim.UserMessage; import com.hhz.ump.util.Constants; @Namespace("/webim") @Results( { @Result(name = CrudActionSupport.RELOAD, location = "user-message.action", type = "redirect") }) public class UserMessageAction extends CrudActionSupport<UserMessage> { private static final long serialVersionUID = -3445152342227169047L; private Page<UserMessage> page = new Page<UserMessage>(15);// 每页10条记录 @Autowired private UserMessageManager userMessageManager; private UserMessage entity; private String filter_LIKES_pageName; private String filter_EQS_pageCd; // 这里申明,前台用来判断本人或他人消息,设置聊天内容样式 private String currentUserCd; private String chattorCd; /** * 传送文件名 */ private String filedataFileName; private File filedata; public UserMessageAction() { } public UserMessage getModel() { return entity; } public String getFilter_LIKES_pageName() { return filter_LIKES_pageName; } public void setFilter_LIKES_pageName(String filterLIKESPageName) { filter_LIKES_pageName = filterLIKESPageName; } public String getFilter_EQS_pageCd() { return filter_EQS_pageCd; } public void setFilter_EQS_pageCd(String filterEQSPageCd) { filter_EQS_pageCd = filterEQSPageCd; } @Override public Page<UserMessage> getPage() { return page; } @Override protected void prepareModel() throws Exception { String UserMessageId = getId(); if (StringUtils.isNotBlank(UserMessageId)) { entity = userMessageManager.getEntity(UserMessageId); } else { entity = new UserMessage(); } } @Override public String list() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); chattorCd = request.getParameter("chattorCd"); commonQuery(chattorCd); return SUCCESS; } @Override public String input() throws Exception { return INPUT; } @Override public String save() throws Exception { return RELOAD; } @Override public String delete() throws Exception { return RELOAD; } @Override public String deleteBatch() throws Exception { return RELOAD; } /** * 用于邮件里富文本编辑器的文件上传 * * @return * @throws Exception */ public String upload() throws Exception { String fileName = genFileName(filedataFileName); String absPath = Struts2Utils.getRequest().getContextPath(); String realPath = ServletActionContext.getServletContext().getRealPath(""); File dir = new File(realPath + File.separator + "upload" + File.separator + "chat" + File.separator + SpringSecurityUtils.getCurrentUiid()); if (!dir.exists()) { dir.mkdirs(); } File fout = new File(dir, fileName); FileOutputStream fos = new FileOutputStream(fout); if (filedata.length() > Constants.MAX_FILE_SIZE) { Struts2Utils.renderText("{'err':'传送文件最大不能超过" + Constants.MAX_FILE_SIZE / (1024 * 1000) + "M','msg':''}"); filedata.delete(); return null; } FileInputStream fin = new FileInputStream(filedata); byte[] buffer = new byte[1024]; int len = 0; while ((len = fin.read(buffer)) > 0) { fos.write(buffer, 0, len); } String path = absPath + "/upload/chat/" + SpringSecurityUtils.getCurrentUiid() + "/" + fileName; Struts2Utils.renderText("{'err':'','msg':'" + path + "','title':'" + filedataFileName + "'}"); return null; } /* * public Map<String, String> getMapTalkMember() { String myUserCd = * SpringSecurityUtils.getCurrentUserCd(); String hql = * " select distinct( from UserMessage where fromUserCd = :myUserCd or toUserCd = :myUserCd order by sendDate desc " * ; Map<String, Object> pram = new HashMap<String, Object>(); * pram.put("myUserCd", myUserCd); * * userMessageManager.find(hql, pram); } */ private String genFileName(String fileName) { String suffix = fileName.substring(fileName.lastIndexOf(".")); Date now = new Date(); String dateFormat = DateOperator.formatDate(now, "yyyyMMddHHmmss"); String genName = dateFormat + RandomUtils.generateString(4) + suffix; return genName; } public String getCurrentUserCd() { return currentUserCd; } public void setCurrentUserCd(String currentUserCd) { this.currentUserCd = currentUserCd; } // 发送人列表 public Map<String, String> getMapSendChattors() { currentUserCd = SpringSecurityUtils.getCurrentUserCd(); String hqlSend = " select distinct t.fromUserCd,t.fromUserName from UserMessage t where t.toUserCd=? "; Map<String,String> map = new HashMap<String,String>(); map.put("", ""); List<Object[]> list = userMessageManager.getDao().createQuery(hqlSend, currentUserCd).list(); for (int i = 0; i < list.size(); i++) { Object[] tmp = list.get(i); String userCd = (String) tmp[0]; String userName = (String) tmp[1]; if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 接收人列表 public Map<String, String> getMapReceiveChattors() { currentUserCd = SpringSecurityUtils.getCurrentUserCd(); String hqlReceive = " select distinct t.toUserCd,t.toUserName from UserMessage t where t.fromUserCd=? "; Map<String, String> map = new HashMap<String, String>(); map.put("", ""); List<Object[]> list = userMessageManager.getDao().createQuery(hqlReceive, currentUserCd).list(); for (int i = 0; i < list.size(); i++) { Object[] tmp = list.get(i); String userCd = (String) tmp[0]; String userName = (String) tmp[1]; if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 所有联系人 public Map<String, String> getMapAllChattors() { Map<String, String> map = getMapSendChattors(); Map<String, String> mapReceive = getMapReceiveChattors(); for (Iterator receive = mapReceive.keySet().iterator(); receive.hasNext();) { String userCd = (String) receive.next(); String userName = (String) mapReceive.get(userCd); if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 选择联系人,搜索历史聊天记录 public String searchChatHistory() { HttpServletRequest request = ServletActionContext.getRequest(); chattorCd = request.getParameter("chattorCd"); commonQuery(chattorCd); return SUCCESS; } private void commonQuery(String chattorUserCd) { // 很重要 currentUserCd = SpringSecurityUtils.getCurrentUserCd(); StringBuffer hqlBuffer = new StringBuffer().append(" from UserMessage ").append( " where (fromUserCd = :myUserCd ").append( StringUtils.isNotBlank(chattorUserCd) ? (" and toUserCd = :toUserCd") : "").append( ") or (toUserCd = :myUserCd ").append( StringUtils.isNotBlank(chattorUserCd) ? (" and fromUserCd = :toUserCd") : "").append( ") order by sendDate desc "); String hql = hqlBuffer.toString(); Map<String, Object> pram = new HashMap<String, Object>(); pram.put("myUserCd", currentUserCd); pram.put("toUserCd", chattorUserCd); page = userMessageManager.findPage(page, hql, pram); } public String getChattorCd() { return chattorCd; } public void setChattorCd(String chattorCd) { this.chattorCd = chattorCd; } public String getFiledataFileName() { return filedataFileName; } public File getFiledata() { return filedata; } public void setFiledataFileName(String filedataFileName) { this.filedataFileName = filedataFileName; } public void setFiledata(File filedata) { this.filedata = filedata; } }
UTF-8
Java
8,453
java
UserMessageAction.java
Java
[]
null
[]
package com.hhz.ump.web.webim; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.springframework.beans.factory.annotation.Autowired; import org.springside.modules.orm.Page; import org.springside.modules.security.springsecurity.SpringSecurityUtils; import org.springside.modules.web.struts2.Struts2Utils; import com.hhz.core.utils.DateOperator; import com.hhz.core.utils.RandomUtils; import com.hhz.core.web.CrudActionSupport; import com.hhz.ump.dao.webim.UserMessageManager; import com.hhz.ump.entity.webim.UserMessage; import com.hhz.ump.util.Constants; @Namespace("/webim") @Results( { @Result(name = CrudActionSupport.RELOAD, location = "user-message.action", type = "redirect") }) public class UserMessageAction extends CrudActionSupport<UserMessage> { private static final long serialVersionUID = -3445152342227169047L; private Page<UserMessage> page = new Page<UserMessage>(15);// 每页10条记录 @Autowired private UserMessageManager userMessageManager; private UserMessage entity; private String filter_LIKES_pageName; private String filter_EQS_pageCd; // 这里申明,前台用来判断本人或他人消息,设置聊天内容样式 private String currentUserCd; private String chattorCd; /** * 传送文件名 */ private String filedataFileName; private File filedata; public UserMessageAction() { } public UserMessage getModel() { return entity; } public String getFilter_LIKES_pageName() { return filter_LIKES_pageName; } public void setFilter_LIKES_pageName(String filterLIKESPageName) { filter_LIKES_pageName = filterLIKESPageName; } public String getFilter_EQS_pageCd() { return filter_EQS_pageCd; } public void setFilter_EQS_pageCd(String filterEQSPageCd) { filter_EQS_pageCd = filterEQSPageCd; } @Override public Page<UserMessage> getPage() { return page; } @Override protected void prepareModel() throws Exception { String UserMessageId = getId(); if (StringUtils.isNotBlank(UserMessageId)) { entity = userMessageManager.getEntity(UserMessageId); } else { entity = new UserMessage(); } } @Override public String list() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); chattorCd = request.getParameter("chattorCd"); commonQuery(chattorCd); return SUCCESS; } @Override public String input() throws Exception { return INPUT; } @Override public String save() throws Exception { return RELOAD; } @Override public String delete() throws Exception { return RELOAD; } @Override public String deleteBatch() throws Exception { return RELOAD; } /** * 用于邮件里富文本编辑器的文件上传 * * @return * @throws Exception */ public String upload() throws Exception { String fileName = genFileName(filedataFileName); String absPath = Struts2Utils.getRequest().getContextPath(); String realPath = ServletActionContext.getServletContext().getRealPath(""); File dir = new File(realPath + File.separator + "upload" + File.separator + "chat" + File.separator + SpringSecurityUtils.getCurrentUiid()); if (!dir.exists()) { dir.mkdirs(); } File fout = new File(dir, fileName); FileOutputStream fos = new FileOutputStream(fout); if (filedata.length() > Constants.MAX_FILE_SIZE) { Struts2Utils.renderText("{'err':'传送文件最大不能超过" + Constants.MAX_FILE_SIZE / (1024 * 1000) + "M','msg':''}"); filedata.delete(); return null; } FileInputStream fin = new FileInputStream(filedata); byte[] buffer = new byte[1024]; int len = 0; while ((len = fin.read(buffer)) > 0) { fos.write(buffer, 0, len); } String path = absPath + "/upload/chat/" + SpringSecurityUtils.getCurrentUiid() + "/" + fileName; Struts2Utils.renderText("{'err':'','msg':'" + path + "','title':'" + filedataFileName + "'}"); return null; } /* * public Map<String, String> getMapTalkMember() { String myUserCd = * SpringSecurityUtils.getCurrentUserCd(); String hql = * " select distinct( from UserMessage where fromUserCd = :myUserCd or toUserCd = :myUserCd order by sendDate desc " * ; Map<String, Object> pram = new HashMap<String, Object>(); * pram.put("myUserCd", myUserCd); * * userMessageManager.find(hql, pram); } */ private String genFileName(String fileName) { String suffix = fileName.substring(fileName.lastIndexOf(".")); Date now = new Date(); String dateFormat = DateOperator.formatDate(now, "yyyyMMddHHmmss"); String genName = dateFormat + RandomUtils.generateString(4) + suffix; return genName; } public String getCurrentUserCd() { return currentUserCd; } public void setCurrentUserCd(String currentUserCd) { this.currentUserCd = currentUserCd; } // 发送人列表 public Map<String, String> getMapSendChattors() { currentUserCd = SpringSecurityUtils.getCurrentUserCd(); String hqlSend = " select distinct t.fromUserCd,t.fromUserName from UserMessage t where t.toUserCd=? "; Map<String,String> map = new HashMap<String,String>(); map.put("", ""); List<Object[]> list = userMessageManager.getDao().createQuery(hqlSend, currentUserCd).list(); for (int i = 0; i < list.size(); i++) { Object[] tmp = list.get(i); String userCd = (String) tmp[0]; String userName = (String) tmp[1]; if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 接收人列表 public Map<String, String> getMapReceiveChattors() { currentUserCd = SpringSecurityUtils.getCurrentUserCd(); String hqlReceive = " select distinct t.toUserCd,t.toUserName from UserMessage t where t.fromUserCd=? "; Map<String, String> map = new HashMap<String, String>(); map.put("", ""); List<Object[]> list = userMessageManager.getDao().createQuery(hqlReceive, currentUserCd).list(); for (int i = 0; i < list.size(); i++) { Object[] tmp = list.get(i); String userCd = (String) tmp[0]; String userName = (String) tmp[1]; if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 所有联系人 public Map<String, String> getMapAllChattors() { Map<String, String> map = getMapSendChattors(); Map<String, String> mapReceive = getMapReceiveChattors(); for (Iterator receive = mapReceive.keySet().iterator(); receive.hasNext();) { String userCd = (String) receive.next(); String userName = (String) mapReceive.get(userCd); if (map.containsKey(userCd)) { continue; } else { map.put(userCd, userName); } } return map; } // 选择联系人,搜索历史聊天记录 public String searchChatHistory() { HttpServletRequest request = ServletActionContext.getRequest(); chattorCd = request.getParameter("chattorCd"); commonQuery(chattorCd); return SUCCESS; } private void commonQuery(String chattorUserCd) { // 很重要 currentUserCd = SpringSecurityUtils.getCurrentUserCd(); StringBuffer hqlBuffer = new StringBuffer().append(" from UserMessage ").append( " where (fromUserCd = :myUserCd ").append( StringUtils.isNotBlank(chattorUserCd) ? (" and toUserCd = :toUserCd") : "").append( ") or (toUserCd = :myUserCd ").append( StringUtils.isNotBlank(chattorUserCd) ? (" and fromUserCd = :toUserCd") : "").append( ") order by sendDate desc "); String hql = hqlBuffer.toString(); Map<String, Object> pram = new HashMap<String, Object>(); pram.put("myUserCd", currentUserCd); pram.put("toUserCd", chattorUserCd); page = userMessageManager.findPage(page, hql, pram); } public String getChattorCd() { return chattorCd; } public void setChattorCd(String chattorCd) { this.chattorCd = chattorCd; } public String getFiledataFileName() { return filedataFileName; } public File getFiledata() { return filedata; } public void setFiledataFileName(String filedataFileName) { this.filedataFileName = filedataFileName; } public void setFiledata(File filedata) { this.filedata = filedata; } }
8,453
0.718467
0.711936
295
27.030508
26.288408
118
false
false
0
0
0
0
0
0
1.881356
false
false
11
b734bf34a8aa806b8c11dd5d3450959d6c8d1237
24,472,723,674,082
28d90f564049c8bc33b106828189ae7005632815
/Lab/Hagen Lab 6/src/LinkedList.java
16a301576c4b3688a46b7a54a1198aad4beb38cd
[]
no_license
bhagen55/CSC-150
https://github.com/bhagen55/CSC-150
4be639a1286a2de74effee74db58ffe7ed0ed4fc
5fb4b3310af9fe608d77bdf87b532e2c360e5992
refs/heads/master
2021-01-18T19:30:12.295000
2016-06-06T00:31:12
2016-06-06T00:31:12
60,487,675
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Linked List is a collection of data nodes. All methods here relate to * how one can manipulate those nodes. * * As a student at Union College, I am part of a community that values intellectual effort, curiosity and discovery. I understand that in order to truly claim my educational and academic achievements, I am obligated to act with academic integrity. Therefore, I affirm that I will carry out my academic endeavors with full academic honesty, and I rely on my fellow students to do the same. * * @author Blair Hagen * @version 5-5-2016 */ public class LinkedList { private int length; // number of nodes private ListNode firstNode; // pointer to first node public LinkedList() { length=0; firstNode=null; } /** getter * * @return number of nodes in the list */ public int getLength() {return length;} /** insert new Event at linked list's head * * @param newData the Event to be inserted */ public void insertAtHead(AgendaItem newData) { ListNode newnode = new ListNode(newData); if (getLength() == 0) { firstNode=newnode; } else { newnode.next=firstNode; firstNode=newnode; } length++; } /** * @return a string representation of the list and its contents. */ public String toString() { String toReturn="("; ListNode runner; runner = firstNode; while (runner != null) { toReturn = toReturn + runner; runner = runner.next; if (runner != null) { toReturn = toReturn + ",\n"; } } toReturn = toReturn + ")"; return toReturn; } /** * insert new Event into sorted position in LL * * @param newData the Event to insert */ public void insertSorted(AgendaItem newData) { ListNode nodeBefore = this.findNodeBefore(newData); if (nodeBefore == null) { insertAtHead(newData); } else { insertAfter(nodeBefore, newData); } } /** * Given a new event to be inserted in the list, finds the correct position for it. * * @param newData an event to be inserted in the list * * @return a pointer to the node in the linked list that will * immediately precede newData once newData gets inserted. * Returns null if no such node exists (which means newData goes first). */ private ListNode findNodeBefore(AgendaItem newData) { if (getLength() == 0) { return(null); } else { ListNode runner = firstNode; if (runner.data.compareTo(newData) == 1) { return(null); } else { while (runner.next != null && runner.next.data.compareTo(newData) == -1) { runner = runner.next; } while (runner.next != null && runner.next.data.compareTo(newData) == 0) { runner = runner.next; } return(runner); } } } /** * Given an event to insert and a pointer to the node * that should come before it, insert the new event after nodeBefore. * Precondition: length >= 1 * * @param nodeBefore the node (already in the list) that should * immediately precede the node with newData in it * @param newData the event to be inserted after nodeBefore */ private void insertAfter (ListNode nodeBefore, AgendaItem newData) { ListNode newNode = new ListNode(newData); ListNode runner = firstNode; while (!runner.equals(nodeBefore)) { runner = runner.next; } newNode.next = runner.next; runner.next = newNode; length++; } }
UTF-8
Java
3,863
java
LinkedList.java
Java
[ { "context": " my fellow students to do the same.\n * \n * @author Blair Hagen\n * @version 5-5-2016\n */\npublic class LinkedList\n", "end": 536, "score": 0.9998549222946167, "start": 525, "tag": "NAME", "value": "Blair Hagen" } ]
null
[]
/** * Linked List is a collection of data nodes. All methods here relate to * how one can manipulate those nodes. * * As a student at Union College, I am part of a community that values intellectual effort, curiosity and discovery. I understand that in order to truly claim my educational and academic achievements, I am obligated to act with academic integrity. Therefore, I affirm that I will carry out my academic endeavors with full academic honesty, and I rely on my fellow students to do the same. * * @author <NAME> * @version 5-5-2016 */ public class LinkedList { private int length; // number of nodes private ListNode firstNode; // pointer to first node public LinkedList() { length=0; firstNode=null; } /** getter * * @return number of nodes in the list */ public int getLength() {return length;} /** insert new Event at linked list's head * * @param newData the Event to be inserted */ public void insertAtHead(AgendaItem newData) { ListNode newnode = new ListNode(newData); if (getLength() == 0) { firstNode=newnode; } else { newnode.next=firstNode; firstNode=newnode; } length++; } /** * @return a string representation of the list and its contents. */ public String toString() { String toReturn="("; ListNode runner; runner = firstNode; while (runner != null) { toReturn = toReturn + runner; runner = runner.next; if (runner != null) { toReturn = toReturn + ",\n"; } } toReturn = toReturn + ")"; return toReturn; } /** * insert new Event into sorted position in LL * * @param newData the Event to insert */ public void insertSorted(AgendaItem newData) { ListNode nodeBefore = this.findNodeBefore(newData); if (nodeBefore == null) { insertAtHead(newData); } else { insertAfter(nodeBefore, newData); } } /** * Given a new event to be inserted in the list, finds the correct position for it. * * @param newData an event to be inserted in the list * * @return a pointer to the node in the linked list that will * immediately precede newData once newData gets inserted. * Returns null if no such node exists (which means newData goes first). */ private ListNode findNodeBefore(AgendaItem newData) { if (getLength() == 0) { return(null); } else { ListNode runner = firstNode; if (runner.data.compareTo(newData) == 1) { return(null); } else { while (runner.next != null && runner.next.data.compareTo(newData) == -1) { runner = runner.next; } while (runner.next != null && runner.next.data.compareTo(newData) == 0) { runner = runner.next; } return(runner); } } } /** * Given an event to insert and a pointer to the node * that should come before it, insert the new event after nodeBefore. * Precondition: length >= 1 * * @param nodeBefore the node (already in the list) that should * immediately precede the node with newData in it * @param newData the event to be inserted after nodeBefore */ private void insertAfter (ListNode nodeBefore, AgendaItem newData) { ListNode newNode = new ListNode(newData); ListNode runner = firstNode; while (!runner.equals(nodeBefore)) { runner = runner.next; } newNode.next = runner.next; runner.next = newNode; length++; } }
3,858
0.581672
0.578307
143
26.013987
37.231647
388
false
false
0
0
0
0
0
0
0.825175
false
false
11
d80b5d2b6f2b7852f06b2adf7d0f49433f02615c
8,744,553,441,606
70086d9f00bd52bc0cd269744ef44b5a6b117ee7
/huiyizhan/src/main/java/cn/ourwill/huiyizhan/mapper/TicketsRecordSqlProvider.java
19905c3720f2af207c9739024c86d7f643be3e68
[]
no_license
verifyCode/project-list
https://github.com/verifyCode/project-list
0bd1f632d8bd70f6a0cd18c16a87a11723484582
a2c4052f8d5bd31965018134310c263891c12c57
refs/heads/master
2018-12-20T04:11:19.434000
2018-10-08T03:10:24
2018-10-08T03:10:24
150,203,237
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.ourwill.huiyizhan.mapper; import cn.ourwill.huiyizhan.entity.TicketsRecord; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.jdbc.SQL; import java.util.Map; public class TicketsRecordSqlProvider { public String insertSelective(TicketsRecord record) { SQL sql = new SQL(); sql.INSERT_INTO("tickets_record"); if (record.getId() != null) { sql.VALUES("id", "#{id,jdbcType=INTEGER}"); } if (record.getTicketsId() != null) { sql.VALUES("tickets_id", "#{ticketsId,jdbcType=INTEGER}"); } if (record.getActivityId() != null) { sql.VALUES("activity_id", "#{activityId,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getTicketsName())) { sql.VALUES("tickets_name", "#{ticketsName,jdbcType=VARCHAR}"); } if (record.getTicketsPrice() != null) { sql.VALUES("tickets_price", "#{ticketsPrice,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.VALUES("conferee_name", "#{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.VALUES("conferee_phone", "#{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.VALUES("conferee_email", "#{confereeEmail,jdbcType=VARCHAR}"); } if (record.getUserId() != null) { sql.VALUES("user_id", "#{userId,jdbcType=INTEGER}"); } if (record.getOrderId() != null) { sql.VALUES("order_id", "#{orderId,jdbcType=INTEGER}"); } if (record.getTicketStatus() != null) { sql.VALUES("ticket_status", "#{ticketStatus,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getBackInfo())) { sql.VALUES("back_info", "#{backInfo,jdbcType=VARCHAR}"); } if (record.getSignCode() != null) { sql.VALUES("sign_code", "#{signCode,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getAuthCode())) { sql.VALUES("auth_code", "#{authCode,jdbcType=VARCHAR}"); } if (record.getSignTime() != null) { sql.VALUES("sign_time", "#{signTime,jdbcType=TIMESTAMP}"); } if (record.getCTime() != null) { sql.VALUES("c_time", "#{cTime,jdbcType=TIMESTAMP}"); } if (record.getUTime() != null) { sql.VALUES("u_time", "#{uTime,jdbcType=TIMESTAMP}"); } if (record.getTicketLink() != null) { sql.VALUES("ticket_link", "#{ticketLink,jdbcType=VARCHAR}"); } return sql.toString(); } public String updateByPrimaryKeySelective(TicketsRecord record) { SQL sql = new SQL(); sql.UPDATE("tickets_record"); if (record.getTicketsId() != null) { sql.SET("tickets_id = #{ticketsId,jdbcType=INTEGER}"); } if (record.getActivityId() != null) { sql.SET("activity_id = #{activityId,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getTicketsName())) { sql.SET("tickets_name=#{ticketsName,jdbcType=VARCHAR}"); } if (record.getTicketsPrice() != null) { sql.SET("tickets_price=#{ticketsPrice,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.SET("conferee_name = #{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.SET("conferee_phone = #{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.SET("conferee_email = #{confereeEmail,jdbcType=VARCHAR}"); } if (record.getUserId() != null) { sql.SET("user_id = #{userId,jdbcType=INTEGER}"); } if (record.getOrderId() != null) { sql.SET("order_id = #{orderId,jdbcType=INTEGER}"); } if (record.getTicketStatus() != null) { sql.SET("ticket_status = #{ticketStatus,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getBackInfo())) { sql.SET("back_info = #{backInfo,jdbcType=VARCHAR}"); } if (record.getSignCode() != null) { sql.SET("sign_code = #{signCode,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getAuthCode())) { sql.SET("auth_code = #{authCode,jdbcType=VARCHAR}"); } if (record.getSignTime() != null) { sql.SET("sign_time = #{signTime,jdbcType=TIMESTAMP}"); } if (record.getCTime() != null) { sql.SET("c_time = #{cTime,jdbcType=TIMESTAMP}"); } if (record.getUTime() != null) { sql.SET("u_time = #{uTime,jdbcType=TIMESTAMP}"); } if (record.getTicketLink() != null) { sql.VALUES("ticket_link", "#{ticketLink,jdbcType=VARCHAR}"); } sql.WHERE("id = #{id,jdbcType=INTEGER}"); return sql.toString(); } //根据属性查找(使用Map参数) public String selectByParams(final Map<String, Object> param) { return new SQL() { { SELECT("id, tickets_id, activity_id, tickets_name, tickets_price, conferee_name, conferee_phone, conferee_email, user_id, order_id, ticket_status, back_info, sign_code, auth_code, c_time, u_time,ticket_link"); FROM("tickets_record"); if (param.get("id") != null && param.get("id") != "") { WHERE("id=#{id}"); } if (param.get("ticketsId") != null && param.get("ticketsId") != "") { WHERE("tickets_id=#{ticketsId}"); } if (param.get("activityId") != null && param.get("activityId") != "") { WHERE("activity_id=#{activityId}"); } if (param.get("ticketsName") != null && param.get("ticketsName") != "") { WHERE("tickets_name=#{ticketsName}"); } if (param.get("ticketsPrice") != null && param.get("ticketsPrice") != "") { WHERE("tickets_price=#{ticketsPrice}"); } if (param.get("confereeName") != null && param.get("confereeName") != "") { WHERE("conferee_name=#{confereeName}"); } if (param.get("confereePhone") != null && param.get("confereePhone") != "") { WHERE("conferee_phone=#{confereePhone}"); } if (param.get("confereeEmail") != null && param.get("confereeEmail") != "") { WHERE("conferee_email=#{confereeEmail}"); } if (param.get("userId") != null && param.get("userId") != "") { WHERE("user_id=#{userId}"); } if (param.get("orderId") != null && param.get("orderId") != "") { WHERE("order_id=#{orderId}"); } if (param.get("ticketStatus") != null && param.get("ticketStatus") != "") { WHERE("ticket_status=#{ticketStatus}"); } if (param.get("searchKeys") != null && param.get("searchKeys") != "") { WHERE("(conferee_name like concat(#{searchKeys},'%') or conferee_phone like concat(#{searchKeys},'%') or conferee_email like concat(#{searchKeys},'%'))"); } ORDER_BY("id desc"); } }.toString(); } public String updateUserInfoByIdSelective(TicketsRecord record) { SQL sql = new SQL(); sql.UPDATE("tickets_record"); if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.SET("conferee_name = #{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.SET("conferee_phone = #{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.SET("conferee_email = #{confereeEmail,jdbcType=VARCHAR}"); } if (record.getTicketStatus() != null) { sql.SET("ticket_status = #{ticketStatus,jdbcType=INTEGER}"); } sql.WHERE("id = #{id,jdbcType=INTEGER}"); return sql.toString(); } public String getByActivityIdUserId(@Param("activityId") Integer activityId, @Param("userId") Integer userId, @Param("isValid") Boolean isValid) { return new SQL() { { SELECT("t.id, t.tickets_id, t.activity_id,t.tickets_name,t.tickets_price, t.conferee_name, t.conferee_phone, t.conferee_email, t.user_id, t.order_id", "t.ticket_status, t.back_info, t.sign_code, t.auth_code,t.sign_time, t.c_time, t.u_time,t.ticket_link"); FROM("tickets_record t"); LEFT_OUTER_JOIN("activity a on t.activity_id = a.id"); WHERE("t.activity_id = #{activityId} and t.user_id = #{userId}"); if (isValid != null && isValid) { WHERE("NOW() <= a.end_time and t.ticket_status in (1,2,3)"); } else if (isValid != null) { WHERE("(NOW() > a.end_time or t.ticket_status in (0,4,9))"); } } }.toString(); } public String statisticsMyTicket(@Param("userId") Integer userId,boolean isValid){ return new SQL(){ { SELECT("count(1) as count"); FROM("tickets_record t"); LEFT_OUTER_JOIN("activity a on t.activity_id = a.id"); if(isValid){ WHERE("NOW() <= a.end_time and t.ticket_status in (1,2,3)"); }else{ WHERE("(NOW() > a.end_time or t.ticket_status in (0,4,9))"); } WHERE("t.user_id = #{userId}"); } }.toString(); } public String getParticipation(@Param("userId") Integer userId, @Param("status") Integer status) { final String value; if ( status == 1) { // 查询有效票 value = "a.start_time >"; } else { value = "a.end_time <"; } return new SQL() { { SELECT( // TicketRecord 属性 "tr.id , tr.tickets_id, tr.activity_id, tr.tickets_name, tr.tickets_price, tr.conferee_name, tr.conferee_phone," + "tr.conferee_email, tr.user_id user_id, tr.order_id,tr.ticket_status, tr.back_info, tr.sign_code, tr.auth_code, tr.c_time tr_c_time, tr.u_time,tr.ticket_link," + // ActivityTicket属性 "ati.id ati_id, ati.activity_id ati_activity_id, ati.ticket_name, ati.ticket_price, ati.ticket_explain, ati.start_time ati_start_time, ati.cut_time, ati.is_free, ati.is_publish_sell," + "ati.is_check, ati.sell_status, ati.single_limits, ati.total_number, ati.stock_number, ati.user_id ati_user_id, ati.c_time ati_c_time, ati.u_id ati_u_id, ati.u_time ati_u_time," + // activity 属性 "a.id a_id, a.user_id a_user_id, a.activity_title, a.activity_type, a.start_time a_start_time, a.end_time a_end_time, a.activity_address," + "a.activity_banner_mobile, a.activity_banner, a.is_open, a.is_online, a.is_hot, a.is_recent, a.schedule_status," + "a.guest_status, a.partner_status, a.contact_status, a.banner_id,a.c_time a_c_time, a.u_time a_u_time, a.u_id a_u_id, a.activity_description ,a.issue_status,a.banner_type ,a.ticket_config, a.custom_url" ); FROM("tickets_record tr"); LEFT_OUTER_JOIN("activity a on a.id = tr.activity_id"); LEFT_OUTER_JOIN("activity_tickets ati on a.id = ati.activity_id"); WHERE(" tr.user_id = #{userId,jdbcType=INTEGER} AND " + value + " NOW()" + "AND a.issue_status = 1 AND a.delete_status = 1"); GROUP_BY("tr.id asc"); } }.toString(); } }
UTF-8
Java
12,428
java
TicketsRecordSqlProvider.java
Java
[]
null
[]
package cn.ourwill.huiyizhan.mapper; import cn.ourwill.huiyizhan.entity.TicketsRecord; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.jdbc.SQL; import java.util.Map; public class TicketsRecordSqlProvider { public String insertSelective(TicketsRecord record) { SQL sql = new SQL(); sql.INSERT_INTO("tickets_record"); if (record.getId() != null) { sql.VALUES("id", "#{id,jdbcType=INTEGER}"); } if (record.getTicketsId() != null) { sql.VALUES("tickets_id", "#{ticketsId,jdbcType=INTEGER}"); } if (record.getActivityId() != null) { sql.VALUES("activity_id", "#{activityId,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getTicketsName())) { sql.VALUES("tickets_name", "#{ticketsName,jdbcType=VARCHAR}"); } if (record.getTicketsPrice() != null) { sql.VALUES("tickets_price", "#{ticketsPrice,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.VALUES("conferee_name", "#{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.VALUES("conferee_phone", "#{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.VALUES("conferee_email", "#{confereeEmail,jdbcType=VARCHAR}"); } if (record.getUserId() != null) { sql.VALUES("user_id", "#{userId,jdbcType=INTEGER}"); } if (record.getOrderId() != null) { sql.VALUES("order_id", "#{orderId,jdbcType=INTEGER}"); } if (record.getTicketStatus() != null) { sql.VALUES("ticket_status", "#{ticketStatus,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getBackInfo())) { sql.VALUES("back_info", "#{backInfo,jdbcType=VARCHAR}"); } if (record.getSignCode() != null) { sql.VALUES("sign_code", "#{signCode,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getAuthCode())) { sql.VALUES("auth_code", "#{authCode,jdbcType=VARCHAR}"); } if (record.getSignTime() != null) { sql.VALUES("sign_time", "#{signTime,jdbcType=TIMESTAMP}"); } if (record.getCTime() != null) { sql.VALUES("c_time", "#{cTime,jdbcType=TIMESTAMP}"); } if (record.getUTime() != null) { sql.VALUES("u_time", "#{uTime,jdbcType=TIMESTAMP}"); } if (record.getTicketLink() != null) { sql.VALUES("ticket_link", "#{ticketLink,jdbcType=VARCHAR}"); } return sql.toString(); } public String updateByPrimaryKeySelective(TicketsRecord record) { SQL sql = new SQL(); sql.UPDATE("tickets_record"); if (record.getTicketsId() != null) { sql.SET("tickets_id = #{ticketsId,jdbcType=INTEGER}"); } if (record.getActivityId() != null) { sql.SET("activity_id = #{activityId,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getTicketsName())) { sql.SET("tickets_name=#{ticketsName,jdbcType=VARCHAR}"); } if (record.getTicketsPrice() != null) { sql.SET("tickets_price=#{ticketsPrice,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.SET("conferee_name = #{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.SET("conferee_phone = #{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.SET("conferee_email = #{confereeEmail,jdbcType=VARCHAR}"); } if (record.getUserId() != null) { sql.SET("user_id = #{userId,jdbcType=INTEGER}"); } if (record.getOrderId() != null) { sql.SET("order_id = #{orderId,jdbcType=INTEGER}"); } if (record.getTicketStatus() != null) { sql.SET("ticket_status = #{ticketStatus,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getBackInfo())) { sql.SET("back_info = #{backInfo,jdbcType=VARCHAR}"); } if (record.getSignCode() != null) { sql.SET("sign_code = #{signCode,jdbcType=INTEGER}"); } if (StringUtils.isNotEmpty(record.getAuthCode())) { sql.SET("auth_code = #{authCode,jdbcType=VARCHAR}"); } if (record.getSignTime() != null) { sql.SET("sign_time = #{signTime,jdbcType=TIMESTAMP}"); } if (record.getCTime() != null) { sql.SET("c_time = #{cTime,jdbcType=TIMESTAMP}"); } if (record.getUTime() != null) { sql.SET("u_time = #{uTime,jdbcType=TIMESTAMP}"); } if (record.getTicketLink() != null) { sql.VALUES("ticket_link", "#{ticketLink,jdbcType=VARCHAR}"); } sql.WHERE("id = #{id,jdbcType=INTEGER}"); return sql.toString(); } //根据属性查找(使用Map参数) public String selectByParams(final Map<String, Object> param) { return new SQL() { { SELECT("id, tickets_id, activity_id, tickets_name, tickets_price, conferee_name, conferee_phone, conferee_email, user_id, order_id, ticket_status, back_info, sign_code, auth_code, c_time, u_time,ticket_link"); FROM("tickets_record"); if (param.get("id") != null && param.get("id") != "") { WHERE("id=#{id}"); } if (param.get("ticketsId") != null && param.get("ticketsId") != "") { WHERE("tickets_id=#{ticketsId}"); } if (param.get("activityId") != null && param.get("activityId") != "") { WHERE("activity_id=#{activityId}"); } if (param.get("ticketsName") != null && param.get("ticketsName") != "") { WHERE("tickets_name=#{ticketsName}"); } if (param.get("ticketsPrice") != null && param.get("ticketsPrice") != "") { WHERE("tickets_price=#{ticketsPrice}"); } if (param.get("confereeName") != null && param.get("confereeName") != "") { WHERE("conferee_name=#{confereeName}"); } if (param.get("confereePhone") != null && param.get("confereePhone") != "") { WHERE("conferee_phone=#{confereePhone}"); } if (param.get("confereeEmail") != null && param.get("confereeEmail") != "") { WHERE("conferee_email=#{confereeEmail}"); } if (param.get("userId") != null && param.get("userId") != "") { WHERE("user_id=#{userId}"); } if (param.get("orderId") != null && param.get("orderId") != "") { WHERE("order_id=#{orderId}"); } if (param.get("ticketStatus") != null && param.get("ticketStatus") != "") { WHERE("ticket_status=#{ticketStatus}"); } if (param.get("searchKeys") != null && param.get("searchKeys") != "") { WHERE("(conferee_name like concat(#{searchKeys},'%') or conferee_phone like concat(#{searchKeys},'%') or conferee_email like concat(#{searchKeys},'%'))"); } ORDER_BY("id desc"); } }.toString(); } public String updateUserInfoByIdSelective(TicketsRecord record) { SQL sql = new SQL(); sql.UPDATE("tickets_record"); if (StringUtils.isNotEmpty(record.getConfereeName())) { sql.SET("conferee_name = #{confereeName,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereePhone())) { sql.SET("conferee_phone = #{confereePhone,jdbcType=VARCHAR}"); } if (StringUtils.isNotEmpty(record.getConfereeEmail())) { sql.SET("conferee_email = #{confereeEmail,jdbcType=VARCHAR}"); } if (record.getTicketStatus() != null) { sql.SET("ticket_status = #{ticketStatus,jdbcType=INTEGER}"); } sql.WHERE("id = #{id,jdbcType=INTEGER}"); return sql.toString(); } public String getByActivityIdUserId(@Param("activityId") Integer activityId, @Param("userId") Integer userId, @Param("isValid") Boolean isValid) { return new SQL() { { SELECT("t.id, t.tickets_id, t.activity_id,t.tickets_name,t.tickets_price, t.conferee_name, t.conferee_phone, t.conferee_email, t.user_id, t.order_id", "t.ticket_status, t.back_info, t.sign_code, t.auth_code,t.sign_time, t.c_time, t.u_time,t.ticket_link"); FROM("tickets_record t"); LEFT_OUTER_JOIN("activity a on t.activity_id = a.id"); WHERE("t.activity_id = #{activityId} and t.user_id = #{userId}"); if (isValid != null && isValid) { WHERE("NOW() <= a.end_time and t.ticket_status in (1,2,3)"); } else if (isValid != null) { WHERE("(NOW() > a.end_time or t.ticket_status in (0,4,9))"); } } }.toString(); } public String statisticsMyTicket(@Param("userId") Integer userId,boolean isValid){ return new SQL(){ { SELECT("count(1) as count"); FROM("tickets_record t"); LEFT_OUTER_JOIN("activity a on t.activity_id = a.id"); if(isValid){ WHERE("NOW() <= a.end_time and t.ticket_status in (1,2,3)"); }else{ WHERE("(NOW() > a.end_time or t.ticket_status in (0,4,9))"); } WHERE("t.user_id = #{userId}"); } }.toString(); } public String getParticipation(@Param("userId") Integer userId, @Param("status") Integer status) { final String value; if ( status == 1) { // 查询有效票 value = "a.start_time >"; } else { value = "a.end_time <"; } return new SQL() { { SELECT( // TicketRecord 属性 "tr.id , tr.tickets_id, tr.activity_id, tr.tickets_name, tr.tickets_price, tr.conferee_name, tr.conferee_phone," + "tr.conferee_email, tr.user_id user_id, tr.order_id,tr.ticket_status, tr.back_info, tr.sign_code, tr.auth_code, tr.c_time tr_c_time, tr.u_time,tr.ticket_link," + // ActivityTicket属性 "ati.id ati_id, ati.activity_id ati_activity_id, ati.ticket_name, ati.ticket_price, ati.ticket_explain, ati.start_time ati_start_time, ati.cut_time, ati.is_free, ati.is_publish_sell," + "ati.is_check, ati.sell_status, ati.single_limits, ati.total_number, ati.stock_number, ati.user_id ati_user_id, ati.c_time ati_c_time, ati.u_id ati_u_id, ati.u_time ati_u_time," + // activity 属性 "a.id a_id, a.user_id a_user_id, a.activity_title, a.activity_type, a.start_time a_start_time, a.end_time a_end_time, a.activity_address," + "a.activity_banner_mobile, a.activity_banner, a.is_open, a.is_online, a.is_hot, a.is_recent, a.schedule_status," + "a.guest_status, a.partner_status, a.contact_status, a.banner_id,a.c_time a_c_time, a.u_time a_u_time, a.u_id a_u_id, a.activity_description ,a.issue_status,a.banner_type ,a.ticket_config, a.custom_url" ); FROM("tickets_record tr"); LEFT_OUTER_JOIN("activity a on a.id = tr.activity_id"); LEFT_OUTER_JOIN("activity_tickets ati on a.id = ati.activity_id"); WHERE(" tr.user_id = #{userId,jdbcType=INTEGER} AND " + value + " NOW()" + "AND a.issue_status = 1 AND a.delete_status = 1"); GROUP_BY("tr.id asc"); } }.toString(); } }
12,428
0.529711
0.528338
297
40.707069
39.881115
226
false
false
0
0
0
0
0
0
0.895623
false
false
11
5424441cf4da9f3ecc08d8528a81fd51bfca8038
33,148,557,652,818
30f0b8c22a43e991d3f76e274cdaeccb98d5764a
/pdfxml2pdf/src/svg/simplestructure/Paintable.java
0593efe23fbda49f88b8434e0952f45b31d5aaa5
[]
no_license
tranngocthachs/pdfxml2pdf
https://github.com/tranngocthachs/pdfxml2pdf
5e1eaaf4921d17c4b6949a6c04a8801f608bab52
40d36e790b60c3ec89007b2412c49c847cfd96b1
refs/heads/master
2021-01-01T17:37:28.031000
2009-04-16T03:32:17
2009-04-16T03:32:17
32,115,858
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package svg.simplestructure; import org.xml.sax.Attributes; public interface Paintable { public String handlePaintPropertiesAtt(Attributes attributes); }
UTF-8
Java
156
java
Paintable.java
Java
[]
null
[]
package svg.simplestructure; import org.xml.sax.Attributes; public interface Paintable { public String handlePaintPropertiesAtt(Attributes attributes); }
156
0.833333
0.833333
6
25
21.16601
63
false
false
0
0
0
0
0
0
0.666667
false
false
11
dfaf8a6b8469bf12d53590a4e4fe64be816729f9
21,895,743,308,507
a57bd32ef9110be57fe947244df4e4ca6c6836a7
/POOEj2/src/Casting/Auto.java
9dc8a1c300124935b411f643eab0d32ecc3a3e41
[]
no_license
vicgaba/programacion2
https://github.com/vicgaba/programacion2
087c143d5363a4635e6a1effa5e377b1de4a759c
b1cab86771c244b58c763eb08c3fab7309571b4a
refs/heads/master
2020-04-04T14:07:23.651000
2018-11-03T15:35:10
2018-11-03T15:35:10
146,137,727
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Casting; public class Auto extends Vehiculo{ public String getModelo() { return "Ferrari"; } }
UTF-8
Java
121
java
Auto.java
Java
[]
null
[]
package Casting; public class Auto extends Vehiculo{ public String getModelo() { return "Ferrari"; } }
121
0.644628
0.644628
8
14.125
13.678793
35
false
false
0
0
0
0
0
0
0.25
false
false
11
49ce84d3cf2fc0d76b812bd2ce234ea70d2a2997
10,058,813,422,838
be7eff4154d74f321f0dacc85cc4b530786c8688
/app/src/main/java/com/example/mycommunity/function/forSecretary/ForSecretaryActivity.java
d990604c39b11eeaf976bcc14741e3a5a0a9a398
[]
no_license
dingych/AndroidCommunity
https://github.com/dingych/AndroidCommunity
8e430a892de758adcbf878ffbbd6568d63f8832d
e37e9721497298ef571de07329887289780c33ff
refs/heads/master
2022-01-04T22:10:27.219000
2019-05-28T11:28:19
2019-05-28T11:28:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mycommunity.function.forSecretary; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.mycommunity.R; public class ForSecretaryActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_for_secretary); } }
UTF-8
Java
410
java
ForSecretaryActivity.java
Java
[]
null
[]
package com.example.mycommunity.function.forSecretary; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.mycommunity.R; public class ForSecretaryActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_for_secretary); } }
410
0.778049
0.77561
15
26.333334
23.901649
61
false
false
0
0
0
0
0
0
0.4
false
false
11
c80e445574aeb8f7cea31c490849cfba9e6eb417
13,280,038,923,424
8379570ec99891dda9af3dc00f1668e9a942c80d
/application/design/tree/src/main/java/org/iproute/springboot/design/tree/mapper/MysqlTreeNodeMapper.java
6440bc6075bf3edeb4e88b69b513bce00e8ed28f
[]
no_license
mimotronik/springboot
https://github.com/mimotronik/springboot
04250cf5ea177d5788e4b3f2c4bbad4bffd1760f
c533d10059826b88ae473b38864e6850b5a045f6
refs/heads/main
2023-02-22T02:20:17.771000
2023-02-21T05:43:49
2023-02-21T05:43:49
331,940,003
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.iproute.springboot.design.tree.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.iproute.springboot.design.tree.model.tree.mysql.MysqlTreeNode; import org.springframework.stereotype.Repository; import java.util.List; /** * TreeNodeMapper * * @author zhuzhenjie * @since 2022 /4/19 */ @Mapper @Repository public interface MysqlTreeNodeMapper extends BaseMapper<MysqlTreeNode> { /** * Node info tree node. * * @param id the id * @return the tree node */ MysqlTreeNode nodeInfo(@Param("id") Long id); /** * Level nodes list. * * @param level the level * @return the list */ List<MysqlTreeNode> levelNodes(@Param("level") int level); /** * 查询层级最大或者最小的 * * @param level the level * @param max true: find max ;false: fin min * @return the tree node */ MysqlTreeNode levelMaxOrMinNode(@Param("level") int level, @Param("max") boolean max); /** * Parents list; * * @param node the node * @param include 是否包含自身 * @param level 查询的层级 自身所在的层数为0层 * @return the tree node */ List<MysqlTreeNode> parents(@Param("node") MysqlTreeNode node, @Param("include") boolean include, @Param("level") int level); /** * 性能问题,单独提取出parent * <p> * TODO 对于特殊的Children查询也需要提取出来 * * @param id the id * @return the tree node */ MysqlTreeNode parent(@Param("id") Long id); /** * Children list. * * @param parent the parent * @param include 是否包含节点自身 * @param level 查询以下的层级, 自身所在的层数为0层 * @return the list */ List<MysqlTreeNode> children(@Param("node") MysqlTreeNode parent, @Param("include") boolean include, @Param("level") int level); /** * Add node int. * * @param node the node * @return the int */ int addNode(MysqlTreeNode node); /** * Add nodes int. * * @param nodes the nodes * @return the int */ int addNodes(List<MysqlTreeNode> nodes); /** * 新增节点前的操作,更新需要更新的节点的 lft 的值 * <p> * -- 新增节点后,其余节点的左值更新<br/> * -- 所有左值大于等于新节点的右值 全部加2 * * @param newNodeRgt the new node rgt * @param count the count 添加的节点的个数 * @return the int */ int updateLft(@Param("newNodeRgt") int newNodeRgt, @Param("count") int count); /** * 新增节点前的操作,更新需要更新的节点的 rgt 的值 * <p> * -- 新增节点后,其余节点的右值更新<br/> * -- 所有右值大于等于新节点的左值 全部+2 * * @param newNodeLft the new node lft * @param count the count 添加的节点的个数 * @return the int */ int updateRgt(@Param("newNodeLft") int newNodeLft, @Param("count") int count); /** * range remove * * @param lft > lft * @param rgt < rgt * @param include the include * @return the int */ int removeRange(@Param("lft") int lft, @Param("rgt") int rgt, @Param("include") boolean include); /** * reset. */ void reset(); }
UTF-8
Java
3,551
java
MysqlTreeNodeMapper.java
Java
[ { "context": "va.util.List;\n\n/**\n * TreeNodeMapper\n *\n * @author zhuzhenjie\n * @since 2022 /4/19\n */\n@Mapper\n@Repository\npubl", "end": 392, "score": 0.9995667934417725, "start": 382, "tag": "USERNAME", "value": "zhuzhenjie" } ]
null
[]
package org.iproute.springboot.design.tree.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.iproute.springboot.design.tree.model.tree.mysql.MysqlTreeNode; import org.springframework.stereotype.Repository; import java.util.List; /** * TreeNodeMapper * * @author zhuzhenjie * @since 2022 /4/19 */ @Mapper @Repository public interface MysqlTreeNodeMapper extends BaseMapper<MysqlTreeNode> { /** * Node info tree node. * * @param id the id * @return the tree node */ MysqlTreeNode nodeInfo(@Param("id") Long id); /** * Level nodes list. * * @param level the level * @return the list */ List<MysqlTreeNode> levelNodes(@Param("level") int level); /** * 查询层级最大或者最小的 * * @param level the level * @param max true: find max ;false: fin min * @return the tree node */ MysqlTreeNode levelMaxOrMinNode(@Param("level") int level, @Param("max") boolean max); /** * Parents list; * * @param node the node * @param include 是否包含自身 * @param level 查询的层级 自身所在的层数为0层 * @return the tree node */ List<MysqlTreeNode> parents(@Param("node") MysqlTreeNode node, @Param("include") boolean include, @Param("level") int level); /** * 性能问题,单独提取出parent * <p> * TODO 对于特殊的Children查询也需要提取出来 * * @param id the id * @return the tree node */ MysqlTreeNode parent(@Param("id") Long id); /** * Children list. * * @param parent the parent * @param include 是否包含节点自身 * @param level 查询以下的层级, 自身所在的层数为0层 * @return the list */ List<MysqlTreeNode> children(@Param("node") MysqlTreeNode parent, @Param("include") boolean include, @Param("level") int level); /** * Add node int. * * @param node the node * @return the int */ int addNode(MysqlTreeNode node); /** * Add nodes int. * * @param nodes the nodes * @return the int */ int addNodes(List<MysqlTreeNode> nodes); /** * 新增节点前的操作,更新需要更新的节点的 lft 的值 * <p> * -- 新增节点后,其余节点的左值更新<br/> * -- 所有左值大于等于新节点的右值 全部加2 * * @param newNodeRgt the new node rgt * @param count the count 添加的节点的个数 * @return the int */ int updateLft(@Param("newNodeRgt") int newNodeRgt, @Param("count") int count); /** * 新增节点前的操作,更新需要更新的节点的 rgt 的值 * <p> * -- 新增节点后,其余节点的右值更新<br/> * -- 所有右值大于等于新节点的左值 全部+2 * * @param newNodeLft the new node lft * @param count the count 添加的节点的个数 * @return the int */ int updateRgt(@Param("newNodeLft") int newNodeLft, @Param("count") int count); /** * range remove * * @param lft > lft * @param rgt < rgt * @param include the include * @return the int */ int removeRange(@Param("lft") int lft, @Param("rgt") int rgt, @Param("include") boolean include); /** * reset. */ void reset(); }
3,551
0.58648
0.58299
136
22.169117
23.381918
132
false
false
0
0
0
0
0
0
0.227941
false
false
11
ad4d48ec208888ec4364ad035222dacb0af1443d
20,976,620,304,450
0f22dae1b1f96829980db49477deba43e1aa7f9c
/src/main/java/ua/neilo/ostrovok/controller/UserController.java
d607438833ef2ec50c60cc7978fe46efbf9f2e12
[]
no_license
NeiloYaroslav1989/ostrovok
https://github.com/NeiloYaroslav1989/ostrovok
9c3bbf1a5c6ae508ef469ae8d84a72f2d82fd631
ab6a1a9dfc76074614c32e829b8377a5230bde48
refs/heads/master
2021-05-21T21:35:47.871000
2020-04-21T09:37:58
2020-04-21T09:37:58
252,810,731
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.neilo.ostrovok.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import ua.neilo.ostrovok.domain.Group; import ua.neilo.ostrovok.domain.Role; import ua.neilo.ostrovok.domain.User; import ua.neilo.ostrovok.repository.UserRepo; import ua.neilo.ostrovok.service.UserService; import java.util.*; import java.util.stream.Collectors; @Controller @RequestMapping("/users") @PreAuthorize("hasAuthority('ADMIN')") public class UserController { private final UserService userService; public UserController(UserService userService) { this.userService = userService; } @GetMapping public String userList(Model model) { List<User> users = userService.findAll(); Collections.sort(users); model.addAttribute("users", users); return "userList"; } @GetMapping("/edit/{id}") public String userEditForm(@PathVariable("id") Long id, Model model) { User user = userService.findById(id); model.addAttribute("user", user); model.addAttribute("roles", Role.values()); return "userEdit"; } @PostMapping public String userUpdate( @RequestParam String username, @RequestParam String password, @RequestParam String confirmPassword, @RequestParam String email, @RequestParam Map<String, String> form, @RequestParam ("userId") User user ) { user.setUsername(username); user.setPassword(password); user.setConfirmPassword(confirmPassword); user.setEmail(email); Set<String> roles = Arrays.stream(Role.values()) .map(Role::name) .collect(Collectors.toSet()); user.getRoles().clear(); for (String key : form.keySet()) { if (roles.contains(key)) { user.getRoles().add(Role.valueOf(key)); } } userService.save(user); return "redirect:/users"; } @GetMapping("/delete/{id}") public String userDelete(@PathVariable("id") Long id) { userService.deleteById(id); return "redirect:/users"; } }
UTF-8
Java
2,453
java
UserController.java
Java
[ { "context": "erId\") User user\n ) {\n user.setUsername(username);\n user.setPassword(password);\n use", "end": 1713, "score": 0.9986310601234436, "start": 1705, "tag": "USERNAME", "value": "username" } ]
null
[]
package ua.neilo.ostrovok.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import ua.neilo.ostrovok.domain.Group; import ua.neilo.ostrovok.domain.Role; import ua.neilo.ostrovok.domain.User; import ua.neilo.ostrovok.repository.UserRepo; import ua.neilo.ostrovok.service.UserService; import java.util.*; import java.util.stream.Collectors; @Controller @RequestMapping("/users") @PreAuthorize("hasAuthority('ADMIN')") public class UserController { private final UserService userService; public UserController(UserService userService) { this.userService = userService; } @GetMapping public String userList(Model model) { List<User> users = userService.findAll(); Collections.sort(users); model.addAttribute("users", users); return "userList"; } @GetMapping("/edit/{id}") public String userEditForm(@PathVariable("id") Long id, Model model) { User user = userService.findById(id); model.addAttribute("user", user); model.addAttribute("roles", Role.values()); return "userEdit"; } @PostMapping public String userUpdate( @RequestParam String username, @RequestParam String password, @RequestParam String confirmPassword, @RequestParam String email, @RequestParam Map<String, String> form, @RequestParam ("userId") User user ) { user.setUsername(username); user.setPassword(password); user.setConfirmPassword(confirmPassword); user.setEmail(email); Set<String> roles = Arrays.stream(Role.values()) .map(Role::name) .collect(Collectors.toSet()); user.getRoles().clear(); for (String key : form.keySet()) { if (roles.contains(key)) { user.getRoles().add(Role.valueOf(key)); } } userService.save(user); return "redirect:/users"; } @GetMapping("/delete/{id}") public String userDelete(@PathVariable("id") Long id) { userService.deleteById(id); return "redirect:/users"; } }
2,453
0.634325
0.634325
83
28.554216
20.020021
65
false
false
0
0
0
0
0
0
0.53012
false
false
11
966f1549e3d8849858f7e34063e092145be6ba3e
12,000,138,664,806
185c038e5a02f1ab1a6001ed77051d2a25e5ca31
/sofitel2/hotel-sofiter-web-admin/src/main/java/com/hotel/sofiter/domain/receivetarget/ReceiveDeleteEntity.java
5730cf97f6838bada577b716d2e5a1acbb76d28e
[]
no_license
ZohnHe/project-hotel-sofiter
https://github.com/ZohnHe/project-hotel-sofiter
920dcbcc74497781fddb77c2d5021f311893bd08
73a220fcce5bb2441adf0bd47825d5ac31b7b747
refs/heads/master
2020-05-15T22:31:56.474000
2019-04-21T12:15:13
2019-04-21T12:15:13
182,529,113
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hotel.sofiter.domain.receivetarget; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.Size; /** * 删除接待对象 输入参数实体 */ public class ReceiveDeleteEntity { @ApiModelProperty("需要删除接待对象的ID") // @Size(min = 1,message = "需要删除的接待对象的ID不能为空") private String[] receiveId; public String[] getReceiveId() { return receiveId; } public void setReceiveId(String[] receiveId) { this.receiveId = receiveId; } }
UTF-8
Java
557
java
ReceiveDeleteEntity.java
Java
[]
null
[]
package com.hotel.sofiter.domain.receivetarget; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.Size; /** * 删除接待对象 输入参数实体 */ public class ReceiveDeleteEntity { @ApiModelProperty("需要删除接待对象的ID") // @Size(min = 1,message = "需要删除的接待对象的ID不能为空") private String[] receiveId; public String[] getReceiveId() { return receiveId; } public void setReceiveId(String[] receiveId) { this.receiveId = receiveId; } }
557
0.696099
0.694045
23
20.173914
19.250414
50
false
false
0
0
0
0
0
0
0.304348
false
false
11
7f7acad82fc0651077e888082ee9b709b3852ff3
10,857,677,373,666
c0e8ca84a5d1588702b6417a24c3698e815e2f2b
/source/com/redhat/ceylon/ide/netbeans/model/mirrors/Annotations.java
c981a4e1fd7320e024877e8cf9b8bc1cf6cf069f
[ "Apache-2.0" ]
permissive
Chris2011/ceylon-ide-netbeans
https://github.com/Chris2011/ceylon-ide-netbeans
e6b01d48d6079de27d3d9b8973576dcb21af2c72
1c4bf421a6ccfc95bb33ac2e6e61836ae12c0b87
refs/heads/master
2021-01-19T18:41:59.408000
2016-10-24T20:07:18
2016-10-24T20:07:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.redhat.ceylon.ide.netbeans.model.mirrors; enum Annotations { attribute(com.redhat.ceylon.compiler.java.metadata.Attribute.class), object(com.redhat.ceylon.compiler.java.metadata.Object.class), method(com.redhat.ceylon.compiler.java.metadata.Method.class), container(com.redhat.ceylon.compiler.java.metadata.Container.class), localContainer(com.redhat.ceylon.compiler.java.metadata.LocalContainer.class), ceylon(com.redhat.ceylon.compiler.java.metadata.Ceylon.class); final Class<?> klazz; private Annotations(Class<?> klazz) { this.klazz = klazz; } }
UTF-8
Java
614
java
Annotations.java
Java
[]
null
[]
package com.redhat.ceylon.ide.netbeans.model.mirrors; enum Annotations { attribute(com.redhat.ceylon.compiler.java.metadata.Attribute.class), object(com.redhat.ceylon.compiler.java.metadata.Object.class), method(com.redhat.ceylon.compiler.java.metadata.Method.class), container(com.redhat.ceylon.compiler.java.metadata.Container.class), localContainer(com.redhat.ceylon.compiler.java.metadata.LocalContainer.class), ceylon(com.redhat.ceylon.compiler.java.metadata.Ceylon.class); final Class<?> klazz; private Annotations(Class<?> klazz) { this.klazz = klazz; } }
614
0.7443
0.7443
16
37.375
29.601255
82
false
false
0
0
0
0
0
0
0.5625
false
false
11
c10dfa8ebf5cf5769bc69ecf1b604ef5bb273bbc
28,355,374,153,944
2b7bc4e511de41c98158991c3b00158fdd0fca4d
/src/xask00/study/designpatterns/composite/menu/MenuDemo.java
de402c72b02d8b96b5879d80106658f6eb98e7e9
[]
no_license
navneetvishwakarma/DesignPatterns
https://github.com/navneetvishwakarma/DesignPatterns
b3138bd8700022fc4d4401fdb2b68d97a86ab69c
5df04595b9a9beebcc4701a7a7b45f9e7cb5c68c
refs/heads/master
2020-05-22T23:24:33.524000
2017-07-31T12:25:20
2017-07-31T12:25:20
84,733,403
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xask00.study.designpatterns.composite.menu; public class MenuDemo { public static void main(String[] args) { Menu menu = new Menu("Navigation", "/home"); MenuItem miAccount = new MenuItem("My Profile", "/profile"); menu.add(miAccount); Menu mActions = new Menu("Actions", "/actions"); MenuItem miCut = new MenuItem("Cut", "/cut"); mActions.add(miCut); MenuItem miCopy = new MenuItem("Copy", "/copy"); mActions.add(miCopy); menu.add(mActions); System.out.println(menu); } }
UTF-8
Java
509
java
MenuDemo.java
Java
[]
null
[]
package xask00.study.designpatterns.composite.menu; public class MenuDemo { public static void main(String[] args) { Menu menu = new Menu("Navigation", "/home"); MenuItem miAccount = new MenuItem("My Profile", "/profile"); menu.add(miAccount); Menu mActions = new Menu("Actions", "/actions"); MenuItem miCut = new MenuItem("Cut", "/cut"); mActions.add(miCut); MenuItem miCopy = new MenuItem("Copy", "/copy"); mActions.add(miCopy); menu.add(mActions); System.out.println(menu); } }
509
0.681729
0.6778
19
25.789474
20.544123
62
false
false
0
0
0
0
0
0
2.105263
false
false
11
130aceb38b24dee936473755021bfe8329dfc054
27,547,920,268,199
2afe78a41af182bdb3841ddb7aaa4a1c09c4ab06
/src/com/assignment_4/subclasses/SavingAccount.java
5c2f414190ba797098d56f706c24311357a499f5
[]
no_license
imostrom/project-assignment04-idamostrom-britajonsson
https://github.com/imostrom/project-assignment04-idamostrom-britajonsson
e35764f64dd810dc9024250aa665c8c8f5f1ef73
e0e3e3f084c38ab7e0d9a1927bb43683118f8705
refs/heads/master
2021-08-12T04:03:28.605000
2017-11-14T12:19:38
2017-11-14T12:19:38
110,685,229
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.assignment_4.subclasses; import java.util.UUID; import com.assignment_4.superclasses.BankAccount; /** * The subclass SavingAccount extends the superclass BankAccount. * It sets information for a saving bank account * * * @author imostrom * @version 1.0 * */ public class SavingAccount extends BankAccount { /** * The method SavingAccount sets an UUID account number, sets the balance at 0.0 * and the account type to "Saving account". */ public SavingAccount() { this.setAccountNumber(UUID.randomUUID().toString().substring(0, 6)); this.setBalance(0.0); this.setAccountType("Saving account"); } }
UTF-8
Java
639
java
SavingAccount.java
Java
[ { "context": "ation for a saving bank account\n * \n * \n * @author imostrom\n * @version 1.0\n *\n */\npublic class SavingAccount", "end": 259, "score": 0.9899518489837646, "start": 251, "tag": "USERNAME", "value": "imostrom" } ]
null
[]
package com.assignment_4.subclasses; import java.util.UUID; import com.assignment_4.superclasses.BankAccount; /** * The subclass SavingAccount extends the superclass BankAccount. * It sets information for a saving bank account * * * @author imostrom * @version 1.0 * */ public class SavingAccount extends BankAccount { /** * The method SavingAccount sets an UUID account number, sets the balance at 0.0 * and the account type to "Saving account". */ public SavingAccount() { this.setAccountNumber(UUID.randomUUID().toString().substring(0, 6)); this.setBalance(0.0); this.setAccountType("Saving account"); } }
639
0.726135
0.710485
27
22.666666
24.476746
81
false
false
0
0
0
0
0
0
0.740741
false
false
11
96fb1d3b1b9ee0a7e74f3db7e3164aea9788b924
20,942,260,570,293
cf2fe3a55c4e88987ccde525a39e95d33425d9b6
/src/lcdminerstats/Parse.java
b4427309fc18ad46dbd2fa5162383441ec14d2ec
[]
no_license
geckoflume/LCDMinerStats
https://github.com/geckoflume/LCDMinerStats
40c971a02c77de707d15e5d097a48231ee1a91f5
e6ac80d28cd4c52f52c57b6c89cc921d181ea881
refs/heads/master
2021-01-25T14:22:15.575000
2018-03-03T21:02:12
2018-03-03T21:02:12
123,685,676
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lcdminerstats; import com.google.gson.*; /** * * @author geckoflume */ public class Parse { private int min; private String[] currencyStat; private String gpustat; private String errstat; public Parse() { this.min = 0; this.currencyStat = new String[2]; this.gpustat = ""; this.errstat = ""; } public void parseResult(String json) { Gson gson = new Gson(); JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject(); JsonArray array = jsonObject.get("result").getAsJsonArray(); this.min = gson.fromJson(array.get(1), int.class); this.currencyStat[0] = gson.fromJson(array.get(2), String.class); this.currencyStat[1] = gson.fromJson(array.get(4), String.class); this.gpustat = gson.fromJson(array.get(6), String.class); this.errstat = gson.fromJson(array.get(8), String.class); } public void parseTime(Miner m) { m.setMin(min); } private void parseCurstat(int curNum, Currency c) { String[] parts = this.currencyStat[curNum].split(";"); c.setHr(Integer.parseInt(parts[0])); c.setShares(Integer.parseInt(parts[1])); c.setRejected(Integer.parseInt(parts[2])); } private void parseErrstat(Currency c1, Currency c2) { String[] parts = this.errstat.split(";"); c1.setInvalid(Integer.parseInt(parts[0])); c2.setInvalid(Integer.parseInt(parts[2])); } public void parseAllCurstat(Currency c1, Currency c2) { parseCurstat(0, c1); parseCurstat(1, c2); parseErrstat(c1, c2); } public void parseGpustat(GPU[] g) { String[] parts = this.gpustat.split(";"); for (int i = 0; i < parts.length / 2; i++) { g[i].setTemp(Integer.parseInt(parts[i])); g[i].setFan(Integer.parseInt(parts[i + 1])); } } }
UTF-8
Java
1,920
java
Parse.java
Java
[ { "context": "ats;\n\nimport com.google.gson.*;\n\n/**\n *\n * @author geckoflume\n */\npublic class Parse {\n\n private int min;\n ", "end": 79, "score": 0.9995404481887817, "start": 69, "tag": "USERNAME", "value": "geckoflume" } ]
null
[]
package lcdminerstats; import com.google.gson.*; /** * * @author geckoflume */ public class Parse { private int min; private String[] currencyStat; private String gpustat; private String errstat; public Parse() { this.min = 0; this.currencyStat = new String[2]; this.gpustat = ""; this.errstat = ""; } public void parseResult(String json) { Gson gson = new Gson(); JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject(); JsonArray array = jsonObject.get("result").getAsJsonArray(); this.min = gson.fromJson(array.get(1), int.class); this.currencyStat[0] = gson.fromJson(array.get(2), String.class); this.currencyStat[1] = gson.fromJson(array.get(4), String.class); this.gpustat = gson.fromJson(array.get(6), String.class); this.errstat = gson.fromJson(array.get(8), String.class); } public void parseTime(Miner m) { m.setMin(min); } private void parseCurstat(int curNum, Currency c) { String[] parts = this.currencyStat[curNum].split(";"); c.setHr(Integer.parseInt(parts[0])); c.setShares(Integer.parseInt(parts[1])); c.setRejected(Integer.parseInt(parts[2])); } private void parseErrstat(Currency c1, Currency c2) { String[] parts = this.errstat.split(";"); c1.setInvalid(Integer.parseInt(parts[0])); c2.setInvalid(Integer.parseInt(parts[2])); } public void parseAllCurstat(Currency c1, Currency c2) { parseCurstat(0, c1); parseCurstat(1, c2); parseErrstat(c1, c2); } public void parseGpustat(GPU[] g) { String[] parts = this.gpustat.split(";"); for (int i = 0; i < parts.length / 2; i++) { g[i].setTemp(Integer.parseInt(parts[i])); g[i].setFan(Integer.parseInt(parts[i + 1])); } } }
1,920
0.600521
0.585417
66
28.09091
23.894165
79
false
false
0
0
0
0
0
0
0.727273
false
false
11
703fa322c88df42818dc5781423f2aca3fa37b7c
9,852,655,016,009
06ebecd9f00cf098d79e7210796a5490f2926225
/SelectionSort.java
c28068f7dd82a00e563e83828609974dc36d5ad8
[]
no_license
balqeesAldabaybah/sortingAlgorithms
https://github.com/balqeesAldabaybah/sortingAlgorithms
986f9079e573af5bee7e515f6e90e4755d315fa7
dfc4f9eaf28e3cf57ddc2b2e57752ea4dae4445e
refs/heads/master
2020-04-10T10:20:42.966000
2018-12-09T14:41:52
2018-12-09T14:41:52
160,963,366
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 sortingalgorithms; /** * * @author Balqees */ public class SelectionSort { static void selectionSort(int arr[]){ for(int i=0;i<arr.length;i++){ int min = findMin(arr, i); if(min != i) SharedOperations.swap(arr,min,i); } } private static int findMin(int arr[], int from){ int min= 999999999; int minIndex=-1; for(int i=from;i<arr.length;i++){ if(arr[i]<min){ min = arr[i]; minIndex = i; } } return minIndex; } }
UTF-8
Java
819
java
SelectionSort.java
Java
[ { "context": "\npackage sortingalgorithms;\r\n\r\n/**\r\n *\r\n * @author Balqees\r\n */\r\npublic class SelectionSort {\r\n \r\n \r\n ", "end": 247, "score": 0.9042180180549622, "start": 240, "tag": "NAME", "value": "Balqees" } ]
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 sortingalgorithms; /** * * @author Balqees */ public class SelectionSort { static void selectionSort(int arr[]){ for(int i=0;i<arr.length;i++){ int min = findMin(arr, i); if(min != i) SharedOperations.swap(arr,min,i); } } private static int findMin(int arr[], int from){ int min= 999999999; int minIndex=-1; for(int i=from;i<arr.length;i++){ if(arr[i]<min){ min = arr[i]; minIndex = i; } } return minIndex; } }
819
0.512821
0.499389
33
22.818182
19.29744
79
false
false
0
0
0
0
0
0
0.575758
false
false
11
ac966b93708a0e571c4fe16c8d78137b95d0c5ff
292,057,799,644
629b574cc6bd3818015dee88ec625dc81b82633b
/app/src/main/java/com/bishe/lzj/myhealth/Bean/OxygenSaturation.java
02a124a5a893a28fec3edea2f0ddd4d48adefecb
[ "Apache-2.0" ]
permissive
a568066242/MyHealth
https://github.com/a568066242/MyHealth
3c0d056f751dd9147e8b6d2c825608827fabadcf
0b5297876b4e228d624b86e943877a1ca76d6246
refs/heads/master
2021-01-18T21:21:32.203000
2016-05-17T08:23:23
2016-05-17T08:23:23
53,645,539
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bishe.lzj.myhealth.Bean; import java.util.Date; /** * Created by lzj on 2016/2/29. * 血氧饱和度 */ public class OxygenSaturation { private int id; private int userID; private Date date; private int os; public OxygenSaturation() { } public OxygenSaturation(int id, int userID, Date date, int os) { this.id = id; this.userID = userID; this.date = date; this.os = os; } public OxygenSaturation(int userID, Date date, int os) { this.userID = userID; this.date = date; this.os = os; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getOs() { return os; } public void setOs(int os) { this.os = os; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public int getUserID() { return userID; } public void setUserID(int userID) { this.userID = userID; } }
UTF-8
Java
1,090
java
OxygenSaturation.java
Java
[ { "context": "h.Bean;\n\nimport java.util.Date;\n\n/**\n * Created by lzj on 2016/2/29.\n * 血氧饱和度\n */\npublic class OxygenSat", "end": 83, "score": 0.9995373487472534, "start": 80, "tag": "USERNAME", "value": "lzj" } ]
null
[]
package com.bishe.lzj.myhealth.Bean; import java.util.Date; /** * Created by lzj on 2016/2/29. * 血氧饱和度 */ public class OxygenSaturation { private int id; private int userID; private Date date; private int os; public OxygenSaturation() { } public OxygenSaturation(int id, int userID, Date date, int os) { this.id = id; this.userID = userID; this.date = date; this.os = os; } public OxygenSaturation(int userID, Date date, int os) { this.userID = userID; this.date = date; this.os = os; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getOs() { return os; } public void setOs(int os) { this.os = os; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public int getUserID() { return userID; } public void setUserID(int userID) { this.userID = userID; } }
1,090
0.54537
0.538889
63
16.142857
14.961174
68
false
false
0
0
0
0
0
0
0.412698
false
false
11
c1b28c3d36fc2ec2af4f6a7436bd1190dc5ed86e
18,038,862,651,453
fafdbe7f3b84140b0c4d8bedf19c24a2a9b05ef4
/ChemCalc/src/pl/edu/pjwstk/chemcalc/code/ast/terminal/DoubleTerminal.java
c26c414a23a4fd7e5d7493cb265ffb2c08d06989
[]
no_license
slowbrain/chem-calc
https://github.com/slowbrain/chem-calc
ffa4ef58834645d31d546ac04d4dff31e9a90b9b
02d2743e7461521c2b3629a5ce1531477131b584
refs/heads/master
2021-01-19T08:10:49.427000
2014-02-09T20:37:37
2014-02-09T20:37:37
42,120,997
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.edu.pjwstk.chemcalc.code.ast.terminal; import pl.edu.pjwstk.chemcalc.code.ast.Expression; import pl.edu.pjwstk.chemcalc.code.visitor.ASTVisitor; public class DoubleTerminal extends Expression implements IDoubleTerminal { private Double value; public DoubleTerminal(Double value) { this.value = value; } public Double getValue() { return value; } public void accept(ASTVisitor visitor) { visitor.visitDoubleTerminal(this); } }
UTF-8
Java
512
java
DoubleTerminal.java
Java
[]
null
[]
package pl.edu.pjwstk.chemcalc.code.ast.terminal; import pl.edu.pjwstk.chemcalc.code.ast.Expression; import pl.edu.pjwstk.chemcalc.code.visitor.ASTVisitor; public class DoubleTerminal extends Expression implements IDoubleTerminal { private Double value; public DoubleTerminal(Double value) { this.value = value; } public Double getValue() { return value; } public void accept(ASTVisitor visitor) { visitor.visitDoubleTerminal(this); } }
512
0.689453
0.689453
20
23.700001
22.759832
75
false
false
0
0
0
0
0
0
0.35
false
false
11
65246fe35338c168210b055311d22c1082adbe48
5,403,068,894,500
2ae526aad71552be14a05328492ca7aa13f7f457
/app/src/main/java/com/wzy/lamanpro/dao/UserPassDaoUtils.java
01b4994c1c25f55e78382610d05de30dbe081492
[]
no_license
wzyxzy/RailWayPro
https://github.com/wzyxzy/RailWayPro
f601b0361604260541f2d7e778f620755d4daccc
5625862f134a4a89707a1ba7f3799b36c63ad215
refs/heads/master
2020-06-28T06:45:36.585000
2020-04-20T07:08:51
2020-04-20T07:08:51
200,167,157
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wzy.lamanpro.dao; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.widget.Toast; import com.wzy.lamanpro.bean.DaoMaster; import com.wzy.lamanpro.bean.DaoSession; import com.wzy.lamanpro.bean.UserPass; import com.wzy.lamanpro.bean.UserPassDao; import com.wzy.lamanpro.bean.Users; import com.wzy.lamanpro.bean.UsersDao; import org.greenrobot.greendao.query.QueryBuilder; import java.util.List; public class UserPassDaoUtils { private UserPassDao userPassDao; private Context context; public UserPassDaoUtils(Context context) { this.context = context; SQLiteDatabase writableDatabase = DBManager.getInstance(context).getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(writableDatabase); DaoSession daoSession = daoMaster.newSession(); userPassDao = daoSession.getUserPassDao(); } /** * 插入用户 * * @param users 账户 */ public boolean insertUserList(UserPass users) { if (users == null) { Toast.makeText(context, "账户信息有错,不能注册", Toast.LENGTH_SHORT).show(); return false; } if (queryUserSize(users.getAccount()) > 0) { Toast.makeText(context, "账户已存在,不能注册", Toast.LENGTH_SHORT).show(); return false; } userPassDao.insert(users); return true; } /** * 更新账户 * * @param users 用户账户 */ public void updateUser(UserPass users) { if (users == null) { return; } // users.setPassword(queryUserPass(users.getAccount())); userPassDao.update(users); } /** * 查询用户密码 */ public String queryUserPass(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)); if (qb.list() == null || qb.list().size() == 0) return ""; return qb.list().get(0).getPassword(); } /** * 查询用户个数 */ public int queryUserSize(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)); return qb.list().size(); } /** * 查询用户个数 */ public void deleteUser(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)).buildDelete().executeDeleteWithoutDetachingEntities(); } }
UTF-8
Java
2,619
java
UserPassDaoUtils.java
Java
[]
null
[]
package com.wzy.lamanpro.dao; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.widget.Toast; import com.wzy.lamanpro.bean.DaoMaster; import com.wzy.lamanpro.bean.DaoSession; import com.wzy.lamanpro.bean.UserPass; import com.wzy.lamanpro.bean.UserPassDao; import com.wzy.lamanpro.bean.Users; import com.wzy.lamanpro.bean.UsersDao; import org.greenrobot.greendao.query.QueryBuilder; import java.util.List; public class UserPassDaoUtils { private UserPassDao userPassDao; private Context context; public UserPassDaoUtils(Context context) { this.context = context; SQLiteDatabase writableDatabase = DBManager.getInstance(context).getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(writableDatabase); DaoSession daoSession = daoMaster.newSession(); userPassDao = daoSession.getUserPassDao(); } /** * 插入用户 * * @param users 账户 */ public boolean insertUserList(UserPass users) { if (users == null) { Toast.makeText(context, "账户信息有错,不能注册", Toast.LENGTH_SHORT).show(); return false; } if (queryUserSize(users.getAccount()) > 0) { Toast.makeText(context, "账户已存在,不能注册", Toast.LENGTH_SHORT).show(); return false; } userPassDao.insert(users); return true; } /** * 更新账户 * * @param users 用户账户 */ public void updateUser(UserPass users) { if (users == null) { return; } // users.setPassword(queryUserPass(users.getAccount())); userPassDao.update(users); } /** * 查询用户密码 */ public String queryUserPass(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)); if (qb.list() == null || qb.list().size() == 0) return ""; return qb.list().get(0).getPassword(); } /** * 查询用户个数 */ public int queryUserSize(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)); return qb.list().size(); } /** * 查询用户个数 */ public void deleteUser(String account) { QueryBuilder<UserPass> qb = userPassDao.queryBuilder(); qb.where(UserPassDao.Properties.Account.eq(account)).buildDelete().executeDeleteWithoutDetachingEntities(); } }
2,619
0.635098
0.633904
98
24.653061
24.558594
115
false
false
0
0
0
0
0
0
0.438776
false
false
11
a6fe0fd3fab5dc9848ad7d282bf8b48d9f8331e9
12,549,894,447,346
e769405e3e4f76ea20f166cefe213817c9e32b5d
/main/java/com/foya/noms/resources/AppConstants.java
781764bd3b2ae4727444f7f1761025302ca46537
[]
no_license
waitti0909/MySpirngBatis
https://github.com/waitti0909/MySpirngBatis
8be381af09f07e1c3c0414f99e1f64ccbc8f2f82
fa483aeb1fddb24e113134973085e756a5544c72
refs/heads/master
2016-09-06T17:44:04.870000
2015-05-09T01:02:13
2015-05-09T01:02:13
34,802,259
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.foya.noms.resources; import java.util.List; /** * 此程式用於系統常用參數(可init by property or xml) * * @author Charlie Woo * */ public class AppConstants { // 環境 public static final String DATE_PATTERN = "yyyy/MM/dd"; public static final String DATE_TIME_PATTERN = "yyyy/MM/dd HH:mm:ss"; public static String ENVIRONMENT = ""; public static String WORKFLOW_REST_HOST = "http://127.0.0.1:9090"; public static String NOMS_HOST = "http://127.0.0.1:8080"; // 共用 public static Integer PWD_MIN_LENGTH; public static Integer PWD_MAX_LENGTH; public static Integer PWD_PERIOD; public static Integer PWD_KEEP_TIMES; public static Integer PWD_ERR_TIMES; public static Boolean PWD_MIX_ENG_NUM; public static String MAIL_SMTP_HOST; public static String MAIL_SMTP_PROTOCAL; public static Boolean MAIL_SMTP_AUTHENTICATION; public static String MAIL_SMTP_AUTH_USER; public static String MAIL_SMTP_AUTH_PASSWORD; public static String MAIL_FROM; public static List<String> MAIL_TO_IT; public static List<String> CC_TO_IT; public static final String INSERT = "新增"; public static final String EDIT = "編輯"; public static final String UPDATE = "更新"; public static final String DELETE = "刪除"; public static final String SUCCESS = "成功"; public static final String FAILED = "失敗"; public static final String WORKFLOW_REST_APPROVAL = "APPROVAL"; public static final String WORKFLOW_REST_REJECT = "REJECT"; public static String WORKFLOW_FAIL_HANDLER = "admin"; public static String WORKFLOW_FAIL_HANDLER_TASK_NAME = "Rest fail handler"; // ExcelPdf型態 public static final String APPLICATION_PDF = "application/pdf"; public static final String APPLICATION_EXCEL = "application/vnd.ms-excel"; public static final String FILE_UPLOAD_ACTION = "UPLOAD"; public static final String FILE_DOWNLOAD_ACTION = "DOWNLOAD"; public static final String FILE_REPLACE_ACTION = "REPLACE"; public static final String FILE_DELETE_ACTION = "DELETE"; public static final int DEFAULTPAGENUMER = 1; public static final int DEFAULTDATASIZEPERPAGE = 10; /** 共站業者 */ public static final String SHARECOM = "SHARECOM"; /** 異動類別 */ public static final String LINE_APPLY_TYPE = "LINE_APPLY_TYPE"; /** 電路用途 */ public static final String LINE_PURPOSE = "CIRCUIT_USES"; /** 電路類別 */ public static final String LINE_TYPE = "CIRCUIT_TYPE"; /** 專線業者 */ public static final String LINE_ISP = "LINE_ISP"; /**使用類別*/ public static final String LINE_USE_TYPE = "LINE_USE_TYPE"; /**速率*/ public static final String LINE_TYPE_ADSL = "CIRCUIT_TYPE_ADSL"; public static final String LINE_TYPE_FIB = "CIRCUIT_TYPE_FIB"; public static final String LINE_TYPE_SDH = "CIRCUIT_TYPE_SDH"; public static final String LINE_TYPE_VPN = "CIRCUIT_TYPE_VPN"; public static final String LINE_TYPE_WAVE = "CIRCUIT_TYPE_WAVE"; public static final String LINE_TYPE_ELL = "CIRCUIT_TYPE_ELL"; public static String WebRealPathRoot = ""; public static String BASEFONT_TYPE_KAIU; }
UTF-8
Java
3,089
java
AppConstants.java
Java
[ { "context": "式用於系統常用參數(可init by property or xml)\n * \n * @author Charlie Woo\n * \n */\npublic class AppConstants {\n\t// 環境\n\tpubli", "end": 129, "score": 0.9997737407684326, "start": 118, "tag": "NAME", "value": "Charlie Woo" }, { "context": "public static String WORKFLOW_REST_HOST = \"http://127.0.0.1:9090\";\n\tpublic static String NOMS_HOST = \"http://", "end": 401, "score": 0.9996587038040161, "start": 392, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": ":9090\";\n\tpublic static String NOMS_HOST = \"http://127.0.0.1:8080\";\n\t\n\t// 共用\n\tpublic static Integer PWD_MIN_LE", "end": 460, "score": 0.9996283650398254, "start": 451, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package com.foya.noms.resources; import java.util.List; /** * 此程式用於系統常用參數(可init by property or xml) * * @author <NAME> * */ public class AppConstants { // 環境 public static final String DATE_PATTERN = "yyyy/MM/dd"; public static final String DATE_TIME_PATTERN = "yyyy/MM/dd HH:mm:ss"; public static String ENVIRONMENT = ""; public static String WORKFLOW_REST_HOST = "http://127.0.0.1:9090"; public static String NOMS_HOST = "http://127.0.0.1:8080"; // 共用 public static Integer PWD_MIN_LENGTH; public static Integer PWD_MAX_LENGTH; public static Integer PWD_PERIOD; public static Integer PWD_KEEP_TIMES; public static Integer PWD_ERR_TIMES; public static Boolean PWD_MIX_ENG_NUM; public static String MAIL_SMTP_HOST; public static String MAIL_SMTP_PROTOCAL; public static Boolean MAIL_SMTP_AUTHENTICATION; public static String MAIL_SMTP_AUTH_USER; public static String MAIL_SMTP_AUTH_PASSWORD; public static String MAIL_FROM; public static List<String> MAIL_TO_IT; public static List<String> CC_TO_IT; public static final String INSERT = "新增"; public static final String EDIT = "編輯"; public static final String UPDATE = "更新"; public static final String DELETE = "刪除"; public static final String SUCCESS = "成功"; public static final String FAILED = "失敗"; public static final String WORKFLOW_REST_APPROVAL = "APPROVAL"; public static final String WORKFLOW_REST_REJECT = "REJECT"; public static String WORKFLOW_FAIL_HANDLER = "admin"; public static String WORKFLOW_FAIL_HANDLER_TASK_NAME = "Rest fail handler"; // ExcelPdf型態 public static final String APPLICATION_PDF = "application/pdf"; public static final String APPLICATION_EXCEL = "application/vnd.ms-excel"; public static final String FILE_UPLOAD_ACTION = "UPLOAD"; public static final String FILE_DOWNLOAD_ACTION = "DOWNLOAD"; public static final String FILE_REPLACE_ACTION = "REPLACE"; public static final String FILE_DELETE_ACTION = "DELETE"; public static final int DEFAULTPAGENUMER = 1; public static final int DEFAULTDATASIZEPERPAGE = 10; /** 共站業者 */ public static final String SHARECOM = "SHARECOM"; /** 異動類別 */ public static final String LINE_APPLY_TYPE = "LINE_APPLY_TYPE"; /** 電路用途 */ public static final String LINE_PURPOSE = "CIRCUIT_USES"; /** 電路類別 */ public static final String LINE_TYPE = "CIRCUIT_TYPE"; /** 專線業者 */ public static final String LINE_ISP = "LINE_ISP"; /**使用類別*/ public static final String LINE_USE_TYPE = "LINE_USE_TYPE"; /**速率*/ public static final String LINE_TYPE_ADSL = "CIRCUIT_TYPE_ADSL"; public static final String LINE_TYPE_FIB = "CIRCUIT_TYPE_FIB"; public static final String LINE_TYPE_SDH = "CIRCUIT_TYPE_SDH"; public static final String LINE_TYPE_VPN = "CIRCUIT_TYPE_VPN"; public static final String LINE_TYPE_WAVE = "CIRCUIT_TYPE_WAVE"; public static final String LINE_TYPE_ELL = "CIRCUIT_TYPE_ELL"; public static String WebRealPathRoot = ""; public static String BASEFONT_TYPE_KAIU; }
3,084
0.734968
0.727242
92
31.369566
24.797316
76
false
false
0
0
0
0
0
0
1.304348
false
false
11
0156a27368d565ae622075cb991245d632d62251
21,981,642,654,584
741062fae9eeea13cdd7bbf3df82b1b2143c4fe3
/src/main/java/io/onepush/util/CriteriaCreator.java
a9e0eb4b796bb866a6f9a254d17b9b583b21bb25
[]
no_license
0xcryptowang/one-push
https://github.com/0xcryptowang/one-push
d9ebf6962193ad3fefb0931481e121d9c1c1b64a
989daf60245346d17a03d65dc8e70a627912b9c4
refs/heads/master
2021-10-23T14:02:25.401000
2016-05-13T00:23:56
2016-05-13T00:23:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.onepush.util; import org.springframework.data.mongodb.core.query.Criteria; import java.util.regex.Pattern; /** * Criteria构造辅助工具 * Created by yaoyasong on 2016/5/7. */ public final class CriteriaCreator { public static Criteria like(String parameter, String value) { Pattern pattern = Pattern.compile("^.*" + value + ".*$"); return Criteria.where(parameter).regex(pattern); } }
UTF-8
Java
431
java
CriteriaCreator.java
Java
[ { "context": "egex.Pattern;\n\n/**\n * Criteria构造辅助工具\n * Created by yaoyasong on 2016/5/7.\n */\npublic final class CriteriaCreat", "end": 166, "score": 0.9996204376220703, "start": 157, "tag": "USERNAME", "value": "yaoyasong" } ]
null
[]
package io.onepush.util; import org.springframework.data.mongodb.core.query.Criteria; import java.util.regex.Pattern; /** * Criteria构造辅助工具 * Created by yaoyasong on 2016/5/7. */ public final class CriteriaCreator { public static Criteria like(String parameter, String value) { Pattern pattern = Pattern.compile("^.*" + value + ".*$"); return Criteria.where(parameter).regex(pattern); } }
431
0.696897
0.682578
17
23.647058
24.425014
65
false
false
0
0
0
0
0
0
0.352941
false
false
11
ce787eff0d4692ef9d6fae3bbc36afa079fc55b4
30,331,059,101,590
c41b2c2d166ca0d2748d85c5ee013cca32fd57bd
/src/ch05_singleton/Singleton4.java
e27d1d0710e8a39c7e56a34eb4ecb0358e9f4004
[]
no_license
youngzhu/HeadFirstDesignPattern
https://github.com/youngzhu/HeadFirstDesignPattern
a45c0e8e62aa8d9701240722a5670ee96559cc71
1c73471d2b8b15fc58ea4ac85bcd8ff7bb17f997
refs/heads/master
2021-04-30T16:35:42.974000
2017-02-05T14:37:51
2017-02-05T14:37:51
80,081,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ch05_singleton; /** * v4.0 * 双重检查加锁(double-checked locking) * * ********************************** * * v3.0 * 静态初始化 * * ********************************** * * v2.0 * 处理多线程,最简单的方式就是使用 synchronized * * 但这也有一个问题: * 一单创建好实例变量,后面就不需要同步这块代码了。之后的每次调用,同步都是一种累赘。 * * 同步一个方法可能造成效率下降100倍。 * * *********************************** * * 单例 v1.0 * * 有个问题:多线程环境中可能生成多个实例 * * @author by Yang.ZHU * on 2017-1-12 * * * Package&FileName: ch05_singleton.Singleton */ public class Singleton4 { /* * 关键字 volatile * 线程在每次使用被 volatile 修饰的变量时都会读取修改后的最新的值 */ private volatile static Singleton4 uniqueInstance; private Singleton4() {}; public static Singleton4 getInstance() { if (uniqueInstance == null) { synchronized (Singleton4.class) { if (uniqueInstance == null) { uniqueInstance = new Singleton4(); } } } return uniqueInstance; } }
UTF-8
Java
1,249
java
Singleton4.java
Java
[ { "context": "0\r\n * \r\n * 有个问题:多线程环境中可能生成多个实例\r\n * \r\n * @author by Yang.ZHU\r\n *\ton 2017-1-12\r\n *\r\n * \r\n * Package&FileName: c", "end": 448, "score": 0.9986122846603394, "start": 440, "tag": "NAME", "value": "Yang.ZHU" } ]
null
[]
package ch05_singleton; /** * v4.0 * 双重检查加锁(double-checked locking) * * ********************************** * * v3.0 * 静态初始化 * * ********************************** * * v2.0 * 处理多线程,最简单的方式就是使用 synchronized * * 但这也有一个问题: * 一单创建好实例变量,后面就不需要同步这块代码了。之后的每次调用,同步都是一种累赘。 * * 同步一个方法可能造成效率下降100倍。 * * *********************************** * * 单例 v1.0 * * 有个问题:多线程环境中可能生成多个实例 * * @author by Yang.ZHU * on 2017-1-12 * * * Package&FileName: ch05_singleton.Singleton */ public class Singleton4 { /* * 关键字 volatile * 线程在每次使用被 volatile 修饰的变量时都会读取修改后的最新的值 */ private volatile static Singleton4 uniqueInstance; private Singleton4() {}; public static Singleton4 getInstance() { if (uniqueInstance == null) { synchronized (Singleton4.class) { if (uniqueInstance == null) { uniqueInstance = new Singleton4(); } } } return uniqueInstance; } }
1,249
0.530761
0.501564
55
15.436363
15.284887
51
false
false
0
0
0
0
0
0
0.781818
false
false
11
fce6d708ae7c001df6ea7c48be618780d05f2190
30,545,807,410,550
d08afc6684b9ce92101cd8cf7bf181325557349a
/src/io/smudgr/app/project/util/ProjectLoader.java
1219941d7f722a9bc797cb45ad428e58f4e295f3
[]
no_license
skykistler/smudgr
https://github.com/skykistler/smudgr
d53c1987387e4d6b16d4b38f205102a639998347
08b04258cc8400338715f6625ffd748f6763b6a1
refs/heads/master
2021-03-27T19:17:11.709000
2018-09-24T14:35:18
2018-09-24T14:35:18
47,445,006
2
2
null
false
2018-09-24T14:28:48
2015-12-05T06:14:57
2018-09-23T12:45:50
2018-09-24T14:28:47
246,158
2
0
26
Java
false
null
package io.smudgr.app.project.util; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import io.smudgr.app.controller.Controller; import io.smudgr.app.project.Project; /** * The {@link ProjectLoader} class can load an XML file containing * {@link Project} data. * * @see ProjectSaver */ public class ProjectLoader { private String path; /** * Create a new {@link ProjectLoader} without a specified path. This can be * used to bootstrap a new {@link Project} without immediately specifying a * save location. * * @see ProjectLoader#ProjectLoader(String) */ public ProjectLoader() { this(null); } /** * Create a new {@link ProjectLoader} to load a project from an existing * file. * * @param path * Absolute or relative project file location. * @see ProjectLoader#ProjectLoader() */ public ProjectLoader(String path) { if (path != null && !path.endsWith(Project.PROJECT_EXTENSION)) path += Project.PROJECT_EXTENSION; this.path = path; } /** * Loads the project. * <p> * The currently running application instance (if any) must be paused and is * not resumed automatically. */ public void load() { PropertyMap projectMap = loadXML(); Controller controller = Controller.getInstance(); controller.pause(); Project project = new Project(); if (path != null) project.setProjectPath(path); try { project.load(projectMap); } catch (Exception e) { e.printStackTrace(); System.err.println("Could not load save file. Possibly corrupted"); project = new Project(); project.load(new PropertyMap("project")); } } private PropertyMap loadXML() { PropertyMap project = new PropertyMap("project"); if (path == null) { System.out.println("Creating new project..."); return project; } File xml = new File(path); if (!xml.exists()) { System.out.println("Did not find file: " + xml.getAbsolutePath()); System.out.println("Creating new project..."); return project; } try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(xml); doc.getDocumentElement().normalize(); Node projectNode = doc.getElementsByTagName("project").item(0); loadProperties(project, projectNode); } catch (Exception e) { e.printStackTrace(); System.out.println("Problem loading project at " + path); } return project; } private void loadProperties(PropertyMap parentMap, Node parentNode) { NamedNodeMap attributes = parentNode.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Node attribute = attributes.item(i); parentMap.setAttribute(attribute.getNodeName(), attribute.getNodeValue()); } NodeList nodes = parentNode.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node childNode = nodes.item(i); if (!childNode.getParentNode().isSameNode(parentNode) || childNode.getNodeName().startsWith("#")) continue; PropertyMap childMap = new PropertyMap(childNode.getNodeName()); loadProperties(childMap, childNode); parentMap.add(childMap); } } }
UTF-8
Java
3,348
java
ProjectLoader.java
Java
[]
null
[]
package io.smudgr.app.project.util; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import io.smudgr.app.controller.Controller; import io.smudgr.app.project.Project; /** * The {@link ProjectLoader} class can load an XML file containing * {@link Project} data. * * @see ProjectSaver */ public class ProjectLoader { private String path; /** * Create a new {@link ProjectLoader} without a specified path. This can be * used to bootstrap a new {@link Project} without immediately specifying a * save location. * * @see ProjectLoader#ProjectLoader(String) */ public ProjectLoader() { this(null); } /** * Create a new {@link ProjectLoader} to load a project from an existing * file. * * @param path * Absolute or relative project file location. * @see ProjectLoader#ProjectLoader() */ public ProjectLoader(String path) { if (path != null && !path.endsWith(Project.PROJECT_EXTENSION)) path += Project.PROJECT_EXTENSION; this.path = path; } /** * Loads the project. * <p> * The currently running application instance (if any) must be paused and is * not resumed automatically. */ public void load() { PropertyMap projectMap = loadXML(); Controller controller = Controller.getInstance(); controller.pause(); Project project = new Project(); if (path != null) project.setProjectPath(path); try { project.load(projectMap); } catch (Exception e) { e.printStackTrace(); System.err.println("Could not load save file. Possibly corrupted"); project = new Project(); project.load(new PropertyMap("project")); } } private PropertyMap loadXML() { PropertyMap project = new PropertyMap("project"); if (path == null) { System.out.println("Creating new project..."); return project; } File xml = new File(path); if (!xml.exists()) { System.out.println("Did not find file: " + xml.getAbsolutePath()); System.out.println("Creating new project..."); return project; } try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(xml); doc.getDocumentElement().normalize(); Node projectNode = doc.getElementsByTagName("project").item(0); loadProperties(project, projectNode); } catch (Exception e) { e.printStackTrace(); System.out.println("Problem loading project at " + path); } return project; } private void loadProperties(PropertyMap parentMap, Node parentNode) { NamedNodeMap attributes = parentNode.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Node attribute = attributes.item(i); parentMap.setAttribute(attribute.getNodeName(), attribute.getNodeValue()); } NodeList nodes = parentNode.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node childNode = nodes.item(i); if (!childNode.getParentNode().isSameNode(parentNode) || childNode.getNodeName().startsWith("#")) continue; PropertyMap childMap = new PropertyMap(childNode.getNodeName()); loadProperties(childMap, childNode); parentMap.add(childMap); } } }
3,348
0.69773
0.695639
135
23.799999
24.071438
100
false
false
0
0
0
0
0
0
1.703704
false
false
11
34924dc4b0c8234996055819841dff08eac460e1
77,309,456,225
4cae2db6009aa87f319d2e2eaef63dc755fc2f28
/app/src/main/java/com/event/cs/csevent/model/ProductItem.java
91cc0be811bf4fcb14c26e5ac1aaca8733dbc11c
[]
no_license
pleming/cs-event
https://github.com/pleming/cs-event
4b49a8291cd1f504ec234b6218dd696984b85230
d7ea824aef192f4d32e5bb7714d6a46d09c3cabf
refs/heads/master
2020-04-06T21:00:11.273000
2018-12-03T11:48:44
2018-12-03T11:48:44
157,789,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.event.cs.csevent.model; public class ProductItem { private String csName; private byte[] productImage; private String productName; private String eventType; private String price; public ProductItem() { } public ProductItem(String csName, byte[] productImage, String productName, String eventType, String price) { this.csName = csName; this.productImage = productImage; this.productName = productName; this.eventType = eventType; this.price = price; } public String getCsName() { return csName; } public void setCsName(String csName) { this.csName = csName; } public byte[] getProductImage() { return productImage; } public void setProductImage(byte[] productImage) { this.productImage = productImage; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public String getEventType() { return eventType; } public void setEventType(String eventType) { this.eventType = eventType; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } }
UTF-8
Java
1,332
java
ProductItem.java
Java
[]
null
[]
package com.event.cs.csevent.model; public class ProductItem { private String csName; private byte[] productImage; private String productName; private String eventType; private String price; public ProductItem() { } public ProductItem(String csName, byte[] productImage, String productName, String eventType, String price) { this.csName = csName; this.productImage = productImage; this.productName = productName; this.eventType = eventType; this.price = price; } public String getCsName() { return csName; } public void setCsName(String csName) { this.csName = csName; } public byte[] getProductImage() { return productImage; } public void setProductImage(byte[] productImage) { this.productImage = productImage; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public String getEventType() { return eventType; } public void setEventType(String eventType) { this.eventType = eventType; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } }
1,332
0.632132
0.632132
60
21.200001
20.252407
112
false
false
0
0
0
0
0
0
0.416667
false
false
11
d27487ff9d598a2bab94455a7e4cc9b90829a66a
8,323,646,675,293
89a7775df216e937c427ca12ceedac5b91779d7f
/src/com/company/MultithreadedProgramming/PriorityThreadDemo.java
9d3cb5ad81354486ab98ffd0773795098a3e9fef
[]
no_license
Rasper4o/OracleDemos
https://github.com/Rasper4o/OracleDemos
e6beb08332f32d2bd030cbc859cab68aeb49b0e4
c59cadb75b38f5e522fceaa9227e5e530ef6e0a5
refs/heads/master
2021-06-23T12:34:56.993000
2017-07-29T19:59:41
2017-07-29T19:59:41
97,162,207
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.MultithreadedProgramming; public class PriorityThreadDemo { public static void main(String[] args) { PriorityThread priorityThread1=new PriorityThread("High Priority"); PriorityThread priorityThread2=new PriorityThread("Low Priority"); priorityThread1.thread.setPriority(Thread.NORM_PRIORITY+2); priorityThread2.thread.setPriority(Thread.NORM_PRIORITY-2); priorityThread1.thread.start(); priorityThread2.thread.start(); try { priorityThread1.thread.join(); priorityThread2.thread.join(); } catch (InterruptedException exception) { System.out.println("Main thread interrupted."); } System.out.println("High priority thread counted to: "+priorityThread1.count); System.out.println("Low priority thread counted to: "+priorityThread2.count); } }
UTF-8
Java
928
java
PriorityThreadDemo.java
Java
[]
null
[]
package com.company.MultithreadedProgramming; public class PriorityThreadDemo { public static void main(String[] args) { PriorityThread priorityThread1=new PriorityThread("High Priority"); PriorityThread priorityThread2=new PriorityThread("Low Priority"); priorityThread1.thread.setPriority(Thread.NORM_PRIORITY+2); priorityThread2.thread.setPriority(Thread.NORM_PRIORITY-2); priorityThread1.thread.start(); priorityThread2.thread.start(); try { priorityThread1.thread.join(); priorityThread2.thread.join(); } catch (InterruptedException exception) { System.out.println("Main thread interrupted."); } System.out.println("High priority thread counted to: "+priorityThread1.count); System.out.println("Low priority thread counted to: "+priorityThread2.count); } }
928
0.665948
0.653017
29
31
28.989891
86
false
false
0
0
0
0
0
0
0.413793
false
false
11
387c34cfa6e4a4841ddb47482159fe798d13fdcd
16,612,933,533,394
116ece0a9f52861e3079ccaa89263d62a462759d
/TalosCamunda/src/main/java/module-info.java
b62c97f052a9b8a8bc09441657fa989aee8ba05f
[ "MIT", "Apache-2.0" ]
permissive
daoos/Talos
https://github.com/daoos/Talos
ccb55ce4cb4784326267f276a506c7f8b57919ea
bc44a9c50f0cc6afa162d97bcb8cd39b89a43399
refs/heads/master
2022-12-06T17:25:12.583000
2020-08-24T09:18:06
2020-08-24T09:18:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
module talosCamunda { exports de.hpi.bpt.talos.talosCamunda; requires camunda.engine; requires de.hpi.bpt.talos; requires javax.servlet.api; requires mybatis; requires de.hpi.bpt.talos.talosUiPath; }
UTF-8
Java
214
java
module-info.java
Java
[]
null
[]
module talosCamunda { exports de.hpi.bpt.talos.talosCamunda; requires camunda.engine; requires de.hpi.bpt.talos; requires javax.servlet.api; requires mybatis; requires de.hpi.bpt.talos.talosUiPath; }
214
0.757009
0.757009
9
22
13.291601
39
false
false
0
0
0
0
0
0
1.333333
false
false
11
9ce8629d35ccc20e5e305e4e438899d0c6d7c885
25,074,019,131,185
8090654411d30b9fa9dd7acf46ba51aa1a5e1385
/core/src/com/axuq15/battle_against_shapes/toolbox/Player.java
ba5bb32283446eb8ed90d6a2b03dbc7c04412205
[]
no_license
axuq15/battle_against_shapes
https://github.com/axuq15/battle_against_shapes
853501cc44448b7eb57f3f0f62120071dc88b7ff
ef322ce6da2a890ffef637317f18ded966067d92
refs/heads/master
2020-03-16T08:54:04.592000
2018-05-08T13:12:51
2018-05-08T13:12:51
132,604,566
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.axuq15.battle_against_shapes.toolbox; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.axuq15.battle_against_shapes.GameBAS; import com.axuq15.battle_against_shapes.game_world.game_objects.general_objects.Fighter; import com.axuq15.battle_against_shapes.game_world.game_objects.weapons.Weapon; import com.axuq15.battle_against_shapes.managers.ControlManager; import com.axuq15.battle_against_shapes.managers.GameModeStatsManager; /** * Manages the data of the player and controls the player. */ public class Player { public GameBAS gameBAS; public ControlManager controlManager; public GameModeStatsManager gameModeStatsManager; public Fighter fighter; public Weapon primaryWeapon; public Weapon secondaryWeapon; public Player(GameBAS gameBAS) { this.gameBAS = gameBAS; controlManager = new ControlManager(); gameModeStatsManager = new GameModeStatsManager(gameBAS); } public void update(float deltaTime) { //if (primaryWeapon instanceof Flamethrower) // ((Flamethrower) primaryWeapon).setDestroy(true); controlManager.update(deltaTime); fighter.update(deltaTime); primaryWeapon.update(deltaTime); secondaryWeapon.update(deltaTime); if (controlManager.btMoveUpPress) fighter.box2DBody.applyForceToCenter(0, 120, true); if (controlManager.btMoveDownPress) fighter.box2DBody.applyForceToCenter(0, -120, true); if (controlManager.btUsePriWeaPress) primaryWeapon.shoot(); if (controlManager.btUseSecWeaPress) secondaryWeapon.shoot(); } public void draw(SpriteBatch spriteBatch) { fighter.draw(spriteBatch); primaryWeapon.draw(spriteBatch); secondaryWeapon.draw(spriteBatch); } }
UTF-8
Java
1,834
java
Player.java
Java
[]
null
[]
package com.axuq15.battle_against_shapes.toolbox; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.axuq15.battle_against_shapes.GameBAS; import com.axuq15.battle_against_shapes.game_world.game_objects.general_objects.Fighter; import com.axuq15.battle_against_shapes.game_world.game_objects.weapons.Weapon; import com.axuq15.battle_against_shapes.managers.ControlManager; import com.axuq15.battle_against_shapes.managers.GameModeStatsManager; /** * Manages the data of the player and controls the player. */ public class Player { public GameBAS gameBAS; public ControlManager controlManager; public GameModeStatsManager gameModeStatsManager; public Fighter fighter; public Weapon primaryWeapon; public Weapon secondaryWeapon; public Player(GameBAS gameBAS) { this.gameBAS = gameBAS; controlManager = new ControlManager(); gameModeStatsManager = new GameModeStatsManager(gameBAS); } public void update(float deltaTime) { //if (primaryWeapon instanceof Flamethrower) // ((Flamethrower) primaryWeapon).setDestroy(true); controlManager.update(deltaTime); fighter.update(deltaTime); primaryWeapon.update(deltaTime); secondaryWeapon.update(deltaTime); if (controlManager.btMoveUpPress) fighter.box2DBody.applyForceToCenter(0, 120, true); if (controlManager.btMoveDownPress) fighter.box2DBody.applyForceToCenter(0, -120, true); if (controlManager.btUsePriWeaPress) primaryWeapon.shoot(); if (controlManager.btUseSecWeaPress) secondaryWeapon.shoot(); } public void draw(SpriteBatch spriteBatch) { fighter.draw(spriteBatch); primaryWeapon.draw(spriteBatch); secondaryWeapon.draw(spriteBatch); } }
1,834
0.720284
0.707743
51
34.980392
23.172405
88
false
false
0
0
0
0
0
0
0.627451
false
false
11
061b84ce708643f6d1a457a18999c52a79257726
14,173,392,128,809
56772b2167bc8a250aaf3277d5c265583de1f1be
/src/main/java/easy/domain/rules/DateShouldGreaterThanRule.java
8ad81190b1e5a09113da09d628ce10491e42762a
[]
no_license
hahalixiaojing/easy.domain.java
https://github.com/hahalixiaojing/easy.domain.java
2c1e75ded8e1c139f8d437ccc4191bc4bbb3dd3e
129a51341b6207d3464d734a19ab20ed682d228f
refs/heads/master
2021-01-16T23:53:51.129000
2018-04-11T06:52:00
2018-04-11T06:52:00
56,763,824
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package easy.domain.rules; import java.util.Calendar; import java.util.Date; import org.apache.commons.lang3.time.DateUtils; public class DateShouldGreaterThanRule<T> extends BaseRule<T, Date> { private Date date; public DateShouldGreaterThanRule(String property, Date date) { super(property); this.date = DateUtils.truncate(date, Calendar.SECOND); } @Override public boolean isSatisfy(T model) { Date d = this.getObjectAttrValue(model); d = DateUtils.truncate(d, Calendar.SECOND); return d.compareTo(this.date) > 0; } }
UTF-8
Java
546
java
DateShouldGreaterThanRule.java
Java
[]
null
[]
package easy.domain.rules; import java.util.Calendar; import java.util.Date; import org.apache.commons.lang3.time.DateUtils; public class DateShouldGreaterThanRule<T> extends BaseRule<T, Date> { private Date date; public DateShouldGreaterThanRule(String property, Date date) { super(property); this.date = DateUtils.truncate(date, Calendar.SECOND); } @Override public boolean isSatisfy(T model) { Date d = this.getObjectAttrValue(model); d = DateUtils.truncate(d, Calendar.SECOND); return d.compareTo(this.date) > 0; } }
546
0.749084
0.745421
26
20
22.088982
69
false
false
0
0
0
0
0
0
1.153846
false
false
11
94bb22561b4613f5ddc5a3d0a531a3366008f871
14,173,392,131,487
fc85b066ed4d1d2673b46ba1d720f48247494fed
/Session11/src/FileDemo/FileDemo1.java
ef8ff900a093d4ddfdd5591b5d6a2660ca15d66d
[]
no_license
Fatsfish/Summer2020_PRO192
https://github.com/Fatsfish/Summer2020_PRO192
34b058cc87a5fa04e69e4c1b51b305bc7ee96678
8c8824aac251080c6a0a1bde9a0f9a816e7aeaa2
refs/heads/main
2023-06-16T04:51:10.399000
2021-07-16T15:30:27
2021-07-16T15:30:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FileDemo; import java.io.*; import java.util.Date; /** * * @author Kyro */ public class FileDemo1 { public static void main(String[] args) throws IOException { File f = new File("f1.txt"); System.out.println("Tên file là: " + f.getName()); System.out.println("Tên file tuyệt đối là: " + f.getAbsoluteFile()); System.out.println("Đường dẫn tuyệt đối là: " + f.getAbsolutePath()); System.out.println("Path chuẩn là: " + f.getCanonicalPath()); System.out.println("Ngày cập nhật cuối cùng là: " + new Date(f.lastModified())); System.out.println("Thuộc tính Hidden: " + f.isHidden()); System.out.println("Thuộc tính can-read: " + f.canRead()); System.out.println("Thuộc tính can-write: " + f.canWrite()); System.out.println("Kích thước file: " + f.length() + " byte"); } }
UTF-8
Java
916
java
FileDemo1.java
Java
[ { "context": "va.io.*;\nimport java.util.Date;\n\n/**\n *\n * @author Kyro\n */\npublic class FileDemo1 {\n\n public static v", "end": 83, "score": 0.9914155006408691, "start": 79, "tag": "USERNAME", "value": "Kyro" } ]
null
[]
package FileDemo; import java.io.*; import java.util.Date; /** * * @author Kyro */ public class FileDemo1 { public static void main(String[] args) throws IOException { File f = new File("f1.txt"); System.out.println("Tên file là: " + f.getName()); System.out.println("Tên file tuyệt đối là: " + f.getAbsoluteFile()); System.out.println("Đường dẫn tuyệt đối là: " + f.getAbsolutePath()); System.out.println("Path chuẩn là: " + f.getCanonicalPath()); System.out.println("Ngày cập nhật cuối cùng là: " + new Date(f.lastModified())); System.out.println("Thuộc tính Hidden: " + f.isHidden()); System.out.println("Thuộc tính can-read: " + f.canRead()); System.out.println("Thuộc tính can-write: " + f.canWrite()); System.out.println("Kích thước file: " + f.length() + " byte"); } }
916
0.613793
0.611494
24
35.25
31.074171
88
false
false
0
0
0
0
0
0
0.541667
false
false
11
9d34690f00b7bae67436ebb2743d073dad4a0d79
22,694,607,231,747
9f01667b6fb503536fecad25ee4a45f36da53472
/src/main/java/br/com/web/rest/OperadorCaixaResource.java
333b874113778e5e00f535e579b1b34313f023b2
[]
no_license
diegodourado555/funpark
https://github.com/diegodourado555/funpark
27cff0836e375b60d2831e790d09c4a1ff040a65
4b584b8dde9b63b96568f32a745a2f7fae1bb7f4
refs/heads/master
2022-12-26T13:06:26.649000
2021-07-17T09:48:07
2021-07-17T09:48:07
228,429,653
0
0
null
false
2022-12-16T04:42:21
2019-12-16T16:34:46
2021-07-17T09:49:56
2022-12-16T04:42:18
2,226
0
0
7
Java
false
false
package br.com.web.rest; import br.com.service.OperadorCaixaService; import br.com.web.rest.errors.BadRequestAlertException; import br.com.service.dto.OperadorCaixaDTO; import io.github.jhipster.web.util.HeaderUtil; import io.github.jhipster.web.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing {@link br.com.domain.OperadorCaixa}. */ @RestController @RequestMapping("/api") public class OperadorCaixaResource { private final Logger log = LoggerFactory.getLogger(OperadorCaixaResource.class); private static final String ENTITY_NAME = "operadorCaixa"; @Value("${jhipster.clientApp.name}") private String applicationName; private final OperadorCaixaService operadorCaixaService; public OperadorCaixaResource(OperadorCaixaService operadorCaixaService) { this.operadorCaixaService = operadorCaixaService; } /** * {@code POST /operador-caixas} : Create a new operadorCaixa. * * @param operadorCaixaDTO the operadorCaixaDTO to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new operadorCaixaDTO, or with status {@code 400 (Bad Request)} if the operadorCaixa has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PostMapping("/operador-caixas") public ResponseEntity<OperadorCaixaDTO> createOperadorCaixa(@RequestBody OperadorCaixaDTO operadorCaixaDTO) throws URISyntaxException { log.debug("REST request to save OperadorCaixa : {}", operadorCaixaDTO); if (operadorCaixaDTO.getId() != null) { throw new BadRequestAlertException("A new operadorCaixa cannot already have an ID", ENTITY_NAME, "idexists"); } OperadorCaixaDTO result = operadorCaixaService.save(operadorCaixaDTO); return ResponseEntity.created(new URI("/api/operador-caixas/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .body(result); } /** * {@code PUT /operador-caixas} : Updates an existing operadorCaixa. * * @param operadorCaixaDTO the operadorCaixaDTO to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated operadorCaixaDTO, * or with status {@code 400 (Bad Request)} if the operadorCaixaDTO is not valid, * or with status {@code 500 (Internal Server Error)} if the operadorCaixaDTO couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PutMapping("/operador-caixas") public ResponseEntity<OperadorCaixaDTO> updateOperadorCaixa(@RequestBody OperadorCaixaDTO operadorCaixaDTO) throws URISyntaxException { log.debug("REST request to update OperadorCaixa : {}", operadorCaixaDTO); if (operadorCaixaDTO.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } OperadorCaixaDTO result = operadorCaixaService.save(operadorCaixaDTO); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, operadorCaixaDTO.getId().toString())) .body(result); } /** * {@code GET /operador-caixas} : get all the operadorCaixas. * * @param pageable the pagination information. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of operadorCaixas in body. */ @GetMapping("/operador-caixas") public ResponseEntity<List<OperadorCaixaDTO>> getAllOperadorCaixas(Pageable pageable) { log.debug("REST request to get a page of OperadorCaixas"); Page<OperadorCaixaDTO> page = operadorCaixaService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } /** * {@code GET /operador-caixas/:id} : get the "id" operadorCaixa. * * @param id the id of the operadorCaixaDTO to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the operadorCaixaDTO, or with status {@code 404 (Not Found)}. */ @GetMapping("/operador-caixas/{id}") public ResponseEntity<OperadorCaixaDTO> getOperadorCaixa(@PathVariable Long id) { log.debug("REST request to get OperadorCaixa : {}", id); Optional<OperadorCaixaDTO> operadorCaixaDTO = operadorCaixaService.findOne(id); return ResponseUtil.wrapOrNotFound(operadorCaixaDTO); } /** * {@code DELETE /operador-caixas/:id} : delete the "id" operadorCaixa. * * @param id the id of the operadorCaixaDTO to delete. * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. */ @DeleteMapping("/operador-caixas/{id}") public ResponseEntity<Void> deleteOperadorCaixa(@PathVariable Long id) { log.debug("REST request to delete OperadorCaixa : {}", id); operadorCaixaService.delete(id); return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); } }
UTF-8
Java
5,913
java
OperadorCaixaResource.java
Java
[]
null
[]
package br.com.web.rest; import br.com.service.OperadorCaixaService; import br.com.web.rest.errors.BadRequestAlertException; import br.com.service.dto.OperadorCaixaDTO; import io.github.jhipster.web.util.HeaderUtil; import io.github.jhipster.web.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing {@link br.com.domain.OperadorCaixa}. */ @RestController @RequestMapping("/api") public class OperadorCaixaResource { private final Logger log = LoggerFactory.getLogger(OperadorCaixaResource.class); private static final String ENTITY_NAME = "operadorCaixa"; @Value("${jhipster.clientApp.name}") private String applicationName; private final OperadorCaixaService operadorCaixaService; public OperadorCaixaResource(OperadorCaixaService operadorCaixaService) { this.operadorCaixaService = operadorCaixaService; } /** * {@code POST /operador-caixas} : Create a new operadorCaixa. * * @param operadorCaixaDTO the operadorCaixaDTO to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new operadorCaixaDTO, or with status {@code 400 (Bad Request)} if the operadorCaixa has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PostMapping("/operador-caixas") public ResponseEntity<OperadorCaixaDTO> createOperadorCaixa(@RequestBody OperadorCaixaDTO operadorCaixaDTO) throws URISyntaxException { log.debug("REST request to save OperadorCaixa : {}", operadorCaixaDTO); if (operadorCaixaDTO.getId() != null) { throw new BadRequestAlertException("A new operadorCaixa cannot already have an ID", ENTITY_NAME, "idexists"); } OperadorCaixaDTO result = operadorCaixaService.save(operadorCaixaDTO); return ResponseEntity.created(new URI("/api/operador-caixas/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .body(result); } /** * {@code PUT /operador-caixas} : Updates an existing operadorCaixa. * * @param operadorCaixaDTO the operadorCaixaDTO to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated operadorCaixaDTO, * or with status {@code 400 (Bad Request)} if the operadorCaixaDTO is not valid, * or with status {@code 500 (Internal Server Error)} if the operadorCaixaDTO couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PutMapping("/operador-caixas") public ResponseEntity<OperadorCaixaDTO> updateOperadorCaixa(@RequestBody OperadorCaixaDTO operadorCaixaDTO) throws URISyntaxException { log.debug("REST request to update OperadorCaixa : {}", operadorCaixaDTO); if (operadorCaixaDTO.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } OperadorCaixaDTO result = operadorCaixaService.save(operadorCaixaDTO); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, operadorCaixaDTO.getId().toString())) .body(result); } /** * {@code GET /operador-caixas} : get all the operadorCaixas. * * @param pageable the pagination information. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of operadorCaixas in body. */ @GetMapping("/operador-caixas") public ResponseEntity<List<OperadorCaixaDTO>> getAllOperadorCaixas(Pageable pageable) { log.debug("REST request to get a page of OperadorCaixas"); Page<OperadorCaixaDTO> page = operadorCaixaService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } /** * {@code GET /operador-caixas/:id} : get the "id" operadorCaixa. * * @param id the id of the operadorCaixaDTO to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the operadorCaixaDTO, or with status {@code 404 (Not Found)}. */ @GetMapping("/operador-caixas/{id}") public ResponseEntity<OperadorCaixaDTO> getOperadorCaixa(@PathVariable Long id) { log.debug("REST request to get OperadorCaixa : {}", id); Optional<OperadorCaixaDTO> operadorCaixaDTO = operadorCaixaService.findOne(id); return ResponseUtil.wrapOrNotFound(operadorCaixaDTO); } /** * {@code DELETE /operador-caixas/:id} : delete the "id" operadorCaixa. * * @param id the id of the operadorCaixaDTO to delete. * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. */ @DeleteMapping("/operador-caixas/{id}") public ResponseEntity<Void> deleteOperadorCaixa(@PathVariable Long id) { log.debug("REST request to delete OperadorCaixa : {}", id); operadorCaixaService.delete(id); return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); } }
5,913
0.723998
0.719094
128
45.195313
40.560921
196
false
false
0
0
0
0
0
0
0.515625
false
false
11
9ee844b93f8d41917a4cb83fa5db90cd1ef98717
24,094,766,586,000
8a65dd04f516ed1488b6dbd5bb14c73fd3874e02
/org.eclipse.buckminster.core.test/src/org/eclipse/buckminster/core/test/command/CommandsTest.java
513fcbea338560930f991db9b8ec29327868fde7
[]
no_license
PalladioSimulator/buckminster
https://github.com/PalladioSimulator/buckminster
ffb173c7734d24ac7fa542b6c27171d53c80a4a8
ecd4575c37c76888fc9bf4714fd6438b10621a30
refs/heads/master
2021-04-18T22:10:25.856000
2018-03-26T12:21:04
2018-03-26T12:21:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.eclipse.buckminster.core.test.command; import java.io.File; import java.io.PrintStream; import org.eclipse.buckminster.cmdline.Headless; import org.eclipse.buckminster.core.test.AbstractTestCase; public class CommandsTest extends AbstractTestCase { public void testMultipleCommands() throws Exception { Headless headless = new Headless(); File commandFile = File.createTempFile("testMultipleCommands", ".bcmd"); //$NON-NLS-1$ //$NON-NLS-2$ File bomFile = File.createTempFile("testMultipleCommands", ".bom"); //$NON-NLS-1$ //$NON-NLS-2$ try { PrintStream cmdOut = new PrintStream(commandFile); cmdOut.println("lscmds"); cmdOut.println("lsprefs download"); cmdOut.close(); assertEquals(((Integer) headless.run(new String[] { "--scriptfile", commandFile.toString() })).intValue(), 0); //$NON-NLS-1$ } finally { commandFile.delete(); bomFile.delete(); } } }
UTF-8
Java
929
java
CommandsTest.java
Java
[]
null
[]
package org.eclipse.buckminster.core.test.command; import java.io.File; import java.io.PrintStream; import org.eclipse.buckminster.cmdline.Headless; import org.eclipse.buckminster.core.test.AbstractTestCase; public class CommandsTest extends AbstractTestCase { public void testMultipleCommands() throws Exception { Headless headless = new Headless(); File commandFile = File.createTempFile("testMultipleCommands", ".bcmd"); //$NON-NLS-1$ //$NON-NLS-2$ File bomFile = File.createTempFile("testMultipleCommands", ".bom"); //$NON-NLS-1$ //$NON-NLS-2$ try { PrintStream cmdOut = new PrintStream(commandFile); cmdOut.println("lscmds"); cmdOut.println("lsprefs download"); cmdOut.close(); assertEquals(((Integer) headless.run(new String[] { "--scriptfile", commandFile.toString() })).intValue(), 0); //$NON-NLS-1$ } finally { commandFile.delete(); bomFile.delete(); } } }
929
0.703983
0.697524
25
35.16
33.401413
127
false
false
0
0
0
0
0
0
2.16
false
false
11
42df3b3636d9f58793edb30d9a34a7595bc2b906
1,735,166,850,545
d95eab5e8ebfdaf9ab3c4d947f29ad1c961c664e
/searchrome/src/main/java/com/fycstart/web/controller/admin/HouseSubscribeController.java
87ff9335787611b3e074406a3f5dac497c380034
[]
no_license
fuyuchaostart/search_room
https://github.com/fuyuchaostart/search_room
b7e6f2c3d79c8ed742e97fe0808ea740277491a0
e5e5b22daad27bab76f1cabee19c40633316f699
refs/heads/master
2022-10-10T04:49:37.241000
2019-05-31T03:42:43
2019-05-31T03:42:43
184,044,864
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fycstart.web.controller.admin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 预约看房信息表 前端控制器 * </p> * * @author fycstart * @since 2019-04-29 */ @RestController @RequestMapping("/houseSubscribe") public class HouseSubscribeController { }
UTF-8
Java
376
java
HouseSubscribeController.java
Java
[ { "context": "\n/**\n * <p>\n * 预约看房信息表 前端控制器\n * </p>\n *\n * @author fycstart\n * @since 2019-04-29\n */\n@RestController\n@Request", "end": 231, "score": 0.999484121799469, "start": 223, "tag": "USERNAME", "value": "fycstart" } ]
null
[]
package com.fycstart.web.controller.admin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 预约看房信息表 前端控制器 * </p> * * @author fycstart * @since 2019-04-29 */ @RestController @RequestMapping("/houseSubscribe") public class HouseSubscribeController { }
376
0.75
0.727273
20
16.549999
20.001188
62
false
false
0
0
0
0
0
0
0.15
false
false
11
7c99da6107573c2d0eb3c4020c9ef36e74b08291
2,937,757,683,507
b6a57edee3133305d80a7c8561cbb3a639d617f3
/sdufe-common/src/main/java/com/brucegua/sdufe/common/pojo/Post.java
8f0c2eaf7d1dccb772b5974fd098c5b40e3809bf
[]
no_license
brucegua/sdufe
https://github.com/brucegua/sdufe
f21e594019d6c72fd2981dda088f3cdb13ff7c93
2df2e3f65e0473cd7be24429ebe67b4729e7607c
refs/heads/master
2017-05-09T15:53:27.941000
2017-02-19T14:58:06
2017-02-19T14:58:06
82,466,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.brucegua.sdufe.common.pojo; import java.util.Date; import java.util.List; /** * 帖子类 * @author brucegua * */ public class Post { public static final int TYPE_COMMON = 1; // 通用 public static final int TYPE_RECRUIT = 2; // 招聘信息 public static final int TYPE_ACTIVITY = 3; // 活动信息 public static final int STATUS_ENABLED = 1; // 使用中 public static final int STATUS_NOTENABLED = 2; // 不可用 private Long id; // 帖子id private User author; // 作者 private String content; // 内容 private Integer thumbCount; // 点赞数 private List<Comment> comments; // 评论列表 private Integer type; // 类型 private Integer status; // 状态 private Date createdAt; // 创建时间 private Date updatedAt; // 更新时间 public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getAuthor() { return author; } public void setAuthor(User author) { this.author = author; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Integer getThumbCount() { return thumbCount; } public void setThumbCount(Integer thumbCount) { this.thumbCount = thumbCount; } public List<Comment> getComments() { return comments; } public void setComments(List<Comment> comments) { this.comments = comments; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } @Override public String toString() { return "Post [id=" + id + ", author=" + author + ", content=" + content + ", thumbCount=" + thumbCount + ", comments=" + comments + ", type=" + type + ", status=" + status + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + "]"; } }
UTF-8
Java
2,352
java
Post.java
Java
[ { "context": "\nimport java.util.List;\r\n\r\n/**\r\n * 帖子类\r\n * @author brucegua\r\n *\r\n */\r\npublic class Post {\r\n\t\r\n\tpublic static ", "end": 125, "score": 0.999588131904602, "start": 117, "tag": "USERNAME", "value": "brucegua" }, { "context": "ing() {\r\n\t\treturn \"Post [id=\" + id + \", author=\" + author + \", content=\" + content + \", thumbCount=\" + thum", "end": 2052, "score": 0.5819152593612671, "start": 2046, "tag": "USERNAME", "value": "author" } ]
null
[]
package com.brucegua.sdufe.common.pojo; import java.util.Date; import java.util.List; /** * 帖子类 * @author brucegua * */ public class Post { public static final int TYPE_COMMON = 1; // 通用 public static final int TYPE_RECRUIT = 2; // 招聘信息 public static final int TYPE_ACTIVITY = 3; // 活动信息 public static final int STATUS_ENABLED = 1; // 使用中 public static final int STATUS_NOTENABLED = 2; // 不可用 private Long id; // 帖子id private User author; // 作者 private String content; // 内容 private Integer thumbCount; // 点赞数 private List<Comment> comments; // 评论列表 private Integer type; // 类型 private Integer status; // 状态 private Date createdAt; // 创建时间 private Date updatedAt; // 更新时间 public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getAuthor() { return author; } public void setAuthor(User author) { this.author = author; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Integer getThumbCount() { return thumbCount; } public void setThumbCount(Integer thumbCount) { this.thumbCount = thumbCount; } public List<Comment> getComments() { return comments; } public void setComments(List<Comment> comments) { this.comments = comments; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } @Override public String toString() { return "Post [id=" + id + ", author=" + author + ", content=" + content + ", thumbCount=" + thumbCount + ", comments=" + comments + ", type=" + type + ", status=" + status + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + "]"; } }
2,352
0.623233
0.621025
109
18.770641
20.002125
104
false
false
0
0
0
0
0
0
1.981651
false
false
11
f29ec3fe7a72e7a219d6c68d625f56750afb6de6
14,731,737,891,729
e17d41c0a257fa69a00a6e8492f9cd0f0a5472bf
/src/test/java/org/apitesting/JSONParsingExample.java
9a256288b21fa1355570609f52c22298d0c4ac8a
[]
no_license
BIOHAZARDIQ/JavaCourse
https://github.com/BIOHAZARDIQ/JavaCourse
2285f79ded0bb7fea7ddbd0b73b4393c66fcf58c
0c5ef8cfe622e130b1fd0afb304f047663c47431
refs/heads/main
2023-03-21T05:26:05.988000
2022-12-14T10:21:09
2022-12-14T10:21:09
340,462,441
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apitesting; import io.restassured.path.json.JsonPath; import org.apitesting.payloads.JSONPayloads; import org.testng.annotations.Test; import java.util.Map; import static org.testng.AssertJUnit.assertEquals; /** * In this class, we will demonstrate example of JSON parsing. * JSON is common type of response in API testing, so we need to learn how to parse json. * JSON used in this test is retrieved from file {@link org.apitesting.payloads.JSONPayloads} * * Example of JSON: * {"menu": { * "id": "file", * "value": "File", * "popup": { * "menuitem": [ * {"value": "New", "onclick": "CreateNewDoc()"}, * {"value": "Open", "onclick": "OpenDoc()"}, * ] * } * }} * */ public class JSONParsingExample { final String JSON_STRING = JSONPayloads.getCoursePriceJSON(); /** * This test will demonstrate getting basic values of JSON */ @Test public void getBasicValuesOfJSON() { //First we will create JsonPath object from JSON string JsonPath exampleJSON = ReusableMethods.stringToJSON(JSON_STRING); //Then we will access elements of this JsonPath object //Variables are accessed like this: System.out.println("name: " + exampleJSON.getString("name")); System.out.println("dashboard.purchaseAmount: " + exampleJSON.getInt("dashboard.purchaseAmount")); System.out.println("dashboard.website: " + exampleJSON.getString("dashboard.website")); //Size of arrays (courses: [] is an array in JSON) are retrieved like this: System.out.println("course.size(): " + exampleJSON.getInt("courses.size()")); //Elements of arrays and their variables are accessed like this: //we will get int/String/Double from first course (index 0) by methods getInt(), getString(), getDouble() System.out.println("courses[0].title: " + exampleJSON.getString("courses[0].title")); System.out.println("courses[0].price: " + exampleJSON.getDouble("courses[0].price")); System.out.println("courses[0].copies: " + exampleJSON.getInt("courses[0].copies")); //or we can use method get() that will handle parsing of int/String/Double, if we don't know type that we need to parse System.out.println("courses[1].title: " + exampleJSON.get("courses[1].title")); System.out.println("courses[1].price: " + exampleJSON.get("courses[1].price")); System.out.println("courses[1].copies: " + exampleJSON.get("courses[1].copies")); //We can even retrieve JSON objects from our JSON in form of HashMap Map<String, Object> course4 = exampleJSON.getJsonObject("courses[3]"); //Now we can retrieve data from that object directly System.out.println("Title of 4th course: " + course4.get("title")); System.out.println("Price of 4th course: " + course4.get("price")); System.out.println("Copies of 4th course: " + course4.get("copies")); } /** * This test will demonstrate getting sum of values from array * We will get total sum of all courses sold */ @Test public void sumOfCourses() { double totalSumOfCourses = 0.0; //First we will create JsonPath object from JSON string JsonPath exampleJSON = ReusableMethods.stringToJSON(JSON_STRING); int numberOfCourses = exampleJSON.getInt("courses.size()"); //Process each course separately for (int i = 0; i < numberOfCourses; i++) { //Parse necessary values from each course String courseTitle = exampleJSON.getString("courses[" + i + "].title"); double coursePrice = exampleJSON.getDouble("courses[" + i + "].price"); int copiesSold = exampleJSON.getInt("courses[" + i +"].copies"); //Calculate and print total amount for which this course was sold double amount = coursePrice * copiesSold; System.out.println("Total sum for selling course '" + courseTitle + "' is: " + amount); totalSumOfCourses+= amount; } System.out.println("Total sum for selling all courses: " + totalSumOfCourses); assertEquals("Total sum of selling all courses is correct", totalSumOfCourses, 1176.4); } }
UTF-8
Java
4,359
java
JSONParsingExample.java
Java
[]
null
[]
package org.apitesting; import io.restassured.path.json.JsonPath; import org.apitesting.payloads.JSONPayloads; import org.testng.annotations.Test; import java.util.Map; import static org.testng.AssertJUnit.assertEquals; /** * In this class, we will demonstrate example of JSON parsing. * JSON is common type of response in API testing, so we need to learn how to parse json. * JSON used in this test is retrieved from file {@link org.apitesting.payloads.JSONPayloads} * * Example of JSON: * {"menu": { * "id": "file", * "value": "File", * "popup": { * "menuitem": [ * {"value": "New", "onclick": "CreateNewDoc()"}, * {"value": "Open", "onclick": "OpenDoc()"}, * ] * } * }} * */ public class JSONParsingExample { final String JSON_STRING = JSONPayloads.getCoursePriceJSON(); /** * This test will demonstrate getting basic values of JSON */ @Test public void getBasicValuesOfJSON() { //First we will create JsonPath object from JSON string JsonPath exampleJSON = ReusableMethods.stringToJSON(JSON_STRING); //Then we will access elements of this JsonPath object //Variables are accessed like this: System.out.println("name: " + exampleJSON.getString("name")); System.out.println("dashboard.purchaseAmount: " + exampleJSON.getInt("dashboard.purchaseAmount")); System.out.println("dashboard.website: " + exampleJSON.getString("dashboard.website")); //Size of arrays (courses: [] is an array in JSON) are retrieved like this: System.out.println("course.size(): " + exampleJSON.getInt("courses.size()")); //Elements of arrays and their variables are accessed like this: //we will get int/String/Double from first course (index 0) by methods getInt(), getString(), getDouble() System.out.println("courses[0].title: " + exampleJSON.getString("courses[0].title")); System.out.println("courses[0].price: " + exampleJSON.getDouble("courses[0].price")); System.out.println("courses[0].copies: " + exampleJSON.getInt("courses[0].copies")); //or we can use method get() that will handle parsing of int/String/Double, if we don't know type that we need to parse System.out.println("courses[1].title: " + exampleJSON.get("courses[1].title")); System.out.println("courses[1].price: " + exampleJSON.get("courses[1].price")); System.out.println("courses[1].copies: " + exampleJSON.get("courses[1].copies")); //We can even retrieve JSON objects from our JSON in form of HashMap Map<String, Object> course4 = exampleJSON.getJsonObject("courses[3]"); //Now we can retrieve data from that object directly System.out.println("Title of 4th course: " + course4.get("title")); System.out.println("Price of 4th course: " + course4.get("price")); System.out.println("Copies of 4th course: " + course4.get("copies")); } /** * This test will demonstrate getting sum of values from array * We will get total sum of all courses sold */ @Test public void sumOfCourses() { double totalSumOfCourses = 0.0; //First we will create JsonPath object from JSON string JsonPath exampleJSON = ReusableMethods.stringToJSON(JSON_STRING); int numberOfCourses = exampleJSON.getInt("courses.size()"); //Process each course separately for (int i = 0; i < numberOfCourses; i++) { //Parse necessary values from each course String courseTitle = exampleJSON.getString("courses[" + i + "].title"); double coursePrice = exampleJSON.getDouble("courses[" + i + "].price"); int copiesSold = exampleJSON.getInt("courses[" + i +"].copies"); //Calculate and print total amount for which this course was sold double amount = coursePrice * copiesSold; System.out.println("Total sum for selling course '" + courseTitle + "' is: " + amount); totalSumOfCourses+= amount; } System.out.println("Total sum for selling all courses: " + totalSumOfCourses); assertEquals("Total sum of selling all courses is correct", totalSumOfCourses, 1176.4); } }
4,359
0.637761
0.631108
99
42.030304
36.025932
127
false
false
0
0
0
0
0
0
0.494949
false
false
11
62245ee4b85b3e61d76d664b2f551ef9fb8eb404
15,118,284,944,342
4841697cc425d0e4ac79f1a1aeb94efd1c146e12
/Tema 03/Ejercicio10.java
18ad5600b5eedc4c1681e4167d38682ef93cd1b8
[]
no_license
rafaelaragon/ejercicios_de_java
https://github.com/rafaelaragon/ejercicios_de_java
d238ce091acc080b730c74bfa60e0a0cf080f1b0
145d5edd4fdc7991b40aba1fd2c754851d4e73ea
refs/heads/master
2020-03-29T19:17:23.668000
2019-02-01T17:14:40
2019-02-01T17:14:40
150,255,606
5
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * * Crea un conversor de Mb a Kb. * * @author Rafael Aragón Rodríguez */ public class Ejercicio10 { public static void main(String[] args) { System.out.println("Bienvenido a este conversor de Mb a Kb."); System.out.print("Dime el número de megabytes a convertir: "); String linea; linea = System.console().readLine(); int mb = Integer.parseInt(linea); int resultado = mb * 1024; System.out.println(linea + " megabytes equivalen a " + resultado + " kilobytes."); } }
UTF-8
Java
516
java
Ejercicio10.java
Java
[ { "context": "* \n * Crea un conversor de Mb a Kb.\n * \n * @author Rafael Aragón Rodríguez\n */\npublic class Ejercicio10 {\n public static vo", "end": 79, "score": 0.9998710751533508, "start": 56, "tag": "NAME", "value": "Rafael Aragón Rodríguez" } ]
null
[]
/** * * Crea un conversor de Mb a Kb. * * @author <NAME> */ public class Ejercicio10 { public static void main(String[] args) { System.out.println("Bienvenido a este conversor de Mb a Kb."); System.out.print("Dime el número de megabytes a convertir: "); String linea; linea = System.console().readLine(); int mb = Integer.parseInt(linea); int resultado = mb * 1024; System.out.println(linea + " megabytes equivalen a " + resultado + " kilobytes."); } }
497
0.649123
0.637427
17
29.058823
25.140711
86
false
false
0
0
0
0
0
0
0.411765
false
false
11
a4082de9fe924a139bd4369a21b3513b4c508bbc
16,630,113,439,110
181a29c47c740572439d6b163de122779cd0ce4a
/app/src/main/java/com/lewiswon/engadget/Utils/RecyclerTouchListener.java
d28012d5893eed53f536893f99d436e73e5a6bbd
[]
no_license
lewiswon/cnEngadget
https://github.com/lewiswon/cnEngadget
35fda71ea38563ba9cc05940ae80e0f0351176c5
29c5f62d5692ae5fdc8ed710f3e3874f5b0ce3b3
refs/heads/master
2021-01-19T04:27:33.437000
2016-06-30T15:57:43
2016-06-30T15:57:43
57,029,712
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lewiswon.engadget.Utils; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; /** * Created by Lordway on 16/4/25. */ public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private Listener listener; private GestureDetector gestureDetector; public RecyclerTouchListener(Context context, final RecyclerView recyclerView, Listener l){ gestureDetector=new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){ @Override public boolean onSingleTapUp(MotionEvent e) { View child=recyclerView.findChildViewUnder(e.getX(),e.getY()); if (child.isClickable())return false; return true; } @Override public void onLongPress(MotionEvent e) { View child=recyclerView.findChildViewUnder(e.getX(),e.getY()); if (child!=null&&listener!=null){ listener.onLongClick(child,recyclerView.getChildAdapterPosition(child)); } } }); this.listener=l; } @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child=rv.findChildViewUnder(e.getX(),e.getY()); if (child!=null&&listener!=null&&gestureDetector.onTouchEvent(e)){ listener.onClick(child,rv.getChildAdapterPosition(child)); } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } public interface Listener{ void onClick(View view,int postion); void onLongClick(View view,int position); } }
UTF-8
Java
1,903
java
RecyclerTouchListener.java
Java
[ { "context": "vent;\nimport android.view.View;\n\n/**\n * Created by Lordway on 16/4/25.\n */\npublic class RecyclerTouchListene", "end": 239, "score": 0.728399932384491, "start": 232, "tag": "NAME", "value": "Lordway" } ]
null
[]
package com.lewiswon.engadget.Utils; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; /** * Created by Lordway on 16/4/25. */ public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private Listener listener; private GestureDetector gestureDetector; public RecyclerTouchListener(Context context, final RecyclerView recyclerView, Listener l){ gestureDetector=new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){ @Override public boolean onSingleTapUp(MotionEvent e) { View child=recyclerView.findChildViewUnder(e.getX(),e.getY()); if (child.isClickable())return false; return true; } @Override public void onLongPress(MotionEvent e) { View child=recyclerView.findChildViewUnder(e.getX(),e.getY()); if (child!=null&&listener!=null){ listener.onLongClick(child,recyclerView.getChildAdapterPosition(child)); } } }); this.listener=l; } @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child=rv.findChildViewUnder(e.getX(),e.getY()); if (child!=null&&listener!=null&&gestureDetector.onTouchEvent(e)){ listener.onClick(child,rv.getChildAdapterPosition(child)); } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } public interface Listener{ void onClick(View view,int postion); void onLongClick(View view,int position); } }
1,903
0.661061
0.657909
61
30.196722
29.253454
98
false
false
0
0
0
0
0
0
0.52459
false
false
11
bf72078bf8bf410a4580a61844a6b2a1abd2fa96
343,597,415,574
31bf63368666a8680a5e707907674f3384dd5b2d
/lista06/Contato/src/org/ufpr/contato/controller/Main.java
000c75402b6d296db30f1bf168a10449aaa04ff2
[]
no_license
kruchelski/sem2-OOPLII-lists
https://github.com/kruchelski/sem2-OOPLII-lists
0f6e3347e7575313096d382fb261a9d370ab280a
2aef59c388d7ffb5fbbde451dd339998b34d481c
refs/heads/master
2020-09-23T10:56:38.545000
2019-12-02T22:44:54
2019-12-02T22:44:54
225,482,613
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 org.ufpr.contato.controller; import java.sql.SQLException; import javax.swing.JOptionPane; import org.ufpr.contato.model.ContactTableModel; import org.ufpr.contato.model.dao.ConnectionFactory; import org.ufpr.contato.model.dao.ContactDao; import org.ufpr.contato.view.ContactView; /** * * @author rafae */ public class Main { public static void main(String[] args){ try{ ContactDao dao = new ContactDao(new ConnectionFactory()); ContactTableModel model = new ContactTableModel(); ContactView view = new ContactView(); ContactController controller = new ContactController(model,view,dao); controller.initController(); }catch(Exception ex){ JOptionPane.showMessageDialog(null,"Erro ao iniciar a aplicação. \n"+ex.getLocalizedMessage(), "", JOptionPane.ERROR_MESSAGE); } } }
UTF-8
Java
1,113
java
Main.java
Java
[ { "context": "r.contato.view.ContactView;\r\n\r\n/**\r\n *\r\n * @author rafae\r\n */\r\npublic class Main {\r\n public static void", "end": 515, "score": 0.9983620047569275, "start": 510, "tag": "USERNAME", "value": "rafae" } ]
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 org.ufpr.contato.controller; import java.sql.SQLException; import javax.swing.JOptionPane; import org.ufpr.contato.model.ContactTableModel; import org.ufpr.contato.model.dao.ConnectionFactory; import org.ufpr.contato.model.dao.ContactDao; import org.ufpr.contato.view.ContactView; /** * * @author rafae */ public class Main { public static void main(String[] args){ try{ ContactDao dao = new ContactDao(new ConnectionFactory()); ContactTableModel model = new ContactTableModel(); ContactView view = new ContactView(); ContactController controller = new ContactController(model,view,dao); controller.initController(); }catch(Exception ex){ JOptionPane.showMessageDialog(null,"Erro ao iniciar a aplicação. \n"+ex.getLocalizedMessage(), "", JOptionPane.ERROR_MESSAGE); } } }
1,113
0.679568
0.679568
32
32.71875
30.81521
138
false
false
0
0
0
0
0
0
0.65625
false
false
5
2c2eefdf669e0ecb0d2449d5605c4b2362a33972
27,462,020,919,852
a90ab52bf587370220d9c6dac70474013ef28fbb
/src/main/java/com/fasterxml/jackson/module/jsonSchema/JsonSchemaGenerator.java
115466e8874d32615c58ba5140e05b2544a6e5c9
[]
no_license
idelvall/jackson-module-jsonSchema
https://github.com/idelvall/jackson-module-jsonSchema
2deb6f8ca1a3cbf1c1b0544efd43e4c1cfef97fe
d273183c06d07fd2dec4a6e892b6b83f9795b297
refs/heads/master
2021-01-18T02:55:43.318000
2015-09-01T14:02:51
2015-09-01T14:02:51
13,464,580
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fasterxml.jackson.module.jsonSchema; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; import com.fasterxml.jackson.module.jsonSchema.factories.WrapperFactory; /** * Convenience class that wraps JSON Schema generation functionality. * * @author tsaloranta */ public class JsonSchemaGenerator { /** * @deprecated Since 2.6 */ @Deprecated protected final ObjectMapper _mapper; /** * @since 2.6 */ protected final ObjectWriter _writer; private final WrapperFactory _wrapperFactory; public JsonSchemaGenerator(ObjectMapper mapper) { this(mapper, null); } public JsonSchemaGenerator(ObjectMapper mapper, WrapperFactory wrapperFactory) { _mapper = mapper; _writer = mapper.writer(); _wrapperFactory = (wrapperFactory == null) ? new WrapperFactory() : wrapperFactory; } /** * @since 2.6 */ public JsonSchemaGenerator(ObjectWriter w) { this(w, null); } /** * @since 2.6 */ public JsonSchemaGenerator(ObjectWriter w, WrapperFactory wrapperFactory) { _mapper = null; _writer = w; _wrapperFactory = (wrapperFactory == null) ? new WrapperFactory() : wrapperFactory; } public JsonSchema generateSchema(Class<?> type) throws JsonMappingException { SchemaFactoryWrapper visitor = _wrapperFactory.getWrapper(null); _writer.acceptJsonFormatVisitor(type, visitor); return visitor.finalSchema(); } public JsonSchema generateSchema(JavaType type) throws JsonMappingException { SchemaFactoryWrapper visitor = _wrapperFactory.getWrapper(null); _writer.acceptJsonFormatVisitor(type, visitor); return visitor.finalSchema(); } }
UTF-8
Java
1,845
java
JsonSchemaGenerator.java
Java
[ { "context": "ON Schema generation functionality.\n * \n * @author tsaloranta\n */\npublic class JsonSchemaGenerator\n{\n /**\n ", "end": 343, "score": 0.9991235733032227, "start": 333, "tag": "USERNAME", "value": "tsaloranta" } ]
null
[]
package com.fasterxml.jackson.module.jsonSchema; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; import com.fasterxml.jackson.module.jsonSchema.factories.WrapperFactory; /** * Convenience class that wraps JSON Schema generation functionality. * * @author tsaloranta */ public class JsonSchemaGenerator { /** * @deprecated Since 2.6 */ @Deprecated protected final ObjectMapper _mapper; /** * @since 2.6 */ protected final ObjectWriter _writer; private final WrapperFactory _wrapperFactory; public JsonSchemaGenerator(ObjectMapper mapper) { this(mapper, null); } public JsonSchemaGenerator(ObjectMapper mapper, WrapperFactory wrapperFactory) { _mapper = mapper; _writer = mapper.writer(); _wrapperFactory = (wrapperFactory == null) ? new WrapperFactory() : wrapperFactory; } /** * @since 2.6 */ public JsonSchemaGenerator(ObjectWriter w) { this(w, null); } /** * @since 2.6 */ public JsonSchemaGenerator(ObjectWriter w, WrapperFactory wrapperFactory) { _mapper = null; _writer = w; _wrapperFactory = (wrapperFactory == null) ? new WrapperFactory() : wrapperFactory; } public JsonSchema generateSchema(Class<?> type) throws JsonMappingException { SchemaFactoryWrapper visitor = _wrapperFactory.getWrapper(null); _writer.acceptJsonFormatVisitor(type, visitor); return visitor.finalSchema(); } public JsonSchema generateSchema(JavaType type) throws JsonMappingException { SchemaFactoryWrapper visitor = _wrapperFactory.getWrapper(null); _writer.acceptJsonFormatVisitor(type, visitor); return visitor.finalSchema(); } }
1,845
0.677507
0.673171
66
26.954546
28.13788
91
false
false
0
0
0
0
0
0
0.409091
false
false
5
10808abe4577fa20fad3e57a7f13b98287a3e878
13,194,139,561,996
ab49c5b50ff85988b687ac8873792da03e05d758
/BOJ/1325_효율적인 해킹.java
aa34bbd2071b7d33d60869a6da8fe919430d5fe7
[]
no_license
sys09270883/Algorithms
https://github.com/sys09270883/Algorithms
e105e3d6120e3b9d46d5aed810260cf2c93f6065
f9e4f8c2a716eebe8e71b7912785deecd34dcc7e
refs/heads/master
2020-06-21T17:08:04.293000
2020-06-21T04:33:38
2020-06-21T04:33:38
197,510,434
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* https://www.acmicpc.net/problem/1325 [문제] 해커 김지민은 잘 알려진 어느 회사를 해킹하려고 한다. 이 회사는 N개의 컴퓨터로 이루어져 있다. 김지민은 귀찮기 때문에, 한 번의 해킹으로 여러 개의 컴퓨터를 해킹 할 수 있는 컴퓨터를 해킹하려고 한다. 이 회사의 컴퓨터는 신뢰하는 관계와, 신뢰하지 않는 관계로 이루어져 있는데, A가 B를 신뢰하는 경우에는 B를 해킹하면, A도 해킹할 수 있다는 소리다. 이 회사의 컴퓨터의 신뢰하는 관계가 주어졌을 때, 한 번에 가장 많은 컴퓨터를 해킹할 수 있는 컴퓨터의 번호를 출력하는 프로그램을 작성하시오. [입력] 첫째 줄에, N과 M이 들어온다. N은 10,000보다 작거나 같은 자연수, M은 100,000보다 작거나 같은 자연수이다. 둘째 줄부터 M개의 줄에 신뢰하는 관계가 A B와 같은 형식으로 들어오며, "A가 B를 신뢰한다"를 의미한다. 컴퓨터는 1번부터 N번까지 번호가 하나씩 매겨져 있다. [출력] 첫째 줄에, 김지민이 한 번에 가장 많은 컴퓨터를 해킹할 수 있는 컴퓨터의 번호를 오름차순으로 출력한다. [풀이] BFS를 하면서 res 배열에 기록한다. res의 최대값과 같은 인덱스를 출력한다 + 싸이클이 생기는 경우에 대해서 예외처리해야한다... */ import java.io.*; import java.util.*; public class Main { static int N, M; static ArrayList<ArrayList<Integer>> adj; static boolean[] visited; static int[] res; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); adj = new ArrayList<ArrayList<Integer>>(N + 1); for (int i = 0; i < N + 1; i++) { adj.add(new ArrayList<Integer>()); } visited = new boolean[N + 1]; res = new int[N + 1]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < M; i++) { st = new StringTokenizer(br.readLine()); int A = Integer.parseInt(st.nextToken()); int B = Integer.parseInt(st.nextToken()); addEdge(A, B); } for (int i = 1; i < N + 1; i++) { BFS(i); Arrays.fill(visited, false); } int max = Integer.MIN_VALUE; for (int i = 1; i < N + 1; i++) { if (max < res[i]) max = res[i]; } for (int i = 1; i < N + 1; i++) { if (max == res[i]) sb.append(i).append(' '); } bw.write(sb.toString()); bw.close(); br.close(); } private static void addEdge(int A, int B) { adj.get(A).add(B); } private static void BFS(int n) { Queue<Integer> queue = new LinkedList<>(); queue.add(n); visited[n] = true; while (!queue.isEmpty()) { int num = queue.poll(); for (int i : adj.get(num)) { if (!visited[i]) { visited[i] = true; queue.add(i); res[i]++; } } } } }
UHC
Java
3,109
java
1325_효율적인 해킹.java
Java
[ { "context": "/*\nhttps://www.acmicpc.net/problem/1325\n[문제]\n해커 김지민은 잘 알려진 어느 회사를 해킹하려고 한다. 이 회사는 N개의 컴퓨터로 이루어져 있다. \n", "end": 51, "score": 0.9619638323783875, "start": 48, "tag": "NAME", "value": "김지민" } ]
null
[]
/* https://www.acmicpc.net/problem/1325 [문제] 해커 김지민은 잘 알려진 어느 회사를 해킹하려고 한다. 이 회사는 N개의 컴퓨터로 이루어져 있다. 김지민은 귀찮기 때문에, 한 번의 해킹으로 여러 개의 컴퓨터를 해킹 할 수 있는 컴퓨터를 해킹하려고 한다. 이 회사의 컴퓨터는 신뢰하는 관계와, 신뢰하지 않는 관계로 이루어져 있는데, A가 B를 신뢰하는 경우에는 B를 해킹하면, A도 해킹할 수 있다는 소리다. 이 회사의 컴퓨터의 신뢰하는 관계가 주어졌을 때, 한 번에 가장 많은 컴퓨터를 해킹할 수 있는 컴퓨터의 번호를 출력하는 프로그램을 작성하시오. [입력] 첫째 줄에, N과 M이 들어온다. N은 10,000보다 작거나 같은 자연수, M은 100,000보다 작거나 같은 자연수이다. 둘째 줄부터 M개의 줄에 신뢰하는 관계가 A B와 같은 형식으로 들어오며, "A가 B를 신뢰한다"를 의미한다. 컴퓨터는 1번부터 N번까지 번호가 하나씩 매겨져 있다. [출력] 첫째 줄에, 김지민이 한 번에 가장 많은 컴퓨터를 해킹할 수 있는 컴퓨터의 번호를 오름차순으로 출력한다. [풀이] BFS를 하면서 res 배열에 기록한다. res의 최대값과 같은 인덱스를 출력한다 + 싸이클이 생기는 경우에 대해서 예외처리해야한다... */ import java.io.*; import java.util.*; public class Main { static int N, M; static ArrayList<ArrayList<Integer>> adj; static boolean[] visited; static int[] res; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); adj = new ArrayList<ArrayList<Integer>>(N + 1); for (int i = 0; i < N + 1; i++) { adj.add(new ArrayList<Integer>()); } visited = new boolean[N + 1]; res = new int[N + 1]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < M; i++) { st = new StringTokenizer(br.readLine()); int A = Integer.parseInt(st.nextToken()); int B = Integer.parseInt(st.nextToken()); addEdge(A, B); } for (int i = 1; i < N + 1; i++) { BFS(i); Arrays.fill(visited, false); } int max = Integer.MIN_VALUE; for (int i = 1; i < N + 1; i++) { if (max < res[i]) max = res[i]; } for (int i = 1; i < N + 1; i++) { if (max == res[i]) sb.append(i).append(' '); } bw.write(sb.toString()); bw.close(); br.close(); } private static void addEdge(int A, int B) { adj.get(A).add(B); } private static void BFS(int n) { Queue<Integer> queue = new LinkedList<>(); queue.add(n); visited[n] = true; while (!queue.isEmpty()) { int num = queue.poll(); for (int i : adj.get(num)) { if (!visited[i]) { visited[i] = true; queue.add(i); res[i]++; } } } } }
3,109
0.613083
0.601112
101
22.158417
22.223764
92
false
false
0
0
0
0
0
0
2.148515
false
false
5
916cc630e1fbe8483434159574da9d3abcd7af5f
20,126,216,780,114
d43f7a94baf3efa6d608c3c53fc5e6f6cde47718
/src/main/java/br/com/evaluate/bean/EvaluateCandidateBeanImpl.java
ebe665a1a9116c5e670ee8322c427f794984e27c
[]
no_license
fabiofrn/Avaliar
https://github.com/fabiofrn/Avaliar
8f41d1f277ddc53e9fbefe959a451b2684a8b17f
a225a4e6c349370062b9cecabc335fe27fd7acc5
refs/heads/master
2019-01-23T12:37:01.498000
2019-01-08T11:11:17
2019-01-08T11:11:17
85,883,144
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.evaluate.bean; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.inject.Inject; import javax.inject.Named; import javax.mail.MessagingException; import org.apache.log4j.Logger; import br.com.evaluate.model.Candidate; import br.com.evaluate.service.EmailSendService; @Named @RequestScoped public class EvaluateCandidateBeanImpl { private static final Logger logger = Logger.getLogger(EvaluateCandidateBeanImpl.class); @Inject private EmailSendService emailSendService; private Candidate candidate; @PostConstruct public void init() { this.candidate = new Candidate(); } public Candidate getCandidate() { return candidate; } public void setCandidate(Candidate candidate) { this.candidate = candidate; } public void actionClearFields(ActionEvent event) { this.candidate = new Candidate(); } public void actionEvaluate(ActionEvent event) { FacesContext context = FacesContext.getCurrentInstance(); try { emailSendService.send(this.candidate); context.addMessage(null, new FacesMessage("Sucesso, acabamos de enviar um email para " + this.candidate.getName(), "Email enviado para " + this.candidate.getName())); actionClearFields(event); } catch (MessagingException e) { context.addMessage(null, new FacesMessage("Ops", "Houve um problema ao enviar email para " + this.candidate.getName())); logger.info("Problemas ao enviar mensagem." + e); } } }
UTF-8
Java
1,607
java
EvaluateCandidateBeanImpl.java
Java
[]
null
[]
package br.com.evaluate.bean; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.inject.Inject; import javax.inject.Named; import javax.mail.MessagingException; import org.apache.log4j.Logger; import br.com.evaluate.model.Candidate; import br.com.evaluate.service.EmailSendService; @Named @RequestScoped public class EvaluateCandidateBeanImpl { private static final Logger logger = Logger.getLogger(EvaluateCandidateBeanImpl.class); @Inject private EmailSendService emailSendService; private Candidate candidate; @PostConstruct public void init() { this.candidate = new Candidate(); } public Candidate getCandidate() { return candidate; } public void setCandidate(Candidate candidate) { this.candidate = candidate; } public void actionClearFields(ActionEvent event) { this.candidate = new Candidate(); } public void actionEvaluate(ActionEvent event) { FacesContext context = FacesContext.getCurrentInstance(); try { emailSendService.send(this.candidate); context.addMessage(null, new FacesMessage("Sucesso, acabamos de enviar um email para " + this.candidate.getName(), "Email enviado para " + this.candidate.getName())); actionClearFields(event); } catch (MessagingException e) { context.addMessage(null, new FacesMessage("Ops", "Houve um problema ao enviar email para " + this.candidate.getName())); logger.info("Problemas ao enviar mensagem." + e); } } }
1,607
0.766024
0.765401
61
25.344263
24.374056
100
false
false
0
0
0
0
0
0
1.52459
false
false
5
19db0148ebf3b54a13a5b4c2cc817ff39a1b92af
20,005,957,698,381
e303eee0cd581b2bb0412674ed1c0ac2f571ffaf
/src/dao/Tag.java
04c2d62b1b318adc98c9065b2f44d15158ed6981
[]
no_license
pcrouillere/Jumper
https://github.com/pcrouillere/Jumper
75ade3456a91c121c56b1b73ff0f19361b48d990
ba9eddfc62aaf909a6710394bcc4891127d58ba1
refs/heads/master
2020-12-24T15:58:54.076000
2014-06-19T22:19:19
2014-06-19T22:19:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import framework.Dao; public class Tag extends Dao { private String tName; private int tid; private int tUserId; public Tag(String n, int id, int uid) { tName = n; tid = id; tUserId = uid; } public Tag(String n, int uid) { tName = n; tUserId = uid; } /** getUrls() : fonction qui retourne l'ensemble des urls taggees avec le tag * @return List<Url> * **/ public List<Url> getUrls() { List<Url> allUrls = new ArrayList<Url>(); User u = User.getInstance(); ResultSet resultId; Map<String, String> attr = new HashMap<String, String>(); attr.put("tagMapTagId", Integer.toString(this.tid)); attr.put("tagMapUserId", Integer.toString(u.getuId())); resultId = Dao.search("jpTagMap", attr); try { while(resultId.next()){ allUrls.add(u.getUrlById(resultId.getInt("tagMapUrlId"))); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return allUrls; } public int getTagIdFromBDD() { ResultSet result; result = Dao.freeRequest("Select tagId from jpTag WHERE tagUserId="+Integer.toString(tUserId)+" AND tagName='"+this.tName+"';", null); try { if(result.next()){ int id = result.getInt("tagId"); return id; } } catch (SQLException e) { e.printStackTrace(); } return -1; } public void addTagtoBDD() { try { Dao.freeRequestUpdate("Insert into jpTag(tagUserId, tagName) values("+this.tUserId+",'"+this.tName+"')", null); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String gettName() { return tName; } public void settName(String tName) { this.tName = tName; } public int getTid() { return tid; } public void setTid(int tid) { this.tid = tid; } public int gettUserId() { return tUserId; } public void settUserId(int tUserId) { this.tUserId = tUserId; } }
UTF-8
Java
2,065
java
Tag.java
Java
[]
null
[]
package dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import framework.Dao; public class Tag extends Dao { private String tName; private int tid; private int tUserId; public Tag(String n, int id, int uid) { tName = n; tid = id; tUserId = uid; } public Tag(String n, int uid) { tName = n; tUserId = uid; } /** getUrls() : fonction qui retourne l'ensemble des urls taggees avec le tag * @return List<Url> * **/ public List<Url> getUrls() { List<Url> allUrls = new ArrayList<Url>(); User u = User.getInstance(); ResultSet resultId; Map<String, String> attr = new HashMap<String, String>(); attr.put("tagMapTagId", Integer.toString(this.tid)); attr.put("tagMapUserId", Integer.toString(u.getuId())); resultId = Dao.search("jpTagMap", attr); try { while(resultId.next()){ allUrls.add(u.getUrlById(resultId.getInt("tagMapUrlId"))); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return allUrls; } public int getTagIdFromBDD() { ResultSet result; result = Dao.freeRequest("Select tagId from jpTag WHERE tagUserId="+Integer.toString(tUserId)+" AND tagName='"+this.tName+"';", null); try { if(result.next()){ int id = result.getInt("tagId"); return id; } } catch (SQLException e) { e.printStackTrace(); } return -1; } public void addTagtoBDD() { try { Dao.freeRequestUpdate("Insert into jpTag(tagUserId, tagName) values("+this.tUserId+",'"+this.tName+"')", null); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String gettName() { return tName; } public void settName(String tName) { this.tName = tName; } public int getTid() { return tid; } public void setTid(int tid) { this.tid = tid; } public int gettUserId() { return tUserId; } public void settUserId(int tUserId) { this.tUserId = tUserId; } }
2,065
0.658596
0.658111
106
18.490566
21.9202
136
false
false
0
0
0
0
0
0
1.820755
false
false
5
d364270d7973db859561299bc3d2ee7e1aed7f9a
28,484,223,144,109
e949512a9f7b5f468101ff664256996a087aba37
/Night.java
af4e0f85e764013941ea916b7320fde4b1d56df2
[]
no_license
stefioan/Chess-Game
https://github.com/stefioan/Chess-Game
a7a948cd4f5a613ef06b5ff43072a96a9a22c12d
546bbbf758f20ac59444bce8bb63e019e703c194
refs/heads/master
2016-08-04T19:27:39.135000
2013-11-18T19:15:23
2013-11-18T19:15:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Night { int xCordN,yCordN; Night(int x, int y) { xCordN = x; yCordN = y; } static char PlaceN() { return 'N'; } static char Placen() { return 'n'; } }
UTF-8
Java
210
java
Night.java
Java
[]
null
[]
class Night { int xCordN,yCordN; Night(int x, int y) { xCordN = x; yCordN = y; } static char PlaceN() { return 'N'; } static char Placen() { return 'n'; } }
210
0.466667
0.466667
18
9.722222
7.744572
23
false
false
0
0
0
0
0
0
2
false
false
5
09f302016b06a8026e2652650edbeea39ef05d5d
28,346,784,191,562
7e27c9041a1b19ef010c23bafa26098e7703a93e
/app/src/main/java/com/example/gangplank/zhong/fragment/ShouFragment.java
913bf6f8bcc7d8150825def4d7ccf396b0ecb9b1
[]
no_license
zhaiyuncong/zhong
https://github.com/zhaiyuncong/zhong
5bdd343f5cd13df89d8147d6034fb50efcdb9520
398e0fc622dbd1fdbf601135a9bf9c2003a45ff7
refs/heads/master
2020-04-17T07:27:39.128000
2019-01-18T08:24:11
2019-01-18T08:24:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.gangplank.zhong.fragment; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.example.gangplank.zhong.MainMoulde.MainModuleIml; import com.example.gangplank.zhong.MainPresener.MainPresenterIml; import com.example.gangplank.zhong.MainView.MainView; import com.example.gangplank.zhong.News; import com.example.gangplank.zhong.R; import com.example.gangplank.zhong.adapter.MyAdapter; import com.jcodecraeer.xrecyclerview.XRecyclerView; import com.jude.rollviewpager.RollPagerView; import com.jude.rollviewpager.adapter.StaticPagerAdapter; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; /** * A simple {@link Fragment} subclass. */ public class ShouFragment extends Fragment implements XRecyclerView.LoadingListener, MainView { @BindView(R.id.xrl) XRecyclerView xrl; Unbinder unbinder; private MyAdapter myAdapter; private List<News.RESULTBean.NewsListBean> newsListBeans = new ArrayList<>(); private MainPresenterIml mainPresenter; private RollPagerView roll; public ShouFragment() { } private int page = 1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_shou, container, false); unbinder = ButterKnife.bind(this, view); initView(view); return view; } private void initView(View view) { roll = (RollPagerView) view.findViewById(R.id.roll); roll.setAdapter(new FragAdapter()); xrl.setLayoutManager(new LinearLayoutManager(getActivity())); xrl.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); myAdapter = new MyAdapter(newsListBeans, getActivity()); xrl.setAdapter(myAdapter); mainPresenter = new MainPresenterIml(new MainModuleIml(), this); mainPresenter.getData(page); xrl.setLoadingListener(this); } @Override public void onRefresh() { page = 1; mainPresenter.getData(page); xrl.refreshComplete(); } @Override public void onLoadMore() { page++; mainPresenter.getData(page); } @Override public void showError(String error) { } @Override public void showList(List<News.RESULTBean.NewsListBean> newsListBeans) { myAdapter.setData(page, newsListBeans); xrl.loadMoreComplete(); } class FragAdapter extends StaticPagerAdapter { private int[] image = {R.drawable.d, R.drawable.e, R.drawable.c}; @Override public View getView(ViewGroup container, int position) { ImageView imageView = new ImageView(container.getContext()); imageView.setImageResource(image[position]); return imageView; } @Override public int getCount() { return image.length; } } }
UTF-8
Java
3,402
java
ShouFragment.java
Java
[]
null
[]
package com.example.gangplank.zhong.fragment; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.example.gangplank.zhong.MainMoulde.MainModuleIml; import com.example.gangplank.zhong.MainPresener.MainPresenterIml; import com.example.gangplank.zhong.MainView.MainView; import com.example.gangplank.zhong.News; import com.example.gangplank.zhong.R; import com.example.gangplank.zhong.adapter.MyAdapter; import com.jcodecraeer.xrecyclerview.XRecyclerView; import com.jude.rollviewpager.RollPagerView; import com.jude.rollviewpager.adapter.StaticPagerAdapter; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; /** * A simple {@link Fragment} subclass. */ public class ShouFragment extends Fragment implements XRecyclerView.LoadingListener, MainView { @BindView(R.id.xrl) XRecyclerView xrl; Unbinder unbinder; private MyAdapter myAdapter; private List<News.RESULTBean.NewsListBean> newsListBeans = new ArrayList<>(); private MainPresenterIml mainPresenter; private RollPagerView roll; public ShouFragment() { } private int page = 1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_shou, container, false); unbinder = ButterKnife.bind(this, view); initView(view); return view; } private void initView(View view) { roll = (RollPagerView) view.findViewById(R.id.roll); roll.setAdapter(new FragAdapter()); xrl.setLayoutManager(new LinearLayoutManager(getActivity())); xrl.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); myAdapter = new MyAdapter(newsListBeans, getActivity()); xrl.setAdapter(myAdapter); mainPresenter = new MainPresenterIml(new MainModuleIml(), this); mainPresenter.getData(page); xrl.setLoadingListener(this); } @Override public void onRefresh() { page = 1; mainPresenter.getData(page); xrl.refreshComplete(); } @Override public void onLoadMore() { page++; mainPresenter.getData(page); } @Override public void showError(String error) { } @Override public void showList(List<News.RESULTBean.NewsListBean> newsListBeans) { myAdapter.setData(page, newsListBeans); xrl.loadMoreComplete(); } class FragAdapter extends StaticPagerAdapter { private int[] image = {R.drawable.d, R.drawable.e, R.drawable.c}; @Override public View getView(ViewGroup container, int position) { ImageView imageView = new ImageView(container.getContext()); imageView.setImageResource(image[position]); return imageView; } @Override public int getCount() { return image.length; } } }
3,402
0.707819
0.706349
123
26.658537
25.069603
104
false
false
0
0
0
0
0
0
0.569106
false
false
5
0b53c8a0b3cb69d5b3805e600ea3ed81af222c4d
12,060,268,200,179
cc55074679f355d64e736ace1ef584fe660757d0
/src/main/java/com/ghasix/util/LogUtil.java
9978d060fc3d96fedd549cbfc23794aee1027187
[]
no_license
Robi02/WebProject
https://github.com/Robi02/WebProject
63ac3bb9b204985d3f6a3af320f3d46abbe8132d
e3370c69f91ff06ab1c56dd3d5f5aa3466224fce
refs/heads/master
2021-01-25T13:17:40.234000
2020-06-15T13:34:18
2020-06-15T13:34:18
123,544,401
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ghasix.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; public class LogUtil { // [Class private constants] private static final Logger logger = LoggerFactory.getLogger(LogUtil.class); private static final String LAYER_STR = "layer"; private static final String TID_STR = "tId"; // [Class public constants] public static final String LAYER_SYS = "SYS"; public static final String LAYER_CTR = "CTR"; public static final String LAYER_SVC = "SVC"; public static final String LAYER_MAP = "MAP"; public static final String LAYER_MGR = "MGR"; public static final String LAYER_UTL = "UTL"; public static final String LAYER_ETC = "ETC"; // [Methods] /** * <p>로그 계층(layer)을 변경하고 기존 계층을 반환합니다.</p> * @param layerStr : 새로운 계층 문자열. * <pre> * - {@link LAYER_SYS} : 시스템 [SYS] * - {@link LAYER_CTR} : 컨트롤러 [CTR] * - {@link LAYER_SVC} : 서비스 [SVC] * - {@link LAYER_MAP} : DB Mapper [MAP] * - {@link LAYER_MGR} : 매니저 [MGR] * - {@link LAYER_UTL} : 유틸 [UTL] * - {@link LAYER_ETC} : 기타 [ETC] * - 커스텀 문자열 : 사용자 정의 계층 * @return 계층 변경전 사용하던 계층 문자열을 반환합니다. */ public static String changeLogLayer(String layerStr) { String oldLayer = MDC.get(LAYER_STR); MDC.put(LAYER_STR, layerStr); return oldLayer; } /** * <p>로그 tId를 변경하고 기존 tiD를 반환합니다.</p> * @param tId : 새로운 tId 문자열. * @return tId 변경전 사용하던 tId문자열을 반환합니다. */ public static String changeTid(String tId) { String oldTid = MDC.get(TID_STR); MDC.put(TID_STR, tId); return oldTid; } }
UTF-8
Java
1,907
java
LogUtil.java
Java
[]
null
[]
package com.ghasix.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; public class LogUtil { // [Class private constants] private static final Logger logger = LoggerFactory.getLogger(LogUtil.class); private static final String LAYER_STR = "layer"; private static final String TID_STR = "tId"; // [Class public constants] public static final String LAYER_SYS = "SYS"; public static final String LAYER_CTR = "CTR"; public static final String LAYER_SVC = "SVC"; public static final String LAYER_MAP = "MAP"; public static final String LAYER_MGR = "MGR"; public static final String LAYER_UTL = "UTL"; public static final String LAYER_ETC = "ETC"; // [Methods] /** * <p>로그 계층(layer)을 변경하고 기존 계층을 반환합니다.</p> * @param layerStr : 새로운 계층 문자열. * <pre> * - {@link LAYER_SYS} : 시스템 [SYS] * - {@link LAYER_CTR} : 컨트롤러 [CTR] * - {@link LAYER_SVC} : 서비스 [SVC] * - {@link LAYER_MAP} : DB Mapper [MAP] * - {@link LAYER_MGR} : 매니저 [MGR] * - {@link LAYER_UTL} : 유틸 [UTL] * - {@link LAYER_ETC} : 기타 [ETC] * - 커스텀 문자열 : 사용자 정의 계층 * @return 계층 변경전 사용하던 계층 문자열을 반환합니다. */ public static String changeLogLayer(String layerStr) { String oldLayer = MDC.get(LAYER_STR); MDC.put(LAYER_STR, layerStr); return oldLayer; } /** * <p>로그 tId를 변경하고 기존 tiD를 반환합니다.</p> * @param tId : 새로운 tId 문자열. * @return tId 변경전 사용하던 tId문자열을 반환합니다. */ public static String changeTid(String tId) { String oldTid = MDC.get(TID_STR); MDC.put(TID_STR, tId); return oldTid; } }
1,907
0.599166
0.597379
53
30.698112
18.296907
80
false
false
0
0
0
0
0
0
0.415094
false
false
5
b6902529d248c51f779d162e8515ca54994757a8
20,495,583,972,832
c9bb394c57771c2d4ca8f2cfc47bb962799ab738
/src/main/java/corey/hue/notifications/email/EmailController.java
8d511c92b56868b08684e85889938f07a341119b
[]
no_license
coeymusa/notification
https://github.com/coeymusa/notification
79b37fc273b8fb42bfb5638827998435e9d280da
e423760a5ec088f195815edf083dcc463715d862
refs/heads/master
2020-03-31T06:44:31.667000
2018-11-09T12:52:19
2018-11-09T12:52:19
151,988,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package corey.hue.notifications.email; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import corey.hue.notifications.lights.HttpClientException; import corey.hue.notifications.model.Email; @Controller @RequestMapping("/email") public class EmailController { @Autowired private EmailService service; @RequestMapping(value= "/new",method = RequestMethod.POST) public void newEmailReceived(@RequestBody Email email) throws HttpClientException{ service.handleEmail(email); } }
UTF-8
Java
786
java
EmailController.java
Java
[]
null
[]
package corey.hue.notifications.email; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import corey.hue.notifications.lights.HttpClientException; import corey.hue.notifications.model.Email; @Controller @RequestMapping("/email") public class EmailController { @Autowired private EmailService service; @RequestMapping(value= "/new",method = RequestMethod.POST) public void newEmailReceived(@RequestBody Email email) throws HttpClientException{ service.handleEmail(email); } }
786
0.832061
0.832061
26
29.23077
26.183241
83
false
false
0
0
0
0
0
0
0.730769
false
false
5
7cfb094c03b250eda5ba99c08c5925f0e7c72fd0
26,001,732,045,179
f20af063f99487a25b7c70134378c1b3201964bf
/appengine/src/main/java/com/dereekb/gae/model/extension/links/system/mutable/impl/link/ReadOnlySingleMutableLinkDataDelegate.java
5b5cfb3c7e9a887232b40fb623168c373ab0bea8
[]
no_license
dereekb/appengine
https://github.com/dereekb/appengine
d45ad5c81c77cf3fcca57af1aac91bc73106ccbb
d0869fca8925193d5a9adafd267987b3edbf2048
refs/heads/master
2022-12-19T22:59:13.980000
2020-01-26T20:10:15
2020-01-26T20:10:15
165,971,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dereekb.gae.model.extension.links.system.mutable.impl.link; import com.dereekb.gae.server.datastore.models.keys.ModelKey; /** * {@link SingleMutableLinkData} delegate. * * @author dereekb * * @param <T> * model type */ public interface ReadOnlySingleMutableLinkDataDelegate<T> { /** * Returns the current linked key for the specific link on the model. * * @param model * Model. Never {@code null}. * * @return {@link ModelKey}. Can be {@code null} if not set. */ public ModelKey readLinkedModelKey(T model); }
UTF-8
Java
574
java
ReadOnlySingleMutableLinkDataDelegate.java
Java
[ { "context": "nk SingleMutableLinkData} delegate.\n * \n * @author dereekb\n *\n * @param <T>\n * model type\n */\npub", "end": 205, "score": 0.9996519088745117, "start": 198, "tag": "USERNAME", "value": "dereekb" } ]
null
[]
package com.dereekb.gae.model.extension.links.system.mutable.impl.link; import com.dereekb.gae.server.datastore.models.keys.ModelKey; /** * {@link SingleMutableLinkData} delegate. * * @author dereekb * * @param <T> * model type */ public interface ReadOnlySingleMutableLinkDataDelegate<T> { /** * Returns the current linked key for the specific link on the model. * * @param model * Model. Never {@code null}. * * @return {@link ModelKey}. Can be {@code null} if not set. */ public ModelKey readLinkedModelKey(T model); }
574
0.670732
0.670732
25
21.959999
25.059097
71
false
false
0
0
0
0
0
0
0.48
false
false
5
04a9b47b35f49d286aac0369f2ae96b6a98463b1
9,002,251,485,511
8fc04189a37e35277194486a599b399a10b2b956
/src/main/java/com/hexnology/boot/dao/mappers/bus/msweidianpanding/MSweidianpanding.java
1e6c423891c94514eb29d688e06837b4e444506e
[]
no_license
k506024730/kongyy
https://github.com/k506024730/kongyy
62af9bbec48d696218d9e0b5536ec139e8193737
d31c4de4f9c0a3935ce5c51a39e7b79baa17b431
refs/heads/master
2020-05-16T23:46:41.232000
2019-04-25T10:51:34
2019-04-25T10:57:24
183,376,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hexnology.boot.dao.mappers.bus.msweidianpanding; import com.hexnology.boot.dao.mappers.core.base.BaseEntity; import javax.persistence.*; @Table(name="msweidianpanding") public class MSweidianpanding extends BaseEntity { /** * 基因诊断模块id */ private String jiyinzhenduanmokuaiid; /** * ms */ private String ms; /** * ms位点判定 */ @Column(name = "ms_weidianpanding") private String msWeidianpanding; /** * 获取基因诊断模块id * * @return jiyinzhenduanmokuaiid - 基因诊断模块id */ public String getJiyinzhenduanmokuaiid() { return jiyinzhenduanmokuaiid; } /** * 设置基因诊断模块id * * @param jiyinzhenduanmokuaiid 基因诊断模块id */ public void setJiyinzhenduanmokuaiid(String jiyinzhenduanmokuaiid) { this.jiyinzhenduanmokuaiid = jiyinzhenduanmokuaiid == null ? null : jiyinzhenduanmokuaiid.trim(); } /** * 获取ms * * @return ms - ms */ public String getMs() { return ms; } /** * 设置ms * * @param ms ms */ public void setMs(String ms) { this.ms = ms == null ? null : ms.trim(); } /** * 获取ms位点判定 * * @return ms_weidianpanding - ms位点判定 */ public String getMsWeidianpanding() { return msWeidianpanding; } /** * 设置ms位点判定 * * @param msWeidianpanding ms位点判定 */ public void setMsWeidianpanding(String msWeidianpanding) { this.msWeidianpanding = msWeidianpanding == null ? null : msWeidianpanding.trim(); } }
UTF-8
Java
1,702
java
MSweidianpanding.java
Java
[]
null
[]
package com.hexnology.boot.dao.mappers.bus.msweidianpanding; import com.hexnology.boot.dao.mappers.core.base.BaseEntity; import javax.persistence.*; @Table(name="msweidianpanding") public class MSweidianpanding extends BaseEntity { /** * 基因诊断模块id */ private String jiyinzhenduanmokuaiid; /** * ms */ private String ms; /** * ms位点判定 */ @Column(name = "ms_weidianpanding") private String msWeidianpanding; /** * 获取基因诊断模块id * * @return jiyinzhenduanmokuaiid - 基因诊断模块id */ public String getJiyinzhenduanmokuaiid() { return jiyinzhenduanmokuaiid; } /** * 设置基因诊断模块id * * @param jiyinzhenduanmokuaiid 基因诊断模块id */ public void setJiyinzhenduanmokuaiid(String jiyinzhenduanmokuaiid) { this.jiyinzhenduanmokuaiid = jiyinzhenduanmokuaiid == null ? null : jiyinzhenduanmokuaiid.trim(); } /** * 获取ms * * @return ms - ms */ public String getMs() { return ms; } /** * 设置ms * * @param ms ms */ public void setMs(String ms) { this.ms = ms == null ? null : ms.trim(); } /** * 获取ms位点判定 * * @return ms_weidianpanding - ms位点判定 */ public String getMsWeidianpanding() { return msWeidianpanding; } /** * 设置ms位点判定 * * @param msWeidianpanding ms位点判定 */ public void setMsWeidianpanding(String msWeidianpanding) { this.msWeidianpanding = msWeidianpanding == null ? null : msWeidianpanding.trim(); } }
1,702
0.596324
0.596324
76
19.776316
21.890636
105
false
false
0
0
0
0
0
0
0.157895
false
false
5
57b1bff93ca3015a833b482e72e42a9982fe3102
11,819,750,000,230
83838e16a8aed067eba725af68c2cfd8f8008581
/dal/src/main/java/com/taobao/api/internal/translate/TqlResponse.java
aeff927f508af89a306ffd35a6b063107e1b2435
[]
no_license
shenke119/zhaobaocai
https://github.com/shenke119/zhaobaocai
79fcfef326db5cb52a56adc4e30ebe141ca92c6c
56263c7fcc46c235086039eeca8326a33776be29
refs/heads/master
2017-11-29T23:59:20.604000
2017-02-06T07:46:34
2017-02-06T07:46:34
81,059,900
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.taobao.api.internal.translate; import com.taobao.api.TaobaoResponse; public class TqlResponse extends TaobaoResponse { private static final long serialVersionUID = -2616669802258798383L; }
UTF-8
Java
207
java
TqlResponse.java
Java
[]
null
[]
package com.taobao.api.internal.translate; import com.taobao.api.TaobaoResponse; public class TqlResponse extends TaobaoResponse { private static final long serialVersionUID = -2616669802258798383L; }
207
0.816425
0.724638
9
22
25.690466
69
false
false
0
0
0
0
0
0
0.333333
false
false
5
bce94b67f38326ae69f913e593e975bf722c1431
11,819,750,002,072
23ea463dedb9057bebb334ab6da8358e15c2e81e
/crmi/src/main/java/run/FastTransportable.java
0a049e93c6d9512a7730dc58c0abf2008d2ff645
[ "BSD-2-Clause" ]
permissive
robertocapuano/crmi
https://github.com/robertocapuano/crmi
3a150a594eec3a4c4e5d6d50e4dd11834355bd38
044becec90879b207b81a1cccfc151a79ba73f14
refs/heads/master
2016-09-10T03:16:00.376000
2014-09-20T14:23:15
2014-09-20T14:23:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2014, Roberto Capuano <roberto@2think.it> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 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 HOLDER 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. */ package run; import run.serialization.SerializationException; import run.serialization.Container; import run.serialization.SerializationException; /** * Una classe che vuole essere resa FastTransportable, implementa il tipo Transportable. * On-the-fly Clio modifica la classe rendendola fast-transportable. * Tutto le classi devono definire questi metodi oltre che un campo long SUID * 1) Un costruttore di default * 2) writeObject() * 3) readObject() * 4) sizeOf() * 5) il campo SUID */ public interface FastTransportable extends Transportable { // Stream unique identifier // public final static long SUID = ..; // Bisogna far generare in maniera automatica questi due metodi // Serializza l'oggetto public void writeObject( Container.ContainerOutputStream cos ) throws SerializationException; // inizializza l'istanza dell'oggetto public void readObject( Container.ContainerInputStream cis ) throws SerializationException; // ...insieme a questo, dipende dal tipo effettivo dell'oggetto. public int sizeOf(); // dimensione dell'oggetto. }
UTF-8
Java
2,456
java
FastTransportable.java
Java
[ { "context": "/* \n * Copyright (c) 2014, Roberto Capuano <roberto@2think.it> \n * All rights reserved.\n *\n ", "end": 42, "score": 0.9998686909675598, "start": 27, "tag": "NAME", "value": "Roberto Capuano" }, { "context": "/* \n * Copyright (c) 2014, Roberto Capuano <roberto@2think.it> \n * All rights reserved.\n *\n * Redistribution an", "end": 61, "score": 0.9999317526817322, "start": 44, "tag": "EMAIL", "value": "roberto@2think.it" } ]
null
[]
/* * Copyright (c) 2014, <NAME> <<EMAIL>> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 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 HOLDER 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. */ package run; import run.serialization.SerializationException; import run.serialization.Container; import run.serialization.SerializationException; /** * Una classe che vuole essere resa FastTransportable, implementa il tipo Transportable. * On-the-fly Clio modifica la classe rendendola fast-transportable. * Tutto le classi devono definire questi metodi oltre che un campo long SUID * 1) Un costruttore di default * 2) writeObject() * 3) readObject() * 4) sizeOf() * 5) il campo SUID */ public interface FastTransportable extends Transportable { // Stream unique identifier // public final static long SUID = ..; // Bisogna far generare in maniera automatica questi due metodi // Serializza l'oggetto public void writeObject( Container.ContainerOutputStream cos ) throws SerializationException; // inizializza l'istanza dell'oggetto public void readObject( Container.ContainerInputStream cis ) throws SerializationException; // ...insieme a questo, dipende dal tipo effettivo dell'oggetto. public int sizeOf(); // dimensione dell'oggetto. }
2,437
0.773208
0.769137
58
41.362068
32.014919
95
false
false
0
0
0
0
0
0
0.568965
false
false
5
2a6fde610a44a6a804731ce7ec30a81dc0db3de3
5,196,910,466,388
4754bc522c94adbd86da56a11b5514b4da414e99
/app/src/main/java/com/example/studentclubsmanagement/activity/ClubInfoActivity.java
d8c800ede4cb8d7e3865da26987c516efeffdead
[ "Apache-2.0" ]
permissive
ZitaoLi/StudentClubManagementSystem
https://github.com/ZitaoLi/StudentClubManagementSystem
a85e1483649574ac192498e78036f815d42076a4
fba7f56b3e8f968fc45aac42ef1b1a985c6eead6
refs/heads/master
2020-03-07T15:19:38.195000
2018-04-15T10:52:00
2018-04-15T10:52:00
127,551,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.studentclubsmanagement.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; import android.os.Build; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.studentclubsmanagement.R; import com.example.studentclubsmanagement.gson.Club; import com.example.studentclubsmanagement.gson.GsonSingleton; import com.example.studentclubsmanagement.util.HttpUtil; import com.example.studentclubsmanagement.util.ImmersionUtil; import com.example.studentclubsmanagement.util.LogUtil; import com.example.studentclubsmanagement.util.MyApplication; import com.google.gson.Gson; import org.w3c.dom.Text; import java.io.IOException; import okhttp3.Call; import okhttp3.FormBody; import okhttp3.RequestBody; import okhttp3.Response; public class ClubInfoActivity extends BaseActivity { public static final String TAG = "ClubInfoActivity"; private int mClubId; private Activity mActivity; private String mUrlPrefix; public ClubInfoActivity() { mActivity = this; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_club_info); ImmersionUtil.setImmersion(this); Intent intent = getIntent(); mClubId = intent.getIntExtra("club_id", 0); if (mClubId != 0) { loadPage(); } } private void loadPage() { mUrlPrefix = HttpUtil.getUrlPrefix(mActivity); String url = mUrlPrefix + "/controller/ClubInfoServlet"; RequestBody body = new FormBody.Builder().add("club_id", String.valueOf(mClubId)).build(); HttpUtil.sendOkHttpRequestWithPost(url, body, new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { String json = response.body().string(); LogUtil.d(TAG, "post success"); try { showResponseData(json); } catch (Exception e) { HttpUtil.showToastOnUI(mActivity, "加载页面失败"); e.printStackTrace(); } } }); } private void showResponseData(final String json) { runOnUiThread(new Runnable() { @Override public void run() { Toolbar toolbar = (Toolbar) findViewById(R.id.club_info_toolbar); ImageView clubInfoBgImage = (ImageView) findViewById(R.id.club_info_bg_image); TextView clubName = (TextView) findViewById(R.id.club_info_club_name); TextView clubInfo = (TextView) findViewById(R.id.club_info_club_info); TextView clubMemberNum = (TextView) findViewById(R.id.club_info_club_member_num); TextView clubAge = (TextView) findViewById(R.id.club_info_club_age); Gson gson = GsonSingleton.getInstance(); LogUtil.d(TAG, json); Club club = gson.fromJson(json, Club.class); LogUtil.d(TAG, club.toString()); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(club.getClubName()); } String imagePath = club.getClubBgImagePath(); if (!"".equals(imagePath)){ LogUtil.d(TAG, "load:" + mUrlPrefix + imagePath); Glide.with(mActivity).load(mUrlPrefix + imagePath).into(clubInfoBgImage); } else { // TODO 设置默认社团背景 // clubInfoBgImage.setImageResource(R.drawable.default_user); } clubName.setText(club.getClubName()); clubInfo.setText(club.getClubInfo()); clubMemberNum.setText(String.valueOf(club.getMemberNum())); clubAge.setText(String.valueOf(club.getLifeTime())); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
4,927
java
ClubInfoActivity.java
Java
[]
null
[]
package com.example.studentclubsmanagement.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; import android.os.Build; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.studentclubsmanagement.R; import com.example.studentclubsmanagement.gson.Club; import com.example.studentclubsmanagement.gson.GsonSingleton; import com.example.studentclubsmanagement.util.HttpUtil; import com.example.studentclubsmanagement.util.ImmersionUtil; import com.example.studentclubsmanagement.util.LogUtil; import com.example.studentclubsmanagement.util.MyApplication; import com.google.gson.Gson; import org.w3c.dom.Text; import java.io.IOException; import okhttp3.Call; import okhttp3.FormBody; import okhttp3.RequestBody; import okhttp3.Response; public class ClubInfoActivity extends BaseActivity { public static final String TAG = "ClubInfoActivity"; private int mClubId; private Activity mActivity; private String mUrlPrefix; public ClubInfoActivity() { mActivity = this; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_club_info); ImmersionUtil.setImmersion(this); Intent intent = getIntent(); mClubId = intent.getIntExtra("club_id", 0); if (mClubId != 0) { loadPage(); } } private void loadPage() { mUrlPrefix = HttpUtil.getUrlPrefix(mActivity); String url = mUrlPrefix + "/controller/ClubInfoServlet"; RequestBody body = new FormBody.Builder().add("club_id", String.valueOf(mClubId)).build(); HttpUtil.sendOkHttpRequestWithPost(url, body, new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { String json = response.body().string(); LogUtil.d(TAG, "post success"); try { showResponseData(json); } catch (Exception e) { HttpUtil.showToastOnUI(mActivity, "加载页面失败"); e.printStackTrace(); } } }); } private void showResponseData(final String json) { runOnUiThread(new Runnable() { @Override public void run() { Toolbar toolbar = (Toolbar) findViewById(R.id.club_info_toolbar); ImageView clubInfoBgImage = (ImageView) findViewById(R.id.club_info_bg_image); TextView clubName = (TextView) findViewById(R.id.club_info_club_name); TextView clubInfo = (TextView) findViewById(R.id.club_info_club_info); TextView clubMemberNum = (TextView) findViewById(R.id.club_info_club_member_num); TextView clubAge = (TextView) findViewById(R.id.club_info_club_age); Gson gson = GsonSingleton.getInstance(); LogUtil.d(TAG, json); Club club = gson.fromJson(json, Club.class); LogUtil.d(TAG, club.toString()); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(club.getClubName()); } String imagePath = club.getClubBgImagePath(); if (!"".equals(imagePath)){ LogUtil.d(TAG, "load:" + mUrlPrefix + imagePath); Glide.with(mActivity).load(mUrlPrefix + imagePath).into(clubInfoBgImage); } else { // TODO 设置默认社团背景 // clubInfoBgImage.setImageResource(R.drawable.default_user); } clubName.setText(club.getClubName()); clubInfo.setText(club.getClubInfo()); clubMemberNum.setText(String.valueOf(club.getMemberNum())); clubAge.setText(String.valueOf(club.getLifeTime())); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } }
4,927
0.628291
0.626046
133
35.834587
25.018543
98
false
false
0
0
0
0
0
0
0.676692
false
false
5
b4550310bc6932b35de6e5f51f0d3e49c46bc02a
18,966,575,587,221
27c54c6e49d0ae6292d7584a7da79c7085b23be3
/week2/继承/Demo1/Subclass.java
390d00915ee64feb6a53b6acf9dbad493dbab67f
[]
no_license
yyqstudy/basic-Java
https://github.com/yyqstudy/basic-Java
877fdfccc2c8ef0d6d7a82cae0910d66867994b9
e49474240abe2e766ffe270625b2d63a16d4740c
refs/heads/main
2023-06-21T11:18:32.335000
2021-08-11T12:58:53
2021-08-11T12:58:53
386,893,572
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package week2.继承.Demo1; public class Subclass extends Superclass { public void method(){ System.out.println("method方法被调用"); } }
UTF-8
Java
159
java
Subclass.java
Java
[]
null
[]
package week2.继承.Demo1; public class Subclass extends Superclass { public void method(){ System.out.println("method方法被调用"); } }
159
0.675862
0.662069
7
19.714285
16.849878
42
false
false
0
0
0
0
0
0
0.285714
false
false
5
9d254ac9e8a67ece55c7761ae726eb411d03a3d0
13,228,499,284,071
6d6494e94a5477b7d1c449d18a85b2615939e697
/app/src/main/java/com/example/fluper/larika_user_app/bean/AddMyProductModel.java
0d91864c4c39ffdc2a8c4db2e8a7b7ca298a90c5
[]
no_license
hata02525/larika
https://github.com/hata02525/larika
de6b1f59406cb0b133728bababb84dea9e8140e2
e898fd3c8981832c5fd74bb117b911cda0917b89
refs/heads/master
2019-03-17T21:05:20.395000
2018-02-28T13:05:30
2018-02-28T13:05:30
123,286,102
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.fluper.larika_user_app.bean; /** * Created by rohit on 4/7/17. */ public class AddMyProductModel { private String dishId,quantity; private String vendorDishId; private String vendorId; private String dishName; private String dishTitle; private String dishDesc; private String dishImage; private String rating; private String dishStock; private String dishSummary; private String dishPrice; private String vendorName; private String category; private String nature; private String cartId; boolean isMatchId; public boolean isMatchId() { return isMatchId; } public void setMatchId(boolean matchId) { isMatchId = matchId; } public String getCartId() { if(cartId==null) cartId=""; return cartId; } public void setCartId(String cartId) { this.cartId = cartId; } public String getQuantity() { if(quantity==null) quantity="1"; return quantity; } public void setQuantity(String quantity) { this.quantity = quantity; } public String getDishId() { return dishId; } public void setDishId(String dishId) { this.dishId = dishId; } public String getVendorDishId() { return vendorDishId; } public void setVendorDishId(String vendorDishId) { this.vendorDishId = vendorDishId; } public String getVendorId() { if(vendorId==null) vendorId=""; return vendorId; } public void setVendorId(String vendorId) { this.vendorId = vendorId; } public String getDishName() { return dishName; } public void setDishName(String dishName) { this.dishName = dishName; } public String getDishTitle() { return dishTitle; } public void setDishTitle(String dishTitle) { this.dishTitle = dishTitle; } public String getDishDesc() { return dishDesc; } public void setDishDesc(String dishDesc) { this.dishDesc = dishDesc; } public String getDishImage() { return dishImage; } public void setDishImage(String dishImage) { this.dishImage = dishImage; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getDishStock() { return dishStock; } public void setDishStock(String dishStock) { this.dishStock = dishStock; } public String getDishSummary() { return dishSummary; } public void setDishSummary(String dishSummary) { this.dishSummary = dishSummary; } public String getDishPrice() { return dishPrice; } public void setDishPrice(String dishPrice) { this.dishPrice = dishPrice; } public String getVendorName() { return vendorName; } public void setVendorName(String vendorName) { this.vendorName = vendorName; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getNature() { return nature; } public void setNature(String nature) { this.nature = nature; } }
UTF-8
Java
3,418
java
AddMyProductModel.java
Java
[ { "context": "le.fluper.larika_user_app.bean;\n\n/**\n * Created by rohit on 4/7/17.\n */\n\npublic class AddMyProductModel {\n", "end": 73, "score": 0.9990841150283813, "start": 68, "tag": "USERNAME", "value": "rohit" } ]
null
[]
package com.example.fluper.larika_user_app.bean; /** * Created by rohit on 4/7/17. */ public class AddMyProductModel { private String dishId,quantity; private String vendorDishId; private String vendorId; private String dishName; private String dishTitle; private String dishDesc; private String dishImage; private String rating; private String dishStock; private String dishSummary; private String dishPrice; private String vendorName; private String category; private String nature; private String cartId; boolean isMatchId; public boolean isMatchId() { return isMatchId; } public void setMatchId(boolean matchId) { isMatchId = matchId; } public String getCartId() { if(cartId==null) cartId=""; return cartId; } public void setCartId(String cartId) { this.cartId = cartId; } public String getQuantity() { if(quantity==null) quantity="1"; return quantity; } public void setQuantity(String quantity) { this.quantity = quantity; } public String getDishId() { return dishId; } public void setDishId(String dishId) { this.dishId = dishId; } public String getVendorDishId() { return vendorDishId; } public void setVendorDishId(String vendorDishId) { this.vendorDishId = vendorDishId; } public String getVendorId() { if(vendorId==null) vendorId=""; return vendorId; } public void setVendorId(String vendorId) { this.vendorId = vendorId; } public String getDishName() { return dishName; } public void setDishName(String dishName) { this.dishName = dishName; } public String getDishTitle() { return dishTitle; } public void setDishTitle(String dishTitle) { this.dishTitle = dishTitle; } public String getDishDesc() { return dishDesc; } public void setDishDesc(String dishDesc) { this.dishDesc = dishDesc; } public String getDishImage() { return dishImage; } public void setDishImage(String dishImage) { this.dishImage = dishImage; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getDishStock() { return dishStock; } public void setDishStock(String dishStock) { this.dishStock = dishStock; } public String getDishSummary() { return dishSummary; } public void setDishSummary(String dishSummary) { this.dishSummary = dishSummary; } public String getDishPrice() { return dishPrice; } public void setDishPrice(String dishPrice) { this.dishPrice = dishPrice; } public String getVendorName() { return vendorName; } public void setVendorName(String vendorName) { this.vendorName = vendorName; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getNature() { return nature; } public void setNature(String nature) { this.nature = nature; } }
3,418
0.609713
0.60825
193
16.715027
16.560038
54
false
false
0
0
0
0
0
0
0.284974
false
false
5
806680a6d88da6767a357396a65fd5a879b6a228
27,960,237,113,342
2f5cc00c75ed32245801fc5d33e2220ac52216bc
/avic-flight-plan-edit/avic-flight-plan-edit-service/src/main/java/cn/com/avic/flightplanedit/factor/controller/internal/SafeguardContractController.java
c632f5753b777de4be3b9b7421182aeabadea1b4
[]
no_license
wangling666/hangyan
https://github.com/wangling666/hangyan
08c38a5709eaab6390fbe76d999035b1fb2265cc
2f26d0245ade22ab9edb4f7da3e0aa590b7ccac9
refs/heads/master
2020-04-24T14:20:48.689000
2019-02-22T07:48:50
2019-02-22T07:51:28
172,017,724
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.avic.flightplanedit.factor.controller.internal; import cn.com.avic.base.api.annotation.ApiOperateLog; import cn.com.avic.base.api.annotation.ApiResult; import cn.com.avic.base.api.exception.ApiException; import cn.com.avic.base.api.result.ApiResultCode; import cn.com.avic.base.constant.SessionConstant; import cn.com.avic.base.mybatis.page.PageResult; import cn.com.avic.base.web.controller.BaseRestController; import cn.com.avic.flightplanedit.factor.dto.condition.SafeguardContractCondition; import cn.com.avic.flightplanedit.factor.dto.page.SafeguardContractPageDTO; import cn.com.avic.flightplanedit.factor.entity.SafeguardContract; import cn.com.avic.flightplanedit.factor.service.ISafeguardContractService; import cn.com.avic.system.approve.dto.workflow.ApproveDTO; import cn.com.avic.system.approve.dto.workflow.ApproveStatus; import cn.com.avic.system.file.dto.UploadFileTempDTO; import cn.com.avic.system.token.entity.ApiAccessToken; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * 类 名: SafeguardContract * 描 述: 保障协议 * 作 者: 甄琦 * 创 建:2018年08月31日 * 版 本:v1.0.0 * * 历 史: (版本) 作者 时间 注释 */ @ApiResult @RestController @RequestMapping("/${spring.application.name}/api/factor/safeguardcontract") @Api(tags = {"保障协议接口"}) public class SafeguardContractController extends BaseRestController { @Resource(name = "safeguardContractServiceImpl") private ISafeguardContractService safeguardContractService; /** * 描 述: 分页查询保障协议数据 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param currentPage 当前页 * @param condition 查询条件 * @return 分页对象 */ @ApiOperation(value = "分页查询保障协议数据") @ApiOperateLog("分页查询保障协议数据") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "currentPage", value = "当前页码", required = true, dataType = "int"), @ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页大小", dataType = "int"), @ApiImplicitParam(paramType = "body", name = "condition", value = "保障协议查询条件实体", dataType = "SafeguardContractCondition",dataTypeClass = SafeguardContractCondition.class) }) @PostMapping("/query") public PageResult<SafeguardContractPageDTO> listSafeguardContractByPage(@RequestParam("currentPage") Integer currentPage, @RequestParam(value = "pageSize",required = false) Integer pageSize, @RequestBody(required = false) SafeguardContractCondition condition) throws ApiException { Long organizationId = this.getOrganizationId(); if (condition == null){ condition = new SafeguardContractCondition(); } condition.setOrganizationId(organizationId); PageResult<SafeguardContractPageDTO> pageResult = new PageResult<>(); pageResult.setCurrentPage(currentPage); pageResult.setPageSize(pageSize); // 分页查询 safeguardContractService.listSafeguardContractByPage(pageResult,condition); return pageResult; } /** * 描 述: 根据ID查询保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param id 主键 * @return 保障协议数据 */ @ApiOperation(value = "根据ID查询保障协议") @ApiOperateLog("根据ID查询保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "保障协议ID", required = true, dataType = "long") }) @GetMapping("/{id}") public SafeguardContract getSafeguardContractById(@PathVariable("id") Long id) throws ApiException { SafeguardContract contract = safeguardContractService.getSafeguardContractById(id); if (contract == null){ throw new ApiException(ApiResultCode.DATA_IS_NONE); } this.checkOrganizationId(contract.getOrganizationId()); return contract; } /** * 描 述: 保存保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议数据 */ @ApiOperation(value = "保存保障协议") @ApiOperateLog("保存保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "item", value = "保障协议实体", required = true, dataType = "SafeguardContract", dataTypeClass = SafeguardContract.class) }) @PostMapping(value = {"/add","/edit"}) public void saveSafeguardContract(@RequestBody SafeguardContract item) throws ApiException { Long organizationId = this.getOrganizationId(); if (null == item.getId()){ item.setStatus(ApproveStatus.UNCOMMIT); item.setOrganizationId(organizationId); safeguardContractService.add(item); return; } SafeguardContract contract = safeguardContractService.getSafeguardContractById(item.getId()); if (contract == null){ throw new ApiException(ApiResultCode.DATA_IS_NONE); } this.checkOrganizationId(contract.getOrganizationId()); safeguardContractService.updateSafeguardContract(item); } /** * 描 述: 提交保障协议 * 作 者: 陈鹤 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议 * @return 提交的保障协议 */ @ApiOperation(value = "提交保障协议") @ApiOperateLog("提交保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType="body", name = "item", value = "保障协议实体", required = true, dataType = "SafeguardContract", dataTypeClass = SafeguardContract.class) }) @PostMapping("/submit") public SafeguardContract submitSafeguardContract(@RequestBody SafeguardContract item, HttpServletRequest request) throws ApiException { Long organizationId = this.getOrganizationId(); if (null == item.getId()){ item.setOrganizationId(organizationId); } else { SafeguardContract safeguardContractById = safeguardContractService.getSafeguardContractById(item.getId()); if (null == safeguardContractById) { throw new ApiException(ApiResultCode.DATA_IS_NONE,"数据库不存在这条作业协议"); } this.checkOrganizationId(safeguardContractById.getOrganizationId()); } ApiAccessToken apiAccessToken = (ApiAccessToken)request.getAttribute(SessionConstant.CURRENT_API_ACCESS_TOKEN); safeguardContractService.submit(item,apiAccessToken.getVisitor()); return item; } /** * 描 述: 审批保障协议 * 作 者: 陈鹤 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议 */ @ApiOperation(value = "审批保障协议") @ApiOperateLog("审批保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType="body", name = "item", value = "保障协议", required = true, dataType = "ApproveDTO", dataTypeClass = ApproveDTO.class) }) @PostMapping("/approve") public SafeguardContract approve(@RequestBody ApproveDTO item) throws ApiException { SafeguardContract safeguardContractById = safeguardContractService.getSafeguardContractById(item.getId()); if (null == safeguardContractById) { throw new ApiException(ApiResultCode.DATA_IS_NONE); } if (safeguardContractById.getStatus().getValue() != ApproveStatus.APPROVING.getValue()) { logger.warn("数据不是待审批的数据:{}", safeguardContractById); throw new ApiException(ApiResultCode.BUSINESS_MILITARY_MILITARYAPPROVAL_ERROR); } Long organizationId = this.getOrganizationId(); safeguardContractById.setStatus(item.getStatus()); safeguardContractService.approve(safeguardContractById,item,organizationId); return safeguardContractById; } /** * 描 述: 根据ID批量保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param idList 主键集合 */ @ApiOperation(value = "根据IDS批量删除保障协议") @ApiOperateLog("根据IDS批量删除保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "idList", value = "ID集合", required = true, allowMultiple = true, dataType = "long", dataTypeClass = Long.class) }) @DeleteMapping(value = "/delete/batch") public void delSafeguardContractByIds(@RequestBody List<Integer> idList) throws ApiException{ // 查寻用户所在机构下的保障协议 List<SafeguardContract> safeguardContractList = this.safeguardContractService.listSafeguardContractByIds(idList); // 删除用的数组 Long[] ids = new Long[safeguardContractList.size()]; for(int i = 0; i < safeguardContractList.size(); i++){ // 判断用户所在的机构是否都有权限删除 SafeguardContract safeguardContract = safeguardContractList.get(i); this.checkOrganizationId(safeguardContract.getOrganizationId()); // 2:审批中 if (safeguardContract.getStatus().getValue() == 20){ throw new ApiException(ApiResultCode.BUSINESS_NO_DELETE_FOR_APPROVE,safeguardContract.getId()); // 5:失效 }else if(safeguardContract.getStatus().getValue() == 50){ throw new ApiException(ApiResultCode.BUSINESS_NO_DELETE_FOR_EXPIRE,safeguardContract.getId()); }else { ids[i] = safeguardContract.getId(); } } // 执行删除 this.safeguardContractService.delByIds(ids); } /** * 描 述: 导出保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param condition 查询条件 * @return UploadFileTempDTO 临时文件 */ @ApiOperation(value = "导出保障协议") @ApiOperateLog("导出保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "condition", value = "查询条件", required = true, dataType = "UploadFileTempDTO", dataTypeClass = UploadFileTempDTO.class) }) @PostMapping("/export") public UploadFileTempDTO export(@RequestBody SafeguardContractCondition condition) throws ApiException { // 获取当前组织 Long organizationId = this.getOrganizationId(); condition.setOrganizationId(organizationId); return safeguardContractService.export(condition); } }
UTF-8
Java
10,934
java
SafeguardContractController.java
Java
[ { "context": "**\n * 类 名: SafeguardContract\n * 描 述: 保障协议\n * 作 者: 甄琦\n * 创 建:2018年08月31日\n * 版 本:v1.0.0\n *\n * 历 史: (版本) ", "end": 1346, "score": 0.9842177033424377, "start": 1344, "tag": "NAME", "value": "甄琦" }, { "context": "ice;\n\n\n /**\n * 描 述: 分页查询保障协议数据\n * 作 者: 甄琦\n * 历 史: (版本) 作者 时间 注释\n * @param currentPa", "end": 1771, "score": 0.999541163444519, "start": 1769, "tag": "NAME", "value": "甄琦" }, { "context": " }\n\n\n /**\n * 描 述: 根据ID查询保障协议\n * 作 者: 甄琦\n * 历 史: (版本) 作者 时间 注释\n * @param id 主键\n ", "end": 3263, "score": 0.9994899034500122, "start": 3261, "tag": "NAME", "value": "甄琦" }, { "context": "ct;\n }\n\n /**\n * 描 述: 保存保障协议\n * 作 者: 甄琦\n * 历 史: (版本) 作者 时间 注释\n * @param item 保障协议", "end": 4022, "score": 0.9989224672317505, "start": 4020, "tag": "NAME", "value": "甄琦" }, { "context": "m);\n }\n\n /**\n * 描 述: 提交保障协议\n * 作 者: 陈鹤\n * 历 史: (版本) 作者 时间 注释\n * @param item 保障协议", "end": 5145, "score": 0.9948742985725403, "start": 5143, "tag": "NAME", "value": "陈鹤" }, { "context": "em;\n }\n\n /**\n * 描 述: 审批保障协议\n * 作 者: 陈鹤\n * 历 史: (版本) 作者 时间 注释\n * @param item 保障协议", "end": 6443, "score": 0.9996337890625, "start": 6441, "tag": "NAME", "value": "陈鹤" }, { "context": " }\n\n\n /**\n * 描 述: 根据ID批量保障协议\n * 作 者: 甄琦\n * 历 史: (版本) 作者 时间 注释\n * @param idList 主键", "end": 7663, "score": 0.9995507597923279, "start": 7661, "tag": "NAME", "value": "甄琦" }, { "context": ";\n }\n\n\n\n /**\n * 描 述: 导出保障协议\n * 作 者: 甄琦\n * 历 史: (版本) 作者 时间 注释\n * @param condition", "end": 9237, "score": 0.9995662569999695, "start": 9235, "tag": "NAME", "value": "甄琦" } ]
null
[]
package cn.com.avic.flightplanedit.factor.controller.internal; import cn.com.avic.base.api.annotation.ApiOperateLog; import cn.com.avic.base.api.annotation.ApiResult; import cn.com.avic.base.api.exception.ApiException; import cn.com.avic.base.api.result.ApiResultCode; import cn.com.avic.base.constant.SessionConstant; import cn.com.avic.base.mybatis.page.PageResult; import cn.com.avic.base.web.controller.BaseRestController; import cn.com.avic.flightplanedit.factor.dto.condition.SafeguardContractCondition; import cn.com.avic.flightplanedit.factor.dto.page.SafeguardContractPageDTO; import cn.com.avic.flightplanedit.factor.entity.SafeguardContract; import cn.com.avic.flightplanedit.factor.service.ISafeguardContractService; import cn.com.avic.system.approve.dto.workflow.ApproveDTO; import cn.com.avic.system.approve.dto.workflow.ApproveStatus; import cn.com.avic.system.file.dto.UploadFileTempDTO; import cn.com.avic.system.token.entity.ApiAccessToken; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * 类 名: SafeguardContract * 描 述: 保障协议 * 作 者: 甄琦 * 创 建:2018年08月31日 * 版 本:v1.0.0 * * 历 史: (版本) 作者 时间 注释 */ @ApiResult @RestController @RequestMapping("/${spring.application.name}/api/factor/safeguardcontract") @Api(tags = {"保障协议接口"}) public class SafeguardContractController extends BaseRestController { @Resource(name = "safeguardContractServiceImpl") private ISafeguardContractService safeguardContractService; /** * 描 述: 分页查询保障协议数据 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param currentPage 当前页 * @param condition 查询条件 * @return 分页对象 */ @ApiOperation(value = "分页查询保障协议数据") @ApiOperateLog("分页查询保障协议数据") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "currentPage", value = "当前页码", required = true, dataType = "int"), @ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页大小", dataType = "int"), @ApiImplicitParam(paramType = "body", name = "condition", value = "保障协议查询条件实体", dataType = "SafeguardContractCondition",dataTypeClass = SafeguardContractCondition.class) }) @PostMapping("/query") public PageResult<SafeguardContractPageDTO> listSafeguardContractByPage(@RequestParam("currentPage") Integer currentPage, @RequestParam(value = "pageSize",required = false) Integer pageSize, @RequestBody(required = false) SafeguardContractCondition condition) throws ApiException { Long organizationId = this.getOrganizationId(); if (condition == null){ condition = new SafeguardContractCondition(); } condition.setOrganizationId(organizationId); PageResult<SafeguardContractPageDTO> pageResult = new PageResult<>(); pageResult.setCurrentPage(currentPage); pageResult.setPageSize(pageSize); // 分页查询 safeguardContractService.listSafeguardContractByPage(pageResult,condition); return pageResult; } /** * 描 述: 根据ID查询保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param id 主键 * @return 保障协议数据 */ @ApiOperation(value = "根据ID查询保障协议") @ApiOperateLog("根据ID查询保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "保障协议ID", required = true, dataType = "long") }) @GetMapping("/{id}") public SafeguardContract getSafeguardContractById(@PathVariable("id") Long id) throws ApiException { SafeguardContract contract = safeguardContractService.getSafeguardContractById(id); if (contract == null){ throw new ApiException(ApiResultCode.DATA_IS_NONE); } this.checkOrganizationId(contract.getOrganizationId()); return contract; } /** * 描 述: 保存保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议数据 */ @ApiOperation(value = "保存保障协议") @ApiOperateLog("保存保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "item", value = "保障协议实体", required = true, dataType = "SafeguardContract", dataTypeClass = SafeguardContract.class) }) @PostMapping(value = {"/add","/edit"}) public void saveSafeguardContract(@RequestBody SafeguardContract item) throws ApiException { Long organizationId = this.getOrganizationId(); if (null == item.getId()){ item.setStatus(ApproveStatus.UNCOMMIT); item.setOrganizationId(organizationId); safeguardContractService.add(item); return; } SafeguardContract contract = safeguardContractService.getSafeguardContractById(item.getId()); if (contract == null){ throw new ApiException(ApiResultCode.DATA_IS_NONE); } this.checkOrganizationId(contract.getOrganizationId()); safeguardContractService.updateSafeguardContract(item); } /** * 描 述: 提交保障协议 * 作 者: 陈鹤 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议 * @return 提交的保障协议 */ @ApiOperation(value = "提交保障协议") @ApiOperateLog("提交保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType="body", name = "item", value = "保障协议实体", required = true, dataType = "SafeguardContract", dataTypeClass = SafeguardContract.class) }) @PostMapping("/submit") public SafeguardContract submitSafeguardContract(@RequestBody SafeguardContract item, HttpServletRequest request) throws ApiException { Long organizationId = this.getOrganizationId(); if (null == item.getId()){ item.setOrganizationId(organizationId); } else { SafeguardContract safeguardContractById = safeguardContractService.getSafeguardContractById(item.getId()); if (null == safeguardContractById) { throw new ApiException(ApiResultCode.DATA_IS_NONE,"数据库不存在这条作业协议"); } this.checkOrganizationId(safeguardContractById.getOrganizationId()); } ApiAccessToken apiAccessToken = (ApiAccessToken)request.getAttribute(SessionConstant.CURRENT_API_ACCESS_TOKEN); safeguardContractService.submit(item,apiAccessToken.getVisitor()); return item; } /** * 描 述: 审批保障协议 * 作 者: 陈鹤 * 历 史: (版本) 作者 时间 注释 * @param item 保障协议 */ @ApiOperation(value = "审批保障协议") @ApiOperateLog("审批保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType="body", name = "item", value = "保障协议", required = true, dataType = "ApproveDTO", dataTypeClass = ApproveDTO.class) }) @PostMapping("/approve") public SafeguardContract approve(@RequestBody ApproveDTO item) throws ApiException { SafeguardContract safeguardContractById = safeguardContractService.getSafeguardContractById(item.getId()); if (null == safeguardContractById) { throw new ApiException(ApiResultCode.DATA_IS_NONE); } if (safeguardContractById.getStatus().getValue() != ApproveStatus.APPROVING.getValue()) { logger.warn("数据不是待审批的数据:{}", safeguardContractById); throw new ApiException(ApiResultCode.BUSINESS_MILITARY_MILITARYAPPROVAL_ERROR); } Long organizationId = this.getOrganizationId(); safeguardContractById.setStatus(item.getStatus()); safeguardContractService.approve(safeguardContractById,item,organizationId); return safeguardContractById; } /** * 描 述: 根据ID批量保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param idList 主键集合 */ @ApiOperation(value = "根据IDS批量删除保障协议") @ApiOperateLog("根据IDS批量删除保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "idList", value = "ID集合", required = true, allowMultiple = true, dataType = "long", dataTypeClass = Long.class) }) @DeleteMapping(value = "/delete/batch") public void delSafeguardContractByIds(@RequestBody List<Integer> idList) throws ApiException{ // 查寻用户所在机构下的保障协议 List<SafeguardContract> safeguardContractList = this.safeguardContractService.listSafeguardContractByIds(idList); // 删除用的数组 Long[] ids = new Long[safeguardContractList.size()]; for(int i = 0; i < safeguardContractList.size(); i++){ // 判断用户所在的机构是否都有权限删除 SafeguardContract safeguardContract = safeguardContractList.get(i); this.checkOrganizationId(safeguardContract.getOrganizationId()); // 2:审批中 if (safeguardContract.getStatus().getValue() == 20){ throw new ApiException(ApiResultCode.BUSINESS_NO_DELETE_FOR_APPROVE,safeguardContract.getId()); // 5:失效 }else if(safeguardContract.getStatus().getValue() == 50){ throw new ApiException(ApiResultCode.BUSINESS_NO_DELETE_FOR_EXPIRE,safeguardContract.getId()); }else { ids[i] = safeguardContract.getId(); } } // 执行删除 this.safeguardContractService.delByIds(ids); } /** * 描 述: 导出保障协议 * 作 者: 甄琦 * 历 史: (版本) 作者 时间 注释 * @param condition 查询条件 * @return UploadFileTempDTO 临时文件 */ @ApiOperation(value = "导出保障协议") @ApiOperateLog("导出保障协议") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "condition", value = "查询条件", required = true, dataType = "UploadFileTempDTO", dataTypeClass = UploadFileTempDTO.class) }) @PostMapping("/export") public UploadFileTempDTO export(@RequestBody SafeguardContractCondition condition) throws ApiException { // 获取当前组织 Long organizationId = this.getOrganizationId(); condition.setOrganizationId(organizationId); return safeguardContractService.export(condition); } }
10,934
0.680117
0.678306
248
39.076614
39.63755
285
false
false
0
0
0
0
0
0
0.528226
false
false
5
01a2ae4a49b580d7491c900d0b16e226b6d9cc66
29,884,382,455,064
1abd0442c5f816d8f50108f7a99263e40bca2d34
/examples/minesweeper/src/controller/Controller.java
1263502d77d5fbb770f18153dab331556931ca53
[]
no_license
jJayyyyyyy/JavaNotes
https://github.com/jJayyyyyyy/JavaNotes
13ea8016de5cad3887e2cf1b3de6730662c292d9
6c9f3cd9d8b881e402bc01f105f46b72f3fe547b
refs/heads/master
2020-03-07T17:33:35.886000
2019-04-30T15:37:41
2019-04-30T15:37:41
127,614,687
8
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.awt.event.MouseEvent; import javax.swing.JFrame; import model.Cell; import view.Gameboard; import view.View; /* * https://testdrive-archive.azurewebsites.net/Performance/Minesweeper/Default.html * */ public class Controller { private Gameboard gameboard; private View view; private MouseClickHandler mouse; private JFrame frame; private static int cntCol = 20; private static int cntRow = 20; public class MouseClickHandler extends MouseHandler{ @Override public void mouseClicked(MouseEvent e) { int x = e.getX() - 3; int y = e.getY() - 26; int col = x / View.GRID_SIZE; int row = y / View.GRID_SIZE; System.out.printf("%d, %d\n", row, col); Cell cell = gameboard.getCell(row, col); /* https://blog.csdn.net/changqing5818/article/details/49497595 * */ if( e.getButton() == MouseEvent.BUTTON1 && cell.isFlag == false ) { /* TODO : how to directly get the X and Y coordinates from the current component? * rather than from the origin point of the whole frame * 3 and 26 is the offset from the whole frame * */ if( cell.isMine ) { gameover(); }else { if( cell.neiborMine == 0 ) { gameboard.floodFill(row, col); }else { cell.revealed = true; } } }else if( e.getButton() == MouseEvent.BUTTON3 ) { // System.out.println("right click"); if( cell.revealed == false ) { cell.isFlag = !cell.isFlag; } } frame.repaint(); } public void MousePressed(MouseEvent e) { /* http://www.aichengxu.com/java/2778900.htm * https://blog.csdn.net/methods2011/article/details/12444003 * */ } } public void gameover() { for( int i = 0; i < cntRow; i++ ) { for (int j = 0; j < cntCol; j++ ) { Cell cell = gameboard.getCell(i, j); if( cell.isFlag == false ) { cell.revealed = true; }else { if( cell.isMine ) { cell.isCorrectFlag = true; }else { cell.isCorrectFlag = false; } } } } } public Controller() { gameboard = new Gameboard(cntRow, cntCol); view = new View(gameboard); mouse = new MouseClickHandler(); frame = new JFrame(); } public static void main(String[] args) { Controller c = new Controller(); c.frame = new JFrame(); c.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c.frame.setResizable(false); c.frame.setTitle("Mine Sweeper"); c.frame.add(c.view); c.frame.addMouseListener(c.mouse); c.frame.pack(); c.frame.setVisible(true); System.out.println("done"); } }
UTF-8
Java
2,671
java
Controller.java
Java
[ { "context": "Cell(row, col);\r\n\t\t\t\r\n\t\t\t/* https://blog.csdn.net/changqing5818/article/details/49497595\r\n\t\t\t * */\r\n\t\t\tif( e.getB", "end": 833, "score": 0.9996863603591919, "start": 820, "tag": "USERNAME", "value": "changqing5818" }, { "context": "com/java/2778900.htm\r\n\t\t\t * https://blog.csdn.net/methods2011/article/details/12444003\r\n\t\t\t * */\r\n\t\t}\r\n\t}\r\n\t\r\n\t", "end": 1694, "score": 0.999583899974823, "start": 1683, "tag": "USERNAME", "value": "methods2011" } ]
null
[]
package controller; import java.awt.event.MouseEvent; import javax.swing.JFrame; import model.Cell; import view.Gameboard; import view.View; /* * https://testdrive-archive.azurewebsites.net/Performance/Minesweeper/Default.html * */ public class Controller { private Gameboard gameboard; private View view; private MouseClickHandler mouse; private JFrame frame; private static int cntCol = 20; private static int cntRow = 20; public class MouseClickHandler extends MouseHandler{ @Override public void mouseClicked(MouseEvent e) { int x = e.getX() - 3; int y = e.getY() - 26; int col = x / View.GRID_SIZE; int row = y / View.GRID_SIZE; System.out.printf("%d, %d\n", row, col); Cell cell = gameboard.getCell(row, col); /* https://blog.csdn.net/changqing5818/article/details/49497595 * */ if( e.getButton() == MouseEvent.BUTTON1 && cell.isFlag == false ) { /* TODO : how to directly get the X and Y coordinates from the current component? * rather than from the origin point of the whole frame * 3 and 26 is the offset from the whole frame * */ if( cell.isMine ) { gameover(); }else { if( cell.neiborMine == 0 ) { gameboard.floodFill(row, col); }else { cell.revealed = true; } } }else if( e.getButton() == MouseEvent.BUTTON3 ) { // System.out.println("right click"); if( cell.revealed == false ) { cell.isFlag = !cell.isFlag; } } frame.repaint(); } public void MousePressed(MouseEvent e) { /* http://www.aichengxu.com/java/2778900.htm * https://blog.csdn.net/methods2011/article/details/12444003 * */ } } public void gameover() { for( int i = 0; i < cntRow; i++ ) { for (int j = 0; j < cntCol; j++ ) { Cell cell = gameboard.getCell(i, j); if( cell.isFlag == false ) { cell.revealed = true; }else { if( cell.isMine ) { cell.isCorrectFlag = true; }else { cell.isCorrectFlag = false; } } } } } public Controller() { gameboard = new Gameboard(cntRow, cntCol); view = new View(gameboard); mouse = new MouseClickHandler(); frame = new JFrame(); } public static void main(String[] args) { Controller c = new Controller(); c.frame = new JFrame(); c.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c.frame.setResizable(false); c.frame.setTitle("Mine Sweeper"); c.frame.add(c.view); c.frame.addMouseListener(c.mouse); c.frame.pack(); c.frame.setVisible(true); System.out.println("done"); } }
2,671
0.607263
0.590041
108
22.731482
19.381935
85
false
false
0
0
0
0
0
0
2.842592
false
false
5
d2836925a4d397a8d77cc6a4c1116f4523938b3b
20,933,670,618,479
c135a0ef4bce05e88bdb86b39cac8c045b9043ca
/commonLib.java
3b8347e269c9032779bf344ec1f18290c800e75e
[]
no_license
shivfgs/automation
https://github.com/shivfgs/automation
d8a5210f478a1d6ec81f17fa1b0c06f0127f14c6
90de8c8e904676b08b89f25b0d7e1f41ec07b8ae
refs/heads/master
2023-04-03T02:55:42.454000
2021-04-12T19:51:14
2021-04-12T19:51:14
294,693,604
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
String osName=System.getProperty("os.name"); String userDirectory= System.getProperty("user.dir"); public static Properties config = null; public void loadConfigProperty() throws IOException { config = new Properties(); FileInputStream ip = new FileInputStream( System.getProperty("user.dir") + "//src//test//resources//config//config.properties"); config.load(ip); } loadConfigProperty(); String browserType=config.getProperty("browserType"); // Set Properties System.setProperty("webdriver.chrome.driver", chromeDriverPath);
UTF-8
Java
545
java
commonLib.java
Java
[]
null
[]
String osName=System.getProperty("os.name"); String userDirectory= System.getProperty("user.dir"); public static Properties config = null; public void loadConfigProperty() throws IOException { config = new Properties(); FileInputStream ip = new FileInputStream( System.getProperty("user.dir") + "//src//test//resources//config//config.properties"); config.load(ip); } loadConfigProperty(); String browserType=config.getProperty("browserType"); // Set Properties System.setProperty("webdriver.chrome.driver", chromeDriverPath);
545
0.757798
0.757798
15
35.333332
24.979103
90
false
false
0
0
0
0
0
0
1.4
false
false
5
8e1b955d4504e8dee8dec90c01fe8e86aadb0649
13,030,930,792,902
7f74795d2f03cf8ef03e37202e5185de771afef2
/src/main/java/epicsquid/mysticallib/item/tool/IEffectiveTool.java
352db391525fa5a072ab774aac36ae58c715dc85
[ "MIT" ]
permissive
MysticMods/MysticalLib
https://github.com/MysticMods/MysticalLib
2ef95b0c51538778723ebc98362b2e0740bf9d26
71f61b7ac70d0a4c607319cbf82960354a1cd79e
refs/heads/master
2023-04-23T16:35:01.838000
2023-04-11T01:35:08
2023-04-11T01:35:08
137,380,670
6
13
MIT
false
2023-04-11T01:35:10
2018-06-14T16:05:38
2023-02-16T21:21:58
2023-04-11T01:35:09
1,097
12
11
1
Java
false
false
package epicsquid.mysticallib.item.tool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import java.util.Set; public interface IEffectiveTool extends ISizedTool { Set<Material> getEffectiveMaterials(); default boolean displayBreak () { return true; } }
UTF-8
Java
300
java
IEffectiveTool.java
Java
[]
null
[]
package epicsquid.mysticallib.item.tool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import java.util.Set; public interface IEffectiveTool extends ISizedTool { Set<Material> getEffectiveMaterials(); default boolean displayBreak () { return true; } }
300
0.776667
0.776667
14
20.428572
19.100166
52
false
false
0
0
0
0
0
0
0.428571
false
false
5
aeef13f5eb778a2c9d3b734745352b928250a196
3,616,362,483,657
eda791e3bb8e9bcab9c47b7f576bbbf04b34ade9
/HospitalOSV3/src/com/hosv3/gui/panel/setup/PanelSetupServicePoint.java
13a91c6d1373fac9c63e9215223a760036ddeee3
[]
no_license
k2003/HospitalOSV3
https://github.com/k2003/HospitalOSV3
af2a04a89dc128b53afd70d174b256cc61767ff4
445701525706c4649aa4633b9aaf16d22173e824
refs/heads/master
2020-03-25T17:16:08.484000
2017-10-30T00:58:51
2017-10-30T00:58:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * PanelSetupServicePoint.java * * Created on 5 ตุลาคม 2546, 12:37 น. */ package com.hosv3.gui.panel.setup; import java.util.Vector; import com.hosv3.usecase.setup.*; import com.hosv3.control.*; import com.hosv3.subject.*; import com.hosv3.gui.dialog.*; import com.hosv3.utility.connection.*; import com.hosv3.utility.GuiLang; import com.hosv3.utility.Constant; import com.hospital_os.object.*; import com.hospital_os.utility.ComboboxModel; import com.hospital_os.utility.TaBleModel; import com.hosv3.gui.component.*; /** * * @Panel Author ojika * @Panel update tong */ public class PanelSetupServicePoint extends javax.swing.JPanel implements ManageServicePointReq,PanelSetup ,ManageOptionReq { HosControl theHC; LookupControl theLookupControl; ComboboxModel theComboboxModel; UpdateStatus theUS; SetupControl theSetupControl; SetupSubject theSetupSubject; Vector theServicePointV = new Vector(); Vector theEmployeeV = new Vector(); Vector depPanelV = new Vector(); ServicePoint theServicePoint = new ServicePoint(); PanelSetupSearchSub psep; int offset = 23; int next = 0; int prev = 0; int saved = 0; // 0 คือ ไม่สามารถ insertได้ 1 คือ insert ได้ /** pu : 29/08/2549 : เก็บ Index ของจุดบริการตัวล่างสุดของหน้าปัจจุบัน*/ int curNext = 0; /** pu : 29/08/2549 : เก็บ Index ของจุดบริการตัวล่างสุดของหน้าก่อนหน้าปัจจุบัน*/ int curPrev = 0; String[] col_TaBleModel = {"ชื่อผู้ใช้","ชื่อ-สกุล"}; String[] col = {"รหัส","ชื่อ"}; public PanelSetupServicePoint() { initComponents(); setLanguage(); } public PanelSetupServicePoint(HosControl hc,UpdateStatus us) { initComponents(); setLanguage(); setControl(hc,us); } public void setTitleLabel(String str) { jLabel4.setText(str); } /** *@Author : amp *@date : 02/02/2549 *@see : จัดการเกี่ยวกับภาษา */ private void setLanguage() { GuiLang.setLanguage(jLabel3); GuiLang.setLanguage(jLabelICD9code); GuiLang.setLanguage(jButtonSearch); GuiLang.setLanguage(jLabel1); GuiLang.setLanguage(jLabel2); GuiLang.setLanguage(jLabel4); GuiLang.setLanguage(jCheckBoxS); GuiLang.setLanguage(jButtonSave); GuiLang.setLanguage(jCheckBox1); GuiLang.setLanguage(jLabel5); GuiLang.setLanguage(jLabel6); GuiLang.setLanguage(col); GuiLang.setLanguage(col_TaBleModel); } /////////////////////Use this for decrease memory usage public void setControl(HosControl hc,UpdateStatus us) { theHC = hc; theUS = us; theLookupControl = hc.theLookupControl; theSetupControl = hc.theSetupControl; theSetupSubject = hc.theHS.theSetupSubject; hc.theHS.theSetupSubject.addpanelrefrash(this); hc.theHS.theSetupSubject.addForLiftAttach(this); setupLookup(); setEnableAll(false); } /////////////////////Use this for decrease memory usage private void initData() { theServicePoint = new ServicePoint(); } public void setupLookup() { ComboboxModel.initComboBox(jComboBoxGroup,theLookupControl.listServiceType()); ComboboxModel.initComboBox(jComboBoxSubGroup,theLookupControl.listServiceSubType()); } /** 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. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; defaultFont1 = new com.hospital_os.gui.font.DefaultFont(); fontFormatTitle1 = new com.hospital_os.gui.font.FontFormatTitle(); tableResultsModel1 = new com.hospital_os.utility.TableResultsModel(); jPanel4 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabelICD9code = new javax.swing.JLabel(); jTextFieldSCode = new javax.swing.JTextField(); jButtonSearch = new javax.swing.JButton(); jCheckBoxS = new javax.swing.JCheckBox(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new com.hosv3.gui.component.HJTableSort(); jPanel7 = new javax.swing.JPanel(); jButtonPrev = new javax.swing.JButton(); jButtonNext = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextFieldCode = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextFieldName = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jComboBoxGroup = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); jComboBoxSubGroup = new javax.swing.JComboBox(); jCheckBox1 = new javax.swing.JCheckBox(); jPanel5 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new com.hosv3.gui.component.HJTableSort(); jPanel1 = new javax.swing.JPanel(); jButtonAdd = new javax.swing.JButton(); jButtonDel = new javax.swing.JButton(); jButtonSave = new javax.swing.JButton(); jPanel6 = new javax.swing.JPanel(); jButtonAddMember = new javax.swing.JButton(); jButtonDelMenber = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); jPanel4.setLayout(new java.awt.GridBagLayout()); jLabel4.setFont(fontFormatTitle1); jLabel4.setText("\u0e08\u0e38\u0e14\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23\u0e1c\u0e39\u0e49\u0e1b\u0e48\u0e27\u0e22\u0e19\u0e2d\u0e01"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; jPanel4.add(jLabel4, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(jPanel4, gridBagConstraints); jPanel3.setLayout(new java.awt.GridBagLayout()); jPanel3.setMinimumSize(new java.awt.Dimension(300, 25)); jPanel3.setPreferredSize(new java.awt.Dimension(300, 404)); jLabelICD9code.setFont(defaultFont1); jLabelICD9code.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SEARCH")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 11); jPanel3.add(jLabelICD9code, gridBagConstraints); jTextFieldSCode.setFont(defaultFont1); jTextFieldSCode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextFieldSCodeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel3.add(jTextFieldSCode, gridBagConstraints); jButtonSearch.setFont(defaultFont1); jButtonSearch.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SEARCH")); jButtonSearch.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonSearch.setMaximumSize(new java.awt.Dimension(67, 25)); jButtonSearch.setMinimumSize(new java.awt.Dimension(67, 25)); jButtonSearch.setPreferredSize(new java.awt.Dimension(67, 25)); jButtonSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSearchActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel3.add(jButtonSearch, gridBagConstraints); jCheckBoxS.setFont(defaultFont1); jCheckBoxS.setSelected(true); jCheckBoxS.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("ACTIVE")); jCheckBoxS.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxSActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); jPanel3.add(jCheckBoxS, gridBagConstraints); jScrollPane1.setMinimumSize(new java.awt.Dimension(100, 22)); jScrollPane1.setPreferredSize(new java.awt.Dimension(100, 80)); jTable1.setModel(tableResultsModel1); jTable1.setFont(defaultFont1); jTable1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jTable1KeyReleased(evt); } }); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { jTable1MouseReleased(evt); } }); jScrollPane1.setViewportView(jTable1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jPanel3.add(jScrollPane1, gridBagConstraints); jPanel7.setLayout(new java.awt.GridBagLayout()); jButtonPrev.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hospital_os/images/Back16.gif"))); jButtonPrev.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonPrev.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonPrev.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonPrev.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPrevActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); jPanel7.add(jButtonPrev, gridBagConstraints); jButtonNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hospital_os/images/Forward16.gif"))); jButtonNext.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonNext.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonNext.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNextActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); jPanel7.add(jButtonNext, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel3.add(jPanel7, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); add(jPanel3, gridBagConstraints); jPanel2.setLayout(new java.awt.GridBagLayout()); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setMaximumSize(new java.awt.Dimension(350, 190)); jPanel2.setMinimumSize(new java.awt.Dimension(350, 135)); jPanel2.setPreferredSize(new java.awt.Dimension(350, 135)); jLabel1.setFont(defaultFont1); jLabel1.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("CODE")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel2.add(jLabel1, gridBagConstraints); jTextFieldCode.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel2.add(jTextFieldCode, gridBagConstraints); jLabel2.setFont(defaultFont1); jLabel2.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("NAME")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel2, gridBagConstraints); jTextFieldName.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jTextFieldName, gridBagConstraints); jLabel5.setFont(defaultFont1); jLabel5.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("GROUP")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel5, gridBagConstraints); jComboBoxGroup.setFont(defaultFont1); jComboBoxGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxGroupActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jComboBoxGroup, gridBagConstraints); jLabel6.setFont(defaultFont1); jLabel6.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SUB_GROUP")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel6, gridBagConstraints); jComboBoxSubGroup.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jComboBoxSubGroup, gridBagConstraints); jCheckBox1.setFont(defaultFont1); jCheckBox1.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("ACTIVE")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel2.add(jCheckBox1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel2, gridBagConstraints); jPanel5.setLayout(new java.awt.GridBagLayout()); jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel5.setMinimumSize(new java.awt.Dimension(350, 250)); jPanel5.setPreferredSize(new java.awt.Dimension(350, 250)); jLabel3.setFont(defaultFont1); jLabel3.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("CLINIC_MEMBER")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel5.add(jLabel3, gridBagConstraints); jScrollPane2.setFont(defaultFont1); jScrollPane2.setMaximumSize(new java.awt.Dimension(200, 230)); jScrollPane2.setMinimumSize(new java.awt.Dimension(200, 230)); jScrollPane2.setPreferredSize(new java.awt.Dimension(200, 230)); jTable2.setModel(tableResultsModel1); jTable2.setFont(defaultFont1); jScrollPane2.setViewportView(jTable2); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel5.add(jScrollPane2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel5, gridBagConstraints); jPanel1.setLayout(new java.awt.GridBagLayout()); jButtonAdd.setFont(defaultFont1); jButtonAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/plus16.gif"))); jButtonAdd.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonAdd.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonAdd.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonAdd.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel1.add(jButtonAdd, gridBagConstraints); jButtonDel.setFont(defaultFont1); jButtonDel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/minus16.gif"))); jButtonDel.setEnabled(false); jButtonDel.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonDel.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonDel.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonDel.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonDel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDelActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jPanel1.add(jButtonDel, gridBagConstraints); jButtonSave.setFont(defaultFont1); jButtonSave.setText("\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 "); jButtonSave.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonSave.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonSave.setPreferredSize(new java.awt.Dimension(60, 24)); jButtonSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSaveActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 1.0; jPanel1.add(jButtonSave, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel1, gridBagConstraints); jPanel6.setLayout(new java.awt.GridBagLayout()); jPanel6.setFont(defaultFont1); jButtonAddMember.setFont(defaultFont1); jButtonAddMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/plus16.gif"))); jButtonAddMember.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonAddMember.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonAddMember.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonAddMember.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonAddMember.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddMemberActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); jPanel6.add(jButtonAddMember, gridBagConstraints); jButtonDelMenber.setFont(defaultFont1); jButtonDelMenber.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/minus16.gif"))); jButtonDelMenber.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonDelMenber.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDelMenberActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jPanel6.add(jButtonDelMenber, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel6, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void jCheckBoxSActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jCheckBoxSActionPerformed {//GEN-HEADEREND:event_jCheckBoxSActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jCheckBoxSActionPerformed private void jComboBoxGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxGroupActionPerformed }//GEN-LAST:event_jComboBoxGroupActionPerformed private void jButtonAddMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddMemberActionPerformed showUserServicePoint(); jButtonDelMenber.setEnabled(true); selectServicePoint(); }//GEN-LAST:event_jButtonAddMemberActionPerformed private void jButtonDelMenberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDelMenberActionPerformed deleteMember(); }//GEN-LAST:event_jButtonDelMenberActionPerformed private void jButtonDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDelActionPerformed deleteServicePoint(); }//GEN-LAST:event_jButtonDelActionPerformed private void jTextFieldSCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldSCodeActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jTextFieldSCodeActionPerformed private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed saveServicePoint(); }//GEN-LAST:event_jButtonSaveActionPerformed private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed insertServicePoint(); }//GEN-LAST:event_jButtonAddActionPerformed private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed nextServicePoint(); }//GEN-LAST:event_jButtonNextActionPerformed private void jButtonPrevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrevActionPerformed prevServicePoint(); }//GEN-LAST:event_jButtonPrevActionPerformed private void jButtonSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jButtonSearchActionPerformed private void jTable1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseReleased selectServicePoint(); }//GEN-LAST:event_jTable1MouseReleased private void jTable1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyReleased if(evt.getKeyCode()==evt.VK_UP || evt.getKeyCode()==evt.VK_DOWN) selectServicePoint(); }//GEN-LAST:event_jTable1KeyReleased private void deleteMember() { int[] row = jTable2.getSelectedRows(); if(row.length ==0) { theUS.setStatus("กรุณาเลือกบุคคลากรที่ต้องการลบ",theUS.WARNING); return; } int ret= theSetupControl.deleteServicePointDoctor(theEmployeeV,row,theServicePoint); if(ret>=0) { theEmployeeV = theLookupControl.listEmployeeBySpid(theServicePoint.getObjectId()); setTableEmployee(theEmployeeV); } } private void nextServicePoint() { setTable(theServicePointV,1); } private void prevServicePoint() { setTable(theServicePointV,0); } private void insertServicePoint() { saved = 1; theServicePoint = new ServicePoint(); setEnableAll(true); clearAll(); theEmployeeV=null; setTableEmployee(null); } private void deleteServicePoint() { if(havePatientInServicePoint()){ theUS.setStatus(Constant.getTextBundle("มีผู้ป่วยอยู่ในจุดบริการ")+ theServicePoint.name+ Constant.getTextBundle("ไม่สามารถลบจุดบริการนี้ได้"), theUS.WARNING); return; } int ans = theSetupControl.deleteServicePoint(theServicePoint); if(ans==1) { //pu : 29/08/2549 : เก็บ Index ปัจจุบันของหน้ารายการที่กำลังบันทึก int count = next - prev; this.curNext = next - count; this.curPrev = prev - offset; clearAll(); searchServicePoint(); theEmployeeV=null; setTableEmployee(null); refreshDepPanel(); } } private boolean havePatientInServicePoint() { boolean have = false; Vector vc = null; if(this.theServicePoint != null) { vc = this.theLookupControl.listVisitQueueTransfer(theServicePoint.getObjectId(), "", ""); if(vc != null && vc.size() != 0) have = true; } return have; } private void clearAll() { jTextFieldCode.setText(""); jTextFieldName.setText(""); jTextFieldCode.requestFocus(); jCheckBox1.setSelected(true); } private void setEnableAll(boolean var) { jTextFieldCode.setEditable(var); jTextFieldName.setEditable(var); jButtonSave.setEnabled(var); jCheckBox1.setEnabled(var); jButtonAddMember.setEnabled(var); jButtonDel.setEnabled(var); } private void selectServicePoint() { setEnableAll(true); int row = jTable1.getSelectedRow(); theServicePoint = (ServicePoint)theServicePointV.get(row+prev); jTextFieldCode.setText(theServicePoint.service_point_id); jTextFieldName.setText(theServicePoint.name); ComboboxModel.setCodeComboBox(jComboBoxGroup, theServicePoint.service_type_id); ComboboxModel.setCodeComboBox(jComboBoxSubGroup, theServicePoint.service_sub_type_id); if(theServicePoint.active.equals("1")) jCheckBox1.setSelected(true); else jCheckBox1.setSelected(false); if(theServicePoint.service_type_id.equals("3")) { searchServicePointDoctor(theServicePoint.getObjectId()); } else { jButtonAddMember.setEnabled(false); theEmployeeV=null; setTableEmployee(null); } } private void searchServicePointDoctor(String pk) { jButtonAddMember.setEnabled(true); theEmployeeV = theLookupControl.listEmployeeBySpid(theServicePoint.getObjectId()); setTableEmployee(theEmployeeV); } private void searchServicePoint() { //pu : 29/08/2549 : กำหนดค่า Index ให้กับหน้าที่ต้องการแสดงรายการ next = this.curNext; prev = this.curPrev; String search = jTextFieldSCode.getText(); String active = "0"; if(jCheckBoxS.isSelected()) active = "1"; theServicePointV = theSetupControl.listServicePointByName(search, active); setTable(theServicePointV,1); } private void setTable(Vector voffice,int off) { ServicePoint of = new ServicePoint(); int count = offset; int p =0; int n =0; int c =0; if(voffice != null && voffice.size() != 0) { if(off == 1) { p = prev; n = next; prev = next; next = next + offset; if(next >= theServicePointV.size()) { next = theServicePointV.size(); count = next - prev; } if(count == 0) { prev = p; next = n; count = n - p; } } else { next = prev; prev = prev - offset; if(prev <=0) { prev = 0; next = offset; } if(next >= theServicePointV.size()) { next= theServicePointV.size(); count = next; } } TaBleModel tm = new TaBleModel(col,count); for(int i=0 ;i<count;i++) { of = (ServicePoint)voffice.get(i+prev); tm.setValueAt(of.service_point_id,i,0); tm.setValueAt(of.name,i,1); } jTable1.setModel(tm); } else { TaBleModel tm = new TaBleModel(col,0); jTable1.setModel(tm); } setTableListDefault(); } private void setTableListDefault() { jTable1.getColumnModel().getColumn(0).setPreferredWidth(60); // ชื่อสามัญสำหรับ รพ.ทั่วไป, ชื่อการค้า สำหรับศูนย์โรคตา jTable1.getColumnModel().getColumn(1).setPreferredWidth(300); // จำนวน } private void saveServicePoint() { theServicePoint.service_point_id = jTextFieldCode.getText(); theServicePoint.name = jTextFieldName.getText(); theServicePoint.service_type_id = ComboboxModel.getCodeComboBox(jComboBoxGroup); theServicePoint.service_sub_type_id = ComboboxModel.getCodeComboBox(jComboBoxSubGroup); if(jCheckBox1.isSelected()) theServicePoint.active = "1"; else theServicePoint.active = "0"; int ans = theSetupControl.saveServicePoint(theServicePoint,theEmployeeV); if(ans>=0) { //pu : 29/08/2549 : เก็บ Index ปัจจุบันของหน้ารายการที่กำลังบันทึก int count = next - prev; this.curNext = next - count; this.curPrev = prev - offset; searchServicePoint(); refreshDepPanel(); } } private void showUserServicePoint() { theSetupSubject.delEmployeeInService(this); if(psep==null) { psep = new PanelSetupSearchSub(theHC,theUS,1); psep.setTitle(Constant.getTextBundle("กำหนด แพทย์ ให้อยู่ในห้องตรวจ")); } psep.setServicePoint(theServicePoint); if(psep.showSearch()) psep = null; } private void setTableEmployee(Vector vc) { TaBleModel tm; Employee of = new Employee(); if(vc != null) { tm = new TaBleModel(col_TaBleModel,vc.size()); for(int i=0 ;i<vc.size();i++) { of = (Employee)vc.get(i); tm.setValueAt(of.employee_id,i,0); tm.setValueAt(of.fname + " " + of.lname ,i,1); } } else { tm = new TaBleModel(col_TaBleModel,0); } jTable2.setModel(tm); jTable2.getColumnModel().getColumn(0).setPreferredWidth(60); // ชื่อสามัญสำหรับ รพ.ทั่วไป, ชื่อการค้า สำหรับศูนย์โรคตา jTable2.getColumnModel().getColumn(1).setPreferredWidth(200); // จำนวน } public void notifyreFrashPanel() { setupLookup(); } public void notifysetEnableForLift(boolean b) { jButtonDel.setVisible(b); } public void addEmployeeInServicePoint(Employee employee) { } public int deleteServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int deleteServicePointDoctor(String servicePointDoctor) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int deleteServicePointDoctorBySPoint(String theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int editServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public ServicePoint listServicePointByCode(String code) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public Vector listServicePointByName(String pk, String active) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public ServicePoint listServicePointByPk(String pk) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public Vector listServicePointDoctor(String pk) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public ServicePointDoctor listServicePointDoctorByEmPoint(String emid, String pointid) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public int saveServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int saveServicePointDoctor(ServicePointDoctor servicepointdoctor) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int editOption(Option option) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public Vector listOptionAll() { Constant.println("PanelSetupServicePoint function is not use."); return null; } public void reFrashPanel() { } public Option readOption() { Constant.println("PanelSetupServicePoint function is not use."); return null; } public int saveOption(Option option) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public void setEnableForLift(boolean b) { } public void notifyaddEmployeeInServicePoint(Employee employee) { } /** *เพิ่ม panel ที่เกิดผลกระทบเมื่อมีการเปลี่ยนแปลงข้อมูลใน panel นี้ *ฟังก์ชันถูกเรียกในคลาส HosPanelSetup *@author aut *@param panel ลูก ที่ imp interface ManageOptionReq */ public void addDepPanel(ManageOptionReq panel) { if(panel!=null) depPanelV.add(panel); } public void refreshDepPanel() { for(int i=0;i<depPanelV.size();i++) { ((ManageOptionReq)depPanelV.get(i)).notifyreFrashPanel(); } } // Variables declaration - do not modify//GEN-BEGIN:variables private com.hospital_os.gui.font.DefaultFont defaultFont1; private com.hospital_os.gui.font.FontFormatTitle fontFormatTitle1; private javax.swing.JButton jButtonAdd; private javax.swing.JButton jButtonAddMember; private javax.swing.JButton jButtonDel; private javax.swing.JButton jButtonDelMenber; private javax.swing.JButton jButtonNext; private javax.swing.JButton jButtonPrev; private javax.swing.JButton jButtonSave; private javax.swing.JButton jButtonSearch; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBoxS; private javax.swing.JComboBox jComboBoxGroup; private javax.swing.JComboBox jComboBoxSubGroup; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabelICD9code; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private com.hosv3.gui.component.HJTableSort jTable1; private com.hosv3.gui.component.HJTableSort jTable2; private javax.swing.JTextField jTextFieldCode; private javax.swing.JTextField jTextFieldName; private javax.swing.JTextField jTextFieldSCode; private com.hospital_os.utility.TableResultsModel tableResultsModel1; // End of variables declaration//GEN-END:variables }
TIS-620
Java
44,020
java
PanelSetupServicePoint.java
Java
[ { "context": "om.hosv3.gui.component.*;\n\n/**\n *\n * @Panel Author ojika \n * @Panel update tong\n */\npublic class PanelSetu", "end": 555, "score": 0.9995768070220947, "start": 550, "tag": "USERNAME", "value": "ojika" }, { "context": "Label4.setText(str);\n }\n /**\n *@Author : amp\n *@date : 02/02/2549\n *@see : จัดการเกี่ย", "end": 1884, "score": 0.9984933137893677, "start": 1881, "tag": "USERNAME", "value": "amp" }, { "context": "ฟังก์ชันถูกเรียกในคลาส HosPanelSetup\n *@author aut\n *@param panel ลูก ที่ imp interface ManageOp", "end": 40398, "score": 0.7299345135688782, "start": 40395, "tag": "NAME", "value": "aut" } ]
null
[]
/* * PanelSetupServicePoint.java * * Created on 5 ตุลาคม 2546, 12:37 น. */ package com.hosv3.gui.panel.setup; import java.util.Vector; import com.hosv3.usecase.setup.*; import com.hosv3.control.*; import com.hosv3.subject.*; import com.hosv3.gui.dialog.*; import com.hosv3.utility.connection.*; import com.hosv3.utility.GuiLang; import com.hosv3.utility.Constant; import com.hospital_os.object.*; import com.hospital_os.utility.ComboboxModel; import com.hospital_os.utility.TaBleModel; import com.hosv3.gui.component.*; /** * * @Panel Author ojika * @Panel update tong */ public class PanelSetupServicePoint extends javax.swing.JPanel implements ManageServicePointReq,PanelSetup ,ManageOptionReq { HosControl theHC; LookupControl theLookupControl; ComboboxModel theComboboxModel; UpdateStatus theUS; SetupControl theSetupControl; SetupSubject theSetupSubject; Vector theServicePointV = new Vector(); Vector theEmployeeV = new Vector(); Vector depPanelV = new Vector(); ServicePoint theServicePoint = new ServicePoint(); PanelSetupSearchSub psep; int offset = 23; int next = 0; int prev = 0; int saved = 0; // 0 คือ ไม่สามารถ insertได้ 1 คือ insert ได้ /** pu : 29/08/2549 : เก็บ Index ของจุดบริการตัวล่างสุดของหน้าปัจจุบัน*/ int curNext = 0; /** pu : 29/08/2549 : เก็บ Index ของจุดบริการตัวล่างสุดของหน้าก่อนหน้าปัจจุบัน*/ int curPrev = 0; String[] col_TaBleModel = {"ชื่อผู้ใช้","ชื่อ-สกุล"}; String[] col = {"รหัส","ชื่อ"}; public PanelSetupServicePoint() { initComponents(); setLanguage(); } public PanelSetupServicePoint(HosControl hc,UpdateStatus us) { initComponents(); setLanguage(); setControl(hc,us); } public void setTitleLabel(String str) { jLabel4.setText(str); } /** *@Author : amp *@date : 02/02/2549 *@see : จัดการเกี่ยวกับภาษา */ private void setLanguage() { GuiLang.setLanguage(jLabel3); GuiLang.setLanguage(jLabelICD9code); GuiLang.setLanguage(jButtonSearch); GuiLang.setLanguage(jLabel1); GuiLang.setLanguage(jLabel2); GuiLang.setLanguage(jLabel4); GuiLang.setLanguage(jCheckBoxS); GuiLang.setLanguage(jButtonSave); GuiLang.setLanguage(jCheckBox1); GuiLang.setLanguage(jLabel5); GuiLang.setLanguage(jLabel6); GuiLang.setLanguage(col); GuiLang.setLanguage(col_TaBleModel); } /////////////////////Use this for decrease memory usage public void setControl(HosControl hc,UpdateStatus us) { theHC = hc; theUS = us; theLookupControl = hc.theLookupControl; theSetupControl = hc.theSetupControl; theSetupSubject = hc.theHS.theSetupSubject; hc.theHS.theSetupSubject.addpanelrefrash(this); hc.theHS.theSetupSubject.addForLiftAttach(this); setupLookup(); setEnableAll(false); } /////////////////////Use this for decrease memory usage private void initData() { theServicePoint = new ServicePoint(); } public void setupLookup() { ComboboxModel.initComboBox(jComboBoxGroup,theLookupControl.listServiceType()); ComboboxModel.initComboBox(jComboBoxSubGroup,theLookupControl.listServiceSubType()); } /** 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. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; defaultFont1 = new com.hospital_os.gui.font.DefaultFont(); fontFormatTitle1 = new com.hospital_os.gui.font.FontFormatTitle(); tableResultsModel1 = new com.hospital_os.utility.TableResultsModel(); jPanel4 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabelICD9code = new javax.swing.JLabel(); jTextFieldSCode = new javax.swing.JTextField(); jButtonSearch = new javax.swing.JButton(); jCheckBoxS = new javax.swing.JCheckBox(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new com.hosv3.gui.component.HJTableSort(); jPanel7 = new javax.swing.JPanel(); jButtonPrev = new javax.swing.JButton(); jButtonNext = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextFieldCode = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextFieldName = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jComboBoxGroup = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); jComboBoxSubGroup = new javax.swing.JComboBox(); jCheckBox1 = new javax.swing.JCheckBox(); jPanel5 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new com.hosv3.gui.component.HJTableSort(); jPanel1 = new javax.swing.JPanel(); jButtonAdd = new javax.swing.JButton(); jButtonDel = new javax.swing.JButton(); jButtonSave = new javax.swing.JButton(); jPanel6 = new javax.swing.JPanel(); jButtonAddMember = new javax.swing.JButton(); jButtonDelMenber = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); jPanel4.setLayout(new java.awt.GridBagLayout()); jLabel4.setFont(fontFormatTitle1); jLabel4.setText("\u0e08\u0e38\u0e14\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23\u0e1c\u0e39\u0e49\u0e1b\u0e48\u0e27\u0e22\u0e19\u0e2d\u0e01"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; jPanel4.add(jLabel4, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(jPanel4, gridBagConstraints); jPanel3.setLayout(new java.awt.GridBagLayout()); jPanel3.setMinimumSize(new java.awt.Dimension(300, 25)); jPanel3.setPreferredSize(new java.awt.Dimension(300, 404)); jLabelICD9code.setFont(defaultFont1); jLabelICD9code.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SEARCH")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 11); jPanel3.add(jLabelICD9code, gridBagConstraints); jTextFieldSCode.setFont(defaultFont1); jTextFieldSCode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextFieldSCodeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel3.add(jTextFieldSCode, gridBagConstraints); jButtonSearch.setFont(defaultFont1); jButtonSearch.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SEARCH")); jButtonSearch.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonSearch.setMaximumSize(new java.awt.Dimension(67, 25)); jButtonSearch.setMinimumSize(new java.awt.Dimension(67, 25)); jButtonSearch.setPreferredSize(new java.awt.Dimension(67, 25)); jButtonSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSearchActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel3.add(jButtonSearch, gridBagConstraints); jCheckBoxS.setFont(defaultFont1); jCheckBoxS.setSelected(true); jCheckBoxS.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("ACTIVE")); jCheckBoxS.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxSActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); jPanel3.add(jCheckBoxS, gridBagConstraints); jScrollPane1.setMinimumSize(new java.awt.Dimension(100, 22)); jScrollPane1.setPreferredSize(new java.awt.Dimension(100, 80)); jTable1.setModel(tableResultsModel1); jTable1.setFont(defaultFont1); jTable1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jTable1KeyReleased(evt); } }); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { jTable1MouseReleased(evt); } }); jScrollPane1.setViewportView(jTable1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jPanel3.add(jScrollPane1, gridBagConstraints); jPanel7.setLayout(new java.awt.GridBagLayout()); jButtonPrev.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hospital_os/images/Back16.gif"))); jButtonPrev.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonPrev.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonPrev.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonPrev.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPrevActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); jPanel7.add(jButtonPrev, gridBagConstraints); jButtonNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hospital_os/images/Forward16.gif"))); jButtonNext.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonNext.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonNext.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNextActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); jPanel7.add(jButtonNext, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel3.add(jPanel7, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); add(jPanel3, gridBagConstraints); jPanel2.setLayout(new java.awt.GridBagLayout()); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setMaximumSize(new java.awt.Dimension(350, 190)); jPanel2.setMinimumSize(new java.awt.Dimension(350, 135)); jPanel2.setPreferredSize(new java.awt.Dimension(350, 135)); jLabel1.setFont(defaultFont1); jLabel1.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("CODE")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel2.add(jLabel1, gridBagConstraints); jTextFieldCode.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel2.add(jTextFieldCode, gridBagConstraints); jLabel2.setFont(defaultFont1); jLabel2.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("NAME")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel2, gridBagConstraints); jTextFieldName.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jTextFieldName, gridBagConstraints); jLabel5.setFont(defaultFont1); jLabel5.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("GROUP")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel5, gridBagConstraints); jComboBoxGroup.setFont(defaultFont1); jComboBoxGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxGroupActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jComboBoxGroup, gridBagConstraints); jLabel6.setFont(defaultFont1); jLabel6.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("SUB_GROUP")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jLabel6, gridBagConstraints); jComboBoxSubGroup.setFont(defaultFont1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 5); jPanel2.add(jComboBoxSubGroup, gridBagConstraints); jCheckBox1.setFont(defaultFont1); jCheckBox1.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("ACTIVE")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 5); jPanel2.add(jCheckBox1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel2, gridBagConstraints); jPanel5.setLayout(new java.awt.GridBagLayout()); jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel5.setMinimumSize(new java.awt.Dimension(350, 250)); jPanel5.setPreferredSize(new java.awt.Dimension(350, 250)); jLabel3.setFont(defaultFont1); jLabel3.setText(java.util.ResourceBundle.getBundle("com/hosv3/property/thai").getString("CLINIC_MEMBER")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); jPanel5.add(jLabel3, gridBagConstraints); jScrollPane2.setFont(defaultFont1); jScrollPane2.setMaximumSize(new java.awt.Dimension(200, 230)); jScrollPane2.setMinimumSize(new java.awt.Dimension(200, 230)); jScrollPane2.setPreferredSize(new java.awt.Dimension(200, 230)); jTable2.setModel(tableResultsModel1); jTable2.setFont(defaultFont1); jScrollPane2.setViewportView(jTable2); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel5.add(jScrollPane2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel5, gridBagConstraints); jPanel1.setLayout(new java.awt.GridBagLayout()); jButtonAdd.setFont(defaultFont1); jButtonAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/plus16.gif"))); jButtonAdd.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonAdd.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonAdd.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonAdd.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel1.add(jButtonAdd, gridBagConstraints); jButtonDel.setFont(defaultFont1); jButtonDel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/minus16.gif"))); jButtonDel.setEnabled(false); jButtonDel.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonDel.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonDel.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonDel.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonDel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDelActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jPanel1.add(jButtonDel, gridBagConstraints); jButtonSave.setFont(defaultFont1); jButtonSave.setText("\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 "); jButtonSave.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonSave.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonSave.setPreferredSize(new java.awt.Dimension(60, 24)); jButtonSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSaveActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 1.0; jPanel1.add(jButtonSave, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel1, gridBagConstraints); jPanel6.setLayout(new java.awt.GridBagLayout()); jPanel6.setFont(defaultFont1); jButtonAddMember.setFont(defaultFont1); jButtonAddMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/plus16.gif"))); jButtonAddMember.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonAddMember.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonAddMember.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonAddMember.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonAddMember.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddMemberActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); jPanel6.add(jButtonAddMember, gridBagConstraints); jButtonDelMenber.setFont(defaultFont1); jButtonDelMenber.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hosv3/gui/images/minus16.gif"))); jButtonDelMenber.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonDelMenber.setMaximumSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.setMinimumSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.setPreferredSize(new java.awt.Dimension(24, 24)); jButtonDelMenber.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDelMenberActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jPanel6.add(jButtonDelMenber, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(jPanel6, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void jCheckBoxSActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jCheckBoxSActionPerformed {//GEN-HEADEREND:event_jCheckBoxSActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jCheckBoxSActionPerformed private void jComboBoxGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxGroupActionPerformed }//GEN-LAST:event_jComboBoxGroupActionPerformed private void jButtonAddMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddMemberActionPerformed showUserServicePoint(); jButtonDelMenber.setEnabled(true); selectServicePoint(); }//GEN-LAST:event_jButtonAddMemberActionPerformed private void jButtonDelMenberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDelMenberActionPerformed deleteMember(); }//GEN-LAST:event_jButtonDelMenberActionPerformed private void jButtonDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDelActionPerformed deleteServicePoint(); }//GEN-LAST:event_jButtonDelActionPerformed private void jTextFieldSCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldSCodeActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jTextFieldSCodeActionPerformed private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed saveServicePoint(); }//GEN-LAST:event_jButtonSaveActionPerformed private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed insertServicePoint(); }//GEN-LAST:event_jButtonAddActionPerformed private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed nextServicePoint(); }//GEN-LAST:event_jButtonNextActionPerformed private void jButtonPrevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrevActionPerformed prevServicePoint(); }//GEN-LAST:event_jButtonPrevActionPerformed private void jButtonSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchActionPerformed //pu : 29/08/2549 : กำหนดค่าให้กับ Index สำหรับระบุถึงหน้าปัจจุบันของรายการ this.curNext = 0; this.curPrev = 0; searchServicePoint(); }//GEN-LAST:event_jButtonSearchActionPerformed private void jTable1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseReleased selectServicePoint(); }//GEN-LAST:event_jTable1MouseReleased private void jTable1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyReleased if(evt.getKeyCode()==evt.VK_UP || evt.getKeyCode()==evt.VK_DOWN) selectServicePoint(); }//GEN-LAST:event_jTable1KeyReleased private void deleteMember() { int[] row = jTable2.getSelectedRows(); if(row.length ==0) { theUS.setStatus("กรุณาเลือกบุคคลากรที่ต้องการลบ",theUS.WARNING); return; } int ret= theSetupControl.deleteServicePointDoctor(theEmployeeV,row,theServicePoint); if(ret>=0) { theEmployeeV = theLookupControl.listEmployeeBySpid(theServicePoint.getObjectId()); setTableEmployee(theEmployeeV); } } private void nextServicePoint() { setTable(theServicePointV,1); } private void prevServicePoint() { setTable(theServicePointV,0); } private void insertServicePoint() { saved = 1; theServicePoint = new ServicePoint(); setEnableAll(true); clearAll(); theEmployeeV=null; setTableEmployee(null); } private void deleteServicePoint() { if(havePatientInServicePoint()){ theUS.setStatus(Constant.getTextBundle("มีผู้ป่วยอยู่ในจุดบริการ")+ theServicePoint.name+ Constant.getTextBundle("ไม่สามารถลบจุดบริการนี้ได้"), theUS.WARNING); return; } int ans = theSetupControl.deleteServicePoint(theServicePoint); if(ans==1) { //pu : 29/08/2549 : เก็บ Index ปัจจุบันของหน้ารายการที่กำลังบันทึก int count = next - prev; this.curNext = next - count; this.curPrev = prev - offset; clearAll(); searchServicePoint(); theEmployeeV=null; setTableEmployee(null); refreshDepPanel(); } } private boolean havePatientInServicePoint() { boolean have = false; Vector vc = null; if(this.theServicePoint != null) { vc = this.theLookupControl.listVisitQueueTransfer(theServicePoint.getObjectId(), "", ""); if(vc != null && vc.size() != 0) have = true; } return have; } private void clearAll() { jTextFieldCode.setText(""); jTextFieldName.setText(""); jTextFieldCode.requestFocus(); jCheckBox1.setSelected(true); } private void setEnableAll(boolean var) { jTextFieldCode.setEditable(var); jTextFieldName.setEditable(var); jButtonSave.setEnabled(var); jCheckBox1.setEnabled(var); jButtonAddMember.setEnabled(var); jButtonDel.setEnabled(var); } private void selectServicePoint() { setEnableAll(true); int row = jTable1.getSelectedRow(); theServicePoint = (ServicePoint)theServicePointV.get(row+prev); jTextFieldCode.setText(theServicePoint.service_point_id); jTextFieldName.setText(theServicePoint.name); ComboboxModel.setCodeComboBox(jComboBoxGroup, theServicePoint.service_type_id); ComboboxModel.setCodeComboBox(jComboBoxSubGroup, theServicePoint.service_sub_type_id); if(theServicePoint.active.equals("1")) jCheckBox1.setSelected(true); else jCheckBox1.setSelected(false); if(theServicePoint.service_type_id.equals("3")) { searchServicePointDoctor(theServicePoint.getObjectId()); } else { jButtonAddMember.setEnabled(false); theEmployeeV=null; setTableEmployee(null); } } private void searchServicePointDoctor(String pk) { jButtonAddMember.setEnabled(true); theEmployeeV = theLookupControl.listEmployeeBySpid(theServicePoint.getObjectId()); setTableEmployee(theEmployeeV); } private void searchServicePoint() { //pu : 29/08/2549 : กำหนดค่า Index ให้กับหน้าที่ต้องการแสดงรายการ next = this.curNext; prev = this.curPrev; String search = jTextFieldSCode.getText(); String active = "0"; if(jCheckBoxS.isSelected()) active = "1"; theServicePointV = theSetupControl.listServicePointByName(search, active); setTable(theServicePointV,1); } private void setTable(Vector voffice,int off) { ServicePoint of = new ServicePoint(); int count = offset; int p =0; int n =0; int c =0; if(voffice != null && voffice.size() != 0) { if(off == 1) { p = prev; n = next; prev = next; next = next + offset; if(next >= theServicePointV.size()) { next = theServicePointV.size(); count = next - prev; } if(count == 0) { prev = p; next = n; count = n - p; } } else { next = prev; prev = prev - offset; if(prev <=0) { prev = 0; next = offset; } if(next >= theServicePointV.size()) { next= theServicePointV.size(); count = next; } } TaBleModel tm = new TaBleModel(col,count); for(int i=0 ;i<count;i++) { of = (ServicePoint)voffice.get(i+prev); tm.setValueAt(of.service_point_id,i,0); tm.setValueAt(of.name,i,1); } jTable1.setModel(tm); } else { TaBleModel tm = new TaBleModel(col,0); jTable1.setModel(tm); } setTableListDefault(); } private void setTableListDefault() { jTable1.getColumnModel().getColumn(0).setPreferredWidth(60); // ชื่อสามัญสำหรับ รพ.ทั่วไป, ชื่อการค้า สำหรับศูนย์โรคตา jTable1.getColumnModel().getColumn(1).setPreferredWidth(300); // จำนวน } private void saveServicePoint() { theServicePoint.service_point_id = jTextFieldCode.getText(); theServicePoint.name = jTextFieldName.getText(); theServicePoint.service_type_id = ComboboxModel.getCodeComboBox(jComboBoxGroup); theServicePoint.service_sub_type_id = ComboboxModel.getCodeComboBox(jComboBoxSubGroup); if(jCheckBox1.isSelected()) theServicePoint.active = "1"; else theServicePoint.active = "0"; int ans = theSetupControl.saveServicePoint(theServicePoint,theEmployeeV); if(ans>=0) { //pu : 29/08/2549 : เก็บ Index ปัจจุบันของหน้ารายการที่กำลังบันทึก int count = next - prev; this.curNext = next - count; this.curPrev = prev - offset; searchServicePoint(); refreshDepPanel(); } } private void showUserServicePoint() { theSetupSubject.delEmployeeInService(this); if(psep==null) { psep = new PanelSetupSearchSub(theHC,theUS,1); psep.setTitle(Constant.getTextBundle("กำหนด แพทย์ ให้อยู่ในห้องตรวจ")); } psep.setServicePoint(theServicePoint); if(psep.showSearch()) psep = null; } private void setTableEmployee(Vector vc) { TaBleModel tm; Employee of = new Employee(); if(vc != null) { tm = new TaBleModel(col_TaBleModel,vc.size()); for(int i=0 ;i<vc.size();i++) { of = (Employee)vc.get(i); tm.setValueAt(of.employee_id,i,0); tm.setValueAt(of.fname + " " + of.lname ,i,1); } } else { tm = new TaBleModel(col_TaBleModel,0); } jTable2.setModel(tm); jTable2.getColumnModel().getColumn(0).setPreferredWidth(60); // ชื่อสามัญสำหรับ รพ.ทั่วไป, ชื่อการค้า สำหรับศูนย์โรคตา jTable2.getColumnModel().getColumn(1).setPreferredWidth(200); // จำนวน } public void notifyreFrashPanel() { setupLookup(); } public void notifysetEnableForLift(boolean b) { jButtonDel.setVisible(b); } public void addEmployeeInServicePoint(Employee employee) { } public int deleteServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int deleteServicePointDoctor(String servicePointDoctor) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int deleteServicePointDoctorBySPoint(String theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int editServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public ServicePoint listServicePointByCode(String code) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public Vector listServicePointByName(String pk, String active) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public ServicePoint listServicePointByPk(String pk) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public Vector listServicePointDoctor(String pk) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public ServicePointDoctor listServicePointDoctorByEmPoint(String emid, String pointid) { Constant.println("PanelSetupServicePoint function is not use."); return null; } public int saveServicePoint(ServicePoint theServicePointV) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int saveServicePointDoctor(ServicePointDoctor servicepointdoctor) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public int editOption(Option option) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public Vector listOptionAll() { Constant.println("PanelSetupServicePoint function is not use."); return null; } public void reFrashPanel() { } public Option readOption() { Constant.println("PanelSetupServicePoint function is not use."); return null; } public int saveOption(Option option) { Constant.println("PanelSetupServicePoint function is not use."); return -1; } public void setEnableForLift(boolean b) { } public void notifyaddEmployeeInServicePoint(Employee employee) { } /** *เพิ่ม panel ที่เกิดผลกระทบเมื่อมีการเปลี่ยนแปลงข้อมูลใน panel นี้ *ฟังก์ชันถูกเรียกในคลาส HosPanelSetup *@author aut *@param panel ลูก ที่ imp interface ManageOptionReq */ public void addDepPanel(ManageOptionReq panel) { if(panel!=null) depPanelV.add(panel); } public void refreshDepPanel() { for(int i=0;i<depPanelV.size();i++) { ((ManageOptionReq)depPanelV.get(i)).notifyreFrashPanel(); } } // Variables declaration - do not modify//GEN-BEGIN:variables private com.hospital_os.gui.font.DefaultFont defaultFont1; private com.hospital_os.gui.font.FontFormatTitle fontFormatTitle1; private javax.swing.JButton jButtonAdd; private javax.swing.JButton jButtonAddMember; private javax.swing.JButton jButtonDel; private javax.swing.JButton jButtonDelMenber; private javax.swing.JButton jButtonNext; private javax.swing.JButton jButtonPrev; private javax.swing.JButton jButtonSave; private javax.swing.JButton jButtonSearch; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBoxS; private javax.swing.JComboBox jComboBoxGroup; private javax.swing.JComboBox jComboBoxSubGroup; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabelICD9code; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private com.hosv3.gui.component.HJTableSort jTable1; private com.hosv3.gui.component.HJTableSort jTable2; private javax.swing.JTextField jTextFieldCode; private javax.swing.JTextField jTextFieldName; private javax.swing.JTextField jTextFieldSCode; private com.hospital_os.utility.TableResultsModel tableResultsModel1; // End of variables declaration//GEN-END:variables }
44,020
0.661837
0.642535
1,016
40.915356
27.647505
142
false
false
0
0
114
0.003522
0
0
0.825787
false
false
5
71e0e5dcd9eeea655a652d89db5d6e5572a8fbe7
9,869,834,859,808
74faeac98535875766afbf44acce8a0ed7964366
/extra/src/main/java/test/algoritm/Line.java
37b025f9f98df24c44ce3eb9a954bfc9c8628865
[]
no_license
Sekator778/job4j
https://github.com/Sekator778/job4j
12f89ab05405baa8220b6595cc397faa87e9b02f
c3016be85b8a975a634570f75ba7acd9172c996b
refs/heads/master
2022-05-11T14:30:00.137000
2022-04-07T18:11:50
2022-04-07T18:11:50
240,452,078
3
2
null
false
2020-10-13T19:32:35
2020-02-14T07:29:14
2020-07-08T13:10:02
2020-10-13T19:32:34
10,719
0
0
1
Java
false
false
package test.algoritm; import java.util.Arrays; public class Line { /** * Для получения позиции искомого элемента перебирается набор из N элементов. * В худшем сценарии для этого алгоритма искомый элемент оказывается последним в массиве. * * В этом случае потребуется N итераций для нахождения элемента. * * Следовательно, временная сложность линейного поиска равна O(N). * * @param arr - масив для поиска * @param elementToSearch - искомый елемент * @return - -1 если не нашли все остальное нашли */ public static int linSearch(int[] arr, int elementToSearch) { for (int i : arr ) { if (i == elementToSearch) { return i; } } return -1; } /** * Временная сложность алгоритма двоичного поиска * равна O(log (N)) из-за деления массива пополам. * Она превосходит O(N) линейного алгоритма. * НО !!! но массив должен быть отсортирован * * @param arr - масив для поиска * @param elementToSearch - искомый елемент * @return - -1 если не нашли все остальное нашли */ public static int binarySearch(int[] arr, int elementToSearch) { Arrays.sort(arr); int firstElement = 0; int lastElement = arr.length - 1; while (firstElement <= lastElement) { int middleIndex = (firstElement + lastElement) / 2; if (arr[middleIndex] == elementToSearch) { return middleIndex; } else if (arr[middleIndex] < elementToSearch) { firstElement = middleIndex + 1; } else if (arr[middleIndex] > elementToSearch) { lastElement = middleIndex - 1; } } return -1; } public static int[] compilePatternArray(String pattern) { int patternLength = pattern.length(); int len = 0; int i = 1; int[] compilePatternArray = new int[patternLength]; compilePatternArray[0] = 0; while (i < patternLength) { if (pattern.charAt(i) == pattern.charAt(len)) { len++; compilePatternArray[i] = len; i++; } } return null; } public static void main(String[] args) { // System.out.println(linSearch(new int[]{ // 1, 2, 9, 4, 5 // }, 5)); System.out.println(binarySearch(new int[]{ 1, 2, 9, 4, 5 }, 0)); int middleElement = 1 + (10 - 1) / 2; int middleIndex = (1 + 10) / 2; System.out.println(middleElement); System.out.println(middleIndex); } }
UTF-8
Java
3,184
java
Line.java
Java
[]
null
[]
package test.algoritm; import java.util.Arrays; public class Line { /** * Для получения позиции искомого элемента перебирается набор из N элементов. * В худшем сценарии для этого алгоритма искомый элемент оказывается последним в массиве. * * В этом случае потребуется N итераций для нахождения элемента. * * Следовательно, временная сложность линейного поиска равна O(N). * * @param arr - масив для поиска * @param elementToSearch - искомый елемент * @return - -1 если не нашли все остальное нашли */ public static int linSearch(int[] arr, int elementToSearch) { for (int i : arr ) { if (i == elementToSearch) { return i; } } return -1; } /** * Временная сложность алгоритма двоичного поиска * равна O(log (N)) из-за деления массива пополам. * Она превосходит O(N) линейного алгоритма. * НО !!! но массив должен быть отсортирован * * @param arr - масив для поиска * @param elementToSearch - искомый елемент * @return - -1 если не нашли все остальное нашли */ public static int binarySearch(int[] arr, int elementToSearch) { Arrays.sort(arr); int firstElement = 0; int lastElement = arr.length - 1; while (firstElement <= lastElement) { int middleIndex = (firstElement + lastElement) / 2; if (arr[middleIndex] == elementToSearch) { return middleIndex; } else if (arr[middleIndex] < elementToSearch) { firstElement = middleIndex + 1; } else if (arr[middleIndex] > elementToSearch) { lastElement = middleIndex - 1; } } return -1; } public static int[] compilePatternArray(String pattern) { int patternLength = pattern.length(); int len = 0; int i = 1; int[] compilePatternArray = new int[patternLength]; compilePatternArray[0] = 0; while (i < patternLength) { if (pattern.charAt(i) == pattern.charAt(len)) { len++; compilePatternArray[i] = len; i++; } } return null; } public static void main(String[] args) { // System.out.println(linSearch(new int[]{ // 1, 2, 9, 4, 5 // }, 5)); System.out.println(binarySearch(new int[]{ 1, 2, 9, 4, 5 }, 0)); int middleElement = 1 + (10 - 1) / 2; int middleIndex = (1 + 10) / 2; System.out.println(middleElement); System.out.println(middleIndex); } }
3,184
0.553949
0.541342
93
28
23.139595
93
false
false
0
0
0
0
0
0
0.430108
false
false
5
d7b387cb52f24e2af61d7130a7b55ffacff82a53
24,721,831,770,951
908a695ac73b3a33c46c8b4a64bc874b81e4d979
/src/main/java/com/daffodilsw/core/data/jpa/embed/ConnectionId.java
439c0f79fd9c8600f72414fb43880c12d4313fea
[]
no_license
deepakkumarrai/spring_security_example
https://github.com/deepakkumarrai/spring_security_example
119304f1bcc80e4a7b102761101d18237fb0fb22
f70b71112c7f5ab723f2521f4acd1e8f3cdbe488
refs/heads/master
2021-01-20T05:58:47.836000
2015-04-23T04:35:27
2015-04-23T04:35:27
34,433,041
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.daffodilsw.core.data.jpa.embed; import javax.persistence.Column; import javax.persistence.Embeddable; import java.io.Serializable; /** * Created by user on 16/4/15. */ @Embeddable public class ConnectionId implements Serializable { @Column(name = "`FIRST_ID`", nullable = false) private String first; @Column(name = "`LAST_ID`", nullable = false) private String last; public String getFirst() { return first; } public String getLast() { return last; } public ConnectionId(String first, String last) { this.first = first; this.last = last; } public void setFirst(String id) { this.first = id; } public void setLast(String ownerId) { this.last = ownerId; } public ConnectionId() { } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ConnectionId)) return false; ConnectionId that = (ConnectionId) o; if (!first.equals(that.first)) return false; if (!last.equals(that.last)) return false; return true; } @Override public int hashCode() { int result = first.hashCode(); result = 31 * result + last.hashCode(); return result; } @Override public String toString() { return this.first + ":" + this.last; } }
UTF-8
Java
1,399
java
ConnectionId.java
Java
[ { "context": "e;\nimport java.io.Serializable;\n\n/**\n * Created by user on 16/4/15.\n */\n@Embeddable\npublic class Connecti", "end": 167, "score": 0.9748644828796387, "start": 163, "tag": "USERNAME", "value": "user" } ]
null
[]
package com.daffodilsw.core.data.jpa.embed; import javax.persistence.Column; import javax.persistence.Embeddable; import java.io.Serializable; /** * Created by user on 16/4/15. */ @Embeddable public class ConnectionId implements Serializable { @Column(name = "`FIRST_ID`", nullable = false) private String first; @Column(name = "`LAST_ID`", nullable = false) private String last; public String getFirst() { return first; } public String getLast() { return last; } public ConnectionId(String first, String last) { this.first = first; this.last = last; } public void setFirst(String id) { this.first = id; } public void setLast(String ownerId) { this.last = ownerId; } public ConnectionId() { } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ConnectionId)) return false; ConnectionId that = (ConnectionId) o; if (!first.equals(that.first)) return false; if (!last.equals(that.last)) return false; return true; } @Override public int hashCode() { int result = first.hashCode(); result = 31 * result + last.hashCode(); return result; } @Override public String toString() { return this.first + ":" + this.last; } }
1,399
0.600429
0.595425
66
20.19697
17.936943
55
false
false
0
0
0
0
0
0
0.378788
false
false
5
8b6ecfb92ea322971f115c37c277ef43a2334866
21,698,174,803,040
ec41f6361203c20c60eb616ff996a62c0d891bc9
/fiveware-test-model/src/main/java/org/fiveware/test/model/repository/TaskRepositoryInterface.java
33b9e2dd4a10b2401d5b36746dd463d726203dda
[]
no_license
cristianoAbudu/test
https://github.com/cristianoAbudu/test
8f4a8982ffbaad0092e03142202f763cb21fcb0a
7ef2830160ef02532eccf34b37344af756f9df21
refs/heads/master
2021-01-18T09:41:36.314000
2016-06-23T01:26:10
2016-06-23T01:26:10
61,736,131
0
0
null
true
2016-06-22T16:53:48
2016-06-22T16:53:48
2015-10-22T17:49:08
2016-03-09T16:12:34
106
0
0
0
null
null
null
package org.fiveware.test.model.repository; import org.fiveware.test.model.TaskDTO; public interface TaskRepositoryInterface { public void save(TaskDTO taskDTO); }
UTF-8
Java
174
java
TaskRepositoryInterface.java
Java
[]
null
[]
package org.fiveware.test.model.repository; import org.fiveware.test.model.TaskDTO; public interface TaskRepositoryInterface { public void save(TaskDTO taskDTO); }
174
0.781609
0.781609
7
22.857143
19.65
43
false
false
0
0
0
0
0
0
0.571429
false
false
5
a1a973b9b4ee0faeb6c0bd51f89db60c81733c06
6,562,710,038,148
1097660ae1c956478ab444c8f5fec337dbb22ac2
/Muthoot/src/main/java/com/Cogniphy/Protection/Muthoot/Reports/RCR_Reports.java
d5248038688f8fd674dadd4e9a5b9b957adc7878
[]
no_license
suresh886bm/projectStructure
https://github.com/suresh886bm/projectStructure
0ae820a4f93ee15edb1d6796486e2d2ee0d34251
8331b2c461780c4d7bc6ffdd1e2637c3bb57ef75
refs/heads/master
2021-04-30T01:21:40.209000
2018-03-05T12:34:17
2018-03-05T12:34:17
121,482,379
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Cogniphy.Protection.Muthoot.Reports; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.Cogniphy.Protection.Muthoot.TestSuites.Reports_TestSuite; import com.Cogniphy.Protection.Muthoot.Utility.BaseClass; public class RCR_Reports extends BaseClass { private static final Logger log = Logger.getLogger(RCR_Reports.class.getName()); public static void navigateToRcR_Report() { driver.findElement(By.xpath(reader.get("rcr_xpath"))).click(); } public static void openGaurdAttendanceReport() throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(reader.get("gaurdAttendance")))); driver.findElement(By.xpath(reader.get("gaurdAttendance"))).click(); Thread.sleep(6000); WebElement filter = driver.findElement(By.xpath(reader.get("dateFilter_xpath"))); filter.click(); Thread.sleep(6000); } static Integer i,j,k,l ; static List<String> ernames ; static List<String> dates ; static List<String> dataList ; public static void identify_PartialPresent() throws InterruptedException { ernames = new ArrayList<String>(); List<WebElement> ertNames = driver.findElements(By.xpath(reader.get("RCRertNames"))); for (WebElement element : ertNames) { ernames.add(element.getText()); } //System.out.println(ernames); dates = new ArrayList<String>(); List<WebElement> rcrDatess = driver.findElements(By.xpath(reader.get("rcrDates"))); for ( i = 5; i < rcrDatess.size() - 4; i++) { dates.add(rcrDatess.get(i).getText()); } //System.out.println(dates); for (int m = 0; m < addERTs().size(); m++) { fetchOnlyPPDates(addERTs().get(m)); } } static void fetchOnlyPPDates(String text) { dataList = new ArrayList<String>(); List<WebElement> preData = driver.findElements(By.xpath(reader.get(text))); for ( i = 5; i < preData.size() - 4; i ++) { dataList.add(preData.get(i).getText()); } //System.out.println(dataList); for ( i = 0; i < dates.size(); i++) { for ( j = 0; j < dataList.size(); j++) { if(i == j && dataList.get(j).equals("PP")) { System.out.println(text+"="+dates.get(i)+"="+dataList.get(j)); log.info(text+" has showed on "+dates.get(i)+" as "+dataList.get(j)); } } } } static List<String> ertsName ; static List<String> addERTs() { ertsName = new ArrayList<String>(); for (int i = 1; i < 26; i++) { ertsName.add("ERT"+i); } return ertsName; } }
UTF-8
Java
2,877
java
RCR_Reports.java
Java
[]
null
[]
package com.Cogniphy.Protection.Muthoot.Reports; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.Cogniphy.Protection.Muthoot.TestSuites.Reports_TestSuite; import com.Cogniphy.Protection.Muthoot.Utility.BaseClass; public class RCR_Reports extends BaseClass { private static final Logger log = Logger.getLogger(RCR_Reports.class.getName()); public static void navigateToRcR_Report() { driver.findElement(By.xpath(reader.get("rcr_xpath"))).click(); } public static void openGaurdAttendanceReport() throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(reader.get("gaurdAttendance")))); driver.findElement(By.xpath(reader.get("gaurdAttendance"))).click(); Thread.sleep(6000); WebElement filter = driver.findElement(By.xpath(reader.get("dateFilter_xpath"))); filter.click(); Thread.sleep(6000); } static Integer i,j,k,l ; static List<String> ernames ; static List<String> dates ; static List<String> dataList ; public static void identify_PartialPresent() throws InterruptedException { ernames = new ArrayList<String>(); List<WebElement> ertNames = driver.findElements(By.xpath(reader.get("RCRertNames"))); for (WebElement element : ertNames) { ernames.add(element.getText()); } //System.out.println(ernames); dates = new ArrayList<String>(); List<WebElement> rcrDatess = driver.findElements(By.xpath(reader.get("rcrDates"))); for ( i = 5; i < rcrDatess.size() - 4; i++) { dates.add(rcrDatess.get(i).getText()); } //System.out.println(dates); for (int m = 0; m < addERTs().size(); m++) { fetchOnlyPPDates(addERTs().get(m)); } } static void fetchOnlyPPDates(String text) { dataList = new ArrayList<String>(); List<WebElement> preData = driver.findElements(By.xpath(reader.get(text))); for ( i = 5; i < preData.size() - 4; i ++) { dataList.add(preData.get(i).getText()); } //System.out.println(dataList); for ( i = 0; i < dates.size(); i++) { for ( j = 0; j < dataList.size(); j++) { if(i == j && dataList.get(j).equals("PP")) { System.out.println(text+"="+dates.get(i)+"="+dataList.get(j)); log.info(text+" has showed on "+dates.get(i)+" as "+dataList.get(j)); } } } } static List<String> ertsName ; static List<String> addERTs() { ertsName = new ArrayList<String>(); for (int i = 1; i < 26; i++) { ertsName.add("ERT"+i); } return ertsName; } }
2,877
0.663886
0.656587
95
28.28421
26.501902
101
false
false
0
0
0
0
0
0
2.105263
false
false
5
c966fcf5202af52340983b48c0ae8540fa6a692d
5,033,701,698,922
669391f8bf4f79d2a6360fb6c073dbe0c2627c88
/Let Me Out V4/src/Jack.java
2fc675dc636747e6887efe13e109798ebd9dd040
[]
no_license
deadeverygame/Let-Me-Out-v-0.4
https://github.com/deadeverygame/Let-Me-Out-v-0.4
faa418d3c897d74ce5eed9534127679cfba5f361
da92f5c4048dd5877920a854b7e678eb9f14231d
refs/heads/main
2023-02-04T22:02:56.084000
2020-12-17T19:42:31
2020-12-17T19:42:31
322,393,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; public class Jack extends GameObject { private int warp = 0; Handler handler; private BufferedImage jack_image; Game game; private BufferedImage[] j_image = new BufferedImage[12]; Animation animd,animup,animr,animl; private AudioPlayer coin_sound,item_sound,pilla_sound; public Jack(int x, int y, ID id, Handler handler,SpriteSheet ss, Game game) { super(x, y, id, ss); this.handler = handler; this.game = game; j_image[0] = ss.grabImage(1, 1,64, 84); j_image[1] = ss.grabImage(2, 1,64, 84); j_image[2] = ss.grabImage(3, 1,64, 84); j_image[3] = ss.grabImage(4, 1,64, 84); j_image[4] = ss.grabImage(5, 1,64, 84); j_image[5] = ss.grabImage(6, 1,64, 84); j_image[6] = ss.grabImage(7, 1,64, 84); j_image[7] = ss.grabImage(8, 1,64, 84); j_image[8] = ss.grabImage(9, 1,64, 84); j_image[9] = ss.grabImage(10, 1,64, 84); j_image[10] = ss.grabImage(11, 1,64, 84); j_image[11] = ss.grabImage(12, 1,64, 84); animd = new Animation(3,j_image[0],j_image[1],j_image[2] ); animup = new Animation(3,j_image[3],j_image[4],j_image[5] ); animl = new Animation(3,j_image[6],j_image[7],j_image[8] ); animr = new Animation(3,j_image[9],j_image[10],j_image[11] ); coin_sound = new AudioPlayer("/sound/coin_pickup.wav"); item_sound = new AudioPlayer("/sound/pickup_item.wav"); pilla_sound = new AudioPlayer("/sound/pilla_hit.wav"); } public void tick() { x += velX; y += velY; collision(); if(handler.isUp()) velY = -5; else if(!handler.isDown()) velY = 0; if(handler.isDown()) velY = 5; else if(!handler.isUp()) velY = 0; if(handler.isRight()) {velX = 5; velY = 0;} else if(!handler.isLeft()) velX = 0; if(handler.isLeft()) { velX = -5; velY=0;} else if(!handler.isRight()) velX = 0; animd.runAnimation();animup.runAnimation();animr.runAnimation();animl.runAnimation(); if(game.tim == 0 & game.tis <= 5 & warp == 0) { x = 2400; y = 900; warp = 1; } } private void collision() { for(int i =0; i < handler.object.size(); i++) { GameObject tempObject = handler.object.get(i); if(tempObject.getId() == ID.Block) { if(getBounds().intersects(tempObject.getBounds())) { x += velX * -1; y += velY * -1; } } if(tempObject.getId() == ID.Axe) { if (getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.axe_+= 1; handler.removeObject(tempObject); } } if(tempObject.getId() == ID.Enemy) { if (getBounds().intersects(tempObject.getBounds())) { if(game.axe_ == 1) {pilla_sound.play(); handler.removeObject(tempObject); } else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.Ladybug) { if(getBounds().intersects(tempObject.getBounds())) { coin_sound.play(); game.lady_bug += 1; handler.removeObject(tempObject); } } if(tempObject.getId() == ID.Door) { if(getBounds().intersects(tempObject.getBounds())) { if(game.lady_bug == 8) handler.removeObject(tempObject); else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.Key) { if(getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.Key_collected += 1; handler.removeObject(tempObject);} } if(tempObject.getId() == ID.Keysilva) { if(getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.Silva_key_col += 1; handler.removeObject(tempObject);} } if(tempObject.getId() == ID.last_door) { if(getBounds().intersects(tempObject.getBounds())) { if(game.Key_collected == 1 & game.Silva_key_col == 1) { handler.removeObject(tempObject); game.win = 1; } else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.cat) { if(getBounds().intersects(tempObject.getBounds())) { x += velX * -1; y += velY * -1; handler.removeObject(this); } } } } public void render(Graphics g) { if( velY > 0) { animd.drawAnimation(g, x, y, 0); } else if( velY < 0) { animup.drawAnimation(g, x, y, 0); } else if( velX > 0) { animr.drawAnimation(g, x, y, 0); } else if( velX < 0) { animl.drawAnimation(g, x, y, 0); } else if ( velX == 0 || velY == 0) { jack_image = ss.grabImage(1, 1,64, 84); g.drawImage(jack_image,x,y,null); } } public Rectangle getBounds() { return new Rectangle(x, y, 60, 80); } }
UTF-8
Java
4,921
java
Jack.java
Java
[]
null
[]
import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; public class Jack extends GameObject { private int warp = 0; Handler handler; private BufferedImage jack_image; Game game; private BufferedImage[] j_image = new BufferedImage[12]; Animation animd,animup,animr,animl; private AudioPlayer coin_sound,item_sound,pilla_sound; public Jack(int x, int y, ID id, Handler handler,SpriteSheet ss, Game game) { super(x, y, id, ss); this.handler = handler; this.game = game; j_image[0] = ss.grabImage(1, 1,64, 84); j_image[1] = ss.grabImage(2, 1,64, 84); j_image[2] = ss.grabImage(3, 1,64, 84); j_image[3] = ss.grabImage(4, 1,64, 84); j_image[4] = ss.grabImage(5, 1,64, 84); j_image[5] = ss.grabImage(6, 1,64, 84); j_image[6] = ss.grabImage(7, 1,64, 84); j_image[7] = ss.grabImage(8, 1,64, 84); j_image[8] = ss.grabImage(9, 1,64, 84); j_image[9] = ss.grabImage(10, 1,64, 84); j_image[10] = ss.grabImage(11, 1,64, 84); j_image[11] = ss.grabImage(12, 1,64, 84); animd = new Animation(3,j_image[0],j_image[1],j_image[2] ); animup = new Animation(3,j_image[3],j_image[4],j_image[5] ); animl = new Animation(3,j_image[6],j_image[7],j_image[8] ); animr = new Animation(3,j_image[9],j_image[10],j_image[11] ); coin_sound = new AudioPlayer("/sound/coin_pickup.wav"); item_sound = new AudioPlayer("/sound/pickup_item.wav"); pilla_sound = new AudioPlayer("/sound/pilla_hit.wav"); } public void tick() { x += velX; y += velY; collision(); if(handler.isUp()) velY = -5; else if(!handler.isDown()) velY = 0; if(handler.isDown()) velY = 5; else if(!handler.isUp()) velY = 0; if(handler.isRight()) {velX = 5; velY = 0;} else if(!handler.isLeft()) velX = 0; if(handler.isLeft()) { velX = -5; velY=0;} else if(!handler.isRight()) velX = 0; animd.runAnimation();animup.runAnimation();animr.runAnimation();animl.runAnimation(); if(game.tim == 0 & game.tis <= 5 & warp == 0) { x = 2400; y = 900; warp = 1; } } private void collision() { for(int i =0; i < handler.object.size(); i++) { GameObject tempObject = handler.object.get(i); if(tempObject.getId() == ID.Block) { if(getBounds().intersects(tempObject.getBounds())) { x += velX * -1; y += velY * -1; } } if(tempObject.getId() == ID.Axe) { if (getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.axe_+= 1; handler.removeObject(tempObject); } } if(tempObject.getId() == ID.Enemy) { if (getBounds().intersects(tempObject.getBounds())) { if(game.axe_ == 1) {pilla_sound.play(); handler.removeObject(tempObject); } else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.Ladybug) { if(getBounds().intersects(tempObject.getBounds())) { coin_sound.play(); game.lady_bug += 1; handler.removeObject(tempObject); } } if(tempObject.getId() == ID.Door) { if(getBounds().intersects(tempObject.getBounds())) { if(game.lady_bug == 8) handler.removeObject(tempObject); else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.Key) { if(getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.Key_collected += 1; handler.removeObject(tempObject);} } if(tempObject.getId() == ID.Keysilva) { if(getBounds().intersects(tempObject.getBounds())) { item_sound.play(); game.Silva_key_col += 1; handler.removeObject(tempObject);} } if(tempObject.getId() == ID.last_door) { if(getBounds().intersects(tempObject.getBounds())) { if(game.Key_collected == 1 & game.Silva_key_col == 1) { handler.removeObject(tempObject); game.win = 1; } else { x += velX * -1; y += velY * -1; } } } if(tempObject.getId() == ID.cat) { if(getBounds().intersects(tempObject.getBounds())) { x += velX * -1; y += velY * -1; handler.removeObject(this); } } } } public void render(Graphics g) { if( velY > 0) { animd.drawAnimation(g, x, y, 0); } else if( velY < 0) { animup.drawAnimation(g, x, y, 0); } else if( velX > 0) { animr.drawAnimation(g, x, y, 0); } else if( velX < 0) { animl.drawAnimation(g, x, y, 0); } else if ( velX == 0 || velY == 0) { jack_image = ss.grabImage(1, 1,64, 84); g.drawImage(jack_image,x,y,null); } } public Rectangle getBounds() { return new Rectangle(x, y, 60, 80); } }
4,921
0.548872
0.514123
211
21.322275
20.53965
87
false
false
0
0
0
0
0
0
3.50237
false
false
5
4601efe2614a23f9c598a24f7304530b67d8a48a
5,033,701,696,481
15ebccb55784bb720bdf13db347d2b21c45d61c1
/campo-minado/src/br/com/atomjuice/cm/modelo/Tabuleiro.java
f8b0c187324b080d92bde42813d88d02e468b9fd
[]
no_license
BiggeRilo/CampoMinadoJava
https://github.com/BiggeRilo/CampoMinadoJava
01783543cca76844b8d1e4ed8f89b37c0ca74bb2
1e3640fbd8d98e0cff195e9a0c2708d812d06ca8
refs/heads/main
2023-08-19T06:32:27.480000
2021-10-09T03:05:34
2021-10-09T03:05:34
415,186,463
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.atomjuice.cm.modelo; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; import br.com.atomjuice.cm.excecao.ExplosaoException; public class Tabuleiro { private int qtdLinhas; private int qtdColunas; private int qtdMinas; private final List<Campo> campos = new ArrayList<>(); public Tabuleiro(int qtdLinhas, int qtdColunas, int qtdMinas) { super(); this.qtdLinhas = qtdLinhas; this.qtdColunas = qtdColunas; this.qtdMinas = qtdMinas; gerarCampos(); associarOsVizinhos(); generateMinas(); } public void abrir(int linha, int coluna) { try { campos.parallelStream().filter(c -> c.getLinha() == linha && c.getColuna() == coluna).findFirst().ifPresent(c -> c.abrirCampo()); } catch (ExplosaoException e) { campos.forEach(c -> c.setAberto(true)); throw e; } } public void alterarMarcacao(int linha, int coluna){ campos.parallelStream().filter(c -> c.getLinha() == linha && c.getColuna() == coluna).findFirst().ifPresent(c -> c.alternarMarcacao());; } private void gerarCampos() { for (int linhas = 0; linhas < qtdLinhas; linhas++) { for (int colunas = 0; colunas < qtdColunas; colunas++) { campos.add(new Campo( linhas, colunas)); } } } private void associarOsVizinhos() { for(Campo c1: campos) { for(Campo c2: campos){ c1.adicionarVizinho(c2); } } } private void generateMinas() { long minasArmadas = 0; Predicate<Campo> minado = c -> c.isMinado(); do { //Cast tem prioridade sobre a multiplicacao, como o Math.random() gera um valor entre 0 e 1, o cast transforma esse valor para 0. Por isso realizamos a multiplicacao primeiro int aleatorio = (int) (Math.random() * campos.size()); campos.get(aleatorio).minarCampo(); minasArmadas = campos.stream().filter(minado).count(); } while (minasArmadas < qtdMinas); } public boolean objetivoAlcancado(){ return campos.stream().allMatch(c->c.objetivoAlcancado()); } public void reiniciar(){ campos.stream().forEach(c-> c.reiniciar()); generateMinas(); } public String toString(){ //Bom para criar uma string que surge a partir de muitas concatanacoes StringBuilder sb = new StringBuilder(); sb.append(" "); for(int colunas = 0; colunas < qtdColunas; colunas++){ sb.append(" "); sb.append(colunas); sb.append(" "); } sb.append("\n"); int i = 0; for(int linhas = 0; linhas < qtdLinhas; linhas++){ sb.append(linhas); sb.append(" "); for(int colunas = 0; colunas < qtdColunas; colunas++){ sb.append(" "); sb.append(campos.get(i)); sb.append(" "); i++; } sb.append("\n"); } return sb.toString(); } }
UTF-8
Java
2,813
java
Tabuleiro.java
Java
[]
null
[]
package br.com.atomjuice.cm.modelo; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; import br.com.atomjuice.cm.excecao.ExplosaoException; public class Tabuleiro { private int qtdLinhas; private int qtdColunas; private int qtdMinas; private final List<Campo> campos = new ArrayList<>(); public Tabuleiro(int qtdLinhas, int qtdColunas, int qtdMinas) { super(); this.qtdLinhas = qtdLinhas; this.qtdColunas = qtdColunas; this.qtdMinas = qtdMinas; gerarCampos(); associarOsVizinhos(); generateMinas(); } public void abrir(int linha, int coluna) { try { campos.parallelStream().filter(c -> c.getLinha() == linha && c.getColuna() == coluna).findFirst().ifPresent(c -> c.abrirCampo()); } catch (ExplosaoException e) { campos.forEach(c -> c.setAberto(true)); throw e; } } public void alterarMarcacao(int linha, int coluna){ campos.parallelStream().filter(c -> c.getLinha() == linha && c.getColuna() == coluna).findFirst().ifPresent(c -> c.alternarMarcacao());; } private void gerarCampos() { for (int linhas = 0; linhas < qtdLinhas; linhas++) { for (int colunas = 0; colunas < qtdColunas; colunas++) { campos.add(new Campo( linhas, colunas)); } } } private void associarOsVizinhos() { for(Campo c1: campos) { for(Campo c2: campos){ c1.adicionarVizinho(c2); } } } private void generateMinas() { long minasArmadas = 0; Predicate<Campo> minado = c -> c.isMinado(); do { //Cast tem prioridade sobre a multiplicacao, como o Math.random() gera um valor entre 0 e 1, o cast transforma esse valor para 0. Por isso realizamos a multiplicacao primeiro int aleatorio = (int) (Math.random() * campos.size()); campos.get(aleatorio).minarCampo(); minasArmadas = campos.stream().filter(minado).count(); } while (minasArmadas < qtdMinas); } public boolean objetivoAlcancado(){ return campos.stream().allMatch(c->c.objetivoAlcancado()); } public void reiniciar(){ campos.stream().forEach(c-> c.reiniciar()); generateMinas(); } public String toString(){ //Bom para criar uma string que surge a partir de muitas concatanacoes StringBuilder sb = new StringBuilder(); sb.append(" "); for(int colunas = 0; colunas < qtdColunas; colunas++){ sb.append(" "); sb.append(colunas); sb.append(" "); } sb.append("\n"); int i = 0; for(int linhas = 0; linhas < qtdLinhas; linhas++){ sb.append(linhas); sb.append(" "); for(int colunas = 0; colunas < qtdColunas; colunas++){ sb.append(" "); sb.append(campos.get(i)); sb.append(" "); i++; } sb.append("\n"); } return sb.toString(); } }
2,813
0.631354
0.626378
110
23.572727
28.572542
177
false
false
0
0
0
0
0
0
2.363636
false
false
5
276876f96b1fc74393dba2e0cf60124a9378533e
21,053,929,714,143
403aff49ce91ef482c4a4cf5dba241d2b1a101e6
/src/main/java/com/hackerrank/dashboard/algorithms/sorting/InsertionSort.java
fcd78c576d173bb677372f569313aaa126b78d76
[]
no_license
wenzaca/HackerRank
https://github.com/wenzaca/HackerRank
a637b6b1874fae7e1d9e2c410b777fe867813ebe
9e67b12671374619a9ff25a72cadd2ea6e89df99
refs/heads/master
2021-01-15T12:02:39.471000
2019-08-13T07:12:02
2019-08-13T07:12:02
99,644,557
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hackerrank.dashboard.algorithms.sorting; import org.junit.Assert; import org.junit.Test; import java.util.Scanner; import static org.hamcrest.CoreMatchers.is; public class InsertionSort { // Complete the insertionSort1 function below. static int[] insertionSort1(int n, int[] arr) { int e = arr[n - 1]; int i = 0; for (i = n - 2; i >= 0 && arr[i] > e; i--) { arr[i + 1] = arr[i]; printArray(arr); } arr[i + 1] = e; printArray(arr); return arr; } static void printArray(int[] arr) { for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(); } 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(); } @Test public void testSolution() { Assert.assertThat(insertionSort1(5, new int[]{1, 2, 4, 5, 3}), is(new int[]{1, 2, 3, 4, 5})); Assert.assertThat(insertionSort1(5, new int[]{2, 3, 4, 5, 1}), is(new int[]{1, 2, 3, 4, 5})); } }
UTF-8
Java
1,547
java
InsertionSort.java
Java
[]
null
[]
package com.hackerrank.dashboard.algorithms.sorting; import org.junit.Assert; import org.junit.Test; import java.util.Scanner; import static org.hamcrest.CoreMatchers.is; public class InsertionSort { // Complete the insertionSort1 function below. static int[] insertionSort1(int n, int[] arr) { int e = arr[n - 1]; int i = 0; for (i = n - 2; i >= 0 && arr[i] > e; i--) { arr[i + 1] = arr[i]; printArray(arr); } arr[i + 1] = e; printArray(arr); return arr; } static void printArray(int[] arr) { for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(); } 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(); } @Test public void testSolution() { Assert.assertThat(insertionSort1(5, new int[]{1, 2, 4, 5, 3}), is(new int[]{1, 2, 3, 4, 5})); Assert.assertThat(insertionSort1(5, new int[]{2, 3, 4, 5, 1}), is(new int[]{1, 2, 3, 4, 5})); } }
1,547
0.530705
0.492566
57
26.14035
24.256262
101
false
false
0
0
0
0
0
0
0.982456
false
false
5
247cb127570b9d5c886ede99544b9b9824af7e12
19,662,360,337,321
a3839c57cad8827ff4a69d1bed2db53b99c330cf
/src/main/java/com/innoscripta/pizza/entity/OnlineOrder.java
4eff66ca14886445eee42fdf350966f0e1dd63b4
[]
no_license
maala/Pizza-api
https://github.com/maala/Pizza-api
25cafa52f794c449f6996b0336564fd7be5b0ba2
dcd1e9463bd197ba0434423890122240f12ffa30
refs/heads/master
2022-11-10T02:09:31.295000
2020-06-30T23:26:23
2020-06-30T23:26:23
274,579,970
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.innoscripta.pizza.entity; import com.innoscripta.pizza.model.InnoscriptaEntity; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity public class OnlineOrder extends InnoscriptaEntity { public String name; public String surname; public String address; public String orderSerialId; @ManyToOne @JoinColumn(name = "user_id") public User user; @OneToMany(mappedBy = "onlineOrder") public List<PizzaInOrder> orderPizzas; @OneToOne(mappedBy = "onlineOrder", cascade = CascadeType.ALL) public Invoice invoice; public OnlineOrder() { } public OnlineOrder(String name, String surname, String address, String orderSerialId) { this.name = name; this.surname = surname; this.address = address; this.orderSerialId = orderSerialId; this.orderPizzas = new ArrayList<>(); } }
UTF-8
Java
915
java
OnlineOrder.java
Java
[]
null
[]
package com.innoscripta.pizza.entity; import com.innoscripta.pizza.model.InnoscriptaEntity; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity public class OnlineOrder extends InnoscriptaEntity { public String name; public String surname; public String address; public String orderSerialId; @ManyToOne @JoinColumn(name = "user_id") public User user; @OneToMany(mappedBy = "onlineOrder") public List<PizzaInOrder> orderPizzas; @OneToOne(mappedBy = "onlineOrder", cascade = CascadeType.ALL) public Invoice invoice; public OnlineOrder() { } public OnlineOrder(String name, String surname, String address, String orderSerialId) { this.name = name; this.surname = surname; this.address = address; this.orderSerialId = orderSerialId; this.orderPizzas = new ArrayList<>(); } }
915
0.698361
0.698361
37
23.729731
21.147676
91
false
false
0
0
0
0
0
0
0.567568
false
false
5
1628ecb648cf828c0044f9a8ce5b8e0d409821f2
6,279,242,224,510
920aa9453c8874420345feb521f7da19692d3fe5
/app/src/main/java/com/tongfu/mytestapp/video/VideoPlayActivity.java
44d3bf029586b4d6563683eb422fac7c156a3dca
[]
no_license
rentongfu/MyTestApp
https://github.com/rentongfu/MyTestApp
acebcf5cab661efb50b1317bf4cc7da75639cce8
d0f41a7fcc78e0db0c0d1de186a3123a81c5e257
refs/heads/master
2021-09-16T14:37:16.985000
2021-08-28T07:20:04
2021-08-28T07:20:04
173,302,989
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tongfu.mytestapp.video; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.WindowManager; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.tongfu.mytestapp.R; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import butterknife.BindView; import butterknife.ButterKnife; public class VideoPlayActivity extends AppCompatActivity { @BindView(R.id.surfaceView) SurfaceView surfaceView; MediaPlayer mediaPlayer ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_play); ButterKnife.bind(this); mediaPlayer = new MediaPlayer(); try {//sdcard/西部往事BD中英双字[电影天堂www.dy2018.com].mp4 mediaPlayer.reset(); File source = new File(getIntent().getStringExtra("url")); // File source = new File(Environment.getExternalStorageDirectory() + "/西部往事BD中英双字[电影天堂www.dy2018.com].mp4"); Log.i("VideoPlay" , source.exists()?"文件存在" :"文件不存在"); mediaPlayer.setDataSource(new FileInputStream(source).getFD()); mediaPlayer.prepareAsync(); mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { getSupportActionBar().hide(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ,WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ); surfaceView.setVisibility(View.VISIBLE); mp.start(); } }); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Toast.makeText(VideoPlayActivity.this, "播放错误" , Toast.LENGTH_LONG).show(); return false; } }); } catch (IOException e) { e.printStackTrace(); } surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { mediaPlayer.setDisplay(holder); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } }); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override protected void onDestroy() { if(mediaPlayer!= null){ mediaPlayer.stop(); mediaPlayer.release(); } this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ); super.onDestroy(); } }
UTF-8
Java
3,633
java
VideoPlayActivity.java
Java
[]
null
[]
package com.tongfu.mytestapp.video; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.WindowManager; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.tongfu.mytestapp.R; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import butterknife.BindView; import butterknife.ButterKnife; public class VideoPlayActivity extends AppCompatActivity { @BindView(R.id.surfaceView) SurfaceView surfaceView; MediaPlayer mediaPlayer ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_play); ButterKnife.bind(this); mediaPlayer = new MediaPlayer(); try {//sdcard/西部往事BD中英双字[电影天堂www.dy2018.com].mp4 mediaPlayer.reset(); File source = new File(getIntent().getStringExtra("url")); // File source = new File(Environment.getExternalStorageDirectory() + "/西部往事BD中英双字[电影天堂www.dy2018.com].mp4"); Log.i("VideoPlay" , source.exists()?"文件存在" :"文件不存在"); mediaPlayer.setDataSource(new FileInputStream(source).getFD()); mediaPlayer.prepareAsync(); mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { getSupportActionBar().hide(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ,WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ); surfaceView.setVisibility(View.VISIBLE); mp.start(); } }); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Toast.makeText(VideoPlayActivity.this, "播放错误" , Toast.LENGTH_LONG).show(); return false; } }); } catch (IOException e) { e.printStackTrace(); } surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { mediaPlayer.setDisplay(holder); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } }); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override protected void onDestroy() { if(mediaPlayer!= null){ mediaPlayer.stop(); mediaPlayer.release(); } this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON ); super.onDestroy(); } }
3,633
0.644563
0.641753
100
34.59
30.223864
138
false
false
0
0
0
0
0
0
0.59
false
false
5
fade23b6a88ff2f59b5bf518ecda624b91b29d5e
8,289,286,919,497
8d926fcb367c1fcd762197d7d29d03859529cbaa
/core/src/com/starsailor/ui/stages/hud/NavigationPanel.java
37f93814473fc1240ceabc6d7793b27bd023ae7f
[]
no_license
syd711/nima
https://github.com/syd711/nima
9334805b17cc2f5b5674a767bc5d1575f7dc6ec0
eb06b9f53a95a4c8cd268c69d55aec2a3c3e1ce8
refs/heads/master
2021-05-24T03:34:04.534000
2019-11-13T10:05:32
2019-11-13T10:05:32
73,103,274
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.starsailor.ui.stages.hud; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.starsailor.ui.Scene2dFactory; import com.starsailor.ui.UIManager; import com.starsailor.ui.states.LeaveMapState; import com.starsailor.ui.states.UIStates; /** * The display on the left of the screen */ public class NavigationPanel extends HudPanel { public NavigationPanel() { super("navigation_bg", Position.RIGHT); TextButton planet1 = Scene2dFactory.createButton("Nereus"); planet1.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(new LeaveMapState("nereus")); } }); TextButton planet2 = Scene2dFactory.createButton("Erebos"); planet2.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(new LeaveMapState("erebos")); } }); Label addressLabel = Scene2dFactory.createLabel("blah:"); TextButton cancelButton = Scene2dFactory.createButton("Cancel"); cancelButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(UIStates.NAVIGATE_BACK_STATE); } }); add(planet1).width(100); row(); add(planet2).width(100); row(); add(cancelButton).width(100); top().left(); } }
UTF-8
Java
1,638
java
NavigationPanel.java
Java
[]
null
[]
package com.starsailor.ui.stages.hud; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.starsailor.ui.Scene2dFactory; import com.starsailor.ui.UIManager; import com.starsailor.ui.states.LeaveMapState; import com.starsailor.ui.states.UIStates; /** * The display on the left of the screen */ public class NavigationPanel extends HudPanel { public NavigationPanel() { super("navigation_bg", Position.RIGHT); TextButton planet1 = Scene2dFactory.createButton("Nereus"); planet1.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(new LeaveMapState("nereus")); } }); TextButton planet2 = Scene2dFactory.createButton("Erebos"); planet2.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(new LeaveMapState("erebos")); } }); Label addressLabel = Scene2dFactory.createLabel("blah:"); TextButton cancelButton = Scene2dFactory.createButton("Cancel"); cancelButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { UIManager.getInstance().changeState(UIStates.NAVIGATE_BACK_STATE); } }); add(planet1).width(100); row(); add(planet2).width(100); row(); add(cancelButton).width(100); top().left(); } }
1,638
0.710012
0.69536
54
29.333334
24.687679
74
false
false
0
0
0
0
0
0
0.555556
false
false
5
d63890f4083e4b1b92a7905c17f5cb7a41ddd746
20,761,871,926,841
a8b30e3c49bcdf6db1c0994831316ccebc613dba
/appmt/src/main/java/com/zxtech/mt/activity/MtTaskActivity.java
cb76f6b9cca073e4fc681b2f7bea0480a96b85fb
[]
no_license
jerry5213/eai
https://github.com/jerry5213/eai
48d3265808397a0554c9fcb5ead91a9e3882b83e
a5b828754e65c80c86ed82782db433a64f84cea3
refs/heads/master
2020-03-25T17:26:29.967000
2018-08-09T09:19:51
2018-08-09T09:19:51
143,977,737
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zxtech.mt.activity; import android.content.Intent; import android.text.TextUtils; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.android.volley.AuthFailureError; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.zxtech.mt.adapter.MtInfoAdapter; import com.zxtech.mt.common.Constants; import com.zxtech.mt.common.UIController; import com.zxtech.mt.common.VolleySingleton; import com.zxtech.mt.entity.JsonData; import com.zxtech.mt.entity.MtWorkPlan; import com.zxtech.mt.utils.HttpCallBack; import com.zxtech.mt.utils.HttpUtil; import com.zxtech.mt.utils.SPUtils; import com.zxtech.mt.utils.ToastUtil; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.zxtech.mtos.R; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 维保详情 * Created by Chw on 2016/7/6. */ public class MtTaskActivity extends BaseActivity{ private TextView project_textview,address_textview,type_textview,plan_date_textview,workers_textview,elevator_code_textview, contract_code_textview,contract_type_textview,contract_begin_textview,elevator_brand_textview,elevator_reg_textview,elevator_type_textview, load_textview,speed_textview,door_textview,high_textview,angle_textview,width_textview,relation_person_textview,relation_phone_textview, next_check_textview,check_textview; private MtWorkPlan work; @Override protected void onCreate() { View view = mInfalter.inflate(R.layout.activity_maintenance_info, null); main_layout.addView(view); title_textview.setText(getString(R.string.mt_check)); setBottomLayoutHide(); } @Override protected void findView() { project_textview = (TextView) findViewById(R.id.project_textview); address_textview = (TextView) findViewById(R.id.address_textview); type_textview = (TextView) findViewById(R.id.type_textview); plan_date_textview = (TextView) findViewById(R.id.plan_date_textview); workers_textview = (TextView) findViewById(R.id.workers_textview); elevator_code_textview = (TextView) findViewById(R.id.elevator_code_textview); contract_code_textview = (TextView) findViewById(R.id.contract_code_textview); contract_type_textview = (TextView) findViewById(R.id.contract_type_textview); contract_begin_textview = (TextView) findViewById(R.id.contract_begin_textview); elevator_brand_textview = (TextView) findViewById(R.id.elevator_brand_textview); elevator_reg_textview = (TextView) findViewById(R.id.elevator_reg_textview); elevator_type_textview = (TextView) findViewById(R.id.elevator_type_textview); load_textview = (TextView) findViewById(R.id.load_textview); speed_textview = (TextView) findViewById(R.id.speed_textview); door_textview = (TextView) findViewById(R.id.door_textview); high_textview = (TextView) findViewById(R.id.high_textview); angle_textview = (TextView) findViewById(R.id.angle_textview); width_textview = (TextView) findViewById(R.id.width_textview); relation_person_textview = (TextView) findViewById(R.id.relation_person_textview); relation_phone_textview = (TextView) findViewById(R.id.relation_phone_textview); next_check_textview = (TextView) findViewById(R.id.next_check_textview); check_textview = (TextView) findViewById(R.id.check_textview); } @Override protected void setListener() { check_textview.setOnClickListener(this); } @Override protected void initData() { } @Override protected void initView() { Intent intent = getIntent(); work = (MtWorkPlan) intent.getSerializableExtra("bean"); project_textview.setText(work.getProj_name()); address_textview.setText(work.getProj_address()); type_textview.setText(work.getWork_type_name()); plan_date_textview.setText(work.getPlan_date()); workers_textview.setText(work.getWorkers()); elevator_code_textview.setText(work.getElevator_code()); contract_code_textview.setText(work.getContract_code()); contract_type_textview.setText(work.getContract_type()); contract_begin_textview.setText(work.getElevator_effect_date()); elevator_brand_textview.setText(work.getElevator_brand()); elevator_reg_textview.setText(work.getElevator_reg_number()); elevator_type_textview.setText(work.getElevator_type()); load_textview.setText(work.getElevator_load()); speed_textview.setText(work.getElevator_speed()); door_textview.setText(work.getElevator_level()+"/"+work.getElevator_station()+"/"+work.getElevator_door()); high_textview.setText(work.getElevator_high()); angle_textview.setText(work.getElevator_angle()); width_textview.setText(work.getElevator_step_width()); relation_person_textview.setText(work.getElevator_relation_person()); relation_phone_textview.setText(work.getElevator_relation_phone()); next_check_textview.setText(work.getNext_check_date()); } @Override public void onClick(View v) { super.onClick(v); if (v.getId()==check_textview.getId()){ startWork(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode==11){ finish(); } } private void intentActivity(){ Intent it = new Intent(mContext,MtCheckItemActivity.class); it.putExtra("bean", work); startActivityForResult(it,11); overridePendingTransition(R.anim.right_in,R.anim.left_out); } private void startWork(){ //维保负责人是否为自己 if ("1".equals(work.getOrder_pincipal()) && (Constants.MT_WORK_STATUS_PAUSE.equals(work.getStatus()) || Constants.MT_WORK_STATUS_RENEW.equals(work.getStatus()))) { intentActivity(); }else{ Map<String, String> param = new HashMap<>(); param.put("status", Constants.MT_WORK_STATUS_IN); param.put("last_update_user", SPUtils.get(mContext,"user","admin").toString()); param.put("id", work.getId()); param.put("plan_id", work.getId()); param.put("emp_id", SPUtils.get(mContext,"emp_id","").toString()); HttpUtil.getInstance(mContext).request("/mtmo/updateworkplan.mo", param, new HttpCallBack<String>() { @Override public void onSuccess(String result) { if ("repeat".equals(result)) { ToastUtil.showShort(mContext,getString(R.string.msg_8)); }else{ intentActivity(); } } @Override public void onFail(String msg) { ToastUtil.showLong(mContext,getString(R.string.msg_3)); } }); } } }
UTF-8
Java
7,261
java
MtTaskActivity.java
Java
[ { "context": ";\nimport java.util.Map;\n\n/**\n * 维保详情\n * Created by Chw on 2016/7/6.\n */\npublic class MtTaskActivity exte", "end": 1039, "score": 0.9707077741622925, "start": 1036, "tag": "USERNAME", "value": "Chw" } ]
null
[]
package com.zxtech.mt.activity; import android.content.Intent; import android.text.TextUtils; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.android.volley.AuthFailureError; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.zxtech.mt.adapter.MtInfoAdapter; import com.zxtech.mt.common.Constants; import com.zxtech.mt.common.UIController; import com.zxtech.mt.common.VolleySingleton; import com.zxtech.mt.entity.JsonData; import com.zxtech.mt.entity.MtWorkPlan; import com.zxtech.mt.utils.HttpCallBack; import com.zxtech.mt.utils.HttpUtil; import com.zxtech.mt.utils.SPUtils; import com.zxtech.mt.utils.ToastUtil; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.zxtech.mtos.R; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 维保详情 * Created by Chw on 2016/7/6. */ public class MtTaskActivity extends BaseActivity{ private TextView project_textview,address_textview,type_textview,plan_date_textview,workers_textview,elevator_code_textview, contract_code_textview,contract_type_textview,contract_begin_textview,elevator_brand_textview,elevator_reg_textview,elevator_type_textview, load_textview,speed_textview,door_textview,high_textview,angle_textview,width_textview,relation_person_textview,relation_phone_textview, next_check_textview,check_textview; private MtWorkPlan work; @Override protected void onCreate() { View view = mInfalter.inflate(R.layout.activity_maintenance_info, null); main_layout.addView(view); title_textview.setText(getString(R.string.mt_check)); setBottomLayoutHide(); } @Override protected void findView() { project_textview = (TextView) findViewById(R.id.project_textview); address_textview = (TextView) findViewById(R.id.address_textview); type_textview = (TextView) findViewById(R.id.type_textview); plan_date_textview = (TextView) findViewById(R.id.plan_date_textview); workers_textview = (TextView) findViewById(R.id.workers_textview); elevator_code_textview = (TextView) findViewById(R.id.elevator_code_textview); contract_code_textview = (TextView) findViewById(R.id.contract_code_textview); contract_type_textview = (TextView) findViewById(R.id.contract_type_textview); contract_begin_textview = (TextView) findViewById(R.id.contract_begin_textview); elevator_brand_textview = (TextView) findViewById(R.id.elevator_brand_textview); elevator_reg_textview = (TextView) findViewById(R.id.elevator_reg_textview); elevator_type_textview = (TextView) findViewById(R.id.elevator_type_textview); load_textview = (TextView) findViewById(R.id.load_textview); speed_textview = (TextView) findViewById(R.id.speed_textview); door_textview = (TextView) findViewById(R.id.door_textview); high_textview = (TextView) findViewById(R.id.high_textview); angle_textview = (TextView) findViewById(R.id.angle_textview); width_textview = (TextView) findViewById(R.id.width_textview); relation_person_textview = (TextView) findViewById(R.id.relation_person_textview); relation_phone_textview = (TextView) findViewById(R.id.relation_phone_textview); next_check_textview = (TextView) findViewById(R.id.next_check_textview); check_textview = (TextView) findViewById(R.id.check_textview); } @Override protected void setListener() { check_textview.setOnClickListener(this); } @Override protected void initData() { } @Override protected void initView() { Intent intent = getIntent(); work = (MtWorkPlan) intent.getSerializableExtra("bean"); project_textview.setText(work.getProj_name()); address_textview.setText(work.getProj_address()); type_textview.setText(work.getWork_type_name()); plan_date_textview.setText(work.getPlan_date()); workers_textview.setText(work.getWorkers()); elevator_code_textview.setText(work.getElevator_code()); contract_code_textview.setText(work.getContract_code()); contract_type_textview.setText(work.getContract_type()); contract_begin_textview.setText(work.getElevator_effect_date()); elevator_brand_textview.setText(work.getElevator_brand()); elevator_reg_textview.setText(work.getElevator_reg_number()); elevator_type_textview.setText(work.getElevator_type()); load_textview.setText(work.getElevator_load()); speed_textview.setText(work.getElevator_speed()); door_textview.setText(work.getElevator_level()+"/"+work.getElevator_station()+"/"+work.getElevator_door()); high_textview.setText(work.getElevator_high()); angle_textview.setText(work.getElevator_angle()); width_textview.setText(work.getElevator_step_width()); relation_person_textview.setText(work.getElevator_relation_person()); relation_phone_textview.setText(work.getElevator_relation_phone()); next_check_textview.setText(work.getNext_check_date()); } @Override public void onClick(View v) { super.onClick(v); if (v.getId()==check_textview.getId()){ startWork(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode==11){ finish(); } } private void intentActivity(){ Intent it = new Intent(mContext,MtCheckItemActivity.class); it.putExtra("bean", work); startActivityForResult(it,11); overridePendingTransition(R.anim.right_in,R.anim.left_out); } private void startWork(){ //维保负责人是否为自己 if ("1".equals(work.getOrder_pincipal()) && (Constants.MT_WORK_STATUS_PAUSE.equals(work.getStatus()) || Constants.MT_WORK_STATUS_RENEW.equals(work.getStatus()))) { intentActivity(); }else{ Map<String, String> param = new HashMap<>(); param.put("status", Constants.MT_WORK_STATUS_IN); param.put("last_update_user", SPUtils.get(mContext,"user","admin").toString()); param.put("id", work.getId()); param.put("plan_id", work.getId()); param.put("emp_id", SPUtils.get(mContext,"emp_id","").toString()); HttpUtil.getInstance(mContext).request("/mtmo/updateworkplan.mo", param, new HttpCallBack<String>() { @Override public void onSuccess(String result) { if ("repeat".equals(result)) { ToastUtil.showShort(mContext,getString(R.string.msg_8)); }else{ intentActivity(); } } @Override public void onFail(String msg) { ToastUtil.showLong(mContext,getString(R.string.msg_3)); } }); } } }
7,261
0.674409
0.672612
183
38.52459
33.128632
171
false
false
0
0
0
0
0
0
0.775956
false
false
5
a49f84073a1986c2805c2272829e14964122a2b9
15,307,263,475,347
eeadf85adcc75ca8db7c355ea9423afef23691cf
/src/Range/FooRange.java
b3e8fca2a81237e50066f7d5e7f4382507818fab
[]
no_license
polymonith/Problems
https://github.com/polymonith/Problems
000a054a6712998a44043a10a418ca7756280095
fcbff71c53fb0e0e6addea489198f6ad473aff24
refs/heads/master
2020-05-17T16:24:00.333000
2015-03-08T00:07:05
2015-03-08T00:07:05
30,925,202
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Range; public class FooRange extends Range { final boolean ADD = true; final boolean DELETE = false; public void addRange(Integer start, Integer end) { applyChange(start,end,ADD); } public boolean queryRange(Integer start, Integer end) { for (int index = 0; index < bounds.size(); index+=2) { if(start.intValue() >= ((Integer) bounds.get(index)).intValue() && start.intValue() <= ((Integer) bounds.get(index+1)).intValue()) { return end.intValue() <= ((Integer) bounds.get(index+1)).intValue(); } } return false; } public void deleteRange(Integer start, Integer end) { applyChange(start,end,DELETE); } private void applyChange(Integer start, Integer end, boolean add) { int startIndex = 0; int endIndex = bounds.size()+1; for(int index = 0; index < bounds.size(); index++) { Integer indexValue = (Integer) bounds.get(index); if(start.intValue() > indexValue.intValue()) startIndex++; if(end.intValue() < indexValue.intValue()) endIndex--; } //When Deleting values should be incremented by one. bounds.add(startIndex, add ? start : new Integer(start.intValue()-1)); bounds.add(endIndex, add ? end : new Integer(end.intValue()+1)); int consolidateIndex; int consolidateCount; if(add) { consolidateIndex = startIndex-startIndex%2+1; consolidateCount = endIndex-consolidateIndex+1-endIndex%2; //Check for neighboring ranges, if the values are within one they should be considered the same range. if(startIndex>1 && ((Integer) bounds.get(startIndex)).intValue()-1 == ((Integer) bounds.get(startIndex-1)).intValue()) { consolidateIndex-=2; consolidateCount+=2; } if(endIndex+1<bounds.size()&& ((Integer) bounds.get(endIndex)).intValue()+1 == ((Integer) bounds.get(endIndex+1)).intValue()) { consolidateCount+=2; } } else { consolidateIndex = startIndex+startIndex%2; consolidateCount = endIndex-consolidateIndex; } consolidateCount+=consolidateCount%2; // Ensure we always remove a pair. for(int remove = 0; remove < consolidateCount; remove++) { bounds.remove(consolidateIndex); } } }
UTF-8
Java
2,177
java
FooRange.java
Java
[]
null
[]
package Range; public class FooRange extends Range { final boolean ADD = true; final boolean DELETE = false; public void addRange(Integer start, Integer end) { applyChange(start,end,ADD); } public boolean queryRange(Integer start, Integer end) { for (int index = 0; index < bounds.size(); index+=2) { if(start.intValue() >= ((Integer) bounds.get(index)).intValue() && start.intValue() <= ((Integer) bounds.get(index+1)).intValue()) { return end.intValue() <= ((Integer) bounds.get(index+1)).intValue(); } } return false; } public void deleteRange(Integer start, Integer end) { applyChange(start,end,DELETE); } private void applyChange(Integer start, Integer end, boolean add) { int startIndex = 0; int endIndex = bounds.size()+1; for(int index = 0; index < bounds.size(); index++) { Integer indexValue = (Integer) bounds.get(index); if(start.intValue() > indexValue.intValue()) startIndex++; if(end.intValue() < indexValue.intValue()) endIndex--; } //When Deleting values should be incremented by one. bounds.add(startIndex, add ? start : new Integer(start.intValue()-1)); bounds.add(endIndex, add ? end : new Integer(end.intValue()+1)); int consolidateIndex; int consolidateCount; if(add) { consolidateIndex = startIndex-startIndex%2+1; consolidateCount = endIndex-consolidateIndex+1-endIndex%2; //Check for neighboring ranges, if the values are within one they should be considered the same range. if(startIndex>1 && ((Integer) bounds.get(startIndex)).intValue()-1 == ((Integer) bounds.get(startIndex-1)).intValue()) { consolidateIndex-=2; consolidateCount+=2; } if(endIndex+1<bounds.size()&& ((Integer) bounds.get(endIndex)).intValue()+1 == ((Integer) bounds.get(endIndex+1)).intValue()) { consolidateCount+=2; } } else { consolidateIndex = startIndex+startIndex%2; consolidateCount = endIndex-consolidateIndex; } consolidateCount+=consolidateCount%2; // Ensure we always remove a pair. for(int remove = 0; remove < consolidateCount; remove++) { bounds.remove(consolidateIndex); } } }
2,177
0.670648
0.659164
60
34.283333
31.384228
135
false
false
0
0
0
0
0
0
2.766667
false
false
5
beff73df39b9278b150fc728ddb3e9a0ad461fb7
27,797,028,385,261
c6f530695c793498c1def35b59c362546eda28a4
/src/main/java/bftsmart/consensus/roles/Acceptor.java
231ddac672ee5c5cbf271f1bcbfcc5b4a1558f93
[ "Apache-2.0" ]
permissive
bft-smart/library
https://github.com/bft-smart/library
f7113838ccac834c8860424409c1f6012f39ead9
238a39b2e7be566601ce1636247ab7eb7c50758a
refs/heads/master
2023-08-30T22:48:34.536000
2023-08-15T09:44:44
2023-08-15T09:44:44
32,321,665
436
254
Apache-2.0
false
2023-08-25T15:35:52
2015-03-16T11:54:21
2023-08-12T08:19:58
2023-08-25T15:35:51
44,407
393
198
7
Java
false
false
/** Copyright (c) 2007-2013 Alysson Bessani, Eduardo Alchieri, Paulo Sousa, and the authors indicated in 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 bftsmart.consensus.roles; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.security.PrivateKey; import java.util.Arrays; import java.util.LinkedList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import bftsmart.communication.ServerCommunicationSystem; import bftsmart.consensus.Consensus; import bftsmart.consensus.Epoch; import bftsmart.consensus.messages.ConsensusMessage; import bftsmart.consensus.messages.MessageFactory; import bftsmart.reconfiguration.ServerViewController; import bftsmart.tom.core.ExecutionManager; import bftsmart.tom.core.TOMLayer; import bftsmart.tom.core.messages.TOMMessage; import bftsmart.tom.util.TOMUtil; /** * This class represents the acceptor role in the consensus protocol. This class * work together with the TOMLayer class in order to supply a atomic multicast * service. * * @author Alysson Bessani */ public final class Acceptor { private Logger logger = LoggerFactory.getLogger(this.getClass()); private int me; // This replica ID private ExecutionManager executionManager; // Execution manager of consensus's executions private MessageFactory factory; // Factory for PaW messages private ServerCommunicationSystem communication; // Replicas comunication system private TOMLayer tomLayer; // TOM layer private ServerViewController controller; // thread pool used to paralelise creation of consensus proofs private ExecutorService proofExecutor = null; /** * Tulio Ribeiro */ private PrivateKey privKey; /** * Creates a new instance of Acceptor. * * @param communication Replicas communication system * @param factory Message factory for PaW messages * @param controller */ public Acceptor(ServerCommunicationSystem communication, MessageFactory factory, ServerViewController controller) { this.communication = communication; this.me = controller.getStaticConf().getProcessId(); this.factory = factory; this.controller = controller; /* Tulio Ribeiro */ this.privKey = controller.getStaticConf().getPrivateKey(); // use either the same number of Netty workers threads if specified in the // configuration // or use a many as the number of cores available /* * int nWorkers = this.controller.getStaticConf().getNumNettyWorkers(); nWorkers * = nWorkers > 0 ? nWorkers : Runtime.getRuntime().availableProcessors(); * this.proofExecutor = Executors.newWorkStealingPool(nWorkers); */ this.proofExecutor = Executors.newSingleThreadExecutor(); } public MessageFactory getFactory() { return factory; } /** * Sets the execution manager for this acceptor * * @param manager Execution manager for this acceptor */ public void setExecutionManager(ExecutionManager manager) { this.executionManager = manager; } /** * Sets the TOM layer for this acceptor * * @param tom TOM layer for this acceptor */ public void setTOMLayer(TOMLayer tom) { this.tomLayer = tom; } /** * Called by communication layer to delivery Paxos messages. This method only * verifies if the message can be executed and calls process message (storing it * on an out of context message buffer if this is not the case) * * @param msg Paxos messages delivered by the communication layer */ public final void deliver(ConsensusMessage msg) { if (executionManager.checkLimits(msg)) { logger.debug("Processing paxos msg with id " + msg.getNumber()); processMessage(msg); } else { logger.debug("Out of context msg with id " + msg.getNumber()); tomLayer.processOutOfContext(); } } /** * Called when a Consensus message is received or when a out of context message * must be processed. It processes the received message according to its type * * @param msg The message to be processed */ public final void processMessage(ConsensusMessage msg) { Consensus consensus = executionManager.getConsensus(msg.getNumber()); consensus.lock.lock(); Epoch epoch = consensus.getEpoch(msg.getEpoch(), controller); switch (msg.getType()) { case MessageFactory.PROPOSE: { proposeReceived(epoch, msg); } break; case MessageFactory.WRITE: { writeReceived(epoch, msg.getSender(), msg.getValue()); } break; case MessageFactory.ACCEPT: { acceptReceived(epoch, msg); } } consensus.lock.unlock(); } /** * Called when a PROPOSE message is received or when processing a formerly out * of context propose which is know belongs to the current consensus. * * @param msg The PROPOSE message to by processed */ public void proposeReceived(Epoch epoch, ConsensusMessage msg) { int cid = epoch.getConsensus().getId(); int ts = epoch.getConsensus().getEts(); int ets = executionManager.getConsensus(msg.getNumber()).getEts(); logger.debug("PROPOSE received from:{}, for consensus cId:{}, I am:{}", msg.getSender(), cid, me); if (msg.getSender() == executionManager.getCurrentLeader() // Is the replica the leader? && epoch.getTimestamp() == 0 && ts == ets && ets == 0) { // Is all this in epoch 0? executePropose(epoch, msg.getValue()); } else { logger.debug("Propose received is not from the expected leader"); } } /** * Executes actions related to a proposed value. * * @param epoch the current epoch of the consensus * @param value Value that is proposed */ private void executePropose(Epoch epoch, byte[] value) { int cid = epoch.getConsensus().getId(); logger.debug("Executing propose for cId:{}, Epoch Timestamp:{}", cid, epoch.getTimestamp()); long consensusStartTime = System.nanoTime(); if (epoch.propValue == null) { // only accept one propose per epoch epoch.propValue = value; epoch.propValueHash = tomLayer.computeHash(value); /*** LEADER CHANGE CODE ********/ epoch.getConsensus().addWritten(value); logger.trace("I have written value " + Arrays.toString(epoch.propValueHash) + " in consensus instance " + cid + " with timestamp " + epoch.getConsensus().getEts()); /*****************************************/ // start this consensus if it is not already running if (cid == tomLayer.getLastExec() + 1) { tomLayer.setInExec(cid); } epoch.deserializedPropValue = tomLayer.checkProposedValue(value, true); if (epoch.deserializedPropValue != null && !epoch.isWriteSent()) { if (epoch.getConsensus().getDecision().firstMessageProposed == null) { epoch.getConsensus().getDecision().firstMessageProposed = epoch.deserializedPropValue[0]; } if (epoch.getConsensus().getDecision().firstMessageProposed.consensusStartTime == 0) { epoch.getConsensus().getDecision().firstMessageProposed.consensusStartTime = consensusStartTime; } epoch.getConsensus().getDecision().firstMessageProposed.proposeReceivedTime = System.nanoTime(); if (controller.getStaticConf().isBFT()) { logger.debug("Sending WRITE for " + cid); epoch.setWrite(me, epoch.propValueHash); epoch.getConsensus().getDecision().firstMessageProposed.writeSentTime = System.nanoTime(); logger.debug("Sending WRITE for cId:{}, I am:{}", cid, me); communication.send(this.controller.getCurrentViewOtherAcceptors(), factory.createWrite(cid, epoch.getTimestamp(), epoch.propValueHash)); epoch.writeSent(); computeWrite(cid, epoch, epoch.propValueHash); logger.debug("WRITE computed for cId:{}, I am:{}", cid, me); } else { epoch.setAccept(me, epoch.propValueHash); epoch.getConsensus().getDecision().firstMessageProposed.writeSentTime = System.nanoTime(); epoch.getConsensus().getDecision().firstMessageProposed.acceptSentTime = System.nanoTime(); /**** LEADER CHANGE CODE! ******/ logger.debug("[CFT Mode] Setting consensus " + cid + " QuorumWrite tiemstamp to " + epoch.getConsensus().getEts() + " and value " + Arrays.toString(epoch.propValueHash)); epoch.getConsensus().setQuorumWrites(epoch.propValueHash); /*****************************************/ communication.send(this.controller.getCurrentViewOtherAcceptors(), factory.createAccept(cid, epoch.getTimestamp(), epoch.propValueHash)); epoch.acceptSent(); computeAccept(cid, epoch, epoch.propValueHash); } executionManager.processOutOfContext(epoch.getConsensus()); } else if (epoch.deserializedPropValue == null && !tomLayer.isChangingLeader()) { // force a leader change tomLayer.getSynchronizer().triggerTimeout(new LinkedList<>()); } } } /** * Called when a WRITE message is received * * @param epoch Epoch of the receives message * @param a Replica that sent the message * @param value Value sent in the message */ private void writeReceived(Epoch epoch, int sender, byte[] value) { int cid = epoch.getConsensus().getId(); logger.debug("WRITE received from:{}, for consensus cId:{}", sender, cid); epoch.setWrite(sender, value); computeWrite(cid, epoch, value); } /** * Computes WRITE values according to Byzantine consensus specification values * received). * * @param cid Consensus ID of the received message * @param epoch Epoch of the receives message * @param value Value sent in the message */ private void computeWrite(int cid, Epoch epoch, byte[] value) { int writeAccepted = epoch.countWrite(value); logger.debug("I have {}, WRITE's for cId:{}, Epoch timestamp:{},", writeAccepted, cid, epoch.getTimestamp()); if (writeAccepted > controller.getQuorum() && Arrays.equals(value, epoch.propValueHash)) { if (!epoch.isAcceptSent()) { logger.debug("Sending ACCEPT message, cId:{}, I am:{}", cid, me); /**** LEADER CHANGE CODE! ******/ logger.debug("Setting consensus " + cid + " QuorumWrite tiemstamp to " + epoch.getConsensus().getEts() + " and value " + Arrays.toString(value)); epoch.getConsensus().setQuorumWrites(value); /*****************************************/ if (epoch.getConsensus().getDecision().firstMessageProposed != null) { epoch.getConsensus().getDecision().firstMessageProposed.acceptSentTime = System.nanoTime(); } ConsensusMessage cm = epoch.fetchAccept(); int[] targets = this.controller.getCurrentViewAcceptors(); epoch.acceptSent(); if (Arrays.equals(cm.getValue(), value)) { // make sure the ACCEPT message generated upon receiving the // PROPOSE message // still matches the value that ended up being written... logger.debug( "Speculative ACCEPT message for consensus {} matches the written value, sending it to the other replicas", cid); communication.getServersConn().send(targets, cm, true); } else { // ... and if not, create the ACCEPT message again (with the correct value), and // send it ConsensusMessage correctAccept = factory.createAccept(cid, epoch.getTimestamp(), value); proofExecutor.submit(() -> { // Create a cryptographic proof for this ACCEPT message logger.debug( "Creating cryptographic proof for the correct ACCEPT message from consensus " + cid); insertProof(correctAccept, epoch.deserializedPropValue); communication.getServersConn().send(targets, correctAccept, true); }); } } } else if (!epoch.isAcceptCreated()) { // start creating the ACCEPT message and its respective proof ASAP, to // increase performance. // since this is done after a PROPOSE message is received, this is done // speculatively, hence // the value must be verified before sending the ACCEPT message to the // other replicas ConsensusMessage cm = factory.createAccept(cid, epoch.getTimestamp(), value); epoch.acceptCreated(); proofExecutor.submit(() -> { // Create a cryptographic proof for this ACCEPT message logger.debug("Creating cryptographic proof for speculative ACCEPT message from consensus " + cid); insertProof(cm, epoch.deserializedPropValue); epoch.setAcceptMsg(cm); }); } } /** * Create a cryptographic proof for a consensus message * * This method modifies the consensus message passed as an argument, so that it * contains a cryptographic proof. * * @param cm The consensus message to which the proof shall be set * @param epoch The epoch during in which the consensus message was created */ private void insertProof(ConsensusMessage cm, TOMMessage[] msgs) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(248); try { ObjectOutputStream obj = new ObjectOutputStream(bOut); obj.writeObject(cm); obj.flush(); bOut.flush(); } catch (IOException ex) { logger.error("Failed to serialize consensus message", ex); } byte[] data = bOut.toByteArray(); // Always sign a consensus proof. byte[] signature = TOMUtil.signMessage(privKey, data); cm.setProof(signature); } /** * Called when a ACCEPT message is received * * @param epoch Epoch of the receives message * @param a Replica that sent the message * @param value Value sent in the message */ private void acceptReceived(Epoch epoch, ConsensusMessage msg) { int cid = epoch.getConsensus().getId(); logger.debug("ACCEPT from " + msg.getSender() + " for consensus " + cid); epoch.setAccept(msg.getSender(), msg.getValue()); epoch.addToProof(msg); computeAccept(cid, epoch, msg.getValue()); } /** * Computes ACCEPT values according to the Byzantine consensus specification * * @param epoch Epoch of the receives message * @param value Value sent in the message */ private void computeAccept(int cid, Epoch epoch, byte[] value) { logger.debug("I have {} ACCEPTs for cId:{}, Timestamp:{} ", epoch.countAccept(value), cid, epoch.getTimestamp()); if (epoch.countAccept(value) > controller.getQuorum() && !epoch.getConsensus().isDecided() && Arrays.equals(value, epoch.propValueHash)) { logger.debug("Deciding consensus " + cid); decide(epoch); } } /** * This is the method invoked when a value is decided by this process * * @param epoch Epoch at which the decision is made */ private void decide(Epoch epoch) { if (epoch.getConsensus().getDecision().firstMessageProposed != null) epoch.getConsensus().getDecision().firstMessageProposed.decisionTime = System.nanoTime(); epoch.getConsensus().decided(epoch, true); } }
UTF-8
Java
15,108
java
Acceptor.java
Java
[ { "context": "/**\nCopyright (c) 2007-2013 Alysson Bessani, Eduardo Alchieri, Paulo Sousa, and the authors i", "end": 43, "score": 0.9998753070831299, "start": 28, "tag": "NAME", "value": "Alysson Bessani" }, { "context": "/**\nCopyright (c) 2007-2013 Alysson Bessani, Eduardo Alchieri, Paulo Sousa, and the authors indicated in the @a", "end": 61, "score": 0.9998604655265808, "start": 45, "tag": "NAME", "value": "Eduardo Alchieri" }, { "context": "t (c) 2007-2013 Alysson Bessani, Eduardo Alchieri, Paulo Sousa, and the authors indicated in the @author tags\n\nL", "end": 74, "score": 0.9998533129692078, "start": 63, "tag": "NAME", "value": "Paulo Sousa" }, { "context": "upply a atomic multicast\n * service.\n *\n * @author Alysson Bessani\n */\npublic final class Acceptor {\n\n\tprivate Logge", "end": 1661, "score": 0.9998642802238464, "start": 1646, "tag": "NAME", "value": "Alysson Bessani" }, { "context": "te ExecutorService proofExecutor = null;\n\n\t/**\n\t * Tulio Ribeiro\n\t */\n\tprivate PrivateKey privKey;\n\n\t/**\n\t * Creat", "end": 2253, "score": 0.9998528957366943, "start": 2240, "tag": "NAME", "value": "Tulio Ribeiro" }, { "context": "y = factory;\n\t\tthis.controller = controller;\n\n\t\t/* Tulio Ribeiro */\n\t\tthis.privKey = controller.getStaticConf().ge", "end": 2766, "score": 0.999718189239502, "start": 2753, "tag": "NAME", "value": "Tulio Ribeiro" } ]
null
[]
/** Copyright (c) 2007-2013 <NAME>, <NAME>, <NAME>, and the authors indicated in 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 bftsmart.consensus.roles; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.security.PrivateKey; import java.util.Arrays; import java.util.LinkedList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import bftsmart.communication.ServerCommunicationSystem; import bftsmart.consensus.Consensus; import bftsmart.consensus.Epoch; import bftsmart.consensus.messages.ConsensusMessage; import bftsmart.consensus.messages.MessageFactory; import bftsmart.reconfiguration.ServerViewController; import bftsmart.tom.core.ExecutionManager; import bftsmart.tom.core.TOMLayer; import bftsmart.tom.core.messages.TOMMessage; import bftsmart.tom.util.TOMUtil; /** * This class represents the acceptor role in the consensus protocol. This class * work together with the TOMLayer class in order to supply a atomic multicast * service. * * @author <NAME> */ public final class Acceptor { private Logger logger = LoggerFactory.getLogger(this.getClass()); private int me; // This replica ID private ExecutionManager executionManager; // Execution manager of consensus's executions private MessageFactory factory; // Factory for PaW messages private ServerCommunicationSystem communication; // Replicas comunication system private TOMLayer tomLayer; // TOM layer private ServerViewController controller; // thread pool used to paralelise creation of consensus proofs private ExecutorService proofExecutor = null; /** * <NAME> */ private PrivateKey privKey; /** * Creates a new instance of Acceptor. * * @param communication Replicas communication system * @param factory Message factory for PaW messages * @param controller */ public Acceptor(ServerCommunicationSystem communication, MessageFactory factory, ServerViewController controller) { this.communication = communication; this.me = controller.getStaticConf().getProcessId(); this.factory = factory; this.controller = controller; /* <NAME> */ this.privKey = controller.getStaticConf().getPrivateKey(); // use either the same number of Netty workers threads if specified in the // configuration // or use a many as the number of cores available /* * int nWorkers = this.controller.getStaticConf().getNumNettyWorkers(); nWorkers * = nWorkers > 0 ? nWorkers : Runtime.getRuntime().availableProcessors(); * this.proofExecutor = Executors.newWorkStealingPool(nWorkers); */ this.proofExecutor = Executors.newSingleThreadExecutor(); } public MessageFactory getFactory() { return factory; } /** * Sets the execution manager for this acceptor * * @param manager Execution manager for this acceptor */ public void setExecutionManager(ExecutionManager manager) { this.executionManager = manager; } /** * Sets the TOM layer for this acceptor * * @param tom TOM layer for this acceptor */ public void setTOMLayer(TOMLayer tom) { this.tomLayer = tom; } /** * Called by communication layer to delivery Paxos messages. This method only * verifies if the message can be executed and calls process message (storing it * on an out of context message buffer if this is not the case) * * @param msg Paxos messages delivered by the communication layer */ public final void deliver(ConsensusMessage msg) { if (executionManager.checkLimits(msg)) { logger.debug("Processing paxos msg with id " + msg.getNumber()); processMessage(msg); } else { logger.debug("Out of context msg with id " + msg.getNumber()); tomLayer.processOutOfContext(); } } /** * Called when a Consensus message is received or when a out of context message * must be processed. It processes the received message according to its type * * @param msg The message to be processed */ public final void processMessage(ConsensusMessage msg) { Consensus consensus = executionManager.getConsensus(msg.getNumber()); consensus.lock.lock(); Epoch epoch = consensus.getEpoch(msg.getEpoch(), controller); switch (msg.getType()) { case MessageFactory.PROPOSE: { proposeReceived(epoch, msg); } break; case MessageFactory.WRITE: { writeReceived(epoch, msg.getSender(), msg.getValue()); } break; case MessageFactory.ACCEPT: { acceptReceived(epoch, msg); } } consensus.lock.unlock(); } /** * Called when a PROPOSE message is received or when processing a formerly out * of context propose which is know belongs to the current consensus. * * @param msg The PROPOSE message to by processed */ public void proposeReceived(Epoch epoch, ConsensusMessage msg) { int cid = epoch.getConsensus().getId(); int ts = epoch.getConsensus().getEts(); int ets = executionManager.getConsensus(msg.getNumber()).getEts(); logger.debug("PROPOSE received from:{}, for consensus cId:{}, I am:{}", msg.getSender(), cid, me); if (msg.getSender() == executionManager.getCurrentLeader() // Is the replica the leader? && epoch.getTimestamp() == 0 && ts == ets && ets == 0) { // Is all this in epoch 0? executePropose(epoch, msg.getValue()); } else { logger.debug("Propose received is not from the expected leader"); } } /** * Executes actions related to a proposed value. * * @param epoch the current epoch of the consensus * @param value Value that is proposed */ private void executePropose(Epoch epoch, byte[] value) { int cid = epoch.getConsensus().getId(); logger.debug("Executing propose for cId:{}, Epoch Timestamp:{}", cid, epoch.getTimestamp()); long consensusStartTime = System.nanoTime(); if (epoch.propValue == null) { // only accept one propose per epoch epoch.propValue = value; epoch.propValueHash = tomLayer.computeHash(value); /*** LEADER CHANGE CODE ********/ epoch.getConsensus().addWritten(value); logger.trace("I have written value " + Arrays.toString(epoch.propValueHash) + " in consensus instance " + cid + " with timestamp " + epoch.getConsensus().getEts()); /*****************************************/ // start this consensus if it is not already running if (cid == tomLayer.getLastExec() + 1) { tomLayer.setInExec(cid); } epoch.deserializedPropValue = tomLayer.checkProposedValue(value, true); if (epoch.deserializedPropValue != null && !epoch.isWriteSent()) { if (epoch.getConsensus().getDecision().firstMessageProposed == null) { epoch.getConsensus().getDecision().firstMessageProposed = epoch.deserializedPropValue[0]; } if (epoch.getConsensus().getDecision().firstMessageProposed.consensusStartTime == 0) { epoch.getConsensus().getDecision().firstMessageProposed.consensusStartTime = consensusStartTime; } epoch.getConsensus().getDecision().firstMessageProposed.proposeReceivedTime = System.nanoTime(); if (controller.getStaticConf().isBFT()) { logger.debug("Sending WRITE for " + cid); epoch.setWrite(me, epoch.propValueHash); epoch.getConsensus().getDecision().firstMessageProposed.writeSentTime = System.nanoTime(); logger.debug("Sending WRITE for cId:{}, I am:{}", cid, me); communication.send(this.controller.getCurrentViewOtherAcceptors(), factory.createWrite(cid, epoch.getTimestamp(), epoch.propValueHash)); epoch.writeSent(); computeWrite(cid, epoch, epoch.propValueHash); logger.debug("WRITE computed for cId:{}, I am:{}", cid, me); } else { epoch.setAccept(me, epoch.propValueHash); epoch.getConsensus().getDecision().firstMessageProposed.writeSentTime = System.nanoTime(); epoch.getConsensus().getDecision().firstMessageProposed.acceptSentTime = System.nanoTime(); /**** LEADER CHANGE CODE! ******/ logger.debug("[CFT Mode] Setting consensus " + cid + " QuorumWrite tiemstamp to " + epoch.getConsensus().getEts() + " and value " + Arrays.toString(epoch.propValueHash)); epoch.getConsensus().setQuorumWrites(epoch.propValueHash); /*****************************************/ communication.send(this.controller.getCurrentViewOtherAcceptors(), factory.createAccept(cid, epoch.getTimestamp(), epoch.propValueHash)); epoch.acceptSent(); computeAccept(cid, epoch, epoch.propValueHash); } executionManager.processOutOfContext(epoch.getConsensus()); } else if (epoch.deserializedPropValue == null && !tomLayer.isChangingLeader()) { // force a leader change tomLayer.getSynchronizer().triggerTimeout(new LinkedList<>()); } } } /** * Called when a WRITE message is received * * @param epoch Epoch of the receives message * @param a Replica that sent the message * @param value Value sent in the message */ private void writeReceived(Epoch epoch, int sender, byte[] value) { int cid = epoch.getConsensus().getId(); logger.debug("WRITE received from:{}, for consensus cId:{}", sender, cid); epoch.setWrite(sender, value); computeWrite(cid, epoch, value); } /** * Computes WRITE values according to Byzantine consensus specification values * received). * * @param cid Consensus ID of the received message * @param epoch Epoch of the receives message * @param value Value sent in the message */ private void computeWrite(int cid, Epoch epoch, byte[] value) { int writeAccepted = epoch.countWrite(value); logger.debug("I have {}, WRITE's for cId:{}, Epoch timestamp:{},", writeAccepted, cid, epoch.getTimestamp()); if (writeAccepted > controller.getQuorum() && Arrays.equals(value, epoch.propValueHash)) { if (!epoch.isAcceptSent()) { logger.debug("Sending ACCEPT message, cId:{}, I am:{}", cid, me); /**** LEADER CHANGE CODE! ******/ logger.debug("Setting consensus " + cid + " QuorumWrite tiemstamp to " + epoch.getConsensus().getEts() + " and value " + Arrays.toString(value)); epoch.getConsensus().setQuorumWrites(value); /*****************************************/ if (epoch.getConsensus().getDecision().firstMessageProposed != null) { epoch.getConsensus().getDecision().firstMessageProposed.acceptSentTime = System.nanoTime(); } ConsensusMessage cm = epoch.fetchAccept(); int[] targets = this.controller.getCurrentViewAcceptors(); epoch.acceptSent(); if (Arrays.equals(cm.getValue(), value)) { // make sure the ACCEPT message generated upon receiving the // PROPOSE message // still matches the value that ended up being written... logger.debug( "Speculative ACCEPT message for consensus {} matches the written value, sending it to the other replicas", cid); communication.getServersConn().send(targets, cm, true); } else { // ... and if not, create the ACCEPT message again (with the correct value), and // send it ConsensusMessage correctAccept = factory.createAccept(cid, epoch.getTimestamp(), value); proofExecutor.submit(() -> { // Create a cryptographic proof for this ACCEPT message logger.debug( "Creating cryptographic proof for the correct ACCEPT message from consensus " + cid); insertProof(correctAccept, epoch.deserializedPropValue); communication.getServersConn().send(targets, correctAccept, true); }); } } } else if (!epoch.isAcceptCreated()) { // start creating the ACCEPT message and its respective proof ASAP, to // increase performance. // since this is done after a PROPOSE message is received, this is done // speculatively, hence // the value must be verified before sending the ACCEPT message to the // other replicas ConsensusMessage cm = factory.createAccept(cid, epoch.getTimestamp(), value); epoch.acceptCreated(); proofExecutor.submit(() -> { // Create a cryptographic proof for this ACCEPT message logger.debug("Creating cryptographic proof for speculative ACCEPT message from consensus " + cid); insertProof(cm, epoch.deserializedPropValue); epoch.setAcceptMsg(cm); }); } } /** * Create a cryptographic proof for a consensus message * * This method modifies the consensus message passed as an argument, so that it * contains a cryptographic proof. * * @param cm The consensus message to which the proof shall be set * @param epoch The epoch during in which the consensus message was created */ private void insertProof(ConsensusMessage cm, TOMMessage[] msgs) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(248); try { ObjectOutputStream obj = new ObjectOutputStream(bOut); obj.writeObject(cm); obj.flush(); bOut.flush(); } catch (IOException ex) { logger.error("Failed to serialize consensus message", ex); } byte[] data = bOut.toByteArray(); // Always sign a consensus proof. byte[] signature = TOMUtil.signMessage(privKey, data); cm.setProof(signature); } /** * Called when a ACCEPT message is received * * @param epoch Epoch of the receives message * @param a Replica that sent the message * @param value Value sent in the message */ private void acceptReceived(Epoch epoch, ConsensusMessage msg) { int cid = epoch.getConsensus().getId(); logger.debug("ACCEPT from " + msg.getSender() + " for consensus " + cid); epoch.setAccept(msg.getSender(), msg.getValue()); epoch.addToProof(msg); computeAccept(cid, epoch, msg.getValue()); } /** * Computes ACCEPT values according to the Byzantine consensus specification * * @param epoch Epoch of the receives message * @param value Value sent in the message */ private void computeAccept(int cid, Epoch epoch, byte[] value) { logger.debug("I have {} ACCEPTs for cId:{}, Timestamp:{} ", epoch.countAccept(value), cid, epoch.getTimestamp()); if (epoch.countAccept(value) > controller.getQuorum() && !epoch.getConsensus().isDecided() && Arrays.equals(value, epoch.propValueHash)) { logger.debug("Deciding consensus " + cid); decide(epoch); } } /** * This is the method invoked when a value is decided by this process * * @param epoch Epoch at which the decision is made */ private void decide(Epoch epoch) { if (epoch.getConsensus().getDecision().firstMessageProposed != null) epoch.getConsensus().getDecision().firstMessageProposed.decisionTime = System.nanoTime(); epoch.getConsensus().decided(epoch, true); } }
15,061
0.707175
0.705586
435
33.731033
30.994234
117
false
false
0
0
0
0
0
0
2.448276
false
false
5
e745e6429f4ebe19cfd39b635f8bcb1abfe38df7
5,093,831,258,631
9dd5e4dd1d227fd9f47595ba7e1093b40fb1ca47
/src/main/java/util/Constants.java
4fc0d8508d369588bcb2c3e157e6051488a2af74
[]
no_license
guruce/Coordinator
https://github.com/guruce/Coordinator
55c9c23d49bb03e551d4b2ca8562dacc9f8d2877
eee5d2e9a2c6790e84fe3c5cc5920ca871619ca5
refs/heads/master
2020-12-30T10:50:19.036000
2014-01-26T07:31:38
2014-01-26T07:31:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; /** * Created with IntelliJ IDEA. * User: Pirinthapan * Date: 7/9/13 * Time: 6:46 PM * To change this template use File | Settings | File Templates. */ public class Constants { public static final String serverAddress = "localhost"; public static final int activationPort = 9090; public static final int registrationPort = 9091; public static final int completionPort = 9092; }
UTF-8
Java
430
java
Constants.java
Java
[ { "context": ";\r\n\r\n/**\r\n * Created with IntelliJ IDEA.\r\n * User: Pirinthapan\r\n * Date: 7/9/13\r\n * Time: 6:46 PM\r\n * To change ", "end": 74, "score": 0.9871920347213745, "start": 63, "tag": "USERNAME", "value": "Pirinthapan" } ]
null
[]
package util; /** * Created with IntelliJ IDEA. * User: Pirinthapan * Date: 7/9/13 * Time: 6:46 PM * To change this template use File | Settings | File Templates. */ public class Constants { public static final String serverAddress = "localhost"; public static final int activationPort = 9090; public static final int registrationPort = 9091; public static final int completionPort = 9092; }
430
0.686047
0.64186
15
26.666666
21.846943
64
false
false
0
0
0
0
0
0
0.466667
false
false
5
65924076b48dff4a0d5adfcd088b78c71a0f65e0
5,093,831,256,139
0b31e1678e6bb91e4eb05a1979bec65cb69c9099
/Projet Workspace/EAP/src/EAP.java
6910fe1c8e17caeb3b12628cc1a7ba4400d81f9a
[]
no_license
GandyMickael/EAP_App
https://github.com/GandyMickael/EAP_App
291f8dfff10d1631799835ade358a262f240351e
319d897393182eb82af6c3781199f23cd4db298c
refs/heads/master
2020-05-07T21:01:52.529000
2019-05-14T19:34:17
2019-05-14T19:34:17
180,888,224
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public class EAP { private int id; private String nom; private String adresse; private int numTel; private String adresseMail; ArrayList<Salle> lesSalles; public EAP(int unID, String unNom, String uneAdresse, int unNumTel, String unMail){ this.id = unID; this.nom = unNom; this.adresse = uneAdresse; this.numTel = unNumTel; this.adresseMail= unMail; this.lesSalles = new ArrayList<Salle>(); } public EAP(int unID, String unNom, String uneAdresse, int unNumTel, String unMail, ArrayList<Salle> desSalles){ this.id = unID; this.nom = unNom; this.adresse = uneAdresse; this.numTel = unNumTel; this.adresseMail= unMail; this.lesSalles = desSalles; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getAdresse() { return adresse; } public void setAdresse(String adresse) { this.adresse = adresse; } public int getNumTel() { return numTel; } public void setNumTel(int numTel) { this.numTel = numTel; } public String getAdresseMail() { return adresseMail; } public void setAdresseMail(String adresseMail) { this.adresseMail = adresseMail; } public ArrayList<Salle> getLesSalles() { return lesSalles; } public void setLesSalles(ArrayList<Salle> lesSalles) { this.lesSalles = lesSalles; } }
UTF-8
Java
1,439
java
EAP.java
Java
[]
null
[]
import java.util.ArrayList; public class EAP { private int id; private String nom; private String adresse; private int numTel; private String adresseMail; ArrayList<Salle> lesSalles; public EAP(int unID, String unNom, String uneAdresse, int unNumTel, String unMail){ this.id = unID; this.nom = unNom; this.adresse = uneAdresse; this.numTel = unNumTel; this.adresseMail= unMail; this.lesSalles = new ArrayList<Salle>(); } public EAP(int unID, String unNom, String uneAdresse, int unNumTel, String unMail, ArrayList<Salle> desSalles){ this.id = unID; this.nom = unNom; this.adresse = uneAdresse; this.numTel = unNumTel; this.adresseMail= unMail; this.lesSalles = desSalles; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getAdresse() { return adresse; } public void setAdresse(String adresse) { this.adresse = adresse; } public int getNumTel() { return numTel; } public void setNumTel(int numTel) { this.numTel = numTel; } public String getAdresseMail() { return adresseMail; } public void setAdresseMail(String adresseMail) { this.adresseMail = adresseMail; } public ArrayList<Salle> getLesSalles() { return lesSalles; } public void setLesSalles(ArrayList<Salle> lesSalles) { this.lesSalles = lesSalles; } }
1,439
0.705351
0.705351
67
20.477612
19.356327
112
false
false
0
0
0
0
0
0
1.895522
false
false
5
6429839da32abf5a478436bd96747c29ea74566e
29,721,173,720,041
b4c1a212ac9bc45720622d9e6fd94a95323f5ba6
/sts_workspace/springmvc/src/main/java/com/oracle/interceptor/CheckInterceptor.java
7a1b06a809c5583218cad64d0c991720607beec3
[]
no_license
GeeK-lhy/myWorkSpaces
https://github.com/GeeK-lhy/myWorkSpaces
7e46147aa8d20df3755eac7527331862180d4857
14910630a5babe7981a1af1eab967296cd6d3cb6
refs/heads/master
2022-12-04T14:20:09.422000
2020-08-25T09:40:25
2020-08-25T09:40:25
290,168,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oracle.interceptor; import java.util.Calendar; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; public class CheckInterceptor implements HandlerInterceptor{ int start; int end; public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println(request.getRequestURL()+"¾­¹ýÁËÀ¹½ØÆ÷"); Calendar c = Calendar.getInstance(); int hour=c.get(Calendar.HOUR_OF_DAY); if(hour<start || hour>end) { response.sendRedirect("http://www.163.com"); return false; } return true; } }
WINDOWS-1252
Java
944
java
CheckInterceptor.java
Java
[]
null
[]
package com.oracle.interceptor; import java.util.Calendar; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; public class CheckInterceptor implements HandlerInterceptor{ int start; int end; public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println(request.getRequestURL()+"¾­¹ýÁËÀ¹½ØÆ÷"); Calendar c = Calendar.getInstance(); int hour=c.get(Calendar.HOUR_OF_DAY); if(hour<start || hour>end) { response.sendRedirect("http://www.163.com"); return false; } return true; } }
944
0.707082
0.699571
41
21.731707
22.324682
101
false
false
0
0
0
0
0
0
2.512195
false
false
5
eaf18ff57b07d04dae2e10f6b92b1fab1797f11c
2,216,203,128,819
b3ae5fcfdc37ffce4172fd0c73ea94bfe81506a2
/app/src/main/java/com/xiaox/studydemo/aboutDataStructure/practice/IsPopOrder.java
90deeb7dcde3fc3ef94e504f48fa577207079304
[]
no_license
xiaoOops/StudyDemo
https://github.com/xiaoOops/StudyDemo
c25358cdd8f76a18b2b5b8df3d01819bc12c8c0a
351bbebe5cb99d2e7f968981bc4c1da65d97f672
refs/heads/master
2020-05-23T11:42:39.120000
2019-12-08T13:00:02
2019-12-08T13:00:02
186,742,448
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xiaox.studydemo.aboutDataStructure.practice; import java.util.Stack; /** * 31:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序。 * 假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序, * 序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。(注意:这两个序列的长度是相等的) */ public class IsPopOrder { public static void main(String[] args) { int[] pushA = {1, 2, 3, 4, 5}; int[] popA = {4, 5, 3, 2, 1}; IsPopOrder1(pushA, popA); } /** * @param pushA 代表压入顺序的数组 * @param popA 代表弹出顺序的 * * 【思路】借用一个辅助的栈,遍历压栈顺序,先讲第一个放入栈中,这里是1,然后判断栈顶元素是不是出栈顺序的第一个元素, * 这里是4,很显然1≠4,所以我们继续压栈,直到相等以后开始出栈,出栈一个元素,则将出栈顺序向后移动一位,直到不相等, * 这样循环等压栈顺序遍历完成,如果辅助栈还不为空,说明弹出序列不是该栈的弹出顺序。 * 举例: * 入栈1,2,3,4,5 * 出栈4,5,3,2,1 * 首先1入辅助栈,此时栈顶1≠4,继续入栈2 * 此时栈顶2≠4,继续入栈3 * 此时栈顶3≠4,继续入栈4 * 此时栈顶4=4,出栈4,弹出序列向后一位,此时为5,,辅助栈里面是1,2,3 * 此时栈顶3≠5,继续入栈5 * 此时栈顶5=5,出栈5,弹出序列向后一位,此时为3,,辅助栈里面是1,2,3 * …. * * 依次执行,最后辅助栈为空。如果不为空说明弹出序列不是该栈的弹出顺序 */ public static boolean IsPopOrder(int[] pushA, int[] popA) { if(pushA.length==0||popA.length==0) { return false; } Stack<Integer> stack = new Stack<>(); int index = 0;//记录指向出栈数组栈顶的游标 for (int i = 0; i < pushA.length; i++) { if (pushA[i] != popA[index]) { stack.push(pushA[i]); } else { index++; } } if (!stack.isEmpty()) { for (int i = 0; i <= stack.size() + 1; i++) { if (stack.peek() == popA[index]) { stack.pop(); index++; } } } return stack.isEmpty(); } private static boolean IsPopOrder1(int [] pushA,int [] popA) { if(pushA.length == 0 || popA.length == 0) return false; Stack<Integer> s = new Stack<Integer>(); //用于标识弹出序列的位置 int popIndex = 0; for(int i = 0; i< pushA.length;i++){ s.push(pushA[i]); //如果栈不为空,且栈顶元素等于弹出序列 while(!s.empty() &&s.peek() == popA[popIndex]){ //出栈 s.pop(); //弹出序列向后一位 popIndex++; } } return s.empty(); } }
UTF-8
Java
3,270
java
IsPopOrder.java
Java
[]
null
[]
package com.xiaox.studydemo.aboutDataStructure.practice; import java.util.Stack; /** * 31:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序。 * 假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序, * 序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。(注意:这两个序列的长度是相等的) */ public class IsPopOrder { public static void main(String[] args) { int[] pushA = {1, 2, 3, 4, 5}; int[] popA = {4, 5, 3, 2, 1}; IsPopOrder1(pushA, popA); } /** * @param pushA 代表压入顺序的数组 * @param popA 代表弹出顺序的 * * 【思路】借用一个辅助的栈,遍历压栈顺序,先讲第一个放入栈中,这里是1,然后判断栈顶元素是不是出栈顺序的第一个元素, * 这里是4,很显然1≠4,所以我们继续压栈,直到相等以后开始出栈,出栈一个元素,则将出栈顺序向后移动一位,直到不相等, * 这样循环等压栈顺序遍历完成,如果辅助栈还不为空,说明弹出序列不是该栈的弹出顺序。 * 举例: * 入栈1,2,3,4,5 * 出栈4,5,3,2,1 * 首先1入辅助栈,此时栈顶1≠4,继续入栈2 * 此时栈顶2≠4,继续入栈3 * 此时栈顶3≠4,继续入栈4 * 此时栈顶4=4,出栈4,弹出序列向后一位,此时为5,,辅助栈里面是1,2,3 * 此时栈顶3≠5,继续入栈5 * 此时栈顶5=5,出栈5,弹出序列向后一位,此时为3,,辅助栈里面是1,2,3 * …. * * 依次执行,最后辅助栈为空。如果不为空说明弹出序列不是该栈的弹出顺序 */ public static boolean IsPopOrder(int[] pushA, int[] popA) { if(pushA.length==0||popA.length==0) { return false; } Stack<Integer> stack = new Stack<>(); int index = 0;//记录指向出栈数组栈顶的游标 for (int i = 0; i < pushA.length; i++) { if (pushA[i] != popA[index]) { stack.push(pushA[i]); } else { index++; } } if (!stack.isEmpty()) { for (int i = 0; i <= stack.size() + 1; i++) { if (stack.peek() == popA[index]) { stack.pop(); index++; } } } return stack.isEmpty(); } private static boolean IsPopOrder1(int [] pushA,int [] popA) { if(pushA.length == 0 || popA.length == 0) return false; Stack<Integer> s = new Stack<Integer>(); //用于标识弹出序列的位置 int popIndex = 0; for(int i = 0; i< pushA.length;i++){ s.push(pushA[i]); //如果栈不为空,且栈顶元素等于弹出序列 while(!s.empty() &&s.peek() == popA[popIndex]){ //出栈 s.pop(); //弹出序列向后一位 popIndex++; } } return s.empty(); } }
3,270
0.497824
0.463011
82
27.024391
19.3214
73
false
false
0
0
0
0
0
0
0.829268
false
false
5
6f913c036c67575adb505d9b3f885c5027dddfd7
12,953,621,422,984
073b8fb1f79764519ae2088b46a94c7b1346c457
/Vapor/src/java/entity/Myorder.java
8de0cbe79b95a5309b4d092f111b3c1f23fc52b9
[]
no_license
lovolLiu/Vapor
https://github.com/lovolLiu/Vapor
25ff9ab6ccb4eb82e761ad274e0160fead741cff
5d57d64805cd534943f96cf507802d4242082e00
refs/heads/master
2021-08-15T12:18:50.864000
2017-11-17T20:37:35
2017-11-17T20:37:35
111,148,125
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 entity; import java.io.Serializable; import java.util.Collection; import java.util.Date; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author Beta */ @Entity @Table(name = "myorder") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Myorder.findAll", query = "SELECT m FROM Myorder m"), @NamedQuery(name = "Myorder.findById", query = "SELECT m FROM Myorder m WHERE m.id = :id"), @NamedQuery(name = "Myorder.findByTime", query = "SELECT m FROM Myorder m WHERE m.time = :time"), @NamedQuery(name = "Myorder.findByState", query = "SELECT m FROM Myorder m WHERE m.state = :state"), @NamedQuery(name = "Myorder.findByUser", query = "SELECT m FROM Myorder m WHERE m.userId = :user"), }) public class Myorder implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @NotNull @Column(name = "time") @Temporal(TemporalType.TIMESTAMP) private Date time; @Basic(optional = false) @NotNull @Column(name = "state") private int state; @JoinColumn(name = "user_id", referencedColumnName = "id") @ManyToOne(optional = false) private Myuser userId; @OneToMany(cascade = CascadeType.ALL, mappedBy = "myOrderid") private Collection<OrderItem> orderItemCollection; public Myorder() { } public Myorder(Integer id) { this.id = id; } public Myorder(Integer id, Date time, int state) { this.id = id; this.time = time; this.state = state; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public int getState() { return state; } public void setState(int state) { this.state = state; } public Myuser getUserId() { return userId; } public void setUserId(Myuser userId) { this.userId = userId; } @XmlTransient public Collection<OrderItem> getOrderItemCollection() { return orderItemCollection; } public void setOrderItemCollection(Collection<OrderItem> orderItemCollection) { this.orderItemCollection = orderItemCollection; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Myorder)) { return false; } Myorder other = (Myorder) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "entity.Myorder[ id=" + id + " ]"; } }
UTF-8
Java
3,862
java
Myorder.java
Java
[ { "context": "nd.annotation.XmlTransient;\r\n\r\n/**\r\n *\r\n * @author Beta\r\n */\r\n@Entity\r\n@Table(name = \"myorder\")\r\n@XmlRoot", "end": 1016, "score": 0.9263461232185364, "start": 1012, "tag": "NAME", "value": "Beta" }, { "context": "notation.XmlTransient;\r\n\r\n/**\r\n *\r\n * @author Beta\r\n */\r\n@Entity\r\n@Table(name = \"myorder\")\r\n@XmlRootEl", "end": 1016, "score": 0.3835512697696686, "start": 1016, "tag": "USERNAME", "value": "" } ]
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 entity; import java.io.Serializable; import java.util.Collection; import java.util.Date; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author Beta */ @Entity @Table(name = "myorder") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Myorder.findAll", query = "SELECT m FROM Myorder m"), @NamedQuery(name = "Myorder.findById", query = "SELECT m FROM Myorder m WHERE m.id = :id"), @NamedQuery(name = "Myorder.findByTime", query = "SELECT m FROM Myorder m WHERE m.time = :time"), @NamedQuery(name = "Myorder.findByState", query = "SELECT m FROM Myorder m WHERE m.state = :state"), @NamedQuery(name = "Myorder.findByUser", query = "SELECT m FROM Myorder m WHERE m.userId = :user"), }) public class Myorder implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @NotNull @Column(name = "time") @Temporal(TemporalType.TIMESTAMP) private Date time; @Basic(optional = false) @NotNull @Column(name = "state") private int state; @JoinColumn(name = "user_id", referencedColumnName = "id") @ManyToOne(optional = false) private Myuser userId; @OneToMany(cascade = CascadeType.ALL, mappedBy = "myOrderid") private Collection<OrderItem> orderItemCollection; public Myorder() { } public Myorder(Integer id) { this.id = id; } public Myorder(Integer id, Date time, int state) { this.id = id; this.time = time; this.state = state; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public int getState() { return state; } public void setState(int state) { this.state = state; } public Myuser getUserId() { return userId; } public void setUserId(Myuser userId) { this.userId = userId; } @XmlTransient public Collection<OrderItem> getOrderItemCollection() { return orderItemCollection; } public void setOrderItemCollection(Collection<OrderItem> orderItemCollection) { this.orderItemCollection = orderItemCollection; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Myorder)) { return false; } Myorder other = (Myorder) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "entity.Myorder[ id=" + id + " ]"; } }
3,862
0.67245
0.671673
145
24.634483
23.506071
102
false
false
0
0
0
0
0
0
0.475862
false
false
5
02be5e5483aecb156a4d23f9576d4e9b0d988056
16,217,796,529,248
7f7a4c12f6799f084f15a69ea9789a1e96e4df9c
/Images-In-Game/src/main/java/main/validators/ImageUrlValidator.java
443e822cd25f732ba933798753cb4eb3d68e0956
[]
no_license
Phobossus/RPPluginsEngine
https://github.com/Phobossus/RPPluginsEngine
324d8b18700701aeb8bdd660d7d13f24af8d304a
f853e23d870379fca62351d3d33a43f5280dafc6
refs/heads/master
2021-04-28T08:46:07.467000
2021-04-14T20:41:37
2021-04-14T20:41:37
122,250,314
0
0
null
false
2021-06-15T17:35:16
2018-02-20T20:12:46
2021-06-13T14:44:02
2021-06-15T17:35:16
4,787
0
0
5
Java
false
false
package main.validators; import main.core.exceptions.ImageUrlFormatException; import org.apache.commons.validator.routines.UrlValidator; import javax.naming.SizeLimitExceededException; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.util.regex.Pattern; public class ImageUrlValidator { private static final double MAX_IMAGE_SIZE_MEGABYTES = 2.0; private final Pattern pattern = Pattern.compile("https?://i.imgur.com/\\w+.(jpg|png)"); private UrlValidator urlValidator = new UrlValidator(); public void validateImgurUrl(String url) { if (urlValidator.isValid(url) && pattern.matcher(url).matches()) { return; } throw new ImageUrlFormatException("Image url " + url + "is invalid. Provide direct link " + "from imgur with PNG or JPG extension, i.e https://i.imgur.com/ZqdqhKG.jpg"); } public void validateImageSize(URL url) throws IOException, SizeLimitExceededException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("HEAD"); double imageSizeInMegabytes = connection.getContentLengthLong() / 1024.0 / 1024.0; if (imageSizeInMegabytes > MAX_IMAGE_SIZE_MEGABYTES) { throw new SizeLimitExceededException("Image size too big: " + imageSizeInMegabytes + "MB. Maximum allowed is: " + MAX_IMAGE_SIZE_MEGABYTES + "MB"); } connection.disconnect(); } }
UTF-8
Java
1,491
java
ImageUrlValidator.java
Java
[]
null
[]
package main.validators; import main.core.exceptions.ImageUrlFormatException; import org.apache.commons.validator.routines.UrlValidator; import javax.naming.SizeLimitExceededException; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.util.regex.Pattern; public class ImageUrlValidator { private static final double MAX_IMAGE_SIZE_MEGABYTES = 2.0; private final Pattern pattern = Pattern.compile("https?://i.imgur.com/\\w+.(jpg|png)"); private UrlValidator urlValidator = new UrlValidator(); public void validateImgurUrl(String url) { if (urlValidator.isValid(url) && pattern.matcher(url).matches()) { return; } throw new ImageUrlFormatException("Image url " + url + "is invalid. Provide direct link " + "from imgur with PNG or JPG extension, i.e https://i.imgur.com/ZqdqhKG.jpg"); } public void validateImageSize(URL url) throws IOException, SizeLimitExceededException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("HEAD"); double imageSizeInMegabytes = connection.getContentLengthLong() / 1024.0 / 1024.0; if (imageSizeInMegabytes > MAX_IMAGE_SIZE_MEGABYTES) { throw new SizeLimitExceededException("Image size too big: " + imageSizeInMegabytes + "MB. Maximum allowed is: " + MAX_IMAGE_SIZE_MEGABYTES + "MB"); } connection.disconnect(); } }
1,491
0.709591
0.701543
35
41.599998
37.70805
159
false
false
0
0
0
0
0
0
0.6
false
false
5
a82cecd6426a2a0129e33d3ea1671e8118f131ad
17,592,186,110,758
0292e430ff9a45afc8392a6449ae768a4e02639c
/app/src/main/java/com/jay/english/words/weather/Seasons.java
d6c5335cffefcbb62856e5ae526331aca9056cff
[]
no_license
JaySokirko/English
https://github.com/JaySokirko/English
194717c16f1ab43a61077e7fc9330b97094bc53f
a965561c31b2077524c025814d32b39d37d9f66a
refs/heads/master
2018-07-15T10:39:57.791000
2018-07-14T17:20:43
2018-07-14T17:20:43
126,584,570
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jay.english.words.weather; import android.support.v4.util.ArrayMap; import com.jay.english.R; import com.jay.english.words.Word; import java.util.ArrayList; public class Seasons implements Word { private static Seasons seasons; private ArrayList<String> wordArray = new ArrayList<>(); private ArrayList<String> transcriptionArray = new ArrayList<>(); private ArrayList<String> translateArray = new ArrayList<>(); private ArrayMap<String,Integer> resID = new ArrayMap<>(); private Seasons(){ wordArray.add("January"); transcriptionArray.add("['ʤænju(ə)ri]"); translateArray.add("январь"); resID.put("January", R.raw.january); wordArray.add("February"); transcriptionArray.add("['febru(ə)ri]"); translateArray.add("февраль"); resID.put("February", R.raw.february); wordArray.add("March"); transcriptionArray.add("[ma:ʧ]"); translateArray.add("март"); resID.put("March", R.raw.march); wordArray.add("April"); transcriptionArray.add("[eipr(ə)l]"); translateArray.add("апрель"); resID.put("April", R.raw.april); wordArray.add("May"); transcriptionArray.add("[mei]"); translateArray.add("май"); resID.put("May", R.raw.may); wordArray.add("June"); transcriptionArray.add("[ʤu:n]"); translateArray.add("июнь"); resID.put("June", R.raw.june); wordArray.add("July"); transcriptionArray.add("[ʤu'lai]"); translateArray.add("июль"); resID.put("July", R.raw.july); wordArray.add("August"); transcriptionArray.add("[o:gəst]"); translateArray.add("август"); resID.put("August", R.raw.august); wordArray.add("September"); transcriptionArray.add("[sep'tembə]"); translateArray.add("сентябрь"); resID.put("September", R.raw.september); wordArray.add("October"); transcriptionArray.add("[оk'təubə]"); translateArray.add("октябрь"); resID.put("October", R.raw.october); wordArray.add("November"); transcriptionArray.add("[nəu'vembə]"); translateArray.add("nəu'vembə"); resID.put("November", R.raw.november); wordArray.add("December"); transcriptionArray.add("[di'sembə]"); translateArray.add("декабрь"); resID.put("December", R.raw.december); wordArray.add("autumn"); transcriptionArray.add("[ˈɔːtəm]"); translateArray.add("осень"); resID.put("autumn", R.raw.autumn); wordArray.add("winter"); transcriptionArray.add("[ˈwɪntə(r)]"); translateArray.add("зима"); resID.put("winter", R.raw.winter); wordArray.add("spring"); transcriptionArray.add("[sprɪŋ]"); translateArray.add("весна"); resID.put("spring", R.raw.spring); wordArray.add("summer"); transcriptionArray.add("[ˈsʌmə(r)]"); translateArray.add("лето"); resID.put("summer", R.raw.summer); wordArray.add("quarter"); transcriptionArray.add("[ˈkwɔːtə(r)]"); translateArray.add("квартал"); resID.put("quarter", R.raw.quarter); wordArray.add("monthly"); transcriptionArray.add("[mʌnθli]"); translateArray.add("ежемесячно"); resID.put("monthly", R.raw.monthly); wordArray.add("month"); transcriptionArray.add("[mʌnθ]"); translateArray.add("месяц"); resID.put("month", R.raw.month); wordArray.add("season"); transcriptionArray.add("[ˈsiːzn]"); translateArray.add("сезон"); resID.put("season", R.raw.season); } public static Seasons getSeasons() { if (seasons == null){ seasons = new Seasons(); } return seasons; } public ArrayList<String> getWordArray() { return wordArray; } public ArrayList<String> getTranscriptionArray() { return transcriptionArray; } public ArrayList<String> getTranslateArray() { return translateArray; } public ArrayMap<String, Integer> getResID() { return resID; } }
UTF-8
Java
4,389
java
Seasons.java
Java
[]
null
[]
package com.jay.english.words.weather; import android.support.v4.util.ArrayMap; import com.jay.english.R; import com.jay.english.words.Word; import java.util.ArrayList; public class Seasons implements Word { private static Seasons seasons; private ArrayList<String> wordArray = new ArrayList<>(); private ArrayList<String> transcriptionArray = new ArrayList<>(); private ArrayList<String> translateArray = new ArrayList<>(); private ArrayMap<String,Integer> resID = new ArrayMap<>(); private Seasons(){ wordArray.add("January"); transcriptionArray.add("['ʤænju(ə)ri]"); translateArray.add("январь"); resID.put("January", R.raw.january); wordArray.add("February"); transcriptionArray.add("['febru(ə)ri]"); translateArray.add("февраль"); resID.put("February", R.raw.february); wordArray.add("March"); transcriptionArray.add("[ma:ʧ]"); translateArray.add("март"); resID.put("March", R.raw.march); wordArray.add("April"); transcriptionArray.add("[eipr(ə)l]"); translateArray.add("апрель"); resID.put("April", R.raw.april); wordArray.add("May"); transcriptionArray.add("[mei]"); translateArray.add("май"); resID.put("May", R.raw.may); wordArray.add("June"); transcriptionArray.add("[ʤu:n]"); translateArray.add("июнь"); resID.put("June", R.raw.june); wordArray.add("July"); transcriptionArray.add("[ʤu'lai]"); translateArray.add("июль"); resID.put("July", R.raw.july); wordArray.add("August"); transcriptionArray.add("[o:gəst]"); translateArray.add("август"); resID.put("August", R.raw.august); wordArray.add("September"); transcriptionArray.add("[sep'tembə]"); translateArray.add("сентябрь"); resID.put("September", R.raw.september); wordArray.add("October"); transcriptionArray.add("[оk'təubə]"); translateArray.add("октябрь"); resID.put("October", R.raw.october); wordArray.add("November"); transcriptionArray.add("[nəu'vembə]"); translateArray.add("nəu'vembə"); resID.put("November", R.raw.november); wordArray.add("December"); transcriptionArray.add("[di'sembə]"); translateArray.add("декабрь"); resID.put("December", R.raw.december); wordArray.add("autumn"); transcriptionArray.add("[ˈɔːtəm]"); translateArray.add("осень"); resID.put("autumn", R.raw.autumn); wordArray.add("winter"); transcriptionArray.add("[ˈwɪntə(r)]"); translateArray.add("зима"); resID.put("winter", R.raw.winter); wordArray.add("spring"); transcriptionArray.add("[sprɪŋ]"); translateArray.add("весна"); resID.put("spring", R.raw.spring); wordArray.add("summer"); transcriptionArray.add("[ˈsʌmə(r)]"); translateArray.add("лето"); resID.put("summer", R.raw.summer); wordArray.add("quarter"); transcriptionArray.add("[ˈkwɔːtə(r)]"); translateArray.add("квартал"); resID.put("quarter", R.raw.quarter); wordArray.add("monthly"); transcriptionArray.add("[mʌnθli]"); translateArray.add("ежемесячно"); resID.put("monthly", R.raw.monthly); wordArray.add("month"); transcriptionArray.add("[mʌnθ]"); translateArray.add("месяц"); resID.put("month", R.raw.month); wordArray.add("season"); transcriptionArray.add("[ˈsiːzn]"); translateArray.add("сезон"); resID.put("season", R.raw.season); } public static Seasons getSeasons() { if (seasons == null){ seasons = new Seasons(); } return seasons; } public ArrayList<String> getWordArray() { return wordArray; } public ArrayList<String> getTranscriptionArray() { return transcriptionArray; } public ArrayList<String> getTranslateArray() { return translateArray; } public ArrayMap<String, Integer> getResID() { return resID; } }
4,389
0.596417
0.596181
144
28.458334
18.403229
69
false
false
0
0
0
0
0
0
0.819444
false
false
5
dcc399603f0cd0c237d3f41e59e03ce590548dec
4,715,874,142,984
bb875ef8141e02dcf7b0183ce6f8dfa3e43c0559
/backend/src/main/java/com/parangluv/withmypet/user/repository/UserRepository.java
79deb86ec583f45405792deed7a59b6ba194b44f
[]
no_license
ParangLuv/WMPBackend
https://github.com/ParangLuv/WMPBackend
812670331a02dc3abd535a2d16b49ba78f8a9475
b0a277ad5d0a362ce58e2088c942ba1f51dd5665
refs/heads/master
2021-01-19T09:46:10.870000
2017-04-12T08:41:56
2017-04-12T08:41:56
87,781,392
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.parangluv.withmypet.user.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.parangluv.withmypet.user.domain.User; public interface UserRepository extends JpaRepository<User, Long>{ }
UTF-8
Java
240
java
UserRepository.java
Java
[]
null
[]
package com.parangluv.withmypet.user.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.parangluv.withmypet.user.domain.User; public interface UserRepository extends JpaRepository<User, Long>{ }
240
0.808333
0.808333
8
28
28.315189
66
false
false
0
0
0
0
0
0
0.5
false
false
5
75f95f5aebb8bfe0a9d64fac4963361c8712cfef
17,995,913,038,553
8cd9185de549030fbb36d56c2ac3e4c41cdfa19a
/src/main/java/cq_server/handler/IBanHandler.java
9accdacea038e8e4ec376adddfa1d7c0ea814f57
[]
no_license
naelir/cq_main_server
https://github.com/naelir/cq_main_server
466ff3ece50b0c8ab3fb751d0b3c8d52797df17e
f1647d74f825bc5ff52848304dcb5879b2d580b1
refs/heads/master
2022-09-12T09:06:25.188000
2020-05-31T15:27:13
2020-05-31T15:27:13
105,383,315
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cq_server.handler; import cq_server.model.Player; public interface IBanHandler { void ban(Player player); }
UTF-8
Java
126
java
IBanHandler.java
Java
[]
null
[]
package cq_server.handler; import cq_server.model.Player; public interface IBanHandler { void ban(Player player); }
126
0.730159
0.730159
7
16
13.680017
30
false
false
0
0
0
0
0
0
0.571429
false
false
5
cdb65b5a0068049b33620655870e8633face42e8
17,995,913,040,162
0829e49ab6eee9cfec611011b30f4afa9097748e
/src/main/java/structure/RdbAdditionalElements.java
1838f259082b31d6e6e5a8ae49a1e593cdd96594
[]
no_license
SerhiiKhomych/XMLtoExcel
https://github.com/SerhiiKhomych/XMLtoExcel
f894a30ff6f83656c34990dd2911f7513e10a10b
ad835dbc027c930c9361fefc983afc2478986578
refs/heads/master
2015-07-26T04:06:22
2015-04-01T20:06:57
2015-04-01T20:06:57
33,269,731
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package structure; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import java.util.List; /** * Created by sekh0713 on 11.12.2014. */ public class RdbAdditionalElements implements RdbXmlElement { private RdbCalculableAttributesElement rdbCalcAttributes; private List<RdbChangeTrackerElement> rdbChangeTrackerElements; private List<RdbN2NElement> rdbN2NElements; public RdbAdditionalElements() { } public RdbAdditionalElements(RdbCalculableAttributesElement rdbCalcAttributes, List<RdbChangeTrackerElement> rdbChangeTrackerElements, List<RdbN2NElement> rdbN2NElements) { this.rdbCalcAttributes = rdbCalcAttributes; this.rdbChangeTrackerElements = rdbChangeTrackerElements; this.rdbN2NElements = rdbN2NElements; } public RdbCalculableAttributesElement getRdbCalcAttributes() { return rdbCalcAttributes; } @XmlElement(name = "calc-attributes") public void setRdbCalcAttributes(RdbCalculableAttributesElement rdbCalcAttributes) { this.rdbCalcAttributes = rdbCalcAttributes; } public List<RdbChangeTrackerElement> getRdbChangeTrackerElements() { return rdbChangeTrackerElements; } @XmlElementWrapper(name = "change-trackers") @XmlElement(name = "change-tracker") public void setRdbChangeTrackerElements(List<RdbChangeTrackerElement> rdbChangeTrackerElements) { this.rdbChangeTrackerElements = rdbChangeTrackerElements; } public List<RdbN2NElement> getRdbN2NElements() { return rdbN2NElements; } @XmlElementWrapper(name = "n2n-tables") @XmlElement(name = "n2n-table") public void setRdbN2NElements(List<RdbN2NElement> rdbN2NElements) { this.rdbN2NElements = rdbN2NElements; } }
UTF-8
Java
1,800
java
RdbAdditionalElements.java
Java
[ { "context": "Wrapper;\nimport java.util.List;\n\n/**\n * Created by sekh0713 on 11.12.2014.\n */\npublic class RdbAdditionalElem", "end": 167, "score": 0.9995978474617004, "start": 159, "tag": "USERNAME", "value": "sekh0713" } ]
null
[]
package structure; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import java.util.List; /** * Created by sekh0713 on 11.12.2014. */ public class RdbAdditionalElements implements RdbXmlElement { private RdbCalculableAttributesElement rdbCalcAttributes; private List<RdbChangeTrackerElement> rdbChangeTrackerElements; private List<RdbN2NElement> rdbN2NElements; public RdbAdditionalElements() { } public RdbAdditionalElements(RdbCalculableAttributesElement rdbCalcAttributes, List<RdbChangeTrackerElement> rdbChangeTrackerElements, List<RdbN2NElement> rdbN2NElements) { this.rdbCalcAttributes = rdbCalcAttributes; this.rdbChangeTrackerElements = rdbChangeTrackerElements; this.rdbN2NElements = rdbN2NElements; } public RdbCalculableAttributesElement getRdbCalcAttributes() { return rdbCalcAttributes; } @XmlElement(name = "calc-attributes") public void setRdbCalcAttributes(RdbCalculableAttributesElement rdbCalcAttributes) { this.rdbCalcAttributes = rdbCalcAttributes; } public List<RdbChangeTrackerElement> getRdbChangeTrackerElements() { return rdbChangeTrackerElements; } @XmlElementWrapper(name = "change-trackers") @XmlElement(name = "change-tracker") public void setRdbChangeTrackerElements(List<RdbChangeTrackerElement> rdbChangeTrackerElements) { this.rdbChangeTrackerElements = rdbChangeTrackerElements; } public List<RdbN2NElement> getRdbN2NElements() { return rdbN2NElements; } @XmlElementWrapper(name = "n2n-tables") @XmlElement(name = "n2n-table") public void setRdbN2NElements(List<RdbN2NElement> rdbN2NElements) { this.rdbN2NElements = rdbN2NElements; } }
1,800
0.761111
0.745556
51
34.294117
33.881161
176
false
false
0
0
0
0
0
0
0.352941
false
false
5
f1f1c2037bc586f585bfa65777b88bb95771f640
22,144,851,440,604
25bcc3c7c42e039dff22f62480cddd483d3389f8
/src/com/ict06/Thread/Ex14.java
324848398b314c7b3a0997aa819578fc72182fea
[]
no_license
kkhyunn/java.project
https://github.com/kkhyunn/java.project
ba0bc664b8da011c43388cac4f5bd5143eee591a
41a6d781048a3484d1e182c632517d25a1268ea9
refs/heads/master
2023-04-27T13:33:17.100000
2021-05-18T07:45:57
2021-05-18T07:45:57
354,701,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ict06.Thread; public class Ex14 implements Runnable{ // 동기화 처리할 때 실행중인 스레드를 강제로 대기상태로 변경시키는 // 메소드를 wait()이라고 한다. // 한번 wait()된 스레드는 풀어주지 않으면 그대로 대기 상태에서 프로그램이 종료된다. // wait()된 스레드를 풀어주는 메소드를 notify(), notifyAll()이라고 한다. int x = 0; @Override public synchronized void run() { for (int i = 0; i < 50; i++) { System.out.println(Thread.currentThread().getName() + " : " + (++x)); if (x == 25) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } else { notify(); } } } }
UHC
Java
730
java
Ex14.java
Java
[]
null
[]
package com.ict06.Thread; public class Ex14 implements Runnable{ // 동기화 처리할 때 실행중인 스레드를 강제로 대기상태로 변경시키는 // 메소드를 wait()이라고 한다. // 한번 wait()된 스레드는 풀어주지 않으면 그대로 대기 상태에서 프로그램이 종료된다. // wait()된 스레드를 풀어주는 메소드를 notify(), notifyAll()이라고 한다. int x = 0; @Override public synchronized void run() { for (int i = 0; i < 50; i++) { System.out.println(Thread.currentThread().getName() + " : " + (++x)); if (x == 25) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } else { notify(); } } } }
730
0.584532
0.566547
25
21.24
19.096136
73
false
false
0
0
0
0
0
0
2.44
false
false
5
1298cef6d24ba7baea8d01b9dccc707975ba485b
20,736,102,162,067
ed1189fc9060e086679d953723fb1895d77d21a2
/java/FarmOptimize/FarmOptimize.java
fd84e4ddb8c4e7d5ede87ae4c0a082d3b6da28f3
[]
no_license
aksource/FarmOptimize
https://github.com/aksource/FarmOptimize
7597b40c4d417c1e9e549c7cdf5c523546ffc656
8da6cf3a2582bc85f3fc5aa81b15d75a0c880bc4
refs/heads/master
2021-01-17T15:06:23.339000
2014-08-05T15:32:29
2014-08-05T15:32:29
17,110,728
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FarmOptimize; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.event.entity.player.BonemealEvent; @Mod(modid="FarmOptimize", name="FarmOptimize", version="@VERSION@",dependencies="required-after:FML", useMetadata = true) public class FarmOptimize { @Mod.Instance("FarmOptimize") public static FarmOptimize instance; // public static int SugarcaneSpeed; // public static int SugarcaneLimit; public static boolean SugarcaneGrowWater; public static boolean SugarcaneUsefulBonemeal; public static int SugarcaneUsedBonemealLimit; // public static int CactusSpeed; // public static int CactusLimit; public static boolean CactusUsefulBonemeal; public static int CactusUsedBonemealLimit; // public static int growSpeedPunpkin; // public static int growSpeedWaterMelon; // public static int growSpeedCrops; // public static int growSpeedCarrot; // public static int growSpeedPotato; // public static int growSpeedSapling; // public static int MushroomSpeed; // public static int MushroomLimit; // public static byte MushroomArea; // public static int growSpeedNetherWart; // public static int growSpeedCocoa; // public static int growSpeedVine; // public static Block reed; // public static Block cactus; // public static Block pumpkinStem; // public static Block melonStem; // public static Block crops; // public static Block carrot; // public static Block potato; // public static Block sapling; // public static Block mushroomBrown; // public static Block mushroomRed; // public static Block netherStalk; // public static Block cocoaPlant; // public static Block vine; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); // SugarcaneSpeed = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneSpeed", 15, "0:noWait 15:default, min = 0, max = 15").getInt(); // SugarcaneSpeed = (SugarcaneSpeed < 0) ? 0: (SugarcaneSpeed > 15)? 15:SugarcaneSpeed; // SugarcaneLimit = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneLimit", 3, "min = 1, max = 250").getInt(); // SugarcaneLimit = (SugarcaneLimit < 1) ? 1: (SugarcaneLimit > 250)?250:SugarcaneLimit; SugarcaneGrowWater = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneGrowWater", false).getBoolean(false); SugarcaneUsefulBonemeal = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneUsefulBonemeal", false).getBoolean(false); SugarcaneUsedBonemealLimit = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneUsedBonemealLimit", 3, "min = 1, max = 250").getInt(); SugarcaneUsedBonemealLimit = (SugarcaneUsedBonemealLimit <1)?1:(SugarcaneUsedBonemealLimit >250)?250:SugarcaneUsedBonemealLimit; // CactusSpeed = config.get(Configuration.CATEGORY_GENERAL, "CactusSpeed", 15, "0:noWait 15:default, min = 0, max = 15").getInt(); // CactusSpeed = (CactusSpeed <0)?0:(CactusSpeed>15)?15:CactusSpeed; // CactusLimit = config.get(Configuration.CATEGORY_GENERAL, "CactusLimit", 3, "min = 1, max = 250").getInt(); // CactusLimit = (CactusLimit < 1) ? 1: (CactusLimit > 250)?250:CactusLimit; CactusUsefulBonemeal = config.get(Configuration.CATEGORY_GENERAL, "CactusUsefulBonemeal", false).getBoolean(false); CactusUsedBonemealLimit = config.get(Configuration.CATEGORY_GENERAL, "CactusUsedBonemealLimit", 3, "min = 1, max = 250").getInt(); CactusUsedBonemealLimit = (CactusUsedBonemealLimit < 1) ? 1: (CactusUsedBonemealLimit > 250)?250:CactusUsedBonemealLimit; // growSpeedPunpkin = config.get(Configuration.CATEGORY_GENERAL, "growSpeedPumpkin", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedPunpkin = (growSpeedPunpkin <0)?0:(growSpeedPunpkin>100)?100:growSpeedPunpkin; // growSpeedWaterMelon = config.get(Configuration.CATEGORY_GENERAL, "growSpeedWaterMelon", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedWaterMelon = (growSpeedWaterMelon <0)?0:(growSpeedWaterMelon>100)?100:growSpeedWaterMelon; // growSpeedCrops = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCrops", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedCrops = (growSpeedCrops <0)?0:(growSpeedCrops>100)?100:growSpeedCrops; // growSpeedCarrot = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCarrot", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedCarrot = (growSpeedCarrot <0)?0:(growSpeedCarrot>100)?100:growSpeedCarrot; // growSpeedPotato = config.get(Configuration.CATEGORY_GENERAL, "growSpeedPotato", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedPotato = (growSpeedPotato <0)?0:(growSpeedPotato>100)?100:growSpeedPotato; // growSpeedSapling = config.get(Configuration.CATEGORY_GENERAL, "growSpeedSapling", 7, "0:noWait 1:fast 100:default, min = 0, max = 7").getInt(); // growSpeedSapling = (growSpeedSapling <0)?0:(growSpeedSapling>7)?7:growSpeedSapling; // MushroomSpeed = config.get(Configuration.CATEGORY_GENERAL, "MushroomSpeed", 25, "0:noWait 1:fast 100:default, min = 0, max = 25").getInt(); // MushroomSpeed = (MushroomSpeed <0)?0:(MushroomSpeed>25)?25:MushroomSpeed; // MushroomLimit = config.get(Configuration.CATEGORY_GENERAL, "MushroomLimit", 5, "area in mushroomLimit 5:default, min = 1, max = 81").getInt(); // MushroomLimit = (MushroomLimit <1)?1:(MushroomLimit>81)?81:MushroomLimit; // MushroomArea = (byte) config.get(Configuration.CATEGORY_GENERAL, "MushroomArea", 4, "mushroom search area 4:default, min = 0, max = 4").getInt(); // MushroomArea = (MushroomArea <0)?0:(MushroomArea>4)?4:MushroomArea; // growSpeedNetherWart = config.get(Configuration.CATEGORY_GENERAL, "growSpeedNetherWart", 10, "0:noWait 1:fast 100:default, min = 0, max = 10").getInt(); // growSpeedNetherWart = (growSpeedNetherWart <0)?0:(growSpeedNetherWart>10)?10:growSpeedNetherWart; // growSpeedCocoa = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCocoa", 5, "0:noWait 1:fast 100:default, min = 0, max = 5").getInt(); // growSpeedCocoa = (growSpeedCocoa <0)?0:(growSpeedCocoa>5)?5:growSpeedCocoa; // growSpeedVine = config.get(Configuration.CATEGORY_GENERAL, "growSpeedVine", 4, "0:noWait 4:default -1:noGrow, min = -1, max = 64").getInt(); // growSpeedVine = (growSpeedVine <-1)?-1:(growSpeedVine>64)?64:growSpeedVine; config.save(); // if(SugarcaneSpeed != 15 || SugarcaneLimit != 3 || SugarcaneUsefulBonemeal || SugarcaneGrowWater) // { // reed = (new foBlockReed()).setHardness(0.0F).setStepSound(Block.soundTypeGrass).setBlockName("reeds").setBlockTextureName("reeds"); // if(SugarcaneUsefulBonemeal) MinecraftForge.EVENT_BUS.register((foBlockReed)reed); // GameRegistry.registerBlock(reed, null, "reeds", "minecraft"); // } // // if(CactusSpeed != 15 || CactusLimit != 3 || CactusUsefulBonemeal) // { // cactus = (new foBlockCactus()).setHardness(0.4F).setStepSound(Block.soundTypeCloth).setBlockName("cactus").setBlockTextureName("cactus"); // if(CactusUsefulBonemeal) MinecraftForge.EVENT_BUS.register((foBlockCactus)cactus); // GameRegistry.registerBlock(cactus, null, "cactus", "minecraft"); // } // // if(growSpeedPumpkin != 100) // { // pumpkinStem = (new foBlockStem(Blocks.pumpkin)).setHardness(0.0F).setStepSound(Block.soundTypeWood).setBlockName("pumpkinStem").setBlockTextureName("melon_stem"); // GameRegistry.registerBlock(pumpkinStem, null, "pumpkin_stem", "minecraft"); // } // // if(growSpeedWaterMelon != 100) // { // melonStem = (new foBlockStem(Blocks.melon_block)).setHardness(0.0F).setStepSound(Block.soundTypeWood).setBlockName("pumpkinStem").setBlockTextureName("pumpkin_stem"); // GameRegistry.registerBlock(melonStem, null, "melon_stem", "minecraft"); // } // // if(growSpeedCrops != 100) // { // crops = (new foBlockCrops()).setBlockName("crops").setBlockTextureName("wheat"); // GameRegistry.registerBlock(crops, null, "wheat", "minecraft"); // } // // if(growSpeedCarrot != 100) // { // carrot = (new foBlockCarrot()).setBlockName("carrots").setBlockTextureName("carrots"); // GameRegistry.registerBlock(carrot, null, "carrots", "minecraft"); // } // // if(growSpeedPotato != 100) // { // potato = (new foBlockPotato()).setBlockName("potatoes").setBlockTextureName("potatoes"); // GameRegistry.registerBlock(potato, null, "potatoes", "minecraft"); // } // // if(growSpeedSapling != 7) // { // sapling = (new foBlockSapling()).setHardness(0.0F).setStepSound(Block.soundTypeGlass).setBlockName("sapling").setBlockTextureName("sapling"); // GameRegistry.registerBlock(sapling, null, "sapling", "minecraft"); // } // // if(MushroomSpeed != 25 || MushroomLimit != 5 || MushroomArea != 4) // { // mushroomBrown = (new foBlockMushroom()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setLightLevel(0.125F).setBlockName("mushroom").setBlockTextureName("mushroom_brown"); // mushroomRed = (new foBlockMushroom()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setBlockName("mushroom").setBlockTextureName("mushroom_red"); // GameRegistry.registerBlock(mushroomBrown, null, "brown_mushroom", "minecraft"); // GameRegistry.registerBlock(mushroomRed, null, "red_mushroom", "minecraft"); // } // // if(growSpeedNetherWart != 10) // { // netherStalk = (new foBlockNetherStalk()).setBlockName("netherStalk").setBlockTextureName("nether_wart"); // GameRegistry.registerBlock(netherStalk, null, "nether_wart","minecraft"); // } // // if(growSpeedCocoa != 5) // { // cocoaPlant = (new foBlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("cocoa").setBlockTextureName("cocoa"); // GameRegistry.registerBlock(cocoaPlant, null, "cocoa", "minecraft"); // } // // if(growSpeedVine != 4) // { // vine = (new foBlockVine()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setBlockName("vine").setBlockTextureName("vine"); // GameRegistry.registerBlock(vine, null, "vine", "minecraft"); // } } @Mod.EventHandler public void load(FMLInitializationEvent event) { if(SugarcaneUsefulBonemeal || SugarcaneGrowWater) { if(SugarcaneUsefulBonemeal) MinecraftForge.EVENT_BUS.register(this); } if(CactusUsefulBonemeal) { if(CactusUsefulBonemeal) MinecraftForge.EVENT_BUS.register(this); } } @SubscribeEvent public void useBonemealToReeds(BonemealEvent event) { if(!event.world.isRemote && event.block == Blocks.reeds && Blocks.reeds.canBlockStay(event.world, event.x, event.y, event.z)) { int size; for (size = event.y; Blocks.reeds.canBlockStay(event.world, event.x, size, event.z); --size) { ; } int min = size + 1; int top = 0; for (size = min; (size - min + 1) < FarmOptimize.SugarcaneUsedBonemealLimit; size++) { if(isGrow(event.world, event.x, size, event.z)) { event.world.setBlock(event.x, size + 1, event.z, Blocks.reeds,0,3); top++; } } if(top > 0) { event.setResult(Event.Result.ALLOW); } } if(!event.world.isRemote && event.block == Blocks.cactus && Blocks.cactus.canBlockStay(event.world, event.x, event.y, event.z)) { int size; for (size = event.y; Blocks.cactus.canBlockStay(event.world, event.x, size, event.z); --size) { ; } int min = size + 1; int top = 0; for (size = min; (size - min + 1) < FarmOptimize.CactusUsedBonemealLimit; size++) { if(event.world.isAirBlock(event.x, size + 1, event.z)) { event.world.setBlock(event.x, size + 1, event.z, Blocks.cactus,0,3); top++; } } if(top > 0) { event.setResult(Event.Result.ALLOW); } } } private boolean isGrow(World par1World, int par2, int par3, int par4) { return par1World.isAirBlock(par2, par3 + 1, par4) || FarmOptimize.SugarcaneGrowWater && par1World.getBlock(par2, par3 + 1, par4).getMaterial().equals(Material.water); } }
UTF-8
Java
12,888
java
FarmOptimize.java
Java
[]
null
[]
package FarmOptimize; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.event.entity.player.BonemealEvent; @Mod(modid="FarmOptimize", name="FarmOptimize", version="@VERSION@",dependencies="required-after:FML", useMetadata = true) public class FarmOptimize { @Mod.Instance("FarmOptimize") public static FarmOptimize instance; // public static int SugarcaneSpeed; // public static int SugarcaneLimit; public static boolean SugarcaneGrowWater; public static boolean SugarcaneUsefulBonemeal; public static int SugarcaneUsedBonemealLimit; // public static int CactusSpeed; // public static int CactusLimit; public static boolean CactusUsefulBonemeal; public static int CactusUsedBonemealLimit; // public static int growSpeedPunpkin; // public static int growSpeedWaterMelon; // public static int growSpeedCrops; // public static int growSpeedCarrot; // public static int growSpeedPotato; // public static int growSpeedSapling; // public static int MushroomSpeed; // public static int MushroomLimit; // public static byte MushroomArea; // public static int growSpeedNetherWart; // public static int growSpeedCocoa; // public static int growSpeedVine; // public static Block reed; // public static Block cactus; // public static Block pumpkinStem; // public static Block melonStem; // public static Block crops; // public static Block carrot; // public static Block potato; // public static Block sapling; // public static Block mushroomBrown; // public static Block mushroomRed; // public static Block netherStalk; // public static Block cocoaPlant; // public static Block vine; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); // SugarcaneSpeed = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneSpeed", 15, "0:noWait 15:default, min = 0, max = 15").getInt(); // SugarcaneSpeed = (SugarcaneSpeed < 0) ? 0: (SugarcaneSpeed > 15)? 15:SugarcaneSpeed; // SugarcaneLimit = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneLimit", 3, "min = 1, max = 250").getInt(); // SugarcaneLimit = (SugarcaneLimit < 1) ? 1: (SugarcaneLimit > 250)?250:SugarcaneLimit; SugarcaneGrowWater = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneGrowWater", false).getBoolean(false); SugarcaneUsefulBonemeal = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneUsefulBonemeal", false).getBoolean(false); SugarcaneUsedBonemealLimit = config.get(Configuration.CATEGORY_GENERAL, "SugarcaneUsedBonemealLimit", 3, "min = 1, max = 250").getInt(); SugarcaneUsedBonemealLimit = (SugarcaneUsedBonemealLimit <1)?1:(SugarcaneUsedBonemealLimit >250)?250:SugarcaneUsedBonemealLimit; // CactusSpeed = config.get(Configuration.CATEGORY_GENERAL, "CactusSpeed", 15, "0:noWait 15:default, min = 0, max = 15").getInt(); // CactusSpeed = (CactusSpeed <0)?0:(CactusSpeed>15)?15:CactusSpeed; // CactusLimit = config.get(Configuration.CATEGORY_GENERAL, "CactusLimit", 3, "min = 1, max = 250").getInt(); // CactusLimit = (CactusLimit < 1) ? 1: (CactusLimit > 250)?250:CactusLimit; CactusUsefulBonemeal = config.get(Configuration.CATEGORY_GENERAL, "CactusUsefulBonemeal", false).getBoolean(false); CactusUsedBonemealLimit = config.get(Configuration.CATEGORY_GENERAL, "CactusUsedBonemealLimit", 3, "min = 1, max = 250").getInt(); CactusUsedBonemealLimit = (CactusUsedBonemealLimit < 1) ? 1: (CactusUsedBonemealLimit > 250)?250:CactusUsedBonemealLimit; // growSpeedPunpkin = config.get(Configuration.CATEGORY_GENERAL, "growSpeedPumpkin", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedPunpkin = (growSpeedPunpkin <0)?0:(growSpeedPunpkin>100)?100:growSpeedPunpkin; // growSpeedWaterMelon = config.get(Configuration.CATEGORY_GENERAL, "growSpeedWaterMelon", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedWaterMelon = (growSpeedWaterMelon <0)?0:(growSpeedWaterMelon>100)?100:growSpeedWaterMelon; // growSpeedCrops = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCrops", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedCrops = (growSpeedCrops <0)?0:(growSpeedCrops>100)?100:growSpeedCrops; // growSpeedCarrot = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCarrot", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedCarrot = (growSpeedCarrot <0)?0:(growSpeedCarrot>100)?100:growSpeedCarrot; // growSpeedPotato = config.get(Configuration.CATEGORY_GENERAL, "growSpeedPotato", 100, "0:noWait 1:fast 100:default, min = 0, max = 100").getInt(); // growSpeedPotato = (growSpeedPotato <0)?0:(growSpeedPotato>100)?100:growSpeedPotato; // growSpeedSapling = config.get(Configuration.CATEGORY_GENERAL, "growSpeedSapling", 7, "0:noWait 1:fast 100:default, min = 0, max = 7").getInt(); // growSpeedSapling = (growSpeedSapling <0)?0:(growSpeedSapling>7)?7:growSpeedSapling; // MushroomSpeed = config.get(Configuration.CATEGORY_GENERAL, "MushroomSpeed", 25, "0:noWait 1:fast 100:default, min = 0, max = 25").getInt(); // MushroomSpeed = (MushroomSpeed <0)?0:(MushroomSpeed>25)?25:MushroomSpeed; // MushroomLimit = config.get(Configuration.CATEGORY_GENERAL, "MushroomLimit", 5, "area in mushroomLimit 5:default, min = 1, max = 81").getInt(); // MushroomLimit = (MushroomLimit <1)?1:(MushroomLimit>81)?81:MushroomLimit; // MushroomArea = (byte) config.get(Configuration.CATEGORY_GENERAL, "MushroomArea", 4, "mushroom search area 4:default, min = 0, max = 4").getInt(); // MushroomArea = (MushroomArea <0)?0:(MushroomArea>4)?4:MushroomArea; // growSpeedNetherWart = config.get(Configuration.CATEGORY_GENERAL, "growSpeedNetherWart", 10, "0:noWait 1:fast 100:default, min = 0, max = 10").getInt(); // growSpeedNetherWart = (growSpeedNetherWart <0)?0:(growSpeedNetherWart>10)?10:growSpeedNetherWart; // growSpeedCocoa = config.get(Configuration.CATEGORY_GENERAL, "growSpeedCocoa", 5, "0:noWait 1:fast 100:default, min = 0, max = 5").getInt(); // growSpeedCocoa = (growSpeedCocoa <0)?0:(growSpeedCocoa>5)?5:growSpeedCocoa; // growSpeedVine = config.get(Configuration.CATEGORY_GENERAL, "growSpeedVine", 4, "0:noWait 4:default -1:noGrow, min = -1, max = 64").getInt(); // growSpeedVine = (growSpeedVine <-1)?-1:(growSpeedVine>64)?64:growSpeedVine; config.save(); // if(SugarcaneSpeed != 15 || SugarcaneLimit != 3 || SugarcaneUsefulBonemeal || SugarcaneGrowWater) // { // reed = (new foBlockReed()).setHardness(0.0F).setStepSound(Block.soundTypeGrass).setBlockName("reeds").setBlockTextureName("reeds"); // if(SugarcaneUsefulBonemeal) MinecraftForge.EVENT_BUS.register((foBlockReed)reed); // GameRegistry.registerBlock(reed, null, "reeds", "minecraft"); // } // // if(CactusSpeed != 15 || CactusLimit != 3 || CactusUsefulBonemeal) // { // cactus = (new foBlockCactus()).setHardness(0.4F).setStepSound(Block.soundTypeCloth).setBlockName("cactus").setBlockTextureName("cactus"); // if(CactusUsefulBonemeal) MinecraftForge.EVENT_BUS.register((foBlockCactus)cactus); // GameRegistry.registerBlock(cactus, null, "cactus", "minecraft"); // } // // if(growSpeedPumpkin != 100) // { // pumpkinStem = (new foBlockStem(Blocks.pumpkin)).setHardness(0.0F).setStepSound(Block.soundTypeWood).setBlockName("pumpkinStem").setBlockTextureName("melon_stem"); // GameRegistry.registerBlock(pumpkinStem, null, "pumpkin_stem", "minecraft"); // } // // if(growSpeedWaterMelon != 100) // { // melonStem = (new foBlockStem(Blocks.melon_block)).setHardness(0.0F).setStepSound(Block.soundTypeWood).setBlockName("pumpkinStem").setBlockTextureName("pumpkin_stem"); // GameRegistry.registerBlock(melonStem, null, "melon_stem", "minecraft"); // } // // if(growSpeedCrops != 100) // { // crops = (new foBlockCrops()).setBlockName("crops").setBlockTextureName("wheat"); // GameRegistry.registerBlock(crops, null, "wheat", "minecraft"); // } // // if(growSpeedCarrot != 100) // { // carrot = (new foBlockCarrot()).setBlockName("carrots").setBlockTextureName("carrots"); // GameRegistry.registerBlock(carrot, null, "carrots", "minecraft"); // } // // if(growSpeedPotato != 100) // { // potato = (new foBlockPotato()).setBlockName("potatoes").setBlockTextureName("potatoes"); // GameRegistry.registerBlock(potato, null, "potatoes", "minecraft"); // } // // if(growSpeedSapling != 7) // { // sapling = (new foBlockSapling()).setHardness(0.0F).setStepSound(Block.soundTypeGlass).setBlockName("sapling").setBlockTextureName("sapling"); // GameRegistry.registerBlock(sapling, null, "sapling", "minecraft"); // } // // if(MushroomSpeed != 25 || MushroomLimit != 5 || MushroomArea != 4) // { // mushroomBrown = (new foBlockMushroom()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setLightLevel(0.125F).setBlockName("mushroom").setBlockTextureName("mushroom_brown"); // mushroomRed = (new foBlockMushroom()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setBlockName("mushroom").setBlockTextureName("mushroom_red"); // GameRegistry.registerBlock(mushroomBrown, null, "brown_mushroom", "minecraft"); // GameRegistry.registerBlock(mushroomRed, null, "red_mushroom", "minecraft"); // } // // if(growSpeedNetherWart != 10) // { // netherStalk = (new foBlockNetherStalk()).setBlockName("netherStalk").setBlockTextureName("nether_wart"); // GameRegistry.registerBlock(netherStalk, null, "nether_wart","minecraft"); // } // // if(growSpeedCocoa != 5) // { // cocoaPlant = (new foBlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("cocoa").setBlockTextureName("cocoa"); // GameRegistry.registerBlock(cocoaPlant, null, "cocoa", "minecraft"); // } // // if(growSpeedVine != 4) // { // vine = (new foBlockVine()).setHardness(0.2F).setStepSound(Block.soundTypeGrass).setBlockName("vine").setBlockTextureName("vine"); // GameRegistry.registerBlock(vine, null, "vine", "minecraft"); // } } @Mod.EventHandler public void load(FMLInitializationEvent event) { if(SugarcaneUsefulBonemeal || SugarcaneGrowWater) { if(SugarcaneUsefulBonemeal) MinecraftForge.EVENT_BUS.register(this); } if(CactusUsefulBonemeal) { if(CactusUsefulBonemeal) MinecraftForge.EVENT_BUS.register(this); } } @SubscribeEvent public void useBonemealToReeds(BonemealEvent event) { if(!event.world.isRemote && event.block == Blocks.reeds && Blocks.reeds.canBlockStay(event.world, event.x, event.y, event.z)) { int size; for (size = event.y; Blocks.reeds.canBlockStay(event.world, event.x, size, event.z); --size) { ; } int min = size + 1; int top = 0; for (size = min; (size - min + 1) < FarmOptimize.SugarcaneUsedBonemealLimit; size++) { if(isGrow(event.world, event.x, size, event.z)) { event.world.setBlock(event.x, size + 1, event.z, Blocks.reeds,0,3); top++; } } if(top > 0) { event.setResult(Event.Result.ALLOW); } } if(!event.world.isRemote && event.block == Blocks.cactus && Blocks.cactus.canBlockStay(event.world, event.x, event.y, event.z)) { int size; for (size = event.y; Blocks.cactus.canBlockStay(event.world, event.x, size, event.z); --size) { ; } int min = size + 1; int top = 0; for (size = min; (size - min + 1) < FarmOptimize.CactusUsedBonemealLimit; size++) { if(event.world.isAirBlock(event.x, size + 1, event.z)) { event.world.setBlock(event.x, size + 1, event.z, Blocks.cactus,0,3); top++; } } if(top > 0) { event.setResult(Event.Result.ALLOW); } } } private boolean isGrow(World par1World, int par2, int par3, int par4) { return par1World.isAirBlock(par2, par3 + 1, par4) || FarmOptimize.SugarcaneGrowWater && par1World.getBlock(par2, par3 + 1, par4).getMaterial().equals(Material.water); } }
12,888
0.692117
0.664882
247
51.182186
47.519814
183
false
false
0
0
0
0
0
0
2.40081
false
false
5
eb2af17abd43f16ab8417baa4a9910f171d67654
19,181,323,972,815
abf5033238b3f7a3afed2077982d6f0680b1efa7
/mobile/src/main/java/net/volcanomobile/vgmplayer/ui/player/MediaFolderViewHolder.java
59fac1580231b26a11c8cfb86a1781aa84ec6c12
[ "Unlicense" ]
permissive
VolcanoMobile/vgm-player
https://github.com/VolcanoMobile/vgm-player
790ad76f9437f31e83426a1513f7612b421a26c5
4498f9cce5caeb93ae59d9794564c535d3a0fcdd
refs/heads/master
2021-01-21T11:16:22.288000
2019-05-09T20:31:21
2019-05-09T20:31:21
83,544,304
6
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.volcanomobile.vgmplayer.ui.player; import android.support.v4.app.FragmentActivity; import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaDescriptionCompat; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import net.volcanomobile.vgmplayer.R; /** * Created by philippesimons on 9/02/17. */ class MediaFolderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private final MediaBrowserFragment.MediaFragmentListener mListener; private final FragmentActivity mActivity; private final View mRootView; private final TextView mTitleView; private MediaBrowserCompat.MediaItem mBoundItem; MediaFolderViewHolder(View itemView, FragmentActivity activity, MediaBrowserFragment.MediaFragmentListener listener) { super(itemView); mActivity = activity; mListener = listener; mRootView = itemView; mTitleView = (TextView) itemView.findViewById(R.id.title); mRootView.setOnClickListener(this); } void bind(MediaBrowserCompat.MediaItem item) { mBoundItem = item; MediaDescriptionCompat description = item.getDescription(); mTitleView.setText(description.getTitle()); } @Override public void onClick(View v) { if (mBoundItem != null) { mListener.onMediaItemSelected(mBoundItem); } } }
UTF-8
Java
1,495
java
MediaFolderViewHolder.java
Java
[ { "context": " net.volcanomobile.vgmplayer.R;\n\n/**\n * Created by philippesimons on 9/02/17.\n */\n\nclass MediaFolderViewHolder exte", "end": 381, "score": 0.9994757771492004, "start": 367, "tag": "USERNAME", "value": "philippesimons" } ]
null
[]
package net.volcanomobile.vgmplayer.ui.player; import android.support.v4.app.FragmentActivity; import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaDescriptionCompat; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import net.volcanomobile.vgmplayer.R; /** * Created by philippesimons on 9/02/17. */ class MediaFolderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private final MediaBrowserFragment.MediaFragmentListener mListener; private final FragmentActivity mActivity; private final View mRootView; private final TextView mTitleView; private MediaBrowserCompat.MediaItem mBoundItem; MediaFolderViewHolder(View itemView, FragmentActivity activity, MediaBrowserFragment.MediaFragmentListener listener) { super(itemView); mActivity = activity; mListener = listener; mRootView = itemView; mTitleView = (TextView) itemView.findViewById(R.id.title); mRootView.setOnClickListener(this); } void bind(MediaBrowserCompat.MediaItem item) { mBoundItem = item; MediaDescriptionCompat description = item.getDescription(); mTitleView.setText(description.getTitle()); } @Override public void onClick(View v) { if (mBoundItem != null) { mListener.onMediaItemSelected(mBoundItem); } } }
1,495
0.72107
0.71505
53
27.207546
24.087387
80
false
false
0
0
0
0
0
0
0.471698
false
false
5
cb0b9977bb7febfae2176c0930ce7a212ce55875
32,916,629,408,554
424214a06373b83cbf34a00f7135beab5197d65a
/sample/sample-common/src/main/java/com/sample/common/patterns/creational/builder/PizzaCrust.java
5e82036d10c5b7126fdabc8e446a07de91fb0449
[]
no_license
debangshud/Java
https://github.com/debangshud/Java
08dde50bca7535fcbfb3bc8af3119b211877c254
6e2fe66a2ceb641befc63a8685605aedff11d7e4
refs/heads/master
2016-09-13T21:42:28.918000
2016-04-30T02:16:25
2016-04-30T02:16:25
57,421,557
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sample.common.patterns.creational.builder; public enum PizzaCrust { THIN, FLAT_BREAD, THICK, FOCACCIA }
UTF-8
Java
123
java
PizzaCrust.java
Java
[]
null
[]
package com.sample.common.patterns.creational.builder; public enum PizzaCrust { THIN, FLAT_BREAD, THICK, FOCACCIA }
123
0.756098
0.756098
5
22.6
20.470467
54
false
false
0
0
0
0
0
0
1
false
false
5
281c03ab863448e5ca6bfdd0c525e57a0527045d
8,890,582,332,952
7d0aa14c3aa2328a959e69f8bbc5786a37112617
/Fuse/qlack2-fuse-settings/qlack2-fuse-settings-impl/src/test/java/com/eurodyn/qlack2/fuse/settings/impl/SettingsServiceImplTest.java
f6460d7bfe6a83b856fd6a065e228b67b827b44e
[]
no_license
clebesis/Qlack2
https://github.com/clebesis/Qlack2
c72e8b71cd91055560c7356b491cf96d93a4d8e5
50b9d4518c691e79fd0ceb49fcc46c903d2813df
refs/heads/master
2020-12-06T19:16:38.120000
2017-06-28T15:03:02
2017-06-28T15:03:02
86,799,589
0
0
null
true
2017-03-31T09:01:00
2017-03-31T09:01:00
2017-03-17T12:27:55
2017-03-17T12:25:54
84,538
0
0
0
null
null
null
/** * */ package com.eurodyn.qlack2.fuse.settings.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.sql.Connection; import java.util.List; import java.util.UUID; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import org.hibernate.Session; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.eurodyn.qlack2.fuse.settings.api.dto.GroupDTO; import com.eurodyn.qlack2.fuse.settings.api.dto.SettingDTO; import com.eurodyn.qlack2.fuse.settings.impl.model.QSetting; import com.eurodyn.qlack2.fuse.settings.impl.model.Setting; import com.querydsl.jpa.impl.JPAQueryFactory; import liquibase.Contexts; import liquibase.LabelExpression; import liquibase.Liquibase; import liquibase.database.Database; import liquibase.database.DatabaseFactory; import liquibase.database.jvm.JdbcConnection; import liquibase.resource.ClassLoaderResourceAccessor; /** * @author European Dynamics SA * */ public class SettingsServiceImplTest { private static EntityManagerFactory emf; private static EntityManager em; private static SettingsServiceImpl settingService; private static EntityTransaction tx; /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { // Create the Entity Manager Factory. emf = Persistence.createEntityManagerFactory("fuse-settings"); // Run Liquibase. em = emf.createEntityManager(); Session session = (Session) em.getDelegate(); SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory(); ConnectionProvider cp = sfi.getConnectionProvider(); Connection connection = cp.getConnection(); Database database = DatabaseFactory.getInstance() .findCorrectDatabaseImplementation(new JdbcConnection(connection)); Liquibase liquibase = new Liquibase("db/qlack2-fuse-settings-impl.liquibase.changelog.xml", new ClassLoaderResourceAccessor(), database); liquibase.update(new Contexts(), new LabelExpression()); // Create an instance of the service to be tested. settingService = new SettingsServiceImpl(); settingService.setEm(em); } /** * @throws java.lang.Exception */ @AfterClass public static void tearDownAfterClass() throws Exception { em.close(); emf.close(); } /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { if (tx == null) { tx = em.getTransaction(); } tx.begin(); } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { tx.rollback(); } private void createTestSetting(String owner, String key, String group, String val) { Setting setting = new Setting(); setting.setOwner(owner); setting.setGroup(group); setting.setKey(key); setting.setVal(val); em.persist(setting); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getSettings(java.lang.String)} * . */ @Test public void testGetSettings() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); createTestSetting(owner, key, group, val); SettingDTO settingDTO = settingService.getSetting(owner, key, group); assertNotNull(settingDTO); assertEquals(owner, settingDTO.getOwner()); assertEquals(key, settingDTO.getKey()); assertEquals(group, settingDTO.getGroup()); } /** * Test methogetDefaultSetting * com.eurodyn.qlack2getSettingFromDefaultgsServiceImpl# * getSettingFromDefaultGroup(java.lang.String, java.lang.String, * java.lang.String)} . */ @Test public void testGetSetting() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); for (int i = 0; i < 10; i++) { createTestSetting(owner, key + i, group, val + i); } List<SettingDTO> settings = settingService.getSettings(owner, true); assertNotNull(settings); assertEquals(10, settings.size()); for (int i = 0; i < 10; i++) { assertEquals(owner, settings.get(i).getOwner()); assertEquals(val + i, settings.get(i).getVal()); } } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getGroupNames(java.lang.String)} * . */ @Test public void testGetGroupNames() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); createTestSetting(owner, key, group + "A", val); createTestSetting(owner, key, group + "B", val); createTestSetting(owner, key, group + "C", val); List<GroupDTO> groupNames = settingService.getGroupNames(owner); assertNotNull(groupNames); assertEquals(3, groupNames.size()); assertEquals(group + "A", groupNames.get(0).getName()); assertEquals(group + "B", groupNames.get(1).getName()); assertEquals(group + "C", groupNames.get(2).getName()); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getValsForGroup(java.lang.String, java.lang.String)} * . */ @Test public void testGetValsForGroup() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); for (int i = 0; i < 5; i++) { createTestSetting(owner, key + i, group + "A", val + i); } for (int i = 5; i < 10; i++) { createTestSetting(owner, key + i, group + "B", val + i); } List<SettingDTO> valsForGroupA = settingService.getGroupSettings(owner, group + "A"); assertNotNull(valsForGroupA); assertEquals(5, valsForGroupA.size()); List<SettingDTO> valsForGroupB = settingService.getGroupSettings(owner, group + "B"); assertNotNull(valsForGroupB); assertEquals(5, valsForGroupB.size()); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#createSetting(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)} * . */ @Test public void testCreateSetting() throws Exception { /* String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); settingService.createSetting(owner, group, key + "A", val, true, false); settingService.createSetting(owner, group, key + "B", val, false, false); QSetting qsetting = QSetting.setting; JPAQueryFactory f = new JPAQueryFactory(em); Setting setting = f.select(qsetting) .from(qsetting) .where(qsetting.owner.eq(owner).and(qsetting.key.eq(key + "A")).and(qsetting.group.eq(group))) .fetchOne(); assertNotNull(setting); assertEquals(true, setting.isSensitive()); setting = f.select(qsetting) .from(qsetting) .where(qsetting.owner.eq(owner).and(qsetting.key.eq(key + "B")).and(qsetting.group.eq(group))) .fetchOne(); assertNotNull(setting); assertEquals(false, setting.isSensitive());*/ } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#setVal(java.lang.String, java.lang.String, java.lang.String, java.lang.String)} * . */ @Test public void testSetVal() throws Exception { } }
UTF-8
Java
7,798
java
SettingsServiceImplTest.java
Java
[ { "context": "ner = UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.randomUUID().toString();", "end": 3419, "score": 0.9388912320137024, "start": 3393, "tag": "KEY", "value": "UUID.randomUUID().toString" }, { "context": "ner = UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.randomUUID().toString();", "end": 4135, "score": 0.9963458776473999, "start": 4109, "tag": "KEY", "value": "UUID.randomUUID().toString" }, { "context": "ner = UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.ra", "end": 4867, "score": 0.9925220608711243, "start": 4863, "tag": "KEY", "value": "UUID" }, { "context": "UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.randomUUID().toString();", "end": 4889, "score": 0.996425211429596, "start": 4868, "tag": "KEY", "value": "randomUUID().toString" }, { "context": "ner = UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.randomUUID().toString();", "end": 5758, "score": 0.9877160787582397, "start": 5732, "tag": "KEY", "value": "UUID.randomUUID().toString" }, { "context": "ner = UUID.randomUUID().toString();\n\t\tString key = UUID.randomUUID().toString();\n\t\tString group = UUID.randomUUID().toString();", "end": 6726, "score": 0.9958213567733765, "start": 6700, "tag": "KEY", "value": "UUID.randomUUID().toString" } ]
null
[]
/** * */ package com.eurodyn.qlack2.fuse.settings.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.sql.Connection; import java.util.List; import java.util.UUID; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import org.hibernate.Session; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.eurodyn.qlack2.fuse.settings.api.dto.GroupDTO; import com.eurodyn.qlack2.fuse.settings.api.dto.SettingDTO; import com.eurodyn.qlack2.fuse.settings.impl.model.QSetting; import com.eurodyn.qlack2.fuse.settings.impl.model.Setting; import com.querydsl.jpa.impl.JPAQueryFactory; import liquibase.Contexts; import liquibase.LabelExpression; import liquibase.Liquibase; import liquibase.database.Database; import liquibase.database.DatabaseFactory; import liquibase.database.jvm.JdbcConnection; import liquibase.resource.ClassLoaderResourceAccessor; /** * @author European Dynamics SA * */ public class SettingsServiceImplTest { private static EntityManagerFactory emf; private static EntityManager em; private static SettingsServiceImpl settingService; private static EntityTransaction tx; /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { // Create the Entity Manager Factory. emf = Persistence.createEntityManagerFactory("fuse-settings"); // Run Liquibase. em = emf.createEntityManager(); Session session = (Session) em.getDelegate(); SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory(); ConnectionProvider cp = sfi.getConnectionProvider(); Connection connection = cp.getConnection(); Database database = DatabaseFactory.getInstance() .findCorrectDatabaseImplementation(new JdbcConnection(connection)); Liquibase liquibase = new Liquibase("db/qlack2-fuse-settings-impl.liquibase.changelog.xml", new ClassLoaderResourceAccessor(), database); liquibase.update(new Contexts(), new LabelExpression()); // Create an instance of the service to be tested. settingService = new SettingsServiceImpl(); settingService.setEm(em); } /** * @throws java.lang.Exception */ @AfterClass public static void tearDownAfterClass() throws Exception { em.close(); emf.close(); } /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { if (tx == null) { tx = em.getTransaction(); } tx.begin(); } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { tx.rollback(); } private void createTestSetting(String owner, String key, String group, String val) { Setting setting = new Setting(); setting.setOwner(owner); setting.setGroup(group); setting.setKey(key); setting.setVal(val); em.persist(setting); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getSettings(java.lang.String)} * . */ @Test public void testGetSettings() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); createTestSetting(owner, key, group, val); SettingDTO settingDTO = settingService.getSetting(owner, key, group); assertNotNull(settingDTO); assertEquals(owner, settingDTO.getOwner()); assertEquals(key, settingDTO.getKey()); assertEquals(group, settingDTO.getGroup()); } /** * Test methogetDefaultSetting * com.eurodyn.qlack2getSettingFromDefaultgsServiceImpl# * getSettingFromDefaultGroup(java.lang.String, java.lang.String, * java.lang.String)} . */ @Test public void testGetSetting() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); for (int i = 0; i < 10; i++) { createTestSetting(owner, key + i, group, val + i); } List<SettingDTO> settings = settingService.getSettings(owner, true); assertNotNull(settings); assertEquals(10, settings.size()); for (int i = 0; i < 10; i++) { assertEquals(owner, settings.get(i).getOwner()); assertEquals(val + i, settings.get(i).getVal()); } } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getGroupNames(java.lang.String)} * . */ @Test public void testGetGroupNames() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); createTestSetting(owner, key, group + "A", val); createTestSetting(owner, key, group + "B", val); createTestSetting(owner, key, group + "C", val); List<GroupDTO> groupNames = settingService.getGroupNames(owner); assertNotNull(groupNames); assertEquals(3, groupNames.size()); assertEquals(group + "A", groupNames.get(0).getName()); assertEquals(group + "B", groupNames.get(1).getName()); assertEquals(group + "C", groupNames.get(2).getName()); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#getValsForGroup(java.lang.String, java.lang.String)} * . */ @Test public void testGetValsForGroup() throws Exception { String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); for (int i = 0; i < 5; i++) { createTestSetting(owner, key + i, group + "A", val + i); } for (int i = 5; i < 10; i++) { createTestSetting(owner, key + i, group + "B", val + i); } List<SettingDTO> valsForGroupA = settingService.getGroupSettings(owner, group + "A"); assertNotNull(valsForGroupA); assertEquals(5, valsForGroupA.size()); List<SettingDTO> valsForGroupB = settingService.getGroupSettings(owner, group + "B"); assertNotNull(valsForGroupB); assertEquals(5, valsForGroupB.size()); } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#createSetting(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)} * . */ @Test public void testCreateSetting() throws Exception { /* String owner = UUID.randomUUID().toString(); String key = UUID.randomUUID().toString(); String group = UUID.randomUUID().toString(); String val = UUID.randomUUID().toString(); settingService.createSetting(owner, group, key + "A", val, true, false); settingService.createSetting(owner, group, key + "B", val, false, false); QSetting qsetting = QSetting.setting; JPAQueryFactory f = new JPAQueryFactory(em); Setting setting = f.select(qsetting) .from(qsetting) .where(qsetting.owner.eq(owner).and(qsetting.key.eq(key + "A")).and(qsetting.group.eq(group))) .fetchOne(); assertNotNull(setting); assertEquals(true, setting.isSensitive()); setting = f.select(qsetting) .from(qsetting) .where(qsetting.owner.eq(owner).and(qsetting.key.eq(key + "B")).and(qsetting.group.eq(group))) .fetchOne(); assertNotNull(setting); assertEquals(false, setting.isSensitive());*/ } /** * Test method for * {@link com.eurodyn.qlack2.fuse.settings.impl.SettingsServiceImpl#setVal(java.lang.String, java.lang.String, java.lang.String, java.lang.String)} * . */ @Test public void testSetVal() throws Exception { } }
7,798
0.726981
0.723006
252
29.944445
27.473452
164
false
false
0
0
0
0
0
0
1.960317
false
false
5
8c085f812670361bb1dd77ed36470cd74c5b3c5c
8,976,481,660,663
0b351dffa38a35050ca095b3c96315eee5520fdf
/src/cn/net/hous/games/Player.java
27f4a01fd9bf44d95fca0ff9a3f60104273113aa
[]
no_license
HousGit/SportMeetManagement
https://github.com/HousGit/SportMeetManagement
a2566d2ec3cc1d3edd63b2a7b987384ccfa3cb0a
adbe65dfa6f32d63065552aab1ee276b12fdf0b1
refs/heads/master
2021-01-23T02:28:53.165000
2015-07-03T08:38:45
2015-07-03T08:38:45
38,482,109
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.net.hous.games; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by ˧ on 2015/6/16. */ public class Player { private int playerid; private int studentid; private String playerpassword; private String playername; private int playersex; private String playerphone; private String playerother; Map<String, String > errors = new HashMap<>(); public int getPlayerid() { return playerid; } public void setPlayerid(int playerid) { this.playerid = playerid; } public int getStudentid() { return studentid; } public void setStudentid(int studentid) { this.studentid = studentid; } public String getPlayerpassword() { return playerpassword; } public void setPlayerpassword(String playerpassword) { this.playerpassword = playerpassword; } public String getPlayername() { return playername; } public void setPlayername(String playername) { this.playername = playername; } public int getPlayersex() { return playersex; } public void setPlayersex(int playersex) { this.playersex = playersex; } public String getPlayerphone() { return playerphone; } public void setPlayerphone(String playerphone) { this.playerphone = playerphone; } public String getPlayerother() { return playerother; } public void setPlayerother(String playerother) { this.playerother = playerother; } public void sava() { PlayerDAO.sava(this); } public void putErr(String key, String value) { errors.put(key, value); } public String getErr(String key){ if(errors.get(key)==null) { return ""; } else return errors.get(key); } public boolean check() { boolean flag = true; if (! (Integer.toString(this.getStudentid())).matches("\\d{10}")) { this.putErr("pstuidErr", "请输入10位学号!"); flag = false; } if (! this.getPlayerpassword().matches("\\w{6,12}")){ this.putErr("ppswErr", "请输入6~12位密码"); flag = false; } // if (null != this.getPlayername() || !this.getPlayername().trim().equals("")) { // this.putErr("pnameErr", "请输入姓名!"); // flag = false; // } return flag; } public boolean update() { return PlayerDAO.update(this); } public static List<Player> getPlayers(){ return PlayerDAO.getPlayers(); } public static void playerDel(int playerid) { PlayerDAO.delete(playerid); } public static boolean login(int studentid, String playerpassword) { return PlayerDAO.login(studentid, playerpassword); } public static Player getPlayerById(int id){ return PlayerDAO.getPlayerById(id); } public static boolean update(Player p) { return PlayerDAO.update(p); } }
UTF-8
Java
3,269
java
Player.java
Java
[ { "context": "il.List;\nimport java.util.Map;\n\n/**\n * Created by ˧ on 2015/6/16.\n */\npublic class Player {\n\n priv", "end": 266, "score": 0.5903307199478149, "start": 266, "tag": "NAME", "value": "" }, { "context": "il.List;\nimport java.util.Map;\n\n/**\n * Created by ˧ on 2015/6/16.\n */\npublic class Player {\n\n priv", "end": 266, "score": 0.5274429321289062, "start": 266, "tag": "USERNAME", "value": "" }, { "context": "ng playerpassword) {\n this.playerpassword = playerpassword;\n }\n\n public String getPlayername()", "end": 1046, "score": 0.7167203426361084, "start": 1040, "tag": "PASSWORD", "value": "player" } ]
null
[]
package cn.net.hous.games; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by ˧ on 2015/6/16. */ public class Player { private int playerid; private int studentid; private String playerpassword; private String playername; private int playersex; private String playerphone; private String playerother; Map<String, String > errors = new HashMap<>(); public int getPlayerid() { return playerid; } public void setPlayerid(int playerid) { this.playerid = playerid; } public int getStudentid() { return studentid; } public void setStudentid(int studentid) { this.studentid = studentid; } public String getPlayerpassword() { return playerpassword; } public void setPlayerpassword(String playerpassword) { this.playerpassword = <PASSWORD>password; } public String getPlayername() { return playername; } public void setPlayername(String playername) { this.playername = playername; } public int getPlayersex() { return playersex; } public void setPlayersex(int playersex) { this.playersex = playersex; } public String getPlayerphone() { return playerphone; } public void setPlayerphone(String playerphone) { this.playerphone = playerphone; } public String getPlayerother() { return playerother; } public void setPlayerother(String playerother) { this.playerother = playerother; } public void sava() { PlayerDAO.sava(this); } public void putErr(String key, String value) { errors.put(key, value); } public String getErr(String key){ if(errors.get(key)==null) { return ""; } else return errors.get(key); } public boolean check() { boolean flag = true; if (! (Integer.toString(this.getStudentid())).matches("\\d{10}")) { this.putErr("pstuidErr", "请输入10位学号!"); flag = false; } if (! this.getPlayerpassword().matches("\\w{6,12}")){ this.putErr("ppswErr", "请输入6~12位密码"); flag = false; } // if (null != this.getPlayername() || !this.getPlayername().trim().equals("")) { // this.putErr("pnameErr", "请输入姓名!"); // flag = false; // } return flag; } public boolean update() { return PlayerDAO.update(this); } public static List<Player> getPlayers(){ return PlayerDAO.getPlayers(); } public static void playerDel(int playerid) { PlayerDAO.delete(playerid); } public static boolean login(int studentid, String playerpassword) { return PlayerDAO.login(studentid, playerpassword); } public static Player getPlayerById(int id){ return PlayerDAO.getPlayerById(id); } public static boolean update(Player p) { return PlayerDAO.update(p); } }
3,273
0.604025
0.598762
149
20.677853
19.17992
88
false
false
0
0
0
0
0
0
0.402685
false
false
5
66a518523021a50aa3b7368063699bf1e5661c12
22,780,506,585,904
befabea22f9ccc50d13e627bea967b922e907172
/Character_Main/src/net/sf/anathema/character/perspective/CharacterStackBridge.java
11012f38ed0a21c7c316631bea46690f8468af61
[]
no_license
fsnicolino/anathema
https://github.com/fsnicolino/anathema
20c90feb61b91b237329708278cfda91d431b296
1b99ec6a99f68bedfe30858d0eb63f3a294bfd36
refs/heads/master
2021-01-16T19:01:41.647000
2013-05-31T16:55:30
2013-05-31T16:55:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sf.anathema.character.perspective; import net.sf.anathema.character.perspective.model.model.CharacterIdentifier; import net.sf.anathema.framework.repository.IItem; public interface CharacterStackBridge { void addViewForCharacter(CharacterIdentifier identifier, IItem item); void showCharacterView(CharacterIdentifier identifier); }
UTF-8
Java
352
java
CharacterStackBridge.java
Java
[]
null
[]
package net.sf.anathema.character.perspective; import net.sf.anathema.character.perspective.model.model.CharacterIdentifier; import net.sf.anathema.framework.repository.IItem; public interface CharacterStackBridge { void addViewForCharacter(CharacterIdentifier identifier, IItem item); void showCharacterView(CharacterIdentifier identifier); }
352
0.84375
0.84375
11
31
29.826773
77
false
false
0
0
0
0
0
0
0.545455
false
false
5
d1610478af7707c8205f9fad79da4093c683b4bd
19,945,828,140,699
9d06352adb1f45ffc53f689afb342f6317636eb6
/harmonic.java
c40ccde342397ca9fc454cec4f990ea40bb8eb81
[]
no_license
Subadhina/labexercise1
https://github.com/Subadhina/labexercise1
dde240d299f9ef1a3cc5257c5f683e9c1c235dc0
fd31efa1c8681f4f90f0005bad9e992349f4233e
refs/heads/master
2022-11-28T01:47:49.535000
2020-07-31T07:38:31
2020-07-31T07:38:31
283,973,436
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 exercise1; import java.util.Scanner; /** * * @author ELCOT */ public class harmonic { public static void main(String[] args) { Scanner obj=new Scanner(System.in); System.out.println("Enter the limit of harmonic series"); int n=obj.nextInt(); int i,j=1; double sum=0; for(i=0;i<n;i++) { sum = sum + (double) 1 / j; j++; } System.out.println("The harmonic series is:"+sum); } }
UTF-8
Java
733
java
harmonic.java
Java
[ { "context": "\r\n\r\nimport java.util.Scanner;\r\n/**\r\n *\r\n * @author ELCOT\r\n */\r\npublic class harmonic {\r\n public static ", "end": 266, "score": 0.995578944683075, "start": 261, "tag": "USERNAME", "value": "ELCOT" }, { "context": "port java.util.Scanner;\r\n/**\r\n *\r\n * @author ELCOT\r\n */\r\npublic class harmonic {\r\n public static vo", "end": 266, "score": 0.4838404059410095, "start": 266, "tag": "NAME", "value": "" } ]
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 exercise1; import java.util.Scanner; /** * * @author ELCOT */ public class harmonic { public static void main(String[] args) { Scanner obj=new Scanner(System.in); System.out.println("Enter the limit of harmonic series"); int n=obj.nextInt(); int i,j=1; double sum=0; for(i=0;i<n;i++) { sum = sum + (double) 1 / j; j++; } System.out.println("The harmonic series is:"+sum); } }
733
0.542974
0.536153
29
23
21.274883
79
false
false
0
0
0
0
0
0
0.551724
false
false
5
583222da0ab44883bf391c36e2de06252da47399
11,828,339,973,013
21cc74392b636568db1325f9f84a273e1cd50bb9
/MyApplication2/app/src/main/java/com/example/administrator/myapplication2/_6_WeatherFragment.java
3ce12a6bb630a08251e47c6475df323bc0a11fb7
[]
no_license
boogil/exerciseApp-with-heartrate-sensor
https://github.com/boogil/exerciseApp-with-heartrate-sensor
807948b620ac50f82f18bfac555c541e1000b528
2ba5500f8bdd59c75523b29348080a851439cebf
refs/heads/master
2016-08-11T20:12:02.524000
2015-10-14T06:03:16
2015-10-14T06:03:16
44,226,584
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.myapplication2; import android.app.Fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ProgressBar; public class _6_WeatherFragment extends Fragment { public _6_WeatherFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout._6_activity_main, container, false); return rootView; } private String mInputUrl = "http://m.weather.naver.com/"; private EditText mEditText; private WebView mWebView; private WebSettings mWebSettings; private ProgressBar mProgressBar; private InputMethodManager mInputMethodManager; @Override public void onStart() { super.onStart(); // mEditText = (EditText) getView().findViewById(R.id.edit_Url); mWebView = (WebView)getView().findViewById(R.id.webview); mProgressBar = (ProgressBar)getView().findViewById(R.id.progressBar); // getView().findViewById(R.id.btn_go).setOnClickListener(onClickListener); // 웹뷰에서 자바스크립트실행가능 mWebView.getSettings().setJavaScriptEnabled(true); mInputMethodManager = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); mWebView.setWebChromeClient(new webViewChrome()); mWebView.setWebViewClient(new webViewClient()); mWebSettings = mWebView.getSettings(); mWebSettings.setBuiltInZoomControls(true); mWebView.loadUrl(mInputUrl); // mEditText.setHint(mInputUrl); } //Button Event를 처리 // View.OnClickListener onClickListener = new View.OnClickListener() { // // @Override // public void onClick(View v) { // switch(v.getId()) { // case R.id.btn_go: // //InputMethodManager를 이용하여 키보드를 숨김 // mInputMethodManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); // mInputUrl = httpInputCheck(mEditText.getText().toString()); // // if(mInputUrl == null) break; // // //페이지를 불러온다 // mWebView.loadUrl(mInputUrl); // mEditText.setText(""); // mEditText.setHint(mInputUrl); // break; // } // } // }; class webViewChrome extends WebChromeClient { @Override public void onProgressChanged(WebView view, int newProgress) { //현제 페이지 진행사항을 ProgressBar를 통해 알린다. if(newProgress < 100) { mProgressBar.setProgress(newProgress); } else { mProgressBar.setVisibility(View.INVISIBLE); mProgressBar.setLayoutParams(new LinearLayout.LayoutParams(0, 0)); } } } class webViewClient extends WebViewClient { //Loading이 시작되면 ProgressBar처리를 한다. @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 15)); view.loadUrl(url); return true; } // @Override // public void onPageFinished(WebView view, String url) { // mWebSettings.setJavaScriptEnabled(true); // mEditText.setHint(url); // super.onPageFinished(view, url); // } } //http://를 체크하여 추가한다. // private String httpInputCheck(String url) { // if(url.isEmpty()) return null; // // if(url.indexOf("http://") == ("http://").length()) return url; // else return "http://" + url; // } }
UTF-8
Java
4,294
java
_6_WeatherFragment.java
Java
[]
null
[]
package com.example.administrator.myapplication2; import android.app.Fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ProgressBar; public class _6_WeatherFragment extends Fragment { public _6_WeatherFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout._6_activity_main, container, false); return rootView; } private String mInputUrl = "http://m.weather.naver.com/"; private EditText mEditText; private WebView mWebView; private WebSettings mWebSettings; private ProgressBar mProgressBar; private InputMethodManager mInputMethodManager; @Override public void onStart() { super.onStart(); // mEditText = (EditText) getView().findViewById(R.id.edit_Url); mWebView = (WebView)getView().findViewById(R.id.webview); mProgressBar = (ProgressBar)getView().findViewById(R.id.progressBar); // getView().findViewById(R.id.btn_go).setOnClickListener(onClickListener); // 웹뷰에서 자바스크립트실행가능 mWebView.getSettings().setJavaScriptEnabled(true); mInputMethodManager = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); mWebView.setWebChromeClient(new webViewChrome()); mWebView.setWebViewClient(new webViewClient()); mWebSettings = mWebView.getSettings(); mWebSettings.setBuiltInZoomControls(true); mWebView.loadUrl(mInputUrl); // mEditText.setHint(mInputUrl); } //Button Event를 처리 // View.OnClickListener onClickListener = new View.OnClickListener() { // // @Override // public void onClick(View v) { // switch(v.getId()) { // case R.id.btn_go: // //InputMethodManager를 이용하여 키보드를 숨김 // mInputMethodManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); // mInputUrl = httpInputCheck(mEditText.getText().toString()); // // if(mInputUrl == null) break; // // //페이지를 불러온다 // mWebView.loadUrl(mInputUrl); // mEditText.setText(""); // mEditText.setHint(mInputUrl); // break; // } // } // }; class webViewChrome extends WebChromeClient { @Override public void onProgressChanged(WebView view, int newProgress) { //현제 페이지 진행사항을 ProgressBar를 통해 알린다. if(newProgress < 100) { mProgressBar.setProgress(newProgress); } else { mProgressBar.setVisibility(View.INVISIBLE); mProgressBar.setLayoutParams(new LinearLayout.LayoutParams(0, 0)); } } } class webViewClient extends WebViewClient { //Loading이 시작되면 ProgressBar처리를 한다. @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 15)); view.loadUrl(url); return true; } // @Override // public void onPageFinished(WebView view, String url) { // mWebSettings.setJavaScriptEnabled(true); // mEditText.setHint(url); // super.onPageFinished(view, url); // } } //http://를 체크하여 추가한다. // private String httpInputCheck(String url) { // if(url.isEmpty()) return null; // // if(url.indexOf("http://") == ("http://").length()) return url; // else return "http://" + url; // } }
4,294
0.636079
0.633189
125
32.223999
26.642181
116
false
false
0
0
0
0
0
0
0.544
false
false
5
ad65473a37d3497604def018201a967bbc830eb1
3,633,542,354,840
c49b91564bcfa6a0feb54f2390d8392144d17e55
/automationpractice/src/test/java/com/automationpractice/homepage/TC003_VerifyingRegistrationPage.java
249e8f9664a98dc653c7e216d900b90de917c2e5
[]
no_license
kousalyak894/Automation
https://github.com/kousalyak894/Automation
ad7910cad1b9476d82f675c70697740d0810ed7b
f6125cc37bf77370810c5640d15b9eb91978a9c4
refs/heads/master
2021-04-03T10:30:50.207000
2018-03-11T17:17:08
2018-03-11T17:17:08
124,777,712
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.automationpractice.homepage; import java.util.List; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import org.testng.annotations.Test; import com.automationpractice.uiactions.Homepage; public class TC003_VerifyingRegistrationPage extends TC002_Verifyingwhetheremailidcreatedornot { public static final Logger log=Logger.getLogger(Homepage.class.getName()); @Test public void VerifyinguserRegistration(){ homepage.userregistraton("kouslaya", "k", "koushi@1994","kousalya", "k", "marathalli,banglore", "banglore","570036", "990141012", "banglore,marathalli"); log.info("User information entered successfully"); Assert.assertEquals(homepage.errormsgafterregis(), "There are 2 errors"); log.info("Error msg generated successfully"); } }
UTF-8
Java
968
java
TC003_VerifyingRegistrationPage.java
Java
[]
null
[]
package com.automationpractice.homepage; import java.util.List; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import org.testng.annotations.Test; import com.automationpractice.uiactions.Homepage; public class TC003_VerifyingRegistrationPage extends TC002_Verifyingwhetheremailidcreatedornot { public static final Logger log=Logger.getLogger(Homepage.class.getName()); @Test public void VerifyinguserRegistration(){ homepage.userregistraton("kouslaya", "k", "koushi@1994","kousalya", "k", "marathalli,banglore", "banglore","570036", "990141012", "banglore,marathalli"); log.info("User information entered successfully"); Assert.assertEquals(homepage.errormsgafterregis(), "There are 2 errors"); log.info("Error msg generated successfully"); } }
968
0.761364
0.733471
29
31.379311
35.047173
155
false
false
0
0
0
0
0
0
1.62069
false
false
5
9dd35c138afc65e48bfdc97ed6149b812cc9b377
8,065,948,602,925
6b5f8c3bf0d264dd5b793439cf2852fb38fac4b7
/src/main/java/com/coupon/web/CompanyController.java
728553f74551da5a180e4cea3f2a53a63392f9f5
[]
no_license
XZizeR/CouponRest
https://github.com/XZizeR/CouponRest
c465f695ae5f08cba47bf341797290b91f876c15
0e28d46e83d8592a10cff99e3100be6a3a7a414c
refs/heads/master
2020-12-02T03:39:23.041000
2020-05-04T20:13:28
2020-05-04T20:13:28
230,875,615
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.coupon.web; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.coupon.beans.Category; import com.coupon.beans.Coupon; import com.coupon.exception.CompanyExistsException; import com.coupon.exception.CouponExistsException; import com.coupon.exception.DateException; import com.coupon.exception.EmptyFieldException; import com.coupon.exception.EndOfSessionException; import com.coupon.exception.IdDoesntExistsException; import com.coupon.exception.IncorrectInputException; import com.coupon.facade.CompanyFacade; @RestController @RequestMapping("company") @CrossOrigin(origins = "http://localhost:4200") public class CompanyController { @Autowired Map<String, Session> sessionMap; // Checks the session time private void isTimeOut(String token, Session session) throws EndOfSessionException { long diff = System.currentTimeMillis() - session.getLastAccessed(); long limit = 1000 * 60 * 60; // milliseconds * seconds * minutes if (diff > limit) { sessionMap.remove(token); session = null; throw new EndOfSessionException(); } else session.setLastAccessed(System.currentTimeMillis()); // updates the last session time // Tests: System.out.println("CompanyController: "); System.out .println(" getLastAccessed: " + session.getLastAccessed() + ", system: " + System.currentTimeMillis()); System.out.println(" diff: " + diff + ", limit: " + limit); } // Add a Coupon - works @PostMapping("/addCoupon/{token}") public ResponseEntity<Object> addNewCoupon(@PathVariable String token, @RequestBody Coupon coupon) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { try { CompanyFacade facade = (CompanyFacade) session.getFacade(); coupon.setCompanyID(facade.getCompanyDetails()); facade.addCoupon(coupon); return ResponseEntity.ok(coupon); } catch (CouponExistsException | EmptyFieldException | DateException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Update a Coupon - works @PutMapping("/updateCoupon/{token}") public ResponseEntity<Object> updateCoupon(@PathVariable String token, @RequestBody Coupon coupon) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { coupon.setCompanyID(facade.getCompanyDetails()); facade.updateCoupon(coupon); return ResponseEntity.ok(coupon); } catch (CouponExistsException | EmptyFieldException | IdDoesntExistsException | DateException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Delete a Coupon - works @DeleteMapping("/deleteCoupon/{token}/{couponID}") public ResponseEntity<Object> deleteCoupon(@PathVariable String token, @PathVariable int couponID) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { facade.deleteCoupon(couponID); return ResponseEntity.ok(couponID); } catch (IdDoesntExistsException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #1 - works @GetMapping("/getCompanyCoupons/{token}") public ResponseEntity<Object> getCoupons(@PathVariable String token) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); return ResponseEntity.ok(facade.getCompanyCoupons()); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #2 - work @GetMapping("/getCompanyCouponsCategory/{token}/{category}") public ResponseEntity<Object> getCoupons(@PathVariable String token, @PathVariable Category category) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getCompanyCoupons(category)); } catch (EmptyFieldException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #3 - work @GetMapping("/getCompanyCouponsMaxprice/{token}/{maxPrice}") public ResponseEntity<Object> getCoupons(@PathVariable String token, @PathVariable double maxPrice) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getCompanyCoupons(maxPrice)); } catch (IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get a Company Details - works @GetMapping("/getCompanyDetails/{token}") public ResponseEntity<Object> getCompanyDetails(@PathVariable String token) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); return ResponseEntity.ok(facade.getCompanyDetails()); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get one Company - works @GetMapping("/getOneCoupon/{token}/{companyID}") public ResponseEntity<Object> getOneCompany(@PathVariable String token, @PathVariable int couponID) throws CompanyExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getOneCoupon(couponID)); } catch (IdDoesntExistsException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } }
UTF-8
Java
7,897
java
CompanyController.java
Java
[]
null
[]
package com.coupon.web; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.coupon.beans.Category; import com.coupon.beans.Coupon; import com.coupon.exception.CompanyExistsException; import com.coupon.exception.CouponExistsException; import com.coupon.exception.DateException; import com.coupon.exception.EmptyFieldException; import com.coupon.exception.EndOfSessionException; import com.coupon.exception.IdDoesntExistsException; import com.coupon.exception.IncorrectInputException; import com.coupon.facade.CompanyFacade; @RestController @RequestMapping("company") @CrossOrigin(origins = "http://localhost:4200") public class CompanyController { @Autowired Map<String, Session> sessionMap; // Checks the session time private void isTimeOut(String token, Session session) throws EndOfSessionException { long diff = System.currentTimeMillis() - session.getLastAccessed(); long limit = 1000 * 60 * 60; // milliseconds * seconds * minutes if (diff > limit) { sessionMap.remove(token); session = null; throw new EndOfSessionException(); } else session.setLastAccessed(System.currentTimeMillis()); // updates the last session time // Tests: System.out.println("CompanyController: "); System.out .println(" getLastAccessed: " + session.getLastAccessed() + ", system: " + System.currentTimeMillis()); System.out.println(" diff: " + diff + ", limit: " + limit); } // Add a Coupon - works @PostMapping("/addCoupon/{token}") public ResponseEntity<Object> addNewCoupon(@PathVariable String token, @RequestBody Coupon coupon) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { try { CompanyFacade facade = (CompanyFacade) session.getFacade(); coupon.setCompanyID(facade.getCompanyDetails()); facade.addCoupon(coupon); return ResponseEntity.ok(coupon); } catch (CouponExistsException | EmptyFieldException | DateException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Update a Coupon - works @PutMapping("/updateCoupon/{token}") public ResponseEntity<Object> updateCoupon(@PathVariable String token, @RequestBody Coupon coupon) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { coupon.setCompanyID(facade.getCompanyDetails()); facade.updateCoupon(coupon); return ResponseEntity.ok(coupon); } catch (CouponExistsException | EmptyFieldException | IdDoesntExistsException | DateException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Delete a Coupon - works @DeleteMapping("/deleteCoupon/{token}/{couponID}") public ResponseEntity<Object> deleteCoupon(@PathVariable String token, @PathVariable int couponID) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { facade.deleteCoupon(couponID); return ResponseEntity.ok(couponID); } catch (IdDoesntExistsException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #1 - works @GetMapping("/getCompanyCoupons/{token}") public ResponseEntity<Object> getCoupons(@PathVariable String token) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); return ResponseEntity.ok(facade.getCompanyCoupons()); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #2 - work @GetMapping("/getCompanyCouponsCategory/{token}/{category}") public ResponseEntity<Object> getCoupons(@PathVariable String token, @PathVariable Category category) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getCompanyCoupons(category)); } catch (EmptyFieldException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get Company Coupons #3 - work @GetMapping("/getCompanyCouponsMaxprice/{token}/{maxPrice}") public ResponseEntity<Object> getCoupons(@PathVariable String token, @PathVariable double maxPrice) throws EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getCompanyCoupons(maxPrice)); } catch (IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get a Company Details - works @GetMapping("/getCompanyDetails/{token}") public ResponseEntity<Object> getCompanyDetails(@PathVariable String token) throws CouponExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); return ResponseEntity.ok(facade.getCompanyDetails()); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } // Get one Company - works @GetMapping("/getOneCoupon/{token}/{companyID}") public ResponseEntity<Object> getOneCompany(@PathVariable String token, @PathVariable int couponID) throws CompanyExistsException, EndOfSessionException { Session session = sessionMap.get(token); if (session != null) isTimeOut(token, session); if (session != null) { CompanyFacade facade = (CompanyFacade) session.getFacade(); try { return ResponseEntity.ok(facade.getOneCoupon(couponID)); } catch (IdDoesntExistsException | IncorrectInputException e) { return ResponseEntity.badRequest().body(e.getMessage()); } } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Unauthorized login"); } } }
7,897
0.732177
0.730277
206
36.334953
27.765827
107
false
false
0
0
0
0
0
0
2.407767
false
false
5
2dc351a589a9a03f82602ba232749dad3d07e9fd
2,851,858,293,792
12b0edd3641905c28387cb92760639c56ecbb3ea
/MyApplication/app/src/main/java/com/kira/helloworld/infomodify.java
86f891cffc50cafe82eac32ffacf134dc062a19b
[]
no_license
DarryNobi/IBookShare
https://github.com/DarryNobi/IBookShare
1295f05377c51bd5fa2c19f5372e2e6d6084c9fe
866d5b0244e508617628c75e6ee5621735397870
refs/heads/master
2021-01-18T00:36:15.869000
2015-06-14T01:15:46
2015-06-14T01:15:46
35,037,979
0
0
null
true
2015-05-04T14:00:10
2015-05-04T14:00:10
2015-05-01T09:52:33
2015-05-01T09:52:33
0
0
0
0
null
null
null
package com.kira.helloworld; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.net.HttpURLConnection; import java.net.URL; import java.util.regex.*; import com.kira.extra.EnableWebService; /** * Created by nobi on 5/9/15. */ public class infomodify extends Activity { private EditText netname; private EditText username; private EditText school; private EditText contactinfo; private EditText signature; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.infomodify); EnableWebService.enableWebService(); Intent intent=getIntent(); Button login_button=(Button)findViewById(R.id.infomodifyconfirm); login_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { netname= (EditText)findViewById(R.id.netname); username=(EditText)findViewById(R.id.username); school=(EditText)findViewById(R.id.school); contactinfo=(EditText)findViewById(R.id.contactinfo); signature=(EditText)findViewById(R.id.signature); HttpURLConnection urlConnection = null; try { String str_url = "http://ibookshare.sinaapp.com/ibs/infomodify?" + "username=" + netname.getText().toString() + "&password=" + username.getText().toString() + "&school=" + school.getText().toString() + "&contactinfo=" + contactinfo.getText().toString() + "&signature=" + signature.getText().toString() ; URL url = new URL(str_url); urlConnection = (HttpURLConnection) url.openConnection(); int response_code = urlConnection.getResponseCode(); if(response_code == HttpURLConnection.HTTP_OK){ WarnToast("修改成功"); } else WarnToast("修改失败"); }catch(Exception e){ e.printStackTrace(); }finally { if(urlConnection != null) urlConnection.disconnect(); } } }); } //提醒信息 private void WarnToast(String str) { Toast.makeText(getBaseContext(), str , Toast.LENGTH_SHORT).show(); } }
UTF-8
Java
2,716
java
infomodify.java
Java
[ { "context": "com.kira.extra.EnableWebService;\n/**\n * Created by nobi on 5/9/15.\n */\n\npublic class infomodify extends A", "end": 377, "score": 0.999534010887146, "start": 373, "tag": "USERNAME", "value": "nobi" }, { "context": "ing() +\n \"&password=\" + username.getText().toString() +\n ", "end": 1642, "score": 0.7059556245803833, "start": 1634, "tag": "PASSWORD", "value": "username" } ]
null
[]
package com.kira.helloworld; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.net.HttpURLConnection; import java.net.URL; import java.util.regex.*; import com.kira.extra.EnableWebService; /** * Created by nobi on 5/9/15. */ public class infomodify extends Activity { private EditText netname; private EditText username; private EditText school; private EditText contactinfo; private EditText signature; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.infomodify); EnableWebService.enableWebService(); Intent intent=getIntent(); Button login_button=(Button)findViewById(R.id.infomodifyconfirm); login_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { netname= (EditText)findViewById(R.id.netname); username=(EditText)findViewById(R.id.username); school=(EditText)findViewById(R.id.school); contactinfo=(EditText)findViewById(R.id.contactinfo); signature=(EditText)findViewById(R.id.signature); HttpURLConnection urlConnection = null; try { String str_url = "http://ibookshare.sinaapp.com/ibs/infomodify?" + "username=" + netname.getText().toString() + "&password=" + <PASSWORD>.getText().toString() + "&school=" + school.getText().toString() + "&contactinfo=" + contactinfo.getText().toString() + "&signature=" + signature.getText().toString() ; URL url = new URL(str_url); urlConnection = (HttpURLConnection) url.openConnection(); int response_code = urlConnection.getResponseCode(); if(response_code == HttpURLConnection.HTTP_OK){ WarnToast("修改成功"); } else WarnToast("修改失败"); }catch(Exception e){ e.printStackTrace(); }finally { if(urlConnection != null) urlConnection.disconnect(); } } }); } //提醒信息 private void WarnToast(String str) { Toast.makeText(getBaseContext(), str , Toast.LENGTH_SHORT).show(); } }
2,718
0.570951
0.569465
75
34.893333
24.61142
86
false
false
0
0
0
0
0
0
0.533333
false
false
5
47d4df328dde7d246c7c4e4d388fc9ed2ec5b9c8
15,874,199,155,942
a0cd546101594e679544d24f92ae8fcc17013142
/refactorit-core/src/test/java/net/sf/refactorit/test/refactorings/RefactoringTestCase.java
28d70d2209e4489374da08527c13dd46d98b8901
[]
no_license
svn2github/RefactorIT
https://github.com/svn2github/RefactorIT
f65198bb64f6c11e20d35ace5f9563d781b7fe5c
4b1fc1ebd06c8e192af9ccd94eb5c2d96f79f94c
refs/heads/master
2021-01-10T03:09:28.310000
2008-09-18T10:17:56
2008-09-18T10:17:56
47,540,746
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ package net.sf.refactorit.test.refactorings; import net.sf.refactorit.classmodel.BinPackage; import net.sf.refactorit.classmodel.BinTypeRef; import net.sf.refactorit.classmodel.Project; import net.sf.refactorit.common.util.StringUtil; import net.sf.refactorit.refactorings.rename.RenamePackage; import net.sf.refactorit.source.SourceParsingException; import net.sf.refactorit.test.RwRefactoringTestUtils; import net.sf.refactorit.test.Utils; import net.sf.refactorit.ui.DialogManager; import net.sf.refactorit.ui.NullDialogManager; import java.io.File; import java.util.List; import junit.framework.TestCase; /** * @author Anton Safonov */ public abstract class RefactoringTestCase extends TestCase { static { // TODO find better way to initialize Utils.setUpTestingEnvironment(); } public RefactoringTestCase(final String name) { super(name); } /** * Examples:<pre> ExtractSuper/&lt;stripped_test_name&gt;/&lt;in_out&gt; RenameField/imported/RenamePrivateField/&lt;test_name&gt;/&lt;in_out&gt; InlineTemp/canInline/A_&lt;test_name&gt;_&lt;in_out&gt;.java ExtractMethod/Imported/&lt;extra_name&gt;_&lt;in_out&gt;/A_&lt;test_name&gt;.java </pre> * &lt;extra_name&gt; is replaced with parameter of * {@link #getInitialProject(String)} or {@link #getExpectedProject(String)}<br> * &lt;stripped_test_name&gt; is replaced with value of {@link #getStrippedTestName()}<br> * &lt;test_name&gt; is replaced with value of {@link #getTestName()}<br> * &lt;in_out&gt; is replaced with either 'in' or 'out' depending on either asked * for initial or expected project.<br> * Either of them can be missing. * @return every test suite defines it's own template how its test projects * are identified and located */ public abstract String getTemplate(); /** * Repesented in template as "&lt;test_name&gt;". * @return the name of the currect single test; can't be <code>null</code> */ public final String getTestName() { return getName(); } /** * Repesented in template as "&lt;stripped_test_name&gt;". * @return the name of the currect single test word without "test" in the * beginning; can't be <code>null</code> */ public final String getStrippedTestName() { final String testName = getTestName(); if (testName.startsWith("test")) { return testName.substring("test".length()); } return testName; } /** * @param extraName some test suites can have tests groups, * see e.g. {@link ExtractMethodTest}; can be null * @param initial true when asked for initial project, false - for expected * @return fully resolved path to the test project */ public final String resolveTestName(final String extraName, final boolean initial) { String result = getTemplate(); result = StringUtil.replace(result, "<extra_name>", extraName == null ? "" : extraName); result = StringUtil.replace(result, "<stripped_test_name>", getStrippedTestName()); result = StringUtil.replace(result, "<test_name>", getTestName()); result = StringUtil.replace(result, "<in_out>", initial ? "in" : "out"); result = result.replace('/', File.separatorChar); return result; } /** * @return initial project, not mutable. If need mutable, * use {@link #getMutableProject()} * @throws Exception when failed to get the project */ public Project getInitialProject() throws Exception { return getInitialProject(null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return initial project, not mutable. If need mutable, * use {@link #getMutableProject()} * @throws Exception when failed to get the project */ public Project getInitialProject(final String extraName) throws Exception { return Utils.createTestRbProject(resolveTestName(extraName, true)); } /** * @return expected project to compare with * @throws Exception when failed to get the project */ public Project getExpectedProject() throws Exception { return getExpectedProject(null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return expected project to compare with * @throws Exception when failed to get the project */ public Project getExpectedProject(final String extraName) throws Exception { return Utils.createTestRbProject(resolveTestName(extraName, false)); } /** * @return mutable project out of initial project * @throws Exception */ public Project getMutableProject() throws Exception { return getMutableProject((String)null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return mutable project out of initial project * @throws Exception */ public Project getMutableProject(final String extraName) throws Exception { return getMutableProject(getInitialProject(extraName)); } /** * @param nonMutableProject converts this project into mutable one and loads * @return a mutable project * @throws java.lang.Exception */ public Project getMutableProject(final Project nonMutableProject) throws Exception { Project mutableProject = null; try { mutableProject = RwRefactoringTestUtils.createMutableProject(nonMutableProject); mutableProject.getProjectLoader().build(); // assertTrue("Project has defined types", // mutableProject.getDefinedTypes().size() > 0); } catch (SourceParsingException e) { System.err.println(e.getMessage()); e.printStackTrace(System.err); } return mutableProject; } public static void renameToOut(final Project project) throws Exception { final List definedTypes = project.getDefinedTypes(); if (definedTypes == null || definedTypes.size() == 0) { return; } final BinPackage oldPackage = ((BinTypeRef) definedTypes.get(0)) .getPackage(); String name = oldPackage.getQualifiedName(); if (name.endsWith("_in")) { name = name.substring(0, name.length() - 3) + "_out"; RenamePackage renamePackage = new RenamePackage(new NullContext(project), oldPackage); renamePackage.setNewName(name); renamePackage.apply(); project.getProjectLoader().build(null, false); ((NullDialogManager) DialogManager.getInstance()).customErrorString = ""; } } }
UTF-8
Java
6,945
java
RefactoringTestCase.java
Java
[ { "context": "ort junit.framework.TestCase;\r\n\r\n\r\n/**\r\n * @author Anton Safonov\r\n */\r\npublic abstract class RefactoringTestCase ext", "end": 957, "score": 0.9521540403366089, "start": 944, "tag": "NAME", "value": "Anton Safonov" } ]
null
[]
/* * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ package net.sf.refactorit.test.refactorings; import net.sf.refactorit.classmodel.BinPackage; import net.sf.refactorit.classmodel.BinTypeRef; import net.sf.refactorit.classmodel.Project; import net.sf.refactorit.common.util.StringUtil; import net.sf.refactorit.refactorings.rename.RenamePackage; import net.sf.refactorit.source.SourceParsingException; import net.sf.refactorit.test.RwRefactoringTestUtils; import net.sf.refactorit.test.Utils; import net.sf.refactorit.ui.DialogManager; import net.sf.refactorit.ui.NullDialogManager; import java.io.File; import java.util.List; import junit.framework.TestCase; /** * @author <NAME> */ public abstract class RefactoringTestCase extends TestCase { static { // TODO find better way to initialize Utils.setUpTestingEnvironment(); } public RefactoringTestCase(final String name) { super(name); } /** * Examples:<pre> ExtractSuper/&lt;stripped_test_name&gt;/&lt;in_out&gt; RenameField/imported/RenamePrivateField/&lt;test_name&gt;/&lt;in_out&gt; InlineTemp/canInline/A_&lt;test_name&gt;_&lt;in_out&gt;.java ExtractMethod/Imported/&lt;extra_name&gt;_&lt;in_out&gt;/A_&lt;test_name&gt;.java </pre> * &lt;extra_name&gt; is replaced with parameter of * {@link #getInitialProject(String)} or {@link #getExpectedProject(String)}<br> * &lt;stripped_test_name&gt; is replaced with value of {@link #getStrippedTestName()}<br> * &lt;test_name&gt; is replaced with value of {@link #getTestName()}<br> * &lt;in_out&gt; is replaced with either 'in' or 'out' depending on either asked * for initial or expected project.<br> * Either of them can be missing. * @return every test suite defines it's own template how its test projects * are identified and located */ public abstract String getTemplate(); /** * Repesented in template as "&lt;test_name&gt;". * @return the name of the currect single test; can't be <code>null</code> */ public final String getTestName() { return getName(); } /** * Repesented in template as "&lt;stripped_test_name&gt;". * @return the name of the currect single test word without "test" in the * beginning; can't be <code>null</code> */ public final String getStrippedTestName() { final String testName = getTestName(); if (testName.startsWith("test")) { return testName.substring("test".length()); } return testName; } /** * @param extraName some test suites can have tests groups, * see e.g. {@link ExtractMethodTest}; can be null * @param initial true when asked for initial project, false - for expected * @return fully resolved path to the test project */ public final String resolveTestName(final String extraName, final boolean initial) { String result = getTemplate(); result = StringUtil.replace(result, "<extra_name>", extraName == null ? "" : extraName); result = StringUtil.replace(result, "<stripped_test_name>", getStrippedTestName()); result = StringUtil.replace(result, "<test_name>", getTestName()); result = StringUtil.replace(result, "<in_out>", initial ? "in" : "out"); result = result.replace('/', File.separatorChar); return result; } /** * @return initial project, not mutable. If need mutable, * use {@link #getMutableProject()} * @throws Exception when failed to get the project */ public Project getInitialProject() throws Exception { return getInitialProject(null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return initial project, not mutable. If need mutable, * use {@link #getMutableProject()} * @throws Exception when failed to get the project */ public Project getInitialProject(final String extraName) throws Exception { return Utils.createTestRbProject(resolveTestName(extraName, true)); } /** * @return expected project to compare with * @throws Exception when failed to get the project */ public Project getExpectedProject() throws Exception { return getExpectedProject(null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return expected project to compare with * @throws Exception when failed to get the project */ public Project getExpectedProject(final String extraName) throws Exception { return Utils.createTestRbProject(resolveTestName(extraName, false)); } /** * @return mutable project out of initial project * @throws Exception */ public Project getMutableProject() throws Exception { return getMutableProject((String)null); } /** * @param extraName the name of the test group, see {@link ExtractMethodTest} * @return mutable project out of initial project * @throws Exception */ public Project getMutableProject(final String extraName) throws Exception { return getMutableProject(getInitialProject(extraName)); } /** * @param nonMutableProject converts this project into mutable one and loads * @return a mutable project * @throws java.lang.Exception */ public Project getMutableProject(final Project nonMutableProject) throws Exception { Project mutableProject = null; try { mutableProject = RwRefactoringTestUtils.createMutableProject(nonMutableProject); mutableProject.getProjectLoader().build(); // assertTrue("Project has defined types", // mutableProject.getDefinedTypes().size() > 0); } catch (SourceParsingException e) { System.err.println(e.getMessage()); e.printStackTrace(System.err); } return mutableProject; } public static void renameToOut(final Project project) throws Exception { final List definedTypes = project.getDefinedTypes(); if (definedTypes == null || definedTypes.size() == 0) { return; } final BinPackage oldPackage = ((BinTypeRef) definedTypes.get(0)) .getPackage(); String name = oldPackage.getQualifiedName(); if (name.endsWith("_in")) { name = name.substring(0, name.length() - 3) + "_out"; RenamePackage renamePackage = new RenamePackage(new NullContext(project), oldPackage); renamePackage.setNewName(name); renamePackage.apply(); project.getProjectLoader().build(null, false); ((NullDialogManager) DialogManager.getInstance()).customErrorString = ""; } } }
6,938
0.677322
0.67545
197
33.253807
27.232903
92
false
false
0
0
0
0
0
0
0.563452
false
false
5
50b71ee5f18fe7d401125898a0b1fb32decef6ec
28,192,165,362,432
381d6d0abdb1911eaf1f8af73f85c3eb55c6be8b
/src/adapter/Controller.java
2dfaee419699917e441a9eef8be4565a9f250950
[]
no_license
VenoVX/Advanced-SWE
https://github.com/VenoVX/Advanced-SWE
552fe3c8f9830d8663c4cc69b53d060b3bf5a8f9
8151aa1c0bd2ed3c26cf58093f9fa4734f57c759
refs/heads/main
2023-05-06T17:30:44.041000
2021-05-31T21:37:48
2021-05-31T21:37:48
372,569,842
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package adapter; import plugins.ui.mainFrame; import javax.swing.*; public class Controller { private JFrame mainFrame; public Controller(){ loadUI(); } public void loadUI(){ this.mainFrame = new mainFrame(); } }
UTF-8
Java
254
java
Controller.java
Java
[]
null
[]
package adapter; import plugins.ui.mainFrame; import javax.swing.*; public class Controller { private JFrame mainFrame; public Controller(){ loadUI(); } public void loadUI(){ this.mainFrame = new mainFrame(); } }
254
0.629921
0.629921
17
13.941176
12.981754
41
false
false
0
0
0
0
0
0
0.352941
false
false
5
a17acd5008fbfd9ec234b940f7fabb79ecf9c839
15,307,263,465,787
30a4edc0efb76798b95561281c59893411c4407b
/backend/common/src/main/java/eu/researchalps/db/model/full/ExternalStructure.java
2b9469635122c970ce25e181bdfd86508c325f23
[ "MIT" ]
permissive
reseachalps/Search-Engine
https://github.com/reseachalps/Search-Engine
55065a82ddf22d7c4a6c51c98bf16f067258ce3c
1cd1e83902119938ffd412394b09dce92d082500
refs/heads/master
2022-12-11T18:54:45.534000
2019-06-25T18:06:29
2019-06-25T18:06:29
193,713,381
0
0
MIT
false
2022-12-07T17:39:55
2019-06-25T13:30:02
2019-06-25T18:06:51
2022-12-07T17:39:54
7,267
0
0
11
Java
false
false
package eu.researchalps.db.model.full; /** * External structure referenced in a project */ public class ExternalStructure { private String label; private String url; public ExternalStructure(String label, String url) { this.label = label; this.url = url; } public String getLabel() { return label; } public String getUrl() { return url; } }
UTF-8
Java
413
java
ExternalStructure.java
Java
[]
null
[]
package eu.researchalps.db.model.full; /** * External structure referenced in a project */ public class ExternalStructure { private String label; private String url; public ExternalStructure(String label, String url) { this.label = label; this.url = url; } public String getLabel() { return label; } public String getUrl() { return url; } }
413
0.619855
0.619855
24
16.208334
16.222359
56
false
false
0
0
0
0
0
0
0.333333
false
false
5
9e2fcad5c27827357d756803b9986a0a733294d3
28,157,805,630,483
5881d1f908106466183188d69e86055bd6a5448a
/ExamPrep/src/Queue/QueueExample.java
b72ccf6d5df66b835e46b663beab5b5eeaba2229
[]
no_license
davegreene2018/java_advanced
https://github.com/davegreene2018/java_advanced
c981443029a1256ee8f871f945d40eb6609d7181
319ca1b5e4a65c8a9947794731c72f3781ddb365
refs/heads/main
2023-07-07T21:48:26.006000
2021-08-16T17:34:26
2021-08-16T17:34:26
396,899,227
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 Queue; /** * * @author Daveg */ public class QueueExample { public static void main(String args []){ LinkedQueue<String> queue = new LinkedQueue<>(); queue.enqueue("dave"); queue.enqueue("greene"); System.out.println("Peek"); System.out.println(queue.peek()); System.out.println(queue.toString()); } }
UTF-8
Java
592
java
QueueExample.java
Java
[ { "context": " the editor.\n */\npackage Queue;\n\n/**\n *\n * @author Daveg\n */\npublic class QueueExample {\n \n public s", "end": 224, "score": 0.9995418190956116, "start": 219, "tag": "NAME", "value": "Daveg" }, { "context": " LinkedQueue<>();\n \n queue.enqueue(\"dave\");\n queue.enqueue(\"greene\");\n Syste", "end": 409, "score": 0.9996579885482788, "start": 405, "tag": "NAME", "value": "dave" }, { "context": " queue.enqueue(\"dave\");\n queue.enqueue(\"greene\");\n System.out.println(\"Peek\");\n Sy", "end": 442, "score": 0.9989598989486694, "start": 436, "tag": "NAME", "value": "greene" } ]
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 Queue; /** * * @author Daveg */ public class QueueExample { public static void main(String args []){ LinkedQueue<String> queue = new LinkedQueue<>(); queue.enqueue("dave"); queue.enqueue("greene"); System.out.println("Peek"); System.out.println(queue.peek()); System.out.println(queue.toString()); } }
592
0.603041
0.603041
26
21.76923
21.557272
79
false
false
0
0
0
0
0
0
0.384615
false
false
5