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
050a39f64d085163575662c7715bb3827c8803f2
30,949,534,386,907
b72bd78d54071e3bfc1b982f73590693f9652ec1
/Invasion of the Kappa Storm/src/Unit.java
f2968c9a366fb5828587ecacb9a06e53405aba3d
[]
no_license
alexlu13/InvasionOfTheKappaStorm
https://github.com/alexlu13/InvasionOfTheKappaStorm
a4c6581f004b27b05a84ddd289dea5909fc4099a
1c648376642395d9eea33f7c6570195df2d328a2
refs/heads/master
2016-08-12T06:32:26.542000
2016-01-29T18:54:15
2016-01-29T18:54:15
50,683,771
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* File Name: Unit.java Name: Alexander Lu Date: Match 27, 2015 Description: This class is the basis for all of the units to be handled in the game */ public abstract class Unit { //Size of the unit protected float size; protected float step; protected int health; protected int maxHealth; //X and Y coordinate of the unit protected Vector2f coordinates; //Constructor public Unit(float xCor, float yCor, float size, float step, int maxHealth){ coordinates = new Vector2f(xCor, yCor); this.size = size; this.step = step; this.maxHealth = maxHealth; this.health = maxHealth; } //Accessors public int getMaxHealth(){ return maxHealth; } public int getHealth(){ return health; } public float getX(){ return coordinates.getX(); } public float getY(){ return coordinates.getY(); } public float getSize(){ return size; } public float getStep(){ return step; } public void setY(float y){ coordinates.setY(y); } //Methods for movement public void moveUp(float step) { coordinates.addY(step); } public void moveDown(float step) { coordinates.addY(-step); } public void moveLeft(float step) { coordinates.addX(-step); } public void moveRight(float step) { coordinates.addX(step); } }
UTF-8
Java
1,271
java
Unit.java
Java
[ { "context": "/* \n\tFile Name: Unit.java\n\tName: Alexander Lu\n\tDate: Match 27, 2015\n\tDescription: This class is", "end": 45, "score": 0.9995815753936768, "start": 33, "tag": "NAME", "value": "Alexander Lu" } ]
null
[]
/* File Name: Unit.java Name: <NAME> Date: Match 27, 2015 Description: This class is the basis for all of the units to be handled in the game */ public abstract class Unit { //Size of the unit protected float size; protected float step; protected int health; protected int maxHealth; //X and Y coordinate of the unit protected Vector2f coordinates; //Constructor public Unit(float xCor, float yCor, float size, float step, int maxHealth){ coordinates = new Vector2f(xCor, yCor); this.size = size; this.step = step; this.maxHealth = maxHealth; this.health = maxHealth; } //Accessors public int getMaxHealth(){ return maxHealth; } public int getHealth(){ return health; } public float getX(){ return coordinates.getX(); } public float getY(){ return coordinates.getY(); } public float getSize(){ return size; } public float getStep(){ return step; } public void setY(float y){ coordinates.setY(y); } //Methods for movement public void moveUp(float step) { coordinates.addY(step); } public void moveDown(float step) { coordinates.addY(-step); } public void moveLeft(float step) { coordinates.addX(-step); } public void moveRight(float step) { coordinates.addX(step); } }
1,265
0.691581
0.685287
73
16.410959
16.208263
84
false
false
0
0
0
0
0
0
1.479452
false
false
2
696bfe668f79d685a58949c717dc387f289dc197
26,499,948,247,328
9c5547af55e62610548c9b4b7dcb6d726feadabc
/src/main/java/com/uniovi/services/PeticionAmistadService.java
add16f918fa77cb879920019eb366ef9ea593001
[]
no_license
javiercasfer95/RedSocialnator
https://github.com/javiercasfer95/RedSocialnator
58515fabd10643a8585cb315fcf05e7c3f422c09
cb1647e0b5ee2727a41e093536aace79bd451b97
refs/heads/master
2021-01-25T11:57:59.730000
2018-03-24T17:21:21
2018-03-24T17:21:21
123,451,312
0
0
null
false
2018-03-07T11:10:40
2018-03-01T15:11:44
2018-03-01T18:28:00
2018-03-07T11:10:03
7,168
0
0
2
Java
false
null
package com.uniovi.services; import java.util.Calendar; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import com.uniovi.entities.PeticionAmistad; import com.uniovi.entities.User; import com.uniovi.repositories.PeticionAmistadRepository; import com.uniovi.repositories.UsersRepository; @Service public class PeticionAmistadService { @Autowired private PeticionAmistadRepository peticionAmistadRepository; // OJO QUE ESTÁ HACIENDO UN FIND ALL @Autowired private UsersRepository userRepository; @Autowired private RoleService roleService; private final Logger log = LoggerFactory.getLogger(this.getClass()); public Page<PeticionAmistad> getAllPeticionesFromUser(Pageable pageable, User user) { Page<PeticionAmistad> requests = peticionAmistadRepository.searchPeticionesFromUser(pageable, user); return requests; } // OJO QUE ESTÁ HACIENDO UN FIND ALL public Page<PeticionAmistad> getAllPeticionesToUser(Pageable pageable, User user) { Page<PeticionAmistad> peticiones = peticionAmistadRepository.searchPeticionesToUser(pageable, user); return peticiones; } public Page<PeticionAmistad> getAllPeticionesDelSistema(Pageable pageable) { Page<PeticionAmistad> res = peticionAmistadRepository.findAll(pageable); return res; } public void crearPeticionAmistad(User origen, User destino) { if (origen.getEmail().equals(destino.getEmail())) { log.debug("Se ha intentado crear una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); return; } if (origen.getRole().equals(roleService.getAdminRole()) || destino.getRole().equals(roleService.adminRole)) { log.debug("Se ha intentado crear una peticion de amistad entre algun admin y no, no queremos eso. Fecha: " + Calendar.getInstance().getTime()); return; } /* * No queremos añadir mas de una peticion de amistad entre dos usuarios */ if (peticionAmistadRepository.numeroPeticionesEntreDosUsuarios(origen, destino) > 0) { return; } else { PeticionAmistad peticionNueva = new PeticionAmistad(origen, destino); peticionAmistadRepository.save(peticionNueva); } log.info("Se ha creado una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); } public void aceptarPeticionAmistad(User origen, User destino) { if (origen.getEmail().equals(destino.getEmail())) { log.debug("Se ha intentado aceptar una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); return; } if (origen.getRole().equals(roleService.getAdminRole()) || destino.getRole().equals(roleService.adminRole)) { log.debug("Se ha intentado acpetar una peticion de amistad entre algun admin y no, no queremos eso. Fecha: " + Calendar.getInstance().getTime()); return; } PeticionAmistad pet = peticionAmistadRepository.findByUsers(origen, destino); pet.setAceptada(true); peticionAmistadRepository.save(pet); origen.getAmigos().add(destino); destino.getAmigos().add(origen); userRepository.save(origen); userRepository.save(destino); System.out.println(origen.getAmigos()); log.info("Se ha aceptado una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); } public boolean existePeticion(User origen, User destino) { if (peticionAmistadRepository.numeroPeticionesEntreDosUsuarios(origen, destino) > 0) { return true; } return false; } }
UTF-8
Java
3,873
java
PeticionAmistadService.java
Java
[]
null
[]
package com.uniovi.services; import java.util.Calendar; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import com.uniovi.entities.PeticionAmistad; import com.uniovi.entities.User; import com.uniovi.repositories.PeticionAmistadRepository; import com.uniovi.repositories.UsersRepository; @Service public class PeticionAmistadService { @Autowired private PeticionAmistadRepository peticionAmistadRepository; // OJO QUE ESTÁ HACIENDO UN FIND ALL @Autowired private UsersRepository userRepository; @Autowired private RoleService roleService; private final Logger log = LoggerFactory.getLogger(this.getClass()); public Page<PeticionAmistad> getAllPeticionesFromUser(Pageable pageable, User user) { Page<PeticionAmistad> requests = peticionAmistadRepository.searchPeticionesFromUser(pageable, user); return requests; } // OJO QUE ESTÁ HACIENDO UN FIND ALL public Page<PeticionAmistad> getAllPeticionesToUser(Pageable pageable, User user) { Page<PeticionAmistad> peticiones = peticionAmistadRepository.searchPeticionesToUser(pageable, user); return peticiones; } public Page<PeticionAmistad> getAllPeticionesDelSistema(Pageable pageable) { Page<PeticionAmistad> res = peticionAmistadRepository.findAll(pageable); return res; } public void crearPeticionAmistad(User origen, User destino) { if (origen.getEmail().equals(destino.getEmail())) { log.debug("Se ha intentado crear una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); return; } if (origen.getRole().equals(roleService.getAdminRole()) || destino.getRole().equals(roleService.adminRole)) { log.debug("Se ha intentado crear una peticion de amistad entre algun admin y no, no queremos eso. Fecha: " + Calendar.getInstance().getTime()); return; } /* * No queremos añadir mas de una peticion de amistad entre dos usuarios */ if (peticionAmistadRepository.numeroPeticionesEntreDosUsuarios(origen, destino) > 0) { return; } else { PeticionAmistad peticionNueva = new PeticionAmistad(origen, destino); peticionAmistadRepository.save(peticionNueva); } log.info("Se ha creado una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); } public void aceptarPeticionAmistad(User origen, User destino) { if (origen.getEmail().equals(destino.getEmail())) { log.debug("Se ha intentado aceptar una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); return; } if (origen.getRole().equals(roleService.getAdminRole()) || destino.getRole().equals(roleService.adminRole)) { log.debug("Se ha intentado acpetar una peticion de amistad entre algun admin y no, no queremos eso. Fecha: " + Calendar.getInstance().getTime()); return; } PeticionAmistad pet = peticionAmistadRepository.findByUsers(origen, destino); pet.setAceptada(true); peticionAmistadRepository.save(pet); origen.getAmigos().add(destino); destino.getAmigos().add(origen); userRepository.save(origen); userRepository.save(destino); System.out.println(origen.getAmigos()); log.info("Se ha aceptado una peticion de amistad entre " + origen.getEmail() + " y " + destino.getEmail() + ". Fecha: " + Calendar.getInstance().getTime()); } public boolean existePeticion(User origen, User destino) { if (peticionAmistadRepository.numeroPeticionesEntreDosUsuarios(origen, destino) > 0) { return true; } return false; } }
3,873
0.740568
0.739535
107
35.168224
34.58012
113
false
false
0
0
0
0
0
0
1.112149
false
false
2
f94629660d730ed271c0d556de937801b0869a89
33,157,147,547,980
1994fced787030a0351e2e3db73265f286191d08
/src/main/java/com/yq/dormitory_system/service/RepairServiceImpl.java
2821e9d10dc4daa05158af5c335f6fe161e907f8
[]
no_license
hezhe1688/dormitorySystem
https://github.com/hezhe1688/dormitorySystem
2649b7f628df4abcdd0bfca710ccbc399f15b010
dee318a9021c15f1264d6e80bd11c3554b7a2d67
refs/heads/master
2021-01-08T16:21:34.536000
2020-02-19T14:24:55
2020-02-19T14:24:55
242,078,558
0
0
null
false
2020-07-02T02:18:13
2020-02-21T07:21:41
2020-02-21T07:21:52
2020-07-02T02:18:12
22
0
0
1
Java
false
false
package com.yq.dormitory_system.service; import com.yq.dormitory_system.mapper.RepairMapper; import com.yq.dormitory_system.model.Repair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author 贺哲 * @2020-02-18 21:57 */ @Service("repairService") public class RepairServiceImpl implements RepairService { @Autowired RepairMapper repairMapper; @Override public int insertRepair(Repair repair) { return repairMapper.insertRepair(repair); } @Override public int deleteRepairById(Integer[] ids) { return repairMapper.deleteRepairById(ids); } @Override public List<Repair> getAllRepair() { return repairMapper.getAllRepair(); } @Override public int updateRepair(Repair repair) { return repairMapper.updateRepair(repair); } }
UTF-8
Java
913
java
RepairServiceImpl.java
Java
[ { "context": ".Service;\n\nimport java.util.List;\n\n/**\n * @author 贺哲\n * @2020-02-18 21:57\n */\n@Service(\"repairService\"", "end": 291, "score": 0.998069167137146, "start": 289, "tag": "NAME", "value": "贺哲" } ]
null
[]
package com.yq.dormitory_system.service; import com.yq.dormitory_system.mapper.RepairMapper; import com.yq.dormitory_system.model.Repair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author 贺哲 * @2020-02-18 21:57 */ @Service("repairService") public class RepairServiceImpl implements RepairService { @Autowired RepairMapper repairMapper; @Override public int insertRepair(Repair repair) { return repairMapper.insertRepair(repair); } @Override public int deleteRepairById(Integer[] ids) { return repairMapper.deleteRepairById(ids); } @Override public List<Repair> getAllRepair() { return repairMapper.getAllRepair(); } @Override public int updateRepair(Repair repair) { return repairMapper.updateRepair(repair); } }
913
0.718372
0.705171
39
22.307692
20.527847
62
false
false
0
0
0
0
0
0
0.282051
false
false
2
f5fdf10999bf4c12543e970188e04ebaefde5bbb
28,638,841,967,627
63282de0cfc2d3b485f34157edb5ec946853209c
/smallchart/src/main/java/com/idtk/smallchart/chart/LineChart.java
8734c7d451ea9c3bfdfb7bb7894ec15b56cb1d92
[ "Apache-2.0" ]
permissive
wangxiaoxiaohan/VehicleState
https://github.com/wangxiaoxiaohan/VehicleState
695741f0e61c33932857b6e1743ac935a4b3d8e2
97edf8a5c962a66d2e41446b3cab47909d2cd395
refs/heads/master
2020-03-19T04:08:16.603000
2018-06-02T10:51:09
2018-06-02T10:51:09
135,798,184
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.idtk.smallchart.chart; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import com.idtk.smallchart.interfaces.iChart.ILineChart; import com.idtk.smallchart.interfaces.iData.ILineData; import com.idtk.smallchart.render.LineChartRender; import com.idtk.smallchart.render.XAxisRender; import com.idtk.smallchart.render.YAxisRender; /** * Created by Idtk on 2016/6/6. * Blog : http://www.idtkm.com * GitHub : https://github.com/Idtk * 描述 ; 折线图表绘制类 */ public class LineChart extends BarLineCurveChart<ILineData> implements ILineChart{ private LineChartRender mLineChartRender; // private PointData mPointData = new PointData(); private float pointOutRadius; private float pointInRadius; // private PointData.PointShape pointShape = PointData.PointShape.CIRCLE; private boolean isPointInRadius = false, isPointOutRadius=false; public LineChart(Context context) { super(context); } public LineChart(Context context, AttributeSet attrs) { super(context, attrs); } public LineChart(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); /*if (!isPointOutRadius){ pointOutRadius = mXAxisData.getAxisLength()/70; } if (!isPointInRadius){ pointInRadius = mXAxisData.getAxisLength()/100; } mPointData.setInRadius(pointInRadius); mPointData.setOutRadius(pointOutRadius); mPointData.setPointShape(pointShape);*/ chartRenderList.clear(); for (int i=0; i<mDataList.size(); i++){ mLineChartRender = new LineChartRender(mDataList.get(i),mXAxisData,mYAxisData,0); chartRenderList.add(mLineChartRender); } } @Override protected void axisScale() { mXAxisData.setAxisScale(mXAxisData.getAxisLength()/(mXAxisData.getMaximum()-mXAxisData.getMinimum())); mYAxisData.setAxisScale(mYAxisData.getAxisLength()/(mYAxisData.getMaximum()-mYAxisData.getMinimum())); mXAxisRender = new XAxisRender(mXAxisData,mYAxisData); mYAxisRender = new YAxisRender(mYAxisData,mXAxisData); } @Override protected void axisRender(Canvas canvas) { mXAxisRender.drawGraph(canvas); mYAxisRender.drawGraph(canvas); } }
UTF-8
Java
2,506
java
LineChart.java
Java
[ { "context": ".smallchart.render.YAxisRender;\n\n/**\n * Created by Idtk on 2016/6/6.\n * Blog : http://www.idtkm.com\n * Gi", "end": 415, "score": 0.9996883273124695, "start": 411, "tag": "USERNAME", "value": "Idtk" }, { "context": "tp://www.idtkm.com\n * GitHub : https://github.com...
null
[]
package com.idtk.smallchart.chart; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import com.idtk.smallchart.interfaces.iChart.ILineChart; import com.idtk.smallchart.interfaces.iData.ILineData; import com.idtk.smallchart.render.LineChartRender; import com.idtk.smallchart.render.XAxisRender; import com.idtk.smallchart.render.YAxisRender; /** * Created by Idtk on 2016/6/6. * Blog : http://www.idtkm.com * GitHub : https://github.com/Idtk * 描述 ; 折线图表绘制类 */ public class LineChart extends BarLineCurveChart<ILineData> implements ILineChart{ private LineChartRender mLineChartRender; // private PointData mPointData = new PointData(); private float pointOutRadius; private float pointInRadius; // private PointData.PointShape pointShape = PointData.PointShape.CIRCLE; private boolean isPointInRadius = false, isPointOutRadius=false; public LineChart(Context context) { super(context); } public LineChart(Context context, AttributeSet attrs) { super(context, attrs); } public LineChart(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); /*if (!isPointOutRadius){ pointOutRadius = mXAxisData.getAxisLength()/70; } if (!isPointInRadius){ pointInRadius = mXAxisData.getAxisLength()/100; } mPointData.setInRadius(pointInRadius); mPointData.setOutRadius(pointOutRadius); mPointData.setPointShape(pointShape);*/ chartRenderList.clear(); for (int i=0; i<mDataList.size(); i++){ mLineChartRender = new LineChartRender(mDataList.get(i),mXAxisData,mYAxisData,0); chartRenderList.add(mLineChartRender); } } @Override protected void axisScale() { mXAxisData.setAxisScale(mXAxisData.getAxisLength()/(mXAxisData.getMaximum()-mXAxisData.getMinimum())); mYAxisData.setAxisScale(mYAxisData.getAxisLength()/(mYAxisData.getMaximum()-mYAxisData.getMinimum())); mXAxisRender = new XAxisRender(mXAxisData,mYAxisData); mYAxisRender = new YAxisRender(mYAxisData,mXAxisData); } @Override protected void axisRender(Canvas canvas) { mXAxisRender.drawGraph(canvas); mYAxisRender.drawGraph(canvas); } }
2,506
0.702974
0.697749
73
33.082191
27.343454
110
false
false
0
0
0
0
0
0
0.739726
false
false
2
9b7745f1eedd8cca861272f5f932fb808163e53b
1,271,310,383,854
7d618c45fe802a43fd8dc4af79b20cad6dfe64d4
/HeardFirstJava/src/heardfirstjava/HobbitsTestDrive.java
326f66f8a2c97562e617714b5477d10b5c7ca5f3
[]
no_license
DavidP1983/Netbeans
https://github.com/DavidP1983/Netbeans
43fbfbf3012c9653c64b700e452140148d8b69c3
04e88a4e5bdd0e35dce980d83f4d84e22b1ab114
refs/heads/master
2020-04-17T12:26:28.885000
2020-01-17T23:05:59
2020-01-17T23:05:59
166,579,092
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package heardfirstjava; class Hobbits { String name; } public class HobbitsTestDrive { public static void main(String[] args) { Hobbits[] h = new Hobbits[3]; int z = -1; //because an array strats with element "0" while(z < 2){ z = z + 1; h[z] = new Hobbits(); h[z].name = "Bilbo"; if(z==1){ h[z].name = "Frodo"; } if(z==2){ h[z].name = "sam"; } System.out.print(h[z].name + " is a "); System.out.println(" good Hobbit name "); } } }
UTF-8
Java
858
java
HobbitsTestDrive.java
Java
[ { "context": " h[z] = new Hobbits();\r\n h[z].name = \"Bilbo\";\r\n if(z==1){\r\n h[z].na", "end": 569, "score": 0.9997522234916687, "start": 564, "tag": "NAME", "value": "Bilbo" }, { "context": " if(z==1){\r\n h[z].name =...
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 heardfirstjava; class Hobbits { String name; } public class HobbitsTestDrive { public static void main(String[] args) { Hobbits[] h = new Hobbits[3]; int z = -1; //because an array strats with element "0" while(z < 2){ z = z + 1; h[z] = new Hobbits(); h[z].name = "Bilbo"; if(z==1){ h[z].name = "Frodo"; } if(z==2){ h[z].name = "sam"; } System.out.print(h[z].name + " is a "); System.out.println(" good Hobbit name "); } } }
858
0.474359
0.4662
34
23.235294
20.373077
79
false
false
0
0
0
0
0
0
0.411765
false
false
2
13fa7e01a45a30436b881e7cd6c9651d89bb6038
18,219,251,333,323
ec2abe8fa8134341f1d8821066a59fb738af4381
/framework/changed-src/vdoclet/src/java/vdoclet/ejb/Ejb_BaseTest.java
7522c8b4a8b315a7556ec2e893aaf04e1be02134
[]
no_license
madebits/java-j2me-mobcon
https://github.com/madebits/java-j2me-mobcon
c9499c0234d3c75b6bd355c902e4b905b1728ea2
3261c7d6a4715a5ab81aa0665bc442eaa6cb41be
refs/heads/master
2016-09-06T06:12:27.426000
2015-10-03T12:00:00
2015-10-03T12:00:00
26,282,921
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vdoclet.ejb; import junit.framework.TestCase; import vdoclet.docinfo.*; /** * Base-test for EjbView derivatives */ public abstract class Ejb_BaseTest extends TestCase { //---( Setup )--- public Ejb_BaseTest( String name ) { super( name ); } public ClassInfo fubarSrc; public EjbInfo fubarEjb; public void setUp() { fubarSrc = new ClassInfo( "demo.FubarBean" ); fubarEjb = new EjbInfo( fubarSrc ); fubarEjb.setBundle( new EjbBundle( new DocInfo() )); } }
UTF-8
Java
539
java
Ejb_BaseTest.java
Java
[]
null
[]
package vdoclet.ejb; import junit.framework.TestCase; import vdoclet.docinfo.*; /** * Base-test for EjbView derivatives */ public abstract class Ejb_BaseTest extends TestCase { //---( Setup )--- public Ejb_BaseTest( String name ) { super( name ); } public ClassInfo fubarSrc; public EjbInfo fubarEjb; public void setUp() { fubarSrc = new ClassInfo( "demo.FubarBean" ); fubarEjb = new EjbInfo( fubarSrc ); fubarEjb.setBundle( new EjbBundle( new DocInfo() )); } }
539
0.625232
0.625232
26
19.73077
18.836458
60
false
false
0
0
0
0
0
0
0.346154
false
false
2
f3236f966e16531b3b5fe57283fae61901b9c61c
6,390,911,359,723
fe276aafdb5ed02919ab693d2e91e6c71645dd3d
/Final/src/CreditStringMatcher.java
b13c066eee01a7b0d2bff969701923d6e3c289b0
[]
no_license
T4RGE7/summer-project-final
https://github.com/T4RGE7/summer-project-final
10d8d642a95ea165a7210efd06802a57e19a4382
2d2af42e1a0cbafe31abea04b10506099b4c8d28
refs/heads/master
2020-06-01T04:44:53.614000
2013-08-01T18:23:40
2013-08-01T18:23:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class CreditStringMatcher { private String rawIn, track[]; public CreditStringMatcher(String rawIn) { this.rawIn = rawIn; if(this.rawIn.contains(";")) { this.track = this.rawIn.split(";"); } else { this.track = new String[]{this.rawIn}; } } public CreditCard getCreditCard() { String firstName, lastName, pan, expM, expY, security; pan = this.trackOnePan(); return new CreditCard(firstName, lastName, pan ,expM, expY, security); } public String trackOnePan() { String toReturn = ""; Scanner regex = new Scanner(track[0]); toReturn = regex.findInLine("%B\\d*\\^"); regex.close(); toReturn = (toReturn != null ? toReturn.substring(2, toReturn.length() - 1) : ""); return toReturn; } public String[] trackOneName() { String[] toReturn = {"",""}; Scanner regex = new Scanner(track[0]); String temp = regex.findInLine("\\^[A-Z 0-9/$]*\\^"); regex.close(); return toReturn; } }
UTF-8
Java
993
java
CreditStringMatcher.java
Java
[ { "context": "\t}\n\t\n\tpublic CreditCard getCreditCard() {\n\t\tString firstName, lastName, pan, expM, expY, security;\n\t\t\n\t\tpan = ", "end": 355, "score": 0.9989570379257202, "start": 346, "tag": "NAME", "value": "firstName" }, { "context": "c CreditCard getCreditCard() {\n\t\...
null
[]
import java.util.Scanner; public class CreditStringMatcher { private String rawIn, track[]; public CreditStringMatcher(String rawIn) { this.rawIn = rawIn; if(this.rawIn.contains(";")) { this.track = this.rawIn.split(";"); } else { this.track = new String[]{this.rawIn}; } } public CreditCard getCreditCard() { String firstName, lastName, pan, expM, expY, security; pan = this.trackOnePan(); return new CreditCard(firstName, lastName, pan ,expM, expY, security); } public String trackOnePan() { String toReturn = ""; Scanner regex = new Scanner(track[0]); toReturn = regex.findInLine("%B\\d*\\^"); regex.close(); toReturn = (toReturn != null ? toReturn.substring(2, toReturn.length() - 1) : ""); return toReturn; } public String[] trackOneName() { String[] toReturn = {"",""}; Scanner regex = new Scanner(track[0]); String temp = regex.findInLine("\\^[A-Z 0-9/$]*\\^"); regex.close(); return toReturn; } }
993
0.63142
0.625378
47
20.127659
21.006197
86
false
false
0
0
0
0
0
0
2.276596
false
false
2
450a9883698792987c153203b1d42448b433d67b
7,284,264,568,711
d4671044d2c7057bb563a0e5b580d418dac2521a
/src/Button.java
a5d5dba2d03827e339284c1c86e67ea7f456b268
[]
no_license
mbugti04/powergrid
https://github.com/mbugti04/powergrid
61c746488b11ff93ed32c174ea51e32d32a9a91e
1ae0f16da6e78f850dbc38cc73ded009007c5763
refs/heads/master
2023-06-07T15:42:41.724000
2023-05-28T17:27:54
2023-05-28T17:27:54
241,703,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.event.MouseEvent; class Button { static int normalw = 200, normalh = 100; Color color = null; String name; int x, y, w, h; boolean on; boolean showname = true; Button(String name, int x, int y, int w, int h) { this.name = name; this.x = x; this.y = y; this.w = w; this.h = h; on = false; } Button(String name, int x, int y, int w, int h, Color col) { this(name, x, y, w, h); color = col; } Button(String name, int x, int y, int w, int h, boolean showname) { this(name, x, y, w, h); this.showname = showname; } Button(String name, int x, int y, int w, int h, boolean showname, Color col) { this(name, x, y, w, h, col); this.showname = showname; } boolean press() { on = !on; return on; } boolean isPressed() { return on; } void draw(Graphics2D g2) { g2.setFont(new Font("Calibri", Font.PLAIN, 16)); if (!on) g2.setColor(Color.DARK_GRAY); else if (on) g2.setColor(new Color(12, 120, 123)); if (color != null) g2.setColor(color); g2.fillRect(x, y, w, h); g2.setColor(Color.WHITE); if (showname) g2.drawString(name, x + w / 10, y + h / 2); } boolean inBounds(MouseEvent m) { return m.getX() >= x && m.getY() >= y && m.getX() <= x + w && m.getY() <= y + h; } public String toString() { return name;} }
UTF-8
Java
1,464
java
Button.java
Java
[]
null
[]
import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.event.MouseEvent; class Button { static int normalw = 200, normalh = 100; Color color = null; String name; int x, y, w, h; boolean on; boolean showname = true; Button(String name, int x, int y, int w, int h) { this.name = name; this.x = x; this.y = y; this.w = w; this.h = h; on = false; } Button(String name, int x, int y, int w, int h, Color col) { this(name, x, y, w, h); color = col; } Button(String name, int x, int y, int w, int h, boolean showname) { this(name, x, y, w, h); this.showname = showname; } Button(String name, int x, int y, int w, int h, boolean showname, Color col) { this(name, x, y, w, h, col); this.showname = showname; } boolean press() { on = !on; return on; } boolean isPressed() { return on; } void draw(Graphics2D g2) { g2.setFont(new Font("Calibri", Font.PLAIN, 16)); if (!on) g2.setColor(Color.DARK_GRAY); else if (on) g2.setColor(new Color(12, 120, 123)); if (color != null) g2.setColor(color); g2.fillRect(x, y, w, h); g2.setColor(Color.WHITE); if (showname) g2.drawString(name, x + w / 10, y + h / 2); } boolean inBounds(MouseEvent m) { return m.getX() >= x && m.getY() >= y && m.getX() <= x + w && m.getY() <= y + h; } public String toString() { return name;} }
1,464
0.568989
0.54918
74
17.81081
18.361002
82
false
false
0
0
0
0
0
0
2.391892
false
false
2
6c3b8f5bcd79c9cc0d6234015595d291787d10b4
7,284,264,569,422
2324fd02d5cc25d80853c329139251145599abb1
/app/src/test/java/com/kickstarter/libs/utils/DiffUtilsTest.java
36ed3f20cffa2edcf7ee10f4371e14231b0478dd
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "ICU", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-facebook-software-license", "EPL-1.0", "MIT" ]
permissive
appspector/android-oss
https://github.com/appspector/android-oss
4554deffd08924636c4a856bc9f5afa3bd10bae3
3fc542d10a32416338b66ea5e6ac5b8144e5bc2f
refs/heads/master
2020-03-15T12:56:18.640000
2018-05-15T11:25:54
2018-05-15T11:25:54
132,154,951
1
1
Apache-2.0
true
2018-05-24T14:30:59
2018-05-04T15:04:54
2018-05-15T11:26:19
2018-05-24T14:30:59
19,111
0
1
0
Java
false
null
package com.kickstarter.libs.utils; import junit.framework.TestCase; import java.util.Arrays; import java.util.List; import rx.functions.Func2; public class DiffUtilsTest extends TestCase { public void testDiff_WithExpandingSection() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 3, 31, 32, 33, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(3, 4, 5)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithCollapsingSection() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 31, 32, 33, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 3, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .deletions(Arrays.asList(3, 4, 5)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithChangedSingleItem() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 6, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(2)) .deletions(Arrays.asList(2)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithTheWholeEnchilada() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 40, 41, 42, 43, 5); final List<Integer> newItems = Arrays.asList(1, 2, 6, 61, 62, 63, 4, 5); final Func2<Integer, Integer, Boolean> equality = (x, y) -> x.equals(y) || (x == 4 && y == 40) || (x == 40 && y == 4); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(2, 3, 4, 5)) .deletions(Arrays.asList(2, 4, 5, 6)) .updates(Arrays.asList(3)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems, equality)); } }
UTF-8
Java
1,961
java
DiffUtilsTest.java
Java
[]
null
[]
package com.kickstarter.libs.utils; import junit.framework.TestCase; import java.util.Arrays; import java.util.List; import rx.functions.Func2; public class DiffUtilsTest extends TestCase { public void testDiff_WithExpandingSection() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 3, 31, 32, 33, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(3, 4, 5)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithCollapsingSection() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 31, 32, 33, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 3, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .deletions(Arrays.asList(3, 4, 5)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithChangedSingleItem() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 4, 5); final List<Integer> newItems = Arrays.asList(1, 2, 6, 4, 5); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(2)) .deletions(Arrays.asList(2)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems)); } public void testDiff_WithTheWholeEnchilada() { final List<Integer> oldItems = Arrays.asList(1, 2, 3, 40, 41, 42, 43, 5); final List<Integer> newItems = Arrays.asList(1, 2, 6, 61, 62, 63, 4, 5); final Func2<Integer, Integer, Boolean> equality = (x, y) -> x.equals(y) || (x == 4 && y == 40) || (x == 40 && y == 4); final DiffUtils.Diff expected = DiffUtils.Diff.builder() .insertions(Arrays.asList(2, 3, 4, 5)) .deletions(Arrays.asList(2, 4, 5, 6)) .updates(Arrays.asList(3)) .build(); assertEquals(expected, DiffUtils.diff(oldItems, newItems, equality)); } }
1,961
0.661397
0.615502
59
32.237289
29.511469
122
false
false
0
0
0
0
0
0
1.559322
false
false
2
73df101dcb5f2c126bb9d745be81d2afa358a48c
28,260,884,840,625
2bb5081dc0cc6d6d7b955600eb64c8d428d257dd
/stage2/day03/14_潘耀峰练习2/com/bjpowernode/demo02/BlackBird.java
d1e0e6a5704a1e7ec722afe4188359c68e3c83eb
[]
no_license
98feng/RBAC
https://github.com/98feng/RBAC
a102bbb3f4ab5f9f7c7d41f4e611e169a5f8ade2
a02d6551b5f541bca5d45115419c5229f08b4ed3
refs/heads/master
2023-04-02T16:56:17.395000
2021-04-19T10:43:50
2021-04-19T10:43:50
359,396,867
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bjpowernode.demo02; /** * @author feng * @date 2020/12/17 * @Description */ public class BlackBird extends Bird implements Flyable { @Override public void flay() { System.out.println("爆炸"); } }
UTF-8
Java
235
java
BlackBird.java
Java
[ { "context": "package com.bjpowernode.demo02;\n\n/**\n * @author feng\n * @date 2020/12/17\n * @Description\n */\npublic cl", "end": 52, "score": 0.912436306476593, "start": 48, "tag": "USERNAME", "value": "feng" } ]
null
[]
package com.bjpowernode.demo02; /** * @author feng * @date 2020/12/17 * @Description */ public class BlackBird extends Bird implements Flyable { @Override public void flay() { System.out.println("爆炸"); } }
235
0.640693
0.597403
13
16.76923
15.517503
56
false
false
0
0
0
0
0
0
0.153846
false
false
2
754472e8bb9a5d720339f59ac7ff68d820fe8e5c
26,938,034,915,222
dab74b09265b4ccb17fc349e43eab864c502bd65
/app/src/main/java/ca/ualberta/t04/medicaltracker/Adapter/PatientListAdapter.java
c0c03034ab943c09380a6ddd0ba86a48c5c6febe
[ "MIT" ]
permissive
CMPUT301F18T04/MedicalTracker
https://github.com/CMPUT301F18T04/MedicalTracker
1ce22b31d449d5fd8a89626b38a23feff017e61f
535db9199b14c539ddf93d70165603ec5494bcbc
refs/heads/master
2020-03-31T19:47:44.060000
2018-12-03T22:06:53
2018-12-03T22:06:53
152,511,798
3
2
MIT
false
2018-12-03T22:03:57
2018-10-11T01:21:01
2018-12-03T22:01:53
2018-12-03T22:03:56
38,218
2
1
0
Java
false
null
package ca.ualberta.t04.medicaltracker.Adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.List; import ca.ualberta.t04.medicaltracker.Model.Patient; import ca.ualberta.t04.medicaltracker.R; /** * This class represents a custom adapter for displaying patient list * * @author CMPUT301F18T04 Team 04 * @version Project part 05 1.0 * @since 1.0 */ /* This class represents a custom adapter for displaying patient list */ public class PatientListAdapter extends ArrayAdapter { private int recourseId; private List<Patient> patients; public PatientListAdapter(@NonNull Context context, int resource, @NonNull List<Patient> patients) { super(context, resource, patients); recourseId = resource; this.patients = patients; } /** * returns the custom view * @param position int * @param convertView View * @param parent ViewGroup * @return view View */ @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { final Patient patient = (Patient) getItem(position); View view = LayoutInflater.from(getContext()).inflate(recourseId, null); TextView userName = view.findViewById(R.id.patient_username); TextView detail = view.findViewById(R.id.patient_detail); userName.setText(patient.getUserName()); String detail_text = getContext().getString(R.string.add_patient_detail); detail_text = detail_text.replace("%d", String.valueOf(patient.getProblemList().getProblems().size())); detail.setText(detail_text); return view; } }
UTF-8
Java
1,904
java
PatientListAdapter.java
Java
[]
null
[]
package ca.ualberta.t04.medicaltracker.Adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.List; import ca.ualberta.t04.medicaltracker.Model.Patient; import ca.ualberta.t04.medicaltracker.R; /** * This class represents a custom adapter for displaying patient list * * @author CMPUT301F18T04 Team 04 * @version Project part 05 1.0 * @since 1.0 */ /* This class represents a custom adapter for displaying patient list */ public class PatientListAdapter extends ArrayAdapter { private int recourseId; private List<Patient> patients; public PatientListAdapter(@NonNull Context context, int resource, @NonNull List<Patient> patients) { super(context, resource, patients); recourseId = resource; this.patients = patients; } /** * returns the custom view * @param position int * @param convertView View * @param parent ViewGroup * @return view View */ @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { final Patient patient = (Patient) getItem(position); View view = LayoutInflater.from(getContext()).inflate(recourseId, null); TextView userName = view.findViewById(R.id.patient_username); TextView detail = view.findViewById(R.id.patient_detail); userName.setText(patient.getUserName()); String detail_text = getContext().getString(R.string.add_patient_detail); detail_text = detail_text.replace("%d", String.valueOf(patient.getProblemList().getProblems().size())); detail.setText(detail_text); return view; } }
1,904
0.714286
0.703256
64
28.75
27.919527
111
false
false
0
0
0
0
0
0
0.53125
false
false
2
dd9820f98831b0365054ba40b2ad12ef6fa173f1
22,050,362,130,939
9edba759c1c046fce5b3b633b4566d96c5f00ec7
/src/gfg/dsacourse/week1/Recursion/Subsequences.java
9bb3d29fc17649ff7f05e26feabe51508dc95485
[]
no_license
nbisht30/data-structures-and-algorithms
https://github.com/nbisht30/data-structures-and-algorithms
a5af63d948b5d54fd9ea4d9a6e963ed5094ad102
8b9030b549135883002bf6c32093d4b324c3e926
refs/heads/master
2022-02-12T16:44:49.778000
2022-01-26T08:51:10
2022-01-26T08:51:10
245,061,193
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gfg.dsacourse.week1.Recursion; public class Subsequences { public static void subseq(String str, String currStr, int i, String target) { if (i == str.length()) { if(currStr.equals(target)) System.out.println(currStr); return; } subseq(str, currStr, i + 1, target); // skip value at i subseq(str, currStr + str.charAt(i), i + 1, target); } public static void main(String[] args) { subseq("ABCAB", "", 0, "AB"); } }
UTF-8
Java
448
java
Subsequences.java
Java
[]
null
[]
package gfg.dsacourse.week1.Recursion; public class Subsequences { public static void subseq(String str, String currStr, int i, String target) { if (i == str.length()) { if(currStr.equals(target)) System.out.println(currStr); return; } subseq(str, currStr, i + 1, target); // skip value at i subseq(str, currStr + str.charAt(i), i + 1, target); } public static void main(String[] args) { subseq("ABCAB", "", 0, "AB"); } }
448
0.651786
0.642857
17
25.352942
22.741362
78
false
false
0
0
0
0
0
0
2.411765
false
false
2
fefd100c830fdedb3414ae88ae430efab57e5af7
7,825,430,413,833
413c46283db94588fdf5ae2f0bdd328ea02dfbf0
/src/samesun/java/vod/service/meetinginfo/MeetingInfoServiceI.java
0aacf2e19f67789681e9fd553ba43c4d22ca00f3
[]
no_license
narci2010/samesun-vod
https://github.com/narci2010/samesun-vod
d3e6a57425056b6ac6b105b248870615b9ee59e3
36fc60e519925b5b7f4fe89d1498229b6e55127d
refs/heads/master
2021-04-30T08:20:38.443000
2014-09-03T04:21:12
2014-09-03T04:21:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vod.service.meetinginfo; import java.util.List; import org.jeecgframework.core.common.service.CommonService; import vod.entity.appointmentmeetinginfo.AppointmentMeetingInfoEntity; import vod.entity.authoritygroup.AuthorityGroupEntity; import vod.entity.confcodecinfo.ConfCodecInfoEntity; import vod.entity.meetinginfo.MeetingInfoEntity; public interface MeetingInfoServiceI extends CommonService{ /** * 根据预约会议信息获取直播会议信息 * <br><font color="red">注: </font>当预约会议启用的时候,实际上是该预约会议已经变成了直播会议 * @param vod.entity.appointmentmeetinginfo.AppointmentMeetingInfoEntity * @return */ public MeetingInfoEntity getMeetingInfoFromAppointment(AppointmentMeetingInfoEntity app); public boolean isFinish(String id); public void autoRecordTask(); public List<ConfCodecInfoEntity> getCodecs(MeetingInfoEntity e); /** * 获取直播会议的所有终端分组(不重复) * @param e * @return */ public List<AuthorityGroupEntity> getGroups(MeetingInfoEntity e); /** * 当预约会议转为直播会议时判断该直播会议所需资源有没有被占用 * 因为要在生成直播信息前验证 * 所以根据预约信息判断 * @param meeting * @return */ public boolean wetherused(AppointmentMeetingInfoEntity app); }
UTF-8
Java
1,396
java
MeetingInfoServiceI.java
Java
[]
null
[]
package vod.service.meetinginfo; import java.util.List; import org.jeecgframework.core.common.service.CommonService; import vod.entity.appointmentmeetinginfo.AppointmentMeetingInfoEntity; import vod.entity.authoritygroup.AuthorityGroupEntity; import vod.entity.confcodecinfo.ConfCodecInfoEntity; import vod.entity.meetinginfo.MeetingInfoEntity; public interface MeetingInfoServiceI extends CommonService{ /** * 根据预约会议信息获取直播会议信息 * <br><font color="red">注: </font>当预约会议启用的时候,实际上是该预约会议已经变成了直播会议 * @param vod.entity.appointmentmeetinginfo.AppointmentMeetingInfoEntity * @return */ public MeetingInfoEntity getMeetingInfoFromAppointment(AppointmentMeetingInfoEntity app); public boolean isFinish(String id); public void autoRecordTask(); public List<ConfCodecInfoEntity> getCodecs(MeetingInfoEntity e); /** * 获取直播会议的所有终端分组(不重复) * @param e * @return */ public List<AuthorityGroupEntity> getGroups(MeetingInfoEntity e); /** * 当预约会议转为直播会议时判断该直播会议所需资源有没有被占用 * 因为要在生成直播信息前验证 * 所以根据预约信息判断 * @param meeting * @return */ public boolean wetherused(AppointmentMeetingInfoEntity app); }
1,396
0.762842
0.762842
43
25.16279
26.294336
90
false
false
0
0
0
0
0
0
0.976744
false
false
2
1b4448f63471718c94054c93cb8640b9c8494415
3,401,614,117,318
c5d610ac9ece5684aadf9fc81c18e8aa4ac68d28
/app/src/main/java/com/example/yodgor777/themoviedb/reviewDataHolder.java
dcd3f00db2cb8da95904ec1ab331ca4bfe70b4fd
[]
no_license
kyodgorbek/ThemovieDb
https://github.com/kyodgorbek/ThemovieDb
eed92c9f9da40f63c5f29ac1acfe4bc297425fac
96e3e055624cb667ba70ab5f4da65391bc561a0d
refs/heads/master
2020-05-24T06:14:16.495000
2017-07-03T09:49:26
2017-07-03T09:49:26
84,830,208
0
1
null
false
2017-03-14T13:49:59
2017-03-13T13:34:38
2017-03-13T13:35:04
2017-03-14T13:49:59
999
0
1
0
Java
null
null
package com.example.yodgor777.themoviedb; /** * Created by yodgor777 on 2017-02-07. */ public class reviewDataHolder { public String userName,Comment; }
UTF-8
Java
161
java
reviewDataHolder.java
Java
[ { "context": "package com.example.yodgor777.themoviedb;\n\n/**\n * Created by yodgor777 on 2017-", "end": 29, "score": 0.9711246490478516, "start": 20, "tag": "USERNAME", "value": "yodgor777" }, { "context": "m.example.yodgor777.themoviedb;\n\n/**\n * Created by yodgor777 on 2017-02-...
null
[]
package com.example.yodgor777.themoviedb; /** * Created by yodgor777 on 2017-02-07. */ public class reviewDataHolder { public String userName,Comment; }
161
0.732919
0.645963
9
16.888889
17.521063
41
false
false
0
0
0
0
0
0
0.333333
false
false
2
20654ac8f366e4688d68598a0c2b97aa1b7b9fa9
15,066,745,283,275
77a48259c256073bb078b1328e7a4192139b75ff
/app/src/main/java/com/jica/butterbookdata/database/dao/PrapositionDAO.java
7e2b9c6829e9593cef987cba64ffbf9830a9d648
[]
no_license
brian4462/ButterbookTest
https://github.com/brian4462/ButterbookTest
229eacdd5ef66b10c31c9de649e8e3690559ef6a
322ecc9d301de9d45dba952bb59cafb4028a0f67
refs/heads/master
2020-03-24T06:57:25.487000
2018-09-07T12:47:56
2018-09-07T12:47:56
142,547,698
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jica.butterbookdata.database.dao; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.OnConflictStrategy; import android.arch.persistence.room.Query; import android.arch.persistence.room.Update; import com.jica.butterbookdata.database.entity.VerbenMitPraposition; import java.util.List; @Dao public interface PrapositionDAO { //get by ID @Query("SELECT * FROM verben WHERE vid = :vid") VerbenMitPraposition get(int vid); //get All @Query("SELECT * FROM verben") List<VerbenMitPraposition> getAll(); //insert @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(VerbenMitPraposition... data); //update @Update void update(VerbenMitPraposition... data); //delete @Delete void delete(VerbenMitPraposition... data); }
UTF-8
Java
918
java
PrapositionDAO.java
Java
[]
null
[]
package com.jica.butterbookdata.database.dao; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.OnConflictStrategy; import android.arch.persistence.room.Query; import android.arch.persistence.room.Update; import com.jica.butterbookdata.database.entity.VerbenMitPraposition; import java.util.List; @Dao public interface PrapositionDAO { //get by ID @Query("SELECT * FROM verben WHERE vid = :vid") VerbenMitPraposition get(int vid); //get All @Query("SELECT * FROM verben") List<VerbenMitPraposition> getAll(); //insert @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(VerbenMitPraposition... data); //update @Update void update(VerbenMitPraposition... data); //delete @Delete void delete(VerbenMitPraposition... data); }
918
0.745098
0.745098
34
26
20.757706
68
false
false
0
0
0
0
0
0
0.411765
false
false
2
435f011694d512d21af9889ca47daf991c01d989
10,763,188,068,408
c321be3897f3dd1c88a884388e92710946ffaeb9
/src/december19/JSAlerts.java
053ba59fe649f857fb57f095661b7290dc0c98e4
[]
no_license
dtacademy2021/Selenium
https://github.com/dtacademy2021/Selenium
8df8cf56888dbd768a31b85c92d8d6096552fb0f
d0c4a5bbad3cfec1e93f716532028a849e8b5ffa
refs/heads/main
2023-02-13T06:13:45.933000
2021-01-06T03:16:00
2021-01-06T03:16:00
318,884,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package december19; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.UnhandledAlertException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class JSAlerts { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\SeleniumFiles\\browserDrivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://the-internet.herokuapp.com/javascript_alerts"); driver.findElement(By.xpath("//button[.='Click for JS Alert']")).click(); // try { // driver.findElement(By.xpath("//button[.='Click for JS Alert']")).sendKeys(Keys.ESCAPE); // } catch (UnhandledAlertException e) { // // TODO Auto-generated catch block // // } Alert alert = driver.switchTo().alert(); // NoAlertPresentException -> switchTo().alert() is called and there is no alert on the UI String alertText = alert.getText(); alert.accept(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You successfuly clicked an alert") && alertText.equals("I am a JS Alert")) { System.out.println("PASS"); }else { System.out.println("FAIL"); } driver.findElement(By.xpath("//button[.='Click for JS Confirm']")).click(); Alert alert2 = driver.switchTo().alert(); String text = alert2.getText(); alert2.dismiss(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You clicked: Cancel") && text.equals("I am a JS Confirm")) { System.out.println("PASS"); }else { System.out.println("FAIL"); } driver.findElement(By.xpath("//button[.='Click for JS Prompt']")).click(); driver.switchTo().alert().sendKeys("Duotech"); // UnhandledAlertException: unexpected alert open: driver.switchTo().alert().accept(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You entered: Duotech") ) { System.out.println("PASS"); }else { System.out.println("FAIL"); } } }
UTF-8
Java
2,128
java
JSAlerts.java
Java
[ { "context": "click();\n\t\t\n\t\tdriver.switchTo().alert().sendKeys(\"Duotech\");\n\t\t// UnhandledAlertException: unexpected alert", "end": 1832, "score": 0.6229422092437744, "start": 1825, "tag": "NAME", "value": "Duotech" } ]
null
[]
package december19; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.UnhandledAlertException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class JSAlerts { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\SeleniumFiles\\browserDrivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://the-internet.herokuapp.com/javascript_alerts"); driver.findElement(By.xpath("//button[.='Click for JS Alert']")).click(); // try { // driver.findElement(By.xpath("//button[.='Click for JS Alert']")).sendKeys(Keys.ESCAPE); // } catch (UnhandledAlertException e) { // // TODO Auto-generated catch block // // } Alert alert = driver.switchTo().alert(); // NoAlertPresentException -> switchTo().alert() is called and there is no alert on the UI String alertText = alert.getText(); alert.accept(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You successfuly clicked an alert") && alertText.equals("I am a JS Alert")) { System.out.println("PASS"); }else { System.out.println("FAIL"); } driver.findElement(By.xpath("//button[.='Click for JS Confirm']")).click(); Alert alert2 = driver.switchTo().alert(); String text = alert2.getText(); alert2.dismiss(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You clicked: Cancel") && text.equals("I am a JS Confirm")) { System.out.println("PASS"); }else { System.out.println("FAIL"); } driver.findElement(By.xpath("//button[.='Click for JS Prompt']")).click(); driver.switchTo().alert().sendKeys("Duotech"); // UnhandledAlertException: unexpected alert open: driver.switchTo().alert().accept(); if(driver.findElement(By.xpath("//p[@id='result']")).getText().equals("You entered: Duotech") ) { System.out.println("PASS"); }else { System.out.println("FAIL"); } } }
2,128
0.666353
0.664004
80
25.6
29.327717
107
false
false
0
0
0
0
0
0
2.175
false
false
2
d143cbdc305ac74101a0dfb1bf496f6c1af93223
5,815,385,737,276
be4c0227dca090a6241fbaaf66053e9343d7c90f
/src/main/java/com/de/utils/LeaveStatus.java
f564ca563e743c38fd4419b5ea1f07c8e8c57bd0
[]
no_license
dechaler/oa
https://github.com/dechaler/oa
c1ebafc98d56b1b52b0151c8352a153543014e1b
1ee9569e28f2395c5086d03d225efa8f891caa5b
refs/heads/master
2022-12-25T08:32:41.101000
2020-03-21T11:52:46
2020-03-21T11:52:46
217,517,946
0
0
null
false
2022-12-16T04:34:11
2019-10-25T11:20:43
2020-03-21T11:53:33
2022-12-16T04:34:07
917
0
0
14
Java
false
false
package com.de.utils; /** * @编写人:de * @时间:2019/10/23 * @描述:请假状态 */ public class LeaveStatus { public final static int WAIT= 0; public final static int PASS = 1; public final static int REFUSE = -1; }
UTF-8
Java
240
java
LeaveStatus.java
Java
[ { "context": "package com.de.utils;\n\n/**\n * @编写人:de\n * @时间:2019/10/23\n * @描述:请假状态\n */\npublic class Le", "end": 37, "score": 0.9936350584030151, "start": 35, "tag": "USERNAME", "value": "de" } ]
null
[]
package com.de.utils; /** * @编写人:de * @时间:2019/10/23 * @描述:请假状态 */ public class LeaveStatus { public final static int WAIT= 0; public final static int PASS = 1; public final static int REFUSE = -1; }
240
0.62844
0.577982
13
15.769231
14.353524
40
false
false
0
0
0
0
0
0
0.307692
false
false
2
d8d04493cc3694df09fc9841fddbe3d78ea90101
17,660,905,571,923
a1f54c4fc08b70dfcde20dd3dc2e0b544850ceb9
/Setter/src/Ch_3/BasketDemo.java
e51ee21e723c7858908705b50fcf9d7debd70adb
[]
no_license
smith1984/java_src_tutorial
https://github.com/smith1984/java_src_tutorial
175d4f69e443084f82c48ab7457dcacfae3dfb23
50fd98e37d675f597074a6e53a9ef34824d5fcd4
refs/heads/master
2020-04-09T03:38:38.848000
2018-12-01T21:57:20
2018-12-01T21:57:20
159,990,788
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ch_3; /** * Created by ito on 20.03.17. */ public class BasketDemo { public static void main (String [] args){ Basket b1 = new Basket(); Basket b2 = new Basket(); Basket b3 = new Basket(); System.out.println("b1: "); b1.pay(1200.00); System.out.println("b2: "); b2.pay("0012456892143654"); System.out.println("b3: "); b3.pay("8754357674535735", "1242345"); } } class Basket{ void pay(double money){ System.out.println("Оплачено наличными: " + money); } void pay(String cardNum){ System.out.println("Оплачено картой №: " +cardNum); } void pay(String accountNum, String bankCode){ System.out.println("Переведено на счет №: " + accountNum + " в банке: " + bankCode); } }
UTF-8
Java
901
java
BasketDemo.java
Java
[ { "context": "package Ch_3;\r\n\r\n/**\r\n * Created by ito on 20.03.17.\r\n */\r\npublic class BasketDemo {\r\n ", "end": 39, "score": 0.9900968670845032, "start": 36, "tag": "USERNAME", "value": "ito" } ]
null
[]
package Ch_3; /** * Created by ito on 20.03.17. */ public class BasketDemo { public static void main (String [] args){ Basket b1 = new Basket(); Basket b2 = new Basket(); Basket b3 = new Basket(); System.out.println("b1: "); b1.pay(1200.00); System.out.println("b2: "); b2.pay("0012456892143654"); System.out.println("b3: "); b3.pay("8754357674535735", "1242345"); } } class Basket{ void pay(double money){ System.out.println("Оплачено наличными: " + money); } void pay(String cardNum){ System.out.println("Оплачено картой №: " +cardNum); } void pay(String accountNum, String bankCode){ System.out.println("Переведено на счет №: " + accountNum + " в банке: " + bankCode); } }
901
0.548578
0.476303
33
23.575758
21.96558
92
false
false
0
0
0
0
0
0
0.454545
false
false
2
945d071d2674239e3b82ba209d2906a52fec5d89
18,159,121,750,565
840e20a0a77bbf53e1ef66d5ee356c261430c719
/app/src/main/java/com/toe/shareyourcuisine/activity/LoginActivity.java
ad0889ea13c33e24beb05e1aa4d09480a89682ae
[]
no_license
tczs91/ShareYourCuisine
https://github.com/tczs91/ShareYourCuisine
ba239396366c4dbf8fb21bd2caa457e9b01d4060
cd6ee474ce710a6bf1472d124ef254d7267bb319
refs/heads/master
2021-01-10T21:54:55.893000
2015-12-07T22:38:15
2015-12-07T22:38:15
42,282,524
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.toe.shareyourcuisine.activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; import com.toe.shareyourcuisine.R; import com.toe.shareyourcuisine.service.UserService; /** * Project: Share Your Cuisine * Comments: Home screen activity * Compile SDK version: 22 * Author: Tommy Qu * Created Date: 09/14/2015 * Modified By: * Modified Date: * Why is modified: */ public class LoginActivity extends BaseActivity implements UserService.UserLoginListener{ private final String TAG = "ToeLoginActivity"; private FrameLayout mContentView; private Button mSubmitBtn; private Button mCancelBtn; private EditText mUserEmailValue; private EditText mUserPwdValue; private TextView mSignUpTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContentView = (FrameLayout)findViewById(R.id.content); View child = getLayoutInflater().inflate(R.layout.activity_login, null); mContentView.addView(child); mSubmitBtn = (Button)findViewById(R.id.submit_btn); mCancelBtn = (Button)findViewById(R.id.cancel_btn); mUserEmailValue = (EditText)findViewById(R.id.user_email_value); mUserPwdValue = (EditText)findViewById(R.id.user_pwd_value); mSignUpTextView = (TextView)findViewById(R.id.sign_up_link); mSubmitBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String userEmail = mUserEmailValue.getText().toString(); String userPwd = mUserPwdValue.getText().toString(); UserService userService = new UserService(LoginActivity.this, LoginActivity.this, "Login"); userService.login(userEmail, userPwd); } }); mCancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } }); mSignUpTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, SignUpActivity.class); startActivity(intent); } }); } @Override public void onBackPressed() { super.onBackPressed(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } @Override public void loginSuccess() { Toast.makeText(LoginActivity.this, "Login successfully!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } @Override public void loginFail(String errorMsg) { Toast.makeText(LoginActivity.this, errorMsg, Toast.LENGTH_SHORT).show(); } }
UTF-8
Java
3,257
java
LoginActivity.java
Java
[ { "context": "een activity\n * Compile SDK version: 22\n * Author: Tommy Qu\n * Created Date: 09/14/2015\n * Modified By:\n * Mo", "end": 490, "score": 0.99981290102005, "start": 482, "tag": "NAME", "value": "Tommy Qu" } ]
null
[]
package com.toe.shareyourcuisine.activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; import com.toe.shareyourcuisine.R; import com.toe.shareyourcuisine.service.UserService; /** * Project: Share Your Cuisine * Comments: Home screen activity * Compile SDK version: 22 * Author: <NAME> * Created Date: 09/14/2015 * Modified By: * Modified Date: * Why is modified: */ public class LoginActivity extends BaseActivity implements UserService.UserLoginListener{ private final String TAG = "ToeLoginActivity"; private FrameLayout mContentView; private Button mSubmitBtn; private Button mCancelBtn; private EditText mUserEmailValue; private EditText mUserPwdValue; private TextView mSignUpTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContentView = (FrameLayout)findViewById(R.id.content); View child = getLayoutInflater().inflate(R.layout.activity_login, null); mContentView.addView(child); mSubmitBtn = (Button)findViewById(R.id.submit_btn); mCancelBtn = (Button)findViewById(R.id.cancel_btn); mUserEmailValue = (EditText)findViewById(R.id.user_email_value); mUserPwdValue = (EditText)findViewById(R.id.user_pwd_value); mSignUpTextView = (TextView)findViewById(R.id.sign_up_link); mSubmitBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String userEmail = mUserEmailValue.getText().toString(); String userPwd = mUserPwdValue.getText().toString(); UserService userService = new UserService(LoginActivity.this, LoginActivity.this, "Login"); userService.login(userEmail, userPwd); } }); mCancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } }); mSignUpTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, SignUpActivity.class); startActivity(intent); } }); } @Override public void onBackPressed() { super.onBackPressed(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } @Override public void loginSuccess() { Toast.makeText(LoginActivity.this, "Login successfully!", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); finish(); startActivity(intent); } @Override public void loginFail(String errorMsg) { Toast.makeText(LoginActivity.this, errorMsg, Toast.LENGTH_SHORT).show(); } }
3,255
0.665336
0.662266
95
33.28421
26.090797
107
false
false
0
0
0
0
0
0
0.631579
false
false
2
4278f016345b1e348b2f4a0a3df940918c3529ac
11,407,433,187,605
6ea948f51c5002fdc68e03ee3548ecc60cfbe8f1
/src/main/java/com/gavinkim/model/oracle/Sample.java
129c9d3043df3d4f74c014e474724a3b6c38106d
[]
no_license
gavin-kim/gavinkim.com
https://github.com/gavin-kim/gavinkim.com
70e46cca9a78e12ed8e41a8b6c1961966b0b9cd4
c94343b0006845d8a38828b091b875263d120549
refs/heads/master
2021-03-22T04:32:35.927000
2017-06-23T05:03:16
2017-06-23T05:03:16
73,661,409
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gavinkim.model.oracle; import com.fasterxml.jackson.annotation.JsonIgnore; import javax.persistence.*; import java.io.Serializable; /** * Project Sample image url and description */ @Entity public class Sample implements Serializable { private static final long serialVersionUID = -4906434512434522342L; private int id; private String url; private String description; @Id @JsonIgnore public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public int hashCode() { return id; } @Override public boolean equals(Object obj) { return this == obj || obj instanceof Sample && ((Sample) obj).id == id; } @Override public String toString() { return String.format("URL: %s, Description: %s", url, description); } }
UTF-8
Java
1,186
java
Sample.java
Java
[]
null
[]
package com.gavinkim.model.oracle; import com.fasterxml.jackson.annotation.JsonIgnore; import javax.persistence.*; import java.io.Serializable; /** * Project Sample image url and description */ @Entity public class Sample implements Serializable { private static final long serialVersionUID = -4906434512434522342L; private int id; private String url; private String description; @Id @JsonIgnore public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public int hashCode() { return id; } @Override public boolean equals(Object obj) { return this == obj || obj instanceof Sample && ((Sample) obj).id == id; } @Override public String toString() { return String.format("URL: %s, Description: %s", url, description); } }
1,186
0.618887
0.602867
61
18.442623
18.640274
75
false
false
0
0
0
0
0
0
0.360656
false
false
2
def68cf217444474c6d47662b336127f58fb6862
19,782,619,385,867
3efa671af158207a32c697f516fa59f8ce1e26f1
/app/src/main/java/com/TyxApp/bangumi/main/search/SearchResult/adapter/SearchResultVPAdapter.java
4ce2f25ab5aeffb83e83b0ce53fe4767a14681e9
[ "Apache-2.0" ]
permissive
Tan-yi-xiong/Bangumi
https://github.com/Tan-yi-xiong/Bangumi
b5cd47562c2dc452915b9f8dd9f8735f20123bc2
4d1d274d807a5447540c63b7ebd7abc0069f7c38
refs/heads/master
2020-06-16T14:36:03.812000
2019-11-14T03:19:50
2019-11-14T03:19:50
195,610,159
12
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.TyxApp.bangumi.main.search.SearchResult.adapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import com.TyxApp.bangumi.main.search.SearchResult.SearchResultFragment; import java.util.List; public class SearchResultVPAdapter extends FragmentPagerAdapter { private List<SearchResultFragment> mSearchResultFragmetns; private List<String> tabTexts; public SearchResultVPAdapter(@NonNull FragmentManager fm, int behavior, List<String> tabTexts, List<SearchResultFragment> searchResultFragmetns) { super(fm, behavior); this.tabTexts = tabTexts; mSearchResultFragmetns = searchResultFragmetns; } @NonNull @Override public Fragment getItem(int position) { return mSearchResultFragmetns.get(position); } @Nullable @Override public CharSequence getPageTitle(int position) { return tabTexts.get(position); } @Override public int getCount() { return mSearchResultFragmetns == null ? 0 : mSearchResultFragmetns.size(); } }
UTF-8
Java
1,272
java
SearchResultVPAdapter.java
Java
[]
null
[]
package com.TyxApp.bangumi.main.search.SearchResult.adapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import com.TyxApp.bangumi.main.search.SearchResult.SearchResultFragment; import java.util.List; public class SearchResultVPAdapter extends FragmentPagerAdapter { private List<SearchResultFragment> mSearchResultFragmetns; private List<String> tabTexts; public SearchResultVPAdapter(@NonNull FragmentManager fm, int behavior, List<String> tabTexts, List<SearchResultFragment> searchResultFragmetns) { super(fm, behavior); this.tabTexts = tabTexts; mSearchResultFragmetns = searchResultFragmetns; } @NonNull @Override public Fragment getItem(int position) { return mSearchResultFragmetns.get(position); } @Nullable @Override public CharSequence getPageTitle(int position) { return tabTexts.get(position); } @Override public int getCount() { return mSearchResultFragmetns == null ? 0 : mSearchResultFragmetns.size(); } }
1,272
0.71305
0.712264
44
27.90909
26.280668
84
false
false
0
0
0
0
0
0
0.454545
false
false
2
b149d02e35a34f2a01998eb819fc31f163a6ca3d
14,929,306,372,281
b1c8e9a08c242f0e27084230000739013d696f85
/hapi-base/src/main/java/ca/uhn/hl7v2/model/Primitive.java
bdbb555214eb3a102dbc6bfab87037f875cdb75e
[]
no_license
hapifhir/hapi-hl7v2
https://github.com/hapifhir/hapi-hl7v2
e91eda28a89884f06e900fa97b2dea2fec5767e0
1f5fd30c98e6348b26f9d7ccadbe90555e2ec7ba
refs/heads/master
2023-08-31T03:54:45.212000
2023-08-28T17:53:03
2023-08-28T17:53:03
76,879,222
256
137
null
false
2023-08-28T17:53:04
2016-12-19T16:41:54
2023-08-17T03:03:49
2023-08-28T17:53:03
73,641
238
126
57
HTML
false
false
/** The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is "Primitive.java". Description: "Represents the category of HL7 data types that contain a single value (in other words have no subcomponents)" The Initial Developer of the Original Code is University Health Network. Copyright (C) 2001. All Rights Reserved. Contributor(s): ______________________________________. Alternatively, the contents of this file may be used under the terms of the GNU General Public License (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. */ package ca.uhn.hl7v2.model; /** * Represents the category of HL7 data types that contain a single value (in other * words have no subcomponents). Examples include ST and ID. * @author Bryan Tripp (bryan_tripp@sourceforge.net) */ public interface Primitive extends Type { /** * Returns a String representation of the value of this field. * * @return a String representation of the value of this field */ String getValue(); /** * Sets the value of this field if the given value is legal in the context of the * implementing class. * * @param value the value to be set * @throws DataTypeException if the given value is not valid in this context. */ void setValue(String value) throws DataTypeException; }
UTF-8
Java
2,193
java
Primitive.java
Java
[ { "context": "mponents). Examples include ST and ID.\n * @author Bryan Tripp (bryan_tripp@sourceforge.net)\n */\npublic interfac", "end": 1644, "score": 0.9998943209648132, "start": 1633, "tag": "NAME", "value": "Bryan Tripp" }, { "context": "amples include ST and ID.\n * @author Br...
null
[]
/** The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is "Primitive.java". Description: "Represents the category of HL7 data types that contain a single value (in other words have no subcomponents)" The Initial Developer of the Original Code is University Health Network. Copyright (C) 2001. All Rights Reserved. Contributor(s): ______________________________________. Alternatively, the contents of this file may be used under the terms of the GNU General Public License (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. */ package ca.uhn.hl7v2.model; /** * Represents the category of HL7 data types that contain a single value (in other * words have no subcomponents). Examples include ST and ID. * @author <NAME> (<EMAIL>) */ public interface Primitive extends Type { /** * Returns a String representation of the value of this field. * * @return a String representation of the value of this field */ String getValue(); /** * Sets the value of this field if the given value is legal in the context of the * implementing class. * * @param value the value to be set * @throws DataTypeException if the given value is not valid in this context. */ void setValue(String value) throws DataTypeException; }
2,168
0.73689
0.73233
55
38.872726
34.349041
87
false
false
0
0
0
0
0
0
0.181818
false
false
2
95629a78cd85eed5f5a8855c7b32b69eb9bd9dd3
19,593,640,845,920
32cef5e7fced08e231524ba06b3444becbd32545
/src/main/java/e/brpl/app/entities/master/DaerahPenangkapan.java
3e48c0edc5e4727a4d9d9faad6982fc408146003
[]
no_license
annassdan/api-brpl
https://github.com/annassdan/api-brpl
981982ab9a080c8c07c86e7b4a4bda3e112f9778
20e938a3513f97869caa73ebee6f2de2b47fdf26
refs/heads/master
2020-04-02T16:32:37.552000
2018-10-25T06:54:39
2018-10-25T06:54:39
154,617,086
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package e.brpl.app.entities.master; import e.brpl.app.utils.EBrpl; import e.brpl.app.utils.entity.EBrplEntity; import lombok.*; import org.hibernate.annotations.ColumnDefault; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Data @NoArgsConstructor @AllArgsConstructor @Builder @Table(name = EBrpl.COMPONENT.MASTER_COMPONENT + EBrpl.DIVIDER + EBrpl.COMPONENT.MASTER.DAERAH_PENANGKAPAN) @SuppressWarnings("unused") @EqualsAndHashCode(callSuper = false) public class DaerahPenangkapan extends EBrplEntity<DaerahPenangkapan, String> { @NotNull @Column(name = "kode_daerah_penangkapan", length = 64) private String kodeDaerahPenangkapan; @NotNull @Column(name = "nama_daerah_penangkapan", length = 120) private String namaDaerahPenangkapan; @Column(name = "latitude") @ColumnDefault("'0'") private double latitude; @Column(name = "longitude") @ColumnDefault("'0'") private double longitude; }
UTF-8
Java
1,065
java
DaerahPenangkapan.java
Java
[]
null
[]
package e.brpl.app.entities.master; import e.brpl.app.utils.EBrpl; import e.brpl.app.utils.entity.EBrplEntity; import lombok.*; import org.hibernate.annotations.ColumnDefault; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Data @NoArgsConstructor @AllArgsConstructor @Builder @Table(name = EBrpl.COMPONENT.MASTER_COMPONENT + EBrpl.DIVIDER + EBrpl.COMPONENT.MASTER.DAERAH_PENANGKAPAN) @SuppressWarnings("unused") @EqualsAndHashCode(callSuper = false) public class DaerahPenangkapan extends EBrplEntity<DaerahPenangkapan, String> { @NotNull @Column(name = "kode_daerah_penangkapan", length = 64) private String kodeDaerahPenangkapan; @NotNull @Column(name = "nama_daerah_penangkapan", length = 120) private String namaDaerahPenangkapan; @Column(name = "latitude") @ColumnDefault("'0'") private double latitude; @Column(name = "longitude") @ColumnDefault("'0'") private double longitude; }
1,065
0.746479
0.739906
42
24.357143
20.055662
79
false
false
0
0
0
0
0
0
0.380952
false
false
2
bfb76bbb69c200f2da03828e914e111232d7b3db
23,278,722,810,918
6f672fb72caedccb841ee23f53e32aceeaf1895e
/Shopping/target_source/src/com/target/ui/widgets/BaseWidgetProvider.java
e6436c26f690bc690a28e7bfdf8d7ef842430f32
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.target.ui.widgets; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.os.Bundle; import android.widget.RemoteViews; import com.target.ui.util.i.b; import com.target.ui.util.i.c; import com.target.ui.util.j; public abstract class BaseWidgetProvider extends AppWidgetProvider { public BaseWidgetProvider() { } private static int a(int i) { int k; for (k = 2; k * 70 - 30 < i; k++) { } return k - 1; } private b a(AppWidgetManager appwidgetmanager, int i) { boolean flag = false; if (!j.a()) { appwidgetmanager = a(); } else { appwidgetmanager = appwidgetmanager.getAppWidgetOptions(i); b b1; int k; if (appwidgetmanager != null && appwidgetmanager.containsKey("appWidgetMinWidth")) { i = appwidgetmanager.getInt("appWidgetMinWidth"); } else { i = 0; } k = ((flag) ? 1 : 0); if (appwidgetmanager != null) { k = ((flag) ? 1 : 0); if (appwidgetmanager.containsKey("appWidgetMinHeight")) { k = appwidgetmanager.getInt("appWidgetMinHeight"); } } if (i == 0 || k == 0) { return a(); } b1 = com.target.ui.util.i.c.a(a(k), a(i)); appwidgetmanager = b1; if (b1.equals(b.UNKNOWN)) { return a(); } } return appwidgetmanager; } private void a(Context context, AppWidgetManager appwidgetmanager, int i) { appwidgetmanager.updateAppWidget(i, a(context, a(appwidgetmanager, i))); } protected abstract RemoteViews a(Context context, b b1); protected abstract b a(); protected abstract void a(int ai[]); protected abstract void b(); protected abstract void c(); public final void onAppWidgetOptionsChanged(Context context, AppWidgetManager appwidgetmanager, int i, Bundle bundle) { a(context, appwidgetmanager, i); } public final void onDeleted(Context context, int ai[]) { super.onDeleted(context, ai); a(ai); } public final void onDisabled(Context context) { super.onDisabled(context); c(); } public final void onEnabled(Context context) { super.onEnabled(context); b(); } public final void onRestored(Context context, int ai[], int ai1[]) { super.onRestored(context, ai, ai1); } public final void onUpdate(Context context, AppWidgetManager appwidgetmanager, int ai[]) { for (int i = 0; i < ai.length; i++) { a(context, appwidgetmanager, ai[i]); } } }
UTF-8
Java
3,151
java
BaseWidgetProvider.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996716976165771, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.target.ui.widgets; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.os.Bundle; import android.widget.RemoteViews; import com.target.ui.util.i.b; import com.target.ui.util.i.c; import com.target.ui.util.j; public abstract class BaseWidgetProvider extends AppWidgetProvider { public BaseWidgetProvider() { } private static int a(int i) { int k; for (k = 2; k * 70 - 30 < i; k++) { } return k - 1; } private b a(AppWidgetManager appwidgetmanager, int i) { boolean flag = false; if (!j.a()) { appwidgetmanager = a(); } else { appwidgetmanager = appwidgetmanager.getAppWidgetOptions(i); b b1; int k; if (appwidgetmanager != null && appwidgetmanager.containsKey("appWidgetMinWidth")) { i = appwidgetmanager.getInt("appWidgetMinWidth"); } else { i = 0; } k = ((flag) ? 1 : 0); if (appwidgetmanager != null) { k = ((flag) ? 1 : 0); if (appwidgetmanager.containsKey("appWidgetMinHeight")) { k = appwidgetmanager.getInt("appWidgetMinHeight"); } } if (i == 0 || k == 0) { return a(); } b1 = com.target.ui.util.i.c.a(a(k), a(i)); appwidgetmanager = b1; if (b1.equals(b.UNKNOWN)) { return a(); } } return appwidgetmanager; } private void a(Context context, AppWidgetManager appwidgetmanager, int i) { appwidgetmanager.updateAppWidget(i, a(context, a(appwidgetmanager, i))); } protected abstract RemoteViews a(Context context, b b1); protected abstract b a(); protected abstract void a(int ai[]); protected abstract void b(); protected abstract void c(); public final void onAppWidgetOptionsChanged(Context context, AppWidgetManager appwidgetmanager, int i, Bundle bundle) { a(context, appwidgetmanager, i); } public final void onDeleted(Context context, int ai[]) { super.onDeleted(context, ai); a(ai); } public final void onDisabled(Context context) { super.onDisabled(context); c(); } public final void onEnabled(Context context) { super.onEnabled(context); b(); } public final void onRestored(Context context, int ai[], int ai1[]) { super.onRestored(context, ai, ai1); } public final void onUpdate(Context context, AppWidgetManager appwidgetmanager, int ai[]) { for (int i = 0; i < ai.length; i++) { a(context, appwidgetmanager, ai[i]); } } }
3,141
0.559505
0.550619
122
24.827869
24.471024
121
false
false
0
0
0
0
0
0
0.57377
false
false
2
ff343fcc4e6043523ab2554d58e6582970aa0a34
19,842,748,951,177
d6de6f63cd11a4989dbd040cae39dd411ca0509b
/app/src/main/java/com/harp/CIS436_Program4/RVAdapter.java
d8e410de080ffa3098c241b264e5db3a1acfa9a7
[]
no_license
mharp1030/CIS436_Program4
https://github.com/mharp1030/CIS436_Program4
fb35d0ccd0b4cf1122e1cf3532b32119407c79b2
a78c82aef59ceeec201fff0691fd1ee5e8470181
refs/heads/master
2020-03-12T09:13:39.583000
2018-04-22T08:05:36
2018-04-22T08:05:36
130,546,909
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.harp.CIS436_Program4; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.List; public class RVAdapter extends RecyclerView.Adapter<RVAdapter.MovieHolder> { public static class MovieHolder extends RecyclerView.ViewHolder { CardView cv; TextView title; TextView year; TextView Desc; ImageView photo; MovieHolder(View itemView) { super(itemView); cv = itemView.findViewById(R.id.cv); title = itemView.findViewById(R.id.title); year = itemView.findViewById(R.id.year); Desc = itemView.findViewById(R.id.desc); photo = itemView.findViewById(R.id.photo); } } List<Movies> movies; RVAdapter(List<Movies> movies){ this.movies = movies; } @Override public void onAttachedToRecyclerView(RecyclerView recyclerView) { super.onAttachedToRecyclerView(recyclerView); } @Override public MovieHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item, viewGroup, false); return new MovieHolder(v); } @Override public void onBindViewHolder(MovieHolder MovieHolder, int i) { MovieHolder.title.setText(movies.get(i).Title); MovieHolder.year.setText(movies.get(i).ReleaseYr); MovieHolder.Desc.setText(movies.get(i).Desc); MovieHolder.photo.setImageResource(movies.get(i).photoId); } @Override public int getItemCount() { return movies.size(); } }
UTF-8
Java
1,804
java
RVAdapter.java
Java
[]
null
[]
package com.harp.CIS436_Program4; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.List; public class RVAdapter extends RecyclerView.Adapter<RVAdapter.MovieHolder> { public static class MovieHolder extends RecyclerView.ViewHolder { CardView cv; TextView title; TextView year; TextView Desc; ImageView photo; MovieHolder(View itemView) { super(itemView); cv = itemView.findViewById(R.id.cv); title = itemView.findViewById(R.id.title); year = itemView.findViewById(R.id.year); Desc = itemView.findViewById(R.id.desc); photo = itemView.findViewById(R.id.photo); } } List<Movies> movies; RVAdapter(List<Movies> movies){ this.movies = movies; } @Override public void onAttachedToRecyclerView(RecyclerView recyclerView) { super.onAttachedToRecyclerView(recyclerView); } @Override public MovieHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item, viewGroup, false); return new MovieHolder(v); } @Override public void onBindViewHolder(MovieHolder MovieHolder, int i) { MovieHolder.title.setText(movies.get(i).Title); MovieHolder.year.setText(movies.get(i).ReleaseYr); MovieHolder.Desc.setText(movies.get(i).Desc); MovieHolder.photo.setImageResource(movies.get(i).photoId); } @Override public int getItemCount() { return movies.size(); } }
1,804
0.677938
0.674612
62
28.112904
24.512739
102
false
false
0
0
0
0
0
0
0.548387
false
false
2
a8606149bbf94bd62d3a053fd77b684d08bea435
28,887,950,097,920
1dfaff941f863b7e34b7348350e84bdda2ca80a0
/src/main/java/com/jm/poo/tcpSocket/TcpServer.java
99f4314674ec475dea09693426e57db2d3f618eb
[]
no_license
IssacOrtega/JavaTopics
https://github.com/IssacOrtega/JavaTopics
c33143387324dde3368a706eb555faede1198000
ece123ccf8326a89f2cb4e5707847d4a3c7e31e9
refs/heads/master
2022-11-25T02:39:38.041000
2020-07-30T18:47:00
2020-07-30T18:47:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jm.poo.tcpSocket; public class TcpServer { }
UTF-8
Java
58
java
TcpServer.java
Java
[]
null
[]
package com.jm.poo.tcpSocket; public class TcpServer { }
58
0.758621
0.758621
4
13.5
13.124405
29
false
false
0
0
0
0
0
0
0.25
false
false
2
4ed8a1ba481d86f2e69b9cf7b17f12796ca9ad0a
23,639,500,041,574
97f299b5414b83438a8adcff14a9d944c67241f1
/s2/sort/InsertionSort.java
007b4e11e100d4264cab6b5c778fbb8ef535919d
[ "BSD-2-Clause" ]
permissive
scalingbits/dhbwjava
https://github.com/scalingbits/dhbwjava
abfd61f07bd4adae29a5d8ae4cd1cf24db4c5f55
ed101efb5d491381c6cad2810a45171adfcadb5c
refs/heads/master
2022-05-16T22:23:00.788000
2022-03-29T09:36:16
2022-03-29T09:36:16
169,788,624
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package s2.sort; /** * * @author s@scalingbits.com * @version 2.0 */ public class InsertionSort extends Sortierer { /** * Konstruktor: Akzeptiere ein Feld von int. Reiche * das Feld an die Oberklasse weiter. * Der Algorithmus ist nicht parallel (false Argument) * @param s das zu sortierende Feld */ public InsertionSort(int[] s) { super(s,false); } /** * sortiert ein Feld im Bereich startIndex bis endeIndex * @param startIndex Anfang des Sortierintervalls * @param endeIndex Ende des Sortierintervalls */ public void sortieren(int startIndex, int endeIndex) { for (int sortierGrenze = startIndex;sortierGrenze < endeIndex; sortierGrenze++) { int probe = sortierGrenze + 1; int j = startIndex; while (istKleiner(j, probe)) { j++; } // Verschiebe alles nach rechts. // Tausche den Probenwert gegen den unteren Nachbarn // bis man bei der Position j angekommen ist for (int k = probe - 1; k >= j; k--) { tausche(k, k + 1); } } } /** * Liefert den Namen des Insertion Sorts * @return Name des Sortierverfahrens */ public String algorithmus() { return "Sortieren durch Einfuegen"; } }
UTF-8
Java
1,371
java
InsertionSort.java
Java
[ { "context": "package s2.sort;\n/**\n *\n * @author s@scalingbits.com\n * @version 2.0\n */\npublic class InsertionSort ex", "end": 52, "score": 0.9999129176139832, "start": 35, "tag": "EMAIL", "value": "s@scalingbits.com" } ]
null
[]
package s2.sort; /** * * @author <EMAIL> * @version 2.0 */ public class InsertionSort extends Sortierer { /** * Konstruktor: Akzeptiere ein Feld von int. Reiche * das Feld an die Oberklasse weiter. * Der Algorithmus ist nicht parallel (false Argument) * @param s das zu sortierende Feld */ public InsertionSort(int[] s) { super(s,false); } /** * sortiert ein Feld im Bereich startIndex bis endeIndex * @param startIndex Anfang des Sortierintervalls * @param endeIndex Ende des Sortierintervalls */ public void sortieren(int startIndex, int endeIndex) { for (int sortierGrenze = startIndex;sortierGrenze < endeIndex; sortierGrenze++) { int probe = sortierGrenze + 1; int j = startIndex; while (istKleiner(j, probe)) { j++; } // Verschiebe alles nach rechts. // Tausche den Probenwert gegen den unteren Nachbarn // bis man bei der Position j angekommen ist for (int k = probe - 1; k >= j; k--) { tausche(k, k + 1); } } } /** * Liefert den Namen des Insertion Sorts * @return Name des Sortierverfahrens */ public String algorithmus() { return "Sortieren durch Einfuegen"; } }
1,361
0.574034
0.569657
45
29.466667
20.581114
70
false
false
0
0
0
0
0
0
0.333333
false
false
2
6f49ca6b49890a3d97f993a4d6539e2482e7238b
3,118,146,326,416
b25e0126f671c6ddca46a4329e388e14d99c2220
/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
643e3f910361a0ae54480460108d60724c0589cb
[ "Apache-2.0", "BSD-3-Clause", "EPL-1.0", "CDDL-1.1", "MIT", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
apache/iotdb
https://github.com/apache/iotdb
fd59940125c905537ffedad3b0963f7170ba67d9
d5450a1e5648699409e1c793035204989d78cfbb
refs/heads/master
2023-09-01T01:15:59.527000
2023-08-31T11:43:29
2023-08-31T11:43:29
158,975,124
2,882
893
Apache-2.0
false
2023-09-14T14:16:58
2018-11-24T21:29:17
2023-09-14T14:15:35
2023-09-14T14:16:58
219,501
3,524
916
367
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.iotdb.db.protocol.rest.v2.impl; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.conf.rest.IoTDBRestServiceDescriptor; import org.apache.iotdb.db.protocol.rest.handler.AuthorizationHandler; import org.apache.iotdb.db.protocol.rest.utils.InsertTabletSortDataUtils; import org.apache.iotdb.db.protocol.rest.v2.RestApiService; import org.apache.iotdb.db.protocol.rest.v2.handler.ExceptionHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.ExecuteStatementHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.QueryDataSetHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.RequestValidationHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.StatementConstructionHandler; import org.apache.iotdb.db.protocol.rest.v2.model.ExecutionStatus; import org.apache.iotdb.db.protocol.rest.v2.model.InsertRecordsRequest; import org.apache.iotdb.db.protocol.rest.v2.model.InsertTabletRequest; import org.apache.iotdb.db.protocol.rest.v2.model.SQL; import org.apache.iotdb.db.protocol.session.SessionManager; import org.apache.iotdb.db.queryengine.plan.Coordinator; import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.IPartitionFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.schema.ClusterSchemaFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.schema.ISchemaFetcher; import org.apache.iotdb.db.queryengine.plan.execution.ExecutionResult; import org.apache.iotdb.db.queryengine.plan.execution.IQueryExecution; import org.apache.iotdb.db.queryengine.plan.parser.StatementGenerator; import org.apache.iotdb.db.queryengine.plan.statement.Statement; import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertRowsStatement; import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertTabletStatement; import org.apache.iotdb.db.utils.SetThreadName; import org.apache.iotdb.rpc.TSStatusCode; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import java.time.ZoneId; public class RestApiServiceImpl extends RestApiService { private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig(); private static final Coordinator COORDINATOR = Coordinator.getInstance(); private static final SessionManager SESSION_MANAGER = SessionManager.getInstance(); private final IPartitionFetcher partitionFetcher; private final ISchemaFetcher schemaFetcher; private final AuthorizationHandler authorizationHandler; private final Integer defaultQueryRowLimit; public RestApiServiceImpl() { partitionFetcher = ClusterPartitionFetcher.getInstance(); schemaFetcher = ClusterSchemaFetcher.getInstance(); authorizationHandler = new AuthorizationHandler(); defaultQueryRowLimit = IoTDBRestServiceDescriptor.getInstance().getConfig().getRestQueryDefaultRowSizeLimit(); } @Override public Response executeNonQueryStatement(SQL sql, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateSQL(sql); Statement statement = StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault()); if (!ExecuteStatementHandler.validateStatement(statement)) { return Response.ok() .entity( new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus() .code(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode()) .message(TSStatusCode.EXECUTE_STATEMENT_ERROR.name())) .build(); } Response response = authorizationHandler.checkAuthority(securityContext, statement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( statement, queryId, null, sql.getSql(), partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response executeQueryStatement(SQL sql, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateSQL(sql); Statement statement = StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault()); if (ExecuteStatementHandler.validateStatement(statement)) { return Response.ok() .entity( new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus() .code(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode()) .message(TSStatusCode.EXECUTE_STATEMENT_ERROR.name())) .build(); } Response response = authorizationHandler.checkAuthority(securityContext, statement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); // create and cache dataset ExecutionResult result = COORDINATOR.execute( statement, queryId, null, sql.getSql(), partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() && result.status.code != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { return Response.ok() .entity( new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } IQueryExecution queryExecution = COORDINATOR.getQueryExecution(queryId); try (SetThreadName threadName = new SetThreadName(result.queryId.getId())) { return QueryDataSetHandler.fillQueryDataSet( queryExecution, statement, sql.getRowLimit() == null ? defaultQueryRowLimit : sql.getRowLimit()); } } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response insertRecords( InsertRecordsRequest insertRecordsRequest, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateInsertRecordsRequest(insertRecordsRequest); InsertRowsStatement insertRowsStatement = StatementConstructionHandler.createInsertRowsStatement(insertRecordsRequest); Response response = authorizationHandler.checkAuthority(securityContext, insertRowsStatement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( insertRowsStatement, SESSION_MANAGER.requestQueryId(), null, "", partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response insertTablet( InsertTabletRequest insertTabletRequest, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateInsertTabletRequest(insertTabletRequest); if (!InsertTabletSortDataUtils.checkSorted(insertTabletRequest.getTimestamps())) { int[] index = InsertTabletSortDataUtils.sortTimeStampList(insertTabletRequest.getTimestamps()); insertTabletRequest.getTimestamps().sort(Long::compareTo); insertTabletRequest.setValues( InsertTabletSortDataUtils.sortList( insertTabletRequest.getValues(), index, insertTabletRequest.getDataTypes().size())); } InsertTabletStatement insertTabletStatement = StatementConstructionHandler.constructInsertTabletStatement(insertTabletRequest); Response response = authorizationHandler.checkAuthority(securityContext, insertTabletStatement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( insertTabletStatement, SESSION_MANAGER.requestQueryId(), null, "", partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } }
UTF-8
Java
11,780
java
RestApiServiceImpl.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.iotdb.db.protocol.rest.v2.impl; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.conf.rest.IoTDBRestServiceDescriptor; import org.apache.iotdb.db.protocol.rest.handler.AuthorizationHandler; import org.apache.iotdb.db.protocol.rest.utils.InsertTabletSortDataUtils; import org.apache.iotdb.db.protocol.rest.v2.RestApiService; import org.apache.iotdb.db.protocol.rest.v2.handler.ExceptionHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.ExecuteStatementHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.QueryDataSetHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.RequestValidationHandler; import org.apache.iotdb.db.protocol.rest.v2.handler.StatementConstructionHandler; import org.apache.iotdb.db.protocol.rest.v2.model.ExecutionStatus; import org.apache.iotdb.db.protocol.rest.v2.model.InsertRecordsRequest; import org.apache.iotdb.db.protocol.rest.v2.model.InsertTabletRequest; import org.apache.iotdb.db.protocol.rest.v2.model.SQL; import org.apache.iotdb.db.protocol.session.SessionManager; import org.apache.iotdb.db.queryengine.plan.Coordinator; import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.IPartitionFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.schema.ClusterSchemaFetcher; import org.apache.iotdb.db.queryengine.plan.analyze.schema.ISchemaFetcher; import org.apache.iotdb.db.queryengine.plan.execution.ExecutionResult; import org.apache.iotdb.db.queryengine.plan.execution.IQueryExecution; import org.apache.iotdb.db.queryengine.plan.parser.StatementGenerator; import org.apache.iotdb.db.queryengine.plan.statement.Statement; import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertRowsStatement; import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertTabletStatement; import org.apache.iotdb.db.utils.SetThreadName; import org.apache.iotdb.rpc.TSStatusCode; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import java.time.ZoneId; public class RestApiServiceImpl extends RestApiService { private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig(); private static final Coordinator COORDINATOR = Coordinator.getInstance(); private static final SessionManager SESSION_MANAGER = SessionManager.getInstance(); private final IPartitionFetcher partitionFetcher; private final ISchemaFetcher schemaFetcher; private final AuthorizationHandler authorizationHandler; private final Integer defaultQueryRowLimit; public RestApiServiceImpl() { partitionFetcher = ClusterPartitionFetcher.getInstance(); schemaFetcher = ClusterSchemaFetcher.getInstance(); authorizationHandler = new AuthorizationHandler(); defaultQueryRowLimit = IoTDBRestServiceDescriptor.getInstance().getConfig().getRestQueryDefaultRowSizeLimit(); } @Override public Response executeNonQueryStatement(SQL sql, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateSQL(sql); Statement statement = StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault()); if (!ExecuteStatementHandler.validateStatement(statement)) { return Response.ok() .entity( new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus() .code(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode()) .message(TSStatusCode.EXECUTE_STATEMENT_ERROR.name())) .build(); } Response response = authorizationHandler.checkAuthority(securityContext, statement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( statement, queryId, null, sql.getSql(), partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response executeQueryStatement(SQL sql, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateSQL(sql); Statement statement = StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault()); if (ExecuteStatementHandler.validateStatement(statement)) { return Response.ok() .entity( new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus() .code(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode()) .message(TSStatusCode.EXECUTE_STATEMENT_ERROR.name())) .build(); } Response response = authorizationHandler.checkAuthority(securityContext, statement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); // create and cache dataset ExecutionResult result = COORDINATOR.execute( statement, queryId, null, sql.getSql(), partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode() && result.status.code != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { return Response.ok() .entity( new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } IQueryExecution queryExecution = COORDINATOR.getQueryExecution(queryId); try (SetThreadName threadName = new SetThreadName(result.queryId.getId())) { return QueryDataSetHandler.fillQueryDataSet( queryExecution, statement, sql.getRowLimit() == null ? defaultQueryRowLimit : sql.getRowLimit()); } } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response insertRecords( InsertRecordsRequest insertRecordsRequest, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateInsertRecordsRequest(insertRecordsRequest); InsertRowsStatement insertRowsStatement = StatementConstructionHandler.createInsertRowsStatement(insertRecordsRequest); Response response = authorizationHandler.checkAuthority(securityContext, insertRowsStatement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( insertRowsStatement, SESSION_MANAGER.requestQueryId(), null, "", partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } @Override public Response insertTablet( InsertTabletRequest insertTabletRequest, SecurityContext securityContext) { Long queryId = null; try { RequestValidationHandler.validateInsertTabletRequest(insertTabletRequest); if (!InsertTabletSortDataUtils.checkSorted(insertTabletRequest.getTimestamps())) { int[] index = InsertTabletSortDataUtils.sortTimeStampList(insertTabletRequest.getTimestamps()); insertTabletRequest.getTimestamps().sort(Long::compareTo); insertTabletRequest.setValues( InsertTabletSortDataUtils.sortList( insertTabletRequest.getValues(), index, insertTabletRequest.getDataTypes().size())); } InsertTabletStatement insertTabletStatement = StatementConstructionHandler.constructInsertTabletStatement(insertTabletRequest); Response response = authorizationHandler.checkAuthority(securityContext, insertTabletStatement); if (response != null) { return response; } queryId = SESSION_MANAGER.requestQueryId(); ExecutionResult result = COORDINATOR.execute( insertTabletStatement, SESSION_MANAGER.requestQueryId(), null, "", partitionFetcher, schemaFetcher, config.getQueryTimeoutThreshold()); return Response.ok() .entity( (result.status.code == TSStatusCode.SUCCESS_STATUS.getStatusCode() || result.status.code == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) ? new ExecutionStatus() .code(TSStatusCode.SUCCESS_STATUS.getStatusCode()) .message(TSStatusCode.SUCCESS_STATUS.name()) : new ExecutionStatus() .code(result.status.getCode()) .message(result.status.getMessage())) .build(); } catch (Exception e) { return Response.ok().entity(ExceptionHandler.tryCatchException(e)).build(); } finally { if (queryId != null) { COORDINATOR.cleanupQueryExecution(queryId); } } } }
11,780
0.676486
0.675212
290
39.620689
28.952415
100
false
false
0
0
0
0
0
0
0.482759
false
false
2
29602533b6407522e9a69bb76be326bcf2761145
33,947,421,560,510
bae6fbc0836531cedc6c13f15f82bfecb440a38e
/CollectionExample/src/com/praveen/shethe/simplejava/Person.java
30bd36493c732e20dc52004f27a99d4b7f113478
[]
no_license
PraveenkumarShethe/trickyExamples
https://github.com/PraveenkumarShethe/trickyExamples
04caff0bb89d4e29760c253f16678b40dfe3bda1
fb99828ce1fc11a76a7d38166820e8c811d9fc61
refs/heads/master
2023-04-18T16:42:10.351000
2021-05-09T21:51:00
2021-05-09T21:51:00
363,913,788
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.praveen.shethe.simplejava; import java.util.Objects; /** * Created by Praveenkumar on 5/6/2021. */ public class Person { final PersonImmutable personImmutable; final int age; public Person(PersonImmutable personImmutable, int age) { this.personImmutable = personImmutable; this.age = age; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Person)) return false; Person that = (Person) o; return age == that.age && Objects.equals(personImmutable, that.personImmutable); } @Override public int hashCode() { return Objects.hash(personImmutable, age); } @Override public String toString() { return "TestPersonImmutable{" + "personImmutable=" + personImmutable + ", age=" + age + '}'; } public PersonImmutable getPersonImmutable() { return personImmutable; } public int getAge() { return age; } }
UTF-8
Java
1,056
java
Person.java
Java
[ { "context": "ava;\n\nimport java.util.Objects;\n\n/**\n * Created by Praveenkumar on 5/6/2021.\n */\npublic class Person {\n\n final", "end": 97, "score": 0.9998761415481567, "start": 85, "tag": "NAME", "value": "Praveenkumar" } ]
null
[]
package com.praveen.shethe.simplejava; import java.util.Objects; /** * Created by Praveenkumar on 5/6/2021. */ public class Person { final PersonImmutable personImmutable; final int age; public Person(PersonImmutable personImmutable, int age) { this.personImmutable = personImmutable; this.age = age; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Person)) return false; Person that = (Person) o; return age == that.age && Objects.equals(personImmutable, that.personImmutable); } @Override public int hashCode() { return Objects.hash(personImmutable, age); } @Override public String toString() { return "TestPersonImmutable{" + "personImmutable=" + personImmutable + ", age=" + age + '}'; } public PersonImmutable getPersonImmutable() { return personImmutable; } public int getAge() { return age; } }
1,056
0.598485
0.592803
48
21
20.540609
88
false
false
0
0
0
0
0
0
0.375
false
false
2
57a3119bbcdc87d0469ed4a73f0f9564c9dfab9f
34,935,264,030,238
a5d2a4c1d23d2594f979cd9cefeb033f3825f9d1
/bukkit/src/main/java/hu/montlikadani/tablist/bukkit/commands/list/fakeplayers.java
9c1c904b188254bfefd67eb9b91f5777cbdd5f73
[]
no_license
ThePenguinsGit/TabList
https://github.com/ThePenguinsGit/TabList
70a3376196a337fb37d48dd57cd0ac1eccd47c61
855c78483fdb2381297fecde3badbe61e8b3e6b8
refs/heads/master
2023-03-11T08:22:12.206000
2021-02-16T17:13:53
2021-02-16T17:13:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hu.montlikadani.tablist.bukkit.commands.list; import static hu.montlikadani.tablist.bukkit.utils.Util.sendMsg; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.google.common.reflect.TypeToken; import hu.montlikadani.tablist.bukkit.Perm; import hu.montlikadani.tablist.bukkit.TabList; import hu.montlikadani.tablist.bukkit.commands.CommandProcessor; import hu.montlikadani.tablist.bukkit.commands.ICommand; import hu.montlikadani.tablist.bukkit.config.ConfigValues; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.FakePlayerHandler; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.FakePlayerHandler.EditingContextError; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.IFakePlayers; import hu.montlikadani.tablist.bukkit.utils.Util; @CommandProcessor(name = "fakeplayers", permission = Perm.FAKEPLAYERS, playerOnly = true) public class fakeplayers implements ICommand { private enum Actions { ADD, RENAME, SETDISPLAYNAME, SETSKIN, SETPING, REMOVE, LIST; } @SuppressWarnings("serial") @Override public boolean run(TabList plugin, CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; if (!ConfigValues.isFakePlayers()) { sendMsg(p, plugin.getMsg("fake-player.disabled")); return true; } plugin.getConf().createFakePlayersFile(); if (args.length < 2) { if (sender instanceof Player) { ((Player) sender).performCommand("tl help"); } else { Bukkit.dispatchCommand(sender, "tl help"); } return true; } Actions action = Actions.valueOf(args[1].toUpperCase()); if (action == null) { action = Actions.ADD; } if (action != Actions.LIST && args.length < 3) { if (sender instanceof Player) { ((Player) sender).performCommand("tl help"); } else { Bukkit.dispatchCommand(sender, "tl help"); } return true; } final FakePlayerHandler handler = plugin.getFakePlayerHandler(); EditingContextError output; switch (action) { case ADD: String name = args[2]; int ping = -1; try { ping = args.length > 4 ? Integer.parseInt(args[4]) : -1; } catch (NumberFormatException e) { } output = handler.createPlayer(p, name, name, args.length > 3 ? args[3] : "", ping); if (output == EditingContextError.ALREADY_EXIST) { sendMsg(p, plugin.getMsg("fake-player.already-added", "%name%", name)); return true; } if (output == EditingContextError.OK) { sendMsg(p, plugin.getMsg("fake-player.added", "%name%", name)); } break; case REMOVE: output = handler.removePlayer(args[2]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.OK) { sendMsg(p, plugin.getMsg("fake-player.removed", "%name%", args[2])); } break; case RENAME: if (args.length < 4) { return true; } output = handler.renamePlayer(args[2], args[3]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.OK) { sendMsg(p, Util.colorMsg("&2Old name: &e" + args[2] + "&2, new name: &e" + args[3])); } break; case LIST: Set<IFakePlayers> list = handler.getFakePlayers(); if (list.isEmpty()) { sendMsg(p, plugin.getMsg("fake-player.no-fake-player")); return true; } Collections.sort(list.stream().map(IFakePlayers::getName).collect(Collectors.toList())); String msg = ""; for (IFakePlayers one : list) { if (!msg.isEmpty()) { msg += "&r, "; } msg += one.getName(); } plugin.getMsg(new TypeToken<List<String>>() {}.getSubtype(List.class), "fake-player.list", "%amount%", list.size(), "%fake-players%", msg) .forEach(line -> sendMsg(p, Util.colorMsg(line))); break; case SETSKIN: output = handler.setSkin(args[2], args[3]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.UUID_MATCH_ERROR) { p.sendMessage("This uuid not matches to a real player uuid."); } break; case SETPING: int amount = -1; try { amount = Integer.parseInt(args[3]); } catch (NumberFormatException e) { } output = handler.setPing(args[2], amount); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.PING_AMOUNT) { sendMsg(p, plugin.getMsg("fake-player.ping-can-not-be-less", "%amount%", amount)); } break; case SETDISPLAYNAME: StringBuilder builder = new StringBuilder(); for (int i = 3; i < args.length; i++) { builder.append(args[i] + (i + 1 < args.length ? " " : "")); } output = handler.setDisplayName(args[2], builder.toString().replace("\"", "")); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); } break; default: break; } return true; } }
UTF-8
Java
5,299
java
fakeplayers.java
Java
[]
null
[]
package hu.montlikadani.tablist.bukkit.commands.list; import static hu.montlikadani.tablist.bukkit.utils.Util.sendMsg; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.google.common.reflect.TypeToken; import hu.montlikadani.tablist.bukkit.Perm; import hu.montlikadani.tablist.bukkit.TabList; import hu.montlikadani.tablist.bukkit.commands.CommandProcessor; import hu.montlikadani.tablist.bukkit.commands.ICommand; import hu.montlikadani.tablist.bukkit.config.ConfigValues; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.FakePlayerHandler; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.FakePlayerHandler.EditingContextError; import hu.montlikadani.tablist.bukkit.tablist.fakeplayers.IFakePlayers; import hu.montlikadani.tablist.bukkit.utils.Util; @CommandProcessor(name = "fakeplayers", permission = Perm.FAKEPLAYERS, playerOnly = true) public class fakeplayers implements ICommand { private enum Actions { ADD, RENAME, SETDISPLAYNAME, SETSKIN, SETPING, REMOVE, LIST; } @SuppressWarnings("serial") @Override public boolean run(TabList plugin, CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; if (!ConfigValues.isFakePlayers()) { sendMsg(p, plugin.getMsg("fake-player.disabled")); return true; } plugin.getConf().createFakePlayersFile(); if (args.length < 2) { if (sender instanceof Player) { ((Player) sender).performCommand("tl help"); } else { Bukkit.dispatchCommand(sender, "tl help"); } return true; } Actions action = Actions.valueOf(args[1].toUpperCase()); if (action == null) { action = Actions.ADD; } if (action != Actions.LIST && args.length < 3) { if (sender instanceof Player) { ((Player) sender).performCommand("tl help"); } else { Bukkit.dispatchCommand(sender, "tl help"); } return true; } final FakePlayerHandler handler = plugin.getFakePlayerHandler(); EditingContextError output; switch (action) { case ADD: String name = args[2]; int ping = -1; try { ping = args.length > 4 ? Integer.parseInt(args[4]) : -1; } catch (NumberFormatException e) { } output = handler.createPlayer(p, name, name, args.length > 3 ? args[3] : "", ping); if (output == EditingContextError.ALREADY_EXIST) { sendMsg(p, plugin.getMsg("fake-player.already-added", "%name%", name)); return true; } if (output == EditingContextError.OK) { sendMsg(p, plugin.getMsg("fake-player.added", "%name%", name)); } break; case REMOVE: output = handler.removePlayer(args[2]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.OK) { sendMsg(p, plugin.getMsg("fake-player.removed", "%name%", args[2])); } break; case RENAME: if (args.length < 4) { return true; } output = handler.renamePlayer(args[2], args[3]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.OK) { sendMsg(p, Util.colorMsg("&2Old name: &e" + args[2] + "&2, new name: &e" + args[3])); } break; case LIST: Set<IFakePlayers> list = handler.getFakePlayers(); if (list.isEmpty()) { sendMsg(p, plugin.getMsg("fake-player.no-fake-player")); return true; } Collections.sort(list.stream().map(IFakePlayers::getName).collect(Collectors.toList())); String msg = ""; for (IFakePlayers one : list) { if (!msg.isEmpty()) { msg += "&r, "; } msg += one.getName(); } plugin.getMsg(new TypeToken<List<String>>() {}.getSubtype(List.class), "fake-player.list", "%amount%", list.size(), "%fake-players%", msg) .forEach(line -> sendMsg(p, Util.colorMsg(line))); break; case SETSKIN: output = handler.setSkin(args[2], args[3]); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.UUID_MATCH_ERROR) { p.sendMessage("This uuid not matches to a real player uuid."); } break; case SETPING: int amount = -1; try { amount = Integer.parseInt(args[3]); } catch (NumberFormatException e) { } output = handler.setPing(args[2], amount); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); return true; } if (output == EditingContextError.PING_AMOUNT) { sendMsg(p, plugin.getMsg("fake-player.ping-can-not-be-less", "%amount%", amount)); } break; case SETDISPLAYNAME: StringBuilder builder = new StringBuilder(); for (int i = 3; i < args.length; i++) { builder.append(args[i] + (i + 1 < args.length ? " " : "")); } output = handler.setDisplayName(args[2], builder.toString().replace("\"", "")); if (output == EditingContextError.NOT_EXIST) { sendMsg(p, plugin.getMsg("fake-player.not-exists")); } break; default: break; } return true; } }
5,299
0.673523
0.668428
195
26.174358
25.909317
101
false
false
0
0
0
0
0
0
2.712821
false
false
2
78f80fd3c96ecd811a1842697e9eb38cb7becfe5
37,606,733,671,907
7275942734779dcccfc13dac2e0db8e6cf9e302b
/deps/Eve/src/parsing/Token.java
e3d962261cc2231603410576345be537f7ead542
[]
no_license
iebeid/genesis-visual-programming
https://github.com/iebeid/genesis-visual-programming
96ef60122994075dbee2235a41758e0d90a861ee
0521cf1e0fc8afe74670b8b5d9758928ad33d947
refs/heads/master
2021-01-10T09:42:08.308000
2017-02-11T21:14:21
2017-02-11T21:14:21
36,741,508
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package parsing; /** * The Token class associates strings with their source (filename, line, pos) * and symbol, and classifies them into one of the following: * <ul> * <li>&lt;id> -- a char followed by one or more chars, digits, or underscores</li> * <li>&lt;no -- a typical floating point of integer literal </li> * <li>&lt;string -- a quote (single or double) followed by zero or more intervening chars * followed by a matching quote (single or double; special characters must be escaped by a backslash. * These include: * <ul> * <li>a backslash </li> * <li>a double quote (if the opening quote is a double quote)</li> * <li>a single quote (if the opening quote is a single quote)</li> * <li>a newline</li> * </ul> * </li> * <li>&lt;char> </li> * <li>&lt;operator</li> * </ul> * * @author Larry Morell <morell@cs.atu.edu> */ public class Token { //----------------- Member variables -----------------// String value ; // The string extracted from the buffer protected Symbol symbol; // the classification of this string protected AbstractBuffer buffer; // the buffer from whence the token was extracted protected String fileName; // the name of the file from whence this token was extracted protected int lineNo; // the line number in the source file protected int charPos; // the character position in the source file //--------------------- Constructors -----------------// public Token(Symbol s, AbstractBuffer b, int lineno, int charpos) { value = s.getValue(); // not really needed, may save time symbol = s; buffer = b; symbol = s; charPos = charpos; lineNo = lineno; fileName = b.getFileName(); } // Getters public AbstractBuffer getBuffer() { return buffer; } public int getCharPos() { return charPos; } public String getFileName() { return fileName; } public int getLineNo() { return lineNo; } public Symbol getSymbol() { return symbol; } public String getValue() { return value; } @Override public String toString() { return "[" + symbol + "]"; } }
UTF-8
Java
2,168
java
Token.java
Java
[ { "context": "i>\n * <li>&lt;operator</li>\n * </ul>\n *\n * @author Larry Morell <morell@cs.atu.edu>\n */\n\npublic class Token {\n\n\t/", "end": 876, "score": 0.9998388290405273, "start": 864, "tag": "NAME", "value": "Larry Morell" }, { "context": "perator</li>\n * </ul>\n *\n * @a...
null
[]
package parsing; /** * The Token class associates strings with their source (filename, line, pos) * and symbol, and classifies them into one of the following: * <ul> * <li>&lt;id> -- a char followed by one or more chars, digits, or underscores</li> * <li>&lt;no -- a typical floating point of integer literal </li> * <li>&lt;string -- a quote (single or double) followed by zero or more intervening chars * followed by a matching quote (single or double; special characters must be escaped by a backslash. * These include: * <ul> * <li>a backslash </li> * <li>a double quote (if the opening quote is a double quote)</li> * <li>a single quote (if the opening quote is a single quote)</li> * <li>a newline</li> * </ul> * </li> * <li>&lt;char> </li> * <li>&lt;operator</li> * </ul> * * @author <NAME> <<EMAIL>> */ public class Token { //----------------- Member variables -----------------// String value ; // The string extracted from the buffer protected Symbol symbol; // the classification of this string protected AbstractBuffer buffer; // the buffer from whence the token was extracted protected String fileName; // the name of the file from whence this token was extracted protected int lineNo; // the line number in the source file protected int charPos; // the character position in the source file //--------------------- Constructors -----------------// public Token(Symbol s, AbstractBuffer b, int lineno, int charpos) { value = s.getValue(); // not really needed, may save time symbol = s; buffer = b; symbol = s; charPos = charpos; lineNo = lineno; fileName = b.getFileName(); } // Getters public AbstractBuffer getBuffer() { return buffer; } public int getCharPos() { return charPos; } public String getFileName() { return fileName; } public int getLineNo() { return lineNo; } public Symbol getSymbol() { return symbol; } public String getValue() { return value; } @Override public String toString() { return "[" + symbol + "]"; } }
2,152
0.621771
0.621771
80
26.1
29.031277
106
false
false
0
0
0
0
0
0
1.075
false
false
2
7353dc943d7a270c809fc196dc42a67e63e0a6e6
34,651,796,197,086
c49871fcc4f0f05507f9b5c3cf3239750f6c88a4
/eShopYTL/domain/exceptions/StueckzahlEntsprichtNichtPackungException.java
ed95c3e8703fc020a6b4d0f45e334bad46062212
[]
no_license
yuliyalitvin/ESHOP
https://github.com/yuliyalitvin/ESHOP
0d6cfb740f306f6aa9d44fe3971b1c0890394aa6
be6b1cd9dd22eae8f55deb9238dc49a5492da384
refs/heads/master
2023-02-16T14:35:41.108000
2021-01-12T19:49:09
2021-01-12T19:49:09
329,035,651
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package domain.exceptions; /** * @author Lars Obist, Yuliya Litvin, Thao Phoung Nguyen */ @SuppressWarnings("serial") public class StueckzahlEntsprichtNichtPackungException extends Exception { public StueckzahlEntsprichtNichtPackungException(int stueck, int pack) { super("Die Stueckzahl " + stueck + " entspricht nicht der Packungsgroesse von " + pack ); } }
UTF-8
Java
370
java
StueckzahlEntsprichtNichtPackungException.java
Java
[ { "context": "package domain.exceptions;\n\n/**\n * @author Lars Obist, Yuliya Litvin, Thao Phoung Nguyen\n */\n\n@Suppress", "end": 53, "score": 0.9998786449432373, "start": 43, "tag": "NAME", "value": "Lars Obist" }, { "context": "age domain.exceptions;\n\n/**\n * @author Lars Obis...
null
[]
package domain.exceptions; /** * @author <NAME>, <NAME>, <NAME> */ @SuppressWarnings("serial") public class StueckzahlEntsprichtNichtPackungException extends Exception { public StueckzahlEntsprichtNichtPackungException(int stueck, int pack) { super("Die Stueckzahl " + stueck + " entspricht nicht der Packungsgroesse von " + pack ); } }
347
0.764865
0.764865
13
27.461538
32.636967
91
false
false
0
0
0
0
0
0
0.769231
false
false
2
d018278fbea3445d35cd36eeb21b86e1519ae3ec
36,507,222,057,404
164f1dc79d0612fb398be815f8a08f43a02ce459
/src/main/java/de/jformchecker/utils/DoubleLabelException.java
59803fe8b57ef362a0df400abc6aed4b51a4b4eb
[ "MIT" ]
permissive
jochen777/jformchecker-integration
https://github.com/jochen777/jformchecker-integration
be21237aca392d795595aab1dd474293f8dc299e
2dd7c074654b443ae33e458d2a658065c2489bde
refs/heads/master
2023-01-13T08:55:36.583000
2023-01-01T20:06:55
2023-01-01T20:06:55
71,294,766
0
0
MIT
false
2023-01-01T20:06:56
2016-10-18T21:55:29
2023-01-01T19:55:07
2023-01-01T20:06:55
55
0
0
0
Java
false
false
package de.jformchecker.utils; @SuppressWarnings("serial") public class DoubleLabelException extends RuntimeException{ public DoubleLabelException(String elementName) { super("You defined two Labels (Label AND LabelTranslationKey) on one element: '" + elementName + "' \nUse either @Label OR @LabelTranslationKey. Not both"); } }
UTF-8
Java
335
java
DoubleLabelException.java
Java
[]
null
[]
package de.jformchecker.utils; @SuppressWarnings("serial") public class DoubleLabelException extends RuntimeException{ public DoubleLabelException(String elementName) { super("You defined two Labels (Label AND LabelTranslationKey) on one element: '" + elementName + "' \nUse either @Label OR @LabelTranslationKey. Not both"); } }
335
0.78209
0.78209
8
40.875
49.006218
158
false
false
0
0
0
0
0
0
0.75
false
false
2
efde81f176225a6d8b7320d101afe3b95527e20f
970,662,670,870
a25b9c3f96d6d004b58476d6c02f9821f61155f1
/src/test/java/by/jrr/profile/service/TimeLineNotificationServiceTest.java
8c0c86676b1a447fff14456d204387fafa755c35
[]
no_license
max-java/moodle
https://github.com/max-java/moodle
bda13c6b0f4cf574654e57d792bd8fa750c97cb0
b7782839276fed10ef326c9d59d960724de676f0
refs/heads/master
2023-08-19T07:31:18.804000
2022-01-02T07:16:34
2022-01-02T07:16:34
249,947,539
2
1
null
false
2023-08-14T21:54:34
2020-03-25T10:22:16
2022-01-02T07:16:52
2023-08-14T21:54:34
21,306
1
1
5
JavaScript
false
false
package by.jrr.profile.service; import by.jrr.profile.bean.TimeLine; import by.jrr.registration.bean.EventType; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @Sql("/profile.sql") @SpringBootTest class TimeLineNotificationServiceTest { @Autowired TimeLineNotificationService timeLineNotificationService; @Test void findTimeLineItemsByEventDay() { List actualTimeLines = timeLineNotificationService.findTimeLineItemsByEventDay(EventType.LECTURE, LocalDate.parse("2020-08-08")); Assertions.assertThat(makeTimeLine()).containsSequence(actualTimeLines); } private List makeTimeLine() { List<TimeLine> timeLines = new ArrayList<>(); timeLines.add(TimeLine.builder() .Id(1512L) .timelineUUID("2b2d6ecb-9919-4cc2-917c-448e9fdc000d") .dateTime(LocalDateTime.parse("2020-08-08T19:00:00.000000")) .streamTeamProfileId(1324L) .courseId(1286L) .lectureId(1265L) .urlToRedirect("https://us02web.zoom.us/j/88181036762") .eventType(EventType.LECTURE) .eventName("Lecture 2") .notes("это лекция 2") .build()); return timeLines; } }
UTF-8
Java
1,655
java
TimeLineNotificationServiceTest.java
Java
[]
null
[]
package by.jrr.profile.service; import by.jrr.profile.bean.TimeLine; import by.jrr.registration.bean.EventType; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @Sql("/profile.sql") @SpringBootTest class TimeLineNotificationServiceTest { @Autowired TimeLineNotificationService timeLineNotificationService; @Test void findTimeLineItemsByEventDay() { List actualTimeLines = timeLineNotificationService.findTimeLineItemsByEventDay(EventType.LECTURE, LocalDate.parse("2020-08-08")); Assertions.assertThat(makeTimeLine()).containsSequence(actualTimeLines); } private List makeTimeLine() { List<TimeLine> timeLines = new ArrayList<>(); timeLines.add(TimeLine.builder() .Id(1512L) .timelineUUID("2b2d6ecb-9919-4cc2-917c-448e9fdc000d") .dateTime(LocalDateTime.parse("2020-08-08T19:00:00.000000")) .streamTeamProfileId(1324L) .courseId(1286L) .lectureId(1265L) .urlToRedirect("https://us02web.zoom.us/j/88181036762") .eventType(EventType.LECTURE) .eventName("Lecture 2") .notes("это лекция 2") .build()); return timeLines; } }
1,655
0.691373
0.643985
47
34.021278
26.943193
137
false
false
0
0
0
0
0
0
0.425532
false
false
2
623c763bbe8b5409b7b82f79217cc01707598e06
10,247,792,012,363
0f142d29826f7b8a0baa97cd4c3b404ff15f51fb
/spark/src/main/java/com/xiangshi/spark/SQLHiveJava.java
ec857f0825c2409003a0e9275077106c466f78cf
[]
no_license
enjoymrsun/hadoop-mapreduce
https://github.com/enjoymrsun/hadoop-mapreduce
76ea2ebf6ecabc979f4f4d692aef26b2064c47c9
80825ef71902409a961331d2ed6da31a79ddef78
refs/heads/master
2020-03-27T10:46:18.815000
2018-08-28T14:49:21
2018-08-28T14:49:21
146,444,091
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xiangshi.spark; import org.apache.spark.SparkConf; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; /** * 2018/4/3. */ public class SQLHiveJava { public static void main(String[] args) { SparkConf conf = new SparkConf(); conf.setMaster("local"); conf.setAppName("SQLJava"); SparkSession sess = SparkSession.builder() .appName("HiveSQLJava") .config("spark.master", "local") .getOrCreate(); Dataset<Row> df = sess.sql("create table tttt(id int,name string,age int)"); df.show(); } }
UTF-8
Java
650
java
SQLHiveJava.java
Java
[]
null
[]
package com.xiangshi.spark; import org.apache.spark.SparkConf; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; /** * 2018/4/3. */ public class SQLHiveJava { public static void main(String[] args) { SparkConf conf = new SparkConf(); conf.setMaster("local"); conf.setAppName("SQLJava"); SparkSession sess = SparkSession.builder() .appName("HiveSQLJava") .config("spark.master", "local") .getOrCreate(); Dataset<Row> df = sess.sql("create table tttt(id int,name string,age int)"); df.show(); } }
650
0.633846
0.624615
24
25.083334
19.486998
80
false
false
0
0
0
0
0
0
0.583333
false
false
2
1eda85a2c8cbeafa6af7e01e8eb7fea8a229d69a
20,890,720,932,260
6a2f63d971fd5ce988c10cdc2401aae3ba5e0fee
/shadersmod/client/Property.java
3b709838542b22dc610a00cb65ec8a89d0f00f79
[ "MIT" ]
permissive
MikeWuang/hawk-client
https://github.com/MikeWuang/hawk-client
22d0d723b70826f74d91f0928384513a419592c1
7f62687c62709c595e2945d71678984ba1b832ea
refs/heads/main
2023-04-05T19:50:35.459000
2021-04-28T00:52:19
2021-04-28T00:52:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package shadersmod.client; import java.util.Properties; import optifine.Config; import org.apache.commons.lang3.ArrayUtils; public class Property { private int value = 0; private int defaultValue = 0; private String[] userValues = null; private String propertyName = null; private String[] propertyValues = null; private int[] values = null; private String userName = null; public void resetValue() { this.value = this.defaultValue; } public void saveTo(Properties var1) { if (var1 != null) { var1.setProperty(this.getPropertyName(), this.getPropertyValue()); } } public boolean loadFrom(Properties var1) { this.resetValue(); if (var1 == null) { return false; } else { String var2 = var1.getProperty(this.propertyName); return var2 == null ? false : this.setPropertyValue(var2); } } public String getPropertyValue() { return this.propertyValues[this.value]; } public String getUserName() { return this.userName; } public void setValue(int var1) { this.value = var1; if (this.value < 0 || this.value >= this.propertyValues.length) { this.value = this.defaultValue; } } public String getUserValue() { return this.userValues[this.value]; } public void nextValue() { ++this.value; if (this.value < 0 || this.value >= this.propertyValues.length) { this.value = 0; } } public Property(String var1, String[] var2, String var3, String[] var4, int var5) { this.propertyName = var1; this.propertyValues = var2; this.userName = var3; this.userValues = var4; this.defaultValue = var5; if (var2.length != var4.length) { throw new IllegalArgumentException(String.valueOf((new StringBuilder("Property and user values have different lengths: ")).append(var2.length).append(" != ").append(var4.length))); } else if (var5 >= 0 && var5 < var2.length) { this.value = var5; } else { throw new IllegalArgumentException(String.valueOf((new StringBuilder("Invalid default value: ")).append(var5))); } } public boolean setPropertyValue(String var1) { if (var1 == null) { this.value = this.defaultValue; return false; } else { this.value = ArrayUtils.indexOf(this.propertyValues, var1); if (this.value >= 0 && this.value < this.propertyValues.length) { return true; } else { this.value = this.defaultValue; return false; } } } public int getValue() { return this.value; } public String getPropertyName() { return this.propertyName; } public String toString() { return String.valueOf((new StringBuilder()).append(this.propertyName).append("=").append(this.getPropertyValue()).append(" [").append(Config.arrayToString((Object[])this.propertyValues)).append("], value: ").append(this.value)); } }
UTF-8
Java
3,042
java
Property.java
Java
[]
null
[]
package shadersmod.client; import java.util.Properties; import optifine.Config; import org.apache.commons.lang3.ArrayUtils; public class Property { private int value = 0; private int defaultValue = 0; private String[] userValues = null; private String propertyName = null; private String[] propertyValues = null; private int[] values = null; private String userName = null; public void resetValue() { this.value = this.defaultValue; } public void saveTo(Properties var1) { if (var1 != null) { var1.setProperty(this.getPropertyName(), this.getPropertyValue()); } } public boolean loadFrom(Properties var1) { this.resetValue(); if (var1 == null) { return false; } else { String var2 = var1.getProperty(this.propertyName); return var2 == null ? false : this.setPropertyValue(var2); } } public String getPropertyValue() { return this.propertyValues[this.value]; } public String getUserName() { return this.userName; } public void setValue(int var1) { this.value = var1; if (this.value < 0 || this.value >= this.propertyValues.length) { this.value = this.defaultValue; } } public String getUserValue() { return this.userValues[this.value]; } public void nextValue() { ++this.value; if (this.value < 0 || this.value >= this.propertyValues.length) { this.value = 0; } } public Property(String var1, String[] var2, String var3, String[] var4, int var5) { this.propertyName = var1; this.propertyValues = var2; this.userName = var3; this.userValues = var4; this.defaultValue = var5; if (var2.length != var4.length) { throw new IllegalArgumentException(String.valueOf((new StringBuilder("Property and user values have different lengths: ")).append(var2.length).append(" != ").append(var4.length))); } else if (var5 >= 0 && var5 < var2.length) { this.value = var5; } else { throw new IllegalArgumentException(String.valueOf((new StringBuilder("Invalid default value: ")).append(var5))); } } public boolean setPropertyValue(String var1) { if (var1 == null) { this.value = this.defaultValue; return false; } else { this.value = ArrayUtils.indexOf(this.propertyValues, var1); if (this.value >= 0 && this.value < this.propertyValues.length) { return true; } else { this.value = this.defaultValue; return false; } } } public int getValue() { return this.value; } public String getPropertyName() { return this.propertyName; } public String toString() { return String.valueOf((new StringBuilder()).append(this.propertyName).append("=").append(this.getPropertyValue()).append(" [").append(Config.arrayToString((Object[])this.propertyValues)).append("], value: ").append(this.value)); } }
3,042
0.62163
0.608153
106
27.698112
33.97562
234
false
false
0
0
0
0
0
0
0.490566
false
false
2
b4919e2110ad9cf45e7750411229cd5f8509e0d1
7,370,163,901,861
ec1a2bc672be69c7081a9760d38e8ef596ef9d4c
/schedule/src/main/java/cn/matio/schedule/ScheduleConfig.java
3fe5e933598d79427471a0cbcb75b1ffcc3323fc
[]
no_license
mwt1314/springboot
https://github.com/mwt1314/springboot
6740ca0d3ac574a1b88b2e9b7e625b173ffac9aa
740773eb47e793399e795087f8040a58af6402a5
refs/heads/master
2020-11-30T02:47:40.278000
2019-12-26T14:43:06
2019-12-26T14:43:06
230,279,756
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.matio.schedule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import java.util.concurrent.Executor; import java.util.concurrent.Executors; /** * @author mawt * @description * @date 2019/12/11 */ /* 在实际项目中,我们一个系统可能会定义多个定时任务。那么多个定时任务之间是可以相互独立且可以并行执行的。 通过查看org.springframework.scheduling.config.ScheduledTaskRegistrar源代码,发现spring默认会创建一个单线程池。 这样对于我们的多任务调度可能会是致命的,当多个任务并发(或需要在同一时间)执行时,任务调度器就会出现时间漂移,任务执行时间将不确定。 protected void scheduleTasks() { if (this.taskScheduler == null) { // 从这一行可以看出, 定时调度任务初始化时候初始化了一个单线程的线程池 // 所以在定时任务调度时候, 如果定时任务过多, 就会存在线程争抢 // 而且每一次也只会有一个定时任务运行 this.localExecutor = Executors.newSingleThreadScheduledExecutor(); this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor); } //省略... } 自定义线程池:新增一个配置类,实现SchedulingConfigurer接口。重写configureTasks方法,通过taskRegistrar设置自定义线程池 */ @Configuration public class ScheduleConfig implements SchedulingConfigurer { @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { taskRegistrar.setScheduler(taskExecutor()); // 修改初始化线程数为100 //taskRegistrar.setScheduler(Executors.newScheduledThreadPool(100)); } @Bean(destroyMethod = "shutdown") public Executor taskExecutor() { return Executors.newScheduledThreadPool(20); } }
UTF-8
Java
2,077
java
ScheduleConfig.java
Java
[ { "context": "rt java.util.concurrent.Executors;\n\n/**\n * @author mawt\n * @description\n * @date 2019/12/11\n */\n/*\n 在实际项目", "end": 379, "score": 0.9996702671051025, "start": 375, "tag": "USERNAME", "value": "mawt" } ]
null
[]
package cn.matio.schedule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import java.util.concurrent.Executor; import java.util.concurrent.Executors; /** * @author mawt * @description * @date 2019/12/11 */ /* 在实际项目中,我们一个系统可能会定义多个定时任务。那么多个定时任务之间是可以相互独立且可以并行执行的。 通过查看org.springframework.scheduling.config.ScheduledTaskRegistrar源代码,发现spring默认会创建一个单线程池。 这样对于我们的多任务调度可能会是致命的,当多个任务并发(或需要在同一时间)执行时,任务调度器就会出现时间漂移,任务执行时间将不确定。 protected void scheduleTasks() { if (this.taskScheduler == null) { // 从这一行可以看出, 定时调度任务初始化时候初始化了一个单线程的线程池 // 所以在定时任务调度时候, 如果定时任务过多, 就会存在线程争抢 // 而且每一次也只会有一个定时任务运行 this.localExecutor = Executors.newSingleThreadScheduledExecutor(); this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor); } //省略... } 自定义线程池:新增一个配置类,实现SchedulingConfigurer接口。重写configureTasks方法,通过taskRegistrar设置自定义线程池 */ @Configuration public class ScheduleConfig implements SchedulingConfigurer { @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { taskRegistrar.setScheduler(taskExecutor()); // 修改初始化线程数为100 //taskRegistrar.setScheduler(Executors.newScheduledThreadPool(100)); } @Bean(destroyMethod = "shutdown") public Executor taskExecutor() { return Executors.newScheduledThreadPool(20); } }
2,077
0.764933
0.754656
51
29.529411
27.974325
88
false
false
0
0
0
0
0
0
0.294118
false
false
2
2fcdcb187a6455c388dca7e8751f23f7d5cef5c3
22,076,131,912,594
b4e99d3ab888b7db1882013af7098b7d86be25ab
/src/main/java/com/matoski/glacier/Output.java
c97525251179a3c20209f83877b350e5b8bf2d39
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
optionalg/glacier-interface
https://github.com/optionalg/glacier-interface
3b483b0c073f25145019c543664303e781fc096e
316be71361d8fb29b102097ef3dfb5773a08754a
refs/heads/master
2021-06-04T14:59:29.772000
2016-10-12T23:09:27
2016-10-12T23:09:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.matoski.glacier; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * Output class, used to write it to the console. * * @author Ilija Matoski (ilijamt@gmail.com) */ public class Output { /** * Write the object as json to {@link System#out}. * * @param obj The obhect to convert to Json using {@link Gson} */ public static void toJson(Object obj) { System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(obj)); } }
UTF-8
Java
511
java
Output.java
Java
[ { "context": "ss, used to write it to the console.\n *\n * @author Ilija Matoski (ilijamt@gmail.com)\n */\npublic class Output {\n\n ", "end": 177, "score": 0.9998719692230225, "start": 164, "tag": "NAME", "value": "Ilija Matoski" }, { "context": "e it to the console.\n *\n * @autho...
null
[]
package com.matoski.glacier; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * Output class, used to write it to the console. * * @author <NAME> (<EMAIL>) */ public class Output { /** * Write the object as json to {@link System#out}. * * @param obj The obhect to convert to Json using {@link Gson} */ public static void toJson(Object obj) { System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(obj)); } }
494
0.657534
0.657534
22
22.227272
24.839359
87
false
false
0
0
0
0
0
0
0.227273
false
false
2
98cd0305f7ed2f4e6daaa3924a756692575f82bf
16,630,113,401,262
d01fc966b3ba8a24ab0e86fbfb757c0158a1c9cd
/app/src/main/java/com/xieyao/movies/data/bean/TrailerResult.java
f84ea1f0fc543312cb17f55aacddf64a5e260853
[ "MIT" ]
permissive
yao-xie/Movies
https://github.com/yao-xie/Movies
debda00e062bbfed1960c821d71c7224974d6872
86a1b3e7bfdd9a80ed62f322ee72b38e030c42c0
refs/heads/master
2020-09-03T20:06:26.256000
2020-02-26T07:45:52
2020-02-26T07:45:52
219,556,164
1
0
null
false
2020-02-26T07:45:54
2019-11-04T17:18:55
2020-02-26T07:40:56
2020-02-26T07:45:53
263
1
0
0
Java
false
false
package com.xieyao.movies.data.bean; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by xieyao on 2019-10-11. */ public class TrailerResult { /** * id : 475557 * results : [{"id":"5ccf56c8925141044e2c88d6","iso_639_1":"en","iso_3166_1":"US","key":"t433PEQGErc","name":"JOKER - Teaser Trailer","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5d66ab95ba4802610c26a044","iso_639_1":"en","iso_3166_1":"US","key":"xRjvmVaFHkk","name":"JOKER \u2013 Final Trailer \u2013 Warner Bros.","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5d95ddbb35818f0013d7c1b3","iso_639_1":"en","iso_3166_1":"US","key":"jk41yJH3pyQ","name":"Playing the mad clown | The Straits Times","site":"YouTube","size":1080,"type":"Featurette"}] */ @SerializedName("id") private int id; @SerializedName("results") private List<TrailerItem> results; public int getId() { return id; } public void setId(int id) { this.id = id; } public List<TrailerItem> getResults() { return results; } public void setResults(List<TrailerItem> results) { this.results = results; } }
UTF-8
Java
1,192
java
TrailerResult.java
Java
[ { "context": "edName;\n\nimport java.util.List;\n\n/**\n * Created by xieyao on 2019-10-11.\n */\npublic class TrailerResult {\n\n", "end": 138, "score": 0.9995556473731995, "start": 132, "tag": "USERNAME", "value": "xieyao" }, { "context": "2c88d6\",\"iso_639_1\":\"en\",\"iso_3166_1...
null
[]
package com.xieyao.movies.data.bean; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by xieyao on 2019-10-11. */ public class TrailerResult { /** * id : 475557 * results : [{"id":"5ccf56c8925141044e2c88d6","iso_639_1":"en","iso_3166_1":"US","key":"t433PEQGErc","name":"JOKER - Teaser Trailer","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5d66ab95ba4802610c26a044","iso_639_1":"en","iso_3166_1":"US","key":"<KEY>","name":"JOKER \u2013 Final Trailer \u2013 Warner Bros.","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5d95ddbb35818f0013d7c1b3","iso_639_1":"en","iso_3166_1":"US","key":"<KEY>","name":"Playing the mad clown | The Straits Times","site":"YouTube","size":1080,"type":"Featurette"}] */ @SerializedName("id") private int id; @SerializedName("results") private List<TrailerItem> results; public int getId() { return id; } public void setId(int id) { this.id = id; } public List<TrailerItem> getResults() { return results; } public void setResults(List<TrailerItem> results) { this.results = results; } }
1,180
0.635906
0.538591
39
29.564102
88.283287
565
false
false
0
0
0
0
0
0
0.846154
false
false
2
98908768e9dc960132537e508007e129326e0232
21,741,124,478,837
fae83a7a4b1f0e4bc3e28b8aaef5ca8998918183
/src/org/daisy/pipeline/core/PipelineCore.java
5e00676b3f6dbec961ed464be27fff0c37652f9a
[]
no_license
techmilano/pipeline1
https://github.com/techmilano/pipeline1
2bd3c64edf9773c868bbe23123b80b2302212ca5
f4b7c92ef9d84bf9caeebc4e17870059d044d83c
refs/heads/master
2020-04-10T14:27:46.762000
2018-03-09T14:35:31
2018-03-13T13:48:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Daisy Pipeline (C) 2005-2008 Daisy Consortium * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.daisy.pipeline.core; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.util.Locale; import java.util.Properties; import java.util.ResourceBundle; import org.daisy.pipeline.core.script.Creator; import org.daisy.pipeline.core.script.Job; import org.daisy.pipeline.core.script.Runner; import org.daisy.pipeline.core.script.Script; import org.daisy.pipeline.core.script.ScriptValidationException; import org.daisy.pipeline.core.transformer.TransformerHandlerLoader; import org.daisy.pipeline.exception.DMFCConfigurationException; import org.daisy.pipeline.exception.JobFailedException; import org.daisy.util.file.TempFile; import org.daisy.util.i18n.I18n; import org.daisy.util.i18n.XMLProperties; import org.daisy.util.i18n.XMLPropertyResourceBundle; import org.daisy.util.runtime.RegistryQuery; /** * This is the class users of DMFC should instantiate. A common usage of DMFC * would include the following: * * <pre> * DMFCCore dmfc = new DMFCCore(inputListener, locale); * dmfc.executeScript(scriptFile); * </pre> * * @author Linus Ericson */ public class PipelineCore { private Creator mCreator; private Runner mRunner; private File mHomeDir; /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. */ public PipelineCore() throws DMFCConfigurationException { this(null, null, null, null); } /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. * * @param inListener a listener of (user) input events */ public PipelineCore(InputListener inListener) throws DMFCConfigurationException { this(inListener, null, null, null); } /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. * * @param inListener a listener of (user) input events * @param homeDir the home directory */ public PipelineCore(InputListener inListener, File homeDir) throws DMFCConfigurationException { this(inListener, homeDir, null, null); } /** * Create an instance of the Daisy Pipeline. * * @param inListener a listener of (user) input events * @param homeDir the home directory * @param userProps a set of user properties */ public PipelineCore(InputListener inListener, File homeDir, Properties userProps) throws DMFCConfigurationException { this(inListener, homeDir, userProps, null); } /** * Creates an instance of Daisy Pipeline. This constructor gives * the user the opportunity to supply both user properties and * pipeline properties as <code>userProps</code> and * <code>pipelineProps</code>. * * @param inListener a listener of (user) input events * @param mHomeDir the directory considered the daisy pipeline home directory * @param userProps a set of user properties * @param pipelineProps a set of pipeline properties * @throws DMFCConfigurationException it the pipeline properties cannot * be read. */ public PipelineCore(InputListener inListener, File homeDir, Properties userProps, Properties pipelineProps) throws DMFCConfigurationException { mHomeDir = (homeDir!=null)?homeDir:findHomeDirectory(); TransformerHandlerLoader.INSTANCE.setInputListener(inListener); TransformerHandlerLoader.INSTANCE.setTransformersDirectory(new File(mHomeDir, "transformers")); mCreator = new Creator(); mRunner = new Runner(); initialize(userProps, pipelineProps); } private void initialize(Properties userProps, Properties pipelineProps) throws DMFCConfigurationException, SecurityException { // Martin Blomberg 20071109: make it possible to give both // Properties as parameters eventougth pipeline.properties // is not normally accessed by users. if (pipelineProps == null) { // Load properties // mg 20070530: we use two properties files; one with likelihood of user // access and one less likely // Init system properties URL propsURL = getClass().getClassLoader().getResource( "pipeline.properties"); XMLProperties properties = new XMLProperties(System.getProperties()); try { properties.loadFromXML(propsURL.openStream()); } catch (IOException e) { throw new DMFCConfigurationException( "Can't read pipeline.properties", e); } System.setProperties(properties); } else { System.getProperties().putAll(pipelineProps); } // Init user properties if (userProps == null) { URL propsURL = getClass().getClassLoader().getResource( "pipeline.user.properties"); userProps = new XMLProperties(); try { userProps.loadFromXML(propsURL.openStream()); } catch (IOException e) { throw new DMFCConfigurationException( "Can't read pipeline.properties", e); } } setUserProperties(userProps); // Load messages ResourceBundle bundle = XMLPropertyResourceBundle.getBundle((this .getClass().getPackage().getName()).replace('.', '/') + "/messages.properties", Locale.getDefault(), this.getClass() .getClassLoader()); // ResourceBundle bundle = // XMLPropertyResourceBundle.getBundle(this.getClass().getPackage().getName() // + ".pipeline.messages", Locale.getDefault(), // this.getClass().getClassLoader()); // alternatively: // ResourceBundle bundle = XMLPropertyResourceBundle.getBundle( // this.getClass().getResource("pipeline.messages"), Locale.ENGLISH); I18n.setDefaultBundle(bundle); //Setup Logging Properties if (System.getProperty("java.util.logging.config.file") == null) { System.setProperty("java.util.logging.config.file", "logging.properties"); } } /** * Configure the Pipeline with the given user properties. This * implementation adds the given properties to the System properties. * * @param properties the user properties used to configure the Pipeline */ public void setUserProperties(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties can't be null"); } // Set system properties for (Object key : properties.keySet()) { String name = (String) key; if ("pipeline.lame.path".equals(name)) { String lamePath = initLamePath(properties.getProperty(name)); System.setProperty(name, lamePath); } else { System.setProperty(name, properties.getProperty(name)); } } // Apply new properties if possible TempFile.setTempDir(new File(System.getProperty("pipeline.tempDir"))); } /** * Initializes the Lame path. If the <code>pipline.lame.path</code> property is * undefined (or set to the empty string), the Lame path can be autodetected on * Windows if Lame has been installed using the NSIS installer. * If Lame is found in both HCLM and HKCU (i.e. installed both by the system * administrator and the current user), the one with the latest version * number is used. * @param propertyValue the <code>pipeline.lame.path</code> property value * @return the (possibly autodetected) lame path */ public static String initLamePath(String propertyValue) { // If the pipeline.lame.path system property is undifined (or set to the empty string), // and we are on the Windows platform, try to detect Lame using the registry. if ((propertyValue == null || "".equals(propertyValue)) && System.getProperty("os.name").matches("Windows.*")) { boolean found = false; // We look in both HKLM and HKCU String hklmPath = RegistryQuery.readString("HKLM\\Software\\Lame", "Path"); String hklmVersion = RegistryQuery.readString("HKLM\\Software\\Lame", "Version"); String hkcuPath = RegistryQuery.readString("HKCU\\Software\\Lame", "Path"); String hkcuVersion = RegistryQuery.readString("HKCU\\Software\\Lame", "Version"); if (hklmPath != null) { File lameExe = new File(hklmPath, "lame.exe"); if (lameExe.exists()) { // Lame found in HKLM propertyValue = lameExe.getAbsolutePath(); found = true; if (hkcuPath != null) { lameExe = new File(hkcuPath, "lame.exe"); // If Lame is found in HKCU as well, we use the one with the latest // version number. if (lameExe.exists() && hkcuVersion != null) { if (hklmVersion == null || hkcuVersion.compareTo(hklmVersion) >= 0) { propertyValue = lameExe.getAbsolutePath(); } } } } } if (!found && hkcuPath != null) { File lameExe = new File(hkcuPath, "lame.exe"); if (lameExe.exists()) { // Lame found in HKCU propertyValue = lameExe.getAbsolutePath(); } } } //System.err.println("Lame path: " + propertyValue); return propertyValue; } /** * Creates a new Script object from a script file * * @param url * @return a Script * @throws ScriptValidationException */ public Script newScript(URL url) throws ScriptValidationException { return mCreator.newScript(url); } /** * Execute a script contained in a ScriptRunner object. * * @param job * @throws JobFailedException */ public void execute(Job job) throws JobFailedException { this.mRunner.execute(job); } /** * Gets the number of completed tasks in the current script. If no script is * currently being executed, 0 is returned. * * @return the number of completed tasks */ public int getCompletedTasks() { return mRunner.getCompletedTasks(); } /** * Is a script currently being run? * * @return true if a script is currently running, false otherwise */ public boolean isRunning() { return mRunner.isRunning(); } /** * Returns the home directory of this Pipeline instance. * @return the home directory of this Pipeline instance. */ public File getHomeDirectory() { return mHomeDir; } /** * Finds the pipeline home directory. * * @param propertiesURL * @return * @throws DMFCConfigurationException */ public static File findHomeDirectory() throws DMFCConfigurationException { URL propertiesURL = PipelineCore.class.getClassLoader().getResource( "pipeline.properties"); File propertiesFile = null; try { propertiesFile = new File(propertiesURL.toURI()); } catch (URISyntaxException e) { throw new DMFCConfigurationException(e.getMessage(), e); } // Is this the home dir? File folder = propertiesFile.getParentFile(); if (PipelineCore.testHomeDirectory(folder)) { return folder; } // Test parent folder = folder.getParentFile(); if (PipelineCore.testHomeDirectory(folder)) { return folder; } throw new DMFCConfigurationException( "Cannot locate the Daisy Pipeline home directory"); } /** * Tests if a given directory is the home directory. * * @param folder a possible home directory * @return true if the given folder is the home directory, false otherwise */ public static boolean testHomeDirectory(File folder) { File[] files = folder.listFiles(new FileFilter() { public boolean accept(File file) { return ("transformers".equals(file.getName()) && file .isDirectory()); } }); return files != null && files.length == 1; } }
UTF-8
Java
13,807
java
PipelineCore.java
Java
[ { "context": "xecuteScript(scriptFile);\n * </pre>\n * \n * @author Linus Ericson\n */\npublic class PipelineCore {\n\n private Crea", "end": 1954, "score": 0.9998226165771484, "start": 1941, "tag": "NAME", "value": "Linus Ericson" }, { "context": "rationException, SecurityExcepti...
null
[]
/* * Daisy Pipeline (C) 2005-2008 Daisy Consortium * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.daisy.pipeline.core; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.util.Locale; import java.util.Properties; import java.util.ResourceBundle; import org.daisy.pipeline.core.script.Creator; import org.daisy.pipeline.core.script.Job; import org.daisy.pipeline.core.script.Runner; import org.daisy.pipeline.core.script.Script; import org.daisy.pipeline.core.script.ScriptValidationException; import org.daisy.pipeline.core.transformer.TransformerHandlerLoader; import org.daisy.pipeline.exception.DMFCConfigurationException; import org.daisy.pipeline.exception.JobFailedException; import org.daisy.util.file.TempFile; import org.daisy.util.i18n.I18n; import org.daisy.util.i18n.XMLProperties; import org.daisy.util.i18n.XMLPropertyResourceBundle; import org.daisy.util.runtime.RegistryQuery; /** * This is the class users of DMFC should instantiate. A common usage of DMFC * would include the following: * * <pre> * DMFCCore dmfc = new DMFCCore(inputListener, locale); * dmfc.executeScript(scriptFile); * </pre> * * @author <NAME> */ public class PipelineCore { private Creator mCreator; private Runner mRunner; private File mHomeDir; /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. */ public PipelineCore() throws DMFCConfigurationException { this(null, null, null, null); } /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. * * @param inListener a listener of (user) input events */ public PipelineCore(InputListener inListener) throws DMFCConfigurationException { this(inListener, null, null, null); } /** * Create an instance of the Daisy Pipeline. This constructor will fetch the * Pipeline properties files in the <code>bin/</code> sub-directory of * <code>homeDir</code>. * * @param inListener a listener of (user) input events * @param homeDir the home directory */ public PipelineCore(InputListener inListener, File homeDir) throws DMFCConfigurationException { this(inListener, homeDir, null, null); } /** * Create an instance of the Daisy Pipeline. * * @param inListener a listener of (user) input events * @param homeDir the home directory * @param userProps a set of user properties */ public PipelineCore(InputListener inListener, File homeDir, Properties userProps) throws DMFCConfigurationException { this(inListener, homeDir, userProps, null); } /** * Creates an instance of Daisy Pipeline. This constructor gives * the user the opportunity to supply both user properties and * pipeline properties as <code>userProps</code> and * <code>pipelineProps</code>. * * @param inListener a listener of (user) input events * @param mHomeDir the directory considered the daisy pipeline home directory * @param userProps a set of user properties * @param pipelineProps a set of pipeline properties * @throws DMFCConfigurationException it the pipeline properties cannot * be read. */ public PipelineCore(InputListener inListener, File homeDir, Properties userProps, Properties pipelineProps) throws DMFCConfigurationException { mHomeDir = (homeDir!=null)?homeDir:findHomeDirectory(); TransformerHandlerLoader.INSTANCE.setInputListener(inListener); TransformerHandlerLoader.INSTANCE.setTransformersDirectory(new File(mHomeDir, "transformers")); mCreator = new Creator(); mRunner = new Runner(); initialize(userProps, pipelineProps); } private void initialize(Properties userProps, Properties pipelineProps) throws DMFCConfigurationException, SecurityException { // <NAME> 20071109: make it possible to give both // Properties as parameters eventougth pipeline.properties // is not normally accessed by users. if (pipelineProps == null) { // Load properties // mg 20070530: we use two properties files; one with likelihood of user // access and one less likely // Init system properties URL propsURL = getClass().getClassLoader().getResource( "pipeline.properties"); XMLProperties properties = new XMLProperties(System.getProperties()); try { properties.loadFromXML(propsURL.openStream()); } catch (IOException e) { throw new DMFCConfigurationException( "Can't read pipeline.properties", e); } System.setProperties(properties); } else { System.getProperties().putAll(pipelineProps); } // Init user properties if (userProps == null) { URL propsURL = getClass().getClassLoader().getResource( "pipeline.user.properties"); userProps = new XMLProperties(); try { userProps.loadFromXML(propsURL.openStream()); } catch (IOException e) { throw new DMFCConfigurationException( "Can't read pipeline.properties", e); } } setUserProperties(userProps); // Load messages ResourceBundle bundle = XMLPropertyResourceBundle.getBundle((this .getClass().getPackage().getName()).replace('.', '/') + "/messages.properties", Locale.getDefault(), this.getClass() .getClassLoader()); // ResourceBundle bundle = // XMLPropertyResourceBundle.getBundle(this.getClass().getPackage().getName() // + ".pipeline.messages", Locale.getDefault(), // this.getClass().getClassLoader()); // alternatively: // ResourceBundle bundle = XMLPropertyResourceBundle.getBundle( // this.getClass().getResource("pipeline.messages"), Locale.ENGLISH); I18n.setDefaultBundle(bundle); //Setup Logging Properties if (System.getProperty("java.util.logging.config.file") == null) { System.setProperty("java.util.logging.config.file", "logging.properties"); } } /** * Configure the Pipeline with the given user properties. This * implementation adds the given properties to the System properties. * * @param properties the user properties used to configure the Pipeline */ public void setUserProperties(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties can't be null"); } // Set system properties for (Object key : properties.keySet()) { String name = (String) key; if ("pipeline.lame.path".equals(name)) { String lamePath = initLamePath(properties.getProperty(name)); System.setProperty(name, lamePath); } else { System.setProperty(name, properties.getProperty(name)); } } // Apply new properties if possible TempFile.setTempDir(new File(System.getProperty("pipeline.tempDir"))); } /** * Initializes the Lame path. If the <code>pipline.lame.path</code> property is * undefined (or set to the empty string), the Lame path can be autodetected on * Windows if Lame has been installed using the NSIS installer. * If Lame is found in both HCLM and HKCU (i.e. installed both by the system * administrator and the current user), the one with the latest version * number is used. * @param propertyValue the <code>pipeline.lame.path</code> property value * @return the (possibly autodetected) lame path */ public static String initLamePath(String propertyValue) { // If the pipeline.lame.path system property is undifined (or set to the empty string), // and we are on the Windows platform, try to detect Lame using the registry. if ((propertyValue == null || "".equals(propertyValue)) && System.getProperty("os.name").matches("Windows.*")) { boolean found = false; // We look in both HKLM and HKCU String hklmPath = RegistryQuery.readString("HKLM\\Software\\Lame", "Path"); String hklmVersion = RegistryQuery.readString("HKLM\\Software\\Lame", "Version"); String hkcuPath = RegistryQuery.readString("HKCU\\Software\\Lame", "Path"); String hkcuVersion = RegistryQuery.readString("HKCU\\Software\\Lame", "Version"); if (hklmPath != null) { File lameExe = new File(hklmPath, "lame.exe"); if (lameExe.exists()) { // Lame found in HKLM propertyValue = lameExe.getAbsolutePath(); found = true; if (hkcuPath != null) { lameExe = new File(hkcuPath, "lame.exe"); // If Lame is found in HKCU as well, we use the one with the latest // version number. if (lameExe.exists() && hkcuVersion != null) { if (hklmVersion == null || hkcuVersion.compareTo(hklmVersion) >= 0) { propertyValue = lameExe.getAbsolutePath(); } } } } } if (!found && hkcuPath != null) { File lameExe = new File(hkcuPath, "lame.exe"); if (lameExe.exists()) { // Lame found in HKCU propertyValue = lameExe.getAbsolutePath(); } } } //System.err.println("Lame path: " + propertyValue); return propertyValue; } /** * Creates a new Script object from a script file * * @param url * @return a Script * @throws ScriptValidationException */ public Script newScript(URL url) throws ScriptValidationException { return mCreator.newScript(url); } /** * Execute a script contained in a ScriptRunner object. * * @param job * @throws JobFailedException */ public void execute(Job job) throws JobFailedException { this.mRunner.execute(job); } /** * Gets the number of completed tasks in the current script. If no script is * currently being executed, 0 is returned. * * @return the number of completed tasks */ public int getCompletedTasks() { return mRunner.getCompletedTasks(); } /** * Is a script currently being run? * * @return true if a script is currently running, false otherwise */ public boolean isRunning() { return mRunner.isRunning(); } /** * Returns the home directory of this Pipeline instance. * @return the home directory of this Pipeline instance. */ public File getHomeDirectory() { return mHomeDir; } /** * Finds the pipeline home directory. * * @param propertiesURL * @return * @throws DMFCConfigurationException */ public static File findHomeDirectory() throws DMFCConfigurationException { URL propertiesURL = PipelineCore.class.getClassLoader().getResource( "pipeline.properties"); File propertiesFile = null; try { propertiesFile = new File(propertiesURL.toURI()); } catch (URISyntaxException e) { throw new DMFCConfigurationException(e.getMessage(), e); } // Is this the home dir? File folder = propertiesFile.getParentFile(); if (PipelineCore.testHomeDirectory(folder)) { return folder; } // Test parent folder = folder.getParentFile(); if (PipelineCore.testHomeDirectory(folder)) { return folder; } throw new DMFCConfigurationException( "Cannot locate the Daisy Pipeline home directory"); } /** * Tests if a given directory is the home directory. * * @param folder a possible home directory * @return true if the given folder is the home directory, false otherwise */ public static boolean testHomeDirectory(File folder) { File[] files = folder.listFiles(new FileFilter() { public boolean accept(File file) { return ("transformers".equals(file.getName()) && file .isDirectory()); } }); return files != null && files.length == 1; } }
13,791
0.628884
0.625045
357
37.675072
28.070555
153
false
false
0
0
0
0
0
0
0.605042
false
false
2
20ae878e22d8b0e6e5f3ae97958adfd5f35b85a0
21,741,124,476,525
0d783e7b43bf80fe7d936e5090bd3929f8b06971
/application.windows64/source/Matrix_Rain.java
45e0febc3462cc8c25f49db7ba50c0b71fc22923
[]
no_license
Vilkass/matrix-rain
https://github.com/Vilkass/matrix-rain
c73b1293e01b3e5a915be447762815c89a556bc0
c965cd37a23733afe3ad9587376acf52a07e252b
refs/heads/master
2022-12-14T14:13:19.852000
2020-08-30T15:38:07
2020-08-30T15:38:07
291,494,236
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class Matrix_Rain extends PApplet { int STREAMS_QUANTATY = 1300 / 15; Stream[] streams = new Stream[STREAMS_QUANTATY]; public void setup(){ surface.setTitle("Matrix rain"); int x = 0; for(int i = 0; i < 1300 / 15; i++){ streams[i] = new Stream( x, (int)random(0,500), (int)random(3,15) ); x += 15; } } public void draw(){ background(0); for(int i = 0; i < streams.length; i++){ streams[i].showStream(); } } class Stream{ Symbol[] symbols; int streamSpeed = (int)random(1,10); int x; Stream(int x, int y, int n){ //int n = 10; symbols = new Symbol[n]; this.x = x; for(int i = 0; i < n; i++){ symbols[i] = new Symbol(x, y); y += symbols[i].symbolSize; } } public int getX(){ return x; } public void showStream(){ for(int i = 0; i < symbols.length; i++){ symbols[i].show(200); symbols[i].changeValue(); symbols[i].y+= streamSpeed; if(symbols[i].y >= 700){ symbols[i].y = 0; } if(i == symbols.length-1){ symbols[i].show(500); } } } } class Symbol{ int x; int y; char value; float speed; int symbolSize = 15; Symbol(int x, int y){ this.x = x; this.y = y; value = PApplet.parseChar((int) random(0x30A0, 0x3100)); } public void show(int a){ fill(0,255,100, a); text(value,x,y); } public void changeValue(){ int rand = (int)random(1,5); if(rand == 1){ value = PApplet.parseChar((int) random(0x30A0, 0x3100)); } } } public void settings() { size(1300,700); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "Matrix_Rain" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }
UTF-8
Java
2,247
java
Matrix_Rain.java
Java
[]
null
[]
import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class Matrix_Rain extends PApplet { int STREAMS_QUANTATY = 1300 / 15; Stream[] streams = new Stream[STREAMS_QUANTATY]; public void setup(){ surface.setTitle("Matrix rain"); int x = 0; for(int i = 0; i < 1300 / 15; i++){ streams[i] = new Stream( x, (int)random(0,500), (int)random(3,15) ); x += 15; } } public void draw(){ background(0); for(int i = 0; i < streams.length; i++){ streams[i].showStream(); } } class Stream{ Symbol[] symbols; int streamSpeed = (int)random(1,10); int x; Stream(int x, int y, int n){ //int n = 10; symbols = new Symbol[n]; this.x = x; for(int i = 0; i < n; i++){ symbols[i] = new Symbol(x, y); y += symbols[i].symbolSize; } } public int getX(){ return x; } public void showStream(){ for(int i = 0; i < symbols.length; i++){ symbols[i].show(200); symbols[i].changeValue(); symbols[i].y+= streamSpeed; if(symbols[i].y >= 700){ symbols[i].y = 0; } if(i == symbols.length-1){ symbols[i].show(500); } } } } class Symbol{ int x; int y; char value; float speed; int symbolSize = 15; Symbol(int x, int y){ this.x = x; this.y = y; value = PApplet.parseChar((int) random(0x30A0, 0x3100)); } public void show(int a){ fill(0,255,100, a); text(value,x,y); } public void changeValue(){ int rand = (int)random(1,5); if(rand == 1){ value = PApplet.parseChar((int) random(0x30A0, 0x3100)); } } } public void settings() { size(1300,700); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "Matrix_Rain" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }
2,247
0.570539
0.534935
123
17.268293
16.085176
72
false
false
0
0
0
0
0
0
0.626016
false
false
2
c4136db9baa2847f02f449757d3ae54775ac19fc
25,074,019,098,656
ffd5a5ab8a0d49210f3f4b5fb0759f42c34658be
/src/sg/org/pap/pickle/ui/pickle/CapturePhotoUtils.java
5ea9484f297ba56f3e162a2b16a121f00c47f1d1
[]
no_license
Sputuks3/pap4sg
https://github.com/Sputuks3/pap4sg
0baddfb2e47f2dce1c5485f2c92a87a43590ccda
4f2dce439e18de05814243c9cd028811a40a89d8
refs/heads/master
2021-05-04T10:30:17.352000
2016-11-16T06:11:34
2016-11-16T06:11:34
53,306,184
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sg.org.pap.pickle.ui.pickle; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.Matrix; import android.net.Uri; import android.provider.MediaStore.Images.Media; import android.provider.MediaStore.Images.Thumbnails; import com.facebook.share.internal.ShareConstants; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; public class CapturePhotoUtils { public static final String insertImage(ContentResolver cr, Bitmap source, String title, String description) { OutputStream imageOut; ContentValues values = new ContentValues(); values.put(ShareConstants.WEB_DIALOG_PARAM_TITLE, title); values.put("_display_name", title); values.put(ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION, description); values.put("mime_type", "image/jpeg"); values.put("date_added", Long.valueOf(System.currentTimeMillis())); values.put("datetaken", Long.valueOf(System.currentTimeMillis())); Uri url = null; try { url = cr.insert(Media.EXTERNAL_CONTENT_URI, values); if (source != null) { imageOut = cr.openOutputStream(url); source.compress(CompressFormat.JPEG, 50, imageOut); imageOut.close(); long id = ContentUris.parseId(url); storeThumbnail(cr, Thumbnails.getThumbnail(cr, id, 1, null), id, 50.0f, 50.0f, 3); if (url == null) { return url.toString(); } return null; } cr.delete(url, null, null); url = null; if (url == null) { return null; } return url.toString(); } catch (Exception e) { if (url != null) { cr.delete(url, null, null); url = null; } } catch (Throwable th) { imageOut.close(); } } private static final Bitmap storeThumbnail(ContentResolver cr, Bitmap source, long id, float width, float height, int kind) { Matrix matrix = new Matrix(); matrix.setScale(width / ((float) source.getWidth()), height / ((float) source.getHeight())); Bitmap thumb = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); ContentValues values = new ContentValues(4); values.put("kind", Integer.valueOf(kind)); values.put("image_id", Integer.valueOf((int) id)); values.put("height", Integer.valueOf(thumb.getHeight())); values.put("width", Integer.valueOf(thumb.getWidth())); try { OutputStream thumbOut = cr.openOutputStream(cr.insert(Thumbnails.EXTERNAL_CONTENT_URI, values)); thumb.compress(CompressFormat.JPEG, 100, thumbOut); thumbOut.close(); return thumb; } catch (FileNotFoundException e) { return null; } catch (IOException e2) { return null; } } }
UTF-8
Java
3,200
java
CapturePhotoUtils.java
Java
[]
null
[]
package sg.org.pap.pickle.ui.pickle; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.Matrix; import android.net.Uri; import android.provider.MediaStore.Images.Media; import android.provider.MediaStore.Images.Thumbnails; import com.facebook.share.internal.ShareConstants; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; public class CapturePhotoUtils { public static final String insertImage(ContentResolver cr, Bitmap source, String title, String description) { OutputStream imageOut; ContentValues values = new ContentValues(); values.put(ShareConstants.WEB_DIALOG_PARAM_TITLE, title); values.put("_display_name", title); values.put(ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION, description); values.put("mime_type", "image/jpeg"); values.put("date_added", Long.valueOf(System.currentTimeMillis())); values.put("datetaken", Long.valueOf(System.currentTimeMillis())); Uri url = null; try { url = cr.insert(Media.EXTERNAL_CONTENT_URI, values); if (source != null) { imageOut = cr.openOutputStream(url); source.compress(CompressFormat.JPEG, 50, imageOut); imageOut.close(); long id = ContentUris.parseId(url); storeThumbnail(cr, Thumbnails.getThumbnail(cr, id, 1, null), id, 50.0f, 50.0f, 3); if (url == null) { return url.toString(); } return null; } cr.delete(url, null, null); url = null; if (url == null) { return null; } return url.toString(); } catch (Exception e) { if (url != null) { cr.delete(url, null, null); url = null; } } catch (Throwable th) { imageOut.close(); } } private static final Bitmap storeThumbnail(ContentResolver cr, Bitmap source, long id, float width, float height, int kind) { Matrix matrix = new Matrix(); matrix.setScale(width / ((float) source.getWidth()), height / ((float) source.getHeight())); Bitmap thumb = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); ContentValues values = new ContentValues(4); values.put("kind", Integer.valueOf(kind)); values.put("image_id", Integer.valueOf((int) id)); values.put("height", Integer.valueOf(thumb.getHeight())); values.put("width", Integer.valueOf(thumb.getWidth())); try { OutputStream thumbOut = cr.openOutputStream(cr.insert(Thumbnails.EXTERNAL_CONTENT_URI, values)); thumb.compress(CompressFormat.JPEG, 100, thumbOut); thumbOut.close(); return thumb; } catch (FileNotFoundException e) { return null; } catch (IOException e2) { return null; } } }
3,200
0.613437
0.608125
77
40.558441
27.183119
129
false
false
0
0
0
0
0
0
1.233766
false
false
2
e42cf8630855dc6f9f43400c45bdb775d9ca069b
25,074,019,099,268
4e7475eced06373a9c087115e1b813149765ef6f
/src/main/java/pers/goetboy/exam/controller/ExamController.java
d38c6c1c10d36cf8d212855b8182b7e493daa5ed
[]
no_license
goetboy/exam
https://github.com/goetboy/exam
0fbd062959f4369effacd4fed2df70a783d3031a
81124c158debf3b825642cd81c3124d08ab244f1
refs/heads/master
2021-11-23T03:50:09.427000
2021-10-26T08:42:56
2021-10-26T08:42:56
129,907,784
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pers.goetboy.exam.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import pers.goetboy.common.AbstractController; import pers.goetboy.common.AbstractParam; import pers.goetboy.common.exception.service.ServiceTipsException; import pers.goetboy.common.EntityState; import pers.goetboy.exam.model.entity.Exam; import pers.goetboy.exam.services.ExamService; /** * @author goetb */ @RestController @RequestMapping("/exam") public class ExamController extends AbstractController { private final ExamService examService; @Autowired public ExamController(ExamService examService) { this.examService = examService; } /** * 获取考试列表 */ @GetMapping("/list") public IPage<Exam> list(Integer current, Integer size) { return examService.page(new Page(current, size)); } /** * 获取考试信息 * * @param examId 考试id * @return 考试信息 */ @GetMapping(value = "/get") public Exam get(Long examId) { return examService.get(examId); } /** * 更新考试信息 * * @param param 考试信息 */ @PostMapping(value = "/update") public void update(@RequestBody ExamParam param) throws ServiceTipsException { examService.update(param.getEntity()); } @PostMapping(value = "/save") public void save(@RequestBody ExamParam param) throws ServiceTipsException { examService.save(param.getEntity()); } /** * 删除考试信息 * * @param param id 考试id */ @PostMapping(value = "/delete") public void delete(@RequestBody ExamParam param) { examService.delete(param.getId()); } /** * 更新考试状态 * * @param param id 考试id | state 菜单状态 0停用 1正常 * @throws ServiceTipsException 异常信息 */ @PostMapping(value = "/update/state") public void updateUserState(@RequestBody ExamParam param) throws ServiceTipsException { examService.updateState(param.getId(), EntityState.getByValue(param.getState())); } } @Data class ExamParam extends AbstractParam<Exam> { }
UTF-8
Java
2,380
java
ExamController.java
Java
[ { "context": "oetboy.exam.services.ExamService;\n\n\n/**\n * @author goetb\n */\n@RestController\n@RequestMapping(\"/exam\")\npubl", "end": 601, "score": 0.9996698498725891, "start": 596, "tag": "USERNAME", "value": "goetb" } ]
null
[]
package pers.goetboy.exam.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import pers.goetboy.common.AbstractController; import pers.goetboy.common.AbstractParam; import pers.goetboy.common.exception.service.ServiceTipsException; import pers.goetboy.common.EntityState; import pers.goetboy.exam.model.entity.Exam; import pers.goetboy.exam.services.ExamService; /** * @author goetb */ @RestController @RequestMapping("/exam") public class ExamController extends AbstractController { private final ExamService examService; @Autowired public ExamController(ExamService examService) { this.examService = examService; } /** * 获取考试列表 */ @GetMapping("/list") public IPage<Exam> list(Integer current, Integer size) { return examService.page(new Page(current, size)); } /** * 获取考试信息 * * @param examId 考试id * @return 考试信息 */ @GetMapping(value = "/get") public Exam get(Long examId) { return examService.get(examId); } /** * 更新考试信息 * * @param param 考试信息 */ @PostMapping(value = "/update") public void update(@RequestBody ExamParam param) throws ServiceTipsException { examService.update(param.getEntity()); } @PostMapping(value = "/save") public void save(@RequestBody ExamParam param) throws ServiceTipsException { examService.save(param.getEntity()); } /** * 删除考试信息 * * @param param id 考试id */ @PostMapping(value = "/delete") public void delete(@RequestBody ExamParam param) { examService.delete(param.getId()); } /** * 更新考试状态 * * @param param id 考试id | state 菜单状态 0停用 1正常 * @throws ServiceTipsException 异常信息 */ @PostMapping(value = "/update/state") public void updateUserState(@RequestBody ExamParam param) throws ServiceTipsException { examService.updateState(param.getId(), EntityState.getByValue(param.getState())); } } @Data class ExamParam extends AbstractParam<Exam> { }
2,380
0.679894
0.679012
89
24.494383
23.540606
91
false
false
0
0
0
0
0
0
0.269663
false
false
2
ac351009b55b4e47c56e781465a35e16b22a9b0e
16,097,537,447,104
7d567a0f59676968d3584e3772a676be1574c90f
/src/main/java/org/nuxeo/sample/kleturc/core/adapter/ProductDocument.java
bac553fb16f4f6575b8b7accbd0a90902f69e02e
[]
no_license
kevinleturc/nuxeo-sample-product-project
https://github.com/kevinleturc/nuxeo-sample-product-project
97684faed073eb38148b6764da835ab80d4e396a
b5b0d292b9f45bb02e2216d83bceb7dbdd7a1670
refs/heads/master
2018-01-10T00:33:07.970000
2015-11-26T16:34:25
2015-11-26T16:34:25
46,801,884
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.nuxeo.sample.kleturc.core.adapter; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import org.nuxeo.ecm.core.api.DocumentModel; /** * Document with price. */ public class ProductDocument { public static final String NEWBEES_PRODUCT = "newbeesproduct"; private DocumentModel document; public ProductDocument(DocumentModel document) { this.document = document; } public DocumentModel getDocument() { return document; } public Optional<Double> getPrice() { return Optional.ofNullable(document.getProperty(NEWBEES_PRODUCT, "price")).map(Double.class::cast); } public void setPrice(double price) { document.setProperty(NEWBEES_PRODUCT, "price", price); } public Optional<Long> getDeliveryDurationDays() { return Optional.ofNullable(document.getProperty(NEWBEES_PRODUCT, "deliveryDurationDays")).map(Long.class::cast); } public void setDeliveryDurationDays(long deliveryDurationDays) { document.setProperty(NEWBEES_PRODUCT, "deliveryDurationDays", deliveryDurationDays); } @SuppressWarnings("unchecked") public List<ProductDistributor> getDistributors() { List<Map<String, Object>> distributors = (List<Map<String, Object>>) document.getProperty(NEWBEES_PRODUCT, "distributor"); return distributors.stream().map(ProductDistributor::new).collect(Collectors.toList()); } public void addDistributor(String name, String sellLocation) { ProductDistributor distributor = new ProductDistributor(); distributor.setName(name); distributor.setSellLocation(sellLocation); addDistributor(distributor); } public void addDistributor(ProductDistributor distributor) { List<ProductDistributor> distributors = getDistributors(); if (!distributors.contains(distributor)) { distributors.add(distributor); } setDistributors(distributors); } public void removeDistributor(String name) { setDistributors(getDistributors().stream() .filter(distributor -> !distributor.getName().equals(name)) .collect(Collectors.toList())); } public void removeDistributor(ProductDistributor distributor) { List<ProductDistributor> distributors = getDistributors(); distributors.remove(distributor); setDistributors(distributors); } public void setDistributors(List<ProductDistributor> distributors) { document.setProperty(NEWBEES_PRODUCT, "distributor", distributors.stream() .map(ProductDistributor::toMap) .collect(Collectors.toList())); } public static class ProductDistributor { private Map<String, Object> values; public ProductDistributor() { this(new HashMap<>()); } public ProductDistributor(Map<String, Object> values) { this.values = values; } public String getName() { return (String) values.get("name"); } public void setName(String name) { values.put("name", name); } public String getSellLocation() { return (String) values.get("sellLocation"); } public void setSellLocation(String sellLocation) { values.put("sellLocation", sellLocation); } public Map<String, Object> toMap() { return new HashMap<>(values); } @Override public int hashCode() { return Objects.hash(getName(), getSellLocation()); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ProductDistributor)) { return false; } ProductDistributor distributor = (ProductDistributor) obj; return Objects.equals(getName(), distributor.getName()) && Objects.equals(getSellLocation(), distributor.getSellLocation()); } } }
UTF-8
Java
4,381
java
ProductDocument.java
Java
[]
null
[]
package org.nuxeo.sample.kleturc.core.adapter; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import org.nuxeo.ecm.core.api.DocumentModel; /** * Document with price. */ public class ProductDocument { public static final String NEWBEES_PRODUCT = "newbeesproduct"; private DocumentModel document; public ProductDocument(DocumentModel document) { this.document = document; } public DocumentModel getDocument() { return document; } public Optional<Double> getPrice() { return Optional.ofNullable(document.getProperty(NEWBEES_PRODUCT, "price")).map(Double.class::cast); } public void setPrice(double price) { document.setProperty(NEWBEES_PRODUCT, "price", price); } public Optional<Long> getDeliveryDurationDays() { return Optional.ofNullable(document.getProperty(NEWBEES_PRODUCT, "deliveryDurationDays")).map(Long.class::cast); } public void setDeliveryDurationDays(long deliveryDurationDays) { document.setProperty(NEWBEES_PRODUCT, "deliveryDurationDays", deliveryDurationDays); } @SuppressWarnings("unchecked") public List<ProductDistributor> getDistributors() { List<Map<String, Object>> distributors = (List<Map<String, Object>>) document.getProperty(NEWBEES_PRODUCT, "distributor"); return distributors.stream().map(ProductDistributor::new).collect(Collectors.toList()); } public void addDistributor(String name, String sellLocation) { ProductDistributor distributor = new ProductDistributor(); distributor.setName(name); distributor.setSellLocation(sellLocation); addDistributor(distributor); } public void addDistributor(ProductDistributor distributor) { List<ProductDistributor> distributors = getDistributors(); if (!distributors.contains(distributor)) { distributors.add(distributor); } setDistributors(distributors); } public void removeDistributor(String name) { setDistributors(getDistributors().stream() .filter(distributor -> !distributor.getName().equals(name)) .collect(Collectors.toList())); } public void removeDistributor(ProductDistributor distributor) { List<ProductDistributor> distributors = getDistributors(); distributors.remove(distributor); setDistributors(distributors); } public void setDistributors(List<ProductDistributor> distributors) { document.setProperty(NEWBEES_PRODUCT, "distributor", distributors.stream() .map(ProductDistributor::toMap) .collect(Collectors.toList())); } public static class ProductDistributor { private Map<String, Object> values; public ProductDistributor() { this(new HashMap<>()); } public ProductDistributor(Map<String, Object> values) { this.values = values; } public String getName() { return (String) values.get("name"); } public void setName(String name) { values.put("name", name); } public String getSellLocation() { return (String) values.get("sellLocation"); } public void setSellLocation(String sellLocation) { values.put("sellLocation", sellLocation); } public Map<String, Object> toMap() { return new HashMap<>(values); } @Override public int hashCode() { return Objects.hash(getName(), getSellLocation()); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ProductDistributor)) { return false; } ProductDistributor distributor = (ProductDistributor) obj; return Objects.equals(getName(), distributor.getName()) && Objects.equals(getSellLocation(), distributor.getSellLocation()); } } }
4,381
0.616754
0.616754
137
30.978102
29.916298
120
false
false
0
0
0
0
0
0
0.459854
false
false
2
72c52603df5222c5766cc91f44ea4738853d91f5
14,731,737,851,596
fb84eb64129c111a9409dbbeb5e4d7910c5bf0ca
/src/unsw/dungeon/Spike.java
126ebbcf6f5636eec477f108f5503e973ba13f36
[]
no_license
PeterKim321/Java-Dungeon-Crawler-Game
https://github.com/PeterKim321/Java-Dungeon-Crawler-Game
59d202d07609113df10edc67efb1d1be6212006d
15f535061c80b7c82ec077c2a5c33a8d5adafd0e
refs/heads/master
2020-12-06T11:52:10.841000
2020-01-08T02:32:17
2020-01-08T02:32:17
232,456,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package unsw.dungeon; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import java.util.Random; public class Spike extends Entity { private SpikeState spikeState; private Player p = null; private BooleanProperty spikeIsActive; private int maxCounterTick; public Spike(int x, int y) { super(x, y); spikeState = new SpikeInactive(); spikeIsActive = new SimpleBooleanProperty(); spikeIsActive.setValue(false); maxCounterTick = getRandNum(); } public SpikeState getSpikeState() { return spikeState; } public BooleanProperty getSpikeIsActive() { return spikeIsActive; } private int counter = 0; public int getRandNum() { int min = 2; int max = 6; Random random = new Random(); return random.nextInt(max - min) + min; } @Override public void tick() { counter++; if (!spikeIsActive.getValue() && counter < maxCounterTick) { return; } spikeState = spikeState.tick(); spikeIsActive.setValue(spikeState.getIsActive()); if (p != null && p.getX() == getX() && p.getY() == getY()) { spikeState.interactWith(p, ""); } counter = 0; } @Override public boolean isMoveToAble() { return true; } @Override public void interactWith(Player p, String moveCmd) { spikeState.interactWith(p, moveCmd); this.p = p; } }
UTF-8
Java
1,348
java
Spike.java
Java
[]
null
[]
package unsw.dungeon; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import java.util.Random; public class Spike extends Entity { private SpikeState spikeState; private Player p = null; private BooleanProperty spikeIsActive; private int maxCounterTick; public Spike(int x, int y) { super(x, y); spikeState = new SpikeInactive(); spikeIsActive = new SimpleBooleanProperty(); spikeIsActive.setValue(false); maxCounterTick = getRandNum(); } public SpikeState getSpikeState() { return spikeState; } public BooleanProperty getSpikeIsActive() { return spikeIsActive; } private int counter = 0; public int getRandNum() { int min = 2; int max = 6; Random random = new Random(); return random.nextInt(max - min) + min; } @Override public void tick() { counter++; if (!spikeIsActive.getValue() && counter < maxCounterTick) { return; } spikeState = spikeState.tick(); spikeIsActive.setValue(spikeState.getIsActive()); if (p != null && p.getX() == getX() && p.getY() == getY()) { spikeState.interactWith(p, ""); } counter = 0; } @Override public boolean isMoveToAble() { return true; } @Override public void interactWith(Player p, String moveCmd) { spikeState.interactWith(p, moveCmd); this.p = p; } }
1,348
0.687685
0.684718
69
18.536232
17.791531
62
false
false
0
0
0
0
0
0
1.681159
false
false
2
890cbf75c67198fce8a84e6eeba3a47724866391
12,652,973,698,217
22d75e5f50b0d6c6794d5e7708f1bc3baf46d943
/common/src/main/java/indi/vicliu/juaner/common/scheduling/annotation/SchedulingConfiguration.java
de3e1dd82afaf79c52194b04d1dbc543b73212e8
[ "MIT" ]
permissive
vicliu624/juaner-platform
https://github.com/vicliu624/juaner-platform
1c91da15ac7bc9a1853771b70d5c3cbff6b9648b
989f2ea55d78370940858936494972761fc0ff50
refs/heads/1.1.0
2021-07-24T12:29:18.199000
2021-07-14T02:30:45
2021-07-14T02:30:45
209,962,777
0
0
MIT
false
2021-04-22T19:22:35
2019-09-21T10:04:19
2021-03-18T03:33:49
2021-04-22T19:22:34
1,255
0
0
1
Java
false
false
package indi.vicliu.juaner.common.scheduling.annotation; import io.micrometer.prometheus.PrometheusMeterRegistry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; import org.springframework.scheduling.config.TaskManagementConfigUtils; @Configuration @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public class SchedulingConfiguration { @Autowired private PrometheusMeterRegistry prometheusMeterRegistry; @Bean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public ScheduledAnnotationBeanPostProcessor scheduledAnnotationProcessor() { return new ScheduledAnnotationBeanPostProcessor(prometheusMeterRegistry); } }
UTF-8
Java
958
java
SchedulingConfiguration.java
Java
[]
null
[]
package indi.vicliu.juaner.common.scheduling.annotation; import io.micrometer.prometheus.PrometheusMeterRegistry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; import org.springframework.scheduling.config.TaskManagementConfigUtils; @Configuration @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public class SchedulingConfiguration { @Autowired private PrometheusMeterRegistry prometheusMeterRegistry; @Bean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public ScheduledAnnotationBeanPostProcessor scheduledAnnotationProcessor() { return new ScheduledAnnotationBeanPostProcessor(prometheusMeterRegistry); } }
958
0.843424
0.843424
25
37.32
29.861977
84
false
false
0
0
0
0
0
0
0.4
false
false
2
b24459ef424b81be9dc05775209a7af5135aea7c
5,368,709,179,686
7ce03bef7011a1b203356a82377366fba6a80ba7
/ReloaderHelpDesk-master/app/src/main/java/resembrink/dev/reloader_helpdesk/AuthFacebook/MainActivityFace.java
15512f008d5be936283b05a8bd3014d8d1afccb7
[]
no_license
reloadersystem/TabBottonSlide
https://github.com/reloadersystem/TabBottonSlide
9763ce13d8f051d09c0592f8d03b5441a6ba611a
64dc8cf53c854d2ced5a5828b375c6f55d86fae8
refs/heads/master
2020-04-17T18:26:59.622000
2019-01-21T14:24:14
2019-01-21T14:24:14
166,827,045
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package resembrink.dev.reloader_helpdesk.AuthFacebook; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.CircleCrop; import com.facebook.AccessToken; import com.facebook.login.LoginManager; import com.google.android.gms.maps.model.CircleOptions; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import de.hdodenhof.circleimageview.CircleImageView; import resembrink.dev.reloader_helpdesk.AuthGoogle.firebaseAuth; import resembrink.dev.reloader_helpdesk.MainActivity; import resembrink.dev.reloader_helpdesk.R; public class MainActivityFace extends AppCompatActivity { Button btlogout; Button btinicio; private TextView nameTextView; private TextView emailTextView; private TextView uidTextview; private CircleImageView circlephoto; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logueo); nameTextView= findViewById(R.id.nameTextViewF); emailTextView= findViewById(R.id.emailTextViewF); uidTextview= findViewById(R.id.uidTextViewF); circlephoto= findViewById(R.id.id_photoResume); btinicio= findViewById(R.id.btnIniciar); FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if( user != null) { String name= user.getDisplayName(); String email= user.getEmail(); Uri photoUrl= user.getPhotoUrl(); String uid= user.getUid(); nameTextView.setText(name); emailTextView.setText(email); uidTextview.setText(uid); Glide.with(getApplicationContext()) .load(photoUrl) .into(circlephoto); } else { goLoginScreen(); } btlogout= findViewById(R.id.btnlogout); btlogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseAuth.getInstance().signOut(); LoginManager.getInstance().logOut(); goLoginScreen(); } }); btinicio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1= new Intent(MainActivityFace.this, MainActivity.class); intent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); finish(); } }); } private void goLoginScreen() { Intent intent= new Intent(MainActivityFace.this, firebaseAuth.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }
UTF-8
Java
3,242
java
MainActivityFace.java
Java
[]
null
[]
package resembrink.dev.reloader_helpdesk.AuthFacebook; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.CircleCrop; import com.facebook.AccessToken; import com.facebook.login.LoginManager; import com.google.android.gms.maps.model.CircleOptions; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import de.hdodenhof.circleimageview.CircleImageView; import resembrink.dev.reloader_helpdesk.AuthGoogle.firebaseAuth; import resembrink.dev.reloader_helpdesk.MainActivity; import resembrink.dev.reloader_helpdesk.R; public class MainActivityFace extends AppCompatActivity { Button btlogout; Button btinicio; private TextView nameTextView; private TextView emailTextView; private TextView uidTextview; private CircleImageView circlephoto; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logueo); nameTextView= findViewById(R.id.nameTextViewF); emailTextView= findViewById(R.id.emailTextViewF); uidTextview= findViewById(R.id.uidTextViewF); circlephoto= findViewById(R.id.id_photoResume); btinicio= findViewById(R.id.btnIniciar); FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if( user != null) { String name= user.getDisplayName(); String email= user.getEmail(); Uri photoUrl= user.getPhotoUrl(); String uid= user.getUid(); nameTextView.setText(name); emailTextView.setText(email); uidTextview.setText(uid); Glide.with(getApplicationContext()) .load(photoUrl) .into(circlephoto); } else { goLoginScreen(); } btlogout= findViewById(R.id.btnlogout); btlogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseAuth.getInstance().signOut(); LoginManager.getInstance().logOut(); goLoginScreen(); } }); btinicio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1= new Intent(MainActivityFace.this, MainActivity.class); intent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); finish(); } }); } private void goLoginScreen() { Intent intent= new Intent(MainActivityFace.this, firebaseAuth.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }
3,242
0.662246
0.661012
101
31.09901
25.822895
131
false
false
0
0
0
0
0
0
0.623762
false
false
2
b37f4e8e462e42b7855a01b28cf233c1c2ec2718
15,942,918,604,476
ffb3e265dadd324592f0cb514fc86dfebf811b5b
/Practica1/src/com/plexus/Reparacion.java
32c41a4489fea2193f18b9add42172be00ff5a9d
[]
no_license
ivancm25/Repositorio
https://github.com/ivancm25/Repositorio
7972ba65e8933ed09e7700e66f0c1e0444fbdf68
904a68ae687a9e979ef4fe3738feb40227da6515
refs/heads/master
2023-08-14T11:01:01.848000
2021-03-03T14:30:00
2021-03-03T14:30:00
337,503,888
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.plexus; import java.sql.Date; import java.time.LocalDate; public class Reparacion { protected String clienteDni; protected String matriculaVeh; protected String descripcion; protected String fecha; protected int tiempoDias; protected double totalReparacion; public Reparacion(String clienteDni, String matriculaVeh, String descripcion, String date, int tiempoDias, double totalReparacion) { this.clienteDni = clienteDni; this.matriculaVeh = matriculaVeh; this.descripcion = descripcion; this.fecha = date; this.tiempoDias = tiempoDias; this.totalReparacion = totalReparacion; } public Reparacion() {} public String getClienteDni() { return clienteDni; } public void setClienteDni(String clienteDni) { this.clienteDni = clienteDni; } public String getMatriculaVeh() { return matriculaVeh; } public void setMatriculaVeh(String matriculaVeh) { this.matriculaVeh = matriculaVeh; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public int getTiempoDias() { return tiempoDias; } public void setTiempoDias(int tiempoDias) { this.tiempoDias = tiempoDias; } public double getTotalReparacion() { return totalReparacion; } public void setTotalReparacion(double totalReparacion) { this.totalReparacion = totalReparacion; } @Override public String toString() { return "ClienteDni:" + clienteDni + "\nMatriculaVeh:" + matriculaVeh + "\nDescripcion:" + descripcion + "\nFecha:" + fecha + "\nTiempoDias:" + tiempoDias + "\nTotalReparacion:" + totalReparacion; } }
UTF-8
Java
1,794
java
Reparacion.java
Java
[]
null
[]
package com.plexus; import java.sql.Date; import java.time.LocalDate; public class Reparacion { protected String clienteDni; protected String matriculaVeh; protected String descripcion; protected String fecha; protected int tiempoDias; protected double totalReparacion; public Reparacion(String clienteDni, String matriculaVeh, String descripcion, String date, int tiempoDias, double totalReparacion) { this.clienteDni = clienteDni; this.matriculaVeh = matriculaVeh; this.descripcion = descripcion; this.fecha = date; this.tiempoDias = tiempoDias; this.totalReparacion = totalReparacion; } public Reparacion() {} public String getClienteDni() { return clienteDni; } public void setClienteDni(String clienteDni) { this.clienteDni = clienteDni; } public String getMatriculaVeh() { return matriculaVeh; } public void setMatriculaVeh(String matriculaVeh) { this.matriculaVeh = matriculaVeh; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public int getTiempoDias() { return tiempoDias; } public void setTiempoDias(int tiempoDias) { this.tiempoDias = tiempoDias; } public double getTotalReparacion() { return totalReparacion; } public void setTotalReparacion(double totalReparacion) { this.totalReparacion = totalReparacion; } @Override public String toString() { return "ClienteDni:" + clienteDni + "\nMatriculaVeh:" + matriculaVeh + "\nDescripcion:" + descripcion + "\nFecha:" + fecha + "\nTiempoDias:" + tiempoDias + "\nTotalReparacion:" + totalReparacion; } }
1,794
0.726867
0.726867
105
16.085714
22.105425
133
false
false
0
0
0
0
0
0
1.238095
false
false
2
cacb9372c10b7637c399ea613dcaab86b065e075
27,805,618,285,367
76b90f32b7a1c8f1a473d1d04bf40e232c5d6a23
/Intersection of Two Arrays II.java
b2236b4c89cfd4c1963a886183bf13f9b64eb9f5
[]
no_license
raicse21/LeetCode
https://github.com/raicse21/LeetCode
bd0f9d1336daae173601ed130863cd233224e913
d56b802f1fe6ffe5cc0521d33ff62cfac97518f4
refs/heads/master
2022-12-17T19:20:33.518000
2020-09-14T17:36:17
2020-09-14T17:36:17
294,941,707
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Solution { public int[] intersect(int[] nums1, int[] nums2) { ArrayList<Integer> res = new ArrayList<>(); Arrays.sort(nums1); Arrays.sort(nums2); int i =0 ,j =0; while( i < nums1.length && j < nums2.length){ if(nums1[i]==nums2[j]){ res.add(nums1[i]); i++; j++; } else if( nums1[i] > nums2[j]) j++; else i++; } int[] ans = new int[res.size()]; for( i = 0; i < res.size();i++) ans[i] = res.get(i); return ans; } }
UTF-8
Java
666
java
Intersection of Two Arrays II.java
Java
[]
null
[]
class Solution { public int[] intersect(int[] nums1, int[] nums2) { ArrayList<Integer> res = new ArrayList<>(); Arrays.sort(nums1); Arrays.sort(nums2); int i =0 ,j =0; while( i < nums1.length && j < nums2.length){ if(nums1[i]==nums2[j]){ res.add(nums1[i]); i++; j++; } else if( nums1[i] > nums2[j]) j++; else i++; } int[] ans = new int[res.size()]; for( i = 0; i < res.size();i++) ans[i] = res.get(i); return ans; } }
666
0.373874
0.352853
24
25.833334
15.131828
54
false
false
0
0
0
0
0
0
0.666667
false
false
2
0ffcfbff1077dbbceaa9dde672ad9724ca5147f5
1,486,058,698,933
a82f3edb7f70ebed97ac8237347bdee5567f69b6
/src/sliddingWindow/LongestSubstringKDistinct.java
d862f958e1593bbd9633963848f8432e55e230b3
[]
no_license
DavidOparanti/algorithm-patterns
https://github.com/DavidOparanti/algorithm-patterns
1539736fea3789646ebf2e75acdd022a8b0a22fb
5ba8887f0b0dcdc0f3dfafcd696fe6146fd5cfda
refs/heads/master
2023-04-29T03:04:46.315000
2021-08-23T05:43:14
2021-08-23T05:43:14
368,731,786
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sliddingWindow; import java.util.HashMap; import java.util.Map; //Given a string, find the length of the longest substring in it with no more than K distinct characters. // // You can assume that K is less than or equal to the length of the given string. // // Example: // // Input: String="araaci", K=2 // Output: 4 // Explanation: The longest substring with no more than '2' distinct characters is "araa". public class LongestSubstringKDistinct { public static int findLength(String str, int k) { if (str.isBlank() || str.length() < k) throw new IllegalArgumentException(); int windowStart = 0; int maxLength = 0; Map<Character, Integer> window = new HashMap<>(); for (int i = 0; i < str.length(); i++) { char rightChar = str.charAt(i); window.put(rightChar, window.getOrDefault(rightChar, 0) + 1); while (window.size() > k) { Character lefChar = str.charAt(windowStart); window.put(lefChar, window.get(lefChar) -1); if (window.get(lefChar) == 0) { window.remove(lefChar); } windowStart++; } maxLength = Math.max(maxLength, i - windowStart + 1); } return maxLength; } public static void main(String[] args) { System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("araaci", 2)); System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("araaci", 1)); System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("cbbebi", 3)); } }
UTF-8
Java
1,762
java
LongestSubstringKDistinct.java
Java
[ { "context": "// Example:\n//\n// Input: String=\"araaci\", K=2\n// Output: 4\n// Explanation: ", "end": 328, "score": 0.6042925715446472, "start": 325, "tag": "NAME", "value": "aci" } ]
null
[]
package sliddingWindow; import java.util.HashMap; import java.util.Map; //Given a string, find the length of the longest substring in it with no more than K distinct characters. // // You can assume that K is less than or equal to the length of the given string. // // Example: // // Input: String="araaci", K=2 // Output: 4 // Explanation: The longest substring with no more than '2' distinct characters is "araa". public class LongestSubstringKDistinct { public static int findLength(String str, int k) { if (str.isBlank() || str.length() < k) throw new IllegalArgumentException(); int windowStart = 0; int maxLength = 0; Map<Character, Integer> window = new HashMap<>(); for (int i = 0; i < str.length(); i++) { char rightChar = str.charAt(i); window.put(rightChar, window.getOrDefault(rightChar, 0) + 1); while (window.size() > k) { Character lefChar = str.charAt(windowStart); window.put(lefChar, window.get(lefChar) -1); if (window.get(lefChar) == 0) { window.remove(lefChar); } windowStart++; } maxLength = Math.max(maxLength, i - windowStart + 1); } return maxLength; } public static void main(String[] args) { System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("araaci", 2)); System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("araaci", 1)); System.out.println("Length of the longest substring: " + LongestSubstringKDistinct.findLength("cbbebi", 3)); } }
1,762
0.599886
0.591941
48
35.708332
33.932507
116
false
false
0
0
0
0
0
0
0.6875
false
false
2
77fe672100a1761fb5384276e26162010f5dbb13
10,728,828,350,421
d507eafbd34e497dbaacefca305d5a41d1f15782
/zce-test/src/main/java/com/laijiantian/zce/test/service/impl/ScorePictureServiceImpl.java
32fad7a95fd07cb4b09e8c5e0fb6440b8d9f34d5
[ "Apache-2.0" ]
permissive
laijiantian/zce
https://github.com/laijiantian/zce
c1f2158f2f147363a24a15f328483847a0936617
028ccbc1dec8a889c0c90b0f1f23f1c2bc0a3b32
refs/heads/master
2023-04-06T08:31:01.142000
2021-03-31T01:11:28
2021-03-31T01:11:28
353,185,079
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.laijiantian.zce.test.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.laijiantian.common.utils.PageUtils; import com.laijiantian.common.utils.Query; import com.laijiantian.zce.test.dao.ScorePictureDao; import com.laijiantian.zce.test.entity.ScorePictureEntity; import com.laijiantian.zce.test.service.ScorePictureService; @Service("scorePictureService") public class ScorePictureServiceImpl extends ServiceImpl<ScorePictureDao, ScorePictureEntity> implements ScorePictureService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<ScorePictureEntity> page = this.page( new Query<ScorePictureEntity>().getPage(params), new QueryWrapper<ScorePictureEntity>() ); return new PageUtils(page); } }
UTF-8
Java
1,035
java
ScorePictureServiceImpl.java
Java
[]
null
[]
package com.laijiantian.zce.test.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.laijiantian.common.utils.PageUtils; import com.laijiantian.common.utils.Query; import com.laijiantian.zce.test.dao.ScorePictureDao; import com.laijiantian.zce.test.entity.ScorePictureEntity; import com.laijiantian.zce.test.service.ScorePictureService; @Service("scorePictureService") public class ScorePictureServiceImpl extends ServiceImpl<ScorePictureDao, ScorePictureEntity> implements ScorePictureService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<ScorePictureEntity> page = this.page( new Query<ScorePictureEntity>().getPage(params), new QueryWrapper<ScorePictureEntity>() ); return new PageUtils(page); } }
1,035
0.77971
0.77971
29
34.724136
30.232315
126
false
false
0
0
0
0
0
0
0.551724
false
false
2
a065d99f51dbfacde250002508f2214f742237fd
10,728,828,351,184
dba38e4cb489c9baadf67d8c66c200b45ef373bd
/src/com/cuc/miti/phone/xmc/dao/PlaceDao.java
bc7d62e1948519128f2ad65c6d1e8ce812ad5a5d
[]
no_license
wangwpapril/testing
https://github.com/wangwpapril/testing
b8eef8b801bb202aa6eae37dc53cfeddc9341baf
7f1db6a985cc910000c46a0377ed945554f9bef7
refs/heads/master
2021-01-10T20:32:27.280000
2015-04-18T02:07:26
2015-04-18T02:07:26
31,912,438
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cuc.miti.phone.xmc.dao; import java.util.ArrayList; import java.util.List; import com.cuc.miti.phone.xmc.domain.Pager; import com.cuc.miti.phone.xmc.domain.Place; import com.cuc.miti.phone.xmc.utils.ChineseToPinyinHelper; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class PlaceDao { private static SQLiteHelper sqlHelper; private static final int VERSION = 1; public PlaceDao(Context context){ sqlHelper = new SQLiteHelper(context,VERSION); } /** * ���һ����¼ * @param placeType * @return */ public boolean addPlace(Place place){ int count = 0; if(place != null){ String sql = "insert into Place (p_id,code,name,[language],[desc],pinyin,headchar) values(?,?,?,?,?,?,?)"; Object[] params = {place.getP_id(),place.getCode(),place.getName(),place.getLanguage(),place.getDesc(),place.getPinyin(),place.getHeadchar()}; count = sqlHelper.insert(sql, params); } return count==1?true:false; } /** * ɾ��һ����� * @param name * @return */ public boolean deletePlace(String name){ int count = 0; if(name != null){ String sql = "delete from Place where name = ?"; String[] params = {name}; count = sqlHelper.delete(sql, params); } return count==1?true:false; } /** * ɾ������ * @return */ public boolean deleteAllPlace(){ String sql = "delete from Place"; sqlHelper.deleteAll(sql); return true; } /** * ���� * @param place * @return */ public boolean updatePlace(Place place){ int count = 0; if(place != null){ String sql = "update Place set p_id=?, code = ?,[language] = ?,[desc]=?,pinyin=?,headchar=? where name = ?"; Object[] params = {place.getP_id(),place.getCode(),place.getLanguage(),place.getDesc(),place.getPinyin(),place.getHeadchar(),place.getName()}; count = sqlHelper.update(sql, params); } return count ==1 ? true:false; } /** * ��ѯһ����Ϣ * @param name * @return */ public Place getPlace(String name){ Place place= null; if(name != null){ String sql = "select * from Place where name = ? "; String[] params = {name}; Cursor cursor = sqlHelper.findQuery(sql,params); if(cursor != null&& cursor.getCount()>0){ place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); } cursor.close(); } return place; } /** * * ��ѯ�б� */ public List<Place> getPlaceList(){ String sql = "select * from Place"; Cursor cursor = sqlHelper.findQuery(sql); List<Place> placeList =null; if(cursor!= null&& cursor.getCount()>0){ placeList = new ArrayList<Place> ();//���� for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()){ Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); return placeList; } /** * * ��ݴ�����������ͻ�ȡ�б���Ϣ */ public List<Place> getPlaceList(String language,String queryString){ String sql =""; if(queryString.equals("")){ sql = "select * from Place where language='" + language + "'" + " order by p_id"; }else{ sql = "select * from Place where language='" + language + "'" + " and (name like '" + queryString + "%' or pinyin like '" + queryString + "%' or headchar like '" + queryString + "%') order by p_id"; } Cursor cursor = sqlHelper.findQuery(sql); List<Place> placeList =null; if(cursor!= null&& cursor.getCount()>0){ placeList = new ArrayList<Place> ();//���� for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()){ Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); return placeList; } /** * ��ȡ������ */ public long getPlaceCount(){ String sql = "select count(*) from Place"; Cursor cursor = sqlHelper.findQuery(sql,null); cursor.moveToFirst(); long returnvalue=cursor.getLong(0); cursor.close(); return returnvalue; } /** * ��ȡָ��ҳ��ķ�ҳ���,���ص�ǰҳ��������� * SQL : Select * From TABLE_NAME Limit 0,10; * ��ʾ��TABLE_NAME���ȡ��ݣ��ӵ�0����ݿ�ʼ��ȥ10�� * @param pager ��ҳ����(CurrentPage-��ǰҳ��PageSize-ÿҳ����totalNum-������<����ֵ>) * @return */ public List<Place> getPlaceByPage(Pager pager){ List<Place> placeList = null; if(pager !=null){ String sql = "select * from Place limit ?,?"; int firstResult = ((pager.getCurrentPage()-1) * pager.getPageSize()); //�ӵڼ�����ݿ�ʼ��ѯ int maxResult = pager.getPageSize(); //ÿҳ��ʾ��������¼ String[] params = {String.valueOf(firstResult),String.valueOf(maxResult)}; Cursor cursor = sqlHelper.findQuery(sql, params); if(cursor != null && cursor.getCount()>0){ placeList = new ArrayList<Place>(); for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()) { Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); } return placeList; } public boolean multiInsert(List<Place> placeList){ if(placeList !=null && placeList.size() >0){ SQLiteDatabase sda = sqlHelper.GetSQLiteDatabase(); sda.beginTransaction(); //For try { for(Place p:placeList) { ContentValues cValues=new ContentValues(); cValues.put("p_id", p.getP_id()); cValues.put("code", p.getCode()); cValues.put("name", p.getName()); cValues.put("language", p.getLanguage()); cValues.put("desc", p.getDesc()); //cValues.put("pinyin", p.getPinyin()); cValues.put("pinyin", ChineseToPinyinHelper.getPinYin(p.getName())); cValues.put("headchar", ChineseToPinyinHelper.getPinYinHeadChar(p.getName())); sda.insert("Place", null, cValues); } sda.setTransactionSuccessful(); } finally { sda.endTransaction(); } sda.close(); return true; }else { return false; } } }
UTF-8
Java
8,453
java
PlaceDao.java
Java
[]
null
[]
package com.cuc.miti.phone.xmc.dao; import java.util.ArrayList; import java.util.List; import com.cuc.miti.phone.xmc.domain.Pager; import com.cuc.miti.phone.xmc.domain.Place; import com.cuc.miti.phone.xmc.utils.ChineseToPinyinHelper; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class PlaceDao { private static SQLiteHelper sqlHelper; private static final int VERSION = 1; public PlaceDao(Context context){ sqlHelper = new SQLiteHelper(context,VERSION); } /** * ���һ����¼ * @param placeType * @return */ public boolean addPlace(Place place){ int count = 0; if(place != null){ String sql = "insert into Place (p_id,code,name,[language],[desc],pinyin,headchar) values(?,?,?,?,?,?,?)"; Object[] params = {place.getP_id(),place.getCode(),place.getName(),place.getLanguage(),place.getDesc(),place.getPinyin(),place.getHeadchar()}; count = sqlHelper.insert(sql, params); } return count==1?true:false; } /** * ɾ��һ����� * @param name * @return */ public boolean deletePlace(String name){ int count = 0; if(name != null){ String sql = "delete from Place where name = ?"; String[] params = {name}; count = sqlHelper.delete(sql, params); } return count==1?true:false; } /** * ɾ������ * @return */ public boolean deleteAllPlace(){ String sql = "delete from Place"; sqlHelper.deleteAll(sql); return true; } /** * ���� * @param place * @return */ public boolean updatePlace(Place place){ int count = 0; if(place != null){ String sql = "update Place set p_id=?, code = ?,[language] = ?,[desc]=?,pinyin=?,headchar=? where name = ?"; Object[] params = {place.getP_id(),place.getCode(),place.getLanguage(),place.getDesc(),place.getPinyin(),place.getHeadchar(),place.getName()}; count = sqlHelper.update(sql, params); } return count ==1 ? true:false; } /** * ��ѯһ����Ϣ * @param name * @return */ public Place getPlace(String name){ Place place= null; if(name != null){ String sql = "select * from Place where name = ? "; String[] params = {name}; Cursor cursor = sqlHelper.findQuery(sql,params); if(cursor != null&& cursor.getCount()>0){ place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); } cursor.close(); } return place; } /** * * ��ѯ�б� */ public List<Place> getPlaceList(){ String sql = "select * from Place"; Cursor cursor = sqlHelper.findQuery(sql); List<Place> placeList =null; if(cursor!= null&& cursor.getCount()>0){ placeList = new ArrayList<Place> ();//���� for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()){ Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); return placeList; } /** * * ��ݴ�����������ͻ�ȡ�б���Ϣ */ public List<Place> getPlaceList(String language,String queryString){ String sql =""; if(queryString.equals("")){ sql = "select * from Place where language='" + language + "'" + " order by p_id"; }else{ sql = "select * from Place where language='" + language + "'" + " and (name like '" + queryString + "%' or pinyin like '" + queryString + "%' or headchar like '" + queryString + "%') order by p_id"; } Cursor cursor = sqlHelper.findQuery(sql); List<Place> placeList =null; if(cursor!= null&& cursor.getCount()>0){ placeList = new ArrayList<Place> ();//���� for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()){ Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); return placeList; } /** * ��ȡ������ */ public long getPlaceCount(){ String sql = "select count(*) from Place"; Cursor cursor = sqlHelper.findQuery(sql,null); cursor.moveToFirst(); long returnvalue=cursor.getLong(0); cursor.close(); return returnvalue; } /** * ��ȡָ��ҳ��ķ�ҳ���,���ص�ǰҳ��������� * SQL : Select * From TABLE_NAME Limit 0,10; * ��ʾ��TABLE_NAME���ȡ��ݣ��ӵ�0����ݿ�ʼ��ȥ10�� * @param pager ��ҳ����(CurrentPage-��ǰҳ��PageSize-ÿҳ����totalNum-������<����ֵ>) * @return */ public List<Place> getPlaceByPage(Pager pager){ List<Place> placeList = null; if(pager !=null){ String sql = "select * from Place limit ?,?"; int firstResult = ((pager.getCurrentPage()-1) * pager.getPageSize()); //�ӵڼ�����ݿ�ʼ��ѯ int maxResult = pager.getPageSize(); //ÿҳ��ʾ��������¼ String[] params = {String.valueOf(firstResult),String.valueOf(maxResult)}; Cursor cursor = sqlHelper.findQuery(sql, params); if(cursor != null && cursor.getCount()>0){ placeList = new ArrayList<Place>(); for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()) { Place place = new Place(); place.setP_id(cursor.getString(cursor.getColumnIndex("p_id"))); place.setCode(cursor.getString(cursor.getColumnIndex("code"))); place.setLanguage(cursor.getString(cursor.getColumnIndex("language"))); place.setName(cursor.getString(cursor.getColumnIndex("name"))); place.setDesc(cursor.getString(cursor.getColumnIndex("desc"))); place.setPinyin(cursor.getString(cursor.getColumnIndex("pinyin"))); place.setHeadchar(cursor.getString(cursor.getColumnIndex("headchar"))); placeList.add(place); } } cursor.close(); } return placeList; } public boolean multiInsert(List<Place> placeList){ if(placeList !=null && placeList.size() >0){ SQLiteDatabase sda = sqlHelper.GetSQLiteDatabase(); sda.beginTransaction(); //For try { for(Place p:placeList) { ContentValues cValues=new ContentValues(); cValues.put("p_id", p.getP_id()); cValues.put("code", p.getCode()); cValues.put("name", p.getName()); cValues.put("language", p.getLanguage()); cValues.put("desc", p.getDesc()); //cValues.put("pinyin", p.getPinyin()); cValues.put("pinyin", ChineseToPinyinHelper.getPinYin(p.getName())); cValues.put("headchar", ChineseToPinyinHelper.getPinYinHeadChar(p.getName())); sda.insert("Place", null, cValues); } sda.setTransactionSuccessful(); } finally { sda.endTransaction(); } sda.close(); return true; }else { return false; } } }
8,453
0.626281
0.623564
278
27.125898
29.238697
203
false
false
0
0
0
0
0
0
2.827338
false
false
2
7de04818666fcb9550b5576f989a60cb8e8da11f
13,477,607,442,717
104d4f3936edddc53742a5ac429da36dfece1a93
/EmplManagment/src/com/cg/emplm/dao/EmplRepository.java
47eacc649cda8f5e374717d4aaaf0f474537e2fb
[]
no_license
RkGdeveloper/Shop
https://github.com/RkGdeveloper/Shop
f105c39dbf9a95a5b733ecfaa09b42d56ade9dff
b503b1941d065ba53bd0bb7253937217717936ed
refs/heads/master
2021-07-15T21:24:45.459000
2017-10-23T13:12:19
2017-10-23T13:12:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cg.emplm.dao; import java.util.List; import com.cg.emplm.dtos.Employee; public interface EmplRepository { List<Employee> getAllItems(); }
UTF-8
Java
163
java
EmplRepository.java
Java
[]
null
[]
package com.cg.emplm.dao; import java.util.List; import com.cg.emplm.dtos.Employee; public interface EmplRepository { List<Employee> getAllItems(); }
163
0.723926
0.723926
9
16.111111
14.601708
34
false
false
0
0
0
0
0
0
0.555556
false
false
2
c0d1d1e803b5c379b407a0616745c69027af59cc
27,135,603,436,626
2aa527b1260e8d6918a5203912fe9ece74c89eec
/wallker-framework/wallker-framework-bean/src/main/java/com/wallker/framework/exception/LoginExpireException.java
2348df5f8cd91699e784c298d05a94443afb02b2
[]
no_license
gao0516/wallker-framework
https://github.com/gao0516/wallker-framework
9fcb8a644acf03543df108e59e9f12a0bad7620b
7d5c5b93c8a031dfc849f147c7a8f61e2a064c42
refs/heads/master
2020-05-16T15:26:56.672000
2019-04-24T03:19:04
2019-04-24T03:19:04
175,025,968
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wallker.framework.exception; /** * 登录已过期异常 * @Filename: LoginExpireException.java * @Description: * @Author: Wallker.Gao * @Date: 2019年01月10日 * @Version: 1.0 * @Email: gao0516.jian@163.com */ public class LoginExpireException extends Exception { private static final long serialVersionUID = 1L; public LoginExpireException() { super(); } public LoginExpireException(String message) { super(message); } public LoginExpireException(String message, Throwable cause) { super(message, cause); } public LoginExpireException(Throwable cause) { super(cause); } protected LoginExpireException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } public static boolean is(Exception error) { return error instanceof LoginExpireException; } }
UTF-8
Java
1,017
java
LoginExpireException.java
Java
[ { "context": "ExpireException.java\n * @Description: \n * @Author: Wallker.Gao\n * @Date: 2019年01月10日\n * @Version: 1.0\n * @Email:", "end": 138, "score": 0.9998712539672852, "start": 127, "tag": "NAME", "value": "Wallker.Gao" }, { "context": "\n * @Date: 2019年01月10日\n * @Version: 1....
null
[]
package com.wallker.framework.exception; /** * 登录已过期异常 * @Filename: LoginExpireException.java * @Description: * @Author: Wallker.Gao * @Date: 2019年01月10日 * @Version: 1.0 * @Email: <EMAIL> */ public class LoginExpireException extends Exception { private static final long serialVersionUID = 1L; public LoginExpireException() { super(); } public LoginExpireException(String message) { super(message); } public LoginExpireException(String message, Throwable cause) { super(message, cause); } public LoginExpireException(Throwable cause) { super(cause); } protected LoginExpireException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } public static boolean is(Exception error) { return error instanceof LoginExpireException; } }
1,004
0.671013
0.652959
41
23.317074
24.39856
94
false
false
0
0
0
0
0
0
0.390244
false
false
2
54623f295615ad296334ad9d1a56ce0f708a29e8
27,135,603,434,629
97bb78ce352baad4295fe562e85383aec2a3f0b7
/Sprint4_Rockola/src/java/restfulService/CancionService.java
1b823558412bfd37419a1521dad227424a180072
[]
no_license
TMang0/MinTic-Project
https://github.com/TMang0/MinTic-Project
4153b868a395c9c9467428c2ba00944728680b5e
00e791940add473fe904bf3a668872661b493d18
refs/heads/main
2023-08-01T23:48:50.103000
2021-10-06T13:39:48
2021-10-06T13:39:48
406,635,279
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package restfulService; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.util.ArrayList; import restfulModel.CancionModel; import restfulModel.Conexion; public class CancionService { public ArrayList<CancionModel> getCanciones() { ArrayList<CancionModel> lista = new ArrayList<>(); Conexion conn = new Conexion(); String sql = "SELECT * FROM cancion"; try { Statement stm = conn.getCon().createStatement(); ResultSet rs = stm.executeQuery(sql); while (rs.next()) { CancionModel cancion = new CancionModel(); cancion.setCodigo_can(rs.getInt("codigo_can")); cancion.setNombre_can(rs.getString("nombre_can")); cancion.setNombre_art(rs.getString("nombre_art")); cancion.setNombre_gen(rs.getString("nombre_gen")); lista.add(cancion); } } catch (SQLException e) { } return lista; } public CancionModel getCancion(int id) { CancionModel cancion = new CancionModel(); Conexion conex = new Conexion(); String Sql = "SELECT * FROM cancion WHERE codigo_can = ?"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, id); ResultSet rs = pstm.executeQuery(); while (rs.next()) { cancion.setCodigo_can(rs.getInt("id_cliente")); cancion.setNombre_can(rs.getString("nombre_can")); cancion.setNombre_art(rs.getString("nombre_art")); cancion.setNombre_gen(rs.getString("nombre_gen")); } } catch (SQLException e) { System.out.println(e); } return cancion; } public CancionModel addCancion(CancionModel cancion) { Conexion conex = new Conexion(); String Sql = "INSERT INTO cancion(codigo_can,nombre_can,nombre_art,nombre_gen)"; Sql = Sql + "values (?,?,?,?)"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, cancion.getCodigo_can()); pstm.setString(2, cancion.getNombre_can()); pstm.setString(3, cancion.getNombre_art()); pstm.setString(4, cancion.getNombre_gen()); pstm.executeUpdate(); } catch (SQLException e) { System.out.println(e); return null; } return cancion; } public CancionModel updateCancion(CancionModel cancion) { Conexion conn = new Conexion(); String sql = "UPDATE cancion SET nombre_can=?,nombre_art=?,nombre_gen=? WHERE codigo_can= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setString(1, cancion.getNombre_can()); pstm.setString(2, cancion.getNombre_art()); pstm.setString(3, cancion.getNombre_gen()); pstm.setInt(4, cancion.getCodigo_can()); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return null; } return cancion; } public String delaCancion(int id) { Conexion conn = new Conexion(); String sql = "DELETE FROM cancion WHERE codigo_can= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setInt(1, id); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return "{\"Accion\":\"Error\"}"; } return "{\"Accion\":\"Registro Borrado\"}"; } }
UTF-8
Java
4,029
java
CancionService.java
Java
[]
null
[]
package restfulService; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.util.ArrayList; import restfulModel.CancionModel; import restfulModel.Conexion; public class CancionService { public ArrayList<CancionModel> getCanciones() { ArrayList<CancionModel> lista = new ArrayList<>(); Conexion conn = new Conexion(); String sql = "SELECT * FROM cancion"; try { Statement stm = conn.getCon().createStatement(); ResultSet rs = stm.executeQuery(sql); while (rs.next()) { CancionModel cancion = new CancionModel(); cancion.setCodigo_can(rs.getInt("codigo_can")); cancion.setNombre_can(rs.getString("nombre_can")); cancion.setNombre_art(rs.getString("nombre_art")); cancion.setNombre_gen(rs.getString("nombre_gen")); lista.add(cancion); } } catch (SQLException e) { } return lista; } public CancionModel getCancion(int id) { CancionModel cancion = new CancionModel(); Conexion conex = new Conexion(); String Sql = "SELECT * FROM cancion WHERE codigo_can = ?"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, id); ResultSet rs = pstm.executeQuery(); while (rs.next()) { cancion.setCodigo_can(rs.getInt("id_cliente")); cancion.setNombre_can(rs.getString("nombre_can")); cancion.setNombre_art(rs.getString("nombre_art")); cancion.setNombre_gen(rs.getString("nombre_gen")); } } catch (SQLException e) { System.out.println(e); } return cancion; } public CancionModel addCancion(CancionModel cancion) { Conexion conex = new Conexion(); String Sql = "INSERT INTO cancion(codigo_can,nombre_can,nombre_art,nombre_gen)"; Sql = Sql + "values (?,?,?,?)"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, cancion.getCodigo_can()); pstm.setString(2, cancion.getNombre_can()); pstm.setString(3, cancion.getNombre_art()); pstm.setString(4, cancion.getNombre_gen()); pstm.executeUpdate(); } catch (SQLException e) { System.out.println(e); return null; } return cancion; } public CancionModel updateCancion(CancionModel cancion) { Conexion conn = new Conexion(); String sql = "UPDATE cancion SET nombre_can=?,nombre_art=?,nombre_gen=? WHERE codigo_can= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setString(1, cancion.getNombre_can()); pstm.setString(2, cancion.getNombre_art()); pstm.setString(3, cancion.getNombre_gen()); pstm.setInt(4, cancion.getCodigo_can()); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return null; } return cancion; } public String delaCancion(int id) { Conexion conn = new Conexion(); String sql = "DELETE FROM cancion WHERE codigo_can= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setInt(1, id); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return "{\"Accion\":\"Error\"}"; } return "{\"Accion\":\"Registro Borrado\"}"; } }
4,029
0.55994
0.557458
113
33.637169
25.261837
101
false
false
0
0
0
0
0
0
0.716814
false
false
2
e862537d90bd323a7e7531647b72eb9f5658bc1f
15,350,213,128,549
9457736086c18fa524493d2fa434d8204e94e744
/src/br/com/dio/calculadora/Calculadora.java
902608644ee3ad9318422b38ec5397a3a17227ab
[]
no_license
Jhonatas-P-Santos/TesteCursoDio
https://github.com/Jhonatas-P-Santos/TesteCursoDio
403ae4c0d3ef6b7363f57e78966c13ddeffd7300
232aa0162f254423ab720eeae60f139ad228d50d
refs/heads/master
2023-07-02T06:52:58.565000
2021-08-10T18:25:26
2021-08-10T18:25:26
394,412,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.dio.calculadora; import java.util.Scanner; public class Calculadora { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a,b; System.out.println("Digite um valor:"); a= scan.nextInt(); System.out.println("Digite outro valor:"); b= scan.nextInt(); int soma = soma(a,b); int subs = sub(a,b); int mults = mult(a,b); double divs = div(a,b); System.out.println("Soma= " + soma +"|Subtração= "+subs + "|Multiplicação= "+mults + "|Divisão= "+divs); } public static int soma(int a, int b) { return a+b; } public static int sub(int a, int b) { return a-b; } public static int mult(int a, int b) { return a*b; } public static double div(double a, double b) { return a/b; } }
ISO-8859-1
Java
813
java
Calculadora.java
Java
[]
null
[]
package br.com.dio.calculadora; import java.util.Scanner; public class Calculadora { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a,b; System.out.println("Digite um valor:"); a= scan.nextInt(); System.out.println("Digite outro valor:"); b= scan.nextInt(); int soma = soma(a,b); int subs = sub(a,b); int mults = mult(a,b); double divs = div(a,b); System.out.println("Soma= " + soma +"|Subtração= "+subs + "|Multiplicação= "+mults + "|Divisão= "+divs); } public static int soma(int a, int b) { return a+b; } public static int sub(int a, int b) { return a-b; } public static int mult(int a, int b) { return a*b; } public static double div(double a, double b) { return a/b; } }
813
0.600248
0.600248
47
16.19149
20.390484
108
false
false
0
0
0
0
0
0
1.914894
false
false
2
812a53e435f189dfec713035e3cb3a8730cf00e4
25,606,595,036,944
c11ef05ce124c85ec8c980b8ec790a6a6404201f
/javaee8cookbook/src/main/java/de/rieckpil/learning/user/control/UserWriter.java
f6917ccc49ed7584789b038b0c614723d4172ba4
[ "MIT" ]
permissive
rieckpil/learning-samples
https://github.com/rieckpil/learning-samples
dda809d863b0128a7005d17ce006ebcfe414f782
33d8f115c81433abca8f4984600a41350a1d831d
refs/heads/master
2023-01-10T16:29:45.565000
2022-01-21T23:17:59
2022-01-22T08:14:06
127,932,091
11
7
MIT
false
2022-12-07T21:59:22
2018-04-03T15:50:15
2021-11-12T11:39:31
2022-12-07T21:59:22
20,702
9
7
21
Java
false
false
package de.rieckpil.learning.user.control; import de.rieckpil.learning.user.entity.JpaUser; import javax.batch.api.chunk.AbstractItemWriter; import javax.enterprise.context.Dependent; import javax.inject.Named; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.Transactional; import java.util.List; @Named @Dependent public class UserWriter extends AbstractItemWriter { @PersistenceContext EntityManager entityManager; @Override @Transactional public void writeItems(List list) { for (JpaUser user : (List<JpaUser>) list) { entityManager.persist(user); } } }
UTF-8
Java
676
java
UserWriter.java
Java
[]
null
[]
package de.rieckpil.learning.user.control; import de.rieckpil.learning.user.entity.JpaUser; import javax.batch.api.chunk.AbstractItemWriter; import javax.enterprise.context.Dependent; import javax.inject.Named; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.Transactional; import java.util.List; @Named @Dependent public class UserWriter extends AbstractItemWriter { @PersistenceContext EntityManager entityManager; @Override @Transactional public void writeItems(List list) { for (JpaUser user : (List<JpaUser>) list) { entityManager.persist(user); } } }
676
0.757396
0.757396
27
24.037037
18.647772
52
false
false
0
0
0
0
0
0
0.407407
false
false
2
2e6b179f446eac26e6163164d3f171b618e69464
25,924,422,648,193
6bb4a9e2d0e96662e9422ea0b0c180d1726da275
/src/main/java/org/dew/comm/astm/ASTMResult.java
5384e96e11d8177808ea220ccae5b5a91b67e828
[ "Apache-2.0" ]
permissive
zhiji6/comm
https://github.com/zhiji6/comm
0b8e112606b00488978f0472c72fff9b7b7f2068
25abf4b3c61dd569c164fdc61eec05668cdbb96c
refs/heads/master
2023-08-10T02:49:16.812000
2019-12-25T20:22:10
2019-12-25T20:22:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.dew.comm.astm; import org.dew.comm.IRecord; import java.util.Date; public class ASTMResult implements IRecord { private int sequenceNumber = 1; private UniversalTestId universalTestId; private String dataValue; private String units; private String abnormalFlags; private String status; private Date dateTestCompleted; public ASTMResult() { } public ASTMResult(String sManufacturersCode, String sResultAspects, String sDataValue, String sUnits) { this.universalTestId = new UniversalTestId(sManufacturersCode, sResultAspects); this.dataValue = sDataValue; this.units = sUnits; this.dateTestCompleted = new Date(); } public void setData(String[] asData) { if(asData == null) return; if(asData.length > 1 && asData[0] != null && asData[1] != null) { this.universalTestId = new UniversalTestId(asData[0], asData[1]); } if(asData.length > 2 && asData[2] != null) dataValue = asData[2]; if(asData.length > 3 && asData[3] != null) units = asData[3]; if(asData.length > 4 && asData[4] != null) { dateTestCompleted = Utils.stringToDateTime(asData[4]); if(dateTestCompleted == null) dateTestCompleted = new Date(); } } public String[] getData() { String[] asResult = new String[5]; if(universalTestId != null) { asResult[0] = universalTestId.getManufacturersCode(); asResult[1] = universalTestId.getResultAspects(); } asResult[2] = dataValue; asResult[3] = units; asResult[4] = Utils.formatDateTime(dateTestCompleted); return asResult; } public Type getType() { return Type.RESULT; } public int getSequenceNumber() { return sequenceNumber; } public void setSequenceNumber(int sequenceNumber) { this.sequenceNumber = sequenceNumber; } public UniversalTestId getTest() { return universalTestId; } public void setTest(UniversalTestId test) { this.universalTestId = test; } public String getDataValue() { return dataValue; } public void setDataValue(String dataValue) { this.dataValue = dataValue; } public String getUnits() { return units; } public void setUnits(String units) { this.units = units; } public String getAbnormalFlags() { return abnormalFlags; } public void setAbnormalFlags(String abnormalFlags) { this.abnormalFlags = abnormalFlags; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Date getDateTestCompleted() { return dateTestCompleted; } public void setDateTestCompleted(Date dateTestCompleted) { this.dateTestCompleted = dateTestCompleted; } public String toString() { StringBuffer sbResult = new StringBuffer(); sbResult.append('R'); sbResult.append('|'); sbResult.append(sequenceNumber); sbResult.append('|'); sbResult.append(universalTestId != null ? universalTestId.toString() : ""); sbResult.append('|'); sbResult.append(dataValue != null ? dataValue : ""); sbResult.append('|'); sbResult.append(units != null ? units : ""); sbResult.append("||"); sbResult.append(abnormalFlags != null ? abnormalFlags : ""); sbResult.append("||"); sbResult.append(status != null ? status : ""); sbResult.append("||||"); sbResult.append(Utils.formatDateTime(dateTestCompleted)); sbResult.append((char) 13); // <CR> return sbResult.toString(); } public byte[] getBytes() { return toString().getBytes(); } }
UTF-8
Java
3,589
java
ASTMResult.java
Java
[]
null
[]
package org.dew.comm.astm; import org.dew.comm.IRecord; import java.util.Date; public class ASTMResult implements IRecord { private int sequenceNumber = 1; private UniversalTestId universalTestId; private String dataValue; private String units; private String abnormalFlags; private String status; private Date dateTestCompleted; public ASTMResult() { } public ASTMResult(String sManufacturersCode, String sResultAspects, String sDataValue, String sUnits) { this.universalTestId = new UniversalTestId(sManufacturersCode, sResultAspects); this.dataValue = sDataValue; this.units = sUnits; this.dateTestCompleted = new Date(); } public void setData(String[] asData) { if(asData == null) return; if(asData.length > 1 && asData[0] != null && asData[1] != null) { this.universalTestId = new UniversalTestId(asData[0], asData[1]); } if(asData.length > 2 && asData[2] != null) dataValue = asData[2]; if(asData.length > 3 && asData[3] != null) units = asData[3]; if(asData.length > 4 && asData[4] != null) { dateTestCompleted = Utils.stringToDateTime(asData[4]); if(dateTestCompleted == null) dateTestCompleted = new Date(); } } public String[] getData() { String[] asResult = new String[5]; if(universalTestId != null) { asResult[0] = universalTestId.getManufacturersCode(); asResult[1] = universalTestId.getResultAspects(); } asResult[2] = dataValue; asResult[3] = units; asResult[4] = Utils.formatDateTime(dateTestCompleted); return asResult; } public Type getType() { return Type.RESULT; } public int getSequenceNumber() { return sequenceNumber; } public void setSequenceNumber(int sequenceNumber) { this.sequenceNumber = sequenceNumber; } public UniversalTestId getTest() { return universalTestId; } public void setTest(UniversalTestId test) { this.universalTestId = test; } public String getDataValue() { return dataValue; } public void setDataValue(String dataValue) { this.dataValue = dataValue; } public String getUnits() { return units; } public void setUnits(String units) { this.units = units; } public String getAbnormalFlags() { return abnormalFlags; } public void setAbnormalFlags(String abnormalFlags) { this.abnormalFlags = abnormalFlags; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Date getDateTestCompleted() { return dateTestCompleted; } public void setDateTestCompleted(Date dateTestCompleted) { this.dateTestCompleted = dateTestCompleted; } public String toString() { StringBuffer sbResult = new StringBuffer(); sbResult.append('R'); sbResult.append('|'); sbResult.append(sequenceNumber); sbResult.append('|'); sbResult.append(universalTestId != null ? universalTestId.toString() : ""); sbResult.append('|'); sbResult.append(dataValue != null ? dataValue : ""); sbResult.append('|'); sbResult.append(units != null ? units : ""); sbResult.append("||"); sbResult.append(abnormalFlags != null ? abnormalFlags : ""); sbResult.append("||"); sbResult.append(status != null ? status : ""); sbResult.append("||||"); sbResult.append(Utils.formatDateTime(dateTestCompleted)); sbResult.append((char) 13); // <CR> return sbResult.toString(); } public byte[] getBytes() { return toString().getBytes(); } }
3,589
0.665645
0.659237
149
23.087248
21.870863
103
false
false
0
0
0
0
0
0
0.52349
false
false
2
3e7393717020c06c4a3eba18e6163d8b8c7a6d2b
26,989,574,491,655
5d2133c875f41a0c0eab9cb1cffaf2fc4faaeb20
/schoolshop-getway/src/main/java/cn/tedu/schoolshop/getway/security/UserDetailsServiceImpl.java
5b22f321350e38bc7c0eaba54be271bbec05e0e3
[]
no_license
zdqssg/schoolshop
https://github.com/zdqssg/schoolshop
54a8bcc819d09991f7c53fb78f0f64e0ce99534d
17499bb36607cb34a11fc7258da3d41f1597be9e
refs/heads/master
2022-12-19T17:51:08.888000
2020-10-06T17:42:00
2020-10-06T17:42:00
301,301,657
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.tedu.schoolshop.getway.security; import cn.tedu.schoolshop.getway.service.UserService; import cn.tedu.schoolshop.model.User; import cn.tedu.schoolshop.security.LoginUserInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; /** * @author Mr.Zhou * @version 1.0 * @email zdq247209@163.com * @date 2020/9/11 17:13 */ @Component public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private UserService userService; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { System.out.println(username); User user = userService.findByNickName(username); System.out.println(user); if (user == null) { return null; } List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority("/api-user/**")); LoginUserInfo userInfo = new LoginUserInfo( user.getNickname(), user.getPassword(), user.getIsEnabled() == 1, true, true, user.getIsLocked() == 0, authorities ); userInfo.setId(user.getId()); userInfo.setNickname(user.getNickname()); return userInfo; } }
UTF-8
Java
1,783
java
UserDetailsServiceImpl.java
Java
[ { "context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author Mr.Zhou\n * @version 1.0\n * @email zdq247209@163.com\n * @d", "end": 727, "score": 0.9996107220649719, "start": 720, "tag": "NAME", "value": "Mr.Zhou" }, { "context": "\n\n/**\n * @author Mr.Zhou\n * @version 1.0\n...
null
[]
package cn.tedu.schoolshop.getway.security; import cn.tedu.schoolshop.getway.service.UserService; import cn.tedu.schoolshop.model.User; import cn.tedu.schoolshop.security.LoginUserInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; /** * @author Mr.Zhou * @version 1.0 * @email <EMAIL> * @date 2020/9/11 17:13 */ @Component public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private UserService userService; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { System.out.println(username); User user = userService.findByNickName(username); System.out.println(user); if (user == null) { return null; } List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority("/api-user/**")); LoginUserInfo userInfo = new LoginUserInfo( user.getNickname(), user.getPassword(), user.getIsEnabled() == 1, true, true, user.getIsLocked() == 0, authorities ); userInfo.setId(user.getId()); userInfo.setNickname(user.getNickname()); return userInfo; } }
1,773
0.698261
0.684801
56
30.839285
24.600941
93
false
false
0
0
0
0
0
0
0.535714
false
false
2
7ff4ea374122af76359676837f2825f5a78aacd2
27,144,193,360,825
d6364df93cf597e41272d7bbd2fc5c65aac92cdb
/SimpleSlack-Client/src/model/GroupClient.java
f95c56508804d5e1846b46c6b3ebc537762cc8ce
[]
no_license
joseabernardes/simple_slack
https://github.com/joseabernardes/simple_slack
93eddd6566b09f07349d48434476cbfae3561d07
a77c734cef2a5ba01e748769bce41a61e0f54383
refs/heads/master
2021-08-31T18:34:00.384000
2017-12-22T11:15:30
2017-12-22T11:15:30
111,467,811
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 model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import org.json.simple.JSONObject; public class GroupClient implements Serializable { private static int ID = 0; private int id; private int port; private String name; private String address; private ObservableList<MessageClient> messages; public GroupClient(int port, String name, String address) { this.id = ++ID; this.port = port; this.name = name; this.address = address; this.messages = FXCollections.observableArrayList(new ArrayList<MessageClient>()); } public void setId(int id) { this.id = id; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getPort() { return port; } public boolean addMessage(MessageClient message) { return messages.add(message); } public ObservableList<MessageClient> getMessages() { return this.messages; } public void setPort(int port) { this.port = port; } public String getName() { return name; } public void setName(String name) { this.name = name; } public static void setID(int id) { GroupClient.ID = id; } public int getId() { return id; } @Override public int hashCode() { int hash = 3; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GroupClient other = (GroupClient) obj; if (this.id != other.id) { return false; } return true; } @Override public String toString() { JSONObject obj = new JSONObject(); obj.put("address", address); obj.put("port", port); obj.put("id", id); obj.put("name", name); return obj.toJSONString(); } public static GroupClient newGroup(JSONObject obj) { GroupClient group = new GroupClient(Integer.valueOf(obj.get("port").toString()), obj.get("name").toString(), obj.get("address").toString()); group.setId(Integer.valueOf(obj.get("id").toString())); return group; } }
UTF-8
Java
2,793
java
GroupClient.java
Java
[ { "context": " obj.put(\"id\", id);\n obj.put(\"name\", name);\n return obj.toJSONString();\n }\n\n p", "end": 2444, "score": 0.9352375268936157, "start": 2440, "tag": "NAME", "value": "name" } ]
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 model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import org.json.simple.JSONObject; public class GroupClient implements Serializable { private static int ID = 0; private int id; private int port; private String name; private String address; private ObservableList<MessageClient> messages; public GroupClient(int port, String name, String address) { this.id = ++ID; this.port = port; this.name = name; this.address = address; this.messages = FXCollections.observableArrayList(new ArrayList<MessageClient>()); } public void setId(int id) { this.id = id; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getPort() { return port; } public boolean addMessage(MessageClient message) { return messages.add(message); } public ObservableList<MessageClient> getMessages() { return this.messages; } public void setPort(int port) { this.port = port; } public String getName() { return name; } public void setName(String name) { this.name = name; } public static void setID(int id) { GroupClient.ID = id; } public int getId() { return id; } @Override public int hashCode() { int hash = 3; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GroupClient other = (GroupClient) obj; if (this.id != other.id) { return false; } return true; } @Override public String toString() { JSONObject obj = new JSONObject(); obj.put("address", address); obj.put("port", port); obj.put("id", id); obj.put("name", name); return obj.toJSONString(); } public static GroupClient newGroup(JSONObject obj) { GroupClient group = new GroupClient(Integer.valueOf(obj.get("port").toString()), obj.get("name").toString(), obj.get("address").toString()); group.setId(Integer.valueOf(obj.get("id").toString())); return group; } }
2,793
0.594701
0.593985
125
21.344
21.773785
148
false
false
0
0
0
0
0
0
0.464
false
false
2
f90e92bc530bd71c99b2298ecf6732548a5456e3
10,977,936,409,041
71a408827506bb661ce31ae6cee2c39cf6fac48d
/bresume/bresume-core/src/main/java/com/bresume/core/model/entity/user/UserVerified.java
326a5b3ce567930046eaa41ef5f86f0df4ec675a
[]
no_license
China2K/bresume
https://github.com/China2K/bresume
5c4dc6eb4b98bd0334b3e134743bc2765843436b
b6e7f2988cb011b69730c4dcefb56edc5df4e6eb
refs/heads/master
2021-01-10T19:41:31.217000
2015-06-15T15:04:34
2015-06-15T15:04:34
26,487,275
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bresume.core.model.entity.user; import java.util.Date; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.bresume.core.model.base.BaseEntity; @Entity @Table(name = "br_user_verified") public class UserVerified extends BaseEntity { /** * */ private static final long serialVersionUID = -3858321447968030594L; private User user; private String code; private Date createdTime; private Date verifiedTime; public UserVerified() { super(); } public UserVerified(User user) { this.user = user; this.code = UUID.randomUUID().toString().replace("-", ""); this.createdTime = new Date(); } /** * @return the user */ @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="USER_ID") public User getUser() { return user; } /** * @param user * the user to set */ public void setUser(User user) { this.user = user; } /** * @return the code */ @Column(name="`CODE`") public String getCode() { return code; } /** * @param code * the code to set */ public void setCode(String code) { this.code = code; } /** * @return the createdTime */ @Column(name="CREATED_TIME") public Date getCreatedTime() { return createdTime; } /** * @param createdTime * the createdTime to set */ public void setCreatedTime(Date createdTime) { this.createdTime = createdTime; } /** * @return the verifiedTime */ @Column(name="VERIFIED_TIME") public Date getVerifiedTime() { return verifiedTime; } /** * @param verifiedTime * the verifiedTime to set */ public void setVerifiedTime(Date verifiedTime) { this.verifiedTime = verifiedTime; } }
UTF-8
Java
1,970
java
UserVerified.java
Java
[]
null
[]
package com.bresume.core.model.entity.user; import java.util.Date; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.bresume.core.model.base.BaseEntity; @Entity @Table(name = "br_user_verified") public class UserVerified extends BaseEntity { /** * */ private static final long serialVersionUID = -3858321447968030594L; private User user; private String code; private Date createdTime; private Date verifiedTime; public UserVerified() { super(); } public UserVerified(User user) { this.user = user; this.code = UUID.randomUUID().toString().replace("-", ""); this.createdTime = new Date(); } /** * @return the user */ @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="USER_ID") public User getUser() { return user; } /** * @param user * the user to set */ public void setUser(User user) { this.user = user; } /** * @return the code */ @Column(name="`CODE`") public String getCode() { return code; } /** * @param code * the code to set */ public void setCode(String code) { this.code = code; } /** * @return the createdTime */ @Column(name="CREATED_TIME") public Date getCreatedTime() { return createdTime; } /** * @param createdTime * the createdTime to set */ public void setCreatedTime(Date createdTime) { this.createdTime = createdTime; } /** * @return the verifiedTime */ @Column(name="VERIFIED_TIME") public Date getVerifiedTime() { return verifiedTime; } /** * @param verifiedTime * the verifiedTime to set */ public void setVerifiedTime(Date verifiedTime) { this.verifiedTime = verifiedTime; } }
1,970
0.632995
0.62335
105
16.761906
15.861017
68
false
false
0
0
0
0
0
0
1.095238
false
false
2
015c8709a4fd6e7e431ed03a2bb1c82b51735a3c
4,200,478,046,703
9cc51e39508b21f32cbeeef659043eebaa659168
/src/main/java/jp/ac/chitose/service/Class/AccountService.java
11a74286993185e006fdc8b577154efd655dc3eb
[]
no_license
TONBOYA/test-ICT
https://github.com/TONBOYA/test-ICT
afe1e4e5ce3b3e2a75c587e90118981090d9edde
5595ed4dc471e5da48354c24751d6bff7f689cde
refs/heads/master
2021-01-22T06:59:13.487000
2017-02-13T07:37:59
2017-02-13T07:37:59
81,796,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.ac.chitose.service.Class; import java.util.List; import com.google.inject.Inject; import jp.ac.chitose.bean.AccountBean; import jp.ac.chitose.bean.PersonalBean; import jp.ac.chitose.dao.Interface.IAccountDAO; import jp.ac.chitose.dao.Interface.IPersonalDAO; import jp.ac.chitose.service.Interface.IAccountService; public class AccountService implements IAccountService { @Inject private IAccountDAO accountDAO; @Inject private IPersonalDAO personalDAO; @Override public PersonalBean getPersonalBean(int accountId) { return accountDAO.selectPersonal(accountId); } @Override public List<PersonalBean> getPersonalAllListBean() { return accountDAO.selectPersonlAllList(); } @Override public int updatePersonalData(int accountId, String name,String belongSchool, String emailAddress) { return personalDAO.updatePersonal(accountId, name, belongSchool, emailAddress); } //追加 @Override public int registerAccountData(String loginName,String passphrase, String role , String name,String belongSchool,String emailAddress) { return accountDAO.registerPersonalData((accountDAO.registerAccountAndSelectId(loginName, passphrase, role)), name, belongSchool, emailAddress); } public String selectLoginName(String loginName){ return accountDAO.selectLoginNameData(loginName); } @Override public int updatePassphrase(int accountId, String passphrase) { return accountDAO.updatePassphrase(accountId, passphrase); } @Override public AccountBean getAccountBean(int accountId){ return accountDAO.selectAccount(accountId); } public boolean deleteAccountData(int accountId){ if(personalDAO.deletePersonal(accountId)){ return accountDAO.deleteAccount(accountId); }else{ return false; } } }
UTF-8
Java
1,748
java
AccountService.java
Java
[]
null
[]
package jp.ac.chitose.service.Class; import java.util.List; import com.google.inject.Inject; import jp.ac.chitose.bean.AccountBean; import jp.ac.chitose.bean.PersonalBean; import jp.ac.chitose.dao.Interface.IAccountDAO; import jp.ac.chitose.dao.Interface.IPersonalDAO; import jp.ac.chitose.service.Interface.IAccountService; public class AccountService implements IAccountService { @Inject private IAccountDAO accountDAO; @Inject private IPersonalDAO personalDAO; @Override public PersonalBean getPersonalBean(int accountId) { return accountDAO.selectPersonal(accountId); } @Override public List<PersonalBean> getPersonalAllListBean() { return accountDAO.selectPersonlAllList(); } @Override public int updatePersonalData(int accountId, String name,String belongSchool, String emailAddress) { return personalDAO.updatePersonal(accountId, name, belongSchool, emailAddress); } //追加 @Override public int registerAccountData(String loginName,String passphrase, String role , String name,String belongSchool,String emailAddress) { return accountDAO.registerPersonalData((accountDAO.registerAccountAndSelectId(loginName, passphrase, role)), name, belongSchool, emailAddress); } public String selectLoginName(String loginName){ return accountDAO.selectLoginNameData(loginName); } @Override public int updatePassphrase(int accountId, String passphrase) { return accountDAO.updatePassphrase(accountId, passphrase); } @Override public AccountBean getAccountBean(int accountId){ return accountDAO.selectAccount(accountId); } public boolean deleteAccountData(int accountId){ if(personalDAO.deletePersonal(accountId)){ return accountDAO.deleteAccount(accountId); }else{ return false; } } }
1,748
0.800459
0.800459
64
26.25
31.912968
145
false
false
0
0
0
0
0
0
1.40625
false
false
2
9942f05ff5da06154fc6cf361d3e716bef38085c
12,292,196,442,406
041b20dcb6276f5275228fb47f2e9d13370643ed
/src/main/java/org/sasdutta/NameSpaceCodec.java
98fe00dd7f6318601931918817ea4ea0ad7d4760
[]
no_license
saswata-dutta/supercsv-poc
https://github.com/saswata-dutta/supercsv-poc
1cfbb0b2fef2c74472f8a5d7fae34ebd02a7e9d0
850a0a976e9b52e2b2f0ab908cdcad7de1474c81
refs/heads/master
2022-12-23T12:26:07.091000
2020-09-22T12:39:18
2020-09-22T12:39:18
297,041,903
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.sasdutta; import java.util.regex.Pattern; public interface NameSpaceCodec { String encodeVertexLabel(String clientApp, String businessLine, String label); String encodeVertexId(String clientApp, String businessLine, String label, String id); String decodeVertexId(String id); String encodeEdgeLabel(String clientApp, String businessLine, String label); String encodeEdgeId(String clientApp, String businessLine, String label, String fromLabel, String fromId, String toLabel, String toId); }
UTF-8
Java
564
java
NameSpaceCodec.java
Java
[]
null
[]
package org.sasdutta; import java.util.regex.Pattern; public interface NameSpaceCodec { String encodeVertexLabel(String clientApp, String businessLine, String label); String encodeVertexId(String clientApp, String businessLine, String label, String id); String decodeVertexId(String id); String encodeEdgeLabel(String clientApp, String businessLine, String label); String encodeEdgeId(String clientApp, String businessLine, String label, String fromLabel, String fromId, String toLabel, String toId); }
564
0.739362
0.739362
17
32.117645
31.994268
88
false
false
0
0
0
0
0
0
1.176471
false
false
2
aa68f2a21fb62ad93d3bacb992b8c5723954ad6a
6,519,760,407,092
612951ae5b9da642d78bcf8bba4c114b810e8d49
/#6.java
af9d3710fc3c3a1629ebd82e0a4bd45231a1149c
[]
no_license
surabhiraj98/ProjectEuler
https://github.com/surabhiraj98/ProjectEuler
05f6e04ac537a1fc6fbdd34f9d440fabc57a1d11
fd3a058d0784c5ef4b195850d63f5e3a9e8cccad
refs/heads/master
2020-08-02T12:43:54.437000
2019-10-26T16:21:46
2019-10-26T16:21:46
211,357,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int numberOfTestCases = in.nextInt(); for(int i=0;i<numberOfTestCases;i++) { long n = in.nextLong(); long sumOfSquares = (n*(n+1)*((2*n)+1))/6; long squareOfSum = (long)Math.pow((n*(n+1))/2,2); System.out.println(squareOfSum-sumOfSquares); } } }
UTF-8
Java
559
java
#6.java
Java
[]
null
[]
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int numberOfTestCases = in.nextInt(); for(int i=0;i<numberOfTestCases;i++) { long n = in.nextLong(); long sumOfSquares = (n*(n+1)*((2*n)+1))/6; long squareOfSum = (long)Math.pow((n*(n+1))/2,2); System.out.println(squareOfSum-sumOfSquares); } } }
559
0.559928
0.545617
21
25.571428
19.182262
61
false
false
0
0
0
0
0
0
0.666667
false
false
2
2ff1eb804770ca0976ab0c246dea9d045042bc0c
6,519,760,404,701
b1bec5dde4dace20f979d9ff904a06b27ba3059b
/src/main/java/com/mr/dao/commonsense/CommonSenseMapper.java
177467b52a38c5541d7127296a743c2031378026
[]
no_license
zhanxupeng/easytour
https://github.com/zhanxupeng/easytour
6326306e6e2950ff16ade18c8dcf4476023e3fa5
b39a4bb6761bf6dacb66b8ba81139b602dc96b40
refs/heads/master
2020-05-15T15:11:24.312000
2019-04-20T12:56:17
2019-04-20T12:56:17
182,364,736
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mr.dao.commonsense; import com.mr.dao.base.BaseMapper; import com.mr.entity.commonsense.CommonSense; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface CommonSenseMapper extends BaseMapper<CommonSense> { List<CommonSense> query(); }
UTF-8
Java
293
java
CommonSenseMapper.java
Java
[]
null
[]
package com.mr.dao.commonsense; import com.mr.dao.base.BaseMapper; import com.mr.entity.commonsense.CommonSense; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface CommonSenseMapper extends BaseMapper<CommonSense> { List<CommonSense> query(); }
293
0.802048
0.802048
12
23.5
21.426229
68
false
false
0
0
0
0
0
0
0.5
false
false
2
db1fef65b7740455d4d3236cdc6820ec43c8106f
22,591,527,987,888
d27afa862047beeaa23aebb733736232f52c50f2
/src/dtp/jade/info/behaviour/GetAgentsDataBehaviour.java
cdbbc84d71bfab56a6556fb885165b91de9eb8b7
[]
no_license
franc90/DispatchRider
https://github.com/franc90/DispatchRider
8d27e859466a3a2b0494a5e53e1d2a2a1d4233d7
cded70bfe9b65246318812f0793110e853266d52
refs/heads/master
2016-09-05T19:53:13.970000
2014-06-21T14:06:48
2014-06-21T14:06:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dtp.jade.info.behaviour; import jade.core.behaviours.CyclicBehaviour; import jade.lang.acl.ACLMessage; import jade.lang.acl.MessageTemplate; import dtp.jade.CommunicationHelper; import dtp.jade.info.InfoAgent; public class GetAgentsDataBehaviour extends CyclicBehaviour { /** * */ private static final long serialVersionUID = -8479077145084706990L; private InfoAgent agent; public GetAgentsDataBehaviour(InfoAgent agent) { this.agent = agent; } @Override public void action() { MessageTemplate template = MessageTemplate.MatchPerformative(CommunicationHelper.AGENTS_DATA); ACLMessage message = agent.receive(template); if (message != null) { agent.sendDataToAgents(); } else { block(); } } }
UTF-8
Java
818
java
GetAgentsDataBehaviour.java
Java
[]
null
[]
package dtp.jade.info.behaviour; import jade.core.behaviours.CyclicBehaviour; import jade.lang.acl.ACLMessage; import jade.lang.acl.MessageTemplate; import dtp.jade.CommunicationHelper; import dtp.jade.info.InfoAgent; public class GetAgentsDataBehaviour extends CyclicBehaviour { /** * */ private static final long serialVersionUID = -8479077145084706990L; private InfoAgent agent; public GetAgentsDataBehaviour(InfoAgent agent) { this.agent = agent; } @Override public void action() { MessageTemplate template = MessageTemplate.MatchPerformative(CommunicationHelper.AGENTS_DATA); ACLMessage message = agent.receive(template); if (message != null) { agent.sendDataToAgents(); } else { block(); } } }
818
0.685819
0.662592
34
23.058823
23.954542
102
false
false
0
0
0
0
0
0
0.470588
false
false
2
af9d3e4699ebf0b1875ad6a88d849d9ffe5dcf9e
16,131,897,188,333
69263721529342afe86216aaea462e5cf5fc85f3
/RMIClient/src/main/java/com/anand/rmiclient/RmiClient.java
260a55a60ad1e3e801ec41036e30390ce5d6aa20
[]
no_license
anandrockdeveloper/Java_RMI
https://github.com/anandrockdeveloper/Java_RMI
fae077bcf36910fd2fdc5e0e176770121eaa087d
ff4017e51745056efd33b936decfefde645d75a9
refs/heads/master
2020-04-16T07:09:59.777000
2019-01-20T20:38:23
2019-01-20T20:38:23
165,375,874
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.anand.rmiclient; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import com.anand.rmiconfiguration.Configuration; import com.anand.rmiinterface.Book; import com.anand.rmiinterface.NotValidAuthor; public class RmiClient { public static void main(String[] args) { Registry reg; try { reg= LocateRegistry.getRegistry(Configuration.REMOTE_HOST, Configuration.REMOTE_PORT); Book book = (Book) reg.lookup(Configuration.REMOTE_ID); String author= "JKRolling"; System.out.println(author +" has written book "+book.getBookByAuthor(author)); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NotBoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
860
java
RmiClient.java
Java
[ { "context": "okup(Configuration.REMOTE_ID);\n\t\t\tString author= \"JKRolling\";\n\t\t\tSystem.out.println(author +\" has written boo", "end": 576, "score": 0.8595852255821228, "start": 567, "tag": "USERNAME", "value": "JKRolling" } ]
null
[]
package com.anand.rmiclient; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import com.anand.rmiconfiguration.Configuration; import com.anand.rmiinterface.Book; import com.anand.rmiinterface.NotValidAuthor; public class RmiClient { public static void main(String[] args) { Registry reg; try { reg= LocateRegistry.getRegistry(Configuration.REMOTE_HOST, Configuration.REMOTE_PORT); Book book = (Book) reg.lookup(Configuration.REMOTE_ID); String author= "JKRolling"; System.out.println(author +" has written book "+book.getBookByAuthor(author)); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NotBoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
860
0.756977
0.756977
29
28.655172
22.436541
89
false
false
0
0
0
0
0
0
1.793103
false
false
2
f105c53a8d92af6d634b74d0d9f946b6c451cb8f
8,521,215,162,031
6c04e7793b8d415efa756a7c6b576cd7c4876103
/LeetCode/src/string/easy/RomantoInteger13.java
5226850d725dd7c1deff43962fda2ca3ec539536
[]
no_license
xuwuji/LeetCode
https://github.com/xuwuji/LeetCode
290644248834d61a07ff0c7fd449e06b695cda4a
c502a8da86f97e253fe70aa27c2029f3cedf9cf3
refs/heads/master
2021-01-10T01:22:02.918000
2019-09-26T09:02:22
2019-09-26T09:02:22
47,496,174
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package string.easy; import java.util.HashMap; /** * Given a roman numeral, convert it to an integer. * * Input is guaranteed to be within the range from 1 to 3999. * * 【罗马数字】 * * 1~9: {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; * * 10~90: {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; * * 100~900: {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; * * 1000~3000: {"M", "MM", "MMM"}. * * @author wuxu * @time 2016年1月6日 */ public class RomantoInteger13 { public int romanToInt(String s) { HashMap<Character, Integer> map = new HashMap<Character, Integer>(); map.put('I', 1); map.put('V', 5); map.put('X', 10); map.put('L', 50); map.put('C', 100); map.put('D', 500); map.put('M', 1000); int count = 0; int i = 0; for (; i < s.length() - 1;) { if (map.get(s.charAt(i)) >= map.get(s.charAt(i + 1))) { count += map.get(s.charAt(i)); i++; } else { count += map.get(s.charAt(i + 1)) - map.get(s.charAt(i)); i = i + 2; } } if (i == s.length() - 1) { count += map.get(s.charAt(i)); } return count; } }
GB18030
Java
1,132
java
RomantoInteger13.java
Java
[ { "context": " \n * 1000~3000: {\"M\", \"MM\", \"MMM\"}.\n * \n * @author wuxu\n * @time 2016年1月6日\n */\npublic class RomantoIntege", "end": 458, "score": 0.959827184677124, "start": 454, "tag": "USERNAME", "value": "wuxu" } ]
null
[]
package string.easy; import java.util.HashMap; /** * Given a roman numeral, convert it to an integer. * * Input is guaranteed to be within the range from 1 to 3999. * * 【罗马数字】 * * 1~9: {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; * * 10~90: {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; * * 100~900: {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; * * 1000~3000: {"M", "MM", "MMM"}. * * @author wuxu * @time 2016年1月6日 */ public class RomantoInteger13 { public int romanToInt(String s) { HashMap<Character, Integer> map = new HashMap<Character, Integer>(); map.put('I', 1); map.put('V', 5); map.put('X', 10); map.put('L', 50); map.put('C', 100); map.put('D', 500); map.put('M', 1000); int count = 0; int i = 0; for (; i < s.length() - 1;) { if (map.get(s.charAt(i)) >= map.get(s.charAt(i + 1))) { count += map.get(s.charAt(i)); i++; } else { count += map.get(s.charAt(i + 1)) - map.get(s.charAt(i)); i = i + 2; } } if (i == s.length() - 1) { count += map.get(s.charAt(i)); } return count; } }
1,132
0.506284
0.456014
50
21.280001
20.846142
70
false
false
0
0
0
0
0
0
2.38
false
false
2
6e1d0fa41ae98693adf9a7bc18e1635917f56a35
5,239,860,150,592
e76716693b601855ed1f208a233b601caf27b888
/src/test/java/es/redmic/test/unit/geodata/common/model/ModelMapperTest.java
c1f57731ea6ed6b257b75705fd545112eaf0fe95
[ "Apache-2.0" ]
permissive
redmic-project/server-library-models
https://github.com/redmic-project/server-library-models
5c58db6f0a059e61efe9854474a33962428cb517
bc27ab85b0f1d1fc2be3bf9e2952e185fcddf5b3
refs/heads/master
2022-12-11T04:13:00.779000
2022-11-29T09:51:28
2022-11-29T09:51:28
223,939,689
0
0
Apache-2.0
false
2021-06-22T13:57:57
2019-11-25T12:07:39
2020-09-18T08:09:14
2021-06-22T13:57:56
545
0
0
0
Java
false
false
package es.redmic.test.unit.geodata.common.model; /*- * #%L * Models * %% * Copyright (C) 2019 REDMIC Project / Server * %% * 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. * #L% */ import java.io.IOException; import java.nio.file.Files; import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.core.io.ClassPathResource; import com.bedatadriven.jackson.datatype.jts.JtsModule; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import es.redmic.models.es.geojson.common.model.GeoPointData; public class ModelMapperTest { private String dataFile = "/geodata/model/allData.json"; ObjectMapper mapper = new ObjectMapper(); @BeforeClass public static void setUp() { } @Before public void reset() { } @Test public void deserializeAndSerializeModel() throws JsonParseException, JsonMappingException, IOException, JSONException { mapper.registerModule(new JtsModule()); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); GeoPointData model = mapper.readValue(getClass().getResource(dataFile).openStream(), GeoPointData.class); String source = new String(Files.readAllBytes(new ClassPathResource(dataFile).getFile().toPath())); String expected = mapper.writeValueAsString(model); JSONAssert.assertEquals(expected, source, false); } }
UTF-8
Java
2,110
java
ModelMapperTest.java
Java
[]
null
[]
package es.redmic.test.unit.geodata.common.model; /*- * #%L * Models * %% * Copyright (C) 2019 REDMIC Project / Server * %% * 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. * #L% */ import java.io.IOException; import java.nio.file.Files; import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.core.io.ClassPathResource; import com.bedatadriven.jackson.datatype.jts.JtsModule; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import es.redmic.models.es.geojson.common.model.GeoPointData; public class ModelMapperTest { private String dataFile = "/geodata/model/allData.json"; ObjectMapper mapper = new ObjectMapper(); @BeforeClass public static void setUp() { } @Before public void reset() { } @Test public void deserializeAndSerializeModel() throws JsonParseException, JsonMappingException, IOException, JSONException { mapper.registerModule(new JtsModule()); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); GeoPointData model = mapper.readValue(getClass().getResource(dataFile).openStream(), GeoPointData.class); String source = new String(Files.readAllBytes(new ClassPathResource(dataFile).getFile().toPath())); String expected = mapper.writeValueAsString(model); JSONAssert.assertEquals(expected, source, false); } }
2,110
0.772986
0.769194
70
29.142857
28.869305
107
false
false
0
0
0
0
0
0
0.871429
false
false
2
fc379424f96e6e537da5550e2058fd39988d9c41
5,970,004,593,877
e033a9a2fea20263bacb885eae2b0588e73908ef
/H5/src/be/pxl/h5/oef4/H5Oef4.java
df49b5d9f74a0e9ad4524cc90eb9e879e2327397
[]
no_license
11700345/ProgBas
https://github.com/11700345/ProgBas
a21c6a756ffedaebbd53dfa6ff998234aff4c5d8
ef503c51af0854de5e726716d431b002ca1cc758
refs/heads/master
2021-07-20T23:55:54.927000
2017-10-27T09:41:56
2017-10-27T09:41:56
107,130,614
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.pxl.h5.oef4; import java.util.Scanner; public class H5Oef4 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int seconden = 0; int minuten = 0; int uren = 0; System.out.println("Hoeveel seconden?"); int inputInSeconden = keyboard.nextInt(); uren = inputInSeconden / 3600; minuten = (inputInSeconden % 3600) / 60; seconden = (inputInSeconden % 3600) % 60; System.out.println("Uren:\t\t" + uren); System.out.println("Minuten:\t" + minuten); System.out.println("Seconden:\t" + seconden); keyboard.close(); } }
UTF-8
Java
589
java
H5Oef4.java
Java
[]
null
[]
package be.pxl.h5.oef4; import java.util.Scanner; public class H5Oef4 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int seconden = 0; int minuten = 0; int uren = 0; System.out.println("Hoeveel seconden?"); int inputInSeconden = keyboard.nextInt(); uren = inputInSeconden / 3600; minuten = (inputInSeconden % 3600) / 60; seconden = (inputInSeconden % 3600) % 60; System.out.println("Uren:\t\t" + uren); System.out.println("Minuten:\t" + minuten); System.out.println("Seconden:\t" + seconden); keyboard.close(); } }
589
0.674024
0.634975
27
20.851852
18.169374
47
false
false
0
0
0
0
0
0
1.592593
false
false
2
30859394bf86baa9008cc4321d4ece601dc581d6
7,404,523,669,918
ec9e48704be0ea4d005d2645ca367ff62c38d068
/src/main/java/org/motion/model/productType/Product.java
0d107ab7ba59ca28e21aa23025216edba711a8a8
[]
no_license
anandhs/motion-exercise
https://github.com/anandhs/motion-exercise
6c880da9b5e090eccfdf3972509ec27a382f45f9
45897d086d99fa4ea142120e0ba55d07386c0a76
refs/heads/master
2020-04-16T18:06:25.247000
2019-01-15T07:26:07
2019-01-15T07:26:07
165,803,902
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.motion.model.productType; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.NotNull; import java.io.Serializable; @Document(collection = "product") //@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "productType") @JsonSubTypes({ @JsonSubTypes.Type(value = Coffee.class, name = "coffee"), @JsonSubTypes.Type(value = Fish.class, name = "fish") }) public class Product implements Serializable { /** * Primary Key */ @Id String id; /** * UserId of the user that added this Product */ @NotNull String userId; /** * Product Type. Note that this is bounded by the defined types at the top of this class. */ String productType; /** * Product type description */ @NotNull String typeDescription; /** * Unit Mass */ @NotNull Double unitMass; /** * Created Time in Millis. Represents epoch time. */ @NotNull Long createTimeMillis; /** * Product expirty time in Millis. Represents epoch time. */ @NotNull Long expiryDateMillis; public Product() { } public Product(String id, @NotNull String userId, String productType, @NotNull String typeDescription, @NotNull Double unitMass, @NotNull Long createTimeMillis, @NotNull Long expiryDateMillis) { this.id = id; this.userId = userId; this.productType = productType; this.typeDescription = typeDescription; this.unitMass = unitMass; this.createTimeMillis = createTimeMillis; this.expiryDateMillis = expiryDateMillis; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getProductType() { return productType; } public void setProductType(String productType) { this.productType = productType; } public String getTypeDescription() { return typeDescription; } public void setTypeDescription(String typeDescription) { this.typeDescription = typeDescription; } public Double getUnitMass() { return unitMass; } public void setUnitMass(Double unitMass) { this.unitMass = unitMass; } public Long getCreateTimeMillis() { return createTimeMillis; } public void setCreateTimeMillis(Long createTimeMillis) { this.createTimeMillis = createTimeMillis; } public Long getExpiryDateMillis() { return expiryDateMillis; } public void setExpiryDateMillis(Long expiryDateMillis) { this.expiryDateMillis = expiryDateMillis; } }
UTF-8
Java
3,169
java
Product.java
Java
[]
null
[]
package org.motion.model.productType; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.NotNull; import java.io.Serializable; @Document(collection = "product") //@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "productType") @JsonSubTypes({ @JsonSubTypes.Type(value = Coffee.class, name = "coffee"), @JsonSubTypes.Type(value = Fish.class, name = "fish") }) public class Product implements Serializable { /** * Primary Key */ @Id String id; /** * UserId of the user that added this Product */ @NotNull String userId; /** * Product Type. Note that this is bounded by the defined types at the top of this class. */ String productType; /** * Product type description */ @NotNull String typeDescription; /** * Unit Mass */ @NotNull Double unitMass; /** * Created Time in Millis. Represents epoch time. */ @NotNull Long createTimeMillis; /** * Product expirty time in Millis. Represents epoch time. */ @NotNull Long expiryDateMillis; public Product() { } public Product(String id, @NotNull String userId, String productType, @NotNull String typeDescription, @NotNull Double unitMass, @NotNull Long createTimeMillis, @NotNull Long expiryDateMillis) { this.id = id; this.userId = userId; this.productType = productType; this.typeDescription = typeDescription; this.unitMass = unitMass; this.createTimeMillis = createTimeMillis; this.expiryDateMillis = expiryDateMillis; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getProductType() { return productType; } public void setProductType(String productType) { this.productType = productType; } public String getTypeDescription() { return typeDescription; } public void setTypeDescription(String typeDescription) { this.typeDescription = typeDescription; } public Double getUnitMass() { return unitMass; } public void setUnitMass(Double unitMass) { this.unitMass = unitMass; } public Long getCreateTimeMillis() { return createTimeMillis; } public void setCreateTimeMillis(Long createTimeMillis) { this.createTimeMillis = createTimeMillis; } public Long getExpiryDateMillis() { return expiryDateMillis; } public void setExpiryDateMillis(Long expiryDateMillis) { this.expiryDateMillis = expiryDateMillis; } }
3,169
0.651625
0.651625
131
23.198473
26.247042
199
false
false
0
0
0
0
0
0
0.366412
false
false
2
1ecaf09cfb31e2948ea59fc3cb17e8d62e00fed0
7,404,523,669,602
b6daf7d8aed65eb36e9bdac5873b0c5b304195dc
/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/version/TestVersionColumn.java
899975819d8a12781928f7eb1e2f86ab970e1f19
[ "Apache-2.0", "CDDL-1.0", "LicenseRef-scancode-oracle-openjdk-exception-2.0", "GPL-2.0-only", "EPL-1.0" ]
permissive
apache/openjpa
https://github.com/apache/openjpa
237e184c18fd1f3c9854130518f8a33d38d9214f
a1e46a10c68c8176cda82db3d1b60e97ca412b75
refs/heads/master
2023-08-31T04:16:56.892000
2023-07-25T13:19:07
2023-07-25T13:19:07
206,364
136
162
Apache-2.0
false
2023-08-15T17:40:57
2009-05-21T01:13:25
2023-07-20T02:15:52
2023-08-15T17:40:56
39,225
121
116
20
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.openjpa.persistence.jdbc.version; import java.util.List; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityTransaction; import org.apache.openjpa.persistence.jdbc.version.model.IntVersion; import org.apache.openjpa.persistence.jdbc.version.model.ShortVersion; import org.apache.openjpa.persistence.jdbc.version.model.TimestampVersion; import org.apache.openjpa.persistence.test.SQLListenerTestCase; public class TestVersionColumn extends SQLListenerTestCase { @Override public void setUp() { super.setUp(IntVersion.class, TimestampVersion.class, ShortVersion.class); } public void testNullIntegerVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new IntVersion()); em.persist(new IntVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE IntVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<IntVersion> results = em.createQuery("SELECT i from IntVersion i", IntVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (IntVersion iv : results) { assertEquals("Version should be initialized to 0, was: " + iv.getVersion(), 0, iv.getVersion()); em.find(IntVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } public void testNullTimestampVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new TimestampVersion()); em.persist(new TimestampVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE TimestampVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<TimestampVersion> results = em.createQuery("SELECT i from TimestampVersion i", TimestampVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (TimestampVersion iv : results) { assertEquals("Version should be initialized to null, was: " + iv.getVersion(), null, iv.getVersion()); em.find(TimestampVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } public void testNullShortVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new ShortVersion()); em.persist(new ShortVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE ShortVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<ShortVersion> results = em.createQuery("SELECT i from ShortVersion i", ShortVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (ShortVersion iv : results) { assertEquals("Version should be initialized to 0, was" + iv.getVersion(), 0, iv.getVersion()); em.find(ShortVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } }
UTF-8
Java
4,564
java
TestVersionColumn.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.openjpa.persistence.jdbc.version; import java.util.List; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityTransaction; import org.apache.openjpa.persistence.jdbc.version.model.IntVersion; import org.apache.openjpa.persistence.jdbc.version.model.ShortVersion; import org.apache.openjpa.persistence.jdbc.version.model.TimestampVersion; import org.apache.openjpa.persistence.test.SQLListenerTestCase; public class TestVersionColumn extends SQLListenerTestCase { @Override public void setUp() { super.setUp(IntVersion.class, TimestampVersion.class, ShortVersion.class); } public void testNullIntegerVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new IntVersion()); em.persist(new IntVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE IntVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<IntVersion> results = em.createQuery("SELECT i from IntVersion i", IntVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (IntVersion iv : results) { assertEquals("Version should be initialized to 0, was: " + iv.getVersion(), 0, iv.getVersion()); em.find(IntVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } public void testNullTimestampVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new TimestampVersion()); em.persist(new TimestampVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE TimestampVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<TimestampVersion> results = em.createQuery("SELECT i from TimestampVersion i", TimestampVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (TimestampVersion iv : results) { assertEquals("Version should be initialized to null, was: " + iv.getVersion(), null, iv.getVersion()); em.find(TimestampVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } public void testNullShortVersion() { EntityManager em = emf.createEntityManager(); EntityTransaction tran = em.getTransaction(); tran.begin(); em.persist(new ShortVersion()); em.persist(new ShortVersion()); tran.commit(); tran.begin(); em.createNativeQuery("UPDATE ShortVersion set version = NULL").executeUpdate(); tran.commit(); em.clear(); resetSQL(); List<ShortVersion> results = em.createQuery("SELECT i from ShortVersion i", ShortVersion.class).getResultList(); assertNotNull("No results found", results); assertFalse("No results found", results.isEmpty()); for (ShortVersion iv : results) { assertEquals("Version should be initialized to 0, was" + iv.getVersion(), 0, iv.getVersion()); em.find(ShortVersion.class, iv.getId()); } assertEquals("Unexpected number of SQL statements: " + getSQLCount(), 1, getSQLCount()); em.close(); } }
4,564
0.666301
0.663891
121
36.719009
30.645189
114
false
false
0
0
0
0
0
0
0.801653
false
false
2
4c9390955efbb5a25c3528b766d2db8ff4375e29
25,589,415,198,386
06b12e49c06fefd2c7accc98c74e20579122f230
/net/src/main/java/com/hylaa/lib/net/model/BaseJsonSecure.java
f7011fb560e4673ec45686e50f5726ee602c2b20
[]
no_license
li-jun-bo/Andream
https://github.com/li-jun-bo/Andream
1bc6909c70a453f7557a77529fc219224d12f716
77ea2aff2fa66964f16aa2a415a744b4c119ea85
refs/heads/master
2020-04-05T13:32:21.957000
2018-01-16T06:14:09
2018-01-16T06:14:09
94,868,964
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hylaa.lib.net.model; import java.io.Serializable; /** * BaseJson. * * @author William Lee * @version v1.0.0 * @created 2016-11-30. * @tel 152-5320-8570 */ public class BaseJsonSecure<S> extends BaseJson implements Serializable { private S secure; public S getSecure() { return secure; } public void setSecure(S secure) { this.secure = secure; } }
UTF-8
Java
408
java
BaseJsonSecure.java
Java
[ { "context": "a.io.Serializable;\n\n/**\n * BaseJson.\n *\n * @author William Lee\n * @version v1.0.0\n * @created 2016-11-30.\n * @te", "end": 107, "score": 0.9998409152030945, "start": 96, "tag": "NAME", "value": "William Lee" } ]
null
[]
package com.hylaa.lib.net.model; import java.io.Serializable; /** * BaseJson. * * @author <NAME> * @version v1.0.0 * @created 2016-11-30. * @tel 152-5320-8570 */ public class BaseJsonSecure<S> extends BaseJson implements Serializable { private S secure; public S getSecure() { return secure; } public void setSecure(S secure) { this.secure = secure; } }
403
0.639706
0.585784
25
15.32
16.823128
73
false
false
0
0
0
0
0
0
0.2
false
false
2
5ff7a2628d0e8612543eabdac14028c6ae3179fd
15,616,501,088,282
d06b6d28f070f4a6a69474ed0f1de6ef2b2589e4
/src/nanostock/app/InOutItemHistoryViewController.java
2d2643d5a74895177416c15975208d814dc6831d
[]
no_license
landryjohn/nanostock
https://github.com/landryjohn/nanostock
c2b1188743eccaafc0a532b177b57e0a343512dd
9aed51343c4db3a275b3ed6579d2eec9972c6be4
refs/heads/master
2021-06-11T18:34:42.636000
2021-04-19T12:52:16
2021-04-19T12:52:16
163,456,891
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nanostock.app; import com.jfoenix.controls.JFXDatePicker; import com.jfoenix.controls.JFXTimePicker; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.ButtonType; import javafx.scene.control.SelectionMode; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; import nanostock.app.logic.Switcher; import nanostock.model.table.DAO.FactoryDAO; import nanostock.model.table.ItemStore; import nanostock.model.table.Operation; import nanostock.model.table.generic.HistoryBuilder; import nanostock.model.table.generic.WatchDogApp; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.ArrayList; import java.util.Optional; import java.util.ResourceBundle; public class InOutItemHistoryViewController extends Switcher implements Initializable { private int operationType ; @FXML TableView<HistoryBuilder> inOutItemOperationTableView ; @FXML TableColumn<HistoryBuilder , String> usernameCol ; @FXML TableColumn<HistoryBuilder , String> itemReferenceCol ; @FXML TableColumn<HistoryBuilder , Integer> quantityCol ; @FXML TableColumn<HistoryBuilder , String> operationDateCol ; @FXML TableColumn<HistoryBuilder , String> operationTimeCol ; @FXML JFXTimePicker startTimeField ; @FXML JFXTimePicker endTimeField ; @FXML JFXDatePicker startDateField ; @FXML JFXDatePicker endDateField ; @Override public void initialize(URL location, ResourceBundle resources) { this.initializeData( 3 ); } public void initializeData( int operationType ){ this.startTimeField.setIs24HourView( true ); this.endTimeField.setIs24HourView( true ); this.usernameCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("username")); this.itemReferenceCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("itemReference")); this.quantityCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , Integer>("quantity")); this.operationDateCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationDate")); this.operationTimeCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationTime")); this.operationType = operationType ; this.usernameCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("username")); this.itemReferenceCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("itemReference")); this.quantityCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , Integer>("quantity")); this.operationDateCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationDate")); this.operationTimeCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationTime")); this.inOutItemOperationTableView.setItems( this.getAll() ); this.inOutItemOperationTableView.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE ) ; } public void reinitializeTable(MouseEvent event ){ this.inOutItemOperationTableView.setItems( this.getAll() ); this.inOutItemOperationTableView.refresh(); } private ObservableList<HistoryBuilder> getAll(){ ObservableList<HistoryBuilder> userOperationObservableList = FXCollections.observableArrayList() ; ArrayList<Operation> operationList = FactoryDAO.getOperationDAO().getAll() ; HistoryBuilder historyBuilder ; for( Operation operation : operationList ){ historyBuilder = new HistoryBuilder( operation ) ; if( historyBuilder.getOperationType() == this.operationType ) userOperationObservableList.add( new HistoryBuilder( operation ) ) ; } return userOperationObservableList ; } private ArrayList<HistoryBuilder> getAllHistory(){ ArrayList<HistoryBuilder> itemOperationList = new ArrayList<>() ; ArrayList<Operation> operationList = FactoryDAO.getOperationDAO().getAll() ; HistoryBuilder historyBuilder ; for( Operation operation : operationList ){ historyBuilder = new HistoryBuilder( operation ) ; if( historyBuilder.getOperationType() == this.operationType ) itemOperationList.add( new HistoryBuilder( operation ) ) ; } return itemOperationList ; } public void archiveOperation( MouseEvent event ){ ArrayList<HistoryBuilder> selectedIOOperation = new ArrayList<>(this.inOutItemOperationTableView.getSelectionModel().getSelectedItems()); if( selectedIOOperation.size() != 0 ){ String message = selectedIOOperation.size() == 1 ? "l'opération ?" : "les opérations ?" ; Optional<ButtonType> choice = this.confirm("Archivage operation" , null , "Voulez vous vraiment archiver " + message ) ; if( choice.isPresent() ){ if( choice.get() == ButtonType.OK ){ for( HistoryBuilder history : selectedIOOperation ){ FactoryDAO.getOperationDAO().archive( history.getOperationId() ); } this.reinitializeTable( event ); } } } } public void sortOperationTableView(MouseEvent _event ){ ObservableList<HistoryBuilder> historyObservableList = FXCollections.observableArrayList() ; ArrayList<HistoryBuilder> historySortedByTimeList = HistoryBuilder.sortByTimePeriod( this.getAllHistory() , this.startTimeField.getValue() + ":00" , this.endTimeField.getValue() + ":00" ) ; ArrayList<HistoryBuilder> historySortedByDateList = HistoryBuilder.sortByDatePeriod( this.getAllHistory() , this.startDateField.getValue() + "" , this.endDateField.getValue() + "") ; ArrayList<HistoryBuilder> historySortedByDateTimeList = HistoryBuilder.sortByDatePeriod( historySortedByTimeList , this.startDateField.getValue() + "" , this.endDateField.getValue() + "") ; if( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ){ historyObservableList.addAll( historySortedByTimeList ) ; }else if( this.startDateField.getValue() != null && this.endDateField.getValue() != null ){ historyObservableList.addAll( historySortedByDateList ) ; } if( ( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ) && ( this.startDateField.getValue() != null && this.endDateField.getValue() != null ) ){ historyObservableList.clear(); historyObservableList.addAll( historySortedByDateTimeList ) ; } if( ( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ) || ( this.startDateField.getValue() != null && this.endDateField.getValue() != null ) ){ this.inOutItemOperationTableView.setItems( historyObservableList ); this.inOutItemOperationTableView.refresh(); } } public void goToInOutItemHistoryView( MouseEvent event , int operationType ) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setLocation( getClass().getResource("view/inOutItemHistoryView.fxml") ) ; Parent homeViewParent = loader.load(); this.initDefaultSize(); Scene homeViewScene = new Scene( homeViewParent, this.getWidth(), this.getHeight()) ; InOutItemHistoryViewController inOutItemHistoryViewController = (InOutItemHistoryViewController)loader.getController(); inOutItemHistoryViewController.initializeData( operationType ); Stage window = (Stage)((Node)event.getSource()).getScene().getWindow(); window.setScene( homeViewScene ); window.setMaximized(true); window.show(); } public void goToInItemHistory( MouseEvent event ) throws IOException { this.goToInOutItemHistoryView( event , 2); } public void goToOutItemHistory( MouseEvent event ) throws IOException { this.goToInOutItemHistoryView( event , 3); } public void goToHistoryPanel( MouseEvent event ) throws IOException { this.switchTo("view/historyPanelView.fxml" , event ); } public void goToSellHistory(MouseEvent event ) throws IOException { this.switchTo("view/sellHistoryView.fxml" , event ); } public void goToHomeView( MouseEvent event ) throws IOException, SQLException { FXMLLoader loader = new FXMLLoader(); loader.setLocation( getClass().getResource("view/homeView.fxml") ) ; Parent homeViewParent = loader.load(); this.initDefaultSize(); Scene homeViewScene = new Scene( homeViewParent, this.getWidth(), this.getHeight()) ; HomeViewController homeViewController = (HomeViewController)loader.getController(); homeViewController.initializeUserData( WatchDogApp.getUserConnected() ); Stage window = (Stage)((Node)event.getSource()).getScene().getWindow(); window.setScene( homeViewScene ); window.setMaximized(true); window.show(); } }
UTF-8
Java
9,699
java
InOutItemHistoryViewController.java
Java
[ { "context": "ew PropertyValueFactory<HistoryBuilder , String>(\"username\"));\n this.itemReferenceCol.setCellValueFac", "end": 2139, "score": 0.9995275735855103, "start": 2131, "tag": "USERNAME", "value": "username" }, { "context": "ew PropertyValueFactory<HistoryBuilder , St...
null
[]
package nanostock.app; import com.jfoenix.controls.JFXDatePicker; import com.jfoenix.controls.JFXTimePicker; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.ButtonType; import javafx.scene.control.SelectionMode; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; import nanostock.app.logic.Switcher; import nanostock.model.table.DAO.FactoryDAO; import nanostock.model.table.ItemStore; import nanostock.model.table.Operation; import nanostock.model.table.generic.HistoryBuilder; import nanostock.model.table.generic.WatchDogApp; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.ArrayList; import java.util.Optional; import java.util.ResourceBundle; public class InOutItemHistoryViewController extends Switcher implements Initializable { private int operationType ; @FXML TableView<HistoryBuilder> inOutItemOperationTableView ; @FXML TableColumn<HistoryBuilder , String> usernameCol ; @FXML TableColumn<HistoryBuilder , String> itemReferenceCol ; @FXML TableColumn<HistoryBuilder , Integer> quantityCol ; @FXML TableColumn<HistoryBuilder , String> operationDateCol ; @FXML TableColumn<HistoryBuilder , String> operationTimeCol ; @FXML JFXTimePicker startTimeField ; @FXML JFXTimePicker endTimeField ; @FXML JFXDatePicker startDateField ; @FXML JFXDatePicker endDateField ; @Override public void initialize(URL location, ResourceBundle resources) { this.initializeData( 3 ); } public void initializeData( int operationType ){ this.startTimeField.setIs24HourView( true ); this.endTimeField.setIs24HourView( true ); this.usernameCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("username")); this.itemReferenceCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("itemReference")); this.quantityCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , Integer>("quantity")); this.operationDateCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationDate")); this.operationTimeCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationTime")); this.operationType = operationType ; this.usernameCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("username")); this.itemReferenceCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("itemReference")); this.quantityCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , Integer>("quantity")); this.operationDateCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationDate")); this.operationTimeCol.setCellValueFactory( new PropertyValueFactory<HistoryBuilder , String>("operationTime")); this.inOutItemOperationTableView.setItems( this.getAll() ); this.inOutItemOperationTableView.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE ) ; } public void reinitializeTable(MouseEvent event ){ this.inOutItemOperationTableView.setItems( this.getAll() ); this.inOutItemOperationTableView.refresh(); } private ObservableList<HistoryBuilder> getAll(){ ObservableList<HistoryBuilder> userOperationObservableList = FXCollections.observableArrayList() ; ArrayList<Operation> operationList = FactoryDAO.getOperationDAO().getAll() ; HistoryBuilder historyBuilder ; for( Operation operation : operationList ){ historyBuilder = new HistoryBuilder( operation ) ; if( historyBuilder.getOperationType() == this.operationType ) userOperationObservableList.add( new HistoryBuilder( operation ) ) ; } return userOperationObservableList ; } private ArrayList<HistoryBuilder> getAllHistory(){ ArrayList<HistoryBuilder> itemOperationList = new ArrayList<>() ; ArrayList<Operation> operationList = FactoryDAO.getOperationDAO().getAll() ; HistoryBuilder historyBuilder ; for( Operation operation : operationList ){ historyBuilder = new HistoryBuilder( operation ) ; if( historyBuilder.getOperationType() == this.operationType ) itemOperationList.add( new HistoryBuilder( operation ) ) ; } return itemOperationList ; } public void archiveOperation( MouseEvent event ){ ArrayList<HistoryBuilder> selectedIOOperation = new ArrayList<>(this.inOutItemOperationTableView.getSelectionModel().getSelectedItems()); if( selectedIOOperation.size() != 0 ){ String message = selectedIOOperation.size() == 1 ? "l'opération ?" : "les opérations ?" ; Optional<ButtonType> choice = this.confirm("Archivage operation" , null , "Voulez vous vraiment archiver " + message ) ; if( choice.isPresent() ){ if( choice.get() == ButtonType.OK ){ for( HistoryBuilder history : selectedIOOperation ){ FactoryDAO.getOperationDAO().archive( history.getOperationId() ); } this.reinitializeTable( event ); } } } } public void sortOperationTableView(MouseEvent _event ){ ObservableList<HistoryBuilder> historyObservableList = FXCollections.observableArrayList() ; ArrayList<HistoryBuilder> historySortedByTimeList = HistoryBuilder.sortByTimePeriod( this.getAllHistory() , this.startTimeField.getValue() + ":00" , this.endTimeField.getValue() + ":00" ) ; ArrayList<HistoryBuilder> historySortedByDateList = HistoryBuilder.sortByDatePeriod( this.getAllHistory() , this.startDateField.getValue() + "" , this.endDateField.getValue() + "") ; ArrayList<HistoryBuilder> historySortedByDateTimeList = HistoryBuilder.sortByDatePeriod( historySortedByTimeList , this.startDateField.getValue() + "" , this.endDateField.getValue() + "") ; if( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ){ historyObservableList.addAll( historySortedByTimeList ) ; }else if( this.startDateField.getValue() != null && this.endDateField.getValue() != null ){ historyObservableList.addAll( historySortedByDateList ) ; } if( ( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ) && ( this.startDateField.getValue() != null && this.endDateField.getValue() != null ) ){ historyObservableList.clear(); historyObservableList.addAll( historySortedByDateTimeList ) ; } if( ( this.startTimeField.getValue() != null && this.endTimeField.getValue() != null ) || ( this.startDateField.getValue() != null && this.endDateField.getValue() != null ) ){ this.inOutItemOperationTableView.setItems( historyObservableList ); this.inOutItemOperationTableView.refresh(); } } public void goToInOutItemHistoryView( MouseEvent event , int operationType ) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setLocation( getClass().getResource("view/inOutItemHistoryView.fxml") ) ; Parent homeViewParent = loader.load(); this.initDefaultSize(); Scene homeViewScene = new Scene( homeViewParent, this.getWidth(), this.getHeight()) ; InOutItemHistoryViewController inOutItemHistoryViewController = (InOutItemHistoryViewController)loader.getController(); inOutItemHistoryViewController.initializeData( operationType ); Stage window = (Stage)((Node)event.getSource()).getScene().getWindow(); window.setScene( homeViewScene ); window.setMaximized(true); window.show(); } public void goToInItemHistory( MouseEvent event ) throws IOException { this.goToInOutItemHistoryView( event , 2); } public void goToOutItemHistory( MouseEvent event ) throws IOException { this.goToInOutItemHistoryView( event , 3); } public void goToHistoryPanel( MouseEvent event ) throws IOException { this.switchTo("view/historyPanelView.fxml" , event ); } public void goToSellHistory(MouseEvent event ) throws IOException { this.switchTo("view/sellHistoryView.fxml" , event ); } public void goToHomeView( MouseEvent event ) throws IOException, SQLException { FXMLLoader loader = new FXMLLoader(); loader.setLocation( getClass().getResource("view/homeView.fxml") ) ; Parent homeViewParent = loader.load(); this.initDefaultSize(); Scene homeViewScene = new Scene( homeViewParent, this.getWidth(), this.getHeight()) ; HomeViewController homeViewController = (HomeViewController)loader.getController(); homeViewController.initializeUserData( WatchDogApp.getUserConnected() ); Stage window = (Stage)((Node)event.getSource()).getScene().getWindow(); window.setScene( homeViewScene ); window.setMaximized(true); window.show(); } }
9,699
0.701145
0.699804
218
43.481651
35.775963
124
false
false
0
0
0
0
0
0
0.678899
false
false
2
40bdf5143a871f6eba69fe8ca588f2f906d7d8ff
21,345,987,509,906
bbc77442f99a16860199f94cd8a8511f5df747ea
/Unit Eight/src/com/bayviewglen/dayone/Box2D.java
f287e9c9c2c343bdf60d6ade7555cb601fda1fd6
[]
no_license
yhashim/ICS3U-AP
https://github.com/yhashim/ICS3U-AP
173c29e044abc0750ec0e53782f48b7755102006
4e19fb556f24149f4bde56558f88d6eb55d1e8a2
refs/heads/master
2023-06-19T22:03:38.098000
2023-01-10T02:03:34
2023-01-10T02:03:34
148,688,773
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bayviewglen.dayone; public class Box2D { private double width; private double length; public Box2D(double width, double length) { this.width = width; this.length = length; } public double getArea() { return width*length; } public double getPerimeter() { return 2*width + 2*length; } public double getWidth() { return width; } // just a method for fun haha public boolean getSquariness() { return width == length; } public void setWidth(double width) { this.width = width; } public double getLength() { return length; } public void setLength(double length) { this.length = length; } }
UTF-8
Java
689
java
Box2D.java
Java
[]
null
[]
package com.bayviewglen.dayone; public class Box2D { private double width; private double length; public Box2D(double width, double length) { this.width = width; this.length = length; } public double getArea() { return width*length; } public double getPerimeter() { return 2*width + 2*length; } public double getWidth() { return width; } // just a method for fun haha public boolean getSquariness() { return width == length; } public void setWidth(double width) { this.width = width; } public double getLength() { return length; } public void setLength(double length) { this.length = length; } }
689
0.640058
0.634253
41
14.804878
13.708141
44
false
false
0
0
0
0
0
0
1.341463
false
false
2
20e70224e0803b38e6b3b5ad07d3b5c051e115de
28,776,280,908,419
228e4d395448351087249528b1697c5b53f75012
/teacherShareLearn/src/main/java/com/share/teacher/utils/URLConstants.java
ca9ddb1f537469a76772e7e4bb89f3eaa0593540
[]
no_license
czqaiwsm/androidStudioShareGit
https://github.com/czqaiwsm/androidStudioShareGit
bdde7b26e561143825b0ae15cc11004bd64ac443
d9129bb927f00d98513d7ad79ae8352cb6ea0d17
refs/heads/master
2020-04-18T01:51:54.455000
2017-10-23T14:20:23
2017-10-23T14:20:23
67,393,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.share.teacher.utils; //import com.alipay.sdk.pay.demo.AlipayConstant; /** * @author czq * @desc 请用一句话描述它 * @date 16/3/15 */ public class URLConstants { // // https://svn.duapp.com/appid7ofdiffbr0/learn // No1RightAnswer // ls/2016 public static int SCREENH = 0; public static int SCREENW = 0; public static final String SUCCESS_CODE = "200"; /********requestCode*************/ public static final int CHOOSE_CITY_REQUEST_CODE = 11;//城市选择 public static final int CHOOSE_JOINOR_REQUEST_CODE = 22;//年级选择 public static final int CHOOSE_DEGREE_REQUEST_CODE = 33;//学历选择 public static final int CHOOSE_SUBJECT_REQUEST_CODE = 44;//科目选择 /********requestCode*************/ public static String CHOOSE = "CHOOSE"; /********Intent value*************/ public static final String COURSEID = "courseId"; public static final int ORDERLEFT = 0X20; public static final int ORDERRIGHT = 0X21; /********Intent value*************/ // 生产环境: // 支付包、微信:http//www.leishangnet.com // wap:http://www.ienjoystudy.cn // 测试地址: // 支付包、微信:http//www.ienjoystudy.cn:8080 // wap:http://www.ienjoystudy.cn:8080 public static final String BASE_DOMAIN = "http://www.leishangnet.com"; // public static final String BASE_DOMAIN = "http://www.ienjoystudy.cn:8081"; public static final String BASE_URL = BASE_DOMAIN+"/learn-teach/teach/api.action";//基础 teacher URL public static final String TEACHER_UPLOAD = BASE_DOMAIN+"/learn-teach/teach/upload.action"; public static final String BANK_WITHDRAW =BASE_DOMAIN+"/learn-wap/wap/bankWithdraw.do";//银行卡提现 public static final String WITHDRAW_DETAIL = BASE_DOMAIN+"/learn-wap/wap/incomeDetail.do";//提现明细 // 银行卡:localhost:8080/learn-wap/wap/bankWithdraw.do // 收入明细:localhost:8080/learn-wap/wap/incomeDetail.do // static { // AlipayConstant.NOTIFY_URL = "http://120.25.171.4/learn-interface/alipayOrderServlet"; // AlipayConstant.SELLER = "1138088601@qq.com"; // AlipayConstant.RSA_PRIVATE = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALLE1FNSf0l4IF1c\n" + // "cBAsu4cKvp4mIzLTsuHtJSHLHwV3fpH1ReYIoNCCqMKx7CWMnFuQEeq2xlop9LHf\n" + // "4VSrgDN2jYMiqSHTxBHtvh7EyNLK6MRZA4CED5bHpdpVKbXbVSJboAfeNFoL/ao4\n" + // "5I8Uf5taaw93SyDvXzmmixh7tEkTAgMBAAECgYBVmumuCMhJT0v4SSakqDcYwK1t\n" + // "IAgk87kqdRwd5Z2ySXmDvXc+Y41Wq+rSaM8TYBUTx5a81c+AJ600bGgD2qhlrs3T\n" + // "cSVDz/lngoANxEKnCZDp1LVOOIw6KIsBy+6p/nQ9RheVpRZpHo7OiNXn+gpVZyCw\n" + // "fsjiwYe98FKHh+fUCQJBAOlAZQl/HUMjWFY5XxG+9rfnySXW8KsI2jMQOiCCXsYV\n" + // "eKJdExRyDqUkiWM5WGxj7L6QcruEnXP17ZAsJAABwfUCQQDENCmVf/SEgzMnCH6z\n" + // "F5otjEvWdRB9QupR9mzt82QgIwI4JjQ0nFpzwwFE1SjnZ/chpiGgyb1OP6BA8rec\n" + // "KRHnAkEA0v1O5+I2BA8qzwQifRjyb7SY/UOKfAwL5HjfO5zyQdgWQThUFACAQt3j\n" + // "8P9kftd8xXxAbGMvUj+5XtquzdrJKQJBAJ88iodX+tZVOP2z6khlnm7bD221QrW2\n" + // "yj/NFOkmARwH7bQuZW5ReyO6n1wC+BifCzZXA7HgKXDJOMGde6EUv/8CQDrM0ZAK\n" + // "wFA5DiiQh9LNu7ztSZFE+4dulNXf62aQ/qybxmYsfqM+onwL3pFt34QAuKWmXh5T\n" + // "0XR2JECVUVlEU9k="; // AlipayConstant.PARTNER = "2088221254922632"; // } }
UTF-8
Java
3,442
java
URLConstants.java
Java
[ { "context": "lipay.sdk.pay.demo.AlipayConstant;\n\n/**\n * @author czq\n * @desc 请用一句话描述它\n * @date 16/3/15\n */\npublic cla", "end": 102, "score": 0.9996905326843262, "start": 99, "tag": "USERNAME", "value": "czq" }, { "context": "c {\n// AlipayConstant.NOTIFY_URL = \"http:/...
null
[]
package com.share.teacher.utils; //import com.alipay.sdk.pay.demo.AlipayConstant; /** * @author czq * @desc 请用一句话描述它 * @date 16/3/15 */ public class URLConstants { // // https://svn.duapp.com/appid7ofdiffbr0/learn // No1RightAnswer // ls/2016 public static int SCREENH = 0; public static int SCREENW = 0; public static final String SUCCESS_CODE = "200"; /********requestCode*************/ public static final int CHOOSE_CITY_REQUEST_CODE = 11;//城市选择 public static final int CHOOSE_JOINOR_REQUEST_CODE = 22;//年级选择 public static final int CHOOSE_DEGREE_REQUEST_CODE = 33;//学历选择 public static final int CHOOSE_SUBJECT_REQUEST_CODE = 44;//科目选择 /********requestCode*************/ public static String CHOOSE = "CHOOSE"; /********Intent value*************/ public static final String COURSEID = "courseId"; public static final int ORDERLEFT = 0X20; public static final int ORDERRIGHT = 0X21; /********Intent value*************/ // 生产环境: // 支付包、微信:http//www.leishangnet.com // wap:http://www.ienjoystudy.cn // 测试地址: // 支付包、微信:http//www.ienjoystudy.cn:8080 // wap:http://www.ienjoystudy.cn:8080 public static final String BASE_DOMAIN = "http://www.leishangnet.com"; // public static final String BASE_DOMAIN = "http://www.ienjoystudy.cn:8081"; public static final String BASE_URL = BASE_DOMAIN+"/learn-teach/teach/api.action";//基础 teacher URL public static final String TEACHER_UPLOAD = BASE_DOMAIN+"/learn-teach/teach/upload.action"; public static final String BANK_WITHDRAW =BASE_DOMAIN+"/learn-wap/wap/bankWithdraw.do";//银行卡提现 public static final String WITHDRAW_DETAIL = BASE_DOMAIN+"/learn-wap/wap/incomeDetail.do";//提现明细 // 银行卡:localhost:8080/learn-wap/wap/bankWithdraw.do // 收入明细:localhost:8080/learn-wap/wap/incomeDetail.do // static { // AlipayConstant.NOTIFY_URL = "http://192.168.127.12/learn-interface/alipayOrderServlet"; // AlipayConstant.SELLER = "<EMAIL>"; // AlipayConstant.RSA_PRIVATE = "<KEY>" + // "<KEY>" + // "<KEY>" + // "<KEY>" + // "<KEY>" + // "<KEY>" + // "<KEY>n" + // "<KEY>qUki<KEY>cr<KEY>wf<KEY>n" + // "<KEY>b1OP6BA8rec\n" + // "<KEY>" + // "<KEY>" + // "<KEY>" + // "<KEY>" + // "0XR2JECVUVlEU9k="; // AlipayConstant.PARTNER = "2088221254922632"; // } }
2,679
0.679673
0.618875
75
43.080002
34.670547
109
false
false
0
0
0
0
64
0.251664
0.306667
false
false
2
7c80cde56878484cb6c021096d9c62c01b4c3048
29,042,568,890,192
e95cd5da5182c29c25859c2a401aa8ff42de1051
/cplay/src/main/java/com/pingfan/modules/manage/repository/AdminRepository.java
b7e14af930c7386ab1146400bbe6ec9b18528212
[]
no_license
dingfan0523/cplayer-server
https://github.com/dingfan0523/cplayer-server
9f5cd4371725090567f5e75ab8a8ae03350d78a8
d1ac89fcb3f04a3b81327d53f5d44c02e96006d8
refs/heads/master
2020-07-30T17:47:09.025000
2020-04-12T14:55:29
2020-04-12T14:55:29
210,307,461
0
0
null
false
2021-01-14T20:24:04
2019-09-23T08:49:54
2020-04-12T14:55:50
2021-01-14T20:24:02
541
0
0
3
Java
false
false
package com.pingfan.modules.manage.repository; import com.pingfan.modules.manage.pojo.Admin; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface AdminRepository extends JpaRepository<Admin, Integer> { @Query(value = "SELECT account FROM admin WHERE id = ?1",nativeQuery = true) String getAccountById(Integer id); public Admin findByAccountAndStatus(String account, Integer status); public List<Admin> findByStatusNotOrderByRankNumDesc(Integer status); }
UTF-8
Java
579
java
AdminRepository.java
Java
[]
null
[]
package com.pingfan.modules.manage.repository; import com.pingfan.modules.manage.pojo.Admin; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface AdminRepository extends JpaRepository<Admin, Integer> { @Query(value = "SELECT account FROM admin WHERE id = ?1",nativeQuery = true) String getAccountById(Integer id); public Admin findByAccountAndStatus(String account, Integer status); public List<Admin> findByStatusNotOrderByRankNumDesc(Integer status); }
579
0.797927
0.7962
16
35.1875
30.502497
80
false
false
0
0
0
0
0
0
0.6875
false
false
2
0f71c7c4a698ba7a93a6931b9362191ef6cc300d
29,042,568,888,248
8a4a3fd37189d5f8c0025c497b1f965a8f43f6a3
/src/main/java/collabai/group42/biddingStrategy/Group42TicForTac.java
9c16d4432ada0da7a0c4aa2fe110ceaf900b2b65
[]
no_license
aaron-c-zhao/collaboritive_ai_auto_negotiation
https://github.com/aaron-c-zhao/collaboritive_ai_auto_negotiation
de8be43e3272392da54065b3c36fab9f66d65b49
99fec44004727790eec8674330cb0f4384c190c3
refs/heads/main
2023-03-31T20:38:26.405000
2021-03-07T10:16:42
2021-03-07T10:16:42
355,333,039
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collabai.group42.biddingStrategy; import geniusweb.actions.Action; import geniusweb.actions.Offer; import collabai.group42.BoaState; import geniusweb.issuevalue.Bid; import tudelft.utilities.immutablelist.ImmutableList; import java.math.BigDecimal; public class Group42TicForTac extends Group42BiddingStrategy { private double[] nashPoint = {0.0, 0.0}; private double reserValue = 0.0; private double maxValue = 1.0; private static final int STEP_NUM = 100; @Override public Action getAction(BoaState boaState) { if (this.bidSpace == null) { init(boaState); } Bid lastBid = getLastBid(boaState.getActionHistory()); double targetUtility = getTargetUtility( boaState.getProgress().get(System.currentTimeMillis()), lastBid, boaState); ImmutableList<Bid> bidOptions = bidSpace .getBids((BigDecimal.valueOf(targetUtility))); if (bidOptions.size().intValue() == 0) return getAlterAction(boaState, targetUtility, lastBid, bidOptions); return new Offer(me, getNiceBid(bidOptions, boaState)); } protected double getTargetUtility(Double progress, Bid lastBid, BoaState boaState) { if (progress < 0.1) { return (1.0 - progress * 0.1) * this.maxValue; } else if (progress < 0.99){ updateNashPoint(boaState); double dist = getOpponentUtility(lastBid, boaState) / getNashPoint()[1]; dist = Math.min(dist, 1.0); return 1.0 - dist* (1.0 - getNashPoint()[0]); } else return getMin(); } /** * Update the nash point according to the most recent opponent model. */ protected void updateNashPoint(BoaState boaState) { double maxProduct = 0.0; double step = (maxValue - reserValue) / STEP_NUM; for (int i = STEP_NUM; i > 0; i--) { double profit = i * step; double utility = reserValue + profit; ImmutableList<Bid> bidOptions = bidSpace .getBids((BigDecimal.valueOf(utility))); if (bidOptions.size().intValue() == 0) continue; Bid bid = getNiceBid(bidOptions, boaState); double utilityOp = getOpponentUtility(bid, boaState); double product = (utilityOp - getOpponentReservation()) * profit; if (maxProduct <= product) { maxProduct = product; nashPoint[0] = utility; nashPoint[1] = utilityOp; } } } /** * Retrieve the opponent's reservation value from the opponent model. * * Could be set to a fix value or the same value as the agent itself if the opponent model * does not support reservation value estimation. * * @return opponent's reservation value. */ protected double getOpponentReservation() { return 0.0; } @Override protected void init(BoaState boaState) { super.init(boaState); reserValue = getMin(); maxValue = getMax(); } protected double[] getNashPoint() { return nashPoint; } }
UTF-8
Java
3,197
java
Group42TicForTac.java
Java
[]
null
[]
package collabai.group42.biddingStrategy; import geniusweb.actions.Action; import geniusweb.actions.Offer; import collabai.group42.BoaState; import geniusweb.issuevalue.Bid; import tudelft.utilities.immutablelist.ImmutableList; import java.math.BigDecimal; public class Group42TicForTac extends Group42BiddingStrategy { private double[] nashPoint = {0.0, 0.0}; private double reserValue = 0.0; private double maxValue = 1.0; private static final int STEP_NUM = 100; @Override public Action getAction(BoaState boaState) { if (this.bidSpace == null) { init(boaState); } Bid lastBid = getLastBid(boaState.getActionHistory()); double targetUtility = getTargetUtility( boaState.getProgress().get(System.currentTimeMillis()), lastBid, boaState); ImmutableList<Bid> bidOptions = bidSpace .getBids((BigDecimal.valueOf(targetUtility))); if (bidOptions.size().intValue() == 0) return getAlterAction(boaState, targetUtility, lastBid, bidOptions); return new Offer(me, getNiceBid(bidOptions, boaState)); } protected double getTargetUtility(Double progress, Bid lastBid, BoaState boaState) { if (progress < 0.1) { return (1.0 - progress * 0.1) * this.maxValue; } else if (progress < 0.99){ updateNashPoint(boaState); double dist = getOpponentUtility(lastBid, boaState) / getNashPoint()[1]; dist = Math.min(dist, 1.0); return 1.0 - dist* (1.0 - getNashPoint()[0]); } else return getMin(); } /** * Update the nash point according to the most recent opponent model. */ protected void updateNashPoint(BoaState boaState) { double maxProduct = 0.0; double step = (maxValue - reserValue) / STEP_NUM; for (int i = STEP_NUM; i > 0; i--) { double profit = i * step; double utility = reserValue + profit; ImmutableList<Bid> bidOptions = bidSpace .getBids((BigDecimal.valueOf(utility))); if (bidOptions.size().intValue() == 0) continue; Bid bid = getNiceBid(bidOptions, boaState); double utilityOp = getOpponentUtility(bid, boaState); double product = (utilityOp - getOpponentReservation()) * profit; if (maxProduct <= product) { maxProduct = product; nashPoint[0] = utility; nashPoint[1] = utilityOp; } } } /** * Retrieve the opponent's reservation value from the opponent model. * * Could be set to a fix value or the same value as the agent itself if the opponent model * does not support reservation value estimation. * * @return opponent's reservation value. */ protected double getOpponentReservation() { return 0.0; } @Override protected void init(BoaState boaState) { super.init(boaState); reserValue = getMin(); maxValue = getMax(); } protected double[] getNashPoint() { return nashPoint; } }
3,197
0.609008
0.594933
103
30.038836
25.49621
94
false
false
0
0
0
0
0
0
0.543689
false
false
2
f12f0c9a5228521621bc2c0357511d47f69c6dca
9,783,935,556,402
1e380237f42fc3d090958dae33a7d82f23467110
/mp_test/src/controller/Controller.java
30367bf19dd12cd3a72e59dfee7bb72e1ca9e5ef
[]
no_license
Quaitgor/mp_test
https://github.com/Quaitgor/mp_test
d7b0fdfa1bf4d485d8a4b895f785a94d9161d47a
123bd8546e6b55fc7fb95753c047f91b169303cf
refs/heads/master
2021-01-02T22:16:43.632000
2014-01-14T08:33:59
2014-01-14T08:33:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import explorer.ExplorerWindow; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.security.CodeSource; import java.util.Iterator; import java.util.ResourceBundle; import java.util.TreeMap; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; import javax.swing.SwingUtilities; import observer.DeltaUpdater; import production.Unit; import reader.JavaAndXML; import writer.TextBlock; public class Controller { private static JavaAndXML jxml = JavaAndXML.getInstance(); private static Controller controller = null; // public boolean isServer = false; public static boolean showHitbox = false; public static TreeMap<String, TreeMap<String, StringWriter>> library; public static boolean isJarFile = false; public static DeltaUpdater deltaUpdater; public ExplorerWindow expWin; public CodeSource srcJar = null; public String jarPath = ""; public static ResourceBundle config = ResourceBundle.getBundle("config"); private Controller() { library = new TreeMap<String, TreeMap<String, StringWriter>>(); TreeMap<String, StringWriter> iUnits = new TreeMap<String, StringWriter>(); library.put("iUnits", iUnits); TreeMap<String, StringWriter> eUnits = new TreeMap<String, StringWriter>(); library.put("eUnits", eUnits); TreeMap<String, StringWriter> iGraphics = new TreeMap<String, StringWriter>(); library.put("iGraphics", iGraphics); TreeMap<String, StringWriter> eGraphics = new TreeMap<String, StringWriter>(); library.put("eGraphics", eGraphics); TreeMap<String, StringWriter> iWeapons = new TreeMap<String, StringWriter>(); library.put("iWeapons", iWeapons); TreeMap<String, StringWriter> eWeapons = new TreeMap<String, StringWriter>(); library.put("eWeapons", eWeapons); TreeMap<String, StringWriter> iprojectiles = new TreeMap<String, StringWriter>(); library.put("iProjectiles", iprojectiles); TreeMap<String, StringWriter> eprojectiles = new TreeMap<String, StringWriter>(); library.put("eProjectiles", eprojectiles); TreeMap<String, StringWriter> itexts = new TreeMap<String, StringWriter>(); library.put("iTexts", itexts); TreeMap<String, StringWriter> etexts = new TreeMap<String, StringWriter>(); library.put("eTexts", etexts); TreeMap<String, StringWriter> ifonts = new TreeMap<String, StringWriter>(); library.put("iFonts", ifonts); TreeMap<String, StringWriter> efonts = new TreeMap<String, StringWriter>(); library.put("eFonts", efonts); CodeSource src = getClass().getProtectionDomain().getCodeSource(); if (src.getLocation().toString().endsWith(".jar")) { isJarFile = true; srcJar = src; jarPath = srcJar.getLocation().toString(); jarPath = jarPath.substring(5, jarPath.length()); } initBlueprints(); } public static Controller getInstance() { if (controller == null) { controller = new Controller(); } return controller; } public void initExplorer() { expWin = new ExplorerWindow(); } public TreeMap<String, TreeMap<String, StringWriter>> getLibrary() { return library; } private boolean contains(String haystack, String needle) { haystack = haystack == null ? "" : haystack; needle = needle == null ? "" : needle; return haystack.toLowerCase().contains(needle.toLowerCase()); } private void readFolders(String path, TreeMap<String, StringWriter> map) { if (new File(path).exists()) { File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles) { StringWriter stringWriter = null; try { stringWriter = jxml.readXML(new FileInputStream(file.getAbsolutePath())); } catch (FileNotFoundException e) { e.printStackTrace(); } String mapKey = file.getName(); int pos = mapKey.lastIndexOf("."); if (pos > 0) { mapKey = mapKey.substring(0, pos); } map.put(mapKey, stringWriter); } } } private void readJar(String path, TreeMap<String, StringWriter> map) { JarInputStream jar = null; JarEntry jarEntry = null; try { jar = new JarInputStream(new FileInputStream(jarPath.substring(5, jarPath.length()))); jarEntry = jar.getNextJarEntry(); while (jarEntry != null) { if (!jarEntry.isDirectory()) { String str = jarEntry.getName(); if (contains(str, path)) { InputStream test = this.getClass().getResourceAsStream("/" + str); StringWriter stringWriter = jxml.readXML(test); String mapKey = new File(str).getName(); int pos = mapKey.lastIndexOf("."); if (pos > 0) { mapKey = mapKey.substring(0, pos); } map.put(mapKey, stringWriter); } } jarEntry = jar.getNextJarEntry(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private void addBlueprints(String path) { int pos = path.lastIndexOf("/"); String libraryName = path.substring(pos + 1, path.length()); libraryName = libraryName.substring(0, 1).toUpperCase() + libraryName.substring(1); pos = path.indexOf("/"); String modPath = "mod/" + path.substring(pos + 1, path.length()); if (isJarFile) { readJar(path, library.get("i" + libraryName)); } else { readFolders(path, library.get("i" + libraryName)); } readFolders(modPath, library.get("e" + libraryName)); } private void initBlueprints() { addBlueprints(config.getString("source.b.units")); addBlueprints(config.getString("source.b.graphics")); addBlueprints(config.getString("source.b.weapons")); addBlueprints(config.getString("source.b.projectiles")); addBlueprints(config.getString("source.b.fonts")); addBlueprints(config.getString("source.b.texts")); } public void start() { // Menu etc here? // Test units etc follow Unit x = (Unit) spawn("Units", "enemy_red", Unit.class); Unit y = (Unit) spawn("Units", "player", Unit.class); if (x != null) { x.setPosition(400, 100); } if (y != null) { y.setPosition(400, 300); } jxml.XMLtoJava(getXML("Texts", "test1"), TextBlock.class); jxml.XMLtoJava(getXML("Texts", "test2"), TextBlock.class); } public StringWriter getXML(String sublibrary, String object) { StringWriter returnWriter = null; // check if library includes e or i, else check both librarys, external // has priority (mod overwrites interal data) if (Character.isLowerCase(sublibrary.charAt(0)) && (sublibrary.charAt(0) == 'e' || sublibrary.charAt(0) == 'i')) { returnWriter = library.get(sublibrary).get(object); } else { StringWriter internal = null; StringWriter external = null; internal = checkLibrary("i" + sublibrary, object); external = checkLibrary("e" + sublibrary, object); if (external != null) { returnWriter = external; } else { returnWriter = internal; } } return returnWriter; } public TreeMap<String, StringWriter> getAllXML(String sublibrary) { TreeMap<String, StringWriter> returnTree = new TreeMap<String, StringWriter>(); if (Character.isLowerCase(sublibrary.charAt(0)) && (sublibrary.charAt(0) == 'e' || sublibrary.charAt(0) == 'i')) { Iterator<String> keySetIterator = library.get(sublibrary).keySet().iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); returnTree.put(key, library.get(sublibrary).get(key)); } } else { Iterator<String> keySetIterator = library.get("i" + sublibrary).keySet().iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); returnTree.put(key, library.get("i" + sublibrary).get(key)); } Iterator<String> keySetIterator2 = library.get("e" + sublibrary).keySet().iterator(); while (keySetIterator2.hasNext()) { String key = keySetIterator2.next(); returnTree.put(key, library.get("e" + sublibrary).get(key)); } } return returnTree; } public StringWriter checkLibrary(String sublibrary, String object) { StringWriter returnXML = null; TreeMap<String, StringWriter> subLibraryTreeMap = library.get(sublibrary); if (subLibraryTreeMap != null) { returnXML = subLibraryTreeMap.get(object); } return returnXML; } private Object spawn(String library, String object, Class<?> contextClass) { Object newUnit = null; StringWriter xmlOfUnit = getXML(library, object); if (xmlOfUnit != null) { newUnit = jxml.XMLtoJava(xmlOfUnit, contextClass); } return newUnit; } }
UTF-8
Java
8,719
java
Controller.java
Java
[]
null
[]
package controller; import explorer.ExplorerWindow; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.security.CodeSource; import java.util.Iterator; import java.util.ResourceBundle; import java.util.TreeMap; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; import javax.swing.SwingUtilities; import observer.DeltaUpdater; import production.Unit; import reader.JavaAndXML; import writer.TextBlock; public class Controller { private static JavaAndXML jxml = JavaAndXML.getInstance(); private static Controller controller = null; // public boolean isServer = false; public static boolean showHitbox = false; public static TreeMap<String, TreeMap<String, StringWriter>> library; public static boolean isJarFile = false; public static DeltaUpdater deltaUpdater; public ExplorerWindow expWin; public CodeSource srcJar = null; public String jarPath = ""; public static ResourceBundle config = ResourceBundle.getBundle("config"); private Controller() { library = new TreeMap<String, TreeMap<String, StringWriter>>(); TreeMap<String, StringWriter> iUnits = new TreeMap<String, StringWriter>(); library.put("iUnits", iUnits); TreeMap<String, StringWriter> eUnits = new TreeMap<String, StringWriter>(); library.put("eUnits", eUnits); TreeMap<String, StringWriter> iGraphics = new TreeMap<String, StringWriter>(); library.put("iGraphics", iGraphics); TreeMap<String, StringWriter> eGraphics = new TreeMap<String, StringWriter>(); library.put("eGraphics", eGraphics); TreeMap<String, StringWriter> iWeapons = new TreeMap<String, StringWriter>(); library.put("iWeapons", iWeapons); TreeMap<String, StringWriter> eWeapons = new TreeMap<String, StringWriter>(); library.put("eWeapons", eWeapons); TreeMap<String, StringWriter> iprojectiles = new TreeMap<String, StringWriter>(); library.put("iProjectiles", iprojectiles); TreeMap<String, StringWriter> eprojectiles = new TreeMap<String, StringWriter>(); library.put("eProjectiles", eprojectiles); TreeMap<String, StringWriter> itexts = new TreeMap<String, StringWriter>(); library.put("iTexts", itexts); TreeMap<String, StringWriter> etexts = new TreeMap<String, StringWriter>(); library.put("eTexts", etexts); TreeMap<String, StringWriter> ifonts = new TreeMap<String, StringWriter>(); library.put("iFonts", ifonts); TreeMap<String, StringWriter> efonts = new TreeMap<String, StringWriter>(); library.put("eFonts", efonts); CodeSource src = getClass().getProtectionDomain().getCodeSource(); if (src.getLocation().toString().endsWith(".jar")) { isJarFile = true; srcJar = src; jarPath = srcJar.getLocation().toString(); jarPath = jarPath.substring(5, jarPath.length()); } initBlueprints(); } public static Controller getInstance() { if (controller == null) { controller = new Controller(); } return controller; } public void initExplorer() { expWin = new ExplorerWindow(); } public TreeMap<String, TreeMap<String, StringWriter>> getLibrary() { return library; } private boolean contains(String haystack, String needle) { haystack = haystack == null ? "" : haystack; needle = needle == null ? "" : needle; return haystack.toLowerCase().contains(needle.toLowerCase()); } private void readFolders(String path, TreeMap<String, StringWriter> map) { if (new File(path).exists()) { File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles) { StringWriter stringWriter = null; try { stringWriter = jxml.readXML(new FileInputStream(file.getAbsolutePath())); } catch (FileNotFoundException e) { e.printStackTrace(); } String mapKey = file.getName(); int pos = mapKey.lastIndexOf("."); if (pos > 0) { mapKey = mapKey.substring(0, pos); } map.put(mapKey, stringWriter); } } } private void readJar(String path, TreeMap<String, StringWriter> map) { JarInputStream jar = null; JarEntry jarEntry = null; try { jar = new JarInputStream(new FileInputStream(jarPath.substring(5, jarPath.length()))); jarEntry = jar.getNextJarEntry(); while (jarEntry != null) { if (!jarEntry.isDirectory()) { String str = jarEntry.getName(); if (contains(str, path)) { InputStream test = this.getClass().getResourceAsStream("/" + str); StringWriter stringWriter = jxml.readXML(test); String mapKey = new File(str).getName(); int pos = mapKey.lastIndexOf("."); if (pos > 0) { mapKey = mapKey.substring(0, pos); } map.put(mapKey, stringWriter); } } jarEntry = jar.getNextJarEntry(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private void addBlueprints(String path) { int pos = path.lastIndexOf("/"); String libraryName = path.substring(pos + 1, path.length()); libraryName = libraryName.substring(0, 1).toUpperCase() + libraryName.substring(1); pos = path.indexOf("/"); String modPath = "mod/" + path.substring(pos + 1, path.length()); if (isJarFile) { readJar(path, library.get("i" + libraryName)); } else { readFolders(path, library.get("i" + libraryName)); } readFolders(modPath, library.get("e" + libraryName)); } private void initBlueprints() { addBlueprints(config.getString("source.b.units")); addBlueprints(config.getString("source.b.graphics")); addBlueprints(config.getString("source.b.weapons")); addBlueprints(config.getString("source.b.projectiles")); addBlueprints(config.getString("source.b.fonts")); addBlueprints(config.getString("source.b.texts")); } public void start() { // Menu etc here? // Test units etc follow Unit x = (Unit) spawn("Units", "enemy_red", Unit.class); Unit y = (Unit) spawn("Units", "player", Unit.class); if (x != null) { x.setPosition(400, 100); } if (y != null) { y.setPosition(400, 300); } jxml.XMLtoJava(getXML("Texts", "test1"), TextBlock.class); jxml.XMLtoJava(getXML("Texts", "test2"), TextBlock.class); } public StringWriter getXML(String sublibrary, String object) { StringWriter returnWriter = null; // check if library includes e or i, else check both librarys, external // has priority (mod overwrites interal data) if (Character.isLowerCase(sublibrary.charAt(0)) && (sublibrary.charAt(0) == 'e' || sublibrary.charAt(0) == 'i')) { returnWriter = library.get(sublibrary).get(object); } else { StringWriter internal = null; StringWriter external = null; internal = checkLibrary("i" + sublibrary, object); external = checkLibrary("e" + sublibrary, object); if (external != null) { returnWriter = external; } else { returnWriter = internal; } } return returnWriter; } public TreeMap<String, StringWriter> getAllXML(String sublibrary) { TreeMap<String, StringWriter> returnTree = new TreeMap<String, StringWriter>(); if (Character.isLowerCase(sublibrary.charAt(0)) && (sublibrary.charAt(0) == 'e' || sublibrary.charAt(0) == 'i')) { Iterator<String> keySetIterator = library.get(sublibrary).keySet().iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); returnTree.put(key, library.get(sublibrary).get(key)); } } else { Iterator<String> keySetIterator = library.get("i" + sublibrary).keySet().iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); returnTree.put(key, library.get("i" + sublibrary).get(key)); } Iterator<String> keySetIterator2 = library.get("e" + sublibrary).keySet().iterator(); while (keySetIterator2.hasNext()) { String key = keySetIterator2.next(); returnTree.put(key, library.get("e" + sublibrary).get(key)); } } return returnTree; } public StringWriter checkLibrary(String sublibrary, String object) { StringWriter returnXML = null; TreeMap<String, StringWriter> subLibraryTreeMap = library.get(sublibrary); if (subLibraryTreeMap != null) { returnXML = subLibraryTreeMap.get(object); } return returnXML; } private Object spawn(String library, String object, Class<?> contextClass) { Object newUnit = null; StringWriter xmlOfUnit = getXML(library, object); if (xmlOfUnit != null) { newUnit = jxml.XMLtoJava(xmlOfUnit, contextClass); } return newUnit; } }
8,719
0.681959
0.678059
251
32.737053
25.80826
116
false
false
0
0
0
0
0
0
2.89243
false
false
2
a4e55dbaf8aaf06226ecf755d161b3d171028634
9,122,510,584,259
3484c9c31aade96577cb450d9e19556dc18b338d
/bsk-admin/src/test/java/com/bsk/aop/IInterceptor.java
34b925b62c587c52b974a4721aa405f7bda9145d
[]
no_license
b6688c/bsk-plus
https://github.com/b6688c/bsk-plus
dc0f05cffd485b044d110e1fa015107c9b24e86c
a34356703d7e16803a077091007bbc3fe665a903
refs/heads/main
2022-12-30T02:31:31.507000
2020-10-18T08:29:59
2020-10-18T08:29:59
305,048,733
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bsk.aop; import java.lang.reflect.InvocationTargetException; public class IInterceptor implements Interceptor { @Override public boolean before() { System.out.println("执行前置方法"); return true; } @Override public void after() { System.out.println("执行后之方法"); } @Override public Object around(Invocation invocation) throws InvocationTargetException, IllegalAccessException { return invocation.proceed(); } @Override public boolean userAround() { return true; } @Override public void afterReturning() { System.out.println("后处理"); } @Override public void afterThrowing() { System.out.println("处理异常"); } }
UTF-8
Java
783
java
IInterceptor.java
Java
[]
null
[]
package com.bsk.aop; import java.lang.reflect.InvocationTargetException; public class IInterceptor implements Interceptor { @Override public boolean before() { System.out.println("执行前置方法"); return true; } @Override public void after() { System.out.println("执行后之方法"); } @Override public Object around(Invocation invocation) throws InvocationTargetException, IllegalAccessException { return invocation.proceed(); } @Override public boolean userAround() { return true; } @Override public void afterReturning() { System.out.println("后处理"); } @Override public void afterThrowing() { System.out.println("处理异常"); } }
783
0.637584
0.637584
36
19.694445
21.051287
106
false
false
0
0
0
0
0
0
0.277778
false
false
2
ab3dbd36d35f057774551e3a90b5aaaf85756402
5,214,090,360,082
df417fb19fb3b535c946f6333d8e0fa1c931c145
/Winter_Base/src/week2/Code_2558.java
d0333f4e203dae365fe9c14b2c545471168e2175
[]
no_license
kje6445/algorithm
https://github.com/kje6445/algorithm
47570f3c8d4ebda2730880261dc686745a25e976
39bc878b512dad8771d82a7aab9a83ed0d6c70b3
refs/heads/master
2021-06-26T20:13:57.040000
2019-07-26T06:39:49
2019-07-26T06:39:49
150,244,604
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package week2; import java.util.Scanner; /*A+B - 2 문제 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 A, 둘째 줄에 B가 주어진다. (0 < A, B < 10) 출력 첫째 줄에 A+B를 출력한다. 예제 입력 1 복사 1 2 예제 출력 1 복사 3*/ public class Code_2558 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int A,B; A=sc.nextInt(); B=sc.nextInt(); if((0<A)&&(A<10)&&(0<B)&&(B<10)) System.out.println(A+B); else if((A<=0)||(A<=10)){ System.out.println("A의 범위를 다시 입력하시오."); }else { System.out.println("B의 범위를 다시 입력하시오"); } } }
UTF-8
Java
759
java
Code_2558.java
Java
[]
null
[]
package week2; import java.util.Scanner; /*A+B - 2 문제 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 A, 둘째 줄에 B가 주어진다. (0 < A, B < 10) 출력 첫째 줄에 A+B를 출력한다. 예제 입력 1 복사 1 2 예제 출력 1 복사 3*/ public class Code_2558 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int A,B; A=sc.nextInt(); B=sc.nextInt(); if((0<A)&&(A<10)&&(0<B)&&(B<10)) System.out.println(A+B); else if((A<=0)||(A<=10)){ System.out.println("A의 범위를 다시 입력하시오."); }else { System.out.println("B의 범위를 다시 입력하시오"); } } }
759
0.598628
0.559177
34
16.147058
15.495981
42
false
false
0
0
0
0
0
0
1.205882
false
false
2
bd4c0396f5ca6f2dca8fb7d4b4b95baa8a7ce8d5
15,625,091,077,017
5d06711dbe210fce6cea7da4f6032e02ca85e00a
/src/main/java/com/course/cases/UpdateUserInfoTest.java
c64731de92ad1c56fa7e46209ff5680017edec11
[]
no_license
crazyzzzz/userInfoTest
https://github.com/crazyzzzz/userInfoTest
4491ecd2553baae8d9ffe5b100621236883e8177
52a0abfae8b0385be8b4eac6c8a50abc187cabe3
refs/heads/master
2020-04-12T11:18:51.191000
2018-12-19T16:08:18
2018-12-19T16:08:18
162,455,311
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.course.cases; import java.io.IOException; import org.apache.ibatis.session.SqlSession; import org.testng.annotations.Test; import com.course.config.TestConfig; import com.course.model.AddUserCase; import com.course.model.UpdateUserInfoCase; import com.course.utils.DatabaseUtil; public class UpdateUserInfoTest { @Test(dependsOnGroups = "loginTrue", description = "更改用户信息") public void updateUserInfo() throws IOException { SqlSession SqlSession = DatabaseUtil.getSqlSession(); UpdateUserInfoCase updateUserInfoCase = SqlSession.selectOne("updateUserInfoCase", 1); System.out.println(updateUserInfoCase.toString()); System.out.println(TestConfig.updateUserInfoUrl); } @Test(dependsOnGroups = "loginTrue", description = "删除用户信息") public void deleteUserInfo() throws IOException { SqlSession SqlSession = DatabaseUtil.getSqlSession(); UpdateUserInfoCase updateUserInfoCase = SqlSession.selectOne("updateUserInfoCase", 2); System.out.println(updateUserInfoCase.toString()); System.out.println(TestConfig.updateUserInfoUrl); } }
UTF-8
Java
1,187
java
UpdateUserInfoTest.java
Java
[]
null
[]
package com.course.cases; import java.io.IOException; import org.apache.ibatis.session.SqlSession; import org.testng.annotations.Test; import com.course.config.TestConfig; import com.course.model.AddUserCase; import com.course.model.UpdateUserInfoCase; import com.course.utils.DatabaseUtil; public class UpdateUserInfoTest { @Test(dependsOnGroups = "loginTrue", description = "更改用户信息") public void updateUserInfo() throws IOException { SqlSession SqlSession = DatabaseUtil.getSqlSession(); UpdateUserInfoCase updateUserInfoCase = SqlSession.selectOne("updateUserInfoCase", 1); System.out.println(updateUserInfoCase.toString()); System.out.println(TestConfig.updateUserInfoUrl); } @Test(dependsOnGroups = "loginTrue", description = "删除用户信息") public void deleteUserInfo() throws IOException { SqlSession SqlSession = DatabaseUtil.getSqlSession(); UpdateUserInfoCase updateUserInfoCase = SqlSession.selectOne("updateUserInfoCase", 2); System.out.println(updateUserInfoCase.toString()); System.out.println(TestConfig.updateUserInfoUrl); } }
1,187
0.733448
0.731728
29
38.103447
27.245176
94
false
false
0
0
0
0
0
0
0.689655
false
false
2
a2e5ccb1bdb00eda0f9a9e1ccfd6fb61cee7dd6d
32,564,442,055,659
fc460091313cce79b5710f5d323ab28085801fb2
/Distributed Networks/FinalProject3/PrimaryServer.java
0b215d6fa8fcbc50c55b9762702a67a52125fc92
[]
no_license
EvanDonald/Projects
https://github.com/EvanDonald/Projects
d219d3c021ff6a19c2858ff07a34f80a02ed2810
5f700ed288abf9b5bb47c8637dc0308f2efc9549
refs/heads/master
2020-07-22T21:40:38.315000
2019-09-09T15:30:44
2019-09-09T15:30:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.rmi.*; public class PrimaryServer { public static void main(String[] args) throws Exception { PrimaryServerInterface primaryServer = new PrimaryServerInterfaceImpl(); Naming.rebind("pserver", primaryServer); ServerInterface server = new ServerInterfaceImpl(); Naming.rebind("server", server); } }
UTF-8
Java
339
java
PrimaryServer.java
Java
[]
null
[]
import java.rmi.*; public class PrimaryServer { public static void main(String[] args) throws Exception { PrimaryServerInterface primaryServer = new PrimaryServerInterfaceImpl(); Naming.rebind("pserver", primaryServer); ServerInterface server = new ServerInterfaceImpl(); Naming.rebind("server", server); } }
339
0.722714
0.722714
13
24.076923
24.78356
74
false
false
0
0
0
0
0
0
1.538462
false
false
2
1e141623cf432e77414666d3d700963d8452a282
22,376,779,653,924
6f01681fc86a8bf066cc2c5b821f8bc09647eb05
/src/PopConfigPanel.java
d3ced77e960d6317bd717e186600b7ce86b15652
[]
no_license
pcrglennon/altruists-egoists
https://github.com/pcrglennon/altruists-egoists
225f84ff79963438d9dace09596d1e03fea0136a
4fee0540db13a8d5faeb69b75620718cb5511b56
refs/heads/master
2016-09-06T19:03:04.347000
2012-12-18T07:18:02
2012-12-18T07:18:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /** * Contains a number of textfields to configure a new population of agents, and * a button to reset the PopulationPanel with the new configuration options */ public class PopConfigPanel extends JPanel { private NumericTextField popSizeTF, altNumTF, avgAltSizeTF, numGenTF, searchSizeTF; private FloatTextField altCostTF; private JButton resetB; /** * Constructor - intializes the text fields and the reset button */ public PopConfigPanel() { super(); setPreferredSize(Config.POP_CONFIG_PANEL_PREF_SIZE); popSizeTF = new NumericTextField(2, "" + Config.DEF_POP_SIZE); altCostTF = new FloatTextField(3, "" + Config.DEF_ALT_COST); altNumTF = new NumericTextField(3, "" + Config.DEF_ALT_NUM); avgAltSizeTF = new NumericTextField(3, "" + Config.DEF_AVG_ALT_GROUP_SIZE); numGenTF = new NumericTextField(3, "" + Config.DEF_NUM_GEN); searchSizeTF = new NumericTextField(2, "" + Config.DEF_SEARCH_SIZE); setupResetB(); addComponentsToPanel(); } /** * Sets up the reset button, and assigns it to call resetPopulationPanel() * from the main window */ public void setupResetB() { resetB = new JButton("Reset"); resetB.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MainWindow mainWindow = (MainWindow)getTopLevelAncestor(); mainWindow.resetPopulationPanel(); } }); } /** * Returns an array of all the configuration options */ public double[] getConfigInfo() { double[] configInfo = {Double.parseDouble(popSizeTF.getText()), Double.parseDouble(altCostTF.getText()), Double.parseDouble(altNumTF.getText()), Double.parseDouble(avgAltSizeTF.getText()), Double.parseDouble(numGenTF.getText()), Double.parseDouble(searchSizeTF.getText())}; return configInfo; } /** * Validate all the inputs, and return a string representing all input errors * * Returns an empty string ("") if there are no errors */ public String checkInputs() { StringBuilder errors = new StringBuilder(); if(popSizeTF.getText().equals("")) { errors.append("Population Size: Text Field is Empty!\n"); } else if (Integer.parseInt(popSizeTF.getText()) < 3){ errors.append("Population Size: Must be 3 or larger!\n"); } if(altNumTF.getText().equals("")) { errors.append("Number of Altruists: Text Field is Empty!\n"); } if(avgAltSizeTF.getText().equals("")) { errors.append("Average Altruist Community Size: Text Field is Empty!\n"); } if(numGenTF.getText().equals("")) { errors.append("Number of Generations: Text Field is Empty!\n"); } errors.append(altCostTF.validateInput("Altruism Cost")); if(searchSizeTF.getText().equals("")) { errors.append("Search Size: Text Field is Empty!\n"); } return errors.toString(); } /** * Add each textfield (and a label marking the textfield) to the panel */ private void addComponentsToPanel() { setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); Insets padding = new Insets(15, 0, 0, 0); c.insets = padding; c.gridx = 0; c.gridy = 0; add(new JLabel("Pop. Size: "), c); c.gridx = 1; c.gridy = 0; add(popSizeTF, c); c.gridx = 0; c.gridy = 1; add(new JLabel("# Generations: "), c); c.gridx = 1; c.gridy = 1; add(numGenTF, c); c.gridx = 0; c.gridy = 2; add(new JLabel("# Altruists: "), c); c.gridx = 1; c.gridy = 2; add(altNumTF, c); c.gridx = 0; c.gridy = 3; add(new JLabel("Avg. Alt. Grp. Size: "), c); c.gridx = 1; c.gridy = 3; add(avgAltSizeTF, c); c.gridx = 0; c.gridy = 5; add(new JLabel("Altruism Cost: "), c); c.gridx = 1; c.gridy = 5; add(altCostTF, c); c.gridx = 0; c.gridy = 6; add(new JLabel("Search Size: "), c); c.gridx = 1; c.gridy = 6; add(searchSizeTF, c); c.gridwidth = 2; c.gridx = 0; c.gridy = 7; add(resetB, c); } }
UTF-8
Java
4,083
java
PopConfigPanel.java
Java
[]
null
[]
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /** * Contains a number of textfields to configure a new population of agents, and * a button to reset the PopulationPanel with the new configuration options */ public class PopConfigPanel extends JPanel { private NumericTextField popSizeTF, altNumTF, avgAltSizeTF, numGenTF, searchSizeTF; private FloatTextField altCostTF; private JButton resetB; /** * Constructor - intializes the text fields and the reset button */ public PopConfigPanel() { super(); setPreferredSize(Config.POP_CONFIG_PANEL_PREF_SIZE); popSizeTF = new NumericTextField(2, "" + Config.DEF_POP_SIZE); altCostTF = new FloatTextField(3, "" + Config.DEF_ALT_COST); altNumTF = new NumericTextField(3, "" + Config.DEF_ALT_NUM); avgAltSizeTF = new NumericTextField(3, "" + Config.DEF_AVG_ALT_GROUP_SIZE); numGenTF = new NumericTextField(3, "" + Config.DEF_NUM_GEN); searchSizeTF = new NumericTextField(2, "" + Config.DEF_SEARCH_SIZE); setupResetB(); addComponentsToPanel(); } /** * Sets up the reset button, and assigns it to call resetPopulationPanel() * from the main window */ public void setupResetB() { resetB = new JButton("Reset"); resetB.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MainWindow mainWindow = (MainWindow)getTopLevelAncestor(); mainWindow.resetPopulationPanel(); } }); } /** * Returns an array of all the configuration options */ public double[] getConfigInfo() { double[] configInfo = {Double.parseDouble(popSizeTF.getText()), Double.parseDouble(altCostTF.getText()), Double.parseDouble(altNumTF.getText()), Double.parseDouble(avgAltSizeTF.getText()), Double.parseDouble(numGenTF.getText()), Double.parseDouble(searchSizeTF.getText())}; return configInfo; } /** * Validate all the inputs, and return a string representing all input errors * * Returns an empty string ("") if there are no errors */ public String checkInputs() { StringBuilder errors = new StringBuilder(); if(popSizeTF.getText().equals("")) { errors.append("Population Size: Text Field is Empty!\n"); } else if (Integer.parseInt(popSizeTF.getText()) < 3){ errors.append("Population Size: Must be 3 or larger!\n"); } if(altNumTF.getText().equals("")) { errors.append("Number of Altruists: Text Field is Empty!\n"); } if(avgAltSizeTF.getText().equals("")) { errors.append("Average Altruist Community Size: Text Field is Empty!\n"); } if(numGenTF.getText().equals("")) { errors.append("Number of Generations: Text Field is Empty!\n"); } errors.append(altCostTF.validateInput("Altruism Cost")); if(searchSizeTF.getText().equals("")) { errors.append("Search Size: Text Field is Empty!\n"); } return errors.toString(); } /** * Add each textfield (and a label marking the textfield) to the panel */ private void addComponentsToPanel() { setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); Insets padding = new Insets(15, 0, 0, 0); c.insets = padding; c.gridx = 0; c.gridy = 0; add(new JLabel("Pop. Size: "), c); c.gridx = 1; c.gridy = 0; add(popSizeTF, c); c.gridx = 0; c.gridy = 1; add(new JLabel("# Generations: "), c); c.gridx = 1; c.gridy = 1; add(numGenTF, c); c.gridx = 0; c.gridy = 2; add(new JLabel("# Altruists: "), c); c.gridx = 1; c.gridy = 2; add(altNumTF, c); c.gridx = 0; c.gridy = 3; add(new JLabel("Avg. Alt. Grp. Size: "), c); c.gridx = 1; c.gridy = 3; add(avgAltSizeTF, c); c.gridx = 0; c.gridy = 5; add(new JLabel("Altruism Cost: "), c); c.gridx = 1; c.gridy = 5; add(altCostTF, c); c.gridx = 0; c.gridy = 6; add(new JLabel("Search Size: "), c); c.gridx = 1; c.gridy = 6; add(searchSizeTF, c); c.gridwidth = 2; c.gridx = 0; c.gridy = 7; add(resetB, c); } }
4,083
0.668381
0.658584
154
25.51948
30.742167
274
false
false
0
0
0
0
0
0
1.337662
false
false
2
6b4281ebfc9c8224c5497d22d07ab6d4d9d29a7d
3,607,772,595,244
971a85d8c3bb4d604f0038ad1a1b710d711bcae5
/TopCoder/src/com/topcoder/srm/srm623/CatAndRat.java
2ee84c2fd0a3bec60483d8a84a248c35af6239a6
[]
no_license
harmishlakhani/AlgoAndDataStructure
https://github.com/harmishlakhani/AlgoAndDataStructure
f636a5759b6c956e0f992cf59471daf373b039b1
e18dbd9ffb64d36c0b17d792c69b1b55f90207ce
refs/heads/master
2021-01-10T21:16:05.371000
2015-10-19T13:16:21
2015-10-19T13:16:21
21,704,289
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.topcoder.srm.srm623; public class CatAndRat { public double getTime(int R, int T, int Vrat, int Vcat) { return 0; } public static void main(String[] args) { CatAndRat obj = new CatAndRat(); System.out.println(obj.getTime(0,0,0,0)); } }
UTF-8
Java
271
java
CatAndRat.java
Java
[]
null
[]
package com.topcoder.srm.srm623; public class CatAndRat { public double getTime(int R, int T, int Vrat, int Vcat) { return 0; } public static void main(String[] args) { CatAndRat obj = new CatAndRat(); System.out.println(obj.getTime(0,0,0,0)); } }
271
0.660517
0.630996
16
15.9375
18.935644
58
false
false
0
0
0
0
0
0
1.6875
false
false
2
f1341fd591455b6a5dd545b24425c93081c08c2c
25,563,645,403,817
17ce1286bd36fa626c247aeb81ddd422b714ecc2
/Project3/MonteCarloNCubeBase1TestPart2.java
58153f33cf531505f1cdd5c099737cd945efacc4
[]
no_license
BichengWang/CS206P_ScientificComputering
https://github.com/BichengWang/CS206P_ScientificComputering
af20eb313d0ff54176026726aee3ab004c9f82cb
0fad4db58377ad7bdfe1676b00651c0a32a5f30a
refs/heads/master
2020-04-05T08:39:07.749000
2018-11-08T14:58:20
2018-11-08T14:58:20
156,723,172
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package MonteCarloNCubeBase1; import java.util.Random; import Helper.Answer; import Helper.MonteCarloMultiHelper; public class MonteCarloNCubeBase1TestPart2 { static Random r = new Random(); public static void main(String[] args) { for (int i = 2; i < 40; i++) { System.out.println("d=" + i); double res1 = MonteCarloIntegration(i); double res2 = CubebasedIntegration(i); double answer = Answer.answer(i); double rerror1 = Math.abs(res1 - answer) / answer; double rerror2 = Math.abs(res2 - answer) / answer; double absolutediff = res1 - res2; System.out.println( "absolute diff:" + Math.abs(absolutediff) + " relative diff:" + Math.abs(absolutediff / answer)); System.out.println("Monte Carlo Integration relative error:" + Math.abs(rerror1)); System.out.println("Cube based Integration relative error:" + Math.abs(rerror2)); System.out.println("Res 1:" + res1); System.out.println("answer:" + answer); System.out.println(); } } private static double MonteCarloIntegration(int d) { long sampleCount = 1000000; int threadnum = 16; long[] temp = new long[threadnum]; double[] halftemp = new double[threadnum]; MonteCarloMultiHelper[] ths = new MonteCarloMultiHelper[threadnum]; for (int i = 0; i < threadnum; i++) { ths[i] = new MonteCarloMultiHelper(i, temp, d, sampleCount / threadnum, halftemp); ths[i].start(); } for (MonteCarloMultiHelper th : ths) { try { th.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } long count = 0; for (long i : temp) { count += i; } double half = 0; for (double i : halftemp) { half += i; } System.out.println("count: " + count); double res = ((double) count + half / 2) / (double) sampleCount * Math.pow(2, d); return res; } private static double CubebasedIntegration(int d) { int sampleCount = (int) Math.round(Math.pow(1000000, (double) 1.0 / (double) d)); int sampleCountError = (int) Math.abs(1000000 - Math.pow(sampleCount, d)); System.out.println("Cube based Integration sample count:" + Math.pow(sampleCount, d) + " sample count error:" + sampleCountError); long[] count = new long[1]; double[] half = new double[1]; helper(0, d, count, sampleCount, half); double res = ((double) count[0] + half[0] / 2) / (double) Math.pow(sampleCount, d) * Math.pow(2, d); return res; } private static void helper(double sum, int remain, long[] count, long sampleCount, double[] half) { if (sum > 1) return; if (remain == 0) { if (sum < 1) { count[0]++; } if (sum == 1) { half[0]++; } return; } double unit = (double) 1.0 / sampleCount; for (int j = 0; j < sampleCount; j++) { double temp = j * unit; helper(sum + temp * temp, remain - 1, count, sampleCount, half); } } }
UTF-8
Java
2,853
java
MonteCarloNCubeBase1TestPart2.java
Java
[]
null
[]
package MonteCarloNCubeBase1; import java.util.Random; import Helper.Answer; import Helper.MonteCarloMultiHelper; public class MonteCarloNCubeBase1TestPart2 { static Random r = new Random(); public static void main(String[] args) { for (int i = 2; i < 40; i++) { System.out.println("d=" + i); double res1 = MonteCarloIntegration(i); double res2 = CubebasedIntegration(i); double answer = Answer.answer(i); double rerror1 = Math.abs(res1 - answer) / answer; double rerror2 = Math.abs(res2 - answer) / answer; double absolutediff = res1 - res2; System.out.println( "absolute diff:" + Math.abs(absolutediff) + " relative diff:" + Math.abs(absolutediff / answer)); System.out.println("Monte Carlo Integration relative error:" + Math.abs(rerror1)); System.out.println("Cube based Integration relative error:" + Math.abs(rerror2)); System.out.println("Res 1:" + res1); System.out.println("answer:" + answer); System.out.println(); } } private static double MonteCarloIntegration(int d) { long sampleCount = 1000000; int threadnum = 16; long[] temp = new long[threadnum]; double[] halftemp = new double[threadnum]; MonteCarloMultiHelper[] ths = new MonteCarloMultiHelper[threadnum]; for (int i = 0; i < threadnum; i++) { ths[i] = new MonteCarloMultiHelper(i, temp, d, sampleCount / threadnum, halftemp); ths[i].start(); } for (MonteCarloMultiHelper th : ths) { try { th.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } long count = 0; for (long i : temp) { count += i; } double half = 0; for (double i : halftemp) { half += i; } System.out.println("count: " + count); double res = ((double) count + half / 2) / (double) sampleCount * Math.pow(2, d); return res; } private static double CubebasedIntegration(int d) { int sampleCount = (int) Math.round(Math.pow(1000000, (double) 1.0 / (double) d)); int sampleCountError = (int) Math.abs(1000000 - Math.pow(sampleCount, d)); System.out.println("Cube based Integration sample count:" + Math.pow(sampleCount, d) + " sample count error:" + sampleCountError); long[] count = new long[1]; double[] half = new double[1]; helper(0, d, count, sampleCount, half); double res = ((double) count[0] + half[0] / 2) / (double) Math.pow(sampleCount, d) * Math.pow(2, d); return res; } private static void helper(double sum, int remain, long[] count, long sampleCount, double[] half) { if (sum > 1) return; if (remain == 0) { if (sum < 1) { count[0]++; } if (sum == 1) { half[0]++; } return; } double unit = (double) 1.0 / sampleCount; for (int j = 0; j < sampleCount; j++) { double temp = j * unit; helper(sum + temp * temp, remain - 1, count, sampleCount, half); } } }
2,853
0.64644
0.623641
94
29.329786
27.364906
111
false
false
0
0
0
0
0
0
2.840425
false
false
2
f8482c574903b5a986c7fcbf59638d62b447f532
8,564,164,858,287
e42115661278e55d337bb8c90a807eafa94cfbe6
/src/main/java/com/study/mapper/TzFilterfldOperatorMapper.java
3aa3dd6d8b9301c01f3147ad22a59e69b1a2b5ff
[]
no_license
17703595860/oasis-project-mapper
https://github.com/17703595860/oasis-project-mapper
1fcda7542326142b1ece3b14d1705eeaba6fdd0f
5df2879b0a329a8071226f1f7665b53a9d50735e
refs/heads/master
2023-05-23T12:21:34.728000
2021-06-06T23:02:24
2021-06-06T23:02:24
360,476,691
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.mapper; import com.study.entity.TzFilterfldOperator; import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.ids.SelectByIdsMapper; public interface TzFilterfldOperatorMapper extends Mapper<TzFilterfldOperator>, SelectByIdsMapper<TzFilterfldOperator> { }
UTF-8
Java
290
java
TzFilterfldOperatorMapper.java
Java
[]
null
[]
package com.study.mapper; import com.study.entity.TzFilterfldOperator; import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.ids.SelectByIdsMapper; public interface TzFilterfldOperatorMapper extends Mapper<TzFilterfldOperator>, SelectByIdsMapper<TzFilterfldOperator> { }
290
0.855172
0.855172
8
35.375
37.729092
120
false
false
0
0
0
0
0
0
0.625
false
false
2
aa82869eb6c2391b79dcef4db8acb15747f08ac1
31,585,189,544,442
1b8420be8df38f52bc52d00695ec9b922ddb53cd
/src/main/java/cn/chenxins/cms/model/json/UserPageJsonOut.java
388d102a308d8f64ae4f50a1f144a081c31e67af
[]
no_license
jandy0414/lincms-java
https://github.com/jandy0414/lincms-java
c66a02404bdc5b46ac3d33eefc36693decd67e38
7fefc593ea4d11d082de544ef23ef5374e9ed10d
refs/heads/master
2020-04-20T14:22:50.053000
2019-03-06T07:05:03
2019-03-06T07:05:03
168,896,327
11
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.chenxins.cms.model.json; import java.util.List; public class UserPageJsonOut { private Integer total_nums; private List<UserJsonOut> collection; public UserPageJsonOut(Integer total_nums, List<UserJsonOut> collection) { this.total_nums = total_nums; this.collection = collection; } public Integer getTotal_nums() { return total_nums; } public void setTotal_nums(Integer total_nums) { this.total_nums = total_nums; } public List<UserJsonOut> getCollection() { return collection; } public void setCollection(List<UserJsonOut> collection) { this.collection = collection; } }
UTF-8
Java
688
java
UserPageJsonOut.java
Java
[]
null
[]
package cn.chenxins.cms.model.json; import java.util.List; public class UserPageJsonOut { private Integer total_nums; private List<UserJsonOut> collection; public UserPageJsonOut(Integer total_nums, List<UserJsonOut> collection) { this.total_nums = total_nums; this.collection = collection; } public Integer getTotal_nums() { return total_nums; } public void setTotal_nums(Integer total_nums) { this.total_nums = total_nums; } public List<UserJsonOut> getCollection() { return collection; } public void setCollection(List<UserJsonOut> collection) { this.collection = collection; } }
688
0.665698
0.665698
31
21.193548
21.326069
78
false
false
0
0
0
0
0
0
0.354839
false
false
2
ecc0068cb33d10ba59353cd4dcc1fac9316e95ec
16,406,775,075,383
08b055ce7568775d27a1860e36c40d0b3541ea05
/src/main/java/top/izayoirinn/service/impl/GoodsServiceImpl.java
a2d991a181bba1a74f2e1cb54fe0ffff26504ee9
[]
no_license
izayoiyurin/kill_shop_demo
https://github.com/izayoiyurin/kill_shop_demo
b43d17c1e9e79c1b1f4d2405bf3b082ac3f1bf4f
b9400777a37844066052be2f586bbdb40a3ff226
refs/heads/master
2023-06-28T05:53:18.570000
2021-07-25T06:28:28
2021-07-25T06:28:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package top.izayoirinn.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import top.izayoirinn.domain.Goods; import top.izayoirinn.service.GoodsService; import top.izayoirinn.mapper.GoodsMapper; import org.springframework.stereotype.Service; /** * */ @Service public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService{ }
UTF-8
Java
398
java
GoodsServiceImpl.java
Java
[]
null
[]
package top.izayoirinn.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import top.izayoirinn.domain.Goods; import top.izayoirinn.service.GoodsService; import top.izayoirinn.mapper.GoodsMapper; import org.springframework.stereotype.Service; /** * */ @Service public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService{ }
398
0.816583
0.816583
16
23.625
23.913582
69
false
false
0
0
0
0
0
0
0.4375
false
false
2
3e6f2c07ac7fa2981053b2a9cdcb5e1913cd0bee
9,045,201,193,482
827333388b19aa4e096d3687bf328be36a75d8d3
/app/src/main/java/com/example/sindhu/tollgate2/MainActivity.java
7a6c2d92be46e4895fa2135e7810846986873865
[]
no_license
Shreelekhya/TollGate2
https://github.com/Shreelekhya/TollGate2
efc0a0f245d1d520fba26fa6592c0c89658b63b4
f0073f651178c5ebcdd02ba11811d87ab46b6bb2
refs/heads/master
2021-01-19T08:33:10.271000
2017-04-08T16:02:25
2017-04-08T16:02:25
87,646,002
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.sindhu.tollgate2; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void Signin(View view) { Intent intent=new Intent(this, Signin.class); startActivity(intent); } public void Signup(View view) { Intent intent1=new Intent(this, Signup.class); startActivity(intent1); } public void adminlogin(View view) { Intent intent2=new Intent(this, AdminLogin.class); startActivity(intent2); } }
UTF-8
Java
803
java
MainActivity.java
Java
[ { "context": "package com.example.sindhu.tollgate2;\n\nimport android.content.Intent;\nimport", "end": 26, "score": 0.9702475070953369, "start": 20, "tag": "USERNAME", "value": "sindhu" } ]
null
[]
package com.example.sindhu.tollgate2; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void Signin(View view) { Intent intent=new Intent(this, Signin.class); startActivity(intent); } public void Signup(View view) { Intent intent1=new Intent(this, Signup.class); startActivity(intent1); } public void adminlogin(View view) { Intent intent2=new Intent(this, AdminLogin.class); startActivity(intent2); } }
803
0.691158
0.683686
30
25.766666
19.758009
58
false
false
0
0
0
0
0
0
0.533333
false
false
2
7e13acfec00ff2a3e0bd07524619acd91e5be0d7
27,230,092,690,728
7e3961feb86331772f56c3c9632ec6de8225eafd
/fb/WildcardMatching.java
4adf526bddbecb8f9f6f26380c2b296d120da257
[]
no_license
jialuyyy/Leetcode
https://github.com/jialuyyy/Leetcode
0b11dbd328aef7fb18e397311e9bc27fdc58a5f2
16fc35ed0756db56db40782a45224ee2151c1160
refs/heads/master
2021-01-23T12:58:25.139000
2020-02-26T13:44:55
2020-02-26T13:44:55
93,215,029
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
//dp[i][j] denotes whether substring from 0 to i in s matches substring from 0 to j in p // if p.charAt(j - 1) == s.charAt(i - 1) || p.charAt(j - 1) == '?', dp[i][j] = dp[i - 1][j - 1] // if p.charAt(j - 1) == '*', dp[i][j] = dp[i - 1][j] || dp[i][j - 1], dp[i - 1][j], means '*' matches the character i - 1 in s, and dp[i][j - 1] //means '*' matches empty //else dp[i][j] = false public class WildcardMatching { public boolean isMatch(String s, String p) { if (s == null || p == null) { return false; } int sLen = s.length(); int pLen = p.length(); boolean[][] dp = new boolean[sLen + 1][pLen + 1]; dp[0][0] = true; for (int i = 1; i <= pLen; i++) { if (p.charAt(i - 1) == '*') { dp[0][i] = dp[0][i - 1]; } } for (int i = 1; i <= sLen; i++) { for (int j = 1; j <= pLen; j++) { if (p.charAt(j - 1) == '*') { dp[i][j] = dp[i][j - 1] || dp[i - 1][j]; } else if (p.charAt(j - 1) == '?' || p.charAt(j - 1) == s.charAt(i - 1)) { dp[i][j] = dp[i - 1][j - 1]; } else { dp[i][j] = false; } } } return dp[sLen][pLen]; } }
UTF-8
Java
1,357
java
WildcardMatching.java
Java
[]
null
[]
//dp[i][j] denotes whether substring from 0 to i in s matches substring from 0 to j in p // if p.charAt(j - 1) == s.charAt(i - 1) || p.charAt(j - 1) == '?', dp[i][j] = dp[i - 1][j - 1] // if p.charAt(j - 1) == '*', dp[i][j] = dp[i - 1][j] || dp[i][j - 1], dp[i - 1][j], means '*' matches the character i - 1 in s, and dp[i][j - 1] //means '*' matches empty //else dp[i][j] = false public class WildcardMatching { public boolean isMatch(String s, String p) { if (s == null || p == null) { return false; } int sLen = s.length(); int pLen = p.length(); boolean[][] dp = new boolean[sLen + 1][pLen + 1]; dp[0][0] = true; for (int i = 1; i <= pLen; i++) { if (p.charAt(i - 1) == '*') { dp[0][i] = dp[0][i - 1]; } } for (int i = 1; i <= sLen; i++) { for (int j = 1; j <= pLen; j++) { if (p.charAt(j - 1) == '*') { dp[i][j] = dp[i][j - 1] || dp[i - 1][j]; } else if (p.charAt(j - 1) == '?' || p.charAt(j - 1) == s.charAt(i - 1)) { dp[i][j] = dp[i - 1][j - 1]; } else { dp[i][j] = false; } } } return dp[sLen][pLen]; } }
1,357
0.375092
0.351511
38
34.710526
29.410799
145
false
false
0
0
0
0
0
0
0.842105
false
false
2
ff1059f9918defa55d884c30af138a93c01db83c
33,509,334,866,517
635534b55adb91a1736c2464755df09bbbcb580b
/server/src/main/java/de/blinkt/openvpn/BindStatus.java
25c0786f8895f05df67a07a75ed660c742d0a710
[ "Apache-2.0" ]
permissive
CMingTseng/SimpleOpenVpn-Android
https://github.com/CMingTseng/SimpleOpenVpn-Android
a45f5517b896075c56325882205e692918ebf8d7
b65830a4b21851514a7227983715e1e71aec6914
refs/heads/master
2021-01-03T04:19:12.149000
2020-02-14T03:39:25
2020-02-14T03:39:25
240,418,453
0
1
Apache-2.0
true
2020-02-14T03:15:16
2020-02-14T03:15:15
2020-02-04T09:51:45
2019-11-01T03:06:52
7,533
0
0
0
null
false
false
package de.blinkt.openvpn; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by sunwanquan on 2019/8/13. * * ∧_∧ * (`・ω・∥ * 丶 つ0 * しーJ * 此处无Bug */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @Documented @Inherited public @interface BindStatus { }
UTF-8
Java
516
java
BindStatus.java
Java
[ { "context": "rt java.lang.annotation.Target;\n\n/**\n * Created by sunwanquan on 2019/8/13.\n * * ∧_∧\n * (`・ω・∥\n * 丶 つ0\n * しーJ\n ", "end": 297, "score": 0.9997050762176514, "start": 287, "tag": "USERNAME", "value": "sunwanquan" } ]
null
[]
package de.blinkt.openvpn; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by sunwanquan on 2019/8/13. * * ∧_∧ * (`・ω・∥ * 丶 つ0 * しーJ * 此处无Bug */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @Documented @Inherited public @interface BindStatus { }
516
0.755694
0.73913
23
19.956522
15.669073
44
false
false
0
0
0
0
0
0
0.304348
false
false
2
76a91f25bd5d61c357c1925cef6cf460a623760c
20,822,001,486,515
44ea23b6b395d096175a3473a77322d9e230c199
/yjsy-model/src/main/java/edu/ecnu/yjsy/model/auth/PageRepository.java
da5e9ecff6ee160da778d2352c14ca7025cefa0a
[]
no_license
zhufeng8407/yjsy
https://github.com/zhufeng8407/yjsy
0c1da4173cfff13ace7a69871a60cd2b76c75e95
472c67a8ecd7b67e37c36604030338521df106ec
refs/heads/master
2021-01-18T03:42:51.128000
2017-03-22T07:23:03
2017-03-22T07:23:03
85,796,324
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.ecnu.yjsy.model.auth; import java.util.List; import java.util.Set; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.transaction.annotation.Transactional; import edu.ecnu.yjsy.model.view.auth.PageSummary; @Transactional(readOnly = true) @RepositoryRestResource(exported = false) public interface PageRepository extends JpaRepository<Page, Long> { @Query("select page.id as id, page.parentPageID as parentPageID, page.pageName as pageName, page.description as description, page.url as url , page.annotation as annotation from Page as page") public List<PageSummary> queryAll(); //@EntityGraph(value = "page.all", type = EntityGraphType.FETCH) public Page findOneById(long id); @EntityGraph(value = "page.restAPIs", type = EntityGraphType.FETCH) public Page findWithApisById(long id); @Query("from Page where pageName=?1 and url=?2") public Page findOne(String pageName, String url); @Query("from Page where pageName=?1") public Page findOne(String pageName); @Query(value = "select page from Page as page join page.restAPIs as mps where mps.id=?1") public Set<Page> findByMethodId(long methodId); @Query("select page from Page as page join page.roles as roles where roles.id=?1") public List<Page> findByRoleId(long roleId); @Query("select pageName from Page") public List<String> findPageName(); }
UTF-8
Java
1,693
java
PageRepository.java
Java
[]
null
[]
package edu.ecnu.yjsy.model.auth; import java.util.List; import java.util.Set; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.transaction.annotation.Transactional; import edu.ecnu.yjsy.model.view.auth.PageSummary; @Transactional(readOnly = true) @RepositoryRestResource(exported = false) public interface PageRepository extends JpaRepository<Page, Long> { @Query("select page.id as id, page.parentPageID as parentPageID, page.pageName as pageName, page.description as description, page.url as url , page.annotation as annotation from Page as page") public List<PageSummary> queryAll(); //@EntityGraph(value = "page.all", type = EntityGraphType.FETCH) public Page findOneById(long id); @EntityGraph(value = "page.restAPIs", type = EntityGraphType.FETCH) public Page findWithApisById(long id); @Query("from Page where pageName=?1 and url=?2") public Page findOne(String pageName, String url); @Query("from Page where pageName=?1") public Page findOne(String pageName); @Query(value = "select page from Page as page join page.restAPIs as mps where mps.id=?1") public Set<Page> findByMethodId(long methodId); @Query("select page from Page as page join page.roles as roles where roles.id=?1") public List<Page> findByRoleId(long roleId); @Query("select pageName from Page") public List<String> findPageName(); }
1,693
0.764914
0.761961
43
38.372093
37.174023
196
false
false
0
0
0
0
0
0
0.627907
false
false
2
ccfe3ab71422c95c451284f5f36afe556034a068
1,142,461,304,786
85b51b222bcbc932aa9ffbe97ad7d15150da50c3
/src/main/java/com/katalon/plugin/katashare/PluginMenuItemDescription.java
7f6212f8d4beab8b41355a00db489ff0da7a95b0
[]
no_license
katalon-studio/export-and-import-test-artifact-plugin
https://github.com/katalon-studio/export-and-import-test-artifact-plugin
5e0a23caa5f90899f085e931acbe921ae879e1ea
698dd3e0bfe7b59b541181a9530b5c28dc84a498
refs/heads/master
2023-08-17T12:02:37.524000
2019-09-12T09:13:46
2019-09-12T09:13:46
193,867,202
0
0
null
false
2023-07-22T09:19:59
2019-06-26T08:52:43
2023-03-31T08:52:10
2023-07-22T09:19:56
83
0
0
8
Java
false
false
package com.katalon.plugin.katashare; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import com.katalon.platform.api.extension.ToolItemWithMenuDescription; import com.katalon.plugin.katashare.composer.toolbar.handler.ExportTestArtifactHandler; import com.katalon.plugin.katashare.composer.toolbar.handler.ImportTestArtifactHandler; import com.katalon.plugin.katashare.constant.StringConstants; public class PluginMenuItemDescription implements ToolItemWithMenuDescription { private Menu menu; @Override public String toolItemId() { return "com.katalon.plugin.katashare.PluginMenuItemDescription"; } @Override public String name() { return "Katashare"; } @Override public String iconUrl() { return "platform:/plugin/" + StringConstants.PLUGIN_BUNDLE_ID + "/icons/import_TC_TO_32x24.png"; } @Override public Menu getMenu(Control parent) { menu = new Menu(parent); MenuItem exportTestArtifactMenuItem = new MenuItem(menu, SWT.PUSH); exportTestArtifactMenuItem.setText("Export Test Artifacts"); exportTestArtifactMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ExportTestArtifactHandler handler = new ExportTestArtifactHandler(e.widget.getDisplay().getActiveShell()); handler.execute(); } }); MenuItem importTestArtifactMenuItem = new MenuItem(menu, SWT.PUSH); importTestArtifactMenuItem.setText("Import Test Artifacts"); importTestArtifactMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ImportTestArtifactHandler handler = new ImportTestArtifactHandler(e.widget.getDisplay().getActiveShell()); handler.execute(); } }); return menu; } }
UTF-8
Java
2,177
java
PluginMenuItemDescription.java
Java
[]
null
[]
package com.katalon.plugin.katashare; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import com.katalon.platform.api.extension.ToolItemWithMenuDescription; import com.katalon.plugin.katashare.composer.toolbar.handler.ExportTestArtifactHandler; import com.katalon.plugin.katashare.composer.toolbar.handler.ImportTestArtifactHandler; import com.katalon.plugin.katashare.constant.StringConstants; public class PluginMenuItemDescription implements ToolItemWithMenuDescription { private Menu menu; @Override public String toolItemId() { return "com.katalon.plugin.katashare.PluginMenuItemDescription"; } @Override public String name() { return "Katashare"; } @Override public String iconUrl() { return "platform:/plugin/" + StringConstants.PLUGIN_BUNDLE_ID + "/icons/import_TC_TO_32x24.png"; } @Override public Menu getMenu(Control parent) { menu = new Menu(parent); MenuItem exportTestArtifactMenuItem = new MenuItem(menu, SWT.PUSH); exportTestArtifactMenuItem.setText("Export Test Artifacts"); exportTestArtifactMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ExportTestArtifactHandler handler = new ExportTestArtifactHandler(e.widget.getDisplay().getActiveShell()); handler.execute(); } }); MenuItem importTestArtifactMenuItem = new MenuItem(menu, SWT.PUSH); importTestArtifactMenuItem.setText("Import Test Artifacts"); importTestArtifactMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ImportTestArtifactHandler handler = new ImportTestArtifactHandler(e.widget.getDisplay().getActiveShell()); handler.execute(); } }); return menu; } }
2,177
0.703261
0.701424
60
35.283333
32.506969
122
false
false
0
0
0
0
0
0
0.483333
false
false
2
928e6bde93926f00aa8eb04f1c30e4355a7cdb8c
33,638,183,894,771
7676219c8f62532e94d6b948e5bb1bca30ccc5c6
/src/main/java/io/spring/wypok/common/MainActivityService.java
1f2c3936f14739aed3a5d89ad6ea806ea64f1f4e
[]
no_license
Kamil1599/wypok
https://github.com/Kamil1599/wypok
ffa7718454abee45e0b1f964f19e53031c74fd54
9e938404daf77f50c47c7fc97a7924b158b1da4a
refs/heads/master
2020-03-26T03:33:17.127000
2019-04-03T22:32:42
2019-04-03T22:35:11
144,460,273
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.spring.wypok.common; import io.spring.wypok.comment.Comment; import io.spring.wypok.comment.CommentService; import io.spring.wypok.user.UserService; import io.spring.wypok.vote.Vote; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; public abstract class MainActivityService<R extends MainActivity, T extends ActivityDto> extends BaseActivityService<R> { protected MainActivityRepository<R> repository; protected Mapper<R, T> mapper; protected CommentService<R> commentService; public void setCommentService(CommentService<R> commentService) { this.commentService = commentService; } public MainActivityService(MainActivityRepository<R> repository, UserService userService, Mapper<R, T> mapper) { super(repository, userService); this.repository = repository; this.mapper = mapper; } public Page<T> getPage(Pageable pageable) { Page<R> page = repository.findAll(pageable); setUserVotes(page.getContent()); return page.map(mapper::toDto); } public Page<T> getPageByVotesCountLast24h(Pageable pageable) { Timestamp from = Timestamp.valueOf(LocalDateTime.now().minusDays(1)); Timestamp to = Timestamp.valueOf(LocalDateTime.now()); Page<R> page = repository.findAllByPublishingDateBetweenOrderByVotesCountDesc(from, to, pageable); setUserVotes(page.getContent()); return page.map(mapper::toDto); } public List<T> getAllByUserId(Long id) { List<R> activities = repository.findAllByUserId(id); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getVotedByUser(Long userId) { List<Vote> votes = voteService.getVotes(userId); List<R> activities = repository.findAllById(votes.stream() .map(Vote::getActivityId) .collect(Collectors.toList())); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getAllByTagName(String tagName) { Set<R> activities = repository.findAllByTagNameList(Collections.singletonList(tagName)); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getAllByUserFollowedTags() { List<String> tagsNames = userService.getLoggedUser().getFollowedTagsAsListOfStrings(); if (tagsNames.size() == 0) { return Collections.emptyList(); } Set<R> activities = repository.findAllByTagNameList(tagsNames); setUserVotes(activities); return mapper.toDtoList(activities); } protected void setUserVotes(Collection<? extends MainActivity> activities) { super.findAndMatchUserVotes(activities); if (activities.size() != 0) { List<Comment> comments = new ArrayList<>(); activities.forEach(a -> comments.addAll(a.getComments())); commentService.findAndMatchUserVotes(comments); } } protected List<R> getActivitiesWithUserComments(Long userId) { List<Comment> comments = commentService.getUserComments(userId); List<R> activities = new ArrayList<>(); Map<Long, List<Comment>> activitiesIdsWithComments = new HashMap<>(); for (Comment comment : comments) { if (activitiesIdsWithComments.containsKey(comment.getActivityId())) { activitiesIdsWithComments.get(comment.getActivityId()).add(comment); } else { activitiesIdsWithComments.put(comment.getActivityId(), Arrays.asList(comment)); } } for (Map.Entry<Long, List<Comment>> e : activitiesIdsWithComments.entrySet()) { R activity = repository.getOne(e.getKey()); activity.setComments(e.getValue()); activities.add(activity); } activities.sort(Comparator.comparing(R::getPublishingDate).reversed().thenComparing(R::getId)); setUserVotes(activities); return activities; } }
UTF-8
Java
4,245
java
MainActivityService.java
Java
[]
null
[]
package io.spring.wypok.common; import io.spring.wypok.comment.Comment; import io.spring.wypok.comment.CommentService; import io.spring.wypok.user.UserService; import io.spring.wypok.vote.Vote; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; public abstract class MainActivityService<R extends MainActivity, T extends ActivityDto> extends BaseActivityService<R> { protected MainActivityRepository<R> repository; protected Mapper<R, T> mapper; protected CommentService<R> commentService; public void setCommentService(CommentService<R> commentService) { this.commentService = commentService; } public MainActivityService(MainActivityRepository<R> repository, UserService userService, Mapper<R, T> mapper) { super(repository, userService); this.repository = repository; this.mapper = mapper; } public Page<T> getPage(Pageable pageable) { Page<R> page = repository.findAll(pageable); setUserVotes(page.getContent()); return page.map(mapper::toDto); } public Page<T> getPageByVotesCountLast24h(Pageable pageable) { Timestamp from = Timestamp.valueOf(LocalDateTime.now().minusDays(1)); Timestamp to = Timestamp.valueOf(LocalDateTime.now()); Page<R> page = repository.findAllByPublishingDateBetweenOrderByVotesCountDesc(from, to, pageable); setUserVotes(page.getContent()); return page.map(mapper::toDto); } public List<T> getAllByUserId(Long id) { List<R> activities = repository.findAllByUserId(id); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getVotedByUser(Long userId) { List<Vote> votes = voteService.getVotes(userId); List<R> activities = repository.findAllById(votes.stream() .map(Vote::getActivityId) .collect(Collectors.toList())); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getAllByTagName(String tagName) { Set<R> activities = repository.findAllByTagNameList(Collections.singletonList(tagName)); setUserVotes(activities); return mapper.toDtoList(activities); } public List<T> getAllByUserFollowedTags() { List<String> tagsNames = userService.getLoggedUser().getFollowedTagsAsListOfStrings(); if (tagsNames.size() == 0) { return Collections.emptyList(); } Set<R> activities = repository.findAllByTagNameList(tagsNames); setUserVotes(activities); return mapper.toDtoList(activities); } protected void setUserVotes(Collection<? extends MainActivity> activities) { super.findAndMatchUserVotes(activities); if (activities.size() != 0) { List<Comment> comments = new ArrayList<>(); activities.forEach(a -> comments.addAll(a.getComments())); commentService.findAndMatchUserVotes(comments); } } protected List<R> getActivitiesWithUserComments(Long userId) { List<Comment> comments = commentService.getUserComments(userId); List<R> activities = new ArrayList<>(); Map<Long, List<Comment>> activitiesIdsWithComments = new HashMap<>(); for (Comment comment : comments) { if (activitiesIdsWithComments.containsKey(comment.getActivityId())) { activitiesIdsWithComments.get(comment.getActivityId()).add(comment); } else { activitiesIdsWithComments.put(comment.getActivityId(), Arrays.asList(comment)); } } for (Map.Entry<Long, List<Comment>> e : activitiesIdsWithComments.entrySet()) { R activity = repository.getOne(e.getKey()); activity.setComments(e.getValue()); activities.add(activity); } activities.sort(Comparator.comparing(R::getPublishingDate).reversed().thenComparing(R::getId)); setUserVotes(activities); return activities; } }
4,245
0.670671
0.669493
107
38.672897
28.440716
121
false
false
0
0
0
0
0
0
0.626168
false
false
2
783e253f66489d4a56891d0d35a218c5acdaac07
5,806,795,809,411
115fedc1c1ada07c846b4e0ddc9f59a3f55244e0
/src/main/java/io/github/zemelua/umu_guns/entity/ModEntities.java
a50e597430eac19e9eb1ec52105518743da20463
[]
no_license
Zemelua/UMU-Guns
https://github.com/Zemelua/UMU-Guns
ece79e79d8953d79bcf29d39f456efa198be713d
9697949d9ab5342cbe00855ea14d05e6aef9e815
refs/heads/main
2023-08-27T02:54:45.335000
2021-11-08T14:24:48
2021-11-08T14:24:48
424,902,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.zemelua.umu_guns.entity; import io.github.zemelua.umu_guns.UMUGuns; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public final class ModEntities { private static final DeferredRegister<EntityType<?>> REGISTRY = UMUGuns.registry(ForgeRegistries.ENTITIES); public static final RegistryObject<EntityType<BulletEntity>> BULLET = REGISTRY.register("bullet", () -> EntityType.Builder.<BulletEntity>of(BulletEntity::new, MobCategory.MISC) .sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20).build("bullet") ); private ModEntities() {} public static void initialize(IEventBus forgeBus, IEventBus modBus) { REGISTRY.register(modBus); } }
UTF-8
Java
933
java
ModEntities.java
Java
[ { "context": "package io.github.zemelua.umu_guns.entity;\n\nimport io.github.zemelua.umu_gu", "end": 25, "score": 0.9966257214546204, "start": 18, "tag": "USERNAME", "value": "zemelua" }, { "context": "github.zemelua.umu_guns.entity;\n\nimport io.github.zemelua.umu_guns.UMUGuns;\nimp...
null
[]
package io.github.zemelua.umu_guns.entity; import io.github.zemelua.umu_guns.UMUGuns; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public final class ModEntities { private static final DeferredRegister<EntityType<?>> REGISTRY = UMUGuns.registry(ForgeRegistries.ENTITIES); public static final RegistryObject<EntityType<BulletEntity>> BULLET = REGISTRY.register("bullet", () -> EntityType.Builder.<BulletEntity>of(BulletEntity::new, MobCategory.MISC) .sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20).build("bullet") ); private ModEntities() {} public static void initialize(IEventBus forgeBus, IEventBus modBus) { REGISTRY.register(modBus); } }
933
0.803859
0.796356
24
37.875
32.598969
108
false
false
0
0
0
0
0
0
1.208333
false
false
2
04aea05ac6c4fbb12001563d65377443f199bcf4
21,741,124,495,082
45aef50d492cf019f6f56a178f2bbd671954ee76
/src/main/java/frc/robot/subsystem/Shooter.java
8f7f4a77a8fe13def47bf534ac605b30560fd2d5
[]
no_license
Dinoyan/CyberCode
https://github.com/Dinoyan/CyberCode
aba61bde52e34a26950bba17ebb41d46c6dbb488
e1ecdd03d7b5a285b1185876edac2c6000ff4704
refs/heads/master
2020-09-13T10:29:51.430000
2020-01-01T19:11:11
2020-01-01T19:11:11
222,742,801
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.subsystem; import edu.wpi.first.wpilibj.Talon; import frc.robot.Constants; public class Shooter extends Subsystem { Talon mShooterCim1 = new Talon(Constants.SHOOTER_CIM_1); private static Shooter instance = null; public static Shooter getInstance() { if (instance == null) { instance = new Shooter(); } return instance; } public Shooter() { mShooterCim1.set(0); } public void shoot(double value) { this.mShooterCim1.set(value); } public void eject() { this.mShooterCim1.set(-0.5); } @Override public void init() { // TODO Auto-generated method stub } @Override public void zeroSensors() { // TODO Auto-generated method stub } @Override public void stop() { // TODO Auto-generated method stub } @Override public Boolean checkSystem() { // TODO Auto-generated method stub return true; } @Override public void updateDashboard() { // TODO Auto-generated method stub } }
UTF-8
Java
1,661
java
Shooter.java
Java
[]
null
[]
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.subsystem; import edu.wpi.first.wpilibj.Talon; import frc.robot.Constants; public class Shooter extends Subsystem { Talon mShooterCim1 = new Talon(Constants.SHOOTER_CIM_1); private static Shooter instance = null; public static Shooter getInstance() { if (instance == null) { instance = new Shooter(); } return instance; } public Shooter() { mShooterCim1.set(0); } public void shoot(double value) { this.mShooterCim1.set(value); } public void eject() { this.mShooterCim1.set(-0.5); } @Override public void init() { // TODO Auto-generated method stub } @Override public void zeroSensors() { // TODO Auto-generated method stub } @Override public void stop() { // TODO Auto-generated method stub } @Override public Boolean checkSystem() { // TODO Auto-generated method stub return true; } @Override public void updateDashboard() { // TODO Auto-generated method stub } }
1,661
0.496689
0.489464
66
23.166666
24.040737
80
false
false
0
0
0
0
0
0
0.166667
false
false
2
6f7f41ae7b52aebce5985e2dba19a01d97259fe0
30,975,304,174,346
2661f593f93fac24789f875f1d5195522509c87a
/src/test/java/TestYmlFileRead.java
aeb79a2c01761b788765d2d7eb6609b819a7cf32
[]
no_license
mmx8553/RestDataTakeWrk
https://github.com/mmx8553/RestDataTakeWrk
4974cf6e7cf23dd7a459d587ed254376c2929805
3e79f6f16ad3dc6f50d1920f6602177db05b8344
refs/heads/master
2020-03-08T14:56:37.308000
2018-05-07T07:56:52
2018-05-07T07:56:52
128,198,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import BotPkg.rootPkg.Utils; import org.junit.Assert; import org.junit.Test; /** * Created by OsipovMS on 19.04.2018. */ public class TestYmlFileRead { @Test public void testEnumStatus(){ Utils u = Utils.INSTANCE; String st = u.getJsonRtLoginPassword(); String tk = u.getTokenTg(); // Assert.assertThat(u.getTgUserState(new Long(123)), Utils.TgUserState.RootMenu); Assert.assertTrue(st != null); Assert.assertTrue(tk.length() > 10); } }
UTF-8
Java
502
java
TestYmlFileRead.java
Java
[ { "context": ".Assert;\nimport org.junit.Test;\n\n/**\n * Created by OsipovMS on 19.04.2018.\n */\npublic class TestYmlFileRead {", "end": 104, "score": 0.9996175169944763, "start": 96, "tag": "USERNAME", "value": "OsipovMS" } ]
null
[]
import BotPkg.rootPkg.Utils; import org.junit.Assert; import org.junit.Test; /** * Created by OsipovMS on 19.04.2018. */ public class TestYmlFileRead { @Test public void testEnumStatus(){ Utils u = Utils.INSTANCE; String st = u.getJsonRtLoginPassword(); String tk = u.getTokenTg(); // Assert.assertThat(u.getTgUserState(new Long(123)), Utils.TgUserState.RootMenu); Assert.assertTrue(st != null); Assert.assertTrue(tk.length() > 10); } }
502
0.64741
0.621514
19
25.31579
21.732954
89
false
false
0
0
0
0
0
0
0.526316
false
false
2
2cdc321fe22fabe3afad3a0a6f009e61d7ef4935
21,122,649,210,567
b239020d1cd175b918c124d8201f498aa3d3e806
/fileIO/readAndWrite/FileStreamTest.java
b1adebf62e3d0424bd9459aa072eadc94111e16a
[]
no_license
chipham79/JavaProgrammingMasterClass
https://github.com/chipham79/JavaProgrammingMasterClass
02c27924e52202cfbfde223ea2e2898c64fa7eb4
84952724cbf9f42464f6dd42bd7f50d6e2d0b2a6
refs/heads/main
2023-08-21T06:26:29.856000
2021-10-03T14:06:39
2021-10-03T14:06:39
398,738,467
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FileIO.readAndWrite; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class FileStreamTest { public static void main(String[] args) { try { byte bWrite [] = {1, 2, 3, 4, 5}; OutputStream os = new FileOutputStream("test.txt"); for(int i = 0; i < bWrite.length; i++) { os.write(bWrite[i]); } os.close(); InputStream is = new FileInputStream("test.txt"); int size = is.available(); for( int i = 0; i < size; i++) { System.out.println( is.read() + " "); } is.close(); } catch (IOException e) { System.out.println("Exception"); } } }
UTF-8
Java
702
java
FileStreamTest.java
Java
[]
null
[]
package FileIO.readAndWrite; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class FileStreamTest { public static void main(String[] args) { try { byte bWrite [] = {1, 2, 3, 4, 5}; OutputStream os = new FileOutputStream("test.txt"); for(int i = 0; i < bWrite.length; i++) { os.write(bWrite[i]); } os.close(); InputStream is = new FileInputStream("test.txt"); int size = is.available(); for( int i = 0; i < size; i++) { System.out.println( is.read() + " "); } is.close(); } catch (IOException e) { System.out.println("Exception"); } } }
702
0.636752
0.626781
30
22.4
16.251358
54
false
false
0
0
0
0
0
0
2.566667
false
false
2
2a1411bc4a15d85e41918af7834b849b77da2b8c
3,118,146,287,668
07a1e49a217a97cfc7d8312313606eb2679c7581
/bre-drools/src/main/java/demo/test/MachineResultSet.java
d7e5c1eb27e76a441b681294aa4229a5b3b55d9d
[]
no_license
rabbitcount/basic
https://github.com/rabbitcount/basic
4ebcfb52af9afce0d685c217cc0bd0d6fe13cc72
8b736e4bd776f8b8361bbb8c26e9d89e3dd2b1f4
refs/heads/master
2020-04-12T01:35:48.166000
2017-01-27T05:44:49
2017-01-27T05:44:49
41,201,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package demo.test; import demo.Machine; public interface MachineResultSet { boolean next(); Machine getMachine(); }
UTF-8
Java
136
java
MachineResultSet.java
Java
[]
null
[]
package demo.test; import demo.Machine; public interface MachineResultSet { boolean next(); Machine getMachine(); }
136
0.669118
0.669118
11
10.363636
11.71846
35
false
false
0
0
0
0
0
0
0.727273
false
false
2