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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0e80cd4401a849309cbb8fe32a303b7b9ee1382d | 22,522,808,507,448 | 74dfac48cdd347676ffa804c82286f90ddba28b3 | /CigarCommon/src/main/java/test/certif/exception/DAOException.java | 81fd3f6da1ed97dd6f9aedca20db4da7008e7517 | []
| no_license | kagzouli/Cigar2011 | https://github.com/kagzouli/Cigar2011 | 5ccea9489c40aada7022423638bafcff829e86d4 | b90c45aaf985ae6fb92123cfec826b08acdd210d | refs/heads/master | 2021-08-09T03:06:09.086000 | 2017-11-12T03:06:57 | 2017-11-12T03:06:57 | 110,398,778 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test.certif.exception;
public class DAOException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1339499494343043340L;
public DAOException(String message){
super(message);
}
public DAOException(Throwable exception){
super(exception);
}
}
| UTF-8 | Java | 293 | java | DAOException.java | Java | []
| null | []
| package test.certif.exception;
public class DAOException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1339499494343043340L;
public DAOException(String message){
super(message);
}
public DAOException(Throwable exception){
super(exception);
}
}
| 293 | 0.737201 | 0.672355 | 17 | 16.235294 | 19.963287 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.058824 | false | false | 15 |
e687747da4be22ddea5d306db426abb2e2f3da23 | 18,571,438,615,606 | 9ed3a888682f006fbae949670551b3ff376079f2 | /app/src/main/java/com/hosigus/coc_helper/services/SocketService.java | 501886d1479cb772d8a8bfa915e5361dcbaf71c5 | []
| no_license | Hosigus/COC_Helper | https://github.com/Hosigus/COC_Helper | 88c674f7e7080480a0d04576b193b5c570b88ee7 | fda51738051cb12b339c1e68ad2c108e0e749d7a | refs/heads/master | 2021-04-26T22:53:29.749000 | 2018-10-06T14:48:21 | 2018-10-06T14:48:21 | 123,891,300 | 7 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hosigus.coc_helper.services;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import com.hosigus.coc_helper.utils.LogUtils;
import com.hosigus.coc_helper.utils.ToastUtils;
import org.json.JSONException;
import org.json.JSONObject;
import static com.hosigus.coc_helper.configs.NetConfig.*;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.Socket;
import java.util.Scanner;
public class SocketService extends Service {
private boolean isRun ;
private ReadThread mReadThread;
private WeakReference<Socket> mSocket;
private Handler mHandler = new Handler();
private SocketBind mBind = new SocketBind();
private Runnable heartBeatRunnable = new Runnable() {
@Override
public void run() {
sendHB();
if (isRun)
mHandler.postDelayed(this,HEART_BEAT_RATE);
else
mHandler.post(()-> send(OUT_STR));
}
};
private void sendHB() {
send(HB_STR);
}
private void send(String msg) {
LogUtils.d("Test", "send: "+msg);
if ((mSocket==null || mSocket.get()==null)&&!restartSocket())
return;
Socket soc = mSocket.get();
if (soc.isClosed() && !soc.isOutputShutdown()&&!restartSocket())
return;
new Thread(()->{
try {
OutputStream os = soc.getOutputStream();
os.write((msg+"\n").getBytes("UTF-8"));
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
}
private void initSocket(){
new Thread(()->{
try {
Socket socket=new Socket(HOST,PORT);
mSocket = new WeakReference<>(socket);
mReadThread=new ReadThread(socket);
mReadThread.start();
mHandler.removeCallbacks(heartBeatRunnable);
mHandler.postDelayed(heartBeatRunnable,HEART_BEAT_RATE);
mHandler.post(()->{
String vitalMsg = mBind.callBack.restart();
if (vitalMsg!=null) {
send(vitalMsg);
}
});
} catch (Exception e) {
e.printStackTrace();
ToastUtils.show("连接不到服务器\n注:服务器在国外,可能被墙,过会再试试");
}
}).start();
}
private boolean restartSocket(){
if (mReadThread==null){
initSocket();
}else {
mReadThread.release();
releaseLastSocket(mSocket);
initSocket();
}
if (mReadThread==null){
mBind.callBack.receive(ERROR,null);
ToastUtils.show("连接不到服务器\n注:服务器在国外,可能被墙,过会再试试");
return false;
}
return true;
}
private void releaseLastSocket(WeakReference<Socket> mSocket){
try {
if(mSocket!=null){
Socket sk = mSocket.get();
if (sk!=null&&!sk.isClosed()){
sk.close();
}
sk=null;
mSocket=null;
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onCreate() {
super.onCreate();
isRun = true;
initSocket();
}
@Override
public void onDestroy() {
isRun = false;
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return mBind;
}
private class ReadThread extends Thread{
private WeakReference<Socket> mWeakSocket;
private boolean isStart = true;
ReadThread(Socket socket) {
mWeakSocket = new WeakReference<>(socket);
}
void release() {
isStart = false;
releaseLastSocket(mWeakSocket);
}
public void run() {
super.run();
Socket socket = mWeakSocket.get();
if (null != socket) {
try {
Scanner in = new Scanner(socket.getInputStream());
while (!socket.isClosed() && !socket.isInputShutdown()
&& isStart) {
if (in.hasNextLine()) {
String message = in.nextLine();
JSONObject json;
try {
json = new JSONObject(message);
} catch (JSONException e) {
e.printStackTrace();
ToastUtils.show("服务器出错!");
break;
}
int type = json.getInt("type");
if (type != HB) {
mBind.callBack.receive(type,json);
}
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
public class SocketBind extends Binder{
private CallBack callBack;
public void setCallBack(CallBack callBack) {
this.callBack = callBack;
}
public void sendCreate(String roomName, String roomPwd){
JSONObject json = new JSONObject();
try {
json.put("type", CREATE);
json.put("room_name", roomName);
json.put("room_pwd", roomPwd);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendBan(String name,int state){
JSONObject json = new JSONObject();
try {
json.put("type", BAN);
json.put("name", name);
json.put("state", state);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendKick(String name){
JSONObject json = new JSONObject();
try {
json.put("type", KICK);
json.put("name", name);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendEnter(String name,String roomName,String roomPwd){
JSONObject json = new JSONObject();
try {
json.put("type", ENTER);
json.put("room_name", roomName);
json.put("room_pwd", roomPwd);
json.put("name", name);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendRoll(String rollName,int point){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type",ROLL_SKILL);
json.put("roll_name", rollName);
json.put("point", point);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendRoll(String rollName,String formula){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type",ROLL_CUSTOM);
json.put("roll_name", rollName);
json.put("roll_formula", formula);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendKPRoll(String rollName,String formula){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type", ROLL_CUSTOM_KP);
json.put("roll_name", rollName);
json.put("roll_formula", formula);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendCLOSE(){
send(CLOSE_STR);
}
public void sendStart(String title) {
JSONObject json = new JSONObject();
try {
json.put("type", START);
json.put("title", title);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendEnd(){
send(END_STR);
}
public void sendMsg(String msg){
JSONObject json = new JSONObject();
try {
json.put("type", MSG);
json.put("msg", msg);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
}
public interface CallBack {
void receive(int type,JSONObject object);
String restart();
}
}
| UTF-8 | Java | 9,441 | java | SocketService.java | Java | [
{
"context": "\", roomName);\n json.put(\"room_pwd\", roomPwd);\n } catch (JSONException e) {\n ",
"end": 5771,
"score": 0.8951611518859863,
"start": 5767,
"tag": "PASSWORD",
"value": "room"
},
{
"context": "\", roomName);\n json.put(\"room_pwd\", roomPwd);\n json.put(\"name\", name);\n ",
"end": 6885,
"score": 0.6538291573524475,
"start": 6881,
"tag": "PASSWORD",
"value": "room"
}
]
| null | []
| package com.hosigus.coc_helper.services;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import com.hosigus.coc_helper.utils.LogUtils;
import com.hosigus.coc_helper.utils.ToastUtils;
import org.json.JSONException;
import org.json.JSONObject;
import static com.hosigus.coc_helper.configs.NetConfig.*;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.Socket;
import java.util.Scanner;
public class SocketService extends Service {
private boolean isRun ;
private ReadThread mReadThread;
private WeakReference<Socket> mSocket;
private Handler mHandler = new Handler();
private SocketBind mBind = new SocketBind();
private Runnable heartBeatRunnable = new Runnable() {
@Override
public void run() {
sendHB();
if (isRun)
mHandler.postDelayed(this,HEART_BEAT_RATE);
else
mHandler.post(()-> send(OUT_STR));
}
};
private void sendHB() {
send(HB_STR);
}
private void send(String msg) {
LogUtils.d("Test", "send: "+msg);
if ((mSocket==null || mSocket.get()==null)&&!restartSocket())
return;
Socket soc = mSocket.get();
if (soc.isClosed() && !soc.isOutputShutdown()&&!restartSocket())
return;
new Thread(()->{
try {
OutputStream os = soc.getOutputStream();
os.write((msg+"\n").getBytes("UTF-8"));
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
}
private void initSocket(){
new Thread(()->{
try {
Socket socket=new Socket(HOST,PORT);
mSocket = new WeakReference<>(socket);
mReadThread=new ReadThread(socket);
mReadThread.start();
mHandler.removeCallbacks(heartBeatRunnable);
mHandler.postDelayed(heartBeatRunnable,HEART_BEAT_RATE);
mHandler.post(()->{
String vitalMsg = mBind.callBack.restart();
if (vitalMsg!=null) {
send(vitalMsg);
}
});
} catch (Exception e) {
e.printStackTrace();
ToastUtils.show("连接不到服务器\n注:服务器在国外,可能被墙,过会再试试");
}
}).start();
}
private boolean restartSocket(){
if (mReadThread==null){
initSocket();
}else {
mReadThread.release();
releaseLastSocket(mSocket);
initSocket();
}
if (mReadThread==null){
mBind.callBack.receive(ERROR,null);
ToastUtils.show("连接不到服务器\n注:服务器在国外,可能被墙,过会再试试");
return false;
}
return true;
}
private void releaseLastSocket(WeakReference<Socket> mSocket){
try {
if(mSocket!=null){
Socket sk = mSocket.get();
if (sk!=null&&!sk.isClosed()){
sk.close();
}
sk=null;
mSocket=null;
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onCreate() {
super.onCreate();
isRun = true;
initSocket();
}
@Override
public void onDestroy() {
isRun = false;
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return mBind;
}
private class ReadThread extends Thread{
private WeakReference<Socket> mWeakSocket;
private boolean isStart = true;
ReadThread(Socket socket) {
mWeakSocket = new WeakReference<>(socket);
}
void release() {
isStart = false;
releaseLastSocket(mWeakSocket);
}
public void run() {
super.run();
Socket socket = mWeakSocket.get();
if (null != socket) {
try {
Scanner in = new Scanner(socket.getInputStream());
while (!socket.isClosed() && !socket.isInputShutdown()
&& isStart) {
if (in.hasNextLine()) {
String message = in.nextLine();
JSONObject json;
try {
json = new JSONObject(message);
} catch (JSONException e) {
e.printStackTrace();
ToastUtils.show("服务器出错!");
break;
}
int type = json.getInt("type");
if (type != HB) {
mBind.callBack.receive(type,json);
}
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
public class SocketBind extends Binder{
private CallBack callBack;
public void setCallBack(CallBack callBack) {
this.callBack = callBack;
}
public void sendCreate(String roomName, String roomPwd){
JSONObject json = new JSONObject();
try {
json.put("type", CREATE);
json.put("room_name", roomName);
json.put("room_pwd", <PASSWORD>Pwd);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendBan(String name,int state){
JSONObject json = new JSONObject();
try {
json.put("type", BAN);
json.put("name", name);
json.put("state", state);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendKick(String name){
JSONObject json = new JSONObject();
try {
json.put("type", KICK);
json.put("name", name);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendEnter(String name,String roomName,String roomPwd){
JSONObject json = new JSONObject();
try {
json.put("type", ENTER);
json.put("room_name", roomName);
json.put("room_pwd", <PASSWORD>Pwd);
json.put("name", name);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendRoll(String rollName,int point){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type",ROLL_SKILL);
json.put("roll_name", rollName);
json.put("point", point);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendRoll(String rollName,String formula){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type",ROLL_CUSTOM);
json.put("roll_name", rollName);
json.put("roll_formula", formula);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendKPRoll(String rollName,String formula){
JSONObject json = new JSONObject();
try {
json.put("type", ROLL);
json.put("roll_type", ROLL_CUSTOM_KP);
json.put("roll_name", rollName);
json.put("roll_formula", formula);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendCLOSE(){
send(CLOSE_STR);
}
public void sendStart(String title) {
JSONObject json = new JSONObject();
try {
json.put("type", START);
json.put("title", title);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
public void sendEnd(){
send(END_STR);
}
public void sendMsg(String msg){
JSONObject json = new JSONObject();
try {
json.put("type", MSG);
json.put("msg", msg);
} catch (JSONException e) {
e.printStackTrace();
}
send(json.toString());
}
}
public interface CallBack {
void receive(int type,JSONObject object);
String restart();
}
}
| 9,453 | 0.475313 | 0.475206 | 293 | 30.866894 | 17.568182 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.658703 | false | false | 15 |
39b1f403552bfcb276eca4daba17b659a10e7297 | 26,448,408,671,269 | bbac901084eca5a5c51c147d9dc00e5118b45e8e | /backendCFP/src/main/java/com/serv/controller/ReceiptTypeController.java | 16c923819b156f9a2d448e3e3f84047b3770165c | []
| no_license | brunomoore/backTcc | https://github.com/brunomoore/backTcc | ec5f6f9e8f894c3ae883e27f4882144d09faf1b2 | e79121305edf8a9133a4e7dda63c462b727fef00 | refs/heads/master | 2020-04-03T14:03:01.184000 | 2018-12-04T19:45:04 | 2018-12-04T19:45:04 | 155,309,770 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.serv.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.serv.entities.ReceiptType;
import com.serv.services.ReceiptTypeService;
@RestController
@RequestMapping("receiptType")
public class ReceiptTypeController {
public static final Logger logger = LoggerFactory.getLogger(ReceiptController.class);
@Autowired
private ReceiptTypeService receiptTypeService;
@RequestMapping(value="/{idReceipt}", method = RequestMethod.GET)
public ResponseEntity<ReceiptType> get(@PathVariable Long idReceipt) {
return new ResponseEntity<>(receiptTypeService.findById(idReceipt), HttpStatus.OK);
}
@RequestMapping( method = RequestMethod.GET)
public ResponseEntity<List<ReceiptType>> findAll(){
return new ResponseEntity<>(receiptTypeService.findAll(),HttpStatus.OK);
}
@RequestMapping( method = RequestMethod.POST)
public ResponseEntity<ReceiptType> saveReceipt(@RequestBody ReceiptType receiptType, @RequestParam Long id){
return new ResponseEntity<>(receiptTypeService.save(receiptType, id), HttpStatus.CREATED);
}
@CrossOrigin
@RequestMapping(value = "/{receiptTypeId}", method = RequestMethod.PUT)
public ResponseEntity<ReceiptType> updateReceipt(@PathVariable Long receiptTypeId, @RequestBody ReceiptType receiptType) {
return new ResponseEntity<>(receiptTypeService.update(receiptType), HttpStatus.OK);
}
@CrossOrigin
@RequestMapping(value="/{receiptTypeId}", method=RequestMethod.DELETE)
public ResponseEntity<ReceiptType> delete(@PathVariable Long receiptTypeId) {
receiptTypeService.delete(receiptTypeId);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}
| UTF-8 | Java | 2,311 | java | ReceiptTypeController.java | Java | []
| null | []
| package com.serv.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.serv.entities.ReceiptType;
import com.serv.services.ReceiptTypeService;
@RestController
@RequestMapping("receiptType")
public class ReceiptTypeController {
public static final Logger logger = LoggerFactory.getLogger(ReceiptController.class);
@Autowired
private ReceiptTypeService receiptTypeService;
@RequestMapping(value="/{idReceipt}", method = RequestMethod.GET)
public ResponseEntity<ReceiptType> get(@PathVariable Long idReceipt) {
return new ResponseEntity<>(receiptTypeService.findById(idReceipt), HttpStatus.OK);
}
@RequestMapping( method = RequestMethod.GET)
public ResponseEntity<List<ReceiptType>> findAll(){
return new ResponseEntity<>(receiptTypeService.findAll(),HttpStatus.OK);
}
@RequestMapping( method = RequestMethod.POST)
public ResponseEntity<ReceiptType> saveReceipt(@RequestBody ReceiptType receiptType, @RequestParam Long id){
return new ResponseEntity<>(receiptTypeService.save(receiptType, id), HttpStatus.CREATED);
}
@CrossOrigin
@RequestMapping(value = "/{receiptTypeId}", method = RequestMethod.PUT)
public ResponseEntity<ReceiptType> updateReceipt(@PathVariable Long receiptTypeId, @RequestBody ReceiptType receiptType) {
return new ResponseEntity<>(receiptTypeService.update(receiptType), HttpStatus.OK);
}
@CrossOrigin
@RequestMapping(value="/{receiptTypeId}", method=RequestMethod.DELETE)
public ResponseEntity<ReceiptType> delete(@PathVariable Long receiptTypeId) {
receiptTypeService.delete(receiptTypeId);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}
| 2,311 | 0.796625 | 0.795759 | 60 | 36.516666 | 32.836205 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.15 | false | false | 15 |
2c4e202a2b4507e821e967421c9fabc442d4db5c | 29,695,403,901,641 | 3fb28ff04a34c317972192bdcf8e9a83a9e103f1 | /back-end/e-commerce/src/main/java/com/youcode/Services/OrderStatusSRV.java | b96bf53d62bc8d0b9ac392c000a2fd8eb7de5787 | []
| no_license | loutfallah/E-Commerce-avec-Traitements-X-Sell-et-Up-Sell | https://github.com/loutfallah/E-Commerce-avec-Traitements-X-Sell-et-Up-Sell | 8ce4d41549b3aa758a70722012a5d71b22799605 | 45192120d77afc761f7b98d2fbc011141697f654 | refs/heads/master | 2023-01-30T16:21:39 | 2020-05-15T22:32:11 | 2020-05-15T22:32:11 | 237,799,566 | 0 | 0 | null | false | 2023-01-07T14:23:26 | 2020-02-02T16:24:55 | 2020-05-18T22:20:44 | 2023-01-07T14:23:26 | 5,877 | 0 | 0 | 25 | CSS | false | false | package com.youcode.Services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.youcode.DAO.IOrderStatusDAO;
import com.youcode.Entiter.OrderStatus;
@Service
public class OrderStatusSRV implements IOrderStatusSRV {
@Autowired IOrderStatusDAO orderStatusDAO;
@Override
public void addOrUpdateOrderStatus(OrderStatus orderStatus) {
orderStatusDAO.save(orderStatus);
}
@Override
public Optional<OrderStatus> selectByIdOrderStatus(int id) {
return orderStatusDAO.findById(id);
}
@Override
public List<OrderStatus> selectAllOrderStatus() {
return orderStatusDAO.findAll();
}
@Override
public void deleteOrderStatus(int id) {
orderStatusDAO.deleteById(id);
}
}
| UTF-8 | Java | 806 | java | OrderStatusSRV.java | Java | []
| null | []
| package com.youcode.Services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.youcode.DAO.IOrderStatusDAO;
import com.youcode.Entiter.OrderStatus;
@Service
public class OrderStatusSRV implements IOrderStatusSRV {
@Autowired IOrderStatusDAO orderStatusDAO;
@Override
public void addOrUpdateOrderStatus(OrderStatus orderStatus) {
orderStatusDAO.save(orderStatus);
}
@Override
public Optional<OrderStatus> selectByIdOrderStatus(int id) {
return orderStatusDAO.findById(id);
}
@Override
public List<OrderStatus> selectAllOrderStatus() {
return orderStatusDAO.findAll();
}
@Override
public void deleteOrderStatus(int id) {
orderStatusDAO.deleteById(id);
}
}
| 806 | 0.801489 | 0.801489 | 36 | 21.388889 | 21.368822 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false | 15 |
5fe693392ee8b39c379a659acfd5aa51d12e5721 | 7,851,200,261,285 | 337a7cf701e8c25bc1b192f0085cebcc21f41886 | /src/main/java/com/wayyer/HelloWorld/lambda/LambdaStreamTest.java | cfbb40fba5b77913384190385e6e842832b5a66d | []
| no_license | 17091958846/HelloWorld | https://github.com/17091958846/HelloWorld | fe23e4f1b00099801d6471ac3ad754ade34d1837 | 0315c73cd5b2e15237e033bda738adec970166ea | refs/heads/master | 2023-01-20T07:40:01.956000 | 2023-01-17T12:16:34 | 2023-01-17T12:16:34 | 93,761,502 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wayyer.HelloWorld.lambda;
import java.util.*;
import java.util.stream.Collectors;
/**
* Streams : a sequence of eles supporting sequential and parallel aggregate operations.
*
* I. the stream comprise the file stream, collection stream and array stream.
* II. the immediate conduction contains filter, distinct, sorted, limit, skip, map and flatMap
* III. the terminal operations contains allMatch, anyMatch, noneMatch, findFirst, findAny, count,
* sum(reduction operations) and collect
*/
public class LambdaStreamTest {
static List<Integer> nums = new ArrayList<>();
static {
nums.add(1);
nums.add(2);
nums.add(3);
nums.add(4);
}
static String[] strs = {"feature", "java8", "author", "caowei", "company", "jnj"};
static List<main.java.com.wayyer.HelloWorld.lambda.Person> people = Arrays.asList(
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao1", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo1", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao2", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo2", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao3", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo3", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Caoguo", "Meili", 18));
public static void main(String[] args) {
//the method stream can trans the collection into a stream
//the filter method will filter the specific logic we defined with lambda expression
//distinct all the duplicated ele
//mapToInt method will handle all the num and return what we want, such as get all the int nums
//the sum method will deal and sum counts
Integer[] a = {1,2,3};
// Arrays.stream(a).filter(e -> e!=0).mapToInt(e -> e+2).collect(Collectors.toCollection());
int sum = nums.stream().filter(num -> num!= null).distinct().mapToInt(num -> num+2).sum();
System.out.println("1.1. calculate the array with the sum = " + sum);
//reduce method is used for all the reduction operations, such as the typical sum, count.
Long countPeo = people.stream().count();
// int sum = nums.stream().filter(num -> num!= null).distinct().mapToInt(num -> num+2).sum();
System.out.println("1.2. count method countPeo = " + countPeo);
//the Collectors is a new class with version 8, this util is used for the reduction operations
//the asList method will return a new collection
nums = nums.stream().filter(num -> num % 2 == 0).collect(Collectors.toList());
System.out.println("2. filter all the ele without odd num, new array = " + nums);
List<main.java.com.wayyer.HelloWorld.lambda.Person> caoPeo = people
.stream()
.filter(person -> person.getFirstName()!=person.getLastName())
.collect(Collectors.toList());
System.out.println("3. filter all the people with different xxx and return caoPeo = " + caoPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> distinctPro = people
.stream().distinct().collect(Collectors.toList());
System.out.println("4. filter all the people with no duplicated and return distinctPro = " + distinctPro);
List<main.java.com.wayyer.HelloWorld.lambda.Person> limitPeo = people
.stream().limit(2).collect(Collectors.toList());
System.out.println("5. limit 2 peo limitPeo = " + limitPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> skipPeo = people
.stream().skip(6).collect(Collectors.toList());
System.out.println("6. skip the early six skipPeo = " + skipPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> sortedDefaultPeo = people.stream().sorted((p1, p2) -> p1.getAge() - p2.getAge()).collect(Collectors.toList());
System.out.println("7. the sortedDefaultPeo = " + sortedDefaultPeo);
//mapToInt, mapToDouble, mapToLong ---> IntStream, DoubleStream, LongStream
OptionalInt optionalInt = people
.stream()
.sorted((p1, p2) -> p1.getAge() - p2.getAge())
.mapToInt(main.java.com.wayyer.HelloWorld.lambda.Person::getAge).findFirst();
System.out.println("8. the optionalInt = " + optionalInt);
List<String> lastnamePeo = people.stream().map(main.java.com.wayyer.HelloWorld.lambda.Person::getLastName).distinct().collect(Collectors.toList());
System.out.println("9. the person map to string list = " + lastnamePeo);
//the map operation just do operate within the ele
List<String[]> reductionList = Arrays.stream(strs).map(str -> str.split("")).distinct().collect(Collectors.toList());
System.out.println("10. operate the arrays with map reductionList = " + reductionList);
//if i want to get all the alphabet with no duplication, the flatMap is available
List<String> flatReducationList = Arrays.stream(strs)
.map(str -> str.split(""))
.flatMap(Arrays::stream)
.distinct()
.sorted()
.collect(Collectors.toList());
System.out.println("11. flat map with operating the arrays with map flatReducationList = " + flatReducationList);
List<Boolean> agePeo = people.stream().map(person -> person.getAge() > 17).collect(Collectors.toList());
System.out.println("12. agePeo = " + agePeo);
//omit the other flatMap related method: flatMapToInt, flatMapToDouble, flatMapToLong
//...
//reduction operation on terminal end
//allMatch method is used for handling if all matching the corresponding characters
boolean lastnameConstainI = people.stream().allMatch(person -> person.getLastName().contains("i"));
System.out.println("13. judge if any person's last name cannot contains character i lastnameConstainI = " + lastnameConstainI);
//anyMatch: poorer valid than allMatch, it will return true with just only one ele is true
boolean caoweiIsInPeo = people.stream().anyMatch(person -> "CaoWei".equals(person.getFirstName() + person.getLastName()));
System.out.println("14. judge if people contains one whose full name is CaoWei caoweiIsInPeo = " + caoweiIsInPeo);
//noneMatch method is opposite from allMatch method, it only returns true if none matched
boolean weeIsNotLastnamePeo = people.stream().noneMatch(person -> person.getLastName().contains("Wee"));
System.out.println("15. judge if wee does not exist in any last name weeIsNotLastnamePeo = " + weeIsNotLastnamePeo);
//findFirst method is used for searching the first ele position we want and return this ele
//this method parameter is null, any criteria make sense in filter method
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> thefirstnameCaoInfoPeo = people.stream().filter(person -> "Cao".equals(person.getFirstName())).findFirst();
System.out.println("16. get the first person whose first name 'Cao' thefirstnameCaoInfoPeo = " + thefirstnameCaoInfoPeo);
//findAny method is used for searching any one who is suitable.
//in stream method which stream is order by sequence, this findAny is the same with findFirst
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> anyoneAdultInfoInStreamPeo = people.stream().filter(person -> person.getAge() > 17).findAny();
System.out.println("17.1. find a person who is a adult anyoneAdultInfoInStreamPeo = " + anyoneAdultInfoInStreamPeo);
//the parallel stream is used for multiple threads to search
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> anyoneAdultInfoInParallelPeo = people.parallelStream().filter(person -> person.getAge() > 17).findAny();
System.out.println("17.2. find a person who is a adult anyoneAdultInfoInParallelPeo = " + anyoneAdultInfoInParallelPeo);
//reduction operation
int reduceSumPeo = people.stream().mapToInt(main.java.com.wayyer.HelloWorld.lambda.Person::getAge).reduce(0, (a1, b) -> a1+b);
System.out.println("18.1. the reduction operation of summarilizing reduceSumPeo = " + reduceSumPeo);
int reduceSumNum = nums.stream().reduce(0, (a1, b) -> a1+b);
System.out.println("18.2. the reduction operation of summarilizing reduceSumNum = " + reduceSumNum);
int reduceSumNum2 = nums.stream().reduce(0, Integer::sum);
System.out.println("18.3. the reduction operation of summarilizing reduceSumNum2 = " + reduceSumNum2);
Optional<Integer> reduceSumNum3 = nums.stream().reduce(Integer::sum);
System.out.println("18.4. the reduction operation of summarilizing reduceSumNum3 = " + reduceSumNum3.get());
//Collectors: Collectors.reducing
long countCollectorsPeo = people.stream().collect(Collectors.counting());
System.out.println("19.1. the reducing operation : counting countCollectorsPeo = " + countCollectorsPeo);
long countCollectorsPeo1 = people.stream().count();
System.out.println("19.2. directly count method countCollectorsPeo1 = " + countCollectorsPeo1);
//Collectors.maxBy, minBy : the maximum and minimum of the given collections
String joiningFirstname = people.stream().map(main.java.com.wayyer.HelloWorld.lambda.Person::getFirstName).collect(Collectors.joining());
System.out.println("20.1. join the strings joiningFirstname = " + joiningFirstname);
//method reference: the method reference is used for java8 lambda expression
//foreach iteration acts as the same functionality of iteration, for loop
people.forEach(System.out::println);
people.stream().forEach(System.out::println);
}
}
| UTF-8 | Java | 10,165 | java | LambdaStreamTest.java | Java | [
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Cao\", \"Wei\", 25),\n new main.java.com.wayye",
"end": 947,
"score": 0.9399865865707397,
"start": 944,
"tag": "NAME",
"value": "Cao"
},
{
"context": ".java.com.wayyer.HelloWorld.lambda.Person(\"Cao\", \"Wei\", 25),\n new main.java.com.wayyer.Hello",
"end": 954,
"score": 0.9739325642585754,
"start": 951,
"tag": "NAME",
"value": "Wei"
},
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Guo\", \"Liu\", 24),\n new main.java.com.wayye",
"end": 1028,
"score": 0.9005676507949829,
"start": 1025,
"tag": "NAME",
"value": "Guo"
},
{
"context": ".java.com.wayyer.HelloWorld.lambda.Person(\"Guo\", \"Liu\", 24),\n new main.java.com.wayyer.Hello",
"end": 1035,
"score": 0.9347789883613586,
"start": 1032,
"tag": "NAME",
"value": "Liu"
},
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Cao1\", \"Wei\", 25),\n new main.java.com.wayy",
"end": 1109,
"score": 0.622282862663269,
"start": 1106,
"tag": "NAME",
"value": "Cao"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Cao1\", \"Wei\", 25),\n new main.java.com.wayyer.Hello",
"end": 1117,
"score": 0.9687770009040833,
"start": 1114,
"tag": "NAME",
"value": "Wei"
},
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Guo1\", \"Liu\", 24),\n new main.java.com.way",
"end": 1190,
"score": 0.5744056701660156,
"start": 1188,
"tag": "NAME",
"value": "Gu"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Guo1\", \"Liu\", 24),\n new main.java.com.wayyer.Hello",
"end": 1199,
"score": 0.9456464648246765,
"start": 1196,
"tag": "NAME",
"value": "Liu"
},
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Cao2\", \"Wei\", 25),\n new main.java.com.wayy",
"end": 1273,
"score": 0.5598797798156738,
"start": 1270,
"tag": "NAME",
"value": "Cao"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Cao2\", \"Wei\", 25),\n new main.java.com.wayyer.Hello",
"end": 1281,
"score": 0.9702029824256897,
"start": 1278,
"tag": "NAME",
"value": "Wei"
},
{
"context": "ew main.java.com.wayyer.HelloWorld.lambda.Person(\"Guo2\", \"Liu\", 24),\n new main.java.com.way",
"end": 1354,
"score": 0.6117605566978455,
"start": 1352,
"tag": "NAME",
"value": "Gu"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Guo2\", \"Liu\", 24),\n new main.java.com.wayyer.Hello",
"end": 1363,
"score": 0.959366500377655,
"start": 1360,
"tag": "NAME",
"value": "Liu"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Cao3\", \"Wei\", 25),\n new main.java.com.wayyer.Hello",
"end": 1445,
"score": 0.9730445146560669,
"start": 1442,
"tag": "NAME",
"value": "Wei"
},
{
"context": "java.com.wayyer.HelloWorld.lambda.Person(\"Guo3\", \"Liu\", 24),\n new main.java.com.wayyer.Hello",
"end": 1527,
"score": 0.9364116191864014,
"start": 1524,
"tag": "NAME",
"value": "Liu"
},
{
"context": "va.com.wayyer.HelloWorld.lambda.Person(\"Caoguo\", \"Meili\", 18));\n\n public static void main(String[] arg",
"end": 1613,
"score": 0.9376471638679504,
"start": 1608,
"tag": "NAME",
"value": "Meili"
},
{
"context": "oweiIsInPeo = people.stream().anyMatch(person -> \"CaoWei\".equals(person.getFirstName() + person.getLastNam",
"end": 6484,
"score": 0.9982573390007019,
"start": 6478,
"tag": "NAME",
"value": "CaoWei"
},
{
"context": "4. judge if people contains one whose full name is CaoWei caoweiIsInPeo = \" + caoweiIsInPeo);\n\n //no",
"end": 6628,
"score": 0.9995508193969727,
"start": 6622,
"tag": "NAME",
"value": "CaoWei"
},
{
"context": "oneMatch(person -> person.getLastName().contains(\"Wee\"));\n\n System.out.println(\"15. judge if wee",
"end": 6872,
"score": 0.9995055794715881,
"start": 6869,
"tag": "NAME",
"value": "Wee"
},
{
"context": "ameCaoInfoPeo = people.stream().filter(person -> \"Cao\".equals(person.getFirstName())).findFirst();\n ",
"end": 7313,
"score": 0.7689085006713867,
"start": 7310,
"tag": "NAME",
"value": "Cao"
},
{
"context": "intln(\"16. get the first person whose first name 'Cao' thefirstnameCaoInfoPeo = \" + thefirstnameCaoInfo",
"end": 7433,
"score": 0.9960677027702332,
"start": 7430,
"tag": "NAME",
"value": "Cao"
}
]
| null | []
| package com.wayyer.HelloWorld.lambda;
import java.util.*;
import java.util.stream.Collectors;
/**
* Streams : a sequence of eles supporting sequential and parallel aggregate operations.
*
* I. the stream comprise the file stream, collection stream and array stream.
* II. the immediate conduction contains filter, distinct, sorted, limit, skip, map and flatMap
* III. the terminal operations contains allMatch, anyMatch, noneMatch, findFirst, findAny, count,
* sum(reduction operations) and collect
*/
public class LambdaStreamTest {
static List<Integer> nums = new ArrayList<>();
static {
nums.add(1);
nums.add(2);
nums.add(3);
nums.add(4);
}
static String[] strs = {"feature", "java8", "author", "caowei", "company", "jnj"};
static List<main.java.com.wayyer.HelloWorld.lambda.Person> people = Arrays.asList(
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao1", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo1", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao2", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo2", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Cao3", "Wei", 25),
new main.java.com.wayyer.HelloWorld.lambda.Person("Guo3", "Liu", 24),
new main.java.com.wayyer.HelloWorld.lambda.Person("Caoguo", "Meili", 18));
public static void main(String[] args) {
//the method stream can trans the collection into a stream
//the filter method will filter the specific logic we defined with lambda expression
//distinct all the duplicated ele
//mapToInt method will handle all the num and return what we want, such as get all the int nums
//the sum method will deal and sum counts
Integer[] a = {1,2,3};
// Arrays.stream(a).filter(e -> e!=0).mapToInt(e -> e+2).collect(Collectors.toCollection());
int sum = nums.stream().filter(num -> num!= null).distinct().mapToInt(num -> num+2).sum();
System.out.println("1.1. calculate the array with the sum = " + sum);
//reduce method is used for all the reduction operations, such as the typical sum, count.
Long countPeo = people.stream().count();
// int sum = nums.stream().filter(num -> num!= null).distinct().mapToInt(num -> num+2).sum();
System.out.println("1.2. count method countPeo = " + countPeo);
//the Collectors is a new class with version 8, this util is used for the reduction operations
//the asList method will return a new collection
nums = nums.stream().filter(num -> num % 2 == 0).collect(Collectors.toList());
System.out.println("2. filter all the ele without odd num, new array = " + nums);
List<main.java.com.wayyer.HelloWorld.lambda.Person> caoPeo = people
.stream()
.filter(person -> person.getFirstName()!=person.getLastName())
.collect(Collectors.toList());
System.out.println("3. filter all the people with different xxx and return caoPeo = " + caoPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> distinctPro = people
.stream().distinct().collect(Collectors.toList());
System.out.println("4. filter all the people with no duplicated and return distinctPro = " + distinctPro);
List<main.java.com.wayyer.HelloWorld.lambda.Person> limitPeo = people
.stream().limit(2).collect(Collectors.toList());
System.out.println("5. limit 2 peo limitPeo = " + limitPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> skipPeo = people
.stream().skip(6).collect(Collectors.toList());
System.out.println("6. skip the early six skipPeo = " + skipPeo);
List<main.java.com.wayyer.HelloWorld.lambda.Person> sortedDefaultPeo = people.stream().sorted((p1, p2) -> p1.getAge() - p2.getAge()).collect(Collectors.toList());
System.out.println("7. the sortedDefaultPeo = " + sortedDefaultPeo);
//mapToInt, mapToDouble, mapToLong ---> IntStream, DoubleStream, LongStream
OptionalInt optionalInt = people
.stream()
.sorted((p1, p2) -> p1.getAge() - p2.getAge())
.mapToInt(main.java.com.wayyer.HelloWorld.lambda.Person::getAge).findFirst();
System.out.println("8. the optionalInt = " + optionalInt);
List<String> lastnamePeo = people.stream().map(main.java.com.wayyer.HelloWorld.lambda.Person::getLastName).distinct().collect(Collectors.toList());
System.out.println("9. the person map to string list = " + lastnamePeo);
//the map operation just do operate within the ele
List<String[]> reductionList = Arrays.stream(strs).map(str -> str.split("")).distinct().collect(Collectors.toList());
System.out.println("10. operate the arrays with map reductionList = " + reductionList);
//if i want to get all the alphabet with no duplication, the flatMap is available
List<String> flatReducationList = Arrays.stream(strs)
.map(str -> str.split(""))
.flatMap(Arrays::stream)
.distinct()
.sorted()
.collect(Collectors.toList());
System.out.println("11. flat map with operating the arrays with map flatReducationList = " + flatReducationList);
List<Boolean> agePeo = people.stream().map(person -> person.getAge() > 17).collect(Collectors.toList());
System.out.println("12. agePeo = " + agePeo);
//omit the other flatMap related method: flatMapToInt, flatMapToDouble, flatMapToLong
//...
//reduction operation on terminal end
//allMatch method is used for handling if all matching the corresponding characters
boolean lastnameConstainI = people.stream().allMatch(person -> person.getLastName().contains("i"));
System.out.println("13. judge if any person's last name cannot contains character i lastnameConstainI = " + lastnameConstainI);
//anyMatch: poorer valid than allMatch, it will return true with just only one ele is true
boolean caoweiIsInPeo = people.stream().anyMatch(person -> "CaoWei".equals(person.getFirstName() + person.getLastName()));
System.out.println("14. judge if people contains one whose full name is CaoWei caoweiIsInPeo = " + caoweiIsInPeo);
//noneMatch method is opposite from allMatch method, it only returns true if none matched
boolean weeIsNotLastnamePeo = people.stream().noneMatch(person -> person.getLastName().contains("Wee"));
System.out.println("15. judge if wee does not exist in any last name weeIsNotLastnamePeo = " + weeIsNotLastnamePeo);
//findFirst method is used for searching the first ele position we want and return this ele
//this method parameter is null, any criteria make sense in filter method
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> thefirstnameCaoInfoPeo = people.stream().filter(person -> "Cao".equals(person.getFirstName())).findFirst();
System.out.println("16. get the first person whose first name 'Cao' thefirstnameCaoInfoPeo = " + thefirstnameCaoInfoPeo);
//findAny method is used for searching any one who is suitable.
//in stream method which stream is order by sequence, this findAny is the same with findFirst
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> anyoneAdultInfoInStreamPeo = people.stream().filter(person -> person.getAge() > 17).findAny();
System.out.println("17.1. find a person who is a adult anyoneAdultInfoInStreamPeo = " + anyoneAdultInfoInStreamPeo);
//the parallel stream is used for multiple threads to search
Optional<main.java.com.wayyer.HelloWorld.lambda.Person> anyoneAdultInfoInParallelPeo = people.parallelStream().filter(person -> person.getAge() > 17).findAny();
System.out.println("17.2. find a person who is a adult anyoneAdultInfoInParallelPeo = " + anyoneAdultInfoInParallelPeo);
//reduction operation
int reduceSumPeo = people.stream().mapToInt(main.java.com.wayyer.HelloWorld.lambda.Person::getAge).reduce(0, (a1, b) -> a1+b);
System.out.println("18.1. the reduction operation of summarilizing reduceSumPeo = " + reduceSumPeo);
int reduceSumNum = nums.stream().reduce(0, (a1, b) -> a1+b);
System.out.println("18.2. the reduction operation of summarilizing reduceSumNum = " + reduceSumNum);
int reduceSumNum2 = nums.stream().reduce(0, Integer::sum);
System.out.println("18.3. the reduction operation of summarilizing reduceSumNum2 = " + reduceSumNum2);
Optional<Integer> reduceSumNum3 = nums.stream().reduce(Integer::sum);
System.out.println("18.4. the reduction operation of summarilizing reduceSumNum3 = " + reduceSumNum3.get());
//Collectors: Collectors.reducing
long countCollectorsPeo = people.stream().collect(Collectors.counting());
System.out.println("19.1. the reducing operation : counting countCollectorsPeo = " + countCollectorsPeo);
long countCollectorsPeo1 = people.stream().count();
System.out.println("19.2. directly count method countCollectorsPeo1 = " + countCollectorsPeo1);
//Collectors.maxBy, minBy : the maximum and minimum of the given collections
String joiningFirstname = people.stream().map(main.java.com.wayyer.HelloWorld.lambda.Person::getFirstName).collect(Collectors.joining());
System.out.println("20.1. join the strings joiningFirstname = " + joiningFirstname);
//method reference: the method reference is used for java8 lambda expression
//foreach iteration acts as the same functionality of iteration, for loop
people.forEach(System.out::println);
people.stream().forEach(System.out::println);
}
}
| 10,165 | 0.671717 | 0.659321 | 211 | 47.175354 | 47.31855 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.649289 | false | false | 15 |
b531a440ca3556f0e58f2ca3d3ede9c3d8095cda | 31,877,247,297,959 | 61781ec7ae5a83dece9f96e7c8c9516a29a1eef1 | /MonFrigo/src/com/example/monfrigo/AfficherListeDeCourse.java | 03c4ab2a0251bc56dc17bd8e272168bdf4e1c82e | []
| no_license | AlexandreMoutel/pts3-g8 | https://github.com/AlexandreMoutel/pts3-g8 | d13393dbb61378468ef1b543424cb74f2beadc10 | a6d86ce6dac3eebab259801e8fedd5a6b9edc8ae | refs/heads/master | 2016-09-09T23:36:55.259000 | 2014-01-13T09:55:06 | 2014-01-13T09:55:06 | 33,366,563 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.monfrigo;
/**
* Cette classe est inutile pour le moment
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.widget.ListView;
public class AfficherListeDeCourse extends Activity {
ArrayList<HashMap<String, Object>> aliment;
HashMap<String, Object> temp;
LayoutInflater inflater;
String[] nom;
String[] quantite;
String[] type;
String[] date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_afficher_liste_de_course);
final ListView maListe = (ListView) findViewById(R.id.listView_liste);
final List<Aliment> laListeDeCourse = ListeDeCourse.getLaBouffeQuiFautAcheter();
laListeDeCourse.add(new Aliment("Steack", "Viande", "12/12/2012", "3"));
laListeDeCourse.add(new Aliment("Haribo", "Bonbon", "13/12/2012", "5"));
laListeDeCourse.add(new Aliment("Coca-Cola", "Boisson", "14/12/2012", "3"));
laListeDeCourse.add(new Aliment("Truite", "Poisson", "12/11/2012", "3"));
laListeDeCourse.add(new Aliment("Boeuf", "Viande", "12/11/2012", "3"));
laListeDeCourse.add(new Aliment("Poisson pané", "Poisson", "12/12/2009", "9"));
remplirTableau(laListeDeCourse);
aliment = new ArrayList<HashMap<String,Object>>();
remplirHashMap();
final CustomAdapter adapter = new CustomAdapter(this, android.R.layout.activity_list_item, aliment, inflater);
maListe.setAdapter(adapter);
}
private void remplirTableau(List<Aliment> laListeDeCourse) {
int tailleFrigo = laListeDeCourse.size();
//On vide les tableaux
nom = null;
quantite = null;
type = null;
date = null;
//Recupération des nom d'aliment
nom = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
nom[i] = laListeDeCourse.get(i).getNom();
}
//Recupération des quantite d'aliment
quantite = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
quantite[i] = laListeDeCourse.get(i).getQuantite();
}
//Recupération des type d'aliment
type = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
type[i] = laListeDeCourse.get(i).getType();
}
//Recupération des date d'aliment
date = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
date[i] = laListeDeCourse.get(i).getDate();
}
}
private void remplirHashMap() {
int tailleHashMap = nom.length;
//On vide la liste
aliment.removeAll(aliment);
for(int i=0;i<tailleHashMap;i++)
{
temp = new HashMap<String, Object>();
temp.put("nom", nom[i]);
temp.put("date", date[i]);
temp.put("type", type[i]);
temp.put("quantite", quantite[i]);
aliment.add(temp);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.afficher_liste_de_course, menu);
return true;
}
}
| ISO-8859-1 | Java | 3,229 | java | AfficherListeDeCourse.java | Java | [
{
"context": "cheter();\r\n\t\t\r\n\t\tlaListeDeCourse.add(new Aliment(\"Steack\", \"Viande\", \"12/12/2012\", \"3\"));\r\n\t\tlaListeDeCour",
"end": 945,
"score": 0.9983556270599365,
"start": 939,
"tag": "NAME",
"value": "Steack"
},
{
"context": "\n\t\t\r\n\t\tlaListeDeCourse.add(new Aliment(\"Steack\", \"Viande\", \"12/12/2012\", \"3\"));\r\n\t\tlaListeDeCourse.add(new",
"end": 955,
"score": 0.9993038177490234,
"start": 949,
"tag": "NAME",
"value": "Viande"
},
{
"context": "2012\", \"3\"));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Haribo\", \"Bonbon\", \"13/12/2012\", \"5\"));\r\n\t\tlaListeDeCour",
"end": 1021,
"score": 0.97822505235672,
"start": 1015,
"tag": "NAME",
"value": "Haribo"
},
{
"context": "));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Haribo\", \"Bonbon\", \"13/12/2012\", \"5\"));\r\n\t\tlaListeDeCourse.add(new",
"end": 1031,
"score": 0.978264570236206,
"start": 1025,
"tag": "NAME",
"value": "Bonbon"
},
{
"context": "2012\", \"5\"));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Coca-Cola\", \"Boisson\", \"14/12/2012\", \"3\"));\r\n\t\tlaLi",
"end": 1092,
"score": 0.5139521956443787,
"start": 1091,
"tag": "NAME",
"value": "C"
},
{
"context": "\r\n\t\tlaListeDeCourse.add(new Aliment(\"Coca-Cola\", \"Boisson\", \"14/12/2012\", \"3\"));\r\n\t\tlaListeDeCourse.add(new",
"end": 1111,
"score": 0.9253268241882324,
"start": 1104,
"tag": "NAME",
"value": "Boisson"
},
{
"context": "));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Truite\", \"Poisson\", \"12/11/2012\", \"3\"));\r\n\t\tlaListeDeCourse.ad",
"end": 1183,
"score": 0.6710250973701477,
"start": 1181,
"tag": "NAME",
"value": "Po"
},
{
"context": "2012\", \"3\"));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Boeuf\", \"Viande\", \"12/11/2012\", \"3\"));\r\n\t\tlaListeDeCour",
"end": 1253,
"score": 0.9315640926361084,
"start": 1248,
"tag": "NAME",
"value": "Boeuf"
},
{
"context": "\"));\r\n\t\tlaListeDeCourse.add(new Aliment(\"Boeuf\", \"Viande\", \"12/11/2012\", \"3\"));\r\n\t\tlaListeDeCourse.add(new",
"end": 1263,
"score": 0.9948759078979492,
"start": 1257,
"tag": "NAME",
"value": "Viande"
}
]
| null | []
| package com.example.monfrigo;
/**
* Cette classe est inutile pour le moment
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.widget.ListView;
public class AfficherListeDeCourse extends Activity {
ArrayList<HashMap<String, Object>> aliment;
HashMap<String, Object> temp;
LayoutInflater inflater;
String[] nom;
String[] quantite;
String[] type;
String[] date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_afficher_liste_de_course);
final ListView maListe = (ListView) findViewById(R.id.listView_liste);
final List<Aliment> laListeDeCourse = ListeDeCourse.getLaBouffeQuiFautAcheter();
laListeDeCourse.add(new Aliment("Steack", "Viande", "12/12/2012", "3"));
laListeDeCourse.add(new Aliment("Haribo", "Bonbon", "13/12/2012", "5"));
laListeDeCourse.add(new Aliment("Coca-Cola", "Boisson", "14/12/2012", "3"));
laListeDeCourse.add(new Aliment("Truite", "Poisson", "12/11/2012", "3"));
laListeDeCourse.add(new Aliment("Boeuf", "Viande", "12/11/2012", "3"));
laListeDeCourse.add(new Aliment("Poisson pané", "Poisson", "12/12/2009", "9"));
remplirTableau(laListeDeCourse);
aliment = new ArrayList<HashMap<String,Object>>();
remplirHashMap();
final CustomAdapter adapter = new CustomAdapter(this, android.R.layout.activity_list_item, aliment, inflater);
maListe.setAdapter(adapter);
}
private void remplirTableau(List<Aliment> laListeDeCourse) {
int tailleFrigo = laListeDeCourse.size();
//On vide les tableaux
nom = null;
quantite = null;
type = null;
date = null;
//Recupération des nom d'aliment
nom = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
nom[i] = laListeDeCourse.get(i).getNom();
}
//Recupération des quantite d'aliment
quantite = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
quantite[i] = laListeDeCourse.get(i).getQuantite();
}
//Recupération des type d'aliment
type = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
type[i] = laListeDeCourse.get(i).getType();
}
//Recupération des date d'aliment
date = new String[tailleFrigo];
for(int i = 0; i < laListeDeCourse.size(); i++) {
date[i] = laListeDeCourse.get(i).getDate();
}
}
private void remplirHashMap() {
int tailleHashMap = nom.length;
//On vide la liste
aliment.removeAll(aliment);
for(int i=0;i<tailleHashMap;i++)
{
temp = new HashMap<String, Object>();
temp.put("nom", nom[i]);
temp.put("date", date[i]);
temp.put("type", type[i]);
temp.put("quantite", quantite[i]);
aliment.add(temp);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.afficher_liste_de_course, menu);
return true;
}
}
| 3,229 | 0.665633 | 0.647332 | 119 | 25.092438 | 24.773933 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.109244 | false | false | 15 |
416e784171af7c0424a2891ad616f79b2c272303 | 24,008,867,224,438 | 94bbbb12c573cf665c11a9b066c58280ebe06172 | /app/src/main/java/com/fatcat/easy_transfer/activity/PictureActivity.java | 18bdaa1de1033eab370d2d8a2c4aa1f43b8c7b53 | []
| no_license | EsauLu/Easy_Transfer | https://github.com/EsauLu/Easy_Transfer | d2c59f6f3adcf584f70247f97f7737ec6598f480 | 139e062ed350750bb6337316c6b622fd8ee40709 | refs/heads/master | 2020-12-24T22:39:52.447000 | 2020-06-22T14:07:45 | 2020-06-22T14:07:45 | 70,228,291 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fatcat.easy_transfer.activity;
import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.fatcat.easy_transfer.R;
import com.fatcat.easy_transfer.base.BaseActivity;
import java.io.File;
/**
* @author Administrator
* @version $Rev$
* @time 2016/4/916:34
* @des ${TODO}
* @updateAuthor $Author$
* @updateDate $Date$
* @updateDes ${TODO}
*/
public class PictureActivity extends BaseActivity {
private Toolbar mToolbar;
private ImageView mImageView;
@Override
public void initView() {
setContentView(R.layout.activity_picture);
}
@Override
protected void initActionBar() {
super.initActionBar();
mToolbar = (Toolbar) findViewById(R.id.toolbar);
// toolbar.setLogo(R.drawable.ic_launcher);
mToolbar.setTitle("查看图片");// 标题的文字需在setSupportActionBar之前,不然会无效
// toolbar.setSubtitle("副标题");
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
protected void initData() {
super.initData();
Intent intent = getIntent();
String picturePath = intent.getStringExtra("PicturePath");
File pictureFile = new File(picturePath);
mImageView = (ImageView) findViewById(R.id.iv_picture_watch);
Glide.with(this).load(pictureFile).into(mImageView);
}
@Override
protected void initListener() {
super.initListener();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
}
| UTF-8 | Java | 2,009 | java | PictureActivity.java | Java | [
{
"context": "vity;\r\n\r\nimport java.io.File;\r\n\r\n\r\n/**\r\n * @author Administrator\r\n * @version $Rev$\r\n * @time 2016/4/916:34\r\n * @d",
"end": 367,
"score": 0.9497128129005432,
"start": 354,
"tag": "USERNAME",
"value": "Administrator"
}
]
| null | []
| package com.fatcat.easy_transfer.activity;
import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.fatcat.easy_transfer.R;
import com.fatcat.easy_transfer.base.BaseActivity;
import java.io.File;
/**
* @author Administrator
* @version $Rev$
* @time 2016/4/916:34
* @des ${TODO}
* @updateAuthor $Author$
* @updateDate $Date$
* @updateDes ${TODO}
*/
public class PictureActivity extends BaseActivity {
private Toolbar mToolbar;
private ImageView mImageView;
@Override
public void initView() {
setContentView(R.layout.activity_picture);
}
@Override
protected void initActionBar() {
super.initActionBar();
mToolbar = (Toolbar) findViewById(R.id.toolbar);
// toolbar.setLogo(R.drawable.ic_launcher);
mToolbar.setTitle("查看图片");// 标题的文字需在setSupportActionBar之前,不然会无效
// toolbar.setSubtitle("副标题");
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
protected void initData() {
super.initData();
Intent intent = getIntent();
String picturePath = intent.getStringExtra("PicturePath");
File pictureFile = new File(picturePath);
mImageView = (ImageView) findViewById(R.id.iv_picture_watch);
Glide.with(this).load(pictureFile).into(mImageView);
}
@Override
protected void initListener() {
super.initListener();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
}
| 2,009 | 0.620356 | 0.614758 | 83 | 21.674698 | 20.277657 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361446 | false | false | 15 |
6a0ca64877fbb5a27b0f375840c7ca2e7d5741b7 | 6,657,199,353,980 | ef0f15b78f183d6747c042e551ac1d541ce2c911 | /src/de/_13ducks/spacebatz/client/graphics/input/impl/OverlayInputMode.java | 9526862c6da598ea19e58134fd81be1cb224ed58 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
]
| permissive | tfg13/spacebatz | https://github.com/tfg13/spacebatz | 4878013c74ed415375a4df884df5cc381537e6eb | d316bbee90e38a0236b82b6b84dee9a80acd8bcf | refs/heads/master | 2020-04-10T14:15:10.939000 | 2015-09-27T20:54:19 | 2015-09-27T20:54:19 | 5,528,232 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de._13ducks.spacebatz.client.graphics.input.impl;
import java.util.ArrayList;
import java.util.List;
/**
* Beschreibt, für was für Arten von Input sich das Overlay interessiert und wann es Input bekommt.
*
* Overlays können beliebig viele Tasten und Bildschrimbereiche als Trigger registrieren lassen.
* Wenn eine solche Taste oder Bildschrimbereich gedrückt/angeklickt wird, wird das Inputsystem das Overlay benachrichtigen und ihm Vollzugriff auf Tastatur und Maus geben.
*
* Ein OverlayInputListener ist entweder getriggert oder nicht, es wird nicht zwischen Trigger für Tastatur- und Mauseingaben unterschieden.
*
* Diese Konstruktor(en) und Methoden dieser Klasse führen keinen Test durch, ob die Parameter sinnvoll sind.
* Das Verhalten des Inputsystems, bei definierten Triggern ohne Triggeraktionen oder undefinierten Triggern ohne Triggeraktionen ist undefiniert.
*
* Diese Klasse hat praktisch kein Verhalten und speichert nur Informationen. (*hust* Scala-structs *hust*)
*
* @author Tobias Fleig <tobifleig@googlemail.com>
*/
public class OverlayInputMode {
/**
* Niemals Tastatureingaben auslesen.
*/
public static final int KEYBOARD_MODE_NEVER = 0;
/**
* Overlay bekommt exklusiv (!) alle Tastatureingaben, sobald eine Triggertaste gedrückt wurde.
*/
public static final int KEYBOARD_MODE_TRIGGER = 1;
/**
* Overlay liest immer passiv die Tastatureingaben mit, hat aber keinen Exklusivzugriff.
*/
public static final int KEYBOARD_MODE_PASSIVE = 2;
/**
* Niemals Mauseingaben auslesen, niemals Mauseingaben für Haupt-Input blockieren.
*/
public static final int MOUSE_MODE_NEVER = 10;
/**
* Overlay bekommt Mauseingaben, während die Maus über dem Overlay schwebt.
* Mausbewegungen (nur die) gehen gleichzeigt aber weiter an den Haupt-Input.
*/
public static final int MOUSE_MODE_HOVER_NONBLOCKING = 11;
/**
* Overlay bekommt alle Mauseingaben, nachdem es getriggert wurde.
* Mausbewegungen (nur die) gehen gleichzeitig aber weiter an den Rest.
*/
public static final int MOUSE_MODE_TRIGGER_NONBLOCKING = 12;
/**
* Overlay bekommt alle Mauseingaben exklusiv, nachdem es getriggert wurde.
*/
public static final int MOUSE_MODE_TRIGGER_BLOCKING = 13;
/**
* Der gewählte Tastatur-Eingabemodus.
*/
public final int keyboardMode;
/**
* Der gewählte Maus-Eingabemodus.
*/
public final int mouseMode;
/**
* Tastatureingaben, die diesen Modus triggern.
*/
public final List<Integer> triggerKeys = new ArrayList<>();
/**
* Bereiche auf dem Bildschrim, die diesen Modus triggern.
* Angaben in Pixeln, die Arrays müssen 4 Einträge haben: X1, Y1, X2, Y2
*/
public final List<int[]> triggerZones = new ArrayList<>();
/**
* Erzeugt einen neuen Overlay-Eingabemodus mit den gegebenen Parametern.
* @param keyboardMode
* @param mouseMode
*/
public OverlayInputMode(int keyboardMode, int mouseMode) {
this.keyboardMode = keyboardMode;
this.mouseMode = mouseMode;
}
}
| UTF-8 | Java | 3,185 | java | OverlayInputMode.java | Java | [
{
"context": "ionen. (*hust* Scala-structs *hust*)\n *\n * @author Tobias Fleig <tobifleig@googlemail.com>\n */\npublic class Overl",
"end": 1033,
"score": 0.9998795390129089,
"start": 1021,
"tag": "NAME",
"value": "Tobias Fleig"
},
{
"context": "Scala-structs *hust*)\n *\n * @author Tobias Fleig <tobifleig@googlemail.com>\n */\npublic class OverlayInputMode {\n \n /**",
"end": 1059,
"score": 0.999931812286377,
"start": 1035,
"tag": "EMAIL",
"value": "tobifleig@googlemail.com"
}
]
| null | []
| package de._13ducks.spacebatz.client.graphics.input.impl;
import java.util.ArrayList;
import java.util.List;
/**
* Beschreibt, für was für Arten von Input sich das Overlay interessiert und wann es Input bekommt.
*
* Overlays können beliebig viele Tasten und Bildschrimbereiche als Trigger registrieren lassen.
* Wenn eine solche Taste oder Bildschrimbereich gedrückt/angeklickt wird, wird das Inputsystem das Overlay benachrichtigen und ihm Vollzugriff auf Tastatur und Maus geben.
*
* Ein OverlayInputListener ist entweder getriggert oder nicht, es wird nicht zwischen Trigger für Tastatur- und Mauseingaben unterschieden.
*
* Diese Konstruktor(en) und Methoden dieser Klasse führen keinen Test durch, ob die Parameter sinnvoll sind.
* Das Verhalten des Inputsystems, bei definierten Triggern ohne Triggeraktionen oder undefinierten Triggern ohne Triggeraktionen ist undefiniert.
*
* Diese Klasse hat praktisch kein Verhalten und speichert nur Informationen. (*hust* Scala-structs *hust*)
*
* @author <NAME> <<EMAIL>>
*/
public class OverlayInputMode {
/**
* Niemals Tastatureingaben auslesen.
*/
public static final int KEYBOARD_MODE_NEVER = 0;
/**
* Overlay bekommt exklusiv (!) alle Tastatureingaben, sobald eine Triggertaste gedrückt wurde.
*/
public static final int KEYBOARD_MODE_TRIGGER = 1;
/**
* Overlay liest immer passiv die Tastatureingaben mit, hat aber keinen Exklusivzugriff.
*/
public static final int KEYBOARD_MODE_PASSIVE = 2;
/**
* Niemals Mauseingaben auslesen, niemals Mauseingaben für Haupt-Input blockieren.
*/
public static final int MOUSE_MODE_NEVER = 10;
/**
* Overlay bekommt Mauseingaben, während die Maus über dem Overlay schwebt.
* Mausbewegungen (nur die) gehen gleichzeigt aber weiter an den Haupt-Input.
*/
public static final int MOUSE_MODE_HOVER_NONBLOCKING = 11;
/**
* Overlay bekommt alle Mauseingaben, nachdem es getriggert wurde.
* Mausbewegungen (nur die) gehen gleichzeitig aber weiter an den Rest.
*/
public static final int MOUSE_MODE_TRIGGER_NONBLOCKING = 12;
/**
* Overlay bekommt alle Mauseingaben exklusiv, nachdem es getriggert wurde.
*/
public static final int MOUSE_MODE_TRIGGER_BLOCKING = 13;
/**
* Der gewählte Tastatur-Eingabemodus.
*/
public final int keyboardMode;
/**
* Der gewählte Maus-Eingabemodus.
*/
public final int mouseMode;
/**
* Tastatureingaben, die diesen Modus triggern.
*/
public final List<Integer> triggerKeys = new ArrayList<>();
/**
* Bereiche auf dem Bildschrim, die diesen Modus triggern.
* Angaben in Pixeln, die Arrays müssen 4 Einträge haben: X1, Y1, X2, Y2
*/
public final List<int[]> triggerZones = new ArrayList<>();
/**
* Erzeugt einen neuen Overlay-Eingabemodus mit den gegebenen Parametern.
* @param keyboardMode
* @param mouseMode
*/
public OverlayInputMode(int keyboardMode, int mouseMode) {
this.keyboardMode = keyboardMode;
this.mouseMode = mouseMode;
}
}
| 3,162 | 0.705771 | 0.700095 | 82 | 37.670731 | 38.985004 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.414634 | false | false | 15 |
389df635e2cb2e9b9ff117a000d659278a9e7e98 | 26,336,739,521,934 | d29cfda6c444a972610c6eb21403f1b32fd2e3be | /app/src/main/java/com/ghmc/biswajeet/ghmcrating/Dbmodel.java | 532ad4c3e4662b970fcc359d616687d530b4c1b6 | []
| no_license | biswajeet619/GhmcRating | https://github.com/biswajeet619/GhmcRating | 78fb60081ebfb1e635a82a34a7bff65c86be88bb | eca6333bae011fe0eb5f499497148374f6d404fc | refs/heads/master | 2021-01-13T08:43:02.720000 | 2019-05-15T15:20:48 | 2019-05-15T15:20:48 | 81,638,477 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ghmc.biswajeet.ghmcrating;
/**
* Created by biswajeet on 10/2/17.
*/
public class Dbmodel {
private String Email;
private String Phno;
private String Password;
private String Locality;
private Integer Rating;
public Dbmodel(String Locality,Integer Rating){
this.Locality=Locality;
this.Rating=Rating;
}
public String getEmail(){
return Email;
}
public String getPhno(){
return Phno;
}
public String getPassword(){
return Password;
}
public void setEmail(String Email){
this.Email=Email;
}
public void setPhno(String Phno){
this.Phno=Phno;
}
public void setPassword(String Password){
this.Password=Password;
}
public void setLocality(String Locality){
this.Locality=Locality;
}
public String getLocality(){return Locality;}
public void setRating(Integer Rating){
this.Rating=Rating;
}
public Integer getRating(){return Rating;}
}
| UTF-8 | Java | 1,039 | java | Dbmodel.java | Java | [
{
"context": " com.ghmc.biswajeet.ghmcrating;\n\n/**\n * Created by biswajeet on 10/2/17.\n */\n\npublic class Dbmodel {\n priva",
"end": 67,
"score": 0.9996554255485535,
"start": 58,
"tag": "USERNAME",
"value": "biswajeet"
},
{
"context": "tPassword(String Password){\n this.Password=Password;\n }\n public void setLocality(String Localit",
"end": 766,
"score": 0.9090057611465454,
"start": 758,
"tag": "PASSWORD",
"value": "Password"
}
]
| null | []
| package com.ghmc.biswajeet.ghmcrating;
/**
* Created by biswajeet on 10/2/17.
*/
public class Dbmodel {
private String Email;
private String Phno;
private String Password;
private String Locality;
private Integer Rating;
public Dbmodel(String Locality,Integer Rating){
this.Locality=Locality;
this.Rating=Rating;
}
public String getEmail(){
return Email;
}
public String getPhno(){
return Phno;
}
public String getPassword(){
return Password;
}
public void setEmail(String Email){
this.Email=Email;
}
public void setPhno(String Phno){
this.Phno=Phno;
}
public void setPassword(String Password){
this.Password=<PASSWORD>;
}
public void setLocality(String Locality){
this.Locality=Locality;
}
public String getLocality(){return Locality;}
public void setRating(Integer Rating){
this.Rating=Rating;
}
public Integer getRating(){return Rating;}
}
| 1,041 | 0.632339 | 0.627526 | 48 | 20.645834 | 16.046144 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.395833 | false | false | 15 |
847812051874d848e9ea93beb8289a4e5254542f | 36,043,365,576,061 | 5d1a40342ecf8eb90642fa4ba3179d68839cb116 | /src/main/java/com/caionastu/exampleReactiveService/api/application/core/ErrorMessage.java | a4b5994e7fa2b0202561a9fa2170e53105ab2df3 | []
| no_license | caionastu/reactive-spring-example | https://github.com/caionastu/reactive-spring-example | 60dc9d2bcffda13ae7d3414589b94bf06b68fccd | 6226fca985c30603841aedf0d1f77155c063b600 | refs/heads/master | 2022-11-04T05:51:00.180000 | 2020-06-20T20:07:05 | 2020-06-20T20:07:05 | 272,682,795 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.caionastu.exampleReactiveService.api.application.core;
import lombok.*;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ErrorMessage {
private String domain;
private String message;
}
| UTF-8 | Java | 235 | java | ErrorMessage.java | Java | []
| null | []
| package com.caionastu.exampleReactiveService.api.application.core;
import lombok.*;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ErrorMessage {
private String domain;
private String message;
}
| 235 | 0.795745 | 0.795745 | 13 | 17.076923 | 17.103582 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 15 |
131f70a6251a28f853eb84b414330a29a9528237 | 38,903,813,772,138 | 3b166e206392bde37908553167b544bf6917a2f4 | /app/src/main/java/com/avtar/android/Constants.java | 7bab5e903b13b84eb53de7ee8cd035b15d7aa634 | [
"MIT"
]
| permissive | android23235616/avtar | https://github.com/android23235616/avtar | d5cf93d8aef907c47b7b66e19af963dc99d19cd5 | 47f00e1330c679201fdd33e026b8449dc797ec17 | refs/heads/master | 2021-09-10T02:19:12.635000 | 2018-03-20T17:24:18 | 2018-03-20T17:24:18 | 126,056,318 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.avtar.android;
public class Constants {
public static String qr_send_url_to_get_ap="http://android23235616.pythonanywhere.com/passenger_enter";
public static String url_stop_trip ="http://android23235616.pythonanywhere.com/passenger_exit";
public static String url_registration="http://android23235616.pythonanywhere.com/passenger";
public static String url_sos="http://android23235616.pythonanywhere.com/sos";
public static String vehicleMAC = null;
public static String CHASSIS = null;
public static boolean tripStarted = false;
//ssos,lat,lng,chesis
//returns mac
}
| UTF-8 | Java | 622 | java | Constants.java | Java | []
| null | []
| package com.avtar.android;
public class Constants {
public static String qr_send_url_to_get_ap="http://android23235616.pythonanywhere.com/passenger_enter";
public static String url_stop_trip ="http://android23235616.pythonanywhere.com/passenger_exit";
public static String url_registration="http://android23235616.pythonanywhere.com/passenger";
public static String url_sos="http://android23235616.pythonanywhere.com/sos";
public static String vehicleMAC = null;
public static String CHASSIS = null;
public static boolean tripStarted = false;
//ssos,lat,lng,chesis
//returns mac
}
| 622 | 0.750804 | 0.699357 | 17 | 35.588234 | 36.964306 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false | 15 |
67020379452c5d26137edfc93eb62d36ba17b0dd | 38,903,813,773,678 | 35e82cd8f5a94a53e829597b3deb2a9e80adc054 | /ToBeRich/src/Team1/Board_main.java | 7d7eac37b77182a07f36609924b6643b3325a727 | []
| no_license | guak908/ToBeRich | https://github.com/guak908/ToBeRich | c0b021a6e242797d4802276a7ce26244376f9585 | 600a589b82422b5b201b4abce02ea0a4b4d9d75e | refs/heads/master | 2021-05-25T09:20:26.776000 | 2018-04-06T04:46:03 | 2018-04-06T04:46:03 | 126,970,551 | 2 | 0 | null | false | 2018-04-06T04:46:04 | 2018-03-27T10:33:40 | 2018-04-05T16:34:53 | 2018-04-06T04:46:04 | 315 | 1 | 0 | 0 | Java | false | null | package Team1;
import java.awt.Font;
import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.SystemColor;
class Board_main extends JFrame{
//DS 선언식으로 모아 둔 변수 생성 위치들 변경함
JPanel mainPanel = new JPanel();
JLabel lblNewLabel = new JLabel("제목");
JTextField textField = new JTextField();
JLabel label = new JLabel("번호");
JTextField textField_1 = new JTextField();
JLabel label_1 = new JLabel("날짜");
JTextField textField_2 = new JTextField();
//DS 이미지를 넣을 라벨 변수 생성
JLabel imgLabel;
JTextArea textArea_1 = new JTextArea();
JTextArea TA_print_comment = new JTextArea();
JButton btnNewButton = new JButton("수정");
JButton button = new JButton("삭제");
//DS DB경로 생성
private File target = new File("DB","board.txt");
private Image img = null;
//DS 이미지 경로가 저장 될 변수 생성
private File imgPath;
//DS 게시판 번호가 저장 되는 변수
private int number;
//DS 클릭한 게시물의 map데이터를 가져와 갱신할 map,list생성
private Map<Integer,List<Object>> map = new HashMap<>();
private List<Object> list = new ArrayList();
ImageIcon ic;
private JTextField TF_add_comment;
private String printed_comment ;
//main에 하던 설정들을 생성자에서 진행
public Board_main(int number) {
//DS 생성자에서 게시물 번호를 전달 받아 number변수에 저장한다
this.number = number;
//DS DB에서 전체 map데이터를 불러와서 number에 해당하는 map데이터만을 list에 갱신한다
try{
FileClient FC = new FileClient("127.0.0.1",8888);
//DS DB에서 전체 map 정보를 불러와 현재 map에 갱신
map = (Map<Integer,List<Object>>)FC.call_request("board");
//DS 현재 map에서 number(게시물 번호)에 해당하는 key값의 value만을 현재 list에 저장
list = map.get(number);
//System.out.println(list.get(1)); //DS DB에서 가져온 해당 게시물 내용을 확인할 수 있다
}catch(Exception e) {
System.out.println("DB에서 데이터를 가져올 때 오류");
}
//DS 생성자를 통해 게시물 확일 폼이 뜰 때마다 조회수가 1씩 증가하는 메소드 호출
// BoardControl bc = new BoardControl();
// bc.viewAdd(map,number);
//DS 생성자에서 list의 2인덱스 데이터를 받아 이미지 경로를 저장하고
//이미지 경로를 Image타입으로 변환해 저장한다
try {
imgPath = (File)list.get(2);
img = ImageIO.read(imgPath);
} catch (IOException e) {
System.out.println("이미지 파일이 없습니다.");
}
//DS Image타입의 변수를 ImageIcon으로 변환 후 상위 클래스 타입인 JLabel에 삽입한다
imgLabel = new JLabel(new ImageIcon(img));
this.display();//화면 구성 관련 처리
this.event();//이벤트 관련 처리
this.menu();//메뉴 관련 처리
this.setTitle("게시판 내용 확인");
this.setSize(1000, 600);
//this.setLocation(100, 100);
//위치를 운영체제가 결정하도록 한다
this.setLocationByPlatform(true);
this.setResizable(false);
this.setVisible(true);
}
private void display() {
this.setContentPane(mainPanel);
mainPanel.setLayout(null);
lblNewLabel.setFont(new Font("굴림", Font.PLAIN, 14));
lblNewLabel.setBounds(12, 10, 28, 21);
mainPanel.add(lblNewLabel);
label.setFont(new Font("굴림", Font.PLAIN, 14));
label.setBounds(254, 10, 28, 21);
mainPanel.add(label);
label_1.setFont(new Font("굴림", Font.PLAIN, 14));
label_1.setBounds(488, 10, 28, 21);
mainPanel.add(label_1);
textField.setBounds(47, 11, 145, 26);
mainPanel.add(textField);
//DS list의 0인덱스(제목)를 필드에 채움
textField.setText((String)list.get(0));
textField_1.setEditable(false);
textField_1.setColumns(10);
textField_1.setBounds(294, 11, 145, 26);
mainPanel.add(textField_1);
//DS Main_Form에서 받은 게시판 번호(number)를 필드에 채움
textField_1.setText(String.valueOf(number));
textField_2.setEditable(false);
textField_2.setColumns(10);
textField_2.setBounds(535, 11, 167, 26);
mainPanel.add(textField_2);
//DS list의 5인덱스(날짜)를 필드에 채움
textField_2.setText((String)list.get(5));
//DS 이미 생성자에서 만든 이미지를 담고 있는 imgLabel변수를 폼의 위치에 설정한다
imgLabel.setBounds(12, 41, 481, 320);
mainPanel.add(imgLabel);
textArea_1.setBounds(505, 41, 197, 320);
mainPanel.add(textArea_1);
textArea_1.setText((String)list.get(3));
JScrollPane scroll = new JScrollPane(textArea_1);
scroll.setBounds(505, 41, 197, 320);
mainPanel.add(scroll);
TA_print_comment.setBackground(SystemColor.control);
TA_print_comment.setEditable(false);
List<Object>temp_O = map.get(number);
List<String> temp_S = (List<String>)temp_O.get(7);
for(int i=temp_S.size()-1;i>=0;i--){
// System.out.println("댓글 합치는중");
// System.out.println(temp_S.get(i));
printed_comment += temp_S.get(i)+" \n";
}
//null들어가는거 제거
System.out.println(printed_comment);
//댓글처럼 달리게 보이도록 출력하기
TA_print_comment.setText(printed_comment);
TA_print_comment.setBounds(12, 371, 690, 130);
mainPanel.add(TA_print_comment);
JScrollPane scroll_1 = new JScrollPane(TA_print_comment);
scroll_1.setBounds(12, 406, 690, 147);
mainPanel.add(scroll_1);
//textArea_3.setText("광고"); //광고 내용이 담길 공간
btnNewButton.setBounds(760, 511, 97, 45);
mainPanel.add(btnNewButton);
button.setBounds(883, 511, 97, 45);
mainPanel.add(button);
ic = new ImageIcon("property/googlead.png");
JLabel ad_sense = new JLabel();
ad_sense.setIcon(ic);
ad_sense.setBounds(716, 42, 257, 457);
mainPanel.add(ad_sense);
TF_add_comment = new JTextField();
TF_add_comment.setEditable(false);
TF_add_comment.setBounds(12, 374, 599, 24);
mainPanel.add(TF_add_comment);
TF_add_comment.setColumns(10);
JButton btnNewButton_1 = new JButton("\uB4F1\uB85D");
btnNewButton_1.setEnabled(false);
btnNewButton_1.setBounds(613, 373, 89, 27);
mainPanel.add(btnNewButton_1);
}
private void event() {
//setDefaultCloseOperation(EXIT_ON_CLOSE);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
//setDefaultCloseOperation(HIDE_ON_CLOSE);
//setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);//JFrame 기본 이벤트 방지
//DS 수정 버튼을 눌렀을 때 이벤트 설정
btnNewButton.addActionListener(e->{
//DS 비번 입력창을 띄운다
String pw = JOptionPane.showInputDialog(null,"게시물 비번을 입력해주세요");
//DS DB에 저장 되어 있는 비번과 입력 받은 비번이 일치하면 수정 완료 메시지창 띄우고 해당 폼 닫기
if(list.get(1).equals(pw)) {
//DS BoardControl 객체 생성
try{
BoardControl bc = new BoardControl();
//DS BoardControl 내의 updateSet(수정기능) 메소드를 호출하며 field와 area에 입력한 데이터를 전달한다
bc.updateSet(number,textField.getText(),textArea_1.getText());
}catch(Exception err){
err.printStackTrace();
}
//DS 완료 확인창을 띄운다
JOptionPane.showMessageDialog(null,"게시물 수정 완료");
//DS 해당 폼을 종료한다
dispose();
//DS 비번 입력창에서 취소 버튼을 누르면 비번 입력창 닫기
}else if(pw == null) {
//DS 아무른 이벤트 없음
//DS 입력한 비번이 불일치하면 오류 메시지창을 띄운다
}else if(list.get(1) != (pw)) {
JOptionPane.showMessageDialog(null, "비밀번호 불일치", "불일치", JOptionPane.ERROR_MESSAGE);
}
});
//DS 삭제 버튼을 눌렀을 때 이벤트 설정
button.addActionListener(e->{
//DS 비번 입력창을 띄운다
String pw = JOptionPane.showInputDialog(null,"게시물 비번을 입력해주세요");
//DS DB에 저장 되어 있는 비번과 입력 받은 비번이 일치하면 수정 완료 메시지창 띄우고 해당 폼 닫기
if(list.get(1).equals(pw)) {
//DS BoardControl 객체 생성
try{
BoardControl bc = new BoardControl();
//DS BoardControl 내의 delete(게시물 삭제 기능) 메소드 호출이며 전달 데이터로는 최신 갱신 map,게시물 번호,해당 이미지 경로가 있다
bc.delete(number,imgPath);
}catch(Exception err){
err.printStackTrace();
}
//DS 완료 확인창을 띄운다
JOptionPane.showMessageDialog(null,"게시물 삭제 완료");
//DS 해당 폼을 종료한다
dispose();
}else if(pw == null) {
//DS 아무른 이벤트 없음
//DS 입력한 비번이 불일치하면 오류 메시지창을 띄운다
}else if(list.get(1) != (pw)) {
JOptionPane.showMessageDialog(null, "비밀번호 불일치", "불일치", JOptionPane.ERROR_MESSAGE);
}
});
}
private void menu() {
}
} | UHC | Java | 10,600 | java | Board_main.java | Java | [
{
"context": "신한다\r\n\t try{\r\n\t\t FileClient FC = new FileClient(\"127.0.0.1\",8888);\r\n\t\t \r\n\t\t //DS DB에서 전체 map 정보를 불러와 현재 ",
"end": 1998,
"score": 0.9997430443763733,
"start": 1989,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
]
| null | []
| package Team1;
import java.awt.Font;
import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.SystemColor;
class Board_main extends JFrame{
//DS 선언식으로 모아 둔 변수 생성 위치들 변경함
JPanel mainPanel = new JPanel();
JLabel lblNewLabel = new JLabel("제목");
JTextField textField = new JTextField();
JLabel label = new JLabel("번호");
JTextField textField_1 = new JTextField();
JLabel label_1 = new JLabel("날짜");
JTextField textField_2 = new JTextField();
//DS 이미지를 넣을 라벨 변수 생성
JLabel imgLabel;
JTextArea textArea_1 = new JTextArea();
JTextArea TA_print_comment = new JTextArea();
JButton btnNewButton = new JButton("수정");
JButton button = new JButton("삭제");
//DS DB경로 생성
private File target = new File("DB","board.txt");
private Image img = null;
//DS 이미지 경로가 저장 될 변수 생성
private File imgPath;
//DS 게시판 번호가 저장 되는 변수
private int number;
//DS 클릭한 게시물의 map데이터를 가져와 갱신할 map,list생성
private Map<Integer,List<Object>> map = new HashMap<>();
private List<Object> list = new ArrayList();
ImageIcon ic;
private JTextField TF_add_comment;
private String printed_comment ;
//main에 하던 설정들을 생성자에서 진행
public Board_main(int number) {
//DS 생성자에서 게시물 번호를 전달 받아 number변수에 저장한다
this.number = number;
//DS DB에서 전체 map데이터를 불러와서 number에 해당하는 map데이터만을 list에 갱신한다
try{
FileClient FC = new FileClient("127.0.0.1",8888);
//DS DB에서 전체 map 정보를 불러와 현재 map에 갱신
map = (Map<Integer,List<Object>>)FC.call_request("board");
//DS 현재 map에서 number(게시물 번호)에 해당하는 key값의 value만을 현재 list에 저장
list = map.get(number);
//System.out.println(list.get(1)); //DS DB에서 가져온 해당 게시물 내용을 확인할 수 있다
}catch(Exception e) {
System.out.println("DB에서 데이터를 가져올 때 오류");
}
//DS 생성자를 통해 게시물 확일 폼이 뜰 때마다 조회수가 1씩 증가하는 메소드 호출
// BoardControl bc = new BoardControl();
// bc.viewAdd(map,number);
//DS 생성자에서 list의 2인덱스 데이터를 받아 이미지 경로를 저장하고
//이미지 경로를 Image타입으로 변환해 저장한다
try {
imgPath = (File)list.get(2);
img = ImageIO.read(imgPath);
} catch (IOException e) {
System.out.println("이미지 파일이 없습니다.");
}
//DS Image타입의 변수를 ImageIcon으로 변환 후 상위 클래스 타입인 JLabel에 삽입한다
imgLabel = new JLabel(new ImageIcon(img));
this.display();//화면 구성 관련 처리
this.event();//이벤트 관련 처리
this.menu();//메뉴 관련 처리
this.setTitle("게시판 내용 확인");
this.setSize(1000, 600);
//this.setLocation(100, 100);
//위치를 운영체제가 결정하도록 한다
this.setLocationByPlatform(true);
this.setResizable(false);
this.setVisible(true);
}
private void display() {
this.setContentPane(mainPanel);
mainPanel.setLayout(null);
lblNewLabel.setFont(new Font("굴림", Font.PLAIN, 14));
lblNewLabel.setBounds(12, 10, 28, 21);
mainPanel.add(lblNewLabel);
label.setFont(new Font("굴림", Font.PLAIN, 14));
label.setBounds(254, 10, 28, 21);
mainPanel.add(label);
label_1.setFont(new Font("굴림", Font.PLAIN, 14));
label_1.setBounds(488, 10, 28, 21);
mainPanel.add(label_1);
textField.setBounds(47, 11, 145, 26);
mainPanel.add(textField);
//DS list의 0인덱스(제목)를 필드에 채움
textField.setText((String)list.get(0));
textField_1.setEditable(false);
textField_1.setColumns(10);
textField_1.setBounds(294, 11, 145, 26);
mainPanel.add(textField_1);
//DS Main_Form에서 받은 게시판 번호(number)를 필드에 채움
textField_1.setText(String.valueOf(number));
textField_2.setEditable(false);
textField_2.setColumns(10);
textField_2.setBounds(535, 11, 167, 26);
mainPanel.add(textField_2);
//DS list의 5인덱스(날짜)를 필드에 채움
textField_2.setText((String)list.get(5));
//DS 이미 생성자에서 만든 이미지를 담고 있는 imgLabel변수를 폼의 위치에 설정한다
imgLabel.setBounds(12, 41, 481, 320);
mainPanel.add(imgLabel);
textArea_1.setBounds(505, 41, 197, 320);
mainPanel.add(textArea_1);
textArea_1.setText((String)list.get(3));
JScrollPane scroll = new JScrollPane(textArea_1);
scroll.setBounds(505, 41, 197, 320);
mainPanel.add(scroll);
TA_print_comment.setBackground(SystemColor.control);
TA_print_comment.setEditable(false);
List<Object>temp_O = map.get(number);
List<String> temp_S = (List<String>)temp_O.get(7);
for(int i=temp_S.size()-1;i>=0;i--){
// System.out.println("댓글 합치는중");
// System.out.println(temp_S.get(i));
printed_comment += temp_S.get(i)+" \n";
}
//null들어가는거 제거
System.out.println(printed_comment);
//댓글처럼 달리게 보이도록 출력하기
TA_print_comment.setText(printed_comment);
TA_print_comment.setBounds(12, 371, 690, 130);
mainPanel.add(TA_print_comment);
JScrollPane scroll_1 = new JScrollPane(TA_print_comment);
scroll_1.setBounds(12, 406, 690, 147);
mainPanel.add(scroll_1);
//textArea_3.setText("광고"); //광고 내용이 담길 공간
btnNewButton.setBounds(760, 511, 97, 45);
mainPanel.add(btnNewButton);
button.setBounds(883, 511, 97, 45);
mainPanel.add(button);
ic = new ImageIcon("property/googlead.png");
JLabel ad_sense = new JLabel();
ad_sense.setIcon(ic);
ad_sense.setBounds(716, 42, 257, 457);
mainPanel.add(ad_sense);
TF_add_comment = new JTextField();
TF_add_comment.setEditable(false);
TF_add_comment.setBounds(12, 374, 599, 24);
mainPanel.add(TF_add_comment);
TF_add_comment.setColumns(10);
JButton btnNewButton_1 = new JButton("\uB4F1\uB85D");
btnNewButton_1.setEnabled(false);
btnNewButton_1.setBounds(613, 373, 89, 27);
mainPanel.add(btnNewButton_1);
}
private void event() {
//setDefaultCloseOperation(EXIT_ON_CLOSE);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
//setDefaultCloseOperation(HIDE_ON_CLOSE);
//setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);//JFrame 기본 이벤트 방지
//DS 수정 버튼을 눌렀을 때 이벤트 설정
btnNewButton.addActionListener(e->{
//DS 비번 입력창을 띄운다
String pw = JOptionPane.showInputDialog(null,"게시물 비번을 입력해주세요");
//DS DB에 저장 되어 있는 비번과 입력 받은 비번이 일치하면 수정 완료 메시지창 띄우고 해당 폼 닫기
if(list.get(1).equals(pw)) {
//DS BoardControl 객체 생성
try{
BoardControl bc = new BoardControl();
//DS BoardControl 내의 updateSet(수정기능) 메소드를 호출하며 field와 area에 입력한 데이터를 전달한다
bc.updateSet(number,textField.getText(),textArea_1.getText());
}catch(Exception err){
err.printStackTrace();
}
//DS 완료 확인창을 띄운다
JOptionPane.showMessageDialog(null,"게시물 수정 완료");
//DS 해당 폼을 종료한다
dispose();
//DS 비번 입력창에서 취소 버튼을 누르면 비번 입력창 닫기
}else if(pw == null) {
//DS 아무른 이벤트 없음
//DS 입력한 비번이 불일치하면 오류 메시지창을 띄운다
}else if(list.get(1) != (pw)) {
JOptionPane.showMessageDialog(null, "비밀번호 불일치", "불일치", JOptionPane.ERROR_MESSAGE);
}
});
//DS 삭제 버튼을 눌렀을 때 이벤트 설정
button.addActionListener(e->{
//DS 비번 입력창을 띄운다
String pw = JOptionPane.showInputDialog(null,"게시물 비번을 입력해주세요");
//DS DB에 저장 되어 있는 비번과 입력 받은 비번이 일치하면 수정 완료 메시지창 띄우고 해당 폼 닫기
if(list.get(1).equals(pw)) {
//DS BoardControl 객체 생성
try{
BoardControl bc = new BoardControl();
//DS BoardControl 내의 delete(게시물 삭제 기능) 메소드 호출이며 전달 데이터로는 최신 갱신 map,게시물 번호,해당 이미지 경로가 있다
bc.delete(number,imgPath);
}catch(Exception err){
err.printStackTrace();
}
//DS 완료 확인창을 띄운다
JOptionPane.showMessageDialog(null,"게시물 삭제 완료");
//DS 해당 폼을 종료한다
dispose();
}else if(pw == null) {
//DS 아무른 이벤트 없음
//DS 입력한 비번이 불일치하면 오류 메시지창을 띄운다
}else if(list.get(1) != (pw)) {
JOptionPane.showMessageDialog(null, "비밀번호 불일치", "불일치", JOptionPane.ERROR_MESSAGE);
}
});
}
private void menu() {
}
} | 10,600 | 0.600653 | 0.572957 | 271 | 30.782288 | 18.678692 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.350554 | false | false | 15 |
41f7fbbb7bdb55e5e55d1773a06099dcee6a7fa8 | 18,047,452,630,620 | 7ce47605a889ede11dd058512bf6ede9beb513dd | /src/br/com/cetip/aplicacao/garantias/negocio/RetirarGarantiaMainframe.java | 185487f7699e772e91a7bb9d4c31c454fc5d85d9 | []
| no_license | codetime66/guarantee | https://github.com/codetime66/guarantee | ecf50b8c64ea765dfd8f4afe8543b216acaa8297 | dd472059b0f3e51f3dc7093d50b57ce045e139cf | refs/heads/master | 2020-03-11T22:27:46.379000 | 2018-04-20T01:43:47 | 2018-04-20T01:43:47 | 130,292,861 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.cetip.aplicacao.garantias.negocio;
import br.com.cetip.aplicacao.garantias.apinegocio.IRetirarGarantia;
import br.com.cetip.dados.aplicacao.sca.SistemaDO;
public class RetirarGarantiaMainframe extends RetirarGarantiaCetip21 implements
IRetirarGarantia {
public void registrar(TiposRetiradaGarantia tipos) {
tipos.registrar(SistemaDO.MOP, this);
tipos.registrar(SistemaDO.SNA, this);
tipos.registrar(SistemaDO.SND, this);
}
}
| UTF-8 | Java | 482 | java | RetirarGarantiaMainframe.java | Java | []
| null | []
| package br.com.cetip.aplicacao.garantias.negocio;
import br.com.cetip.aplicacao.garantias.apinegocio.IRetirarGarantia;
import br.com.cetip.dados.aplicacao.sca.SistemaDO;
public class RetirarGarantiaMainframe extends RetirarGarantiaCetip21 implements
IRetirarGarantia {
public void registrar(TiposRetiradaGarantia tipos) {
tipos.registrar(SistemaDO.MOP, this);
tipos.registrar(SistemaDO.SNA, this);
tipos.registrar(SistemaDO.SND, this);
}
}
| 482 | 0.76556 | 0.761411 | 15 | 30.133333 | 26.973732 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 15 |
e3ab0cb479b23a0d89ca0e720850c13bd7562dcd | 8,830,452,808,371 | f15889af407de46a94fd05f6226c66182c6085d0 | /trackrite/src/main/java/com/nas/recovery/web/action/workflowmgt/bugManagement/assign/InitiatorAssignment.java | 661cbae22bebd2cee5efacbfdd4a968390d916e2 | []
| no_license | oreon/sfcode-full | https://github.com/oreon/sfcode-full | 231149f07c5b0b9b77982d26096fc88116759e5b | bea6dba23b7824de871d2b45d2a51036b88d4720 | refs/heads/master | 2021-01-10T06:03:27.674000 | 2015-04-27T10:23:10 | 2015-04-27T10:23:10 | 55,370,912 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nas.recovery.web.action.workflowmgt.bugManagement.assign;
import org.jboss.seam.Component;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.exe.Assignable;
import org.wc.trackrite.issues.Issue;
import com.nas.recovery.web.action.issues.IssueAction;
public class InitiatorAssignment implements AssignmentHandler {
public void assign(Assignable assignable, ExecutionContext executionContext)
throws Exception {
Issue issueToken = (Issue) executionContext.getVariable("token");
assignable.setActorId(issueToken.getCreatedByUser().getUserName()); //i
}
}
| UTF-8 | Java | 686 | java | InitiatorAssignment.java | Java | []
| null | []
|
package com.nas.recovery.web.action.workflowmgt.bugManagement.assign;
import org.jboss.seam.Component;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.exe.Assignable;
import org.wc.trackrite.issues.Issue;
import com.nas.recovery.web.action.issues.IssueAction;
public class InitiatorAssignment implements AssignmentHandler {
public void assign(Assignable assignable, ExecutionContext executionContext)
throws Exception {
Issue issueToken = (Issue) executionContext.getVariable("token");
assignable.setActorId(issueToken.getCreatedByUser().getUserName()); //i
}
}
| 686 | 0.766764 | 0.766764 | 20 | 32.099998 | 28.418129 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false | 15 |
df399dc8a7e4ebe1bb2c1f325342522b5e3482ba | 6,253,472,429,281 | 24c6d451d41f7a96916896053e57d9d7d8fc486a | /modules/core/src/com/project/web/cache/StaticEntityCache.java | 2bde494d7f17fa73533a39177c2d429f36352a3e | []
| no_license | AdamSkywalker/littlejavaproject | https://github.com/AdamSkywalker/littlejavaproject | 512f9e4d0753f46ebc34a71fd33e33a9dd2453d1 | 0e70264fa2cf732ecb97c9644910a2d9442f0bf2 | refs/heads/master | 2015-08-24T14:19:28.731000 | 2014-07-15T18:59:39 | 2014-07-15T18:59:39 | 35,761,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.project.web.cache;
import com.project.core.entity.common.Entity;
import com.project.core.entity.common.SoftDelete;
import com.project.core.persistence.EntityManager;
import com.project.core.persistence.Persistence;
import com.project.core.persistence.Transaction;
import com.project.core.sys.AppBeans;
import com.project.core.sys.AppContext;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang.text.StrTokenizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* This is web layer application cache for static entities,
* i.e. entities that are updated seldom or never. Use it
* everywhere when it is possible to decrease database traffic.
* <p/>
* Author: Sergey Saiyan
* Created: 09.08.13 20:35
*/
public class StaticEntityCache {
public static final String NAME = "web_StaticEntityCache";
private Map<Class, List<? extends Entity>> cache = new ConcurrentHashMap<>();
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private Log log = LogFactory.getLog(StaticEntityCache.class);
private Persistence persistence;
@SuppressWarnings("unchecked")
public void init() {
persistence = AppBeans.get(Persistence.NAME);
String cacheEntityConfig = AppContext.getProperty("cacheEntities");
if (StringUtils.isBlank(cacheEntityConfig)) {
throw new IllegalStateException("Missing entity cache config property");
}
StrTokenizer strTokenizer = new StrTokenizer(cacheEntityConfig);
String[] classes = strTokenizer.getTokenArray();
for (String clazz : classes) {
try {
Class c = Class.forName(clazz);
loadEntities(c);
} catch (ClassNotFoundException cnfe) {
log.error(ExceptionUtils.getStackTrace(cnfe));
throw new RuntimeException(cnfe);
}
}
}
@SuppressWarnings("unchecked")
public <T extends Entity> List<T> getEntities(Class<T> clazz) {
return (List<T>) cache.get(clazz);
}
public <T extends Entity> void updateEntityCache(Class<T> clazz) {
lock.readLock().lock();
loadEntities(clazz);
lock.readLock().unlock();
}
public Collection<Class> getCachedClasses() {
return Collections.unmodifiableCollection(cache.keySet());
}
@SuppressWarnings("unchecked")
private void loadEntities(Class clazz) {
Annotation eA = clazz.getAnnotation(javax.persistence.Entity.class);
javax.persistence.Entity e = (javax.persistence.Entity) eA;
String entityName = e.name();
String queryString = String.format("select e from %s e", entityName);
if (SoftDelete.class.isAssignableFrom(clazz)) {
queryString += " where e.deleteTs is null";
}
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();
List entities = em.createQuery(queryString).getResultList();
cache.put(clazz, entities);
} catch (Exception ex) {
log.error(ExceptionUtils.getStackTrace(ex));
throw new RuntimeException(ex);
} finally {
tx.close();
}
}
}
| UTF-8 | Java | 3,723 | java | StaticEntityCache.java | Java | [
{
"context": "to decrease database traffic.\r\n * <p/>\r\n * Author: Sergey Saiyan\r\n * Created: 09.08.13 20:35\r\n */\r\npublic class St",
"end": 1088,
"score": 0.9998871684074402,
"start": 1075,
"tag": "NAME",
"value": "Sergey Saiyan"
}
]
| null | []
| package com.project.web.cache;
import com.project.core.entity.common.Entity;
import com.project.core.entity.common.SoftDelete;
import com.project.core.persistence.EntityManager;
import com.project.core.persistence.Persistence;
import com.project.core.persistence.Transaction;
import com.project.core.sys.AppBeans;
import com.project.core.sys.AppContext;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang.text.StrTokenizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* This is web layer application cache for static entities,
* i.e. entities that are updated seldom or never. Use it
* everywhere when it is possible to decrease database traffic.
* <p/>
* Author: <NAME>
* Created: 09.08.13 20:35
*/
public class StaticEntityCache {
public static final String NAME = "web_StaticEntityCache";
private Map<Class, List<? extends Entity>> cache = new ConcurrentHashMap<>();
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private Log log = LogFactory.getLog(StaticEntityCache.class);
private Persistence persistence;
@SuppressWarnings("unchecked")
public void init() {
persistence = AppBeans.get(Persistence.NAME);
String cacheEntityConfig = AppContext.getProperty("cacheEntities");
if (StringUtils.isBlank(cacheEntityConfig)) {
throw new IllegalStateException("Missing entity cache config property");
}
StrTokenizer strTokenizer = new StrTokenizer(cacheEntityConfig);
String[] classes = strTokenizer.getTokenArray();
for (String clazz : classes) {
try {
Class c = Class.forName(clazz);
loadEntities(c);
} catch (ClassNotFoundException cnfe) {
log.error(ExceptionUtils.getStackTrace(cnfe));
throw new RuntimeException(cnfe);
}
}
}
@SuppressWarnings("unchecked")
public <T extends Entity> List<T> getEntities(Class<T> clazz) {
return (List<T>) cache.get(clazz);
}
public <T extends Entity> void updateEntityCache(Class<T> clazz) {
lock.readLock().lock();
loadEntities(clazz);
lock.readLock().unlock();
}
public Collection<Class> getCachedClasses() {
return Collections.unmodifiableCollection(cache.keySet());
}
@SuppressWarnings("unchecked")
private void loadEntities(Class clazz) {
Annotation eA = clazz.getAnnotation(javax.persistence.Entity.class);
javax.persistence.Entity e = (javax.persistence.Entity) eA;
String entityName = e.name();
String queryString = String.format("select e from %s e", entityName);
if (SoftDelete.class.isAssignableFrom(clazz)) {
queryString += " where e.deleteTs is null";
}
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();
List entities = em.createQuery(queryString).getResultList();
cache.put(clazz, entities);
} catch (Exception ex) {
log.error(ExceptionUtils.getStackTrace(ex));
throw new RuntimeException(ex);
} finally {
tx.close();
}
}
}
| 3,716 | 0.664518 | 0.661832 | 106 | 33.122643 | 24.873909 | 84 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.518868 | false | false | 15 |
4082c38f8d376dd572ca4a2850d4f0abce7959b4 | 19,301,583,079,552 | 5317efd5477c4f30db3cd2e416a27d19c676970f | /application/src/main/java/stdlib/network/UrlConnectionShowCase.java | 03db37c394ae3d51a6d5f50101fd9242ad104bd9 | [
"MIT"
]
| permissive | pickjob/java-starter | https://github.com/pickjob/java-starter | 0b1ea39e154a7582f2e543f250fc392db108f1bb | dd9f3ae3c9f0ca2eed42f6195b9a1bfc722cd65c | refs/heads/master | 2023-04-03T21:47:29.668000 | 2023-03-21T12:09:09 | 2023-03-21T12:09:09 | 157,976,895 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package stdlib.network;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
/**
* URLConnection: JDK自带http支持, 支持 http、https 1.0 1.1
*
* @author pickjob@126.com
* @time 2022-12-16
*/
public class UrlConnectionShowCase {
private static final Logger logger = LogManager.getLogger();
public static void main(String[] args) {
logger.info("UrlConnection用法");
try {
URL url = new URL("https://www.baidu.com");
// obtain urlConnection
URLConnection urlConnection = url.openConnection();
// set request properties
urlConnection.setReadTimeout(5000);
// POST Dat a
// urlConnection.setDoOutput(true);
// PrintWriter writer = new PrintWriter(urlConnection.getOutputStream(), true, StandardCharsets.UTF_8);
// writer.println();
// connect
urlConnection.connect();
// query infomation
Map<String, List<String>> headers = urlConnection.getHeaderFields();
logger.info("headers: {}", headers);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line = null;
while((line = bufferedReader.readLine()) != null) {
logger.info("content: {}", line);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
| UTF-8 | Java | 1,662 | java | UrlConnectionShowCase.java | Java | [
{
"context": ": JDK自带http支持, 支持 http、https 1.0 1.1\n *\n * @author pickjob@126.com\n * @time 2022-12-16\n */\npublic class UrlConnectio",
"end": 359,
"score": 0.9999088048934937,
"start": 344,
"tag": "EMAIL",
"value": "pickjob@126.com"
}
]
| null | []
| package stdlib.network;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
/**
* URLConnection: JDK自带http支持, 支持 http、https 1.0 1.1
*
* @author <EMAIL>
* @time 2022-12-16
*/
public class UrlConnectionShowCase {
private static final Logger logger = LogManager.getLogger();
public static void main(String[] args) {
logger.info("UrlConnection用法");
try {
URL url = new URL("https://www.baidu.com");
// obtain urlConnection
URLConnection urlConnection = url.openConnection();
// set request properties
urlConnection.setReadTimeout(5000);
// POST Dat a
// urlConnection.setDoOutput(true);
// PrintWriter writer = new PrintWriter(urlConnection.getOutputStream(), true, StandardCharsets.UTF_8);
// writer.println();
// connect
urlConnection.connect();
// query infomation
Map<String, List<String>> headers = urlConnection.getHeaderFields();
logger.info("headers: {}", headers);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line = null;
while((line = bufferedReader.readLine()) != null) {
logger.info("content: {}", line);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
| 1,654 | 0.622871 | 0.609489 | 48 | 33.25 | 25.898439 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.645833 | false | false | 15 |
b7d942a0746b6853863754d6b0d6e9eee60a1449 | 35,570,919,180,178 | 8bba2be416ac7e7c8a04bb9f371fd856ea53a7a1 | /chapter_003/src/main/java/ru/job4j/list/ConvertList2Array.java | 8f7dce15347b94e6db0882739306688803db8ece | [
"Apache-2.0"
]
| permissive | azicks/job4j | https://github.com/azicks/job4j | babc9422b73e635ad2d9bc3903ffc1735616a7b3 | 7e02795986880f788dafb5af6be6de96b9ac88ec | refs/heads/master | 2022-10-01T08:26:53.779000 | 2020-03-02T07:29:01 | 2020-03-02T07:29:01 | 159,322,189 | 0 | 0 | Apache-2.0 | false | 2022-09-08T01:05:53 | 2018-11-27T11:05:11 | 2020-03-02T07:29:08 | 2022-09-08T01:05:51 | 380 | 0 | 0 | 5 | Java | false | false |
package ru.job4j.list;
import java.util.ArrayList;
import java.util.List;
public class ConvertList2Array {
private List<int[]> li = new ArrayList<>();
public void add(int[] data) {
this.li.add(data);
}
public int[][] toArray(List<Integer> list, int rows) {
int cells = (int) Math.ceil(list.size() / (float) rows);
int[][] array = new int[rows][cells];
for (Integer i : list) {
int row = list.indexOf(i) / rows;
int cell = list.indexOf(i) - row * rows;
array[row][cell] = i;
}
return array;
}
public List<Integer> convert() {
List<Integer> result = new ArrayList<>();
for (int[] ai : this.li) {
for (int i : ai) {
result.add(i);
}
}
return result;
}
} | UTF-8 | Java | 840 | java | ConvertList2Array.java | Java | []
| null | []
|
package ru.job4j.list;
import java.util.ArrayList;
import java.util.List;
public class ConvertList2Array {
private List<int[]> li = new ArrayList<>();
public void add(int[] data) {
this.li.add(data);
}
public int[][] toArray(List<Integer> list, int rows) {
int cells = (int) Math.ceil(list.size() / (float) rows);
int[][] array = new int[rows][cells];
for (Integer i : list) {
int row = list.indexOf(i) / rows;
int cell = list.indexOf(i) - row * rows;
array[row][cell] = i;
}
return array;
}
public List<Integer> convert() {
List<Integer> result = new ArrayList<>();
for (int[] ai : this.li) {
for (int i : ai) {
result.add(i);
}
}
return result;
}
} | 840 | 0.511905 | 0.509524 | 33 | 24.454546 | 18.481916 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 15 |
1165eebd4d5eef4d2f89dc45f6f2ba1d0cebdbbe | 9,526,237,507,444 | 73725d3d37d646a8d9d493e4a53f48844124df0b | /app/src/main/java/com/cpm/use_toothpaste/VideoNew.java | ef91acddb5b5cacc1490ef7c8c53121f2d97927b | []
| no_license | JeevanPrasad1991/GSKOralCare_New | https://github.com/JeevanPrasad1991/GSKOralCare_New | 50c073f0fe8d0ac1825b1f87902acf2bf280f812 | 3452b4c89797cd534742be545878026dd0f2c636 | refs/heads/master | 2021-04-27T06:55:26.623000 | 2018-02-23T12:50:22 | 2018-02-23T12:50:22 | 122,621,134 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cpm.use_toothpaste;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Environment;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;
import com.cpm.database.GskDatabase;
import com.cpm.gsk.R;
import com.cpm.mainmenu.Startsales;
public class VideoNew extends Activity implements OnClickListener{
Button btnnext,btnbuy;
VideoView video;
MediaController mc;
String SrcPath;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.video_new_layout);
video = (VideoView) findViewById(R.id.videoviewsrnp);
SrcPath = Environment.getExternalStorageDirectory().getPath()+"/GSKOralCare/SensodyneExpertToothbrushVideo.mp4";
//btnOther=(Button) findViewById(R.id.other);
btnnext=(Button) findViewById(R.id.nextvideorapid);
//btnOther.setOnClickListener(this);
btnnext.setOnClickListener(this);
btnbuy=(Button) findViewById(R.id.buythis);
btnbuy.setOnClickListener(this);
/*ImageView back = (ImageView) findViewById(R.id.backto);
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(),
DrActivity.class);
startActivity(i);
finish();
}
});*/
video.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
video.seekTo(0);
video.start();
// TODO Auto-generated method stub
return false;
}
});
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int id=v.getId();
switch (id) {
case R.id.nextvideorapid:
Intent in = new Intent(getApplicationContext(),ToothBrush_Activity.class);
startActivity(in);
finish();
break;
case R.id.buythis:
GskDatabase mdatabaseObj = new GskDatabase(getApplicationContext());
mdatabaseObj.openDB();
String sensodyne_id = mdatabaseObj.getBrandId("Sensodyne");
Editor e2 = this.getSharedPreferences("brand_count",
Context.MODE_WORLD_READABLE).edit();
e2.putString("brand", "Sensodyne");
e2.putString("brand_id", sensodyne_id);
e2.putString("count_status", "Yes");
e2.commit();
Intent intent = new Intent(getApplicationContext(),Sales_Record.class);
startActivity(intent);
finish();
break;
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
video.stopPlayback();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
video.setVideoPath(SrcPath);
mc = new MediaController(this);
mc.setAnchorView(video);
video.setMediaController(mc);
video.requestFocus();
video.seekTo(0);
video.start();
//video.seekTo(2000);
}
public void onBackPressed() {
return;
}
}
| UTF-8 | Java | 3,201 | java | VideoNew.java | Java | []
| null | []
| package com.cpm.use_toothpaste;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Environment;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;
import com.cpm.database.GskDatabase;
import com.cpm.gsk.R;
import com.cpm.mainmenu.Startsales;
public class VideoNew extends Activity implements OnClickListener{
Button btnnext,btnbuy;
VideoView video;
MediaController mc;
String SrcPath;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.video_new_layout);
video = (VideoView) findViewById(R.id.videoviewsrnp);
SrcPath = Environment.getExternalStorageDirectory().getPath()+"/GSKOralCare/SensodyneExpertToothbrushVideo.mp4";
//btnOther=(Button) findViewById(R.id.other);
btnnext=(Button) findViewById(R.id.nextvideorapid);
//btnOther.setOnClickListener(this);
btnnext.setOnClickListener(this);
btnbuy=(Button) findViewById(R.id.buythis);
btnbuy.setOnClickListener(this);
/*ImageView back = (ImageView) findViewById(R.id.backto);
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(),
DrActivity.class);
startActivity(i);
finish();
}
});*/
video.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
video.seekTo(0);
video.start();
// TODO Auto-generated method stub
return false;
}
});
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int id=v.getId();
switch (id) {
case R.id.nextvideorapid:
Intent in = new Intent(getApplicationContext(),ToothBrush_Activity.class);
startActivity(in);
finish();
break;
case R.id.buythis:
GskDatabase mdatabaseObj = new GskDatabase(getApplicationContext());
mdatabaseObj.openDB();
String sensodyne_id = mdatabaseObj.getBrandId("Sensodyne");
Editor e2 = this.getSharedPreferences("brand_count",
Context.MODE_WORLD_READABLE).edit();
e2.putString("brand", "Sensodyne");
e2.putString("brand_id", sensodyne_id);
e2.putString("count_status", "Yes");
e2.commit();
Intent intent = new Intent(getApplicationContext(),Sales_Record.class);
startActivity(intent);
finish();
break;
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
video.stopPlayback();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
video.setVideoPath(SrcPath);
mc = new MediaController(this);
mc.setAnchorView(video);
video.setMediaController(mc);
video.requestFocus();
video.seekTo(0);
video.start();
//video.seekTo(2000);
}
public void onBackPressed() {
return;
}
}
| 3,201 | 0.72696 | 0.723211 | 144 | 21.222221 | 20.869118 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.923611 | false | false | 15 |
bb20ba6f8b46107935fb1dc55eb292f2714873ed | 36,163,624,669,639 | 9b1f88c69dee4ba7dd1ca39f9278c5c71d039c27 | /datasource-demo/src/main/java/com/whale/demo/dao/DBQuery.java | 9c2588578d86543b105f9e79379743b5520ec159 | []
| no_license | BenjaminChung/demos | https://github.com/BenjaminChung/demos | af5691ea20302f6aad1e0921b238c80ba97d8225 | 823892947ee783398e8b7f6f3d5245428da90b6d | refs/heads/master | 2020-09-20T18:22:59.429000 | 2017-05-07T08:53:10 | 2017-05-07T08:53:10 | 66,522,299 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.whale.demo.dao;
/**
* Created by benjaminchung on 17/5/7.
*/
public class DBQuery implements IDBQuery{
public DBQuery(){
try{
Thread.sleep(1000);
}catch (InterruptedException ex){
ex.printStackTrace();
}
}
public String request() {
return "request string";
}
} | UTF-8 | Java | 349 | java | DBQuery.java | Java | [
{
"context": "package com.whale.demo.dao;\n\n/**\n * Created by benjaminchung on 17/5/7.\n */\npublic class DBQuery implements ID",
"end": 60,
"score": 0.9995052814483643,
"start": 47,
"tag": "USERNAME",
"value": "benjaminchung"
}
]
| null | []
| package com.whale.demo.dao;
/**
* Created by benjaminchung on 17/5/7.
*/
public class DBQuery implements IDBQuery{
public DBQuery(){
try{
Thread.sleep(1000);
}catch (InterruptedException ex){
ex.printStackTrace();
}
}
public String request() {
return "request string";
}
} | 349 | 0.570201 | 0.547278 | 19 | 17.421053 | 15.249904 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | false | false | 15 |
1b479423d8093a754c4155a6e5c0b89a5ff5589a | 38,732,015,091,994 | 65021c4275e6274b5f334a506098ed1bdebe5dc5 | /yummers-service/src/main/java/com/anemortalkid/yummers/banned/BannedDateController.java | 2b85798e7fab84f5a9bcbc6addee0bfd4d379b8e | []
| no_license | AnEmortalKid/yummers | https://github.com/AnEmortalKid/yummers | b3e8c98e6bfd4eff3ec042402f6ccdfd95a3ecb4 | d4203e1d8e46367a9ebd279e152402b9c5377b06 | refs/heads/master | 2020-05-31T03:17:37.811000 | 2015-09-09T00:48:46 | 2015-09-09T00:48:46 | 40,578,070 | 0 | 1 | null | false | 2015-09-09T00:48:47 | 2015-08-12T03:21:10 | 2015-08-12T03:32:52 | 2015-09-09T00:48:46 | 256 | 0 | 0 | 0 | Java | null | null | package com.anemortalkid.yummers.banned;
import java.util.List;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.anemortalkid.yummers.responses.ResponseFactory;
import com.anemortalkid.yummers.responses.YummersResponseEntity;
/**
* Controller for {@link BannedDate}s
*
* @author JMonterrubio
*
*/
@RestController
@RequestMapping("/bannedDates")
public class BannedDateController {
private static final String BANNED = "/banned";
@Autowired
private BannedDateRepository bannedDateRepository;
@PreAuthorize("hasRole('ROLE_ADMIN')")
@RequestMapping(value = "/banDate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public YummersResponseEntity<BannedDate> banDate(@DateTimeFormat(pattern = "dd/MM/YYYY") LocalDate date) {
String callingPath = BANNED + "/banDate";
// check if it exists
BannedDate bannedDate = findBannedDate(date);
if (bannedDate == null) {
BannedDate savedDate = bannedDateRepository.save(new BannedDate(date));
return ResponseFactory.respondCreated(callingPath, savedDate);
} else {
return ResponseFactory.respondFound(callingPath, bannedDate);
}
}
/**
* Returns a {@link BannedDate} that was banned
*
* @param date
* the date to ban
* @return the {@link BannedDate}
*/
public BannedDate addBannedDate(LocalDate date) {
// check if it exists
BannedDate bannedDate = findBannedDate(date);
if (bannedDate == null) {
BannedDate savedDate = bannedDateRepository.save(new BannedDate(date));
return savedDate;
}
return bannedDate;
}
@PreAuthorize("hasRole('ROLE_BASIC')")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public YummersResponseEntity<List<BannedDate>> bannedDates() {
String callingPath = BANNED + "/list";
return ResponseFactory.respondOK(callingPath, bannedDateRepository.findAll());
}
/**
* Returns a List of all the {@link BannedDate}s
*
* @return a List of all the {@link BannedDate}s
*/
public List<BannedDate> getBannedDates() {
return bannedDateRepository.findAll();
}
@PreAuthorize("hasRole('ROLE_BASIC')")
@RequestMapping(value = "/checkDate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public YummersResponseEntity<Boolean> checkBannedDate(@DateTimeFormat(pattern = "dd/MM/yyyy") LocalDate date) {
String callingPath = BANNED + "/checkDate";
return ResponseFactory.respondOK(callingPath, findBannedDate(date) != null);
}
/**
* Checks whether the given date is banned or not
*
* @param date
* the date to check
* @return true if that date is banned, false otherwise
*/
public boolean isBannedDate(@DateTimeFormat(pattern = "dd/MM/yyyy") LocalDate date) {
return findBannedDate(date) != null;
}
private BannedDate findBannedDate(LocalDate date) {
int day = date.getDayOfMonth();
int month = date.getMonthOfYear();
int year = date.getYear();
return bannedDateRepository.findByYearAndMonthAndDay(year, month, day);
}
}
| UTF-8 | Java | 3,397 | java | BannedDateController.java | Java | [
{
"context": " Controller for {@link BannedDate}s\n * \n * @author JMonterrubio\n *\n */\n@RestController\n@RequestMapping(\"/bannedDa",
"end": 713,
"score": 0.9327114820480347,
"start": 701,
"tag": "NAME",
"value": "JMonterrubio"
}
]
| null | []
| package com.anemortalkid.yummers.banned;
import java.util.List;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.anemortalkid.yummers.responses.ResponseFactory;
import com.anemortalkid.yummers.responses.YummersResponseEntity;
/**
* Controller for {@link BannedDate}s
*
* @author JMonterrubio
*
*/
@RestController
@RequestMapping("/bannedDates")
public class BannedDateController {
private static final String BANNED = "/banned";
@Autowired
private BannedDateRepository bannedDateRepository;
@PreAuthorize("hasRole('ROLE_ADMIN')")
@RequestMapping(value = "/banDate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public YummersResponseEntity<BannedDate> banDate(@DateTimeFormat(pattern = "dd/MM/YYYY") LocalDate date) {
String callingPath = BANNED + "/banDate";
// check if it exists
BannedDate bannedDate = findBannedDate(date);
if (bannedDate == null) {
BannedDate savedDate = bannedDateRepository.save(new BannedDate(date));
return ResponseFactory.respondCreated(callingPath, savedDate);
} else {
return ResponseFactory.respondFound(callingPath, bannedDate);
}
}
/**
* Returns a {@link BannedDate} that was banned
*
* @param date
* the date to ban
* @return the {@link BannedDate}
*/
public BannedDate addBannedDate(LocalDate date) {
// check if it exists
BannedDate bannedDate = findBannedDate(date);
if (bannedDate == null) {
BannedDate savedDate = bannedDateRepository.save(new BannedDate(date));
return savedDate;
}
return bannedDate;
}
@PreAuthorize("hasRole('ROLE_BASIC')")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public YummersResponseEntity<List<BannedDate>> bannedDates() {
String callingPath = BANNED + "/list";
return ResponseFactory.respondOK(callingPath, bannedDateRepository.findAll());
}
/**
* Returns a List of all the {@link BannedDate}s
*
* @return a List of all the {@link BannedDate}s
*/
public List<BannedDate> getBannedDates() {
return bannedDateRepository.findAll();
}
@PreAuthorize("hasRole('ROLE_BASIC')")
@RequestMapping(value = "/checkDate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public YummersResponseEntity<Boolean> checkBannedDate(@DateTimeFormat(pattern = "dd/MM/yyyy") LocalDate date) {
String callingPath = BANNED + "/checkDate";
return ResponseFactory.respondOK(callingPath, findBannedDate(date) != null);
}
/**
* Checks whether the given date is banned or not
*
* @param date
* the date to check
* @return true if that date is banned, false otherwise
*/
public boolean isBannedDate(@DateTimeFormat(pattern = "dd/MM/yyyy") LocalDate date) {
return findBannedDate(date) != null;
}
private BannedDate findBannedDate(LocalDate date) {
int day = date.getDayOfMonth();
int month = date.getMonthOfYear();
int year = date.getYear();
return bannedDateRepository.findByYearAndMonthAndDay(year, month, day);
}
}
| 3,397 | 0.749485 | 0.749485 | 104 | 31.663462 | 29.20834 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.384615 | false | false | 15 |
75a02083ae790bea8af477b4e1954c213aa72b0b | 36,687,610,673,750 | 467bda71508d43e4faf5e241866fcc6f301843ec | /src/KR/Models/Line3D.java | 018380dd2d769fb42c864f728260d41dd42adcb4 | []
| no_license | Kropach/triangles | https://github.com/Kropach/triangles | 62b523b0200662816554c45c56f6863457cb0578 | 55db7716ef8f5c4f53e752bc0664595108ec94b6 | refs/heads/master | 2023-04-03T18:29:41.099000 | 2021-04-08T18:13:41 | 2021-04-08T18:13:41 | 356,007,595 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package KR.Models;
import KR.Math.Vector3;
import KR.ThirdDimention.PolyLine3D;
import KR.ThirdDimention.iModel;
import java.util.Arrays;
import java.util.List;
import static java.util.Arrays.asList;
public class Line3D implements iModel {
private Vector3 p1, p2;
public Line3D(Vector3 p1, Vector3 p2) {
this.p1 = p1;
this.p2 = p2;
}
@Override
public List<PolyLine3D> getLines() {
PolyLine3D pl = new PolyLine3D(Arrays.asList(new Vector3[]{p1,p2}), false);
return Arrays.asList(new PolyLine3D[]{pl});
}
}
| UTF-8 | Java | 567 | java | Line3D.java | Java | []
| null | []
| package KR.Models;
import KR.Math.Vector3;
import KR.ThirdDimention.PolyLine3D;
import KR.ThirdDimention.iModel;
import java.util.Arrays;
import java.util.List;
import static java.util.Arrays.asList;
public class Line3D implements iModel {
private Vector3 p1, p2;
public Line3D(Vector3 p1, Vector3 p2) {
this.p1 = p1;
this.p2 = p2;
}
@Override
public List<PolyLine3D> getLines() {
PolyLine3D pl = new PolyLine3D(Arrays.asList(new Vector3[]{p1,p2}), false);
return Arrays.asList(new PolyLine3D[]{pl});
}
}
| 567 | 0.680776 | 0.641975 | 25 | 21.68 | 20.21627 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.64 | false | false | 15 |
7c5272586979c1dd92935cf0de1661df82e39250 | 6,012,954,256,046 | 971f932fc8558216bf58ceeb89ef1c41101c2a09 | /lesports-bole/trunk/lesports-qmt-data-import/src/main/java/com/lesports/sms/data/model/commonImpl/DefaultMatchReviews.java | 6f241159081190dd249bbae29c9517dd8c143c9f | []
| no_license | wang-shun/lesports | https://github.com/wang-shun/lesports | c80085652d6c5c7af9f7eeacde65cd3bdd066e56 | 40b3d588e400046b89803f8fbd8fb9176f7acaa6 | refs/heads/master | 2020-04-12T23:23:16.620000 | 2018-12-21T02:59:29 | 2018-12-21T02:59:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lesports.sms.data.model.commonImpl;
import com.google.common.collect.Lists;
import com.lesports.qmt.sbd.api.common.CareerScopeType;
import com.lesports.qmt.sbd.api.common.CareerStatType;
import com.lesports.qmt.sbd.model.MatchReview;
import com.lesports.sms.data.util.formatter.soda.SodaPlayerCareerStatsFormatter;
import com.lesports.sms.data.util.formatter.stats.NBAPlayerTotalStatsFormatter;
import com.lesports.sms.data.util.xml.annotation.XPathSoda;
import com.lesports.sms.data.util.xml.annotation.XPathStats;
import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match;
import java.util.List;
import java.util.Map;
/**
* Created by qiaohongxin on 2016/11/3.
*/
public class DefaultMatchReviews extends DefaultModel {
@XPathSoda(value = "SoccerFeed/Preview")
private List<MatchReviewModel> matchReviewModels;
public static class MatchReviewModel {
@XPathSoda(value = "./Match/@id")
private String partnerId;
@XPathSoda(value = "./Match/@stadName")
private String stadium;
@XPathSoda(value = "./Match/@homeId")
private String homeTeamId;
@XPathSoda(value = "./Match/@awayId")
private String awayTeamId;
@XPathSoda(value = "./History/Match")
private List<MatchInfoModel> confrontationsList;
@XPathSoda(value = "./Before/Home/Match")
private List<MatchInfoModel> homeCompetitorBeforeMatchInfoList;
@XPathSoda(value = "./After/Home/Match")
private List<MatchInfoModel> homeCompetitorAfterMatchInfoList;
@XPathSoda(value = "./Before/Away/Match")
private List<MatchInfoModel> awayCompetitorBeforeMatchInfoList;
@XPathSoda(value = "./After/Away/Match")
private List<MatchInfoModel> awayCompetitorAfterMatchInfoList;
public String getPartnerId() {
return partnerId;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
public String getStadium() {
return stadium;
}
public void setStadium(String stadium) {
this.stadium = stadium;
}
public String getHomeTeamId() {
return homeTeamId;
}
public void setHomeTeamId(String homeTeamId) {
this.homeTeamId = homeTeamId;
}
public String getAwayTeamId() {
return awayTeamId;
}
public void setAwayTeamId(String awayTeamId) {
this.awayTeamId = awayTeamId;
}
public List<MatchInfoModel> getConfrontationsList() {
return confrontationsList;
}
public void setConfrontationsList(List<MatchInfoModel> confrontationsList) {
this.confrontationsList = confrontationsList;
}
public List<MatchInfoModel> getHomeCompetitorBeforeMatchInfoList() {
return homeCompetitorBeforeMatchInfoList;
}
public void setHomeCompetitorBeforeMatchInfoList(List<MatchInfoModel> homeCompetitorBeforeMatchInfoList) {
this.homeCompetitorBeforeMatchInfoList = homeCompetitorBeforeMatchInfoList;
}
public List<MatchInfoModel> getHomeCompetitorAfterMatchInfoList() {
return homeCompetitorAfterMatchInfoList;
}
public void setHomeCompetitorAfterMatchInfoList(List<MatchInfoModel> homeCompetitorAfterMatchInfoList) {
this.homeCompetitorAfterMatchInfoList = homeCompetitorAfterMatchInfoList;
}
public List<MatchInfoModel> getAwayCompetitorBeforeMatchInfoList() {
return awayCompetitorBeforeMatchInfoList;
}
public void setAwayCompetitorBeforeMatchInfoList(List<MatchInfoModel> awayCompetitorBeforeMatchInfoList) {
this.awayCompetitorBeforeMatchInfoList = awayCompetitorBeforeMatchInfoList;
}
public List<MatchInfoModel> getAwayCompetitorAfterMatchInfoList() {
return awayCompetitorAfterMatchInfoList;
}
public void setAwayCompetitorAfterMatchInfoList(List<MatchInfoModel> awayCompetitorAfterMatchInfoList) {
this.awayCompetitorAfterMatchInfoList = awayCompetitorAfterMatchInfoList;
}
public static class MatchInfoModel {
@XPathSoda(value = "./@id")
private String matchPartnerId;
public String getMatchPartnerId() {
return matchPartnerId;
}
public void setMatchPartnerId(String matchPartnerId) {
this.matchPartnerId = matchPartnerId;
}
}
}
@Override
public List<Object> getData() {
List<Object> res = Lists.newArrayList();
for (MatchReviewModel model : matchReviewModels) {
res.add(model);
}
return res;
}
}
| UTF-8 | Java | 4,957 | java | DefaultMatchReviews.java | Java | [
{
"context": "List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * Created by qiaohongxin on 2016/11/3.\r\n */\r\npublic class DefaultMatchRevi",
"end": 687,
"score": 0.9981489181518555,
"start": 676,
"tag": "USERNAME",
"value": "qiaohongxin"
}
]
| null | []
| package com.lesports.sms.data.model.commonImpl;
import com.google.common.collect.Lists;
import com.lesports.qmt.sbd.api.common.CareerScopeType;
import com.lesports.qmt.sbd.api.common.CareerStatType;
import com.lesports.qmt.sbd.model.MatchReview;
import com.lesports.sms.data.util.formatter.soda.SodaPlayerCareerStatsFormatter;
import com.lesports.sms.data.util.formatter.stats.NBAPlayerTotalStatsFormatter;
import com.lesports.sms.data.util.xml.annotation.XPathSoda;
import com.lesports.sms.data.util.xml.annotation.XPathStats;
import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match;
import java.util.List;
import java.util.Map;
/**
* Created by qiaohongxin on 2016/11/3.
*/
public class DefaultMatchReviews extends DefaultModel {
@XPathSoda(value = "SoccerFeed/Preview")
private List<MatchReviewModel> matchReviewModels;
public static class MatchReviewModel {
@XPathSoda(value = "./Match/@id")
private String partnerId;
@XPathSoda(value = "./Match/@stadName")
private String stadium;
@XPathSoda(value = "./Match/@homeId")
private String homeTeamId;
@XPathSoda(value = "./Match/@awayId")
private String awayTeamId;
@XPathSoda(value = "./History/Match")
private List<MatchInfoModel> confrontationsList;
@XPathSoda(value = "./Before/Home/Match")
private List<MatchInfoModel> homeCompetitorBeforeMatchInfoList;
@XPathSoda(value = "./After/Home/Match")
private List<MatchInfoModel> homeCompetitorAfterMatchInfoList;
@XPathSoda(value = "./Before/Away/Match")
private List<MatchInfoModel> awayCompetitorBeforeMatchInfoList;
@XPathSoda(value = "./After/Away/Match")
private List<MatchInfoModel> awayCompetitorAfterMatchInfoList;
public String getPartnerId() {
return partnerId;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
public String getStadium() {
return stadium;
}
public void setStadium(String stadium) {
this.stadium = stadium;
}
public String getHomeTeamId() {
return homeTeamId;
}
public void setHomeTeamId(String homeTeamId) {
this.homeTeamId = homeTeamId;
}
public String getAwayTeamId() {
return awayTeamId;
}
public void setAwayTeamId(String awayTeamId) {
this.awayTeamId = awayTeamId;
}
public List<MatchInfoModel> getConfrontationsList() {
return confrontationsList;
}
public void setConfrontationsList(List<MatchInfoModel> confrontationsList) {
this.confrontationsList = confrontationsList;
}
public List<MatchInfoModel> getHomeCompetitorBeforeMatchInfoList() {
return homeCompetitorBeforeMatchInfoList;
}
public void setHomeCompetitorBeforeMatchInfoList(List<MatchInfoModel> homeCompetitorBeforeMatchInfoList) {
this.homeCompetitorBeforeMatchInfoList = homeCompetitorBeforeMatchInfoList;
}
public List<MatchInfoModel> getHomeCompetitorAfterMatchInfoList() {
return homeCompetitorAfterMatchInfoList;
}
public void setHomeCompetitorAfterMatchInfoList(List<MatchInfoModel> homeCompetitorAfterMatchInfoList) {
this.homeCompetitorAfterMatchInfoList = homeCompetitorAfterMatchInfoList;
}
public List<MatchInfoModel> getAwayCompetitorBeforeMatchInfoList() {
return awayCompetitorBeforeMatchInfoList;
}
public void setAwayCompetitorBeforeMatchInfoList(List<MatchInfoModel> awayCompetitorBeforeMatchInfoList) {
this.awayCompetitorBeforeMatchInfoList = awayCompetitorBeforeMatchInfoList;
}
public List<MatchInfoModel> getAwayCompetitorAfterMatchInfoList() {
return awayCompetitorAfterMatchInfoList;
}
public void setAwayCompetitorAfterMatchInfoList(List<MatchInfoModel> awayCompetitorAfterMatchInfoList) {
this.awayCompetitorAfterMatchInfoList = awayCompetitorAfterMatchInfoList;
}
public static class MatchInfoModel {
@XPathSoda(value = "./@id")
private String matchPartnerId;
public String getMatchPartnerId() {
return matchPartnerId;
}
public void setMatchPartnerId(String matchPartnerId) {
this.matchPartnerId = matchPartnerId;
}
}
}
@Override
public List<Object> getData() {
List<Object> res = Lists.newArrayList();
for (MatchReviewModel model : matchReviewModels) {
res.add(model);
}
return res;
}
}
| 4,957 | 0.658665 | 0.657252 | 139 | 33.661869 | 29.290054 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.330935 | false | false | 15 |
8232736aaf42d7af3b92df7fabfff4a2728a7199 | 21,629,455,339,532 | 664db6083b0655cf1ffd07587866ad07cf0b3a5c | /src/main/java/com/common/weixin/WeiXinInit.java | 0d6f33c962442d628cef9992731c684615877a25 | []
| no_license | laolong1987/zdk | https://github.com/laolong1987/zdk | 6132b2cee9d24e7b4b092de9aed1089a147e06b9 | 1308b8aac4e69c3fc3094173644bdbf5a685942d | refs/heads/master | 2020-04-05T23:07:55.189000 | 2016-06-29T02:04:20 | 2016-06-29T02:04:20 | 57,199,288 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.common.weixin;
import com.utils.SettingUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
/**
* Created by gaoyang on 2016/4/28.
*/
public class WeiXinInit {
private static Logger log = LoggerFactory.getLogger(WeiXinInit.class);
@PostConstruct
public void init(){
// 获取web.xml中配置的参数
TokenThread.appid = SettingUtil.getSetting("appid");
TokenThread.appsecret = SettingUtil.getSetting("appsecret");
log.info("weixin api appid:{}", TokenThread.appid);
log.info("weixin api appsecret:{}", TokenThread.appsecret);
// 未配置appid、appsecret时给出提示
if ("".equals(TokenThread.appid) || "".equals(TokenThread.appsecret)) {
log.error("appid and appsecret configuration error, please check carefully.");
} else {
// 启动定时获取access_token的线程
new Thread(new TokenThread()).start();
}
}
@PreDestroy
public void dostory(){
System.out.println("I'm destory method using @PreDestroy.....");
}
}
| UTF-8 | Java | 1,177 | java | WeiXinInit.java | Java | [
{
"context": "rt javax.annotation.PreDestroy;\n\n/**\n * Created by gaoyang on 2016/4/28.\n */\npublic class WeiXinInit {\n p",
"end": 218,
"score": 0.9993858337402344,
"start": 211,
"tag": "USERNAME",
"value": "gaoyang"
}
]
| null | []
| package com.common.weixin;
import com.utils.SettingUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
/**
* Created by gaoyang on 2016/4/28.
*/
public class WeiXinInit {
private static Logger log = LoggerFactory.getLogger(WeiXinInit.class);
@PostConstruct
public void init(){
// 获取web.xml中配置的参数
TokenThread.appid = SettingUtil.getSetting("appid");
TokenThread.appsecret = SettingUtil.getSetting("appsecret");
log.info("weixin api appid:{}", TokenThread.appid);
log.info("weixin api appsecret:{}", TokenThread.appsecret);
// 未配置appid、appsecret时给出提示
if ("".equals(TokenThread.appid) || "".equals(TokenThread.appsecret)) {
log.error("appid and appsecret configuration error, please check carefully.");
} else {
// 启动定时获取access_token的线程
new Thread(new TokenThread()).start();
}
}
@PreDestroy
public void dostory(){
System.out.println("I'm destory method using @PreDestroy.....");
}
}
| 1,177 | 0.656889 | 0.648889 | 38 | 28.605263 | 26.158966 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
3851b0d13727eeaddb090198c89917d3d0596746 | 23,725,399,375,434 | da2626a9606bc72759eb9c21a5e3ebe3dd2230ee | /src/main/java/de/edgb/aviationclubmanager/domain/Bug.java | 9e15d98476fa89e113682877e6bd1880f16f007c | []
| no_license | daha96/de.edgb.aviationclubmanager | https://github.com/daha96/de.edgb.aviationclubmanager | eac820621b794bfcd83efbf553cf4aaae8a6f05b | cde566ed566b1f2432167a199349996ad4f144a2 | refs/heads/master | 2021-01-10T22:13:42.087000 | 2014-11-05T21:06:27 | 2014-11-05T21:06:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.edgb.aviationclubmanager.domain;
import java.util.Date;
import java.util.List;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.joda.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
import de.edgb.aviationclubmanager.web.Util;
@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Bug {
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(style = "MM")
@NotNull
private Date bugDate;
public LocalDateTime getBugDate() {
return Util.convertDateToLocalDateTime(this.bugDate);
}
public void setBugDate(LocalDateTime bugDate) {
this.bugDate = Util.convertLocalDateTimeToDate(bugDate);
}
@ManyToOne
@NotNull
private Person person;
@NotNull
private String description;
public static List<Bug> findAllBugs() {
return entityManager().createQuery("SELECT o FROM Bug o ORDER BY o.id",
Bug.class).getResultList();
}
public static List<Bug> findBugEntries(int firstResult, int maxResults) {
return entityManager()
.createQuery("SELECT o FROM Bug o ORDER BY o.id", Bug.class)
.setFirstResult(firstResult).setMaxResults(maxResults)
.getResultList();
}
}
| UTF-8 | Java | 1,448 | java | Bug.java | Java | []
| null | []
| package de.edgb.aviationclubmanager.domain;
import java.util.Date;
import java.util.List;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.joda.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
import de.edgb.aviationclubmanager.web.Util;
@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Bug {
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(style = "MM")
@NotNull
private Date bugDate;
public LocalDateTime getBugDate() {
return Util.convertDateToLocalDateTime(this.bugDate);
}
public void setBugDate(LocalDateTime bugDate) {
this.bugDate = Util.convertLocalDateTimeToDate(bugDate);
}
@ManyToOne
@NotNull
private Person person;
@NotNull
private String description;
public static List<Bug> findAllBugs() {
return entityManager().createQuery("SELECT o FROM Bug o ORDER BY o.id",
Bug.class).getResultList();
}
public static List<Bug> findBugEntries(int firstResult, int maxResults) {
return entityManager()
.createQuery("SELECT o FROM Bug o ORDER BY o.id", Bug.class)
.setFirstResult(firstResult).setMaxResults(maxResults)
.getResultList();
}
}
| 1,448 | 0.791436 | 0.791436 | 55 | 25.327272 | 23.023352 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.163636 | false | false | 15 |
fd5e3b0a0ae5a8d0f6fbab4ff087ee463db617e8 | 9,088,150,804,484 | 0dccef976f19741f67479f32f15d76c1e90e7f94 | /GuiOtherSettingsOF.java | 93e9ed0a8d1117f4d02ff947b44c86d0ca3bc1fb | []
| no_license | Tominous/LabyMod-1.9 | https://github.com/Tominous/LabyMod-1.9 | a960959d67817b1300272d67bd942cd383dfd668 | 33e441754a0030d619358fc20ca545df98d55f71 | refs/heads/master | 2020-05-24T21:35:00.931000 | 2017-02-06T21:04:08 | 2017-02-06T21:04:08 | 187,478,724 | 1 | 0 | null | true | 2019-05-19T13:14:46 | 2019-05-19T13:14:46 | 2019-05-19T13:12:37 | 2017-02-06T21:06:23 | 6,855 | 0 | 0 | 0 | null | false | false | import java.util.List;
public class GuiOtherSettingsOF
extends bfb
implements beg
{
private bfb prevScreen;
protected String title;
private bch settings;
private static bch.a[] enumOptions = { bch.a.LAGOMETER, bch.a.PROFILER, bch.a.WEATHER, bch.a.TIME, bch.a.v, bch.a.FULLSCREEN_MODE, bch.a.SHOW_FPS, bch.a.AUTOSAVE_TICKS, bch.a.h };
private TooltipManager tooltipManager = new TooltipManager(this);
public GuiOtherSettingsOF(bfb guiscreen, bch gamesettings)
{
this.prevScreen = guiscreen;
this.settings = gamesettings;
}
public void b()
{
this.title = bwo.a("of.options.otherTitle", new Object[0]);
this.n.clear();
for (int i = 0; i < enumOptions.length; i++)
{
bch.a enumoptions = enumOptions[i];
int x = this.l / 2 - 155 + i % 2 * 160;
int y = this.m / 6 + 21 * (i / 2) - 12;
if (!enumoptions.a()) {
this.n.add(new GuiOptionButtonOF(enumoptions.c(), x, y, enumoptions, this.settings.c(enumoptions)));
} else {
this.n.add(new GuiOptionSliderOF(enumoptions.c(), x, y, enumoptions));
}
}
this.n.add(new bcz(210, this.l / 2 - 100, this.m / 6 + 168 + 11 - 44, bwo.a("of.options.other.reset", new Object[0])));
this.n.add(new bcz(200, this.l / 2 - 100, this.m / 6 + 168 + 11, bwo.a("gui.done", new Object[0])));
}
protected void a(bcz guibutton)
{
if (!guibutton.l) {
return;
}
if ((guibutton.k < 200) && ((guibutton instanceof bdm)))
{
this.settings.a(((bdm)guibutton).c(), 1);
guibutton.j = this.settings.c(bch.a.a(guibutton.k));
}
if (guibutton.k == 200)
{
this.j.u.b();
this.j.a(this.prevScreen);
}
if (guibutton.k == 210)
{
this.j.u.b();
beh guiyesno = new beh(this, bwo.a("of.message.other.reset", new Object[0]), "", 9999);
this.j.a(guiyesno);
}
}
public void a(boolean flag, int i)
{
if (flag) {
this.j.u.resetSettings();
}
this.j.a(this);
}
public void a(int x, int y, float f)
{
c();
a(this.q, this.title, this.l / 2, 15, 16777215);
super.a(x, y, f);
this.tooltipManager.drawTooltips(x, y, this.n);
}
}
| UTF-8 | Java | 2,201 | java | GuiOtherSettingsOF.java | Java | []
| null | []
| import java.util.List;
public class GuiOtherSettingsOF
extends bfb
implements beg
{
private bfb prevScreen;
protected String title;
private bch settings;
private static bch.a[] enumOptions = { bch.a.LAGOMETER, bch.a.PROFILER, bch.a.WEATHER, bch.a.TIME, bch.a.v, bch.a.FULLSCREEN_MODE, bch.a.SHOW_FPS, bch.a.AUTOSAVE_TICKS, bch.a.h };
private TooltipManager tooltipManager = new TooltipManager(this);
public GuiOtherSettingsOF(bfb guiscreen, bch gamesettings)
{
this.prevScreen = guiscreen;
this.settings = gamesettings;
}
public void b()
{
this.title = bwo.a("of.options.otherTitle", new Object[0]);
this.n.clear();
for (int i = 0; i < enumOptions.length; i++)
{
bch.a enumoptions = enumOptions[i];
int x = this.l / 2 - 155 + i % 2 * 160;
int y = this.m / 6 + 21 * (i / 2) - 12;
if (!enumoptions.a()) {
this.n.add(new GuiOptionButtonOF(enumoptions.c(), x, y, enumoptions, this.settings.c(enumoptions)));
} else {
this.n.add(new GuiOptionSliderOF(enumoptions.c(), x, y, enumoptions));
}
}
this.n.add(new bcz(210, this.l / 2 - 100, this.m / 6 + 168 + 11 - 44, bwo.a("of.options.other.reset", new Object[0])));
this.n.add(new bcz(200, this.l / 2 - 100, this.m / 6 + 168 + 11, bwo.a("gui.done", new Object[0])));
}
protected void a(bcz guibutton)
{
if (!guibutton.l) {
return;
}
if ((guibutton.k < 200) && ((guibutton instanceof bdm)))
{
this.settings.a(((bdm)guibutton).c(), 1);
guibutton.j = this.settings.c(bch.a.a(guibutton.k));
}
if (guibutton.k == 200)
{
this.j.u.b();
this.j.a(this.prevScreen);
}
if (guibutton.k == 210)
{
this.j.u.b();
beh guiyesno = new beh(this, bwo.a("of.message.other.reset", new Object[0]), "", 9999);
this.j.a(guiyesno);
}
}
public void a(boolean flag, int i)
{
if (flag) {
this.j.u.resetSettings();
}
this.j.a(this);
}
public void a(int x, int y, float f)
{
c();
a(this.q, this.title, this.l / 2, 15, 16777215);
super.a(x, y, f);
this.tooltipManager.drawTooltips(x, y, this.n);
}
}
| 2,201 | 0.583826 | 0.551113 | 79 | 26.86076 | 32.022831 | 181 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.936709 | false | false | 15 |
7b0b7d485faa641dafd7e296905ec16362d8f102 | 13,795,434,975,694 | e7a66fa5303ff4eff7bede218bfbb16361eccf4e | /src/bitcompile/ecps/controls/EventsTableView.java | 7a5a526744c98f517c8b46bacdbf937b68faca43 | [
"Apache-2.0"
]
| permissive | TomasBisciak/ECPS | https://github.com/TomasBisciak/ECPS | 80c828a23484dfa6ff8da1ee7aa054b810c02878 | 7b950b92bb24991908a7f1caaa2291f129e363b0 | refs/heads/master | 2016-02-25T04:08:02.308000 | 2015-01-31T17:28:12 | 2015-01-31T17:28:12 | 30,118,812 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bitcompile.ecps.controls;
import bitcompile.ecps.data.events.Event;
import bitcompile.ecps.hsqldb.HSQLDBConnector;
import bitcompile.ecps.main.BitcompileEcps;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.ToolBar;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.util.Callback;
/**
*
* @author Tomas Bisciak
*/
public class EventsTableView extends BorderPane {
TableView tableView = new TableView();
private ArrayList<TableColumn> tcmns = new ArrayList<>();
private ArrayList<Integer> mulSelect = new ArrayList<>();
private Event currentSelect;
//create menu for top
private ToolBar toolBar;
private Button removeBtn = new Button("Remove");
private Button removeAllBtn = new Button("Remove all");
private Label amountOfEvents = new Label("Events total:");
public EventsTableView() {
tcmns.add(new TableColumn("ID"));
tcmns.add(new TableColumn("Latitude"));
tcmns.add(new TableColumn("Longtitude"));
tcmns.add(new TableColumn("Start Date"));
tcmns.add(new TableColumn("End Date"));
tcmns.add(new TableColumn("Location"));
tcmns.add(new TableColumn("Description"));
tcmns.add(new TableColumn("Logo ID"));
removeBtn.setDisable(true);
toolBar = new ToolBar(removeAllBtn, removeBtn);
this.setTop(toolBar);
//SQL injection unprotected
Callback<TableColumn, TableCell> cellFactory
= (TableColumn p) -> {
return new EditingCell();
};
tcmns.get(0).setCellValueFactory(
new PropertyValueFactory<>("id")
);
tcmns.get(1).setCellValueFactory(
new PropertyValueFactory<>("latitudePropertyString")
);
tcmns.get(1).setCellFactory(cellFactory);
tcmns.get(1).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLatitudeProperty(Double.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
System.out.println("Editing");
this.statement.executeUpdate("");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(2).setCellValueFactory(
new PropertyValueFactory<>("longtitudePropertyString")
);
tcmns.get(2).setCellFactory(cellFactory);
tcmns.get(2).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLongtitudeProperty(Double.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET message='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(3).setCellValueFactory(
new PropertyValueFactory<>("startDateProperty")
);
tcmns.get(3).setCellFactory(cellFactory);
tcmns.get(3).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setStartDateProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(4).setCellValueFactory(
new PropertyValueFactory<>("endDateProperty")
);
tcmns.get(4).setCellFactory(cellFactory);
tcmns.get(4).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setEndDateProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(5).setCellValueFactory(
new PropertyValueFactory<>("locationProperty")
);
tcmns.get(5).setCellFactory(cellFactory);
tcmns.get(5).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLocationProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(6).setCellValueFactory(
new PropertyValueFactory<>("descriptionProperty")
);
tcmns.get(6).setCellFactory(cellFactory);
tcmns.get(6).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setDescriptionProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(7).setCellValueFactory(
new PropertyValueFactory<>("logoEventPropertyString")
);
tcmns.get(7).setCellFactory(cellFactory);
tcmns.get(7).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLogoEventProperty(Integer.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tableView.setEditable(true);
tableView.getColumns().addAll(getTcmns());
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
//tableView.getSelectionModel().getSelectedItem()
tableView.getSelectionModel().getSelectedItems().addListener((ListChangeListener.Change c) -> {
mulSelect.removeAll(mulSelect);
currentSelect = ((Event) c.getList().get(0));
if (currentSelect != null) {
updateDetail(currentSelect);
}
//show current selected
//Todo.datMod.updateTable(tableView, tcmns);
c.getList().forEach((Object t) -> {
mulSelect.add(((Event) t).getIdProperty());
if (mulSelect.size() > 0) {
removeBtn.setDisable(false);
} else {
removeBtn.setDisable(true);
}
});
});
//test data
ObservableList<Event> list = FXCollections.observableArrayList();
list.add(new Event(47.335840, -122.33584, LocalDateTime.now(), LocalDateTime.now(), "Home", "Lets be at home brother you feel me", 0));
tableView.setItems(list);
tableView.setPrefHeight(200);
setCenter(tableView);
}
public ArrayList<TableColumn> getTcmns() {
return tcmns;
}
private void updateDetail(Event event) {
// dlblEntry.setText("TODO Entry:" + todo.getId());
// dlbCategory.setText("Category:" + todo.getCategory());
// dlbPriority.setText("Priority:" + todo.getPriority());
// messTextArea.setText(todo.getMessage());
}
class EditingCell extends TableCell<Event, String> {
private TextField textField;
public EditingCell() {
}
@Override
public void startEdit() {
if (!isEmpty()) {
super.startEdit();
createTextField();
setText(null);
setGraphic(textField);
textField.selectAll();
}
}
@Override
public void cancelEdit() {
super.cancelEdit();
setText(getItem());
setGraphic(null);
}
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (isEditing()) {
if (textField != null) {
textField.setText(getString());
}
setText(null);
setGraphic(textField);
} else {
setText(getString());
setGraphic(null);
}
}
}
private void createTextField() {
textField = new TextField(getString());
textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> {
if (!arg2) {
commitEdit(textField.getText());
}
});
}
private String getString() {
return getItem() == null ? "" : getItem().toString();
}
}
}
| UTF-8 | Java | 14,977 | java | EventsTableView.java | Java | [
{
"context": "mport javafx.util.Callback;\r\n\r\n/**\r\n *\r\n * @author Tomas Bisciak\r\n */\r\npublic class EventsTableView extends BorderPa",
"end": 1071,
"score": 0.9953036904335022,
"start": 1058,
"tag": "NAME",
"value": "Tomas Bisciak"
}
]
| null | []
|
package bitcompile.ecps.controls;
import bitcompile.ecps.data.events.Event;
import bitcompile.ecps.hsqldb.HSQLDBConnector;
import bitcompile.ecps.main.BitcompileEcps;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.ToolBar;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.util.Callback;
/**
*
* @author <NAME>
*/
public class EventsTableView extends BorderPane {
TableView tableView = new TableView();
private ArrayList<TableColumn> tcmns = new ArrayList<>();
private ArrayList<Integer> mulSelect = new ArrayList<>();
private Event currentSelect;
//create menu for top
private ToolBar toolBar;
private Button removeBtn = new Button("Remove");
private Button removeAllBtn = new Button("Remove all");
private Label amountOfEvents = new Label("Events total:");
public EventsTableView() {
tcmns.add(new TableColumn("ID"));
tcmns.add(new TableColumn("Latitude"));
tcmns.add(new TableColumn("Longtitude"));
tcmns.add(new TableColumn("Start Date"));
tcmns.add(new TableColumn("End Date"));
tcmns.add(new TableColumn("Location"));
tcmns.add(new TableColumn("Description"));
tcmns.add(new TableColumn("Logo ID"));
removeBtn.setDisable(true);
toolBar = new ToolBar(removeAllBtn, removeBtn);
this.setTop(toolBar);
//SQL injection unprotected
Callback<TableColumn, TableCell> cellFactory
= (TableColumn p) -> {
return new EditingCell();
};
tcmns.get(0).setCellValueFactory(
new PropertyValueFactory<>("id")
);
tcmns.get(1).setCellValueFactory(
new PropertyValueFactory<>("latitudePropertyString")
);
tcmns.get(1).setCellFactory(cellFactory);
tcmns.get(1).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLatitudeProperty(Double.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
System.out.println("Editing");
this.statement.executeUpdate("");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(2).setCellValueFactory(
new PropertyValueFactory<>("longtitudePropertyString")
);
tcmns.get(2).setCellFactory(cellFactory);
tcmns.get(2).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLongtitudeProperty(Double.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET message='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(3).setCellValueFactory(
new PropertyValueFactory<>("startDateProperty")
);
tcmns.get(3).setCellFactory(cellFactory);
tcmns.get(3).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setStartDateProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(4).setCellValueFactory(
new PropertyValueFactory<>("endDateProperty")
);
tcmns.get(4).setCellFactory(cellFactory);
tcmns.get(4).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setEndDateProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(5).setCellValueFactory(
new PropertyValueFactory<>("locationProperty")
);
tcmns.get(5).setCellFactory(cellFactory);
tcmns.get(5).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLocationProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(6).setCellValueFactory(
new PropertyValueFactory<>("descriptionProperty")
);
tcmns.get(6).setCellFactory(cellFactory);
tcmns.get(6).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setDescriptionProperty(t.getNewValue());
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tcmns.get(7).setCellValueFactory(
new PropertyValueFactory<>("logoEventPropertyString")
);
tcmns.get(7).setCellFactory(cellFactory);
tcmns.get(7).setOnEditCommit(
new EventHandler<CellEditEvent<Event, String>>() {
@Override
public void handle(CellEditEvent<Event, String> t) {
((Event) t.getTableView().getItems().get(
t.getTablePosition().getRow())).setLogoEventProperty(Integer.valueOf(t.getNewValue()));
new HSQLDBConnector(BitcompileEcps.configurator) {
@Override
public void execute() {
try {
this.statement.executeUpdate("UPDATE todos SET priority='" + t.getNewValue() + "' WHERE todoId='" + t.getRowValue().getIdProperty() + "';");
} catch (SQLException ex) {
ex.printStackTrace();
}
closeConnector();
}
}.execute();
}
}
);
tableView.setEditable(true);
tableView.getColumns().addAll(getTcmns());
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
//tableView.getSelectionModel().getSelectedItem()
tableView.getSelectionModel().getSelectedItems().addListener((ListChangeListener.Change c) -> {
mulSelect.removeAll(mulSelect);
currentSelect = ((Event) c.getList().get(0));
if (currentSelect != null) {
updateDetail(currentSelect);
}
//show current selected
//Todo.datMod.updateTable(tableView, tcmns);
c.getList().forEach((Object t) -> {
mulSelect.add(((Event) t).getIdProperty());
if (mulSelect.size() > 0) {
removeBtn.setDisable(false);
} else {
removeBtn.setDisable(true);
}
});
});
//test data
ObservableList<Event> list = FXCollections.observableArrayList();
list.add(new Event(47.335840, -122.33584, LocalDateTime.now(), LocalDateTime.now(), "Home", "Lets be at home brother you feel me", 0));
tableView.setItems(list);
tableView.setPrefHeight(200);
setCenter(tableView);
}
public ArrayList<TableColumn> getTcmns() {
return tcmns;
}
private void updateDetail(Event event) {
// dlblEntry.setText("TODO Entry:" + todo.getId());
// dlbCategory.setText("Category:" + todo.getCategory());
// dlbPriority.setText("Priority:" + todo.getPriority());
// messTextArea.setText(todo.getMessage());
}
class EditingCell extends TableCell<Event, String> {
private TextField textField;
public EditingCell() {
}
@Override
public void startEdit() {
if (!isEmpty()) {
super.startEdit();
createTextField();
setText(null);
setGraphic(textField);
textField.selectAll();
}
}
@Override
public void cancelEdit() {
super.cancelEdit();
setText(getItem());
setGraphic(null);
}
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (isEditing()) {
if (textField != null) {
textField.setText(getString());
}
setText(null);
setGraphic(textField);
} else {
setText(getString());
setGraphic(null);
}
}
}
private void createTextField() {
textField = new TextField(getString());
textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> {
if (!arg2) {
commitEdit(textField.getText());
}
});
}
private String getString() {
return getItem() == null ? "" : getItem().toString();
}
}
}
| 14,970 | 0.475396 | 0.472124 | 403 | 35.15881 | 31.232016 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454094 | false | false | 15 |
ee5981f10ab1235d4292b6978b15090df742784c | 15,822,659,578,009 | 98da3a519209187224db41601f435e49d65fc33d | /src/tmcit/freedom/Algorithm/BeamSearch/MyThread.java | e72a208430bdb901a5ee71d5e706abb83865f727 | []
| no_license | Freedom645/PipeMasterVis | https://github.com/Freedom645/PipeMasterVis | a875ee681b3deebd63e3f0f20445339dd27ed6ff | 3125eeb94abec9852ffdbb0100f2dda41605e611 | refs/heads/master | 2021-01-10T17:23:01.076000 | 2016-01-20T09:23:09 | 2016-01-20T09:23:09 | 49,770,208 | 0 | 3 | null | false | 2016-01-17T02:40:04 | 2016-01-16T11:10:14 | 2016-01-16T11:17:58 | 2016-01-17T02:40:04 | 49 | 0 | 1 | 0 | Java | null | null | package tmcit.freedom.Algorithm.BeamSearch;
import java.util.PriorityQueue;
import tmcit.freedom.System.Problem;
import tmcit.freedom.UI.Visualize.AnswerArrayPanel;
import tmcit.freedom.UI.Visualize.VisualizePanel;
public class MyThread extends Thread{
private boolean isEnd = false;
private Problem problem;
private AnswerArrayPanel arrayPanel;
private VisualizePanel visuPanel;
private MainALG algorithm;
public void run(){
long startTime = System.currentTimeMillis();
this.algorithm = new MainALG(problem);
this.algorithm.start();
long endTime = System.currentTimeMillis();
System.out.println(endTime-startTime + " ms");
PriorityQueue<AnswerData> que = this.algorithm.getAnswerData();
while(que.isEmpty() == false){
this.arrayPanel.addAnswer(que.poll().makeAnswer());
}
this.visuPanel.repaint();
this.isEnd = true;
return;
}
public void setProblem(Problem problem){
this.problem = problem;
}
public void setAnsList(AnswerArrayPanel answerList) {
this.arrayPanel = answerList;
}
public void setVisuPanel(VisualizePanel visuPanel){
this.visuPanel = visuPanel;
}
public boolean isEnd(){
return isEnd;
}
}
| UTF-8 | Java | 1,219 | java | MyThread.java | Java | []
| null | []
| package tmcit.freedom.Algorithm.BeamSearch;
import java.util.PriorityQueue;
import tmcit.freedom.System.Problem;
import tmcit.freedom.UI.Visualize.AnswerArrayPanel;
import tmcit.freedom.UI.Visualize.VisualizePanel;
public class MyThread extends Thread{
private boolean isEnd = false;
private Problem problem;
private AnswerArrayPanel arrayPanel;
private VisualizePanel visuPanel;
private MainALG algorithm;
public void run(){
long startTime = System.currentTimeMillis();
this.algorithm = new MainALG(problem);
this.algorithm.start();
long endTime = System.currentTimeMillis();
System.out.println(endTime-startTime + " ms");
PriorityQueue<AnswerData> que = this.algorithm.getAnswerData();
while(que.isEmpty() == false){
this.arrayPanel.addAnswer(que.poll().makeAnswer());
}
this.visuPanel.repaint();
this.isEnd = true;
return;
}
public void setProblem(Problem problem){
this.problem = problem;
}
public void setAnsList(AnswerArrayPanel answerList) {
this.arrayPanel = answerList;
}
public void setVisuPanel(VisualizePanel visuPanel){
this.visuPanel = visuPanel;
}
public boolean isEnd(){
return isEnd;
}
}
| 1,219 | 0.722724 | 0.722724 | 50 | 22.34 | 19.616941 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.48 | false | false | 15 |
106fe4203322d1002e727b50c7530a725c224396 | 23,725,399,384,159 | cbccf1771070cc222c7da531e206a09033e79523 | /dex_src/com/xunlei/downloadprovider/qrcode/a/f.java | e60efa07e9bda29ac966176c42648b1e9547ea71 | [
"MIT"
]
| permissive | mdrayhansantu/android_thunder | https://github.com/mdrayhansantu/android_thunder | c716d7644c36c3a6c2454c63300dc5d52de492c7 | 9ea16f77bd963a1a7fe7ee2faeb014cd881e18db | refs/heads/master | 2020-07-09T17:07:52.957000 | 2019-08-23T15:58:25 | 2019-08-23T15:58:25 | 204,029,623 | 1 | 0 | null | true | 2019-08-23T15:57:08 | 2019-08-23T15:57:08 | 2019-08-18T06:15:04 | 2016-10-25T03:32:20 | 8,223 | 0 | 0 | 0 | null | false | false | package com.xunlei.downloadprovider.qrcode.a;
import android.view.View;
import android.view.View.OnClickListener;
import com.xunlei.downloadprovider.qrcode.b.c;
// compiled from: QRCodeResultTextDialog.java
final class f implements OnClickListener {
final /* synthetic */ e a;
f(e eVar) {
this.a = eVar;
}
public final void onClick(View view) {
if (e.a(this.a) != null) {
e.a(this.a).a();
this.a.dismiss();
return;
}
c.a(this.a.getContext(), e.b(this.a));
this.a.dismiss();
}
}
| UTF-8 | Java | 578 | java | f.java | Java | []
| null | []
| package com.xunlei.downloadprovider.qrcode.a;
import android.view.View;
import android.view.View.OnClickListener;
import com.xunlei.downloadprovider.qrcode.b.c;
// compiled from: QRCodeResultTextDialog.java
final class f implements OnClickListener {
final /* synthetic */ e a;
f(e eVar) {
this.a = eVar;
}
public final void onClick(View view) {
if (e.a(this.a) != null) {
e.a(this.a).a();
this.a.dismiss();
return;
}
c.a(this.a.getContext(), e.b(this.a));
this.a.dismiss();
}
}
| 578 | 0.596886 | 0.596886 | 24 | 23.083334 | 16.876801 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
06add2611900f358a2badadbf98caf10451b9d53 | 15,625,091,064,159 | b0ba8ee49451f9c73f5bb9634b53781823702e39 | /target/generated-sources/annotations/project/model/SystemRoleEntity_.java | c06f15e873aef8ccac73f22ff6071ca7185530cd | []
| no_license | m5201202/WebTrial | https://github.com/m5201202/WebTrial | 423774d19f9bad4288da2561b17d26b277edd2ea | e496b49c9cf0fc2adfc54dfd7c6e20568e437297 | refs/heads/master | 2021-03-27T17:17:57.973000 | 2017-09-04T06:40:34 | 2017-09-04T06:40:34 | 101,944,804 | 0 | 0 | null | false | 2017-09-01T05:40:17 | 2017-08-31T01:20:31 | 2017-08-31T02:57:45 | 2017-09-01T05:40:16 | 6,485 | 0 | 0 | 0 | HTML | null | null | package project.model;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SystemRoleEntity.class)
public abstract class SystemRoleEntity_ {
public static volatile SingularAttribute<SystemRoleEntity, Byte> roleId;
public static volatile SingularAttribute<SystemRoleEntity, Long> id;
public static volatile SingularAttribute<SystemRoleEntity, UserEntity> user;
}
| UTF-8 | Java | 552 | java | SystemRoleEntity_.java | Java | []
| null | []
| package project.model;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SystemRoleEntity.class)
public abstract class SystemRoleEntity_ {
public static volatile SingularAttribute<SystemRoleEntity, Byte> roleId;
public static volatile SingularAttribute<SystemRoleEntity, Long> id;
public static volatile SingularAttribute<SystemRoleEntity, UserEntity> user;
}
| 552 | 0.846014 | 0.846014 | 15 | 35.733334 | 29.238028 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.866667 | false | false | 15 |
095a80d9c0beb64fba2a38feaef42afc4aef68b1 | 15,625,091,064,208 | 34fcbcecef2d2874a7713bdbc6506052d1a05d29 | /MasternodeTool/src/org/tri/masternode/AutoRestart.java | 94882c41ade623aaa255e049d6fb812a398b6f11 | []
| no_license | devindy/MasternodeTool | https://github.com/devindy/MasternodeTool | ad4a0992e475ab3ba2c696544f22dc73b7f1003d | b3d7bb0f5299dc95f82464e97b8c6d9980317feb | refs/heads/master | 2020-03-29T09:16:41.416000 | 2018-06-29T04:01:30 | 2018-06-29T04:01:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.tri.masternode;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import com.jcabi.ssh.Shell;
import com.jcabi.ssh.Shell.Plain;
import com.jcabi.ssh.SshByPassword;
public class AutoRestart
{
public static class CoinShell {
private Plain plain;
private String coinCommandPrefix;
private String explorerApiUrl;
private String coinName;
public CoinShell(Plain plain, String coinCommandPrefix, String explorerApiUrl)
{
this.plain = plain;
this.coinCommandPrefix = coinCommandPrefix;
this.explorerApiUrl = explorerApiUrl;
}
public CoinShell(String config) throws FileNotFoundException, IOException {
Properties prop = new Properties();
prop.load(new FileInputStream(config));
String host = prop.getProperty("host");
int port = Integer.parseInt(prop.getProperty("port", "22"));
String username = prop.getProperty("username");
String password = prop.getProperty("password");
coinCommandPrefix = prop.getProperty("coinCommandPrefix");
explorerApiUrl = prop.getProperty("explorerAPIUrl");
coinName = prop.getProperty("coinName");
//Shell shell = new SshByPassword("107.172.234.19", 22, "root", "ubuntu7721");
Shell shell = new SshByPassword(host, port, username, password);
plain = new Plain(shell);
}
public Boolean checkSync(Integer blockcount) throws IOException {
URL url = new URL(explorerApiUrl+"getblockcount");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String explorerResult = rd.readLine().trim();
Integer explorerBlockcount;
try {
explorerBlockcount = Integer.parseInt(explorerResult);
} catch (Exception e) {
return null;
}
//System.out.println("explorer count: " + explorerBlockcount);
return explorerBlockcount <= (blockcount + 10);
}
public Integer isCoindRunning() throws IOException {
String blockcount = plain.exec(coinCommandPrefix + "-cli getblockcount").trim();
//System.out.println(blockcount);
try {
return Integer.parseInt(blockcount);
} catch (Exception e) {
return null;
}
}
public boolean restartDaemon() throws IOException
{
String execResult = plain.exec(coinCommandPrefix + "d -daemon");
String expectedResult = "server starting";
if(execResult.contains(expectedResult)) {
return true;
}
System.err.println("Error: " + execResult);
return false;
}
public boolean reindex() throws IOException
{
String execResult = plain.exec(coinCommandPrefix + "d -daemon -reindex");
String expectedResult = "server starting";
if(execResult.contains(expectedResult)) {
return true;
}
System.err.println("Error: " + execResult);
return false;
}
public void exit() throws IOException {
plain.exec("exit");
}
}
public static List<String> loadConfigFiles(String file) throws IOException {
BufferedReader rd = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
List<String> fileList = new ArrayList<String>();
String fileName;
while((fileName = rd.readLine()) != null) {
fileName = fileName.trim();
if(!fileName.isEmpty()) {
fileList.add(fileName);
}
}
rd.close();
return fileList;
}
public static void checkCoinServers(String file) throws IOException {
List<String> configFiles = loadConfigFiles(file);
for(String configFile : configFiles) {
CoinShell coinShell = new CoinShell(configFile);
Integer blockcount = coinShell.isCoindRunning();
if(blockcount == null) {
System.err.println(coinShell.coinName + " is down. restarting daemon");
coinShell.restartDaemon();
} else {
Boolean checkSync = coinShell.checkSync(blockcount);
if(checkSync == null) {
System.err.println(coinShell.explorerApiUrl + " is down");
} else if(checkSync) {
System.out.println(coinShell.coinName + " is synced and running");
} else {
System.err.println(coinShell.coinName + " node is not synced. restarting and reindexing");
coinShell.reindex();
}
}
coinShell.exit();
}
}
public static void main(String[] args) throws IOException, InterruptedException
{
if(args.length < 1) {
System.err.println("USAGE: AutoRestart path/coin-config-list.txt");
return;
}
int sleep;
try {
if(args.length > 2) {
sleep = Integer.parseInt(args[1].trim())*60000;
} else {
sleep = 600000;
}
} catch (Exception e) {
sleep = 600000;
}
while(true) {
System.out.println("running check for servers in: " + args[0] + " every "+ (sleep/60000) + " mins");
checkCoinServers(args[0]);
Thread.sleep(sleep);
}
}
}
| UTF-8 | Java | 6,069 | java | AutoRestart.java | Java | [
{
"context": ";\n String username = prop.getProperty(\"username\");\n String password = prop.getProperty",
"end": 1258,
"score": 0.9927842617034912,
"start": 1250,
"tag": "USERNAME",
"value": "username"
},
{
"context": "roperty(\"username\");\n String password = prop.getProperty(\"password\");\n coinCommandPrefix = prop",
"end": 1308,
"score": 0.9738613963127136,
"start": 1292,
"tag": "PASSWORD",
"value": "prop.getProperty"
},
{
"context": ";\n String password = prop.getProperty(\"password\");\n coinCommandPrefix = prop.getProper",
"end": 1318,
"score": 0.7872145175933838,
"start": 1310,
"tag": "PASSWORD",
"value": "password"
},
{
"context": ");\n //Shell shell = new SshByPassword(\"107.172.234.19\", 22, \"root\", \"ubuntu7721\");\n Shell sh",
"end": 1572,
"score": 0.9993792772293091,
"start": 1558,
"tag": "IP_ADDRESS",
"value": "107.172.234.19"
},
{
"context": " new SshByPassword(\"107.172.234.19\", 22, \"root\", \"ubuntu7721\");\n Shell shell = new SshByPasswor",
"end": 1594,
"score": 0.7251355051994324,
"start": 1588,
"tag": "PASSWORD",
"value": "ubuntu"
},
{
"context": "shByPassword(\"107.172.234.19\", 22, \"root\", \"ubuntu7721\");\n Shell shell = new SshByPassword(ho",
"end": 1598,
"score": 0.7157747149467468,
"start": 1594,
"tag": "USERNAME",
"value": "7721"
}
]
| null | []
| package org.tri.masternode;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import com.jcabi.ssh.Shell;
import com.jcabi.ssh.Shell.Plain;
import com.jcabi.ssh.SshByPassword;
public class AutoRestart
{
public static class CoinShell {
private Plain plain;
private String coinCommandPrefix;
private String explorerApiUrl;
private String coinName;
public CoinShell(Plain plain, String coinCommandPrefix, String explorerApiUrl)
{
this.plain = plain;
this.coinCommandPrefix = coinCommandPrefix;
this.explorerApiUrl = explorerApiUrl;
}
public CoinShell(String config) throws FileNotFoundException, IOException {
Properties prop = new Properties();
prop.load(new FileInputStream(config));
String host = prop.getProperty("host");
int port = Integer.parseInt(prop.getProperty("port", "22"));
String username = prop.getProperty("username");
String password = <PASSWORD>("<PASSWORD>");
coinCommandPrefix = prop.getProperty("coinCommandPrefix");
explorerApiUrl = prop.getProperty("explorerAPIUrl");
coinName = prop.getProperty("coinName");
//Shell shell = new SshByPassword("192.168.127.12", 22, "root", "<PASSWORD>7721");
Shell shell = new SshByPassword(host, port, username, password);
plain = new Plain(shell);
}
public Boolean checkSync(Integer blockcount) throws IOException {
URL url = new URL(explorerApiUrl+"getblockcount");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String explorerResult = rd.readLine().trim();
Integer explorerBlockcount;
try {
explorerBlockcount = Integer.parseInt(explorerResult);
} catch (Exception e) {
return null;
}
//System.out.println("explorer count: " + explorerBlockcount);
return explorerBlockcount <= (blockcount + 10);
}
public Integer isCoindRunning() throws IOException {
String blockcount = plain.exec(coinCommandPrefix + "-cli getblockcount").trim();
//System.out.println(blockcount);
try {
return Integer.parseInt(blockcount);
} catch (Exception e) {
return null;
}
}
public boolean restartDaemon() throws IOException
{
String execResult = plain.exec(coinCommandPrefix + "d -daemon");
String expectedResult = "server starting";
if(execResult.contains(expectedResult)) {
return true;
}
System.err.println("Error: " + execResult);
return false;
}
public boolean reindex() throws IOException
{
String execResult = plain.exec(coinCommandPrefix + "d -daemon -reindex");
String expectedResult = "server starting";
if(execResult.contains(expectedResult)) {
return true;
}
System.err.println("Error: " + execResult);
return false;
}
public void exit() throws IOException {
plain.exec("exit");
}
}
public static List<String> loadConfigFiles(String file) throws IOException {
BufferedReader rd = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
List<String> fileList = new ArrayList<String>();
String fileName;
while((fileName = rd.readLine()) != null) {
fileName = fileName.trim();
if(!fileName.isEmpty()) {
fileList.add(fileName);
}
}
rd.close();
return fileList;
}
public static void checkCoinServers(String file) throws IOException {
List<String> configFiles = loadConfigFiles(file);
for(String configFile : configFiles) {
CoinShell coinShell = new CoinShell(configFile);
Integer blockcount = coinShell.isCoindRunning();
if(blockcount == null) {
System.err.println(coinShell.coinName + " is down. restarting daemon");
coinShell.restartDaemon();
} else {
Boolean checkSync = coinShell.checkSync(blockcount);
if(checkSync == null) {
System.err.println(coinShell.explorerApiUrl + " is down");
} else if(checkSync) {
System.out.println(coinShell.coinName + " is synced and running");
} else {
System.err.println(coinShell.coinName + " node is not synced. restarting and reindexing");
coinShell.reindex();
}
}
coinShell.exit();
}
}
public static void main(String[] args) throws IOException, InterruptedException
{
if(args.length < 1) {
System.err.println("USAGE: AutoRestart path/coin-config-list.txt");
return;
}
int sleep;
try {
if(args.length > 2) {
sleep = Integer.parseInt(args[1].trim())*60000;
} else {
sleep = 600000;
}
} catch (Exception e) {
sleep = 600000;
}
while(true) {
System.out.println("running check for servers in: " + args[0] + " every "+ (sleep/60000) + " mins");
checkCoinServers(args[0]);
Thread.sleep(sleep);
}
}
}
| 6,069 | 0.577031 | 0.569122 | 161 | 36.695652 | 26.416643 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.596273 | false | false | 15 |
6512f71adb02ae6e3d7031ac10fedc7a431adcf6 | 18,691,697,726,677 | 732d68fade9e927b9b8aa2223fc06b61e1cc418a | /src/main.java | 3afb55e60e6f6d2c731774d2b54ad0cb819518da | []
| no_license | kdufera/In-memory-database | https://github.com/kdufera/In-memory-database | 9e0dd668d8fb6f334e9e07c630359850e44cd10d | 40068bcaec4491e5546aaff4746c815da6a8d9e7 | refs/heads/master | 2021-10-09T12:58:58.384000 | 2018-12-28T10:14:19 | 2018-12-28T10:14:19 | 163,382,819 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
import database.InMemoryDatabase;
import utils.command;
public class main {
public static void main(String[] args) {
// scanner used to accept user input
Scanner scanner = new Scanner(System.in);
InMemoryDatabase inMemDatabase = new InMemoryDatabase();
while (true) {
System.out.print(" >> : ");
String input = scanner.nextLine();
switch (input.toString().split(" ")[0]) { // Switch statement to handle different cases
case command.SET :
inMemDatabase.setData(input.toString());
continue;
case command.GET :
if (inMemDatabase.getData(input) == null) {
continue;
} else {
System.out.println(inMemDatabase.getData(input));
continue;
}
case command.DELETE :
inMemDatabase.deleteData(input);
continue;
case command.COUNT:
inMemDatabase.countData(input);
continue;
case command.BEGIN:
inMemDatabase.beginTransactions(input);
continue;
case command.ROLLBACK:
inMemDatabase.rollBackTransactions(input);
continue;
case command.COMMIT :
inMemDatabase.commitData(input);
continue;
case command.END:
System.out.println(" >> : " + "Exiting!");
break;
default:
System.out.println("Please enter a valid command!");
continue;
}
break;
}
scanner.close();
}
}
| UTF-8 | Java | 1,345 | java | main.java | Java | []
| null | []
| import java.util.Scanner;
import database.InMemoryDatabase;
import utils.command;
public class main {
public static void main(String[] args) {
// scanner used to accept user input
Scanner scanner = new Scanner(System.in);
InMemoryDatabase inMemDatabase = new InMemoryDatabase();
while (true) {
System.out.print(" >> : ");
String input = scanner.nextLine();
switch (input.toString().split(" ")[0]) { // Switch statement to handle different cases
case command.SET :
inMemDatabase.setData(input.toString());
continue;
case command.GET :
if (inMemDatabase.getData(input) == null) {
continue;
} else {
System.out.println(inMemDatabase.getData(input));
continue;
}
case command.DELETE :
inMemDatabase.deleteData(input);
continue;
case command.COUNT:
inMemDatabase.countData(input);
continue;
case command.BEGIN:
inMemDatabase.beginTransactions(input);
continue;
case command.ROLLBACK:
inMemDatabase.rollBackTransactions(input);
continue;
case command.COMMIT :
inMemDatabase.commitData(input);
continue;
case command.END:
System.out.println(" >> : " + "Exiting!");
break;
default:
System.out.println("Please enter a valid command!");
continue;
}
break;
}
scanner.close();
}
}
| 1,345 | 0.660967 | 0.660223 | 55 | 23.436363 | 18.508734 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.218182 | false | false | 15 |
2cdde1f4a66e4419dc5c27f708900eaa1c511626 | 35,330,400,989,693 | b8b3617825158d34b47b4a844eb6bc7bba78e340 | /src/main/java/com/snippets/GreaterThan10Exception.java | d2091adcff1b182ea6f983779a20b0cae054df1a | []
| no_license | edvmorango/reactive-programming-workshop | https://github.com/edvmorango/reactive-programming-workshop | ec3ce1c024efd27d6e0bc90ce3b549426bc994a3 | b446aa57c8cd4099f89d15b32ba0d3a19eb9a64a | refs/heads/master | 2020-04-17T15:15:01.924000 | 2019-01-22T00:47:25 | 2019-01-22T00:47:25 | 166,691,120 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.snippets;
public class GreaterThan10Exception extends RuntimeException {
public GreaterThan10Exception(String message) {
super(message);
}
}
| UTF-8 | Java | 173 | java | GreaterThan10Exception.java | Java | []
| null | []
| package com.snippets;
public class GreaterThan10Exception extends RuntimeException {
public GreaterThan10Exception(String message) {
super(message);
}
}
| 173 | 0.734104 | 0.710983 | 9 | 18.111111 | 22.333057 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 15 |
bdf3814fcffabcd84990581bd013e510a643e4c7 | 35,442,070,141,307 | ebb42697fc5be4a6285b344181b90f078726af79 | /Shu/src/main/java/rezonant/shu/ui/session/ExecuteActionActivity.java | 2ef55a9c8bd6b15294d46d20a5617b3ebbf638cb | []
| no_license | rezonant/shu | https://github.com/rezonant/shu | d0121623bc6dc31530756cd00fea857823f408d4 | 6dc27e36ce527c1175fb17f81fee5581bfaf6e89 | refs/heads/master | 2021-03-12T19:43:50.053000 | 2014-12-31T22:29:56 | 2014-12-31T22:29:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rezonant.shu.ui.session;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import java.util.HashMap;
import java.util.List;
import rezonant.shu.R;
import rezonant.shu.state.data.SSHConnection;
import rezonant.shu.state.data.SessionAction;
public class ExecuteActionActivity extends FragmentActivity implements ExecuteActionFragment.Delegate {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_actions_list);
if (savedInstanceState == null) {
ExecuteActionFragment fragment = new ExecuteActionFragment();
Bundle args = getIntent().getExtras();
if (args == null)
args = new Bundle();
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, fragment)
.commit();
}
}
public void actionExecuted(SessionAction session, HashMap<Integer, String> variables, List<SSHConnection> connections)
{
}
}
| UTF-8 | Java | 996 | java | ExecuteActionActivity.java | Java | []
| null | []
| package rezonant.shu.ui.session;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import java.util.HashMap;
import java.util.List;
import rezonant.shu.R;
import rezonant.shu.state.data.SSHConnection;
import rezonant.shu.state.data.SessionAction;
public class ExecuteActionActivity extends FragmentActivity implements ExecuteActionFragment.Delegate {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_actions_list);
if (savedInstanceState == null) {
ExecuteActionFragment fragment = new ExecuteActionFragment();
Bundle args = getIntent().getExtras();
if (args == null)
args = new Bundle();
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, fragment)
.commit();
}
}
public void actionExecuted(SessionAction session, HashMap<Integer, String> variables, List<SSHConnection> connections)
{
}
}
| 996 | 0.768072 | 0.767068 | 38 | 25.210526 | 27.914492 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.631579 | false | false | 15 |
466381596a581144cfeade1e13095c5d8167f969 | 26,912,265,146,671 | e87014139ef2963b3db4feb043b8fc3206221965 | /src/main/java/br/com/rest/services/UserService.java | e86ceaefd89f5e078f891e46640b50b155a1ce05 | []
| no_license | lucasrest/APIRestWithSpringBoot | https://github.com/lucasrest/APIRestWithSpringBoot | 97beb5ef4337f5e26a7da7198eebb65695d364dd | 466d78769629843f9b2d5764963e86d9e7359d14 | refs/heads/master | 2021-01-22T17:48:58.147000 | 2018-09-24T17:12:36 | 2018-09-24T17:12:36 | 100,731,558 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.rest.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
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.Service;
import br.com.rest.models.User;
import br.com.rest.repositories.UserRepository;
@Service
public class UserService implements UserDetailsService {
@Autowired
UserRepository userRepository;
public UserService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public Iterable<User> findAll() {
return userRepository.findAll();
}
public User find(Long id) {
return userRepository.findOne(id);
}
public User save(User user) {
return userRepository.save(user);
}
public User update(User user) {
return userRepository.save(user);
}
public HttpStatus delete(Long id) {
userRepository.delete(id);
return HttpStatus.OK;
}
public User findByUsername(String username) {
return userRepository.findByUsername(username);
}
public boolean authenticated(String username, String password) {
if(userRepository.findByUsernameAndPassword(username, password) != null)
return true;
else
return false;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = Optional.ofNullable(findByUsername(username))
.orElseThrow(() -> new UsernameNotFoundException("User not found"));
List<GrantedAuthority> authorityListAdmin = AuthorityUtils.createAuthorityList("ROLE_USER", "ROLE_ADMIN");
List<GrantedAuthority> authorityListUser = AuthorityUtils.createAuthorityList("ROLE_USER");
return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), authorityListAdmin);
}
}
| UTF-8 | Java | 2,311 | java | UserService.java | Java | []
| null | []
| package br.com.rest.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
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.Service;
import br.com.rest.models.User;
import br.com.rest.repositories.UserRepository;
@Service
public class UserService implements UserDetailsService {
@Autowired
UserRepository userRepository;
public UserService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public Iterable<User> findAll() {
return userRepository.findAll();
}
public User find(Long id) {
return userRepository.findOne(id);
}
public User save(User user) {
return userRepository.save(user);
}
public User update(User user) {
return userRepository.save(user);
}
public HttpStatus delete(Long id) {
userRepository.delete(id);
return HttpStatus.OK;
}
public User findByUsername(String username) {
return userRepository.findByUsername(username);
}
public boolean authenticated(String username, String password) {
if(userRepository.findByUsernameAndPassword(username, password) != null)
return true;
else
return false;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = Optional.ofNullable(findByUsername(username))
.orElseThrow(() -> new UsernameNotFoundException("User not found"));
List<GrantedAuthority> authorityListAdmin = AuthorityUtils.createAuthorityList("ROLE_USER", "ROLE_ADMIN");
List<GrantedAuthority> authorityListUser = AuthorityUtils.createAuthorityList("ROLE_USER");
return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), authorityListAdmin);
}
}
| 2,311 | 0.729987 | 0.729987 | 70 | 32.014286 | 31.317951 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.471429 | false | false | 15 |
d6547cb21b1413b0dab5fc7552adfd2d16b25831 | 4,234,837,814,725 | 94e9e2107603ffcfc93695d035471d7c99c256ea | /src/main/java/project/dao/RolesDao.java | 4a26d52fdb9c2df4caf8c8a9dadd38e040bc7cf2 | []
| no_license | alexanderbeznos/restaurant_manager_project | https://github.com/alexanderbeznos/restaurant_manager_project | c272c53c30e93d8b9d7f1bd9c53bb91e49c87e72 | 2b83c3a2cf057e7a5251090c8d203c5beca94f20 | refs/heads/master | 2023-05-12T14:37:26.037000 | 2023-05-05T16:52:55 | 2023-05-05T16:52:55 | 238,035,529 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package project.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import project.entities.Roles;
public interface RolesDao extends JpaRepository<Roles, Long> {
Roles findByName(String name);
}
| UTF-8 | Java | 217 | java | RolesDao.java | Java | []
| null | []
| package project.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import project.entities.Roles;
public interface RolesDao extends JpaRepository<Roles, Long> {
Roles findByName(String name);
}
| 217 | 0.801843 | 0.801843 | 9 | 23.111111 | 24.071396 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 15 |
65ac74d5223efbfa75dade987faf24c631a5b5e2 | 15,195,594,329,403 | 3eeba1c0b06be5e4f4867f5b9feef661bd70f296 | /ex7/src/oop/ex7/main/Variable/BooleanVariable.java | 20374eff1d537900514006750fdaf6d80ab99f55 | []
| no_license | aviadlevy/OOP | https://github.com/aviadlevy/OOP | b40c19184bd0b927ec4257163c393cd30e55ee97 | 40e78d9542c21ceaec751495650dd33aa12cecb1 | refs/heads/master | 2021-01-01T05:51:20.295000 | 2015-06-19T13:41:38 | 2015-06-19T13:41:38 | 33,539,486 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package oop.ex7.main.Variable;
import java.util.regex.Pattern;
import oop.ex7.main.RegExPatterns;
public class BooleanVariable implements Variable {
private String _variableName, _variableValue;
private int _level;
/**
* Default constructor.
*/
public BooleanVariable() {}
/**
* Boolean initialized variable constructor.
* @param name variable name.
* @param value variable value.
* @param level variable scope level.
*/
public BooleanVariable(String name, String value, int level) {
_variableName = name;
_variableValue = value;
_level = level;
}
/**
* Boolean variable declaration-only constructor.
* @param name variable name.
* @param level variable scope level.
*/
public BooleanVariable(String name, int level) {
_variableName = name;
_variableValue = null;
_level = level;
}
@Override
public String getName() {
return _variableName;
}
@Override
public String getValue() {
return _variableValue;
}
@Override
public int getLevel() {
return _level;
}
@Override
public Pattern getPattern() {
return RegExPatterns.BOOLEAN;
}
@Override
public boolean isValid(String valueToCheck) throws VariableErrorException {
GeneralCheck check = new GeneralCheck(RegExPatterns.BOOLEAN);
return check.checkExecute(valueToCheck, this);
}
} | UTF-8 | Java | 1,308 | java | BooleanVariable.java | Java | []
| null | []
| package oop.ex7.main.Variable;
import java.util.regex.Pattern;
import oop.ex7.main.RegExPatterns;
public class BooleanVariable implements Variable {
private String _variableName, _variableValue;
private int _level;
/**
* Default constructor.
*/
public BooleanVariable() {}
/**
* Boolean initialized variable constructor.
* @param name variable name.
* @param value variable value.
* @param level variable scope level.
*/
public BooleanVariable(String name, String value, int level) {
_variableName = name;
_variableValue = value;
_level = level;
}
/**
* Boolean variable declaration-only constructor.
* @param name variable name.
* @param level variable scope level.
*/
public BooleanVariable(String name, int level) {
_variableName = name;
_variableValue = null;
_level = level;
}
@Override
public String getName() {
return _variableName;
}
@Override
public String getValue() {
return _variableValue;
}
@Override
public int getLevel() {
return _level;
}
@Override
public Pattern getPattern() {
return RegExPatterns.BOOLEAN;
}
@Override
public boolean isValid(String valueToCheck) throws VariableErrorException {
GeneralCheck check = new GeneralCheck(RegExPatterns.BOOLEAN);
return check.checkExecute(valueToCheck, this);
}
} | 1,308 | 0.719419 | 0.71789 | 63 | 19.777779 | 18.717995 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 15 |
ded88830b3e7de97b17350428840d79f97235798 | 34,093,450,417,634 | 34c8bb360950f217f0e47bd0bb8accd8d970b388 | /src/main/java/com/wenthomas/mapreduce/outputformat/MyOutputFormat.java | 3c779b47130973cf3d5559b885f9fbb9b25ee44b | []
| no_license | wenthomas/my-hadoop-study | https://github.com/wenthomas/my-hadoop-study | f6a0b1730d2a82863edd370c1e3dfafd7b59d231 | f245894a2f9ebce8378451f565bb6fdb4f8ff7ca | refs/heads/master | 2022-05-08T02:20:15.671000 | 2020-01-06T13:00:04 | 2020-01-06T13:00:04 | 230,082,059 | 0 | 0 | null | false | 2022-04-12T21:57:27 | 2019-12-25T09:58:08 | 2020-01-06T13:01:06 | 2022-04-12T21:57:26 | 118 | 0 | 0 | 5 | Java | false | false | package com.wenthomas.mapreduce.outputformat;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
/**
* @author Verno
* @create 2020-01-03 11:09
*/
public class MyOutputFormat extends FileOutputFormat<Text, NullWritable> {
//将job对象传递到RecordWriter以方便获取FileSystem
@Override
public RecordWriter<Text, NullWritable> getRecordWriter(TaskAttemptContext job) throws IOException, InterruptedException {
return new MyRecordWriter(job);
}
}
| UTF-8 | Java | 703 | java | MyOutputFormat.java | Java | [
{
"context": "rmat;\n\nimport java.io.IOException;\n\n/**\n * @author Verno\n * @create 2020-01-03 11:09\n */\npublic class MyOu",
"end": 341,
"score": 0.9658207297325134,
"start": 336,
"tag": "NAME",
"value": "Verno"
}
]
| null | []
| package com.wenthomas.mapreduce.outputformat;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
/**
* @author Verno
* @create 2020-01-03 11:09
*/
public class MyOutputFormat extends FileOutputFormat<Text, NullWritable> {
//将job对象传递到RecordWriter以方便获取FileSystem
@Override
public RecordWriter<Text, NullWritable> getRecordWriter(TaskAttemptContext job) throws IOException, InterruptedException {
return new MyRecordWriter(job);
}
}
| 703 | 0.792952 | 0.77533 | 21 | 31.428572 | 30.709967 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 15 |
69482703be6c759fd3faceb5dabf41e86142d5f2 | 14,946,486,252,817 | cd3c8dae5e8ae5b331881761ddd38a0d54ccc4a7 | /FabricaPokemon/src/testes/TesteV.java | d6f832817ac1c93de23616be2db442cb8a9397a0 | []
| no_license | icarocrespo/FabricaPokemons | https://github.com/icarocrespo/FabricaPokemons | 57403eaffd017345282e1943162bfca9510e1f63 | 01f91276de64e886d85c9b71609c69bb6ac6ff4a | refs/heads/master | 2020-06-05T00:09:38.747000 | 2019-06-27T02:58:08 | 2019-06-27T02:58:08 | 192,245,834 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package testes;
import estruturas.Vetor;
import main.GeradorDePokemon;
import main.Main;
import main.Pokemon;
public class TesteV {
Vetor vetor1;
Vetor vetor2;
Vetor vetor3;
long antes;
long depois;
public TesteV() {
this.vetor1 = new Vetor(10000);
this.vetor2 = new Vetor(100000);
this.vetor3 = new Vetor(1000000);
}
// Ordem 10000
public Vetor gera10000(GeradorDePokemon geradorDePokemon) {
System.out.println("10000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 10000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor1.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
return vetor1;
}
public void contaFogo10000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + " do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido: " + Main.time(antes, depois));
System.out.println();
}
public void alfabetico10000(Vetor vetor) {
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
}
public void removeAgua10000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
}
// Ordem 100000
public Vetor gera100000(GeradorDePokemon geradorDePokemon) {
System.out.println("100000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 100000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor2.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
return vetor2;
}
public void contaFogo100000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + "do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void alfabetico100000(Vetor vetor) {
System.out.println("Ordenação Alfabética");
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void removeAgua100000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
// Ordem 1000000
public Vetor gera1000000(GeradorDePokemon geradorDePokemon) {
System.out.println("1000000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 1000000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor3.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
return vetor3;
}
public void contaFogo1000000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + " do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void alfabetico1000000(Vetor vetor) {
System.out.println("Ordenação Alfabética");
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void removeAgua1000000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
} | UTF-8 | Java | 5,020 | java | TesteV.java | Java | []
| null | []
| package testes;
import estruturas.Vetor;
import main.GeradorDePokemon;
import main.Main;
import main.Pokemon;
public class TesteV {
Vetor vetor1;
Vetor vetor2;
Vetor vetor3;
long antes;
long depois;
public TesteV() {
this.vetor1 = new Vetor(10000);
this.vetor2 = new Vetor(100000);
this.vetor3 = new Vetor(1000000);
}
// Ordem 10000
public Vetor gera10000(GeradorDePokemon geradorDePokemon) {
System.out.println("10000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 10000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor1.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
return vetor1;
}
public void contaFogo10000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + " do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido: " + Main.time(antes, depois));
System.out.println();
}
public void alfabetico10000(Vetor vetor) {
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
}
public void removeAgua10000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
System.out.println();
}
// Ordem 100000
public Vetor gera100000(GeradorDePokemon geradorDePokemon) {
System.out.println("100000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 100000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor2.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
return vetor2;
}
public void contaFogo100000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + "do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void alfabetico100000(Vetor vetor) {
System.out.println("Ordenação Alfabética");
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void removeAgua100000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
// Ordem 1000000
public Vetor gera1000000(GeradorDePokemon geradorDePokemon) {
System.out.println("1000000");
antes = Main.nanoTime();
Pokemon pokemon;
for (int i = 0; i < 1000000; i++) {
pokemon = new Pokemon();
String[] aux = new String[2];
aux = geradorDePokemon.geraPokemon();
pokemon.setNome(aux[0]);
pokemon.setTipo(aux[1]);
vetor3.add(pokemon);
}
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
return vetor3;
}
public void contaFogo1000000(Vetor vetor) {
antes = Main.nanoTime();
System.out.println("Existem " + vetor.searchTypeFire() + " do tipo fogo.");
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void alfabetico1000000(Vetor vetor) {
System.out.println("Ordenação Alfabética");
antes = Main.nanoTime();
vetor.showAllAlphabetic();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
public void removeAgua1000000(Vetor vetor) {
System.out.println("Remoção Água");
antes = Main.nanoTime();
vetor.removeAllWater();
depois = Main.nanoTime();
System.out.println("Tempo decorrido em nanossegundos: " + Main.time(antes, depois));
}
} | 5,020 | 0.593407 | 0.55984 | 153 | 31.718954 | 24.752752 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.732026 | false | false | 15 |
97f5c83b3b092ffde0f8c9cdcbabe3bc7cf8f4af | 6,734,508,773,376 | 460b67fe1edf793496a712575727c0dae8af127a | /src/main/java/fieldbox/boxes/plugins/FLineButton.java | af2a53f150a8475c497d3427a85b438472b78c7c | []
| no_license | OpenEndedGroup/Field2 | https://github.com/OpenEndedGroup/Field2 | 99af34959254e193506172d3bbc6bf6762bd3bee | ebf154deb39929bf3db6f65da6cd015768a0ebbf | refs/heads/new_build | 2023-05-24T20:29:22.699000 | 2023-01-26T16:18:42 | 2023-01-26T16:18:42 | 20,703,816 | 57 | 13 | null | false | 2023-04-14T18:08:29 | 2014-06-10T22:22:27 | 2023-03-05T02:23:49 | 2023-04-14T18:08:28 | 742,750 | 52 | 10 | 46 | Java | false | false | package fieldbox.boxes.plugins;
import field.app.RunLoop;
import field.graphics.FLine;
import field.graphics.Window;
import field.linalg.Vec2;
import field.utility.Dict;
import field.utility.Log;
import fieldbox.boxes.Box;
import fieldbox.boxes.Drawing;
import fieldbox.boxes.FLineInteraction;
import fieldbox.boxes.Mouse;
import java.util.LinkedHashSet;
import java.util.Map;
import static fieldbox.boxes.FLineInteraction._interactionTarget;
/**
* Helper class for an FLine interaction handler that has hover, press and drag.
*/
public class FLineButton {
private FLine target;
private Map<String, Object> hover;
private Map<String, Object> press;
private Handle handle;
private Box box;
private LinkedHashSet<String> implicated;
private Dict original;
private Dict was;
private boolean during = false;
private boolean upSemantics = false;
public interface Handle {
void dragged(boolean up, FLine target, Window.Event<Window.MouseState> event);
}
public FLineButton() {
}
static public FLineButton attach(Box box, FLine target, Map<String, Object> hover, Map<String, Object> press, Handle h) {
FLineButton b = new FLineButton();
b.box = box;
b.target = target;
b.hover = hover;
b.press = press;
b.handle = h;
target.attributes.putToMap(Mouse.onMouseEnter, "__FLineButton__", b::enter);
target.attributes.putToMap(Mouse.onMouseExit, "__FLineButton__", b::exit);
target.attributes.putToMap(Mouse.onMouseDown, "__FLineButton__", b::down);
b.implicated = new LinkedHashSet<>();
b.implicated.addAll(hover.keySet());
b.implicated.addAll(press.keySet());
b.original = target.attributes.duplicate();
return b;
}
protected Mouse.Dragger enter(Window.Event<Window.MouseState> e) {
Log.log("interactive.debug", () -> "ENTER !");
if (during) return null;
Dict d = new Dict();
for (Map.Entry<String, Object> ee : hover.entrySet())
d.put(new Dict.Prop<Object>(ee.getKey()), ee.getValue());
was = target.attributes.putAll(d);
target.modify();
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
return null;
}
protected Mouse.Dragger exit(Window.Event<Window.MouseState> e) {
Log.log("interactive.debug", () -> "EXIT !");
if (during) return null;
target.attributes.putAll(was);
target.modify();
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
return null;
}
/**
* set to true if you don't want to be called if the mouse up happens outside the box — this works like buttons that fire on mouse up; set to false if you want popup menu semantics, when the handler is stilled called when the up happes and the mouse has long moved away
*/
public FLineButton setUpSemantics(boolean upSemantics) {
this.upSemantics = upSemantics;
return this;
}
protected Mouse.Dragger down(Window.Event<Window.MouseState> d, int button) {
Dict dp = new Dict();
for (Map.Entry<String, Object> ee : press.entrySet())
dp.put(new Dict.Prop<Object>(ee.getKey()), ee.getValue());
target.attributes.putAll(dp);
target.modify();
Drawing.dirty(box);
FLineInteraction interaction = d.properties.get(FLineInteraction.interaction);
d.properties.put(Window.consumed, true);
Log.log("interactive.debug", () -> "DOWN !, consuming " + d + " " + d.properties + " " + System.identityHashCode(d) + " " + interaction);
during = true;
return (e, t) -> {
FLine ongoingTarget = e.properties.get(_interactionTarget);
Log.log("interactive.debug", () -> "handling .... ");
if (handle != null) {
Vec2 point = interaction.convertCoordinateSystem(new Vec2(e.after.x, e.after.y));
if (interaction.intersects(ongoingTarget, point)) {
handle.dragged(t, this.target, e);
System.out.println(" interaction is in ");
target.attributes.putAll(dp);
target.modify();
} else {
if (!upSemantics)
handle.dragged(t, this.target, e);
System.out.println(" interaction is out, point :" + e.after.x + " " + e.after.y + " not in " + interaction.projectFLineToArea(ongoingTarget).getBounds());
target.attributes.putAll(original, x -> implicated.contains(x.getName()));
target.modify();
}
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
}
e.properties.put(Window.consumed, true);
if (t) {
Log.log("interactive.debug", () -> "resetting on termination ");
target.attributes.putAll(original, x -> implicated.contains(x.getName()));
target.modify();
during = false;
Vec2 point = interaction.convertCoordinateSystem(new Vec2(e.after.x, e.after.y));
if (interaction.intersects(ongoingTarget, point)) {
RunLoop.main.delayTicks(() -> {
enter(null);
}, 2);
}
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
}
return !t;
};
}
}
| UTF-8 | Java | 4,759 | java | FLineButton.java | Java | []
| null | []
| package fieldbox.boxes.plugins;
import field.app.RunLoop;
import field.graphics.FLine;
import field.graphics.Window;
import field.linalg.Vec2;
import field.utility.Dict;
import field.utility.Log;
import fieldbox.boxes.Box;
import fieldbox.boxes.Drawing;
import fieldbox.boxes.FLineInteraction;
import fieldbox.boxes.Mouse;
import java.util.LinkedHashSet;
import java.util.Map;
import static fieldbox.boxes.FLineInteraction._interactionTarget;
/**
* Helper class for an FLine interaction handler that has hover, press and drag.
*/
public class FLineButton {
private FLine target;
private Map<String, Object> hover;
private Map<String, Object> press;
private Handle handle;
private Box box;
private LinkedHashSet<String> implicated;
private Dict original;
private Dict was;
private boolean during = false;
private boolean upSemantics = false;
public interface Handle {
void dragged(boolean up, FLine target, Window.Event<Window.MouseState> event);
}
public FLineButton() {
}
static public FLineButton attach(Box box, FLine target, Map<String, Object> hover, Map<String, Object> press, Handle h) {
FLineButton b = new FLineButton();
b.box = box;
b.target = target;
b.hover = hover;
b.press = press;
b.handle = h;
target.attributes.putToMap(Mouse.onMouseEnter, "__FLineButton__", b::enter);
target.attributes.putToMap(Mouse.onMouseExit, "__FLineButton__", b::exit);
target.attributes.putToMap(Mouse.onMouseDown, "__FLineButton__", b::down);
b.implicated = new LinkedHashSet<>();
b.implicated.addAll(hover.keySet());
b.implicated.addAll(press.keySet());
b.original = target.attributes.duplicate();
return b;
}
protected Mouse.Dragger enter(Window.Event<Window.MouseState> e) {
Log.log("interactive.debug", () -> "ENTER !");
if (during) return null;
Dict d = new Dict();
for (Map.Entry<String, Object> ee : hover.entrySet())
d.put(new Dict.Prop<Object>(ee.getKey()), ee.getValue());
was = target.attributes.putAll(d);
target.modify();
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
return null;
}
protected Mouse.Dragger exit(Window.Event<Window.MouseState> e) {
Log.log("interactive.debug", () -> "EXIT !");
if (during) return null;
target.attributes.putAll(was);
target.modify();
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
return null;
}
/**
* set to true if you don't want to be called if the mouse up happens outside the box — this works like buttons that fire on mouse up; set to false if you want popup menu semantics, when the handler is stilled called when the up happes and the mouse has long moved away
*/
public FLineButton setUpSemantics(boolean upSemantics) {
this.upSemantics = upSemantics;
return this;
}
protected Mouse.Dragger down(Window.Event<Window.MouseState> d, int button) {
Dict dp = new Dict();
for (Map.Entry<String, Object> ee : press.entrySet())
dp.put(new Dict.Prop<Object>(ee.getKey()), ee.getValue());
target.attributes.putAll(dp);
target.modify();
Drawing.dirty(box);
FLineInteraction interaction = d.properties.get(FLineInteraction.interaction);
d.properties.put(Window.consumed, true);
Log.log("interactive.debug", () -> "DOWN !, consuming " + d + " " + d.properties + " " + System.identityHashCode(d) + " " + interaction);
during = true;
return (e, t) -> {
FLine ongoingTarget = e.properties.get(_interactionTarget);
Log.log("interactive.debug", () -> "handling .... ");
if (handle != null) {
Vec2 point = interaction.convertCoordinateSystem(new Vec2(e.after.x, e.after.y));
if (interaction.intersects(ongoingTarget, point)) {
handle.dragged(t, this.target, e);
System.out.println(" interaction is in ");
target.attributes.putAll(dp);
target.modify();
} else {
if (!upSemantics)
handle.dragged(t, this.target, e);
System.out.println(" interaction is out, point :" + e.after.x + " " + e.after.y + " not in " + interaction.projectFLineToArea(ongoingTarget).getBounds());
target.attributes.putAll(original, x -> implicated.contains(x.getName()));
target.modify();
}
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
}
e.properties.put(Window.consumed, true);
if (t) {
Log.log("interactive.debug", () -> "resetting on termination ");
target.attributes.putAll(original, x -> implicated.contains(x.getName()));
target.modify();
during = false;
Vec2 point = interaction.convertCoordinateSystem(new Vec2(e.after.x, e.after.y));
if (interaction.intersects(ongoingTarget, point)) {
RunLoop.main.delayTicks(() -> {
enter(null);
}, 2);
}
Drawing.dirty(box);
Drawing.dirty(box, "__main__");
}
return !t;
};
}
}
| 4,759 | 0.686988 | 0.685726 | 170 | 26.982353 | 33.57756 | 270 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.394118 | false | false | 15 |
55d3346dd0f62e8c8b822d768219ef916cc234bb | 18,253,611,069,482 | 5d5ace38f8873b43a9689bf74dff9c63177f07d9 | /Eclipse-workspace/LeetCode/src/leetcodeanswer/_120三角形最小路径和.java | e6643d1eaf52d52ab56a6898da4c2ea1830c44db | []
| no_license | Jackyjinchen/Algorithm_Study | https://github.com/Jackyjinchen/Algorithm_Study | 7972a42cbafeefcfb7be624127763867e46ad722 | dae0eb0f09864c3341b05e2fd8dbbca5601a526d | refs/heads/main | 2023-01-01T15:47:30.232000 | 2020-10-31T02:45:33 | 2020-10-31T02:45:33 | 308,789,878 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcodeanswer;
import java.util.ArrayList;
import java.util.List;
public class _120三角形最小路径和 {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<List<Integer>> triangle = new ArrayList<>();
List<Integer> list1 = new ArrayList<Integer>();
list1.add(2);
triangle.add(list1);
List<Integer> list2 = new ArrayList<Integer>();
list2.add(3);
list2.add(4);
triangle.add(list2);
List<Integer> list3 = new ArrayList<Integer>();
list3.add(6);
list3.add(5);
list3.add(7);
triangle.add(list3);
List<Integer> list4 = new ArrayList<Integer>();
list4.add(4);
list4.add(1);
list4.add(8);
list4.add(3);
triangle.add(list4);
// System.out.println(triangle);
Solution120 sl = new Solution120();
System.out.println(sl.minimumTotal(triangle));
}
}
class Solution120 {
public int minimumTotal(List<List<Integer>> triangle) {
if (triangle.size() < 1) {
return 0;
}
if (triangle.size() == 1) {
return triangle.get(0).get(0);
}
int temp = 0;
int lens = triangle.size();
for (int i = lens - 2; i >= 0; i--) {
for (int j = 0; j < i + 1; j++) {
triangle.get(i).set(j,
triangle.get(i).get(j) + Math.min(triangle.get(i + 1).get(j), triangle.get(i + 1).get(j + 1)));
}
}
return triangle.get(0).get(0);
}
} | GB18030 | Java | 1,329 | java | _120三角形最小路径和.java | Java | []
| null | []
| package leetcodeanswer;
import java.util.ArrayList;
import java.util.List;
public class _120三角形最小路径和 {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<List<Integer>> triangle = new ArrayList<>();
List<Integer> list1 = new ArrayList<Integer>();
list1.add(2);
triangle.add(list1);
List<Integer> list2 = new ArrayList<Integer>();
list2.add(3);
list2.add(4);
triangle.add(list2);
List<Integer> list3 = new ArrayList<Integer>();
list3.add(6);
list3.add(5);
list3.add(7);
triangle.add(list3);
List<Integer> list4 = new ArrayList<Integer>();
list4.add(4);
list4.add(1);
list4.add(8);
list4.add(3);
triangle.add(list4);
// System.out.println(triangle);
Solution120 sl = new Solution120();
System.out.println(sl.minimumTotal(triangle));
}
}
class Solution120 {
public int minimumTotal(List<List<Integer>> triangle) {
if (triangle.size() < 1) {
return 0;
}
if (triangle.size() == 1) {
return triangle.get(0).get(0);
}
int temp = 0;
int lens = triangle.size();
for (int i = lens - 2; i >= 0; i--) {
for (int j = 0; j < i + 1; j++) {
triangle.get(i).set(j,
triangle.get(i).get(j) + Math.min(triangle.get(i + 1).get(j), triangle.get(i + 1).get(j + 1)));
}
}
return triangle.get(0).get(0);
}
} | 1,329 | 0.630617 | 0.588728 | 61 | 20.540983 | 19.441019 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.081967 | false | false | 2 |
7dc6822f8be2810e81f6c360722680dfeec6a199 | 21,423,296,907,823 | 03c8af0e8a125d7cc4f41b3558d7d7ce8e5583cf | /src/ru/albemuth/util/RandomGenerator.java | dce00664d8109a25da1daac253d29f0909461edf | []
| no_license | gnuzzz/albemuth-util | https://github.com/gnuzzz/albemuth-util | 7a7bfb99dcb0a6bd36a37472105e998d1793f1f9 | b2248bda3c243f75c317c796cd533130265f445b | refs/heads/master | 2016-09-11T15:00:10.866000 | 2013-12-05T08:32:53 | 2013-12-05T08:32:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.albemuth.util;
import java.sql.Timestamp;
import java.sql.Time;
import java.sql.Date;
/**
* Created by IntelliJ IDEA.
* User: vovan
* Date: 02.08.2004
* Time: 14:46:36
* To change this template use Options | File Templates.
*/
public class RandomGenerator {
public static String randomString(int aLength) {
String ret = "";
for (int i = 0; i < aLength; i++) {
ret += (char)randomInt(64, 123);
}
return ret;
}
public static int randomInt(int aMin, int aMax) {
return (int)randomLong(aMin, aMax);
}
public static byte randomByte(byte aMin, byte aMax) {
return (byte)randomLong(aMin, aMax);
}
public static Date randomDate(Date aMin, Date aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Date(randomLong(t1, t2));
}
public static Time randomTime(Time aMin, Time aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Time(randomLong(t1, t2));
}
public static Timestamp randomTimestamp(Timestamp aMin, Timestamp aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Timestamp(randomLong(t1, t2));
}
public static boolean randomBoolean() {
return randomLong(0, 10) % 2 == 0;
}
public static long randomLong(long aMin, long aMax) {
return (long)(Math.random() * (aMax - aMin) + aMin);
}
public static float randomFloat(float aMin, float aMax) {
return (float)randomDouble(aMin, aMax);
}
public static double randomDouble(double aMin, double aMax) {
return Math.random() * (aMax - aMin) + aMin;
}
}
| UTF-8 | Java | 1,722 | java | RandomGenerator.java | Java | [
{
"context": "l.Date;\n\n/**\n * Created by IntelliJ IDEA.\n * User: vovan\n * Date: 02.08.2004\n * Time: 14:46:36\n * To chang",
"end": 146,
"score": 0.9925038814544678,
"start": 141,
"tag": "USERNAME",
"value": "vovan"
}
]
| null | []
| package ru.albemuth.util;
import java.sql.Timestamp;
import java.sql.Time;
import java.sql.Date;
/**
* Created by IntelliJ IDEA.
* User: vovan
* Date: 02.08.2004
* Time: 14:46:36
* To change this template use Options | File Templates.
*/
public class RandomGenerator {
public static String randomString(int aLength) {
String ret = "";
for (int i = 0; i < aLength; i++) {
ret += (char)randomInt(64, 123);
}
return ret;
}
public static int randomInt(int aMin, int aMax) {
return (int)randomLong(aMin, aMax);
}
public static byte randomByte(byte aMin, byte aMax) {
return (byte)randomLong(aMin, aMax);
}
public static Date randomDate(Date aMin, Date aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Date(randomLong(t1, t2));
}
public static Time randomTime(Time aMin, Time aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Time(randomLong(t1, t2));
}
public static Timestamp randomTimestamp(Timestamp aMin, Timestamp aMax) {
long t1 = aMin.getTime();
long t2 = aMax.getTime();
return new Timestamp(randomLong(t1, t2));
}
public static boolean randomBoolean() {
return randomLong(0, 10) % 2 == 0;
}
public static long randomLong(long aMin, long aMax) {
return (long)(Math.random() * (aMax - aMin) + aMin);
}
public static float randomFloat(float aMin, float aMax) {
return (float)randomDouble(aMin, aMax);
}
public static double randomDouble(double aMin, double aMax) {
return Math.random() * (aMax - aMin) + aMin;
}
}
| 1,722 | 0.606852 | 0.585366 | 66 | 25.09091 | 22.21706 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621212 | false | false | 2 |
312d6b353efb354f1acfce60328b0538760464ee | 28,948,079,613,700 | e872f7188a4c261b820e8fe26a279301aea7ff94 | /app/src/main/java/com/example/pkkbajukita/Adapter/AdapterBarang.java | d4c20386135b8c72ff1e35cd0360a34dde342a24 | []
| no_license | rasyidk/android-bajukita | https://github.com/rasyidk/android-bajukita | 754fccf77ee94ffe788f68cd404dab13d16c69e4 | 1607c9b24fca1c3c0d8521915130c1c84f0a1740 | refs/heads/master | 2021-01-02T13:40:56.293000 | 2020-02-12T11:45:08 | 2020-02-12T11:45:08 | 239,646,681 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.pkkbajukita.Adapter;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
/**
* Created by Dimas Maulana on 5/26/17.
* Email : araymaulana66@gmail.com
*/
import com.example.pkkbajukita.R;
import com.example.pkkbajukita.Value.ValueBarang;
public class AdapterBarang extends RecyclerView.Adapter {
private static final String TAG = "RecyclerAdapter";
List<ValueBarang> moviesList;
public AdapterBarang(List<ValueBarang> moviesList) {
this.moviesList = moviesList;
}
@Override
public int getItemViewType(int position) {
if (moviesList.get(position).getKet_barang().toLowerCase().contains("fak")) {
return 0;
}
return 1;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view;
if (viewType == 0) {
view = layoutInflater.inflate(R.layout.row_barang, parent, false);
return new ViewHolderOne(view);
}
view = layoutInflater.inflate(R.layout.row_barang, parent, false);
return new ViewHolderTwo(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
if (moviesList.get(position).getKet_barang().toLowerCase().contains("fak")) {
ViewHolderOne viewHolderOne = (ViewHolderOne) holder;
viewHolderOne.tv_judul.setText(moviesList.get(position).getNama_barang());
viewHolderOne.tv_ket_barang.setText(moviesList.get(position).getKet_barang());
viewHolderOne.tv_lokasi.setText(moviesList.get(position).getLokasi_barang());
viewHolderOne.tv_wa.setText(moviesList.get(position).getNo_wa());
String img = moviesList.get(position).getImg_barang();
byte[] decodestring = Base64.decode(img,Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodestring,0,decodestring.length);
viewHolderOne.imageView.setImageBitmap(bitmap);
}else {
ViewHolderTwo viewHolderTwo = (ViewHolderTwo) holder;
viewHolderTwo.tv_judul.setText(moviesList.get(position).getNama_barang());
viewHolderTwo.tv_ket_barang.setText(moviesList.get(position).getKet_barang());
viewHolderTwo.tv_lokasi.setText(moviesList.get(position).getLokasi_barang());
viewHolderTwo.tv_wa.setText(moviesList.get(position).getNo_wa());
String img = moviesList.get(position).getImg_barang();
byte[] decodestring = Base64.decode(img,Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodestring,0,decodestring.length);
viewHolderTwo.imageView.setImageBitmap(bitmap);
//Pindah
viewHolderTwo.btn_hubungi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Toast.makeText(v.getContext(), moviesList.get(position).getNama_barang(), Toast.LENGTH_SHORT).show();
String judul = moviesList.get(position).getNama_barang();
String number = moviesList.get(position).getNo_wa();
String url = "https://api.whatsapp.com/send?phone=" + number + "&text=Permisi, Apakah " + judul + " masih tersedia? Terimakasih";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
v.getContext().startActivity(i);
}
});
}
}
@Override
public int getItemCount() {
return moviesList.size();
}
class ViewHolderOne extends RecyclerView.ViewHolder {
TextView tv_judul,tv_ket_barang,tv_lokasi, tv_wa;
ImageView imageView;
public ViewHolderOne(@NonNull View itemView) {
super(itemView);
tv_judul = itemView.findViewById(R.id.tv_judul);
tv_ket_barang = itemView.findViewById(R.id.tv_keterangan);
tv_lokasi = itemView.findViewById(R.id.tv_lokasi);
tv_wa = itemView.findViewById(R.id.tv_wa);
imageView = itemView.findViewById(R.id.imagevw);
}
}
class ViewHolderTwo extends RecyclerView.ViewHolder {
TextView tv_judul,tv_ket_barang,tv_lokasi, tv_wa;
ImageView imageView;
Button btn_hubungi;
public ViewHolderTwo(@NonNull View itemView) {
super(itemView);
tv_judul = itemView.findViewById(R.id.tv_judul);
tv_ket_barang = itemView.findViewById(R.id.tv_keterangan);
tv_lokasi = itemView.findViewById(R.id.tv_lokasi);
tv_wa = itemView.findViewById(R.id.tv_wa);
imageView = itemView.findViewById(R.id.imagevw);
btn_hubungi = itemView.findViewById(R.id.btn_hubungi);
}
}
}
| UTF-8 | Java | 5,396 | java | AdapterBarang.java | Java | [
{
"context": "erView;\n\nimport java.util.List;\n\n/**\n * Created by Dimas Maulana on 5/26/17.\n * Email : araymaulana66@gmail.com\n *",
"end": 527,
"score": 0.9998749494552612,
"start": 514,
"tag": "NAME",
"value": "Dimas Maulana"
},
{
"context": " * Created by Dimas Maulana on 5/26/17.\n * Email : araymaulana66@gmail.com\n */\n\nimport com.example.pkkbajukita.R;\nimport com",
"end": 574,
"score": 0.9999269843101501,
"start": 551,
"tag": "EMAIL",
"value": "araymaulana66@gmail.com"
}
]
| null | []
| package com.example.pkkbajukita.Adapter;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
/**
* Created by <NAME> on 5/26/17.
* Email : <EMAIL>
*/
import com.example.pkkbajukita.R;
import com.example.pkkbajukita.Value.ValueBarang;
public class AdapterBarang extends RecyclerView.Adapter {
private static final String TAG = "RecyclerAdapter";
List<ValueBarang> moviesList;
public AdapterBarang(List<ValueBarang> moviesList) {
this.moviesList = moviesList;
}
@Override
public int getItemViewType(int position) {
if (moviesList.get(position).getKet_barang().toLowerCase().contains("fak")) {
return 0;
}
return 1;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view;
if (viewType == 0) {
view = layoutInflater.inflate(R.layout.row_barang, parent, false);
return new ViewHolderOne(view);
}
view = layoutInflater.inflate(R.layout.row_barang, parent, false);
return new ViewHolderTwo(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
if (moviesList.get(position).getKet_barang().toLowerCase().contains("fak")) {
ViewHolderOne viewHolderOne = (ViewHolderOne) holder;
viewHolderOne.tv_judul.setText(moviesList.get(position).getNama_barang());
viewHolderOne.tv_ket_barang.setText(moviesList.get(position).getKet_barang());
viewHolderOne.tv_lokasi.setText(moviesList.get(position).getLokasi_barang());
viewHolderOne.tv_wa.setText(moviesList.get(position).getNo_wa());
String img = moviesList.get(position).getImg_barang();
byte[] decodestring = Base64.decode(img,Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodestring,0,decodestring.length);
viewHolderOne.imageView.setImageBitmap(bitmap);
}else {
ViewHolderTwo viewHolderTwo = (ViewHolderTwo) holder;
viewHolderTwo.tv_judul.setText(moviesList.get(position).getNama_barang());
viewHolderTwo.tv_ket_barang.setText(moviesList.get(position).getKet_barang());
viewHolderTwo.tv_lokasi.setText(moviesList.get(position).getLokasi_barang());
viewHolderTwo.tv_wa.setText(moviesList.get(position).getNo_wa());
String img = moviesList.get(position).getImg_barang();
byte[] decodestring = Base64.decode(img,Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodestring,0,decodestring.length);
viewHolderTwo.imageView.setImageBitmap(bitmap);
//Pindah
viewHolderTwo.btn_hubungi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Toast.makeText(v.getContext(), moviesList.get(position).getNama_barang(), Toast.LENGTH_SHORT).show();
String judul = moviesList.get(position).getNama_barang();
String number = moviesList.get(position).getNo_wa();
String url = "https://api.whatsapp.com/send?phone=" + number + "&text=Permisi, Apakah " + judul + " masih tersedia? Terimakasih";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
v.getContext().startActivity(i);
}
});
}
}
@Override
public int getItemCount() {
return moviesList.size();
}
class ViewHolderOne extends RecyclerView.ViewHolder {
TextView tv_judul,tv_ket_barang,tv_lokasi, tv_wa;
ImageView imageView;
public ViewHolderOne(@NonNull View itemView) {
super(itemView);
tv_judul = itemView.findViewById(R.id.tv_judul);
tv_ket_barang = itemView.findViewById(R.id.tv_keterangan);
tv_lokasi = itemView.findViewById(R.id.tv_lokasi);
tv_wa = itemView.findViewById(R.id.tv_wa);
imageView = itemView.findViewById(R.id.imagevw);
}
}
class ViewHolderTwo extends RecyclerView.ViewHolder {
TextView tv_judul,tv_ket_barang,tv_lokasi, tv_wa;
ImageView imageView;
Button btn_hubungi;
public ViewHolderTwo(@NonNull View itemView) {
super(itemView);
tv_judul = itemView.findViewById(R.id.tv_judul);
tv_ket_barang = itemView.findViewById(R.id.tv_keterangan);
tv_lokasi = itemView.findViewById(R.id.tv_lokasi);
tv_wa = itemView.findViewById(R.id.tv_wa);
imageView = itemView.findViewById(R.id.imagevw);
btn_hubungi = itemView.findViewById(R.id.btn_hubungi);
}
}
}
| 5,373 | 0.651038 | 0.646961 | 150 | 34.973331 | 32.157932 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.626667 | false | false | 2 |
02de3b726dc0dbeb59060c92444b8f5acaf09ce0 | 22,033,182,275,397 | c64bc262285919a54a5c5e53a32b8c3e11174c49 | /NewFatAdmin/app/src/main/java/com/example/rioir/fat/RecyclerAdapter.java | 14ae0a82aadc8c6b531f3efdca6859586fbcd628 | []
| no_license | Rioirvansyah/FoodAndThings | https://github.com/Rioirvansyah/FoodAndThings | 80bd471ecc25e54f4d8041d0f644c53b787db59b | 4622c8d6d5ee30a0a53891fe0c5d376fa36365c5 | refs/heads/master | 2020-04-01T09:27:48.069000 | 2018-12-10T03:58:01 | 2018-12-10T03:58:01 | 153,076,030 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.rioir.fat;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
/**
* Created by rioir on 10/20/2018.
*/
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.MyViewHolder>{
Context mContext;
List<Home> mData;
Dialog dialog;
DataHelper datamakanan;
Cursor cursor;
public RecyclerAdapter(Context mContext, List<Home> mData) {
this.mContext = mContext;
this.mData = mData;
datamakanan = new DataHelper(FragmentHome.layarutama.getContext());
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v;
v = LayoutInflater.from(mContext).inflate(R.layout.item_home, parent, false);
final MyViewHolder vHolder = new MyViewHolder(v);
//dialog
dialog = new Dialog(mContext);
dialog.setContentView(R.layout.dialog_home);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
vHolder.item_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final TextView txt_dialog_nama = dialog.findViewById(R.id.dialog_nama);
TextView txt_dialog_daerah = dialog.findViewById(R.id.dialog_daerah);
txt_dialog_nama.setText(mData.get(vHolder.getAdapterPosition()).getMenu());
txt_dialog_daerah.setText(mData.get(vHolder.getAdapterPosition()).getDaerah());
dialog.show();
Button btn_lihat = dialog.findViewById(R.id.dialog_btn_lihat);
btn_lihat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent0 = new Intent(mContext, TampilData.class);
intent0.putExtra("menu",txt_dialog_nama.getText().toString());
mContext.startActivity(intent0);
}
});
Button btn_update = dialog.findViewById(R.id.dialog_btn_edit);
btn_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent1 = new Intent(mContext, EditData.class);
intent1.putExtra("menu",txt_dialog_nama.getText().toString());
mContext.startActivity(intent1);
}
});
Button btn_delete = dialog.findViewById(R.id.dialog_btn_hapus);
btn_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
datamakanan = new DataHelper(FragmentHome.layarutama.getActivity());
SQLiteDatabase db = datamakanan.getWritableDatabase();
db.execSQL("DELETE FROM makanan where menu = '"+txt_dialog_nama.getText().toString()+"'");
Intent i = new Intent(mContext,MainActivity.class);
Intent intent0 = new Intent(mContext, MainActivity.class);
mContext.startActivity(intent0);
}
});
}
});
return vHolder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.txt_menu.setText(mData.get(position).getMenu());
holder.txt_daerah.setText(mData.get(position).getDaerah());
holder.txt_harga.setText(mData.get(position).getHarga());
// holder.img.setImageResource(mData.get(position).getGambar());
}
@Override
public int getItemCount() {
return mData.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder{
private LinearLayout item_home;
private TextView txt_menu;
private TextView txt_daerah;
private TextView txt_harga;
// private ImageView img;
public MyViewHolder(View itemView) {
super(itemView);
item_home = itemView.findViewById(R.id.iditem_home);
txt_menu = itemView.findViewById(R.id.menu);
txt_daerah = itemView.findViewById(R.id.daerah);
txt_harga = itemView.findViewById(R.id.harga);
// img = itemView.findViewById(R.id.gambar);
}
}
}
| UTF-8 | Java | 5,009 | java | RecyclerAdapter.java | Java | [
{
"context": "package com.example.rioir.fat;\n\nimport android.app.Activity;\nimport andro",
"end": 23,
"score": 0.7627206444740295,
"start": 20,
"tag": "USERNAME",
"value": "rio"
},
{
"context": ".Toast;\n\nimport java.util.List;\n\n/**\n * Created by rioir on 10/20/2018.\n */\n\npublic class RecyclerAda",
"end": 651,
"score": 0.9522291421890259,
"start": 651,
"tag": "USERNAME",
"value": ""
},
{
"context": "Toast;\n\nimport java.util.List;\n\n/**\n * Created by rioir on 10/20/2018.\n */\n\npublic class RecyclerAdapter ",
"end": 657,
"score": 0.9855663180351257,
"start": 652,
"tag": "USERNAME",
"value": "rioir"
}
]
| null | []
| package com.example.rioir.fat;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
/**
* Created by rioir on 10/20/2018.
*/
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.MyViewHolder>{
Context mContext;
List<Home> mData;
Dialog dialog;
DataHelper datamakanan;
Cursor cursor;
public RecyclerAdapter(Context mContext, List<Home> mData) {
this.mContext = mContext;
this.mData = mData;
datamakanan = new DataHelper(FragmentHome.layarutama.getContext());
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v;
v = LayoutInflater.from(mContext).inflate(R.layout.item_home, parent, false);
final MyViewHolder vHolder = new MyViewHolder(v);
//dialog
dialog = new Dialog(mContext);
dialog.setContentView(R.layout.dialog_home);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
vHolder.item_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final TextView txt_dialog_nama = dialog.findViewById(R.id.dialog_nama);
TextView txt_dialog_daerah = dialog.findViewById(R.id.dialog_daerah);
txt_dialog_nama.setText(mData.get(vHolder.getAdapterPosition()).getMenu());
txt_dialog_daerah.setText(mData.get(vHolder.getAdapterPosition()).getDaerah());
dialog.show();
Button btn_lihat = dialog.findViewById(R.id.dialog_btn_lihat);
btn_lihat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent0 = new Intent(mContext, TampilData.class);
intent0.putExtra("menu",txt_dialog_nama.getText().toString());
mContext.startActivity(intent0);
}
});
Button btn_update = dialog.findViewById(R.id.dialog_btn_edit);
btn_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent1 = new Intent(mContext, EditData.class);
intent1.putExtra("menu",txt_dialog_nama.getText().toString());
mContext.startActivity(intent1);
}
});
Button btn_delete = dialog.findViewById(R.id.dialog_btn_hapus);
btn_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
datamakanan = new DataHelper(FragmentHome.layarutama.getActivity());
SQLiteDatabase db = datamakanan.getWritableDatabase();
db.execSQL("DELETE FROM makanan where menu = '"+txt_dialog_nama.getText().toString()+"'");
Intent i = new Intent(mContext,MainActivity.class);
Intent intent0 = new Intent(mContext, MainActivity.class);
mContext.startActivity(intent0);
}
});
}
});
return vHolder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.txt_menu.setText(mData.get(position).getMenu());
holder.txt_daerah.setText(mData.get(position).getDaerah());
holder.txt_harga.setText(mData.get(position).getHarga());
// holder.img.setImageResource(mData.get(position).getGambar());
}
@Override
public int getItemCount() {
return mData.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder{
private LinearLayout item_home;
private TextView txt_menu;
private TextView txt_daerah;
private TextView txt_harga;
// private ImageView img;
public MyViewHolder(View itemView) {
super(itemView);
item_home = itemView.findViewById(R.id.iditem_home);
txt_menu = itemView.findViewById(R.id.menu);
txt_daerah = itemView.findViewById(R.id.daerah);
txt_harga = itemView.findViewById(R.id.harga);
// img = itemView.findViewById(R.id.gambar);
}
}
}
| 5,009 | 0.619884 | 0.61649 | 129 | 37.829456 | 29.05678 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.658915 | false | false | 2 |
4b202e00a3ca717ee71e41a90a609e84a602ac8e | 32,933,809,274,434 | 9aebf3119bf906730a05cd340f7563e51c7c292d | /GenericInventory/src/main/java/com/genericinventory/domain/service/DataObjectService.java | b94cdb143861dedc34ecde46cbcb0f9836b10d1e | []
| no_license | lunachickengrill/JavaStuff | https://github.com/lunachickengrill/JavaStuff | d494b3799426cd5e3e8b795010969f4a84328861 | 3f6fb9d6a65d8b39b9305ea4c746d40287f60420 | refs/heads/master | 2021-06-08T11:13:03.100000 | 2019-10-27T17:17:01 | 2019-10-27T17:17:01 | 150,226,257 | 0 | 0 | null | false | 2021-05-08T16:59:57 | 2018-09-25T07:41:51 | 2019-10-27T17:17:11 | 2021-05-08T16:59:56 | 1,129 | 0 | 0 | 5 | Java | false | false | package com.genericinventory.domain.service;
import com.genericinventory.domain.dataobject.DataObject;
import com.genericinventory.domain.objecttype.ObjectType;
public interface DataObjectService {
DataObject constructFromObjectType(final ObjectType objectType);
}
| UTF-8 | Java | 280 | java | DataObjectService.java | Java | []
| null | []
| package com.genericinventory.domain.service;
import com.genericinventory.domain.dataobject.DataObject;
import com.genericinventory.domain.objecttype.ObjectType;
public interface DataObjectService {
DataObject constructFromObjectType(final ObjectType objectType);
}
| 280 | 0.825 | 0.825 | 10 | 26 | 26.825361 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
a53d1ebcbdc313a3d4e7db4ebb6f2f90e2e694f9 | 24,404,004,231,228 | eb3ccc790d2df81c04ca568cbfc21f012029c1eb | /src/main/java/com/zhkj/message_system/service/CodeQuotientService.java | 2b6a3f8f121a12a9479bef56e048cd5079e4b411 | []
| no_license | zfh1726401945/messages_system | https://github.com/zfh1726401945/messages_system | 23d6f7f0adee4cf5192bdd4bd56597206e150e51 | 98a8f3b3c664235d4497a5d12934318162c0e8ae | refs/heads/master | 2020-03-22T04:42:24.961000 | 2018-12-11T03:24:11 | 2018-12-11T03:24:11 | 139,515,435 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhkj.message_system.service;
import java.util.LinkedHashMap;
public interface CodeQuotientService {
/**
* app端获取号码的服务
*
* @param device_num
* @return
*/
public LinkedHashMap<String, Object> getPhoneByCodeQuotient(Integer device_num);
/**
* 获取验证码的方法
*
* @param device_num
* @param phone
* @return
*/
public LinkedHashMap<String, Object> getVerificationCode(Integer device_num, String phone);
} | UTF-8 | Java | 510 | java | CodeQuotientService.java | Java | []
| null | []
| package com.zhkj.message_system.service;
import java.util.LinkedHashMap;
public interface CodeQuotientService {
/**
* app端获取号码的服务
*
* @param device_num
* @return
*/
public LinkedHashMap<String, Object> getPhoneByCodeQuotient(Integer device_num);
/**
* 获取验证码的方法
*
* @param device_num
* @param phone
* @return
*/
public LinkedHashMap<String, Object> getVerificationCode(Integer device_num, String phone);
} | 510 | 0.648536 | 0.648536 | 22 | 20.772728 | 24.602165 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false | 2 |
d79c79dead82883f0e3dcfbf2e56d214d88b67e6 | 9,062,381,050,715 | 86aa5dc339b738bbd2ddd98284642f560920d274 | /src/test/java/pt/isel/ls/utils/HeaderTest.java | 2a239e5fc1be0025558bb4d404c79b572c11f79f | []
| no_license | laruibasar/leic-lic-2021si | https://github.com/laruibasar/leic-lic-2021si | bccc2ed620ebff8dcf988b31905a20e7d2800109 | 8270e2bdea2bb5d55e609864fe1a7f6652a554d0 | refs/heads/master | 2023-03-12T04:53:56.676000 | 2021-02-01T23:54:12 | 2021-02-01T23:54:12 | 343,149,289 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pt.isel.ls.utils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class HeaderTest {
@Test
public void header_equals() {
Header header = new Header("accept:text/html|file-name:test.txt");
assertEquals("accept:text/html|file-name:test.txt", header.toString());
}
@Test
public void header_split_fields_equals() {
Header header = new Header("accept:text/html|file-name:test.txt");
assertEquals("text/html", header.getValue("accept"));
assertEquals("test.txt", header.getValue("file-name"));
}
@Test
public void header_absent_accept() {
Header header = new Header("file-name:test.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("test.txt", header.getValue("file-name"));
}
@Test
public void header_absent_filename() {
Header header = new Header("accept:text/html");
assertEquals("text/html", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_doble_accept() {
Header header = new Header("accept:text/html|accept:text/plain");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_invalid_accept() {
Header header = new Header("accept:|file-name:text.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("text.txt", header.getValue("file-name"));
}
@Test
public void header_another_invalid_accept() {
Header header = new Header("accept:text/css|file-name:text.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("text.txt", header.getValue("file-name"));
}
@Test
public void header_invalid_filename() {
Header header = new Header("accept:text/plain|file-name:");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_invalid_filename_accept() {
Header header = new Header("accept:|file-name:");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_absent_accept_filename() {
Header header = new Header();
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
}
| UTF-8 | Java | 2,560 | java | HeaderTest.java | Java | []
| null | []
| package pt.isel.ls.utils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class HeaderTest {
@Test
public void header_equals() {
Header header = new Header("accept:text/html|file-name:test.txt");
assertEquals("accept:text/html|file-name:test.txt", header.toString());
}
@Test
public void header_split_fields_equals() {
Header header = new Header("accept:text/html|file-name:test.txt");
assertEquals("text/html", header.getValue("accept"));
assertEquals("test.txt", header.getValue("file-name"));
}
@Test
public void header_absent_accept() {
Header header = new Header("file-name:test.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("test.txt", header.getValue("file-name"));
}
@Test
public void header_absent_filename() {
Header header = new Header("accept:text/html");
assertEquals("text/html", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_doble_accept() {
Header header = new Header("accept:text/html|accept:text/plain");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_invalid_accept() {
Header header = new Header("accept:|file-name:text.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("text.txt", header.getValue("file-name"));
}
@Test
public void header_another_invalid_accept() {
Header header = new Header("accept:text/css|file-name:text.txt");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("text.txt", header.getValue("file-name"));
}
@Test
public void header_invalid_filename() {
Header header = new Header("accept:text/plain|file-name:");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_invalid_filename_accept() {
Header header = new Header("accept:|file-name:");
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
@Test
public void header_absent_accept_filename() {
Header header = new Header();
assertEquals("text/plain", header.getValue("accept"));
assertEquals("", header.getValue("file-name"));
}
}
| 2,560 | 0.630469 | 0.630469 | 77 | 32.246754 | 27.062292 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.766234 | false | false | 2 |
fbc9a250d726c5384abbea06fc6ab6c3ba208bb5 | 9,062,381,051,399 | eda68e649eb68b4a75dd996f99b6279c08bf983a | /ParcelableDemo/app/src/main/java/com/example/parcelabledemo/ProductDetails.java | 4d7413a927402a6f5bac39b93c949ad700459cc6 | []
| no_license | ajaykhandge/Android_Parcelable_Demo | https://github.com/ajaykhandge/Android_Parcelable_Demo | cb479b2affd9233a4dc01efbee0831d937d8dcef | f84d0ed8403ee2d4ef4ff04f8cd079daec4172c7 | refs/heads/master | 2023-05-06T02:14:19.720000 | 2021-05-19T11:52:39 | 2021-05-19T11:52:39 | 334,965,090 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.parcelabledemo;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
public class ProductDetails extends AppCompatActivity {
private TextView title;
private ImageView imageView;
private TextView description;
private TextView price;
private TextView ratings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_details);
title = findViewById(R.id.prod_title);
description = findViewById(R.id.prod_subtitle);
imageView = findViewById(R.id.prod_imageview);
price = findViewById(R.id.prod_price);
ratings = findViewById(R.id.prod_ratings);
this.setTitle("Product Info");
Intent intent = getIntent(); //
Product details = intent.getParcelableExtra("product details"); //getParcelableExtra instead of getExtra
this.setTitle(details.getTitle());
setProdcutDetails(details); //acessing the object
}
private void setProdcutDetails(Product product){
title.setText(product.getTitle());
description.setText(product.getDescription());
imageView.setImageResource(product.getImageResource());
price.setText(price.getText()+" $."+ product.getPrice());
ratings.setText(ratings.getText()+" "+product.getRatings());
}
} | UTF-8 | Java | 1,541 | java | ProductDetails.java | Java | []
| null | []
| package com.example.parcelabledemo;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
public class ProductDetails extends AppCompatActivity {
private TextView title;
private ImageView imageView;
private TextView description;
private TextView price;
private TextView ratings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_details);
title = findViewById(R.id.prod_title);
description = findViewById(R.id.prod_subtitle);
imageView = findViewById(R.id.prod_imageview);
price = findViewById(R.id.prod_price);
ratings = findViewById(R.id.prod_ratings);
this.setTitle("Product Info");
Intent intent = getIntent(); //
Product details = intent.getParcelableExtra("product details"); //getParcelableExtra instead of getExtra
this.setTitle(details.getTitle());
setProdcutDetails(details); //acessing the object
}
private void setProdcutDetails(Product product){
title.setText(product.getTitle());
description.setText(product.getDescription());
imageView.setImageResource(product.getImageResource());
price.setText(price.getText()+" $."+ product.getPrice());
ratings.setText(ratings.getText()+" "+product.getRatings());
}
} | 1,541 | 0.707333 | 0.707333 | 48 | 31.125 | 25.310263 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.604167 | false | false | 2 |
8c6f72046afe7aa37b149401ea29c8362a2d8612 | 29,033,978,965,666 | 937e365880468c93a7963e783ca5de4d6eb4e74b | /src/Gun08/StringReplaceAll.java | 2dcabb6c715a36bf606086ae5f2efd04740709fa | []
| no_license | YusufSahin90/JavaKursu | https://github.com/YusufSahin90/JavaKursu | 1d098b02fb526db5ad9d32eb8f5d48ae45be10b5 | 6eabec70504c666cbf842088e54688532b3b3180 | refs/heads/master | 2023-01-22T10:45:33.010000 | 2020-11-24T19:13:11 | 2020-11-24T19:13:11 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Gun08;
public class StringReplaceAll {
public static void main(String[] args) {
// ReplaceAll : replace gibi çalışır, farkı kritere göre degistirir.
String text = "Merhaba Dünya";
System.out.println("Original hali : " + text);
System.out.println("a,b,n leri, _ yapılmıs hali : " + text.replaceAll("[abn]", "_"));
System.out.println("Buyuk harfleri * yapılmıs hali : " + text.replaceAll("[A-Z]", "_")); // A'dan Z'ye kadar olan harfleri _ yapar.
System.out.println("Buyuk harfleri * yapılmıs hali : " + text.replaceAll("[A-D]", "*")); // A'dan D'ye kadar olan harfleri * yapar.
}
}
| UTF-8 | Java | 671 | java | StringReplaceAll.java | Java | [
{
"context": " kritere göre degistirir.\n\n String text = \"Merhaba Dünya\";\n\n System.out.println(\"Original hali : \" ",
"end": 208,
"score": 0.9995322823524475,
"start": 195,
"tag": "NAME",
"value": "Merhaba Dünya"
}
]
| null | []
| package Gun08;
public class StringReplaceAll {
public static void main(String[] args) {
// ReplaceAll : replace gibi çalışır, farkı kritere göre degistirir.
String text = "<NAME>";
System.out.println("Original hali : " + text);
System.out.println("a,b,n leri, _ yapılmıs hali : " + text.replaceAll("[abn]", "_"));
System.out.println("Buyuk harfleri * yapılmıs hali : " + text.replaceAll("[A-Z]", "_")); // A'dan Z'ye kadar olan harfleri _ yapar.
System.out.println("Buyuk harfleri * yapılmıs hali : " + text.replaceAll("[A-D]", "*")); // A'dan D'ye kadar olan harfleri * yapar.
}
}
| 663 | 0.609423 | 0.606383 | 22 | 28.90909 | 44.064941 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false | 2 |
f0077b38d2de0105bf9a82ade8292b1565fcb516 | 29,197,187,734,594 | a84d2aaac00f3596b34fd39a753366c8f62eb45e | /zisecm-portal/src/main/java/com/ecm/portal/controller/admin/CfgActivityManager.java | 45adfc71a870416a29eeb307afb2fa399bfe90e6 | []
| no_license | breezerong/zisecm | https://github.com/breezerong/zisecm | 7d619f3a37275d3cdc79164aaf10f469e8b3082d | 6dcbd86ed4d24fd9bb1cc64a4317ba7fc6c52c64 | refs/heads/master | 2023-05-12T02:52:29.336000 | 2022-11-18T08:58:45 | 2022-11-18T08:58:45 | 214,353,868 | 2 | 0 | null | false | 2023-05-07T00:05:12 | 2019-10-11T05:51:09 | 2023-01-30T20:56:33 | 2023-05-07T00:05:11 | 226,805 | 2 | 0 | 50 | Vue | false | false | package com.ecm.portal.controller.admin;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.flowable.bpmn.model.Artifact;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.EndEvent;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.FlowNode;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.flowable.engine.repository.ProcessDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ecm.core.ActionContext;
import com.ecm.core.entity.EcmAction;
import com.ecm.core.entity.EcmCfgActivity;
import com.ecm.core.service.ActionService;
import com.ecm.core.service.CfgActivityService;
import com.ecm.portal.controller.ControllerAbstract;
import com.ecm.portal.log.LogAopAction;
/**
* 工作流配置管理
* @author Haihong Rong
* Date:2020年4月13日 下午4:59:11
*/
@Controller
@RequestMapping(value = "/cfgworkflow")
public class CfgActivityManager extends ControllerAbstract{
private final Logger logger = LoggerFactory.getLogger(CfgActivityManager.class);
@Autowired
private CfgActivityService cfgActivityService;
@Autowired
private RepositoryService repositoryService;
/**
* 获取所有流程定义
* @return
*/
@ResponseBody
@RequestMapping(value="processes",method = RequestMethod.GET)
public Map<String, Object> getProcesses() {
Map<String, Object> mp = new HashMap<String, Object>();
try {
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().latestVersion().list();
List<Map<String, Object>> itemList = new ArrayList<Map<String, Object>>();
for(ProcessDefinition item: list) {
Map<String, Object> p = new HashMap<String, Object>();
p.put("deploymentId", item.getDeploymentId());
p.put("id", item.getId());
p.put("name", item.getName());
p.put("version", item.getVersion());
p.put("description", item.getDescription());
itemList.add(p);
}
mp.put("data", itemList);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
/**
* 更新事件
*
* @param obj 事件jason对象
* @return
*/
@RequestMapping(value = "/activities/{processId}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getActivities(@PathVariable("processId") String processId) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
org.flowable.bpmn.model.Process process = repositoryService.getBpmnModel(processId).getMainProcess();
Collection<FlowElement> list = process.getFlowElements();
List<String> acts = new ArrayList<String>();
acts.add("start");
for (FlowElement f : list) {
//System.out.println(f.getClass().getName()+":"+f.getId()+": "+f.getName());
if (f instanceof UserTask) {
UserTask act = (UserTask)f;
acts.add(act.getName());
}
}
mp.put("data", acts);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivities/{processId}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getCfgActivities(@PathVariable("processId") String processId) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
List<EcmCfgActivity> list = cfgActivityService.getProcessCfgActivities(getToken(), processId);
mp.put("data", list);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivity/{id}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getCfgActivity(@PathVariable("id") String id) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
EcmCfgActivity obj = cfgActivityService.getObjectById(getToken(), id);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/newCfgActivity", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> newCfgActivity(@RequestBody EcmCfgActivity obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.newObject(getToken(), obj);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/updateCfgActivity", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> updateCfgActivity(@RequestBody EcmCfgActivity obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.updateObject(getToken(), obj);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivity/{id}", method = RequestMethod.DELETE)
@ResponseBody
public Map<String, Object> deleteCfgActivity(@PathVariable("id") String id) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.deleteObjectById(getToken(), id);
mp.put("data", id);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/updateProcessId", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> updateProcessId(@RequestBody Map<String, String> obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.updateProcessId(getToken(), obj.get("name"),obj.get("id"));
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
}
| UTF-8 | Java | 7,671 | java | CfgActivityManager.java | Java | [
{
"context": "ortal.log.LogAopAction;\n\n/**\n * 工作流配置管理\n * @author Haihong Rong\n * Date:2020年4月13日 下午4:59:11\n */\n@Controller\n@Req",
"end": 1542,
"score": 0.999841034412384,
"start": 1530,
"tag": "NAME",
"value": "Haihong Rong"
}
]
| null | []
| package com.ecm.portal.controller.admin;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.flowable.bpmn.model.Artifact;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.EndEvent;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.FlowNode;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.flowable.engine.repository.ProcessDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ecm.core.ActionContext;
import com.ecm.core.entity.EcmAction;
import com.ecm.core.entity.EcmCfgActivity;
import com.ecm.core.service.ActionService;
import com.ecm.core.service.CfgActivityService;
import com.ecm.portal.controller.ControllerAbstract;
import com.ecm.portal.log.LogAopAction;
/**
* 工作流配置管理
* @author <NAME>
* Date:2020年4月13日 下午4:59:11
*/
@Controller
@RequestMapping(value = "/cfgworkflow")
public class CfgActivityManager extends ControllerAbstract{
private final Logger logger = LoggerFactory.getLogger(CfgActivityManager.class);
@Autowired
private CfgActivityService cfgActivityService;
@Autowired
private RepositoryService repositoryService;
/**
* 获取所有流程定义
* @return
*/
@ResponseBody
@RequestMapping(value="processes",method = RequestMethod.GET)
public Map<String, Object> getProcesses() {
Map<String, Object> mp = new HashMap<String, Object>();
try {
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().latestVersion().list();
List<Map<String, Object>> itemList = new ArrayList<Map<String, Object>>();
for(ProcessDefinition item: list) {
Map<String, Object> p = new HashMap<String, Object>();
p.put("deploymentId", item.getDeploymentId());
p.put("id", item.getId());
p.put("name", item.getName());
p.put("version", item.getVersion());
p.put("description", item.getDescription());
itemList.add(p);
}
mp.put("data", itemList);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
/**
* 更新事件
*
* @param obj 事件jason对象
* @return
*/
@RequestMapping(value = "/activities/{processId}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getActivities(@PathVariable("processId") String processId) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
org.flowable.bpmn.model.Process process = repositoryService.getBpmnModel(processId).getMainProcess();
Collection<FlowElement> list = process.getFlowElements();
List<String> acts = new ArrayList<String>();
acts.add("start");
for (FlowElement f : list) {
//System.out.println(f.getClass().getName()+":"+f.getId()+": "+f.getName());
if (f instanceof UserTask) {
UserTask act = (UserTask)f;
acts.add(act.getName());
}
}
mp.put("data", acts);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivities/{processId}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getCfgActivities(@PathVariable("processId") String processId) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
List<EcmCfgActivity> list = cfgActivityService.getProcessCfgActivities(getToken(), processId);
mp.put("data", list);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivity/{id}", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getCfgActivity(@PathVariable("id") String id) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
EcmCfgActivity obj = cfgActivityService.getObjectById(getToken(), id);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/newCfgActivity", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> newCfgActivity(@RequestBody EcmCfgActivity obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.newObject(getToken(), obj);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/updateCfgActivity", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> updateCfgActivity(@RequestBody EcmCfgActivity obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.updateObject(getToken(), obj);
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/cfgActivity/{id}", method = RequestMethod.DELETE)
@ResponseBody
public Map<String, Object> deleteCfgActivity(@PathVariable("id") String id) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.deleteObjectById(getToken(), id);
mp.put("data", id);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
@RequestMapping(value = "/updateProcessId", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> updateProcessId(@RequestBody Map<String, String> obj) {
Map<String, Object> mp = new HashMap<String, Object>();
try {
cfgActivityService.updateProcessId(getToken(), obj.get("name"),obj.get("id"));
mp.put("data", obj);
mp.put("code", ActionContext.SUCESS);
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
logger.error(e.getMessage());
mp.put("code", ActionContext.FAILURE);
mp.put("message", e.getMessage());
}
return mp;
}
}
| 7,665 | 0.708601 | 0.706763 | 235 | 31.404255 | 24.471312 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.446809 | false | false | 2 |
5f1199ee420c96c7984c70768c3662ea9d43091f | 8,546,984,972,693 | 30e3c91f23aaa6127ee3e520becc443701e18faa | /sources/com/p683ss/android/ugc/aweme/setting/C41536al.java | f259b9d9e045e3f2e9016965d22e249179447325 | []
| no_license | jakesyl/tishtosh_source | https://github.com/jakesyl/tishtosh_source | 521d4ab2bc28325519cf84422cce9c5709339b1f | c88d8f6fc6147fc08dfda6bd6d8540156278fa5d | refs/heads/master | 2022-09-10T17:19:16.637000 | 2020-05-25T06:06:31 | 2020-05-25T06:06:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.p683ss.android.ugc.aweme.setting;
/* renamed from: com.ss.android.ugc.aweme.setting.al */
public interface C41536al {
/* renamed from: a */
void mo48470a(int i);
}
| UTF-8 | Java | 185 | java | C41536al.java | Java | []
| null | []
| package com.p683ss.android.ugc.aweme.setting;
/* renamed from: com.ss.android.ugc.aweme.setting.al */
public interface C41536al {
/* renamed from: a */
void mo48470a(int i);
}
| 185 | 0.697297 | 0.627027 | 7 | 25.428572 | 18.912256 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 2 |
f16f6225473eb97546507ee743fbc82b7ce47fb2 | 14,044,543,109,345 | 8a518f95b455485ceb2e760bcc47cf518374301f | /src/sdesheet/Day2.java | 0e0f7f9c8914cd0797cccbd6b86534a647c3ab94 | []
| no_license | ajay109458/LeetCode | https://github.com/ajay109458/LeetCode | c0567e89cdef5ea9980da4a583cfdc195bb484ad | e3980e63f24079b9ddcc7b261eea8286e1d6a664 | refs/heads/master | 2022-05-29T15:25:35.334000 | 2021-06-26T12:53:46 | 2021-06-26T12:53:46 | 245,487,557 | 0 | 0 | null | false | 2022-05-20T22:04:35 | 2020-03-06T18:10:29 | 2021-06-26T12:53:55 | 2022-05-20T22:04:35 | 724 | 0 | 0 | 1 | Java | false | false | package sdesheet;
import array.ArrayHelper;
import java.util.Arrays;
public class Day2 {
public int maxProfit(int[] prices) {
if (prices.length == 0)
return 0;
int buy = prices[0];
int maxProfit = 0;
int sell = prices[0];
int i = 0;
while(i < prices.length) {
if ( i > 0 && prices[i] > prices[i-1]) {
sell = prices[i];
} else if (i > 0 && prices[i] < prices[i-1]){
maxProfit += (sell - buy);
sell = prices[i];
buy = prices[i];
}
i++;
}
return maxProfit;
}
public int maxProfit2Trans(int[] arr) {
int mpist = 0;
int leastsf = arr[0];
int[] dp = new int[arr.length];
for(int i = 1; i < arr.length; i++) {
leastsf = Math.min(leastsf, arr[i]);
mpist = arr[i] - leastsf;
if (mpist > dp[i-1]) {
dp[i] = mpist;
} else {
dp[i] = dp[i-1];
}
}
int mpibt = 0;
int maxat = arr[arr.length - 1];
int[] dpRight = new int[arr.length];
for (int i = arr.length - 2; i >=0; i--) {
if (arr[i] > maxat) {
maxat = arr[i];
}
mpibt = maxat - arr[i];
if (mpibt > dpRight[i+1]) {
dpRight[i] = mpibt;
} else {
dpRight[i] = dpRight[i+1];
}
}
int op = 0;
for(int i = 0; i < arr.length; i++) {
op = Math.max(op, dp[i] + dpRight[i]);
}
return op;
}
public void setMatrixOs(int[][] matrix) {
int m = matrix.length;
if (m == 0)
return;
int n = matrix[0].length;
if (n == 0)
return;
int[] rows = new int[m];
int[] cols = new int[n];
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if (matrix[i][j] == 0) {
rows[i] = 0;
cols[j] = 0;
}
}
}
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if (rows[i] == 0 || cols[j] == 0) {
matrix[i][j] = 0;
}
}
}
}
public static void printPascalTriangle(int n) {
if (n == 0)
return;
int[][] dp = new int[n][n];
for(int i = 0; i < n; i++) {
for(int j = 0; j <= i; j++) {
if (i == 0) {
dp[i][j] = 1;
} else if (i == j) {
dp[i][j] = 1;
} else {
dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
}
}
System.out.println(Arrays.toString(dp[i]));
}
}
public static String nextPermutation(String number) {
char[] array = number.toCharArray();
if (array.length == 0)
return null;
if (array.length == 1) {
return number;
}
int i = array.length-2;
while(i >= 0 && array[i] > array[i+1]) {
i--;
}
if (i < 0) {
Arrays.sort(array);
return array.toString();
}
int min = Integer.MAX_VALUE;
int minIndex = -1;
for(int j = i+1; j < array.length; j++) {
if (array[j] < min && array[j] > array[i]) {
min = array[j];
minIndex = j;
}
}
ArrayHelper.swap(array, minIndex, i);
Arrays.sort(array);
return Arrays.toString(array);
}
}
| UTF-8 | Java | 3,751 | java | Day2.java | Java | []
| null | []
| package sdesheet;
import array.ArrayHelper;
import java.util.Arrays;
public class Day2 {
public int maxProfit(int[] prices) {
if (prices.length == 0)
return 0;
int buy = prices[0];
int maxProfit = 0;
int sell = prices[0];
int i = 0;
while(i < prices.length) {
if ( i > 0 && prices[i] > prices[i-1]) {
sell = prices[i];
} else if (i > 0 && prices[i] < prices[i-1]){
maxProfit += (sell - buy);
sell = prices[i];
buy = prices[i];
}
i++;
}
return maxProfit;
}
public int maxProfit2Trans(int[] arr) {
int mpist = 0;
int leastsf = arr[0];
int[] dp = new int[arr.length];
for(int i = 1; i < arr.length; i++) {
leastsf = Math.min(leastsf, arr[i]);
mpist = arr[i] - leastsf;
if (mpist > dp[i-1]) {
dp[i] = mpist;
} else {
dp[i] = dp[i-1];
}
}
int mpibt = 0;
int maxat = arr[arr.length - 1];
int[] dpRight = new int[arr.length];
for (int i = arr.length - 2; i >=0; i--) {
if (arr[i] > maxat) {
maxat = arr[i];
}
mpibt = maxat - arr[i];
if (mpibt > dpRight[i+1]) {
dpRight[i] = mpibt;
} else {
dpRight[i] = dpRight[i+1];
}
}
int op = 0;
for(int i = 0; i < arr.length; i++) {
op = Math.max(op, dp[i] + dpRight[i]);
}
return op;
}
public void setMatrixOs(int[][] matrix) {
int m = matrix.length;
if (m == 0)
return;
int n = matrix[0].length;
if (n == 0)
return;
int[] rows = new int[m];
int[] cols = new int[n];
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if (matrix[i][j] == 0) {
rows[i] = 0;
cols[j] = 0;
}
}
}
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if (rows[i] == 0 || cols[j] == 0) {
matrix[i][j] = 0;
}
}
}
}
public static void printPascalTriangle(int n) {
if (n == 0)
return;
int[][] dp = new int[n][n];
for(int i = 0; i < n; i++) {
for(int j = 0; j <= i; j++) {
if (i == 0) {
dp[i][j] = 1;
} else if (i == j) {
dp[i][j] = 1;
} else {
dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
}
}
System.out.println(Arrays.toString(dp[i]));
}
}
public static String nextPermutation(String number) {
char[] array = number.toCharArray();
if (array.length == 0)
return null;
if (array.length == 1) {
return number;
}
int i = array.length-2;
while(i >= 0 && array[i] > array[i+1]) {
i--;
}
if (i < 0) {
Arrays.sort(array);
return array.toString();
}
int min = Integer.MAX_VALUE;
int minIndex = -1;
for(int j = i+1; j < array.length; j++) {
if (array[j] < min && array[j] > array[i]) {
min = array[j];
minIndex = j;
}
}
ArrayHelper.swap(array, minIndex, i);
Arrays.sort(array);
return Arrays.toString(array);
}
}
| 3,751 | 0.369768 | 0.355105 | 175 | 20.434286 | 17.244295 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491429 | false | false | 2 |
7ac2f2406bdb8648f17d87d910ddb2578528e480 | 13,993,003,499,701 | bc8ce01b20941d799114d46738329b78b3ab0e4b | /client/src/main/java/class235.java | c43eee67ddb466c9e9a29ab4099a41b301c6290f | []
| permissive | rsbox/rsbox | https://github.com/rsbox/rsbox | dd8d87112066f2a7719221d705e5a77e62cbdfa5 | 7961e53f4e9c132b1f140dca7250d9dcf0b0f7bb | refs/heads/master | 2023-08-17T04:04:23.631000 | 2023-08-09T16:31:04 | 2023-08-09T16:31:04 | 197,709,170 | 3 | 3 | Apache-2.0 | false | 2019-07-19T14:43:43 | 2019-07-19T05:43:31 | 2019-07-19T13:46:06 | 2019-07-19T14:43:42 | 60 | 2 | 1 | 0 | Kotlin | false | false | public class class235 {
static int[] field2616;
class235() {
}
}
| UTF-8 | Java | 75 | java | class235.java | Java | []
| null | []
| public class class235 {
static int[] field2616;
class235() {
}
}
| 75 | 0.6 | 0.466667 | 6 | 11.5 | 10.436315 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false | 2 |
9086252d02e9bedd22e30e9f1b1ce185ee7de941 | 1,219,770,771,062 | 1df9b2dd4a7db2f1673638a46ecb6f20a3933994 | /Spring-proctice/src/Common-java/src/test/java/abc/xyz/pts/bcs/common/web/interceptor/SSOReferalInterceptorTest.java | 7fc8e21fecd0679714ee4cca9d93220a8738071b | []
| no_license | pavanhp001/Spring-boot-proct | https://github.com/pavanhp001/Spring-boot-proct | 71cfb3e86f74aa22951f66a87d55ba4a18b5c6c7 | 238bf76e1b68d46acb3d0e98cb34a53a121643dc | refs/heads/master | 2020-03-20T12:23:10.735000 | 2019-03-18T04:03:40 | 2019-03-18T04:03:40 | 137,428,541 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package abc.xyz.pts.bcs.common.web.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.josso.gateway.SSONameValuePair;
import org.josso.gateway.identity.SSOUser;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.web.servlet.mvc.Controller;
public class SSOReferalInterceptorTest {
private Mockery mockContext;
private HttpServletRequest mockRequest;
private HttpServletResponse mockResponse;
private SSOReferalInterceptor ssoReferalInterceptor;
private Object mockHandler;
private SSOUser mockPrincipal = null;
private SSONameValuePair[] emptySSOProps = new SSONameValuePair[0];
private static String expiredPwdChgDate = "20010101010100Z";
private static String CHG_PWD_URL = "/changePassword.form";
@Before
public void setup(){
mockContext = new Mockery();
mockRequest = mockContext.mock(HttpServletRequest.class);
mockResponse = mockContext.mock(HttpServletResponse.class);
ssoReferalInterceptor = new SSOReferalInterceptor();
mockPrincipal = mockContext.mock(SSOUser.class);
ssoReferalInterceptor.setChangePasswordView(CHG_PWD_URL);
mockHandler = mockContext.mock(Controller.class);
}
@After
public void checkMockContext(){
mockContext.assertIsSatisfied();
}
@Test
public void testPwdResetRedirect() throws Exception {
final SSONameValuePair pwdResetProp = new SSONameValuePair("passwordReset", "TRUE");
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(new SSONameValuePair[] { pwdResetProp }));
one(mockResponse).sendRedirect(CHG_PWD_URL);
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertFalse(result);
}
@Test
public void testPwdWarningRedirect() throws Exception {
final SSONameValuePair pwdChangeTimeProp = new SSONameValuePair("pwdChangedTime", expiredPwdChgDate);
final SSONameValuePair expiryTime = new SSONameValuePair("secondsBeforePasswordExpiryWarning", "0");
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(new SSONameValuePair[] { pwdChangeTimeProp, expiryTime }));
one(mockResponse).sendRedirect(CHG_PWD_URL);
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertFalse(result);
}
@Test
public void testNonRedirect() throws Exception {
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(emptySSOProps));
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertTrue(result);
}
@Test
public void testPreviousRedirect() throws Exception {
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue("homePage=true"));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertTrue(result);
}
}
| UTF-8 | Java | 4,728 | java | SSOReferalInterceptorTest.java | Java | []
| null | []
| package abc.xyz.pts.bcs.common.web.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.josso.gateway.SSONameValuePair;
import org.josso.gateway.identity.SSOUser;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.web.servlet.mvc.Controller;
public class SSOReferalInterceptorTest {
private Mockery mockContext;
private HttpServletRequest mockRequest;
private HttpServletResponse mockResponse;
private SSOReferalInterceptor ssoReferalInterceptor;
private Object mockHandler;
private SSOUser mockPrincipal = null;
private SSONameValuePair[] emptySSOProps = new SSONameValuePair[0];
private static String expiredPwdChgDate = "20010101010100Z";
private static String CHG_PWD_URL = "/changePassword.form";
@Before
public void setup(){
mockContext = new Mockery();
mockRequest = mockContext.mock(HttpServletRequest.class);
mockResponse = mockContext.mock(HttpServletResponse.class);
ssoReferalInterceptor = new SSOReferalInterceptor();
mockPrincipal = mockContext.mock(SSOUser.class);
ssoReferalInterceptor.setChangePasswordView(CHG_PWD_URL);
mockHandler = mockContext.mock(Controller.class);
}
@After
public void checkMockContext(){
mockContext.assertIsSatisfied();
}
@Test
public void testPwdResetRedirect() throws Exception {
final SSONameValuePair pwdResetProp = new SSONameValuePair("passwordReset", "TRUE");
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(new SSONameValuePair[] { pwdResetProp }));
one(mockResponse).sendRedirect(CHG_PWD_URL);
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertFalse(result);
}
@Test
public void testPwdWarningRedirect() throws Exception {
final SSONameValuePair pwdChangeTimeProp = new SSONameValuePair("pwdChangedTime", expiredPwdChgDate);
final SSONameValuePair expiryTime = new SSONameValuePair("secondsBeforePasswordExpiryWarning", "0");
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(new SSONameValuePair[] { pwdChangeTimeProp, expiryTime }));
one(mockResponse).sendRedirect(CHG_PWD_URL);
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertFalse(result);
}
@Test
public void testNonRedirect() throws Exception {
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue(""));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
one(mockRequest).getUserPrincipal(); will(returnValue(mockPrincipal));
one(mockPrincipal).getProperties(); will(returnValue(emptySSOProps));
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertTrue(result);
}
@Test
public void testPreviousRedirect() throws Exception {
mockContext.checking(new Expectations() {{
one(mockRequest).getQueryString(); will(returnValue("homePage=true"));
one(mockRequest).getHeader("Referer"); will(returnValue("http://localhost:8080/josso/signon/login.do?josso_back_to=http://localhost:8080/ui/josso_security_check"));
}});
boolean result = ssoReferalInterceptor.preHandle(mockRequest, mockResponse, mockHandler);
org.junit.Assert.assertTrue(result);
}
}
| 4,728 | 0.693528 | 0.683376 | 97 | 46.742268 | 41.057735 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.876289 | false | false | 2 |
19f8e8ec4cce70856959a04bb17d717d65cd0b21 | 4,406,636,461,494 | e03ee06a6936995fdf2cbd8b9dc876e7c1d42130 | /Ejercicios/Bucles/Ejercicio26.java | 44b2e8248fd4b241d819f6452bc44a79b61bd3a3 | []
| no_license | andresfernandeznad/ejercicios-programacion | https://github.com/andresfernandeznad/ejercicios-programacion | db07fe9cea7397711f3db322c32aafb126fd0ae9 | 721732b374766da98ec59da15abae242ac7d8cb9 | refs/heads/master | 2021-09-06T21:54:29.299000 | 2018-02-12T07:28:37 | 2018-02-12T07:28:37 | 105,648,541 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**Ejercicio26 de Bucles
*
*@author Andrés Fernández Nadales
*
*/
import java.util.Scanner;
public class Ejercicio26 {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
System.out.print("Introduce un número: ");
int numero = s.nextInt();
System.out.print("Introduce un dígito del número introducido anteriormente: ");
int digito = s.nextInt();
int resto;
int i = 0;
int volteado = 0;
while (numero > 0) {
volteado = (numero % 10) + (volteado * 10);
numero /= 10;
}
while (volteado > 0) {
resto = volteado % 10;
volteado = volteado / 10;
++i;
if (resto == digito) {
System.out.print("Su número está en la posición: " + i);
}
}
}
}
| UTF-8 | Java | 769 | java | Ejercicio26.java | Java | [
{
"context": "/**Ejercicio26 de Bucles\n*\n*@author Andrés Fernández Nadales\n* \n*/\n\nimport java.util.Scanner;\n\npublic class Ej",
"end": 60,
"score": 0.9998685121536255,
"start": 36,
"tag": "NAME",
"value": "Andrés Fernández Nadales"
}
]
| null | []
| /**Ejercicio26 de Bucles
*
*@author <NAME>
*
*/
import java.util.Scanner;
public class Ejercicio26 {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
System.out.print("Introduce un número: ");
int numero = s.nextInt();
System.out.print("Introduce un dígito del número introducido anteriormente: ");
int digito = s.nextInt();
int resto;
int i = 0;
int volteado = 0;
while (numero > 0) {
volteado = (numero % 10) + (volteado * 10);
numero /= 10;
}
while (volteado > 0) {
resto = volteado % 10;
volteado = volteado / 10;
++i;
if (resto == digito) {
System.out.print("Su número está en la posición: " + i);
}
}
}
}
| 749 | 0.586071 | 0.562418 | 32 | 22.78125 | 19.314396 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false | 2 |
6beab406ab5615c00e7091dd2e375a6a6a9bc2fc | 1,623,497,656,355 | 4c97138da1c101ba277e695bc0bc1119410b3f17 | /checkedException/classes/Pessoa.java | 00b6654a9cf42985898aace397e0218316283f1a | []
| no_license | MatheusSouza072/exercicios-maratona-java-devdojo | https://github.com/MatheusSouza072/exercicios-maratona-java-devdojo | 39c4377e71c9bfba9aafb014dfcfb5e934704d68 | 1140b7e6704d8db297fb26e8ac49dca95768dba0 | refs/heads/master | 2020-05-26T04:59:24.074000 | 2019-05-29T19:24:38 | 2019-05-29T19:24:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package checkedException.classes;
import java.io.IOException;
import CustomException.LoginInvalidoException;
public class Pessoa {
public void salvar() throws LoginInvalidoException, IOException{
}
}
| UTF-8 | Java | 223 | java | Pessoa.java | Java | []
| null | []
| package checkedException.classes;
import java.io.IOException;
import CustomException.LoginInvalidoException;
public class Pessoa {
public void salvar() throws LoginInvalidoException, IOException{
}
}
| 223 | 0.753363 | 0.753363 | 11 | 18.272728 | 22.058149 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 2 |
53529efc6496d41b0a32ecb881980f2f33e783cd | 9,371,618,648,278 | 4a2f3e34dbe54d4dbc0323257ce1ac9ac8779024 | /src/gesetudiant/conbd/AccessDB.java | 60e36ab80e11a19ac8725c4fe30a94355499463c | []
| no_license | MyJeanno/Mon_site_web | https://github.com/MyJeanno/Mon_site_web | 51f594f396f8e9bee896e3c83f7845f2ce98b483 | 291858c28ff0a3cc1c9b4b1915699237ddf3fdfd | refs/heads/master | 2023-06-05T11:35:36.382000 | 2021-06-10T12:29:45 | 2021-06-10T12:29:45 | 369,311,325 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package gesetudiant.conbd;
/**
*
* @author hppp
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class AccessDB {
public static Connection obtenirConnection(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException ex) {
Logger.getLogger(AccessDB.class.getName()).log(Level.SEVERE, null, ex);
}
try {
String url = "jdbc:mysql://localhost:3306/test";
String user = "root";
String pass = "";
Connection con = DriverManager.getConnection(url,user,pass);
//JOptionPane.showMessageDialog(null, "Connexion bien établie");
return con;
} catch (SQLException ex) {
Logger.getLogger(AccessDB.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
}
| UTF-8 | Java | 986 | java | AccessDB.java | Java | [
{
"context": "\npackage gesetudiant.conbd;\n\n/**\n *\n * @author hppp\n */\nimport java.sql.Connection;\nimport java.sql.D",
"end": 51,
"score": 0.9996707439422607,
"start": 47,
"tag": "USERNAME",
"value": "hppp"
}
]
| null | []
|
package gesetudiant.conbd;
/**
*
* @author hppp
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class AccessDB {
public static Connection obtenirConnection(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException ex) {
Logger.getLogger(AccessDB.class.getName()).log(Level.SEVERE, null, ex);
}
try {
String url = "jdbc:mysql://localhost:3306/test";
String user = "root";
String pass = "";
Connection con = DriverManager.getConnection(url,user,pass);
//JOptionPane.showMessageDialog(null, "Connexion bien établie");
return con;
} catch (SQLException ex) {
Logger.getLogger(AccessDB.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
}
| 986 | 0.601015 | 0.596954 | 34 | 27.941177 | 24.015854 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676471 | false | false | 2 |
a6e5f4cd32b9c3d86f5768ddee871c42dbe31b00 | 4,337,916,971,897 | a51d07f2c3fa8aae079f53563ff731236bab7189 | /zoe-phip/1.infrastructure/phip-infrastructure/src/main/java/com/zoe/phip/infrastructure/util/ValidateUtil.java | 1adacea9da8050c9f4964cf2f08457c143d527bc | []
| no_license | zh415085484/meros.phip | https://github.com/zh415085484/meros.phip | dfaec8e496a7a23415815d45893692e0f3e2f664 | bc5139c6a4fc2227f4550a4d8a16a85712b2d06b | HEAD | 2016-04-11T19:38:38.443000 | 2016-03-15T06:35:16 | 2016-03-15T06:35:16 | 53,924,642 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zoe.phip.infrastructure.util;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
/**
* Created by zengjiyang on 2016/3/11.
*/
public class ValidateUtil {
public static boolean isEmpty(Object object) {
if (object == null)
return true;
if (object instanceof String)
return ((String) object).trim().length() == 0;
if (object.getClass().isArray())
return Array.getLength(object) == 0;
if (object instanceof Collection)
return ((Collection<?>) object).isEmpty();
if (object instanceof Map)
return ((Map<?, ?>) object).isEmpty();
return false;
}
public static boolean isNotEmpty(Object object) {
return !isEmpty(object);
}
}
| UTF-8 | Java | 806 | java | ValidateUtil.java | Java | [
{
"context": "llection;\nimport java.util.Map;\n\n/**\n * Created by zengjiyang on 2016/3/11.\n */\npublic class ValidateUtil {\n\n ",
"end": 155,
"score": 0.9989948272705078,
"start": 145,
"tag": "USERNAME",
"value": "zengjiyang"
}
]
| null | []
| package com.zoe.phip.infrastructure.util;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
/**
* Created by zengjiyang on 2016/3/11.
*/
public class ValidateUtil {
public static boolean isEmpty(Object object) {
if (object == null)
return true;
if (object instanceof String)
return ((String) object).trim().length() == 0;
if (object.getClass().isArray())
return Array.getLength(object) == 0;
if (object instanceof Collection)
return ((Collection<?>) object).isEmpty();
if (object instanceof Map)
return ((Map<?, ?>) object).isEmpty();
return false;
}
public static boolean isNotEmpty(Object object) {
return !isEmpty(object);
}
}
| 806 | 0.604218 | 0.593052 | 34 | 22.705883 | 19.962507 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 2 |
e0a4369caa699f0f0718128b7a3cc4104ade1a4d | 28,432,683,537,834 | 2ac30e5b1177fb4c0f836ece2b474b11637e4c49 | /blogAPI/src/main/java/com/my/service/UserService.java | c79616ae9ecb21db5841f4be6df097b231192d6e | []
| no_license | LastingN/blogAPI | https://github.com/LastingN/blogAPI | b0d3b3a8e0086ec20674304b1d39ff2194f914ea | eb1ee4df18f5d31a661d808306d8e6341c4cff5e | refs/heads/master | 2020-05-25T13:11:48.515000 | 2019-05-21T10:34:31 | 2019-05-21T10:34:31 | 187,816,122 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.my.service;
import com.my.mapper.UserMapper;
import com.my.pojo.User;
import com.my.utils.JwtUtil;
import com.my.utils.MD5Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
@Service
public class UserService {
Logger log = LoggerFactory.getLogger(UserService.class);
@Autowired
UserMapper userMapper;
/**
* 登录账号密码
*
* */
public Map<String,Object> selectUser(String user_name, String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
String md5_pwd = MD5Util.MD5Encode(user_pwd, "utf-8").toUpperCase();
User user = userMapper.selectUser(user_name, md5_pwd);
String jwt = JwtUtil.createJWT(user);
if ( user != null){
map.put("row",user);
map.put("jwt",jwt);
map.put("result_code","0");
map.put("result_msg","OK");
}else {
map.put("result_code","1001");
map.put("result_msg","User does not exist");
}
return map;
}
/**
* 根据user_id 查询用户
*
* */
public User findUserById(String user_id){
User user = userMapper.findUserById(user_id);
return user;
}
/**
* 注册账号
*
* */
public Map<String,Object> putUser(String user_name,String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
if (userMapper.selectUser(user_name,null) == null){
String user_id = UUID.randomUUID().toString();
String MD5_pwd = MD5Util.MD5Encode(user_pwd,"utf-8").toUpperCase();
log.info("====================================================");
log.info(user_id.toString());
log.info(MD5_pwd);
log.info("====================================================");
User user = new User(user_id,user_name,MD5_pwd,null,null,null,null);
userMapper.putUser(user);
String jwt = JwtUtil.createJWT(user);
map.put("jwt",jwt);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}else {
map.put("result_code","1002");
map.put("result_msg","User already exists");
return map;
}
}
/**
* 更新账号信息
*
* */
public Map<String,Object> updateUser(User user){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
userMapper.updateUser(user);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}
public Map<String,Object> updateUserPwd(String user_id, String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
String md5_pwd = MD5Util.MD5Encode(user_pwd, "utf-8");
userMapper.updateUserPwd(user_id,md5_pwd);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}
}
| UTF-8 | Java | 3,169 | java | UserService.java | Java | []
| null | []
| package com.my.service;
import com.my.mapper.UserMapper;
import com.my.pojo.User;
import com.my.utils.JwtUtil;
import com.my.utils.MD5Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
@Service
public class UserService {
Logger log = LoggerFactory.getLogger(UserService.class);
@Autowired
UserMapper userMapper;
/**
* 登录账号密码
*
* */
public Map<String,Object> selectUser(String user_name, String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
String md5_pwd = MD5Util.MD5Encode(user_pwd, "utf-8").toUpperCase();
User user = userMapper.selectUser(user_name, md5_pwd);
String jwt = JwtUtil.createJWT(user);
if ( user != null){
map.put("row",user);
map.put("jwt",jwt);
map.put("result_code","0");
map.put("result_msg","OK");
}else {
map.put("result_code","1001");
map.put("result_msg","User does not exist");
}
return map;
}
/**
* 根据user_id 查询用户
*
* */
public User findUserById(String user_id){
User user = userMapper.findUserById(user_id);
return user;
}
/**
* 注册账号
*
* */
public Map<String,Object> putUser(String user_name,String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
if (userMapper.selectUser(user_name,null) == null){
String user_id = UUID.randomUUID().toString();
String MD5_pwd = MD5Util.MD5Encode(user_pwd,"utf-8").toUpperCase();
log.info("====================================================");
log.info(user_id.toString());
log.info(MD5_pwd);
log.info("====================================================");
User user = new User(user_id,user_name,MD5_pwd,null,null,null,null);
userMapper.putUser(user);
String jwt = JwtUtil.createJWT(user);
map.put("jwt",jwt);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}else {
map.put("result_code","1002");
map.put("result_msg","User already exists");
return map;
}
}
/**
* 更新账号信息
*
* */
public Map<String,Object> updateUser(User user){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
userMapper.updateUser(user);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}
public Map<String,Object> updateUserPwd(String user_id, String user_pwd){
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
String md5_pwd = MD5Util.MD5Encode(user_pwd, "utf-8");
userMapper.updateUserPwd(user_id,md5_pwd);
map.put("result_code","0");
map.put("result_msg","OK");
return map;
}
}
| 3,169 | 0.5584 | 0.54848 | 106 | 28.481133 | 23.878716 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.877358 | false | false | 2 |
75a8253093117a795e5ffec297063128faa1361f | 35,150,012,406,518 | 0695dfd060a2d118ec701373ab9da89fe7532cee | /src/test/java/org/giiwa/misc/ClassUtilTest.java | ca05ecce01248ffca892630d7e2d4cbddd076110 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | summyjohn/giiwa | https://github.com/summyjohn/giiwa | d697d0cb3e8e86f78a191d52d5ca3f50a7552ebd | 0d53015901514c9fb7234d55192ae37bebc4afc2 | refs/heads/master | 2023-07-02T17:54:37.245000 | 2020-12-12T00:12:45 | 2020-12-12T00:12:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.giiwa.misc;
import static org.junit.Assert.*;
import org.giiwa.dao.Bean;
import org.junit.Test;
public class ClassUtilTest {
@Test
public void test() {
System.out.println(ClassUtil.listSubType("", Bean.class));
}
}
| UTF-8 | Java | 237 | java | ClassUtilTest.java | Java | []
| null | []
| package org.giiwa.misc;
import static org.junit.Assert.*;
import org.giiwa.dao.Bean;
import org.junit.Test;
public class ClassUtilTest {
@Test
public void test() {
System.out.println(ClassUtil.listSubType("", Bean.class));
}
}
| 237 | 0.721519 | 0.721519 | 15 | 14.8 | 17.04582 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false | 2 |
222aa79d32144fa8ed06970393d6b298bccd1e1a | 37,941,741,122,152 | 8716508689083c76a89ee68f12eabf573c146450 | /src/main/java/com/rsd/enterprise/ProductEnterpriseController.java | d1b7c122bda5878111c860356f5d228caca3ca64 | []
| no_license | jiaoyunliang/nrsd | https://github.com/jiaoyunliang/nrsd | 4a6fcc1c665cc4ce6029541d0bb1ce316ce2f629 | 90c7850624b05cc4df12634556c25880a64deaa5 | refs/heads/master | 2022-07-12T22:49:12.499000 | 2019-10-11T09:42:40 | 2019-10-11T09:42:44 | 213,855,784 | 0 | 0 | null | false | 2022-06-30T20:20:15 | 2019-10-09T07:55:00 | 2019-10-11T09:43:11 | 2022-06-30T20:20:15 | 16,652 | 0 | 0 | 7 | JavaScript | false | false | package com.rsd.enterprise;
import com.github.pagehelper.Page;
import com.rsd.domain.RsdAccount;
import com.rsd.domain.BnzFileRelation;
import com.rsd.domain.BnzProductModel;
import com.rsd.domain.BnzProductTypeModel;
import com.rsd.service.BnzProductService;
import com.rsd.service.BnzProductTypeService;
import com.rsd.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* @author tony
* @data 2019-06-24
* @modifyUser
* @modifyDate
*/
@Controller
@RequestMapping("/enterprise/product")
@PropertySource(value = {"classpath:upload.properties"}, encoding = "utf-8")
public class ProductEnterpriseController {
private static final Logger logger = LoggerFactory.getLogger(ProductEnterpriseController.class);
@Autowired
private MessageManager messageManager;
@Autowired
private BnzProductService bnzProductService;
@Autowired
private BnzProductTypeService bnzProductTypeService;
@Value("${ueditorFileUrlPerfix}")
private String fileUrlPrefix;
@GetMapping(value = "list")
public String list(){
return "/enterprise/product/list";
}
@ResponseBody
@PostMapping(value = "queryProductList")
public HashMap queryProductList(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setOrgId(account.getOrgId());
Page page = bnzProductService.queryProductPage(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("page")
.addData(page.getResult())
.addData("pageInfo", new PageInfoWrap(page).get())
.addData("fileServer", fileUrlPrefix).build();
} catch (Exception e) {
logger.error("queryProductList", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@GetMapping(value = "view")
public String view(
@RequestParam(value = "id") Long id,
Map<String, Object> model) {
try {
BnzProductModel param = new BnzProductModel();
param.setId(id);
//产品
BnzProductModel productModel = bnzProductService.selectProduct(param);
model.put("product", productModel);
model.put("fileServer", fileUrlPrefix);
} catch (Exception e) {
logger.error("view", e);
}
return "/enterprise/product/detail";
}
@GetMapping(value = "add")
public String add() {
return "/enterprise/product/add";
}
@GetMapping(value = "edit")
public String edit(
@RequestParam(value = "id") Long id,
Map<String, Object> model) {
try {
model.put("productId", id);
model.put("fileServer", fileUrlPrefix);
} catch (Exception e) {
logger.error("edit", e);
}
return "/enterprise/product/edit";
}
@ResponseBody
@PostMapping(value = "queryProductById")
public HashMap queryProductById(@RequestBody BnzProductModel param){
try {
//产品
BnzProductModel productModel = bnzProductService.selectProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("data")
.addData(productModel).build();
} catch (Exception e) {
logger.error("queryProductById", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "queryProductTypeList")
public HashMap queryProductTypeList(){
try {
List<BnzProductTypeModel> list = bnzProductTypeService.queryProductType();
List<Map<String,Object>> typeList = new ArrayList<>();
for(BnzProductTypeModel type : list){
Map<String,Object> map = new HashMap<>();
map.put("id",type.getId());
map.put("name",type.getName());
typeList.add(map);
}
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("data")
.addData(typeList).build();
} catch (Exception e) {
logger.error("queryProductTypeList", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "saveProduct")
public HashMap saveProduct(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setOrgId(account.getOrgId());
param.setCreateUser(account.getUserName());
if (param.getVideo()!=null){
param.getVideo().setIsDel(0L);
param.getVideo().setType(2L);
param.getVideo().setCreateUser(account.getUserName());
}
if (!param.getPicList().isEmpty()){
for (BnzFileRelation pic : param.getPicList()){
pic.setType(1L);
pic.setIsDel(0L);
pic.setCreateUser(account.getUserName());
}
}
bnzProductService.saveProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005")).build();
} catch (Exception e) {
logger.error("saveProduct", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "updateProduct")
public HashMap updateProduct(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setUpdateTime(new Date());
param.setUpdateUser(account.getUserName());
if (param.getVideo()!=null){
param.getVideo().setIsDel(0L);
param.getVideo().setType(2L);
param.getVideo().setCreateUser(account.getUserName());
}
if (!param.getPicList().isEmpty()){
for (BnzFileRelation pic : param.getPicList()){
pic.setType(1L);
pic.setIsDel(0L);
pic.setCreateUser(account.getUserName());
}
}
bnzProductService.updateProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005")).build();
} catch (Exception e) {
logger.error("updateProduct", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
}
| UTF-8 | Java | 7,666 | java | ProductEnterpriseController.java | Java | [
{
"context": "annotation.*;\n\nimport java.util.*;\n\n/**\n * @author tony\n * @data 2019-06-24\n * @modifyUser\n * @modifyDate",
"end": 713,
"score": 0.9995231628417969,
"start": 709,
"tag": "USERNAME",
"value": "tony"
}
]
| null | []
| package com.rsd.enterprise;
import com.github.pagehelper.Page;
import com.rsd.domain.RsdAccount;
import com.rsd.domain.BnzFileRelation;
import com.rsd.domain.BnzProductModel;
import com.rsd.domain.BnzProductTypeModel;
import com.rsd.service.BnzProductService;
import com.rsd.service.BnzProductTypeService;
import com.rsd.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* @author tony
* @data 2019-06-24
* @modifyUser
* @modifyDate
*/
@Controller
@RequestMapping("/enterprise/product")
@PropertySource(value = {"classpath:upload.properties"}, encoding = "utf-8")
public class ProductEnterpriseController {
private static final Logger logger = LoggerFactory.getLogger(ProductEnterpriseController.class);
@Autowired
private MessageManager messageManager;
@Autowired
private BnzProductService bnzProductService;
@Autowired
private BnzProductTypeService bnzProductTypeService;
@Value("${ueditorFileUrlPerfix}")
private String fileUrlPrefix;
@GetMapping(value = "list")
public String list(){
return "/enterprise/product/list";
}
@ResponseBody
@PostMapping(value = "queryProductList")
public HashMap queryProductList(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setOrgId(account.getOrgId());
Page page = bnzProductService.queryProductPage(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("page")
.addData(page.getResult())
.addData("pageInfo", new PageInfoWrap(page).get())
.addData("fileServer", fileUrlPrefix).build();
} catch (Exception e) {
logger.error("queryProductList", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@GetMapping(value = "view")
public String view(
@RequestParam(value = "id") Long id,
Map<String, Object> model) {
try {
BnzProductModel param = new BnzProductModel();
param.setId(id);
//产品
BnzProductModel productModel = bnzProductService.selectProduct(param);
model.put("product", productModel);
model.put("fileServer", fileUrlPrefix);
} catch (Exception e) {
logger.error("view", e);
}
return "/enterprise/product/detail";
}
@GetMapping(value = "add")
public String add() {
return "/enterprise/product/add";
}
@GetMapping(value = "edit")
public String edit(
@RequestParam(value = "id") Long id,
Map<String, Object> model) {
try {
model.put("productId", id);
model.put("fileServer", fileUrlPrefix);
} catch (Exception e) {
logger.error("edit", e);
}
return "/enterprise/product/edit";
}
@ResponseBody
@PostMapping(value = "queryProductById")
public HashMap queryProductById(@RequestBody BnzProductModel param){
try {
//产品
BnzProductModel productModel = bnzProductService.selectProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("data")
.addData(productModel).build();
} catch (Exception e) {
logger.error("queryProductById", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "queryProductTypeList")
public HashMap queryProductTypeList(){
try {
List<BnzProductTypeModel> list = bnzProductTypeService.queryProductType();
List<Map<String,Object>> typeList = new ArrayList<>();
for(BnzProductTypeModel type : list){
Map<String,Object> map = new HashMap<>();
map.put("id",type.getId());
map.put("name",type.getName());
typeList.add(map);
}
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005"))
.addDataName("data")
.addData(typeList).build();
} catch (Exception e) {
logger.error("queryProductTypeList", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "saveProduct")
public HashMap saveProduct(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setOrgId(account.getOrgId());
param.setCreateUser(account.getUserName());
if (param.getVideo()!=null){
param.getVideo().setIsDel(0L);
param.getVideo().setType(2L);
param.getVideo().setCreateUser(account.getUserName());
}
if (!param.getPicList().isEmpty()){
for (BnzFileRelation pic : param.getPicList()){
pic.setType(1L);
pic.setIsDel(0L);
pic.setCreateUser(account.getUserName());
}
}
bnzProductService.saveProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005")).build();
} catch (Exception e) {
logger.error("saveProduct", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
@ResponseBody
@PostMapping(value = "updateProduct")
public HashMap updateProduct(@RequestBody BnzProductModel param){
logger.info(param.toString());
try {
RsdAccount account = HttpSessionManager.get(Const.SESSION_ACCOUNT, RsdAccount.class);
param.setUpdateTime(new Date());
param.setUpdateUser(account.getUserName());
if (param.getVideo()!=null){
param.getVideo().setIsDel(0L);
param.getVideo().setType(2L);
param.getVideo().setCreateUser(account.getUserName());
}
if (!param.getPicList().isEmpty()){
for (BnzFileRelation pic : param.getPicList()){
pic.setType(1L);
pic.setIsDel(0L);
pic.setCreateUser(account.getUserName());
}
}
bnzProductService.updateProduct(param);
return new JsonOut().addMessage(messageManager.getMessage("ERROR.0005")).build();
} catch (Exception e) {
logger.error("updateProduct", e);
return new JsonOut().addResult(Const.ApiResult.EXCEPTION)
.addException(messageManager.getMessage("ERROR.0006")).build();
}
}
}
| 7,666 | 0.605902 | 0.598198 | 221 | 33.651585 | 26.467104 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.488688 | false | false | 2 |
452ab6a0e2c7cb5e8b31c9b6174fa25354da2334 | 7,782,480,741,580 | 256248d98f7e3fac9a01195a1ff8e6e6a2682e60 | /src/main/java/com/slasher/slasherproductions/restapi/CEOMusicalGroupRestController.java | ae57003de164afef4b300079d8963d10d1201b96 | []
| no_license | Alexystech/slasher-productions | https://github.com/Alexystech/slasher-productions | e1ceb5d5aac9a33d6fc1ac7205baa2180974576f | 64e6c7e6db11094709d748090cba22958b5cdbf2 | refs/heads/master | 2023-07-07T11:16:33.193000 | 2021-08-12T01:07:57 | 2021-08-12T01:07:57 | 395,156,648 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.slasher.slasherproductions.restapi;
import com.slasher.slasherproductions.entiy.CEOMusicalGroup;
import com.slasher.slasherproductions.service.CEOMusicalGroupService;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(path = "/ceo-musical-group")
public class CEOMusicalGroupRestController {
private final CEOMusicalGroupService ceoService;
@Autowired
public CEOMusicalGroupRestController(CEOMusicalGroupService ceoService) {
this.ceoService = ceoService;
}
@ApiResponses({
@ApiResponse(code = 422, message = "unprocessable entity"),
@ApiResponse(code = 201, message = "created")
})
@PostMapping("/create")
public ResponseEntity<CEOMusicalGroup> createCEO(@RequestBody CEOMusicalGroup ceo) {
return new ResponseEntity<>(ceoService.createCEO(ceo), HttpStatus.CREATED);
}
@ApiResponse(code = 202, message = "successful")
@DeleteMapping(path = "/delete/{idCEO}")
public ResponseEntity<Boolean> deleteCEOById(@PathVariable("idCEO") long idCEO) {
ceoService.deleteCEOById(idCEO);
return new ResponseEntity<>(true, HttpStatus.ACCEPTED);
}
@ApiResponses({
@ApiResponse(code = 422, message = "unprocessable entity"),
@ApiResponse(code = 202, message = "updated")
})
@PutMapping(path = "/update")
public ResponseEntity<CEOMusicalGroup> updateCEO(@RequestBody CEOMusicalGroup ceo) {
return new ResponseEntity<>(ceoService.updateCEO(ceo), HttpStatus.ACCEPTED);
}
@ApiResponse(code = 200, message = "successful")
@GetMapping(path = "/get/{idCEO}")
public ResponseEntity<CEOMusicalGroup> getCEOById(@PathVariable("idCEO") long idCEO) {
return new ResponseEntity<>(ceoService.getCEOById(idCEO), HttpStatus.OK);
}
@ApiResponse(code = 200, message = "successful")
@GetMapping(path = "/get/all")
public ResponseEntity<List<CEOMusicalGroup>> getAllCEOs() {
return new ResponseEntity<>(ceoService.getAllCEOS(), HttpStatus.OK);
}
}
| UTF-8 | Java | 2,776 | java | CEOMusicalGroupRestController.java | Java | []
| null | []
| package com.slasher.slasherproductions.restapi;
import com.slasher.slasherproductions.entiy.CEOMusicalGroup;
import com.slasher.slasherproductions.service.CEOMusicalGroupService;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(path = "/ceo-musical-group")
public class CEOMusicalGroupRestController {
private final CEOMusicalGroupService ceoService;
@Autowired
public CEOMusicalGroupRestController(CEOMusicalGroupService ceoService) {
this.ceoService = ceoService;
}
@ApiResponses({
@ApiResponse(code = 422, message = "unprocessable entity"),
@ApiResponse(code = 201, message = "created")
})
@PostMapping("/create")
public ResponseEntity<CEOMusicalGroup> createCEO(@RequestBody CEOMusicalGroup ceo) {
return new ResponseEntity<>(ceoService.createCEO(ceo), HttpStatus.CREATED);
}
@ApiResponse(code = 202, message = "successful")
@DeleteMapping(path = "/delete/{idCEO}")
public ResponseEntity<Boolean> deleteCEOById(@PathVariable("idCEO") long idCEO) {
ceoService.deleteCEOById(idCEO);
return new ResponseEntity<>(true, HttpStatus.ACCEPTED);
}
@ApiResponses({
@ApiResponse(code = 422, message = "unprocessable entity"),
@ApiResponse(code = 202, message = "updated")
})
@PutMapping(path = "/update")
public ResponseEntity<CEOMusicalGroup> updateCEO(@RequestBody CEOMusicalGroup ceo) {
return new ResponseEntity<>(ceoService.updateCEO(ceo), HttpStatus.ACCEPTED);
}
@ApiResponse(code = 200, message = "successful")
@GetMapping(path = "/get/{idCEO}")
public ResponseEntity<CEOMusicalGroup> getCEOById(@PathVariable("idCEO") long idCEO) {
return new ResponseEntity<>(ceoService.getCEOById(idCEO), HttpStatus.OK);
}
@ApiResponse(code = 200, message = "successful")
@GetMapping(path = "/get/all")
public ResponseEntity<List<CEOMusicalGroup>> getAllCEOs() {
return new ResponseEntity<>(ceoService.getAllCEOS(), HttpStatus.OK);
}
}
| 2,776 | 0.747118 | 0.739553 | 69 | 39.231884 | 28.989326 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 2 |
038eb64f7436648b7178af7c3b0a94b682941979 | 35,467,839,978,108 | 5000d56b5b6cf2b0edc4e1ff89c94821a86de383 | /Level_Trainee/Part_003_Collections_Lite/5_Control_Tasks/src/main/java/ru/job4j/bank/Bank.java | 8f09ea5b7bc3db30cde95a203e70ab50fe391630 | [
"Apache-2.0"
]
| permissive | OleksandrProshak/Alexandr_Proshak | https://github.com/OleksandrProshak/Alexandr_Proshak | 8da5399cf39c900848219d30084a3cdd28cd6c1f | b9800a5e82e8c7086e676c31fe83e5e1fb424d64 | refs/heads/master | 2021-01-18T23:13:17.058000 | 2018-09-12T06:31:51 | 2018-09-12T06:31:51 | 87,094,890 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.job4j.bank;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Class Bank.
*
* @author Alex Proshak (olexandr_proshak@ukr.net)
*/
public class Bank {
/**
* A Map of bank's clients.
*/
private Map<User, List<Account>> clients;
/**
* A constructor.
*/
public Bank() {
this.clients = new HashMap<>();
}
/**
* A getter for clients.
* @return a map of bank's clients.
*/
public Map<User, List<Account>> getClients() {
return clients;
}
/**
* A method is adding an user to the bank's client's map.
* @param user to add.
*/
public void addUser(User user) {
if (user != null) {
Account emptyAccount = new Account("empty", 0.0, "0000 0000 0000 0000");
user.addUserAccounts(emptyAccount);
this.clients.put(user, user.getUserAccountList());
} else {
throw new UnsupportedOperationException("An invalid user to add");
}
}
/**
* A method is deleting a given user.
* @param user to delete from the bank.
*/
public void deleteUser(User user) {
if (valid(user)) {
this.clients.remove(user);
}
}
/**
* A method is adding new account to current user.
* @param user for adding an account.
* @param account to add.
*/
public void addAccountToUser(User user, Account account) {
if (valid(user, account)) {
user.addUserAccounts(account);
}
}
/**
* A method is deleting an account from current user.
* @param user to refresh.
* @param account to delete.
*/
public void deleteAccountFromUser(User user, Account account) {
if (valid(user, account)) {
boolean result = user.removeAccountFromList(account);
if (!result) {
throw new UnsupportedOperationException("An invalid account");
}
} else {
throw new UnsupportedOperationException(String.format(
"Account %s does not belong to this user %s", account.getRequisites(), user.getName()));
}
}
/**
* A method transfers money from source account to the destination account.
* @param srcUser source user.
* @param srcAccount source account.
* @param dstUser destination user.
* @param dstAccount destination account.
* @param amount of money to transfer.
* @return true if everything went fine.
*/
public boolean transferMoney(User srcUser, Account srcAccount, User dstUser, Account dstAccount, double amount) {
boolean result = false;
if (valid(srcUser, srcAccount)
&& valid(dstUser, dstAccount)
&& srcAccount.getCurrency().equalsIgnoreCase(dstAccount.getCurrency())) {
List<Account> srcListOfAccount = this.clients.get(srcUser);
boolean srcInclude = srcListOfAccount.contains(srcAccount);
List<Account> dstListOfAccount = this.clients.get(dstUser);
boolean dstInclude = dstListOfAccount.contains(dstAccount);
if (srcInclude && dstInclude) {
if (srcAccount.getValue() > amount) {
double srcCheck = srcAccount.getValue();
double dstCheck = dstAccount.getValue();
dstAccount.increaseValue(amount);
srcAccount.increaseValue(-amount);
if (dstAccount.getValue() == dstCheck + amount && srcAccount.getValue() == srcCheck - amount) {
result = true;
}
}
}
}
return result;
}
/**
* An overloaded method valid for user.
* @param user to validation.
* @return true if user is not null and is present in the bank.
*/
private boolean valid(User user) {
if (user == null) {
throw new UnsupportedOperationException("An invalid user");
}
if (!this.clients.containsKey(user)) {
throw new UnsupportedOperationException(String.format(
"%s is not a customer of our bank", user.getName()));
}
return true;
}
/**
* A method checking user.
* @param user to check.
* @param account to check.
* @return true when user and account are valid.
*/
private boolean valid(User user, Account account) {
if (user == null) {
throw new UnsupportedOperationException("An invalid user");
}
if (account == null) {
throw new UnsupportedOperationException("An invalid account");
}
if (!this.clients.containsKey(user)) {
throw new UnsupportedOperationException(String.format(
"%s is not a customer of our bank", user.getName()));
}
return true;
}
}
| UTF-8 | Java | 4,951 | java | Bank.java | Java | [
{
"context": "t java.util.Map;\n\n/**\n * Class Bank.\n *\n * @author Alex Proshak (olexandr_proshak@ukr.net)\n */\npublic class Bank ",
"end": 141,
"score": 0.9998528957366943,
"start": 129,
"tag": "NAME",
"value": "Alex Proshak"
},
{
"context": ";\n\n/**\n * Class Bank.\n *\n * @author Alex Proshak (olexandr_proshak@ukr.net)\n */\npublic class Bank {\n\n /**\n * A Map of",
"end": 167,
"score": 0.9999335408210754,
"start": 143,
"tag": "EMAIL",
"value": "olexandr_proshak@ukr.net"
}
]
| null | []
| package ru.job4j.bank;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Class Bank.
*
* @author <NAME> (<EMAIL>)
*/
public class Bank {
/**
* A Map of bank's clients.
*/
private Map<User, List<Account>> clients;
/**
* A constructor.
*/
public Bank() {
this.clients = new HashMap<>();
}
/**
* A getter for clients.
* @return a map of bank's clients.
*/
public Map<User, List<Account>> getClients() {
return clients;
}
/**
* A method is adding an user to the bank's client's map.
* @param user to add.
*/
public void addUser(User user) {
if (user != null) {
Account emptyAccount = new Account("empty", 0.0, "0000 0000 0000 0000");
user.addUserAccounts(emptyAccount);
this.clients.put(user, user.getUserAccountList());
} else {
throw new UnsupportedOperationException("An invalid user to add");
}
}
/**
* A method is deleting a given user.
* @param user to delete from the bank.
*/
public void deleteUser(User user) {
if (valid(user)) {
this.clients.remove(user);
}
}
/**
* A method is adding new account to current user.
* @param user for adding an account.
* @param account to add.
*/
public void addAccountToUser(User user, Account account) {
if (valid(user, account)) {
user.addUserAccounts(account);
}
}
/**
* A method is deleting an account from current user.
* @param user to refresh.
* @param account to delete.
*/
public void deleteAccountFromUser(User user, Account account) {
if (valid(user, account)) {
boolean result = user.removeAccountFromList(account);
if (!result) {
throw new UnsupportedOperationException("An invalid account");
}
} else {
throw new UnsupportedOperationException(String.format(
"Account %s does not belong to this user %s", account.getRequisites(), user.getName()));
}
}
/**
* A method transfers money from source account to the destination account.
* @param srcUser source user.
* @param srcAccount source account.
* @param dstUser destination user.
* @param dstAccount destination account.
* @param amount of money to transfer.
* @return true if everything went fine.
*/
public boolean transferMoney(User srcUser, Account srcAccount, User dstUser, Account dstAccount, double amount) {
boolean result = false;
if (valid(srcUser, srcAccount)
&& valid(dstUser, dstAccount)
&& srcAccount.getCurrency().equalsIgnoreCase(dstAccount.getCurrency())) {
List<Account> srcListOfAccount = this.clients.get(srcUser);
boolean srcInclude = srcListOfAccount.contains(srcAccount);
List<Account> dstListOfAccount = this.clients.get(dstUser);
boolean dstInclude = dstListOfAccount.contains(dstAccount);
if (srcInclude && dstInclude) {
if (srcAccount.getValue() > amount) {
double srcCheck = srcAccount.getValue();
double dstCheck = dstAccount.getValue();
dstAccount.increaseValue(amount);
srcAccount.increaseValue(-amount);
if (dstAccount.getValue() == dstCheck + amount && srcAccount.getValue() == srcCheck - amount) {
result = true;
}
}
}
}
return result;
}
/**
* An overloaded method valid for user.
* @param user to validation.
* @return true if user is not null and is present in the bank.
*/
private boolean valid(User user) {
if (user == null) {
throw new UnsupportedOperationException("An invalid user");
}
if (!this.clients.containsKey(user)) {
throw new UnsupportedOperationException(String.format(
"%s is not a customer of our bank", user.getName()));
}
return true;
}
/**
* A method checking user.
* @param user to check.
* @param account to check.
* @return true when user and account are valid.
*/
private boolean valid(User user, Account account) {
if (user == null) {
throw new UnsupportedOperationException("An invalid user");
}
if (account == null) {
throw new UnsupportedOperationException("An invalid account");
}
if (!this.clients.containsKey(user)) {
throw new UnsupportedOperationException(String.format(
"%s is not a customer of our bank", user.getName()));
}
return true;
}
}
| 4,928 | 0.572814 | 0.568976 | 156 | 30.737179 | 26.513449 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346154 | false | false | 2 |
2e016ac0256877f80316296659dbffb82b8ab9d8 | 12,824,772,346,725 | 102fbd4afcf166e6b44b8576e297c4e25aeffc0a | /OkacaTalkClient/src/kr/or/ddit/vo/FavoriteVO.java | fb7387bd3a1336a1fbbe2ea2a7d69ce45f16c407 | []
| no_license | kimchan2/middleProject | https://github.com/kimchan2/middleProject | 0a1fdffe9a1e63572e08f55dad6241f9b4e0fbfb | 0d7846a1448eb0d42a8cf0592b193cacc75c27fb | refs/heads/master | 2022-12-11T18:18:10.370000 | 2020-08-25T08:32:46 | 2020-08-25T08:32:46 | 290,159,435 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kr.or.ddit.vo;
import java.io.Serializable;
/**
* 관심상품
* @author PC-22
*
*/
public class FavoriteVO implements Serializable{
public int getPl_index() {
return pl_index;
}
public void setPl_index(int pl_index) {
this.pl_index = pl_index;
}
public String getMem_mail() {
return mem_mail;
}
public void setMem_mail(String mem_mail) {
this.mem_mail = mem_mail;
}
private int pl_index; //상품 인덱스
private String mem_mail; //이메일
}
| UTF-8 | Java | 489 | java | FavoriteVO.java | Java | [
{
"context": "port java.io.Serializable;\n\n/**\n * 관심상품\n * @author PC-22\n *\n */\npublic class FavoriteVO implements Serial",
"end": 82,
"score": 0.9996592998504639,
"start": 77,
"tag": "USERNAME",
"value": "PC-22"
}
]
| null | []
| package kr.or.ddit.vo;
import java.io.Serializable;
/**
* 관심상품
* @author PC-22
*
*/
public class FavoriteVO implements Serializable{
public int getPl_index() {
return pl_index;
}
public void setPl_index(int pl_index) {
this.pl_index = pl_index;
}
public String getMem_mail() {
return mem_mail;
}
public void setMem_mail(String mem_mail) {
this.mem_mail = mem_mail;
}
private int pl_index; //상품 인덱스
private String mem_mail; //이메일
}
| 489 | 0.664516 | 0.660215 | 27 | 16.222221 | 15.423246 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.037037 | false | false | 2 |
e6a5bb5bddf38a4239c2fe10108a19b8ed55438c | 22,668,837,450,548 | 8bfbc3f79235d7719f0127fc61b7ca8e4eab7071 | /kaibiyuanze/test.java | b19176de4f340d83042ef258d50f7779cbaea717 | []
| no_license | LIAN0856/Design-pattern | https://github.com/LIAN0856/Design-pattern | edb67a5451abfd686e3b3b5a5a7db24a9d83f211 | ea2d3b932abf945f08d767819ef4fff1d485486e | refs/heads/master | 2021-01-04T09:21:40.394000 | 2020-04-29T07:04:53 | 2020-04-29T07:04:53 | 240,485,986 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kaibiyuanze;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
LoginForm loginform1=new LoginForm();
Scanner input=new Scanner(System.in);
System.out.println("请输入你想用的按钮图形:");
loginform1.setButton(input.next());
loginform1.display();
}
}
| GB18030 | Java | 320 | java | test.java | Java | []
| null | []
| package kaibiyuanze;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
LoginForm loginform1=new LoginForm();
Scanner input=new Scanner(System.in);
System.out.println("请输入你想用的按钮图形:");
loginform1.setButton(input.next());
loginform1.display();
}
}
| 320 | 0.733108 | 0.722973 | 13 | 21.76923 | 15.738996 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.461538 | false | false | 2 |
453fc4a13bdc0c3273e1a1facf041d86525a21ab | 17,179,869,219,328 | c5d2922d7d40199d56fd9df082aa3f620aafdaa9 | /src/test/java/com/data/DataProviderClass.java | dc375f23cab814a411d94bf188b9bf2b07c36b4f | []
| no_license | sheetalrepo/ApiTestFW | https://github.com/sheetalrepo/ApiTestFW | 7e2267e50b7f901ca09fa5abb9ea031ac2c81a21 | cfb7bd2d3f5e9e1d23b3bdfa19a0d5437fb9533c | refs/heads/master | 2023-05-12T17:54:00.186000 | 2022-01-17T15:26:42 | 2022-01-17T15:26:42 | 195,540,036 | 5 | 12 | null | false | 2023-05-09T18:57:08 | 2019-07-06T13:01:41 | 2022-01-17T15:27:26 | 2023-05-09T18:57:05 | 378 | 5 | 10 | 3 | Java | false | false | package com.data;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.lang.reflect.Method;
//import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.testng.annotations.DataProvider;
import org.yaml.snakeyaml.Yaml;
import com.data.yaml.AllTestCaseData;
import com.data.yaml.TestData;
/**
* Here we have single DP method for any type of data present in all_test_data.yaml
*
* @author Sheetal Singh (https://www.youtube.com/user/MrQwerty8080/playlists?view_as=subscriber)
*/
public class DataProviderClass {
@DataProvider(name="common_test_data_provider")
public Object[][] getDataFromYamlFile(Method method)
{
Yaml yaml = new Yaml();
AllTestCaseData allTestCaseData = null;
String testCasePath = ".\\src\\test\\resources\\testdata\\all_test_data.yaml";
try {
allTestCaseData = yaml.loadAs(new FileReader(new File(testCasePath)), AllTestCaseData.class);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String testCaseName = method.getName();
List<TestData> testDataSets = allTestCaseData.getAllTestCaseDataMap().get(testCaseName); //list will be specific for @test method
//Filter test data based on test category to be run i.e. smoke, sanity and reg
String casesToBeRun = PropertyFileReader.getPropertyData().getApis().get("cases_to_be_run");
System.out.println("********** CASES TO BE RUN : "+casesToBeRun+" **********");
testDataSets = testDataSets.stream()
.filter(x -> casesToBeRun.equalsIgnoreCase(x.getTestCategory()))
.collect(Collectors.toList());
Object[][] data = new Object[testDataSets.size()][1]; //on runtime, rows will be decided, column will always be 1 in all the cases
//on runtime Object[n][1] array will be populated based on list size
for (int i = 0; i < testDataSets.size(); i++) {
data[i][0] = testDataSets.get(i);
}
return data;
}
}
| UTF-8 | Java | 1,949 | java | DataProviderClass.java | Java | [
{
"context": " data present in all_test_data.yaml\n * \n * @author Sheetal Singh (https://www.youtube.com/user/MrQwerty8080/playli",
"end": 490,
"score": 0.9998253583908081,
"start": 477,
"tag": "NAME",
"value": "Sheetal Singh"
},
{
"context": "uthor Sheetal Singh (https://www.youtube.com/user/MrQwerty8080/playlists?view_as=subscriber)\n */\npublic class Da",
"end": 533,
"score": 0.9990677237510681,
"start": 521,
"tag": "USERNAME",
"value": "MrQwerty8080"
}
]
| null | []
| package com.data;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.lang.reflect.Method;
//import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.testng.annotations.DataProvider;
import org.yaml.snakeyaml.Yaml;
import com.data.yaml.AllTestCaseData;
import com.data.yaml.TestData;
/**
* Here we have single DP method for any type of data present in all_test_data.yaml
*
* @author <NAME> (https://www.youtube.com/user/MrQwerty8080/playlists?view_as=subscriber)
*/
public class DataProviderClass {
@DataProvider(name="common_test_data_provider")
public Object[][] getDataFromYamlFile(Method method)
{
Yaml yaml = new Yaml();
AllTestCaseData allTestCaseData = null;
String testCasePath = ".\\src\\test\\resources\\testdata\\all_test_data.yaml";
try {
allTestCaseData = yaml.loadAs(new FileReader(new File(testCasePath)), AllTestCaseData.class);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String testCaseName = method.getName();
List<TestData> testDataSets = allTestCaseData.getAllTestCaseDataMap().get(testCaseName); //list will be specific for @test method
//Filter test data based on test category to be run i.e. smoke, sanity and reg
String casesToBeRun = PropertyFileReader.getPropertyData().getApis().get("cases_to_be_run");
System.out.println("********** CASES TO BE RUN : "+casesToBeRun+" **********");
testDataSets = testDataSets.stream()
.filter(x -> casesToBeRun.equalsIgnoreCase(x.getTestCategory()))
.collect(Collectors.toList());
Object[][] data = new Object[testDataSets.size()][1]; //on runtime, rows will be decided, column will always be 1 in all the cases
//on runtime Object[n][1] array will be populated based on list size
for (int i = 0; i < testDataSets.size(); i++) {
data[i][0] = testDataSets.get(i);
}
return data;
}
}
| 1,942 | 0.717804 | 0.713186 | 60 | 31.483334 | 33.912876 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.716667 | false | false | 2 |
30a7fd6c86b07be8a8cb50ac67b1b691d5aa32cf | 17,179,869,218,924 | 18197fd86b337c0288204134be2b1cf3bc330ef4 | /src/com/google/solarchallenge/client/gwtui/applicants/manageapplications/ManageApplicationsPresenter.java | d83a445800e90324d9609a8ec6d672ddf7815b42 | []
| no_license | arjunsatyapal/javasolper | https://github.com/arjunsatyapal/javasolper | 98bf1d8adf51923cfe74fc6f6f875f653eef6bad | f918ef1aadd56d79fcda29796e3fe7f05718141c | refs/heads/master | 2016-09-05T17:16:02.756000 | 2011-07-13T00:46:18 | 2011-07-13T00:46:18 | 32,204,183 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.solarchallenge.client.gwtui.applicants.manageapplications;
import static com.google.solarchallenge.client.rpc.ServiceProvider.getServiceProvider;
import com.google.common.collect.ImmutableMap;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.solarchallenge.client.gwtui.mvpinterfaces.Presenter;
import com.google.solarchallenge.shared.ApplicationStatus;
import com.google.solarchallenge.shared.dtos.ApplicationDto;
import java.util.ArrayList;
import java.util.Map;
/**
* Presenter for ManageApplications UI.
*
* @author Arjun Satyapal
*/
public class ManageApplicationsPresenter extends Presenter {
ManageApplicationsDisplay display;
private Map<Integer, ApplicationDto> map;
public ManageApplicationsPresenter(ManageApplicationsDisplay display,
String historyToken) {
super(display.getSolarChallengeHeaderPanel(), historyToken);
this.display = display;
}
@Override
public void go(HasWidgets container) {
container.clear();
container.add(display.asWidget());
bind();
}
@Override
public void bind() {
display.getListBoxApplicationStatus().addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
display.getListBoxApplicationDetails().clear();
int selectedIndex = display.getListBoxApplicationStatus()
.getSelectedIndex();
if (selectedIndex == 0) {
cleanState();
return;
}
ApplicationStatus overallStatus = ApplicationStatus.valueOf(display
.getListBoxApplicationStatus().getItemText(selectedIndex));
getServiceProvider().getApplicantService().getApplicationsByStatus(
overallStatus, new AsyncCallback<ArrayList<ApplicationDto>>() {
@Override
public void onSuccess(ArrayList<ApplicationDto> result) {
int counter = 0;
ImmutableMap.Builder<Integer, ApplicationDto> mapBuilder
= new ImmutableMap.Builder<Integer, ApplicationDto>();
for (ApplicationDto currDto : result) {
mapBuilder.put(counter++, currDto);
String item = new String(currDto.getId() + " : " + currDto
.getApplicationDetails());
display.getListBoxApplicationDetails().addItem(item);
}
map = mapBuilder.build();
}
@Override
public void onFailure(Throwable caught) {
Window.alert("Failed to get list from the server.");
}
});
}
});
display.getListBoxApplicationDetails().addChangeHandler(
new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
int selectedIndex = display.getListBoxApplicationDetails()
.getSelectedIndex();
if (selectedIndex < 0) {
cleanState();
return;
}
ApplicationDto dto = map.get(selectedIndex);
display.getDraftApplicationWidget().setApplicationId(dto.getId());
display.getDraftApplicationWidget().refreshDisplay();
display.getDraftApplicationWidget().setVisible(true);
}
});
}
private void cleanState() {
display.getDraftApplicationWidget().setVisible(false);
if (map != null) {
map.clear();
}
}
}
| UTF-8 | Java | 4,250 | java | ManageApplicationsPresenter.java | Java | [
{
"context": "Presenter for ManageApplications UI.\n *\n * @author Arjun Satyapal\n */\npublic class ManageApplicationsPresenter exte",
"end": 1371,
"score": 0.9998535513877869,
"start": 1357,
"tag": "NAME",
"value": "Arjun Satyapal"
}
]
| null | []
| /**
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.solarchallenge.client.gwtui.applicants.manageapplications;
import static com.google.solarchallenge.client.rpc.ServiceProvider.getServiceProvider;
import com.google.common.collect.ImmutableMap;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.solarchallenge.client.gwtui.mvpinterfaces.Presenter;
import com.google.solarchallenge.shared.ApplicationStatus;
import com.google.solarchallenge.shared.dtos.ApplicationDto;
import java.util.ArrayList;
import java.util.Map;
/**
* Presenter for ManageApplications UI.
*
* @author <NAME>
*/
public class ManageApplicationsPresenter extends Presenter {
ManageApplicationsDisplay display;
private Map<Integer, ApplicationDto> map;
public ManageApplicationsPresenter(ManageApplicationsDisplay display,
String historyToken) {
super(display.getSolarChallengeHeaderPanel(), historyToken);
this.display = display;
}
@Override
public void go(HasWidgets container) {
container.clear();
container.add(display.asWidget());
bind();
}
@Override
public void bind() {
display.getListBoxApplicationStatus().addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
display.getListBoxApplicationDetails().clear();
int selectedIndex = display.getListBoxApplicationStatus()
.getSelectedIndex();
if (selectedIndex == 0) {
cleanState();
return;
}
ApplicationStatus overallStatus = ApplicationStatus.valueOf(display
.getListBoxApplicationStatus().getItemText(selectedIndex));
getServiceProvider().getApplicantService().getApplicationsByStatus(
overallStatus, new AsyncCallback<ArrayList<ApplicationDto>>() {
@Override
public void onSuccess(ArrayList<ApplicationDto> result) {
int counter = 0;
ImmutableMap.Builder<Integer, ApplicationDto> mapBuilder
= new ImmutableMap.Builder<Integer, ApplicationDto>();
for (ApplicationDto currDto : result) {
mapBuilder.put(counter++, currDto);
String item = new String(currDto.getId() + " : " + currDto
.getApplicationDetails());
display.getListBoxApplicationDetails().addItem(item);
}
map = mapBuilder.build();
}
@Override
public void onFailure(Throwable caught) {
Window.alert("Failed to get list from the server.");
}
});
}
});
display.getListBoxApplicationDetails().addChangeHandler(
new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
int selectedIndex = display.getListBoxApplicationDetails()
.getSelectedIndex();
if (selectedIndex < 0) {
cleanState();
return;
}
ApplicationDto dto = map.get(selectedIndex);
display.getDraftApplicationWidget().setApplicationId(dto.getId());
display.getDraftApplicationWidget().refreshDisplay();
display.getDraftApplicationWidget().setVisible(true);
}
});
}
private void cleanState() {
display.getDraftApplicationWidget().setVisible(false);
if (map != null) {
map.clear();
}
}
}
| 4,242 | 0.667059 | 0.664471 | 124 | 33.274193 | 27.412718 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false | 2 |
f325ff0e9030db52941b6227f6590072673e36e9 | 32,246,614,514,223 | 2d9bd0fc6fd3e788b0cff0d17bc6d74c55d51671 | /Sprint17_repush/commons/commons-data/src/main/java/dz/gov/mesrs/sii/commons/data/model/gfc/AgentComptable.java | b1427115d7328bd7d3750e17fa5465f063b5f802 | []
| no_license | kkezzar/code2 | https://github.com/kkezzar/code2 | 952de18642d118d9dae9b10acc3b15ef7cfd709e | ee7bd0908ac7826074d26e214ef07c594e8a9706 | refs/heads/master | 2016-09-06T04:17:06.896000 | 2015-03-10T13:41:04 | 2015-03-10T13:41:04 | 31,958,723 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dz.gov.mesrs.sii.commons.data.model.gfc;
// Generated 24 nov. 2014 16:52:54 by Hibernate Tools 3.6.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import dz.gov.mesrs.sii.commons.data.model.Identifiable;
import dz.gov.mesrs.sii.commons.data.model.referentiel.RefIndividu;
/**
* AgentComptable generated by hbm2java
*/
@Entity
@Table(name = "agent_comptable", schema = "gfc")
public class AgentComptable implements java.io.Serializable, Identifiable<Integer> {
/**
* @author Mounir.MESSAOUDI on : 24 nov. 2014 17:31:48
*/
private static final long serialVersionUID = 1L;
private Integer id;
private RefIndividu refIndividu;
private String code;
private String decisionNomination;
private Date dateNomination;
private Date dateFinNomination;
private List<Regie> regies = new ArrayList<Regie>(0);
private List<Compte> comptes = new ArrayList<Compte>(0);
private List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables = new ArrayList<AffectationEtabStrAgentComptable>(
0);
public AgentComptable() {
}
public AgentComptable(Integer id, RefIndividu refIndividu) {
this.id = id;
this.refIndividu = refIndividu;
}
public AgentComptable(Integer id, RefIndividu refIndividu, String code, String decisionNomination,
Date dateNomination, Date dateFinNomination, List<Regie> regies, List<Compte> comptes,
List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables) {
this.id = id;
this.refIndividu = refIndividu;
this.code = code;
this.decisionNomination = decisionNomination;
this.dateNomination = dateNomination;
this.dateFinNomination = dateFinNomination;
this.regies = regies;
this.comptes = comptes;
this.affectationEtabStrAgentComptables = affectationEtabStrAgentComptables;
}
@SequenceGenerator(name = "agent_comptable_id_seq", sequenceName = "gfc.agent_comptable_id_seq")
@Id
@GeneratedValue(generator = "agent_comptable_id_seq")
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_individu", nullable = false)
public RefIndividu getRefIndividu() {
return this.refIndividu;
}
public void setRefIndividu(RefIndividu refIndividu) {
this.refIndividu = refIndividu;
}
@Column(name = "code", length = 10)
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
@Column(name = "decision_nomination", length = 200)
public String getDecisionNomination() {
return this.decisionNomination;
}
public void setDecisionNomination(String decisionNominiation) {
this.decisionNomination = decisionNominiation;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date_nomination", length = 29)
public Date getDateNomination() {
return this.dateNomination;
}
public void setDateNomination(Date dateNomination) {
this.dateNomination = dateNomination;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date_fin_nomination", length = 29)
public Date getDateFinNomination() {
return this.dateFinNomination;
}
public void setDateFinNomination(Date dateFinNomination) {
this.dateFinNomination = dateFinNomination;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable")
public List<Regie> getRegies() {
return this.regies;
}
public void setRegies(List<Regie> regies) {
this.regies = regies;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable")
public List<Compte> getComptes() {
return this.comptes;
}
public void setComptes(List<Compte> comptes) {
this.comptes = comptes;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable", cascade = { CascadeType.ALL }, orphanRemoval = true)
public List<AffectationEtabStrAgentComptable> getAffectationEtabStrAgentComptables() {
return this.affectationEtabStrAgentComptables;
}
public void setAffectationEtabStrAgentComptables(
List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables) {
this.affectationEtabStrAgentComptables = affectationEtabStrAgentComptables;
}
@Transient
@Override
public Integer getIdenfiant() {
return id;
}
@Transient
@Override
public String getIdentifiantName() {
return "id";
}
}
| UTF-8 | Java | 4,824 | java | AgentComptable.java | Java | [
{
"context": "lizable, Identifiable<Integer> {\n\n\t/**\n\t * @author Mounir.MESSAOUDI on : 24 nov. 2014 17:31:48\n\t */\n\tprivate static f",
"end": 1042,
"score": 0.9998910427093506,
"start": 1026,
"tag": "NAME",
"value": "Mounir.MESSAOUDI"
}
]
| null | []
| package dz.gov.mesrs.sii.commons.data.model.gfc;
// Generated 24 nov. 2014 16:52:54 by Hibernate Tools 3.6.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import dz.gov.mesrs.sii.commons.data.model.Identifiable;
import dz.gov.mesrs.sii.commons.data.model.referentiel.RefIndividu;
/**
* AgentComptable generated by hbm2java
*/
@Entity
@Table(name = "agent_comptable", schema = "gfc")
public class AgentComptable implements java.io.Serializable, Identifiable<Integer> {
/**
* @author Mounir.MESSAOUDI on : 24 nov. 2014 17:31:48
*/
private static final long serialVersionUID = 1L;
private Integer id;
private RefIndividu refIndividu;
private String code;
private String decisionNomination;
private Date dateNomination;
private Date dateFinNomination;
private List<Regie> regies = new ArrayList<Regie>(0);
private List<Compte> comptes = new ArrayList<Compte>(0);
private List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables = new ArrayList<AffectationEtabStrAgentComptable>(
0);
public AgentComptable() {
}
public AgentComptable(Integer id, RefIndividu refIndividu) {
this.id = id;
this.refIndividu = refIndividu;
}
public AgentComptable(Integer id, RefIndividu refIndividu, String code, String decisionNomination,
Date dateNomination, Date dateFinNomination, List<Regie> regies, List<Compte> comptes,
List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables) {
this.id = id;
this.refIndividu = refIndividu;
this.code = code;
this.decisionNomination = decisionNomination;
this.dateNomination = dateNomination;
this.dateFinNomination = dateFinNomination;
this.regies = regies;
this.comptes = comptes;
this.affectationEtabStrAgentComptables = affectationEtabStrAgentComptables;
}
@SequenceGenerator(name = "agent_comptable_id_seq", sequenceName = "gfc.agent_comptable_id_seq")
@Id
@GeneratedValue(generator = "agent_comptable_id_seq")
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_individu", nullable = false)
public RefIndividu getRefIndividu() {
return this.refIndividu;
}
public void setRefIndividu(RefIndividu refIndividu) {
this.refIndividu = refIndividu;
}
@Column(name = "code", length = 10)
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
@Column(name = "decision_nomination", length = 200)
public String getDecisionNomination() {
return this.decisionNomination;
}
public void setDecisionNomination(String decisionNominiation) {
this.decisionNomination = decisionNominiation;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date_nomination", length = 29)
public Date getDateNomination() {
return this.dateNomination;
}
public void setDateNomination(Date dateNomination) {
this.dateNomination = dateNomination;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date_fin_nomination", length = 29)
public Date getDateFinNomination() {
return this.dateFinNomination;
}
public void setDateFinNomination(Date dateFinNomination) {
this.dateFinNomination = dateFinNomination;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable")
public List<Regie> getRegies() {
return this.regies;
}
public void setRegies(List<Regie> regies) {
this.regies = regies;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable")
public List<Compte> getComptes() {
return this.comptes;
}
public void setComptes(List<Compte> comptes) {
this.comptes = comptes;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "agentComptable", cascade = { CascadeType.ALL }, orphanRemoval = true)
public List<AffectationEtabStrAgentComptable> getAffectationEtabStrAgentComptables() {
return this.affectationEtabStrAgentComptables;
}
public void setAffectationEtabStrAgentComptables(
List<AffectationEtabStrAgentComptable> affectationEtabStrAgentComptables) {
this.affectationEtabStrAgentComptables = affectationEtabStrAgentComptables;
}
@Transient
@Override
public Integer getIdenfiant() {
return id;
}
@Transient
@Override
public String getIdentifiantName() {
return "id";
}
}
| 4,824 | 0.770315 | 0.761816 | 172 | 27.046511 | 26.23481 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.377907 | false | false | 2 |
6ea51c8350c92e869b2a0a0e9d162da6ab088825 | 6,210,522,758,999 | 234e5d895e10ac6d7a367a07fea50fcc57358b2a | /app/src/main/java/udl/eps/testaccelerometre/TestAccelerometreActivity.java | 47425c755f7dc20ebe4e53b67ec88317246f4853 | []
| no_license | MiquelOliveros/TestAccelerometre | https://github.com/MiquelOliveros/TestAccelerometre | 1e7cfeaf6afce9bbd83fdc4ccae3d84b50bfb957 | 187d169f21fa3d0a4f933cdfac25e33096d8500b | refs/heads/master | 2022-04-10T22:30:57.917000 | 2020-02-20T08:51:42 | 2020-02-20T08:51:42 | 240,077,954 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package udl.eps.testaccelerometre;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Locale;
public class TestAccelerometreActivity extends Activity implements SensorEventListener {
private static final String TAG = "ActivityAccelerometer";
private SensorManager sensorManager;
private boolean color = false;
private TextView viewSuperior;
private TextView viewMig;
private TextView viewInferior;
private ListView lvIntensity;
private LinearLayout lyInferior;
private long lastUpdate;
private float lastValue = 0f;
private ArrayAdapter<String> arrayAdapter;
private ArrayList<String> intensityList = new ArrayList<>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i(TAG, "onCreate");
findViews();
viewSuperior.setBackgroundColor(Color.GREEN);
lyInferior.setBackgroundColor(Color.YELLOW);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, intensityList);
lvIntensity.setAdapter(arrayAdapter);
lastUpdate = System.currentTimeMillis();
}
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume");
setSensorsListeners();
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// Do something here if sensor accuracy changes.
}
@Override
protected void onPause() {
// unregister listener
super.onPause();
sensorManager.unregisterListener(this);
Log.i(TAG, "onPause: Unregistered sensorManager listener");
}
@Override
protected void onDestroy() {
super.onDestroy();
sensorManager.unregisterListener(this);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
getAccelerometer(event);
Log.i(TAG, "onSensorChanged: Type Sensor --> Accelerometer");
}
if (event.sensor.getType() == Sensor.TYPE_LIGHT){
getLuminic(event);
Log.i(TAG, "onSensorChanged: Type Sensor --> Light");
}
}
private void setSensorsListeners() {
if (sensorManager != null) {
Sensor accelerometre = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
Sensor luminic = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
if (accelerometre != null){
sensorManager.registerListener(this,
accelerometre,
SensorManager.SENSOR_DELAY_NORMAL);
String showCapabilities = "";
showCapabilities = showCapabilities + getText(R.string.shake) +
"\nMax Delay: " + accelerometre.getMaxDelay() +
"\nMin Delay: " + accelerometre.getMinDelay() +
"\nPower: " + accelerometre.getPower() +
"\nResolution: " + accelerometre.getResolution() +
"\nVersion: " + accelerometre.getVersion();
viewMig.setText(showCapabilities);
} else {
viewMig.setText(getText(R.string.noAccel));
}
if (luminic != null){
sensorManager.registerListener(this,
luminic,
SensorManager.SENSOR_DELAY_NORMAL);
String showCapabilities = "";
float HIGH = luminic.getMaximumRange();
showCapabilities = showCapabilities + getText(R.string.luminic) +
"\nMax Rang: " + HIGH;
viewInferior.setText(showCapabilities);
} else {
viewInferior.setText(R.string.noLuminic);
}
}
}
private void findViews() {
viewSuperior = findViewById(R.id.tvSuperior);
viewMig = findViewById(R.id.tvMig);
viewInferior = findViewById(R.id.tvInferior);
lyInferior = findViewById(R.id.lyInferior);
lvIntensity = findViewById(R.id.lvIntensity);
}
private void getLuminic(SensorEvent event) {
float value = event.values[0];
long actualTime = System.currentTimeMillis();
if (actualTime - lastUpdate < 1000 || value == lastValue) {
return;
}
lastUpdate = actualTime;
lastValue = value;
float MEDIUM = 2000f;
float LOW = 1000f;
if (value < LOW){
addTextToList(0,value, String.valueOf(getText(R.string.low)));
} else if( value < MEDIUM) {
addTextToList(0,value, String.valueOf(getText(R.string.medium)));
} else {
addTextToList(0,value, String.valueOf(getText(R.string.high)));
}
arrayAdapter.notifyDataSetChanged();
}
public void addTextToList(int index, float value, String intensity) {
intensityList.add(index, String.format(Locale.getDefault(),"New value light sensor = %s \n", value) + intensity);
Log.i(TAG, "New luminic value");
}
private void getAccelerometer(SensorEvent event) {
float[] values = event.values;
// Movement
float x = values[0];
float y = values[1];
float z = values[2];
float accelationSquareRoot = (x * x + y * y + z * z)
/ (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
long actualTime = System.currentTimeMillis();
if (accelationSquareRoot >= 2)
{
if (actualTime - lastUpdate < 200) {
return;
}
lastUpdate = actualTime;
Toast.makeText(this, R.string.shuffed, Toast.LENGTH_SHORT).show();
if (color) {
viewSuperior.setBackgroundColor(Color.GREEN);
} else {
viewSuperior.setBackgroundColor(Color.RED);
}
color = !color;
}
}
} | UTF-8 | Java | 6,635 | java | TestAccelerometreActivity.java | Java | []
| null | []
| package udl.eps.testaccelerometre;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Locale;
public class TestAccelerometreActivity extends Activity implements SensorEventListener {
private static final String TAG = "ActivityAccelerometer";
private SensorManager sensorManager;
private boolean color = false;
private TextView viewSuperior;
private TextView viewMig;
private TextView viewInferior;
private ListView lvIntensity;
private LinearLayout lyInferior;
private long lastUpdate;
private float lastValue = 0f;
private ArrayAdapter<String> arrayAdapter;
private ArrayList<String> intensityList = new ArrayList<>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i(TAG, "onCreate");
findViews();
viewSuperior.setBackgroundColor(Color.GREEN);
lyInferior.setBackgroundColor(Color.YELLOW);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, intensityList);
lvIntensity.setAdapter(arrayAdapter);
lastUpdate = System.currentTimeMillis();
}
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume");
setSensorsListeners();
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// Do something here if sensor accuracy changes.
}
@Override
protected void onPause() {
// unregister listener
super.onPause();
sensorManager.unregisterListener(this);
Log.i(TAG, "onPause: Unregistered sensorManager listener");
}
@Override
protected void onDestroy() {
super.onDestroy();
sensorManager.unregisterListener(this);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
getAccelerometer(event);
Log.i(TAG, "onSensorChanged: Type Sensor --> Accelerometer");
}
if (event.sensor.getType() == Sensor.TYPE_LIGHT){
getLuminic(event);
Log.i(TAG, "onSensorChanged: Type Sensor --> Light");
}
}
private void setSensorsListeners() {
if (sensorManager != null) {
Sensor accelerometre = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
Sensor luminic = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
if (accelerometre != null){
sensorManager.registerListener(this,
accelerometre,
SensorManager.SENSOR_DELAY_NORMAL);
String showCapabilities = "";
showCapabilities = showCapabilities + getText(R.string.shake) +
"\nMax Delay: " + accelerometre.getMaxDelay() +
"\nMin Delay: " + accelerometre.getMinDelay() +
"\nPower: " + accelerometre.getPower() +
"\nResolution: " + accelerometre.getResolution() +
"\nVersion: " + accelerometre.getVersion();
viewMig.setText(showCapabilities);
} else {
viewMig.setText(getText(R.string.noAccel));
}
if (luminic != null){
sensorManager.registerListener(this,
luminic,
SensorManager.SENSOR_DELAY_NORMAL);
String showCapabilities = "";
float HIGH = luminic.getMaximumRange();
showCapabilities = showCapabilities + getText(R.string.luminic) +
"\nMax Rang: " + HIGH;
viewInferior.setText(showCapabilities);
} else {
viewInferior.setText(R.string.noLuminic);
}
}
}
private void findViews() {
viewSuperior = findViewById(R.id.tvSuperior);
viewMig = findViewById(R.id.tvMig);
viewInferior = findViewById(R.id.tvInferior);
lyInferior = findViewById(R.id.lyInferior);
lvIntensity = findViewById(R.id.lvIntensity);
}
private void getLuminic(SensorEvent event) {
float value = event.values[0];
long actualTime = System.currentTimeMillis();
if (actualTime - lastUpdate < 1000 || value == lastValue) {
return;
}
lastUpdate = actualTime;
lastValue = value;
float MEDIUM = 2000f;
float LOW = 1000f;
if (value < LOW){
addTextToList(0,value, String.valueOf(getText(R.string.low)));
} else if( value < MEDIUM) {
addTextToList(0,value, String.valueOf(getText(R.string.medium)));
} else {
addTextToList(0,value, String.valueOf(getText(R.string.high)));
}
arrayAdapter.notifyDataSetChanged();
}
public void addTextToList(int index, float value, String intensity) {
intensityList.add(index, String.format(Locale.getDefault(),"New value light sensor = %s \n", value) + intensity);
Log.i(TAG, "New luminic value");
}
private void getAccelerometer(SensorEvent event) {
float[] values = event.values;
// Movement
float x = values[0];
float y = values[1];
float z = values[2];
float accelationSquareRoot = (x * x + y * y + z * z)
/ (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
long actualTime = System.currentTimeMillis();
if (accelationSquareRoot >= 2)
{
if (actualTime - lastUpdate < 200) {
return;
}
lastUpdate = actualTime;
Toast.makeText(this, R.string.shuffed, Toast.LENGTH_SHORT).show();
if (color) {
viewSuperior.setBackgroundColor(Color.GREEN);
} else {
viewSuperior.setBackgroundColor(Color.RED);
}
color = !color;
}
}
} | 6,635 | 0.611756 | 0.607988 | 204 | 31.529411 | 25.266504 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.602941 | false | false | 2 |
9cf3aeabb1370c82f993c794b150315efdf42941 | 6,210,522,759,812 | 43486bf14eea8f35740a56341a22f01f07bad924 | /Leetcode/src/main/java/com/daily/April/ReverseBits.java | c7b94ed7973bac343bbea3e68a8b3d06f25edc97 | []
| no_license | DoubleSmile/Leetcode | https://github.com/DoubleSmile/Leetcode | b154fdd8f584f0aaea85164f85db60d81492ad08 | 87719e7c883798c6786e9beb2ebeb8d81c0fe8a6 | refs/heads/master | 2021-01-17T14:13:45.620000 | 2016-07-17T11:11:22 | 2016-07-17T11:11:22 | 53,506,118 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.daily.April;
/**
* Created by luckyyflv on 16-4-20.
* Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100),
return 964176192 (represented in binary as 00111001011110000010100101000000).
*/
public class ReverseBits {
public int reverseBits(int n) {
return Integer.reverse(n);
}
}
| UTF-8 | Java | 405 | java | ReverseBits.java | Java | [
{
"context": "package com.daily.April;\n\n/**\n * Created by luckyyflv on 16-4-20.\n * Reverse bits of a given 32 bits un",
"end": 53,
"score": 0.9995520710945129,
"start": 44,
"tag": "USERNAME",
"value": "luckyyflv"
}
]
| null | []
| package com.daily.April;
/**
* Created by luckyyflv on 16-4-20.
* Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100),
return 964176192 (represented in binary as 00111001011110000010100101000000).
*/
public class ReverseBits {
public int reverseBits(int n) {
return Integer.reverse(n);
}
}
| 405 | 0.74321 | 0.525926 | 14 | 27.928572 | 29.025763 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 2 |
e56525f3e9fecd4f72a4f7119a214f7d0614cd6e | 13,383,118,135,658 | fec1435c270151a64605c7f05a6e2e6ff4e3c794 | /src/main/java/com/Kiiko/ExhibitionsApp/model/Ticket.java | d2e775677af56975966e6824bbeb7bf48317f547 | []
| no_license | VasylKiiko/ExhibitionApp | https://github.com/VasylKiiko/ExhibitionApp | 45ffb39b54204a6908fa71a75ab716276ef535fa | 7a288f573c64c4a73acf633e9e2e52b9fc5d82e5 | refs/heads/main | 2023-04-27T09:50:49.780000 | 2021-05-12T13:25:07 | 2021-05-12T13:25:07 | 357,112,968 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Kiiko.ExhibitionsApp.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Fetch;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Ticket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "exhibition_id")
private Exhibition exhibition;
private LocalDateTime creationTime;
private LocalDate visitingDate;
private int visitorsNumber;
private double price;
}
| UTF-8 | Java | 776 | java | Ticket.java | Java | []
| null | []
| package com.Kiiko.ExhibitionsApp.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Fetch;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Ticket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "exhibition_id")
private Exhibition exhibition;
private LocalDateTime creationTime;
private LocalDate visitingDate;
private int visitorsNumber;
private double price;
}
| 776 | 0.759021 | 0.759021 | 35 | 21.171429 | 14.898678 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457143 | false | false | 2 |
b1dbac4ae0784c62f9c8aaf116c453f6212ca7cd | 17,471,926,978,334 | 1d72c73430b0653c78b8383e7a5e1ad9ffa81663 | /tobi_7_4/src/com/framework/proxy/interfaces/Pointcut.java | 9a7f85ce0ec8a2e4fc48680d400d04b64a80dbaa | []
| no_license | sleepygloa/tobi_spring3_1 | https://github.com/sleepygloa/tobi_spring3_1 | 65bea392acc16792e56593ae2e35f1c081493fe1 | 096ed3a889061f025262c3f4860eeb6ebe9018c4 | refs/heads/master | 2020-04-01T08:56:11.805000 | 2019-10-15T07:06:18 | 2019-10-15T07:06:18 | 153,052,759 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.framework.proxy.interfaces;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;
public interface Pointcut {
ClassFilter getClassFilter();
MethodMatcher getMethodMathcer();
}
| UTF-8 | Java | 228 | java | Pointcut.java | Java | []
| null | []
| package com.framework.proxy.interfaces;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;
public interface Pointcut {
ClassFilter getClassFilter();
MethodMatcher getMethodMathcer();
}
| 228 | 0.828947 | 0.828947 | 9 | 24.333334 | 17.801373 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false | 2 |
48bc28fe605751aa3f423e87e106d178b667b2bb | 8,332,236,617,250 | 8d7fea6b4a2557fb9526d687b5a1e3f54e291924 | /Back End/MasterService/src/main/java/com/brycen/hrm/masterservice/ms007002GetDetail/MS007002GetDetailService.java | 7a1d3fc2738cf49450bfdfd7970f676dbc549a4b | []
| no_license | PBO-Training/vd_phi | https://github.com/PBO-Training/vd_phi | 69cd73af50bf02d1a7d80f07a430c2fb8f6ffcc5 | b89ee935feff35494f31b360aaa999a7247b15ec | refs/heads/main | 2023-03-09T04:03:40.129000 | 2021-02-26T02:00:47 | 2021-02-26T02:00:47 | 326,868,891 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.brycen.hrm.masterservice.ms007002GetDetail;
import com.brycen.hrm.common.base.BaseResponse;
/**
* [Description]: Interface is called by controller to do actions find a employee position<br>
* [ Remarks ]:<br>
* [Copyright]: Copyright (c) 2020<br>
*
* @author Brycen VietNam Company
* @version 1.0
*/
public interface MS007002GetDetailService {
/**
* [Description]: Method find a position with id specification<br/>
* [ Remarks ]:<br/>
*
* @param id
* @return MS007002UpdateResponse - Model contain data what need to send to client
*/
BaseResponse getDetail(long positionEmployeeID, int companyID);
}
| UTF-8 | Java | 660 | java | MS007002GetDetailService.java | Java | [
{
"context": "[Copyright]: Copyright (c) 2020<br>\n * \n * @author Brycen VietNam Company\n * @version 1.0\n */\npublic interface MS007002GetD",
"end": 301,
"score": 0.9996352195739746,
"start": 279,
"tag": "NAME",
"value": "Brycen VietNam Company"
}
]
| null | []
| package com.brycen.hrm.masterservice.ms007002GetDetail;
import com.brycen.hrm.common.base.BaseResponse;
/**
* [Description]: Interface is called by controller to do actions find a employee position<br>
* [ Remarks ]:<br>
* [Copyright]: Copyright (c) 2020<br>
*
* @author <NAME>
* @version 1.0
*/
public interface MS007002GetDetailService {
/**
* [Description]: Method find a position with id specification<br/>
* [ Remarks ]:<br/>
*
* @param id
* @return MS007002UpdateResponse - Model contain data what need to send to client
*/
BaseResponse getDetail(long positionEmployeeID, int companyID);
}
| 644 | 0.695455 | 0.659091 | 22 | 29 | 28.963928 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 2 |
ce679811ec08834c17bc19467079bba8285ffb2e | 10,041,633,556,074 | 6f2410dffea6c8cfaa75048b31ad6ea11e56aa89 | /src/GUI/fichasTecnicas/TelaConsultarFichasTecnicasController.java | 7ce2d152edbc5a6ce76daf256c410c4fb227bd36 | []
| no_license | renanramos97/FichasTecnicas-HotelRegente | https://github.com/renanramos97/FichasTecnicas-HotelRegente | b97c7c83c8d91bc4b461dee0da30d34fda82756d | 09d03380d8df46ae641b7bcc2569b035bb6be8c3 | refs/heads/master | 2020-03-20T20:41:06.654000 | 2018-08-18T02:07:38 | 2018-08-18T02:07:38 | 137,700,579 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GUI.fichasTecnicas;
import GUI.GUIManager;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import static database.DatabaseManager.queryArray;
import static database.DatabaseManager.queryString;
import database.objetos.FichaTecnica;
import database.objetos.Ingrediente;
import database.objetos.Insumo;
import java.text.NumberFormat;
import java.util.Collections;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import static database.DatabaseManager.executarComando;
import static database.DatabaseManager.queryResultSet;
public class TelaConsultarFichasTecnicasController extends GUIManager implements Initializable {
@FXML
private ListView listaFichas, listaIngredientes;
@FXML
private TextField fieldNome, fieldRendimento;
@FXML
private ChoiceBox boxSetor, boxCategoria;
@FXML
private Label labelValorTotal;
private ArrayList<String> fichasTecnicas;
private FichaTecnica fichaTecnica;
private ArrayList<String> ingredientes;
NumberFormat nf = NumberFormat.getCurrencyInstance();
@FXML
private void exibirFichaTecnica(){
String query = "SELECT * FROM FICHAS WHERE NOME='" + listaFichas.getSelectionModel().getSelectedItem() + "'";
fichaTecnica = new FichaTecnica(queryResultSet(query));
fieldNome.setText(fichaTecnica.getNome());
boxSetor.setValue(queryString("SELECT NOME FROM SETORES WHERE ID=" + fichaTecnica.getIDSetor()));
boxCategoria.setValue(queryString("SELECT NOME FROM CATEGORIAS WHERE ID=" + fichaTecnica.getIDCategoria()));
fieldRendimento.setText(Float.toString(fichaTecnica.getRendimento()));
ArrayList<String> valores = queryArray("SELECT INSUMOS.VALOR FROM INGREDIENTES JOIN INSUMOS WHERE INSUMOS.ID = INGREDIENTES.ID_INSUMO AND INGREDIENTES.ID_FICHA = " + fichaTecnica.getID());
ArrayList<String> quantidade = queryArray("SELECT QUANTIDADE FROM INGREDIENTES WHERE ID_FICHA = " + fichaTecnica.getID());
float valorTotal = 0;
for (int i = 0; i < valores.size(); i++){
valorTotal += Float.parseFloat(valores.get(i)) * Float.parseFloat(quantidade.get(i));
}
labelValorTotal.setText(NumberFormat.getCurrencyInstance().format(valorTotal));
listarIngredientes();
}
@FXML
private void salvarFichaTecnica(){
String query;
if (fieldNome.getText().length() > 0 && fieldRendimento.getText().length() > 0) {
fichaTecnica.setNome(fieldNome.getText());
fichaTecnica.setIDCategoria(Integer.parseInt(queryString("SELECT ID FROM CATEGORIAS WHERE NOME='" + boxCategoria.getValue() + "'")));
fichaTecnica.setIDSetor(Integer.parseInt(queryString("SELECT ID FROM SETORES WHERE NOME='" + boxSetor.getValue() + "'")));
fichaTecnica.setRendimento(Float.parseFloat(fieldRendimento.getText()));
query = "UPDATE FICHAS SET NOME='" + fichaTecnica.getNome() + "' WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET ID_CATEGORIA=" + fichaTecnica.getIDCategoria() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET ID_SETOR=" + fichaTecnica.getIDSetor() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET RENDIMENTO=" + fichaTecnica.getRendimento() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
}
}
@FXML
private void excluirFichaTecnica(){
String query = "DELETE FROM INGREDIENTES WHERE ID_FICHA=" + fichaTecnica.getID();
executarComando(query);
query = "DELETE FROM FICHAS WHERE NOME='" + fichaTecnica.getNome() + "'";
executarComando(query);
fichasTecnicas = queryArray("SELECT NOME FROM FICHAS");
listarFichas();
}
//Funções de listagem
private void listarFichas(){
listaFichas.getItems().clear();
listaFichas.getItems().addAll(fichasTecnicas);
listaFichas.getSelectionModel().select(1);
}
@FXML
private void listarSetores(){
ArrayList<String> setores = queryArray("SELECT NOME FROM SETORES");
Collections.sort(setores, (String setor1, String setor2) -> setor1.compareTo(setor2));
boxSetor.getItems().clear();
boxSetor.getItems().addAll(setores);
}
@FXML
private void listarCategorias(){
ArrayList<String> categorias = queryArray("SELECT NOME FROM CATEGORIAS");
Collections.sort(categorias, (String categoria1, String categoria2) -> categoria1.compareTo(categoria2));
boxCategoria.getItems().clear();
boxCategoria.getItems().addAll(categorias);
}
@FXML
private void listarIngredientes(){
ArrayList<Ingrediente> objIngredientes = new ArrayList<>();
for (String id : queryArray("SELECT ID FROM INGREDIENTES WHERE ID_FICHA = " + fichaTecnica.getID())){
objIngredientes.add(new Ingrediente(queryResultSet("SELECT * FROM INGREDIENTES WHERE ID=" + id)));
}
Insumo insumo = null;
ingredientes = new ArrayList<>();
for (Ingrediente ingrediente : objIngredientes){
insumo = new Insumo(queryResultSet("SELECT * FROM INSUMOS WHERE ID=" + ingrediente.getIDInsumo()));
ingredientes.add(insumo.getNome() + " | " + ingrediente.getQuantidade() + " " + insumo.getUnidade() + " | " + nf.format(ingrediente.getQuantidade() * insumo.getValor()));
}
Collections.sort(ingredientes, (String ingrediente1, String ingrediente2) -> ingrediente1.compareTo(ingrediente2));
listaIngredientes.getItems().clear();
listaIngredientes.getItems().addAll(ingredientes);
}
@FXML
private void editarIngredientes(){
editarFichaTecnica(fichaTecnica);
}
@Override
public void initialize(URL url, ResourceBundle rb) {
String query = "SELECT NOME FROM FICHAS";
fichasTecnicas = queryArray(query);
listarFichas();
listarSetores();
listarCategorias();
}
}
| UTF-8 | Java | 6,427 | java | TelaConsultarFichasTecnicasController.java | Java | []
| null | []
| package GUI.fichasTecnicas;
import GUI.GUIManager;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import static database.DatabaseManager.queryArray;
import static database.DatabaseManager.queryString;
import database.objetos.FichaTecnica;
import database.objetos.Ingrediente;
import database.objetos.Insumo;
import java.text.NumberFormat;
import java.util.Collections;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import static database.DatabaseManager.executarComando;
import static database.DatabaseManager.queryResultSet;
public class TelaConsultarFichasTecnicasController extends GUIManager implements Initializable {
@FXML
private ListView listaFichas, listaIngredientes;
@FXML
private TextField fieldNome, fieldRendimento;
@FXML
private ChoiceBox boxSetor, boxCategoria;
@FXML
private Label labelValorTotal;
private ArrayList<String> fichasTecnicas;
private FichaTecnica fichaTecnica;
private ArrayList<String> ingredientes;
NumberFormat nf = NumberFormat.getCurrencyInstance();
@FXML
private void exibirFichaTecnica(){
String query = "SELECT * FROM FICHAS WHERE NOME='" + listaFichas.getSelectionModel().getSelectedItem() + "'";
fichaTecnica = new FichaTecnica(queryResultSet(query));
fieldNome.setText(fichaTecnica.getNome());
boxSetor.setValue(queryString("SELECT NOME FROM SETORES WHERE ID=" + fichaTecnica.getIDSetor()));
boxCategoria.setValue(queryString("SELECT NOME FROM CATEGORIAS WHERE ID=" + fichaTecnica.getIDCategoria()));
fieldRendimento.setText(Float.toString(fichaTecnica.getRendimento()));
ArrayList<String> valores = queryArray("SELECT INSUMOS.VALOR FROM INGREDIENTES JOIN INSUMOS WHERE INSUMOS.ID = INGREDIENTES.ID_INSUMO AND INGREDIENTES.ID_FICHA = " + fichaTecnica.getID());
ArrayList<String> quantidade = queryArray("SELECT QUANTIDADE FROM INGREDIENTES WHERE ID_FICHA = " + fichaTecnica.getID());
float valorTotal = 0;
for (int i = 0; i < valores.size(); i++){
valorTotal += Float.parseFloat(valores.get(i)) * Float.parseFloat(quantidade.get(i));
}
labelValorTotal.setText(NumberFormat.getCurrencyInstance().format(valorTotal));
listarIngredientes();
}
@FXML
private void salvarFichaTecnica(){
String query;
if (fieldNome.getText().length() > 0 && fieldRendimento.getText().length() > 0) {
fichaTecnica.setNome(fieldNome.getText());
fichaTecnica.setIDCategoria(Integer.parseInt(queryString("SELECT ID FROM CATEGORIAS WHERE NOME='" + boxCategoria.getValue() + "'")));
fichaTecnica.setIDSetor(Integer.parseInt(queryString("SELECT ID FROM SETORES WHERE NOME='" + boxSetor.getValue() + "'")));
fichaTecnica.setRendimento(Float.parseFloat(fieldRendimento.getText()));
query = "UPDATE FICHAS SET NOME='" + fichaTecnica.getNome() + "' WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET ID_CATEGORIA=" + fichaTecnica.getIDCategoria() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET ID_SETOR=" + fichaTecnica.getIDSetor() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
query = "UPDATE FICHAS SET RENDIMENTO=" + fichaTecnica.getRendimento() + " WHERE ID=" + fichaTecnica.getID();
executarComando(query);
}
}
@FXML
private void excluirFichaTecnica(){
String query = "DELETE FROM INGREDIENTES WHERE ID_FICHA=" + fichaTecnica.getID();
executarComando(query);
query = "DELETE FROM FICHAS WHERE NOME='" + fichaTecnica.getNome() + "'";
executarComando(query);
fichasTecnicas = queryArray("SELECT NOME FROM FICHAS");
listarFichas();
}
//Funções de listagem
private void listarFichas(){
listaFichas.getItems().clear();
listaFichas.getItems().addAll(fichasTecnicas);
listaFichas.getSelectionModel().select(1);
}
@FXML
private void listarSetores(){
ArrayList<String> setores = queryArray("SELECT NOME FROM SETORES");
Collections.sort(setores, (String setor1, String setor2) -> setor1.compareTo(setor2));
boxSetor.getItems().clear();
boxSetor.getItems().addAll(setores);
}
@FXML
private void listarCategorias(){
ArrayList<String> categorias = queryArray("SELECT NOME FROM CATEGORIAS");
Collections.sort(categorias, (String categoria1, String categoria2) -> categoria1.compareTo(categoria2));
boxCategoria.getItems().clear();
boxCategoria.getItems().addAll(categorias);
}
@FXML
private void listarIngredientes(){
ArrayList<Ingrediente> objIngredientes = new ArrayList<>();
for (String id : queryArray("SELECT ID FROM INGREDIENTES WHERE ID_FICHA = " + fichaTecnica.getID())){
objIngredientes.add(new Ingrediente(queryResultSet("SELECT * FROM INGREDIENTES WHERE ID=" + id)));
}
Insumo insumo = null;
ingredientes = new ArrayList<>();
for (Ingrediente ingrediente : objIngredientes){
insumo = new Insumo(queryResultSet("SELECT * FROM INSUMOS WHERE ID=" + ingrediente.getIDInsumo()));
ingredientes.add(insumo.getNome() + " | " + ingrediente.getQuantidade() + " " + insumo.getUnidade() + " | " + nf.format(ingrediente.getQuantidade() * insumo.getValor()));
}
Collections.sort(ingredientes, (String ingrediente1, String ingrediente2) -> ingrediente1.compareTo(ingrediente2));
listaIngredientes.getItems().clear();
listaIngredientes.getItems().addAll(ingredientes);
}
@FXML
private void editarIngredientes(){
editarFichaTecnica(fichaTecnica);
}
@Override
public void initialize(URL url, ResourceBundle rb) {
String query = "SELECT NOME FROM FICHAS";
fichasTecnicas = queryArray(query);
listarFichas();
listarSetores();
listarCategorias();
}
}
| 6,427 | 0.674708 | 0.672062 | 152 | 41.269737 | 39.145977 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.651316 | false | false | 2 |
612f4a410f8902dd30375da0f0e6471cef94e54f | 17,858,474,046,838 | b2b6a834c331769cee01f492b1607acf99f85230 | /src/org/obscurasoft/opatch/gui/SucPanel.java | 31f109367bdd26f6534cd8cd00a4d9db10506c6a | [
"Apache-2.0"
]
| permissive | GodusX/obscurum-patcher | https://github.com/GodusX/obscurum-patcher | a25cd19da12290030a2f0d4ad2f205660e6b122f | c1dcc5189e6dd66f3f385912f07edbb0be0b9a14 | refs/heads/master | 2016-08-12T22:11:27.408000 | 2016-02-11T17:08:50 | 2016-02-11T17:08:50 | 46,592,046 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.obscurasoft.opatch.gui;
import java.awt.Button;
import java.awt.Label;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import org.obscurasoft.opatch.listener.Listener;
public class SucPanel extends JPanel {
/**
* Success panel
*/
private static final long serialVersionUID = 1L;
Label label = new Label();
Button exit = new Button("Выход");
Label skip = new Label();
ActionListener listener = new Listener();
public SucPanel() {
skip.setText(" ");
label.setText(" Клиент обновлён! Теперь вы можете играть.");
this.add(label);
this.add(skip);
exit.addActionListener(listener);
this.add(exit);
}
}
| UTF-8 | Java | 703 | java | SucPanel.java | Java | []
| null | []
| package org.obscurasoft.opatch.gui;
import java.awt.Button;
import java.awt.Label;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import org.obscurasoft.opatch.listener.Listener;
public class SucPanel extends JPanel {
/**
* Success panel
*/
private static final long serialVersionUID = 1L;
Label label = new Label();
Button exit = new Button("Выход");
Label skip = new Label();
ActionListener listener = new Listener();
public SucPanel() {
skip.setText(" ");
label.setText(" Клиент обновлён! Теперь вы можете играть.");
this.add(label);
this.add(skip);
exit.addActionListener(listener);
this.add(exit);
}
}
| 703 | 0.712349 | 0.710843 | 30 | 21.133333 | 17.421698 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3 | false | false | 2 |
c9cf2976ec3c4fdf1b14fd5d0825fa2d61b25db4 | 26,482,768,374,089 | 3069f97a4bf8d374ab21db27d3ca212fbe8742f2 | /base.core/src/main/java/eapli/base/respostaformularios/domain/RespostaFormulario.java | 7d23c43b52130da48cebe1509fff64ce09870cf6 | [
"MIT"
]
| permissive | guilhermeDaniel10/LAPR4_ISEP | https://github.com/guilhermeDaniel10/LAPR4_ISEP | dbd4d74dce74b4abc028264404a234b0c7fcb801 | 065d4e384f480b44db04d82e9301bce3109defa7 | refs/heads/master | 2023-08-16T22:30:02.149000 | 2021-10-06T22:38:25 | 2021-10-06T22:38:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package eapli.base.respostaformularios.domain;
import eapli.base.formulariomanagement.domain.Atributo;
import eapli.base.formulariomanagement.domain.DadosBase;
import eapli.base.formulariomanagement.domain.Formulario;
import eapli.framework.domain.model.AggregateRoot;
import eapli.framework.domain.model.DomainEntities;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
*
* @author Guilherme
*/
@Entity
public class RespostaFormulario implements AggregateRoot<Long> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idRespostaForm;
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Formulario formularioDaResposta;
@Column(nullable = false)
private String identificadorRespostaPorFormulario;
@ElementCollection
private List<AtributoEmResposta> valoresAtributos = new ArrayList<>();
public RespostaFormulario() {
}
public RespostaFormulario(String identificadorForm, Formulario formularioResposta) {
this.identificadorRespostaPorFormulario = "REP_" + identificadorForm;
this.formularioDaResposta = formularioResposta;
}
public RespostaFormulario(String identificadorForm, Formulario formularioResposta, List<AtributoEmResposta> atributos) {
this.identificadorRespostaPorFormulario = "REP_" + identificadorForm;
this.valoresAtributos = atributos;
this.formularioDaResposta = formularioResposta;
}
public boolean equals(final Object o) {
return DomainEntities.areEqual(this, o);
}
@Override
public int hashCode() {
return DomainEntities.hashCode(this);
}
@Override
public boolean sameAs(Object other) {
if (!(other instanceof RespostaFormulario)) {
return false;
}
final RespostaFormulario that = (RespostaFormulario) other;
if (this == that) {
return true;
}
return identity().equals(that.identity())
&& this.valoresAtributos.equals(that.valoresAtributos);
}
@Override
public Long identity() {
return this.idRespostaForm;
}
public List<AtributoEmResposta> valoresAtributos() {
return this.valoresAtributos;
}
public void addAtributoEmResposta(String nomeVariavel, DadosBase dadoBase, Object obj, int position) {
AtributoEmResposta atr = new AtributoEmResposta(nomeVariavel, dadoBase, obj, position);
this.valoresAtributos.add(atr);
}
public void addAtributoEmResposta(AtributoEmResposta atributo){
this.valoresAtributos.add(atributo);
}
public String idRespostaDeFormulario() {
return this.identificadorRespostaPorFormulario;
}
public Formulario formularioDaResposta(){
return this.formularioDaResposta;
}
}
| UTF-8 | Java | 3,410 | java | RespostaFormulario.java | Java | [
{
"context": "x.persistence.UniqueConstraint;\n\n/**\n *\n * @author Guilherme\n */\n@Entity\npublic class RespostaFormulario imple",
"end": 976,
"score": 0.9997965693473816,
"start": 967,
"tag": "NAME",
"value": "Guilherme"
}
]
| 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 eapli.base.respostaformularios.domain;
import eapli.base.formulariomanagement.domain.Atributo;
import eapli.base.formulariomanagement.domain.DadosBase;
import eapli.base.formulariomanagement.domain.Formulario;
import eapli.framework.domain.model.AggregateRoot;
import eapli.framework.domain.model.DomainEntities;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
*
* @author Guilherme
*/
@Entity
public class RespostaFormulario implements AggregateRoot<Long> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idRespostaForm;
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Formulario formularioDaResposta;
@Column(nullable = false)
private String identificadorRespostaPorFormulario;
@ElementCollection
private List<AtributoEmResposta> valoresAtributos = new ArrayList<>();
public RespostaFormulario() {
}
public RespostaFormulario(String identificadorForm, Formulario formularioResposta) {
this.identificadorRespostaPorFormulario = "REP_" + identificadorForm;
this.formularioDaResposta = formularioResposta;
}
public RespostaFormulario(String identificadorForm, Formulario formularioResposta, List<AtributoEmResposta> atributos) {
this.identificadorRespostaPorFormulario = "REP_" + identificadorForm;
this.valoresAtributos = atributos;
this.formularioDaResposta = formularioResposta;
}
public boolean equals(final Object o) {
return DomainEntities.areEqual(this, o);
}
@Override
public int hashCode() {
return DomainEntities.hashCode(this);
}
@Override
public boolean sameAs(Object other) {
if (!(other instanceof RespostaFormulario)) {
return false;
}
final RespostaFormulario that = (RespostaFormulario) other;
if (this == that) {
return true;
}
return identity().equals(that.identity())
&& this.valoresAtributos.equals(that.valoresAtributos);
}
@Override
public Long identity() {
return this.idRespostaForm;
}
public List<AtributoEmResposta> valoresAtributos() {
return this.valoresAtributos;
}
public void addAtributoEmResposta(String nomeVariavel, DadosBase dadoBase, Object obj, int position) {
AtributoEmResposta atr = new AtributoEmResposta(nomeVariavel, dadoBase, obj, position);
this.valoresAtributos.add(atr);
}
public void addAtributoEmResposta(AtributoEmResposta atributo){
this.valoresAtributos.add(atributo);
}
public String idRespostaDeFormulario() {
return this.identificadorRespostaPorFormulario;
}
public Formulario formularioDaResposta(){
return this.formularioDaResposta;
}
}
| 3,410 | 0.727859 | 0.727859 | 114 | 28.912281 | 27.160524 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482456 | false | false | 2 |
a0301723d09d9214f775c194d50956d7ecd138ad | 22,325,240,036,053 | 2a413e5fa0fa2a60f792fa196d276004f590d8ca | /src/main/java/com/lab/epam/persistant/ConnectionPool.java | f5ad16f87fb443e27dd196f07af57e76bba2f593 | [
"MIT"
]
| permissive | DimaVovchuk/LvivPortal | https://github.com/DimaVovchuk/LvivPortal | f5ae862e706f1ad2e6332d0db847ac9d99242334 | ebcf0f425114d7ae091963940f5ee061a4ef7cfa | refs/heads/master | 2021-01-17T06:16:39.598000 | 2016-08-08T11:14:47 | 2016-08-08T11:14:47 | 36,935,102 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lab.epam.persistant;
import com.lab.epam.helper.ClassName;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
import java.util.Vector;
public class ConnectionPool {
private Vector<Connection> availableConns = new Vector<Connection>();
private Vector<Connection> usedConns = new Vector<Connection>();
private String url;
private String user;
private String password;
public ConnectionPool(int initConnCnt) {
Properties props = new Properties();
try {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("persistent.xml").getFile());
InputStream stream = new FileInputStream(file);
props.loadFromXML(stream);
} catch (IOException e) {
e.printStackTrace();
}
try {
final String driver = props.getProperty("jdbc.driver");
Class.forName(driver);
props.put("useUnicode", "true");
props.put("characterEncoding", "utf8");
} catch (Exception e) {
e.printStackTrace();
}
this.url = props.getProperty("jdbc.url");
this.user = props.getProperty("jdbc.user");
this.password = props.getProperty("jdbc.password");
for (int i = 0; i < initConnCnt; i++) {
availableConns.addElement(getConnection());
}
}
public Connection getConnection() {
Connection conn = null;
try {
conn = DriverManager.getConnection(url, user, password);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
public synchronized Connection retrieve() {
Connection newConn = null;
if (availableConns.size() == 0) {
newConn = getConnection();
} else {
newConn = (Connection) availableConns.lastElement();
availableConns.removeElement(newConn);
}
usedConns.addElement(newConn);
return newConn;
}
public synchronized void putback(Connection c) throws NullPointerException {
if (c != null) {
if (usedConns.removeElement(c)) {
availableConns.addElement(c);
} else {
throw new NullPointerException(
"Connection not in the usedConns array");
}
}
}
public int getAvailableConnsCnt() {
return availableConns.size();
}
}
| UTF-8 | Java | 2,711 | java | ConnectionPool.java | Java | []
| null | []
| package com.lab.epam.persistant;
import com.lab.epam.helper.ClassName;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
import java.util.Vector;
public class ConnectionPool {
private Vector<Connection> availableConns = new Vector<Connection>();
private Vector<Connection> usedConns = new Vector<Connection>();
private String url;
private String user;
private String password;
public ConnectionPool(int initConnCnt) {
Properties props = new Properties();
try {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("persistent.xml").getFile());
InputStream stream = new FileInputStream(file);
props.loadFromXML(stream);
} catch (IOException e) {
e.printStackTrace();
}
try {
final String driver = props.getProperty("jdbc.driver");
Class.forName(driver);
props.put("useUnicode", "true");
props.put("characterEncoding", "utf8");
} catch (Exception e) {
e.printStackTrace();
}
this.url = props.getProperty("jdbc.url");
this.user = props.getProperty("jdbc.user");
this.password = props.getProperty("jdbc.password");
for (int i = 0; i < initConnCnt; i++) {
availableConns.addElement(getConnection());
}
}
public Connection getConnection() {
Connection conn = null;
try {
conn = DriverManager.getConnection(url, user, password);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
public synchronized Connection retrieve() {
Connection newConn = null;
if (availableConns.size() == 0) {
newConn = getConnection();
} else {
newConn = (Connection) availableConns.lastElement();
availableConns.removeElement(newConn);
}
usedConns.addElement(newConn);
return newConn;
}
public synchronized void putback(Connection c) throws NullPointerException {
if (c != null) {
if (usedConns.removeElement(c)) {
availableConns.addElement(c);
} else {
throw new NullPointerException(
"Connection not in the usedConns array");
}
}
}
public int getAvailableConnsCnt() {
return availableConns.size();
}
}
| 2,711 | 0.605312 | 0.603467 | 89 | 29.460674 | 21.519291 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573034 | false | false | 2 |
814bd2a54f442d4c0d45b25ceab40284f9f95ecc | 738,734,410,369 | d1df87dc03edd380f0ba4e4697d51e43d9d80a8d | /DesignJava/src/UML_exam/Server.java | 78739ccaeb608ec47023dfd8cd87019dd20c29dd | []
| no_license | soorichu/my-eclipse | https://github.com/soorichu/my-eclipse | 964dc78bc7a7a73f0f29e84d922f5de0e32d8f70 | 654239bfe8a65df27dfeb7ce5186597c8c0b56c5 | refs/heads/master | 2021-01-10T03:40:11.014000 | 2016-01-10T17:17:30 | 2016-01-10T17:17:30 | 49,375,785 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package UML_exam;
class Server{
String device = new String();
Server(){
this.device = "Unknown Device";
}
Server(String dev){
this.device = dev;
}
void open(){
System.out.println(device + " is opening");
}
void print(){
System.out.println("The device is "+device);
}
void close(){
System.out.println(device +" is close");
}
}
| UTF-8 | Java | 360 | java | Server.java | Java | []
| null | []
| package UML_exam;
class Server{
String device = new String();
Server(){
this.device = "Unknown Device";
}
Server(String dev){
this.device = dev;
}
void open(){
System.out.println(device + " is opening");
}
void print(){
System.out.println("The device is "+device);
}
void close(){
System.out.println(device +" is close");
}
}
| 360 | 0.616667 | 0.616667 | 25 | 13.4 | 14.63694 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 2 |
8feac2226760890fcbdbe4be75f2fe952e0ef926 | 25,228,637,927,459 | 5b7864b83cdd919439a84711a6b2f9894785c3b3 | /src/main/java/com/springdata/repositories/EmployeeRepository.java | db9267bac26133ee4de73137ab93112bf1362b16 | []
| no_license | Lovjit/spring-data-jpa | https://github.com/Lovjit/spring-data-jpa | e45e6300fc04a212e4e75390faf22a06db9429b1 | 78a0f3383b067f57cc8eeb8b805b34845fd38620 | refs/heads/master | 2020-04-05T14:04:12.067000 | 2017-06-29T15:19:29 | 2017-06-29T15:19:29 | 94,752,661 | 0 | 1 | null | true | 2017-06-19T08:12:52 | 2017-06-19T08:12:51 | 2017-06-18T09:31:23 | 2017-06-18T09:31:22 | 7 | 0 | 0 | 0 | null | null | null | package com.springdata.repositories;
import java.util.List;
import com.springdata.entity.Employee;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
public interface EmployeeRepository extends CrudRepository<Employee,Integer> , JpaSpecificationExecutor<Employee> {
List<Employee> findByNameOrderByIdAsc(String string);
}
| UTF-8 | Java | 414 | java | EmployeeRepository.java | Java | []
| null | []
| package com.springdata.repositories;
import java.util.List;
import com.springdata.entity.Employee;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
public interface EmployeeRepository extends CrudRepository<Employee,Integer> , JpaSpecificationExecutor<Employee> {
List<Employee> findByNameOrderByIdAsc(String string);
}
| 414 | 0.838164 | 0.838164 | 16 | 24.875 | 33.555691 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6875 | false | false | 2 |
0e07841221d1758ddbdc7f8c606149f7326992ff | 3,298,534,912,250 | 4a20ef25af3d73e3856a1a1df2ae22370cde5578 | /src/main/java/com/luobo/entity/AssetRack.java | a9435918e943ee4e5476694b0b7167809529d054 | []
| no_license | XiaoJieB/test | https://github.com/XiaoJieB/test | eaaae1942e9ea3b779e1a59b5c322218f76089e6 | 6828929ed779540faf01219c1544e6d5eae11a5d | refs/heads/master | 2020-05-15T10:03:31.948000 | 2019-04-24T03:38:19 | 2019-04-24T03:38:22 | 182,186,956 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.luobo.entity;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
/**
* . Description: Date: 2019/4/23 10:20
*
* @author: ws
* @version: 1.0
*/
@Entity
@DiscriminatorValue("RACK")
@PrimaryKeyJoinColumn(name = "asset_rack_id")
@Table(name = "asset_rack")
public class AssetRack extends Asset {
@Column(name = "rack_size")
private Integer rackSize; // 机柜总容量 U(unit)
public AssetRack() {
super();
super.setType(Type.RACK);
}
public Integer getRackSize() {
return rackSize;
}
public void setRackSize(Integer rackSize) {
this.rackSize = rackSize;
}
}
| UTF-8 | Java | 736 | java | AssetRack.java | Java | [
{
"context": " Description: Date: 2019/4/23 10:20\n *\n * @author: ws\n * @version: 1.0\n */\n@Entity\n@DiscriminatorValue(",
"end": 279,
"score": 0.9932934045791626,
"start": 277,
"tag": "USERNAME",
"value": "ws"
}
]
| null | []
| package com.luobo.entity;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
/**
* . Description: Date: 2019/4/23 10:20
*
* @author: ws
* @version: 1.0
*/
@Entity
@DiscriminatorValue("RACK")
@PrimaryKeyJoinColumn(name = "asset_rack_id")
@Table(name = "asset_rack")
public class AssetRack extends Asset {
@Column(name = "rack_size")
private Integer rackSize; // 机柜总容量 U(unit)
public AssetRack() {
super();
super.setType(Type.RACK);
}
public Integer getRackSize() {
return rackSize;
}
public void setRackSize(Integer rackSize) {
this.rackSize = rackSize;
}
}
| 736 | 0.728532 | 0.710526 | 35 | 19.628571 | 16.069645 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.771429 | false | false | 2 |
d35e6b02b3b78597107bab982844288245fc61f0 | 20,040,317,435,485 | f3b93dbcdc899ebf603fc0b4222d1ba38d18eada | /src/main/java/com/cg/customerms/dto/ItemDetails.java | d3bf86b41088b92feafd7389ce5f12500730d9a3 | []
| no_license | dextro-gear/cg-customerms-sprint | https://github.com/dextro-gear/cg-customerms-sprint | bf62de51493e16da3712fdf679bf56e2fe748020 | cd3e130b4f26da77af894447cdf0ef134138b70c | refs/heads/master | 2023-03-21T08:12:05.662000 | 2021-03-15T10:23:40 | 2021-03-15T10:23:40 | 346,634,946 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cg.customerms.dto;
import com.cg.items.entities.Item;
public class ItemDetails {
String id;
String description;
public ItemDetails(String id, String desc) {
this.id = id;
this.description = desc;
}
public ItemDetails(Item item){
this.id = item.getId();
this.description = item.getDescription();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDesc() {
return description;
}
public void setDesc(String desc) {
this.description = desc;
}
}
| UTF-8 | Java | 633 | java | ItemDetails.java | Java | []
| null | []
| package com.cg.customerms.dto;
import com.cg.items.entities.Item;
public class ItemDetails {
String id;
String description;
public ItemDetails(String id, String desc) {
this.id = id;
this.description = desc;
}
public ItemDetails(Item item){
this.id = item.getId();
this.description = item.getDescription();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDesc() {
return description;
}
public void setDesc(String desc) {
this.description = desc;
}
}
| 633 | 0.589257 | 0.589257 | 34 | 17.617647 | 15.368062 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false | 2 |
084bbe4847ee1546b9d9d43641ebeea72d18b658 | 4,612,794,913,860 | ad0bb5ee70cbff364e4c380fab2c2ee73eded5a3 | /DP/lectures/2013/c4/Streams/src/streams/WhereIterator.java | d1f3c2444744c6eff54749a128fa8d71e1144318 | []
| no_license | SAlexandru/LiUHomework | https://github.com/SAlexandru/LiUHomework | 073fd79c6a91c10ffd6f17cbed22b35c82cb17da | a78fc12297776eab3fa6020b9eb8433d9d1b9842 | refs/heads/master | 2016-09-10T10:11:00.745000 | 2013-09-18T12:34:49 | 2013-09-18T12:34:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package streams;
import java.util.Iterator;
public class WhereIterator<T> implements Iterator<T> {
private Iterator<T> iterator;
private IPredicate<T> predicate;
public WhereIterator(Iterable<T> iterable, IPredicate<T> predicate) {
this.iterator = iterable.iterator();
this.predicate = predicate;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
T item = iterator.hasNext() ? iterator.next() : null;
while (iterator.hasNext() && !predicate.accept(item)) {
item = iterator.next();
}
return item;
}
@Override
public void remove() {
iterator.remove();
}
}
| UTF-8 | Java | 640 | java | WhereIterator.java | Java | []
| null | []
| package streams;
import java.util.Iterator;
public class WhereIterator<T> implements Iterator<T> {
private Iterator<T> iterator;
private IPredicate<T> predicate;
public WhereIterator(Iterable<T> iterable, IPredicate<T> predicate) {
this.iterator = iterable.iterator();
this.predicate = predicate;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
T item = iterator.hasNext() ? iterator.next() : null;
while (iterator.hasNext() && !predicate.accept(item)) {
item = iterator.next();
}
return item;
}
@Override
public void remove() {
iterator.remove();
}
}
| 640 | 0.69375 | 0.69375 | 34 | 17.82353 | 19.142609 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.294118 | false | false | 2 |
ed637e860df08264b56a20f622c2272fcaa5cb19 | 14,499,809,628,944 | 5b48e1483bafcc86da07557a0f4327588b20c65a | /src/main/java/com/chen/local/learn/dataStructureAndAlgorithm/algorithmOld/Fibnach.java | 6d70d5b7888eaf99d16be7faff356f0b387ddb5b | []
| no_license | za96421955/Local | https://github.com/za96421955/Local | c1648e56b8664e7640d43a68bf6d7cdddd7c2c72 | a7f6bf90126224df1726eed4ce2ae80222f02fbf | refs/heads/master | 2023-05-08T15:55:39.865000 | 2021-06-04T02:24:01 | 2021-06-04T02:24:01 | 360,858,305 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chen.local.learn.dataStructureAndAlgorithm.algorithmOld;
public class Fibnach {
public void show(int n) {
for (int i=1; i<=n; i++) {
for (int j=1; j<=i; j++) {
System.out.print(get(i, j) + "\t");
}
System.out.print("\n");
}
}
public int get(int row, int col) {
if (row < 0 || col < 0 || col > row)
return 0;
else if (col == 1 || col == row)
return 1;
else {
return get(row - 1, col - 1) + get(row - 1, col);
}
}
}
| UTF-8 | Java | 489 | java | Fibnach.java | Java | []
| null | []
| package com.chen.local.learn.dataStructureAndAlgorithm.algorithmOld;
public class Fibnach {
public void show(int n) {
for (int i=1; i<=n; i++) {
for (int j=1; j<=i; j++) {
System.out.print(get(i, j) + "\t");
}
System.out.print("\n");
}
}
public int get(int row, int col) {
if (row < 0 || col < 0 || col > row)
return 0;
else if (col == 1 || col == row)
return 1;
else {
return get(row - 1, col - 1) + get(row - 1, col);
}
}
}
| 489 | 0.521472 | 0.501023 | 22 | 20.227272 | 18.500446 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.681818 | false | false | 2 |
e554c5c6513a3871c41f0e8a9fbcdcf1e59394ba | 17,927,193,540,441 | 5407a3f261a65010ca0b39e031916eff8461d5e9 | /src/main/java/com/linxi/FileTransfer/TransferActionImp/TransferActionSchedulerImp.java | c124ff6c745456fb58641a1544c3f4a63d1c8fdd | []
| no_license | Wheat345/RemoteScheduleFileTransfer | https://github.com/Wheat345/RemoteScheduleFileTransfer | 371219e72f13d6a6e69b7b338c5b8a59ccbaabfb | 5198afa0d59b9d6c200a95ba304788a613dab4b5 | refs/heads/master | 2021-03-02T16:58:58.095000 | 2020-03-08T21:11:59 | 2020-03-08T21:11:59 | 245,886,516 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.linxi.FileTransfer.TransferActionImp;
/*
* This class is to setup schedule about running this application
*
*
* **/
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.linxi.FileTransfer.FileTransferApplication;
import com.linxi.FileTransfer.TransferAction.TransferActionScheduler;
@Component
public class TransferActionSchedulerImp implements TransferActionScheduler {
private static final Logger logger = LoggerFactory.getLogger(FileTransferApplication.class);
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
@Autowired
TransferActionImp transferActionImp;
//@Scheduled(cron = "0 0 */2 * * *") //every two hours
//@Scheduled(cron = "0 * * * * *") //every one minute
@Scheduled(cron = "0 0 2 * * *") //execute everyday at 2am
public void scheduleTaskWithFixedRate() {
logger.info("Fixed Rate Task :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()) );
transferActionImp.process();
}
}
| UTF-8 | Java | 1,274 | java | TransferActionSchedulerImp.java | Java | []
| null | []
| package com.linxi.FileTransfer.TransferActionImp;
/*
* This class is to setup schedule about running this application
*
*
* **/
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.linxi.FileTransfer.FileTransferApplication;
import com.linxi.FileTransfer.TransferAction.TransferActionScheduler;
@Component
public class TransferActionSchedulerImp implements TransferActionScheduler {
private static final Logger logger = LoggerFactory.getLogger(FileTransferApplication.class);
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
@Autowired
TransferActionImp transferActionImp;
//@Scheduled(cron = "0 0 */2 * * *") //every two hours
//@Scheduled(cron = "0 * * * * *") //every one minute
@Scheduled(cron = "0 0 2 * * *") //execute everyday at 2am
public void scheduleTaskWithFixedRate() {
logger.info("Fixed Rate Task :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()) );
transferActionImp.process();
}
}
| 1,274 | 0.77237 | 0.764521 | 34 | 36.470589 | 31.520521 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676471 | false | false | 2 |
bfec608af6debfaa231d91c38d49ad7518798f2f | 36,962,488,588,250 | 6d70165871b2564e2981f4ded56b461cbcda67fc | /src/java/kayitCekk.java | 6dae0f3a89f1b02cc4dc659fb4d11d61f05767de | []
| no_license | esracom/bookstore | https://github.com/esracom/bookstore | 44955f2500bcf640daabd57eaa1138b5863346a7 | d18dcb29f3ab3ea79c8ed3fcf148e98a6091b44f | refs/heads/master | 2020-03-23T15:36:27.494000 | 2018-07-23T20:48:34 | 2018-07-23T20:48:34 | 141,761,403 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.sql.*;
import java.util.*;
import javax.faces.bean.*;
@ManagedBean
@RequestScoped
public class kayitCekk {
PreparedStatement ps=null;//SQL sorgumuzu tutacak ve çalıştıracak nesne.
Connection con=null;//Veri tabanına bağlantı yapmamızı sağlayacak nesne.
public List<AdiAlaniPojok> getKitTablosu() {
try {
Class.forName("com.mysql.jdbc.Driver");//Hangi türde bir veri tabanını kullanacağını bildiriyoruz.
con=DriverManager.getConnection("jdbc:mysql:///kitap","root","esra");//Bağlanacağı veri tabanını ve kullanacağı kullanıcı adı-parolayı bildiriyoruz.
ps=con.prepareStatement("SELECT kid,kadi,kyazar,kfiyat FROM kitap");//Yazarlar tablosundaki herşeyi çek diyoruz.
ResultSet rs=ps.executeQuery();//SQL Sorgusundan dönecek sonuç rs sonuç kümesi içinde tutulacak.
List<AdiAlaniPojok> listek=new ArrayList<>();//AdiAlani sınıfı tipinde liste tanımladık çünkü SQL Sorgusundan dönecek sonuç içindeki Adi Alani kısmına bu tiple ulaşacaz.
while(rs.next())//Kayıt olduğu sürece her işlem sonunda 1 satır atla.
{
AdiAlaniPojok aa=new AdiAlaniPojok();//SQL Sorgusundan sütunları çekip bu değişkenin içinde Adı veya Alani kısmına atıyacağız.
aa.setKid(rs.getString("kid")); //ResultSet içinden o anki indisdeki "Adi" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKadi(rs.getString("kadi")); //ResultSet içinden o anki indisdeki "Adi" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKyazar(rs.getString("kyazar")); //ResultSet içinden o anki indisdeki "Alani" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKfiyat(rs.getString("kfiyat")); //ResultSet içinden o anki indisdeki "Alani" anahtar kelimesine karşı gelen değer alınıyor.
listek.add(aa);//Her bir dönen sonucu listeye ekliyoruz.
}
return listek;//Listeyi return ediyoruz.
}
catch (ClassNotFoundException | SQLException exception) {
System.out.println("Bir hata meydana geldi:"+exception);
return null;
}
finally{ //try'a da düşse catch'e de bu bloktaki kod çalıştırılacak.
try {
if(con!=null){ //Connection nesnesi belki yukarıda null kalmış olabilir. Kontrol etmekte fayda var.
con.close();
}
if(ps!=null){ //PreparedStatement nesnesi yukarıda null kalmış olabilir. Kontrol etmekte fayda var.
ps.close();
}
} catch (SQLException sqlException) {
System.out.println("Bir hata meydana geldi:"+sqlException);
}
}
}
} | UTF-8 | Java | 2,847 | java | kayitCekk.java | Java | []
| null | []
| import java.sql.*;
import java.util.*;
import javax.faces.bean.*;
@ManagedBean
@RequestScoped
public class kayitCekk {
PreparedStatement ps=null;//SQL sorgumuzu tutacak ve çalıştıracak nesne.
Connection con=null;//Veri tabanına bağlantı yapmamızı sağlayacak nesne.
public List<AdiAlaniPojok> getKitTablosu() {
try {
Class.forName("com.mysql.jdbc.Driver");//Hangi türde bir veri tabanını kullanacağını bildiriyoruz.
con=DriverManager.getConnection("jdbc:mysql:///kitap","root","esra");//Bağlanacağı veri tabanını ve kullanacağı kullanıcı adı-parolayı bildiriyoruz.
ps=con.prepareStatement("SELECT kid,kadi,kyazar,kfiyat FROM kitap");//Yazarlar tablosundaki herşeyi çek diyoruz.
ResultSet rs=ps.executeQuery();//SQL Sorgusundan dönecek sonuç rs sonuç kümesi içinde tutulacak.
List<AdiAlaniPojok> listek=new ArrayList<>();//AdiAlani sınıfı tipinde liste tanımladık çünkü SQL Sorgusundan dönecek sonuç içindeki Adi Alani kısmına bu tiple ulaşacaz.
while(rs.next())//Kayıt olduğu sürece her işlem sonunda 1 satır atla.
{
AdiAlaniPojok aa=new AdiAlaniPojok();//SQL Sorgusundan sütunları çekip bu değişkenin içinde Adı veya Alani kısmına atıyacağız.
aa.setKid(rs.getString("kid")); //ResultSet içinden o anki indisdeki "Adi" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKadi(rs.getString("kadi")); //ResultSet içinden o anki indisdeki "Adi" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKyazar(rs.getString("kyazar")); //ResultSet içinden o anki indisdeki "Alani" anahtar kelimesine karşı gelen değer alınıyor.
aa.setKfiyat(rs.getString("kfiyat")); //ResultSet içinden o anki indisdeki "Alani" anahtar kelimesine karşı gelen değer alınıyor.
listek.add(aa);//Her bir dönen sonucu listeye ekliyoruz.
}
return listek;//Listeyi return ediyoruz.
}
catch (ClassNotFoundException | SQLException exception) {
System.out.println("Bir hata meydana geldi:"+exception);
return null;
}
finally{ //try'a da düşse catch'e de bu bloktaki kod çalıştırılacak.
try {
if(con!=null){ //Connection nesnesi belki yukarıda null kalmış olabilir. Kontrol etmekte fayda var.
con.close();
}
if(ps!=null){ //PreparedStatement nesnesi yukarıda null kalmış olabilir. Kontrol etmekte fayda var.
ps.close();
}
} catch (SQLException sqlException) {
System.out.println("Bir hata meydana geldi:"+sqlException);
}
}
}
} | 2,847 | 0.657434 | 0.65707 | 46 | 58.673912 | 51.755299 | 181 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.608696 | false | false | 2 |
116bd227077c50ba93eb4b6aacf485e02d5b3851 | 37,417,755,115,768 | ea38fc3499b06d0bf910608713fafce520a27f64 | /src/main/java/com/custom/by/lht/excel/ExcelStyle.java | 018a511b097e9f48351254c4c76c5001af8f7d0e | []
| no_license | lhtGit/excelUtil | https://github.com/lhtGit/excelUtil | 62ac6033443a4987d0d2765cfc16f3f7e59a55f9 | 0fcc3aea6e42ab62579b37bd3d078a041fa1ca06 | refs/heads/master | 2020-04-14T16:00:44.342000 | 2019-01-03T08:49:49 | 2019-01-03T08:49:49 | 163,941,842 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.custom.by.lht.excel;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
/**
* @Auther: lht
* @Date: 2018/12/27 16:54
* @Description:
*/
public class ExcelStyle {
//位置(居中、右、左) 居中
private HorizontalAlignment horizontal = HorizontalAlignment.CENTER ;
private VerticalAlignment vertical = VerticalAlignment.CENTER;
//是否加粗
private boolean isBold=false;
//是否加框
private boolean isBorder = true;
//字体大小
private short fontSize = 12;
//字体
private String fontName = "黑体";
//宽度
private int width=0;
public String getFontName() {
return fontName;
}
public void setFontName(String fontName) {
this.fontName = fontName;
}
public HorizontalAlignment getHorizontal() {
return horizontal;
}
public void setHorizontal(HorizontalAlignment horizontal) {
this.horizontal = horizontal;
}
public VerticalAlignment getVertical() {
return vertical;
}
public void setVertical(VerticalAlignment vertical) {
this.vertical = vertical;
}
public boolean isBold() {
return isBold;
}
public void setBold(boolean bold) {
isBold = bold;
}
public boolean isBorder() {
return isBorder;
}
public void setBorder(boolean border) {
isBorder = border;
}
public short getFontSize() {
return fontSize;
}
public void setFontSize(short fontSize) {
this.fontSize = fontSize;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
}
| UTF-8 | Java | 1,755 | java | ExcelStyle.java | Java | [
{
"context": "i.ss.usermodel.VerticalAlignment;\n\n/**\n * @Auther: lht\n * @Date: 2018/12/27 16:54\n * @Description:\n */\np",
"end": 164,
"score": 0.9996018409729004,
"start": 161,
"tag": "USERNAME",
"value": "lht"
}
]
| null | []
| package com.custom.by.lht.excel;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
/**
* @Auther: lht
* @Date: 2018/12/27 16:54
* @Description:
*/
public class ExcelStyle {
//位置(居中、右、左) 居中
private HorizontalAlignment horizontal = HorizontalAlignment.CENTER ;
private VerticalAlignment vertical = VerticalAlignment.CENTER;
//是否加粗
private boolean isBold=false;
//是否加框
private boolean isBorder = true;
//字体大小
private short fontSize = 12;
//字体
private String fontName = "黑体";
//宽度
private int width=0;
public String getFontName() {
return fontName;
}
public void setFontName(String fontName) {
this.fontName = fontName;
}
public HorizontalAlignment getHorizontal() {
return horizontal;
}
public void setHorizontal(HorizontalAlignment horizontal) {
this.horizontal = horizontal;
}
public VerticalAlignment getVertical() {
return vertical;
}
public void setVertical(VerticalAlignment vertical) {
this.vertical = vertical;
}
public boolean isBold() {
return isBold;
}
public void setBold(boolean bold) {
isBold = bold;
}
public boolean isBorder() {
return isBorder;
}
public void setBorder(boolean border) {
isBorder = border;
}
public short getFontSize() {
return fontSize;
}
public void setFontSize(short fontSize) {
this.fontSize = fontSize;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
}
| 1,755 | 0.633038 | 0.624189 | 82 | 19.670732 | 18.602423 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.292683 | false | false | 2 |
0e2867bd81e65f588f4962f2825c4e35e4ff9e09 | 4,002,909,524,931 | 59f1677f51052073bd40e253673fef17b656ffc1 | /problem1.java | bf82c41e350f071d11ab2b0f74669aa5e625e702 | []
| no_license | larasilva/HackerEarth | https://github.com/larasilva/HackerEarth | c89b791aaa0b5f72425a1dfadd312f84fe3cc866 | f96a9105a64cd980fd03021139b9db82c9b8d26a | refs/heads/master | 2016-09-05T16:39:28.639000 | 2015-07-01T20:43:31 | 2015-07-01T20:43:31 | 38,393,954 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
class TestClass {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
int N = Integer.parseInt(line);
ArrayList <Integer> vamp = new ArrayList<Integer>();
ArrayList <Integer> zombie = new ArrayList<Integer>();
String [] numb = br.readLine().split(" ");
for (int i = 0; i < N; i++) {
Integer power = Integer.parseInt(numb[i]);
if (power%2 == 0){
zombie.add(power);
}
else{
vamp.add(power);
}
}
Collections.sort(vamp);
Collections.sort(zombie);
Integer zombiePower = 0;
for (Integer j:zombie){
System.out.print(j+" ");
zombiePower +=j;
}
System.out.print(zombiePower+" ");
Integer vampPower = 0;
for (Integer k:vamp){
System.out.print(k+" ");
vampPower +=k;
}
System.out.print(vampPower);
}
}
| UTF-8 | Java | 1,269 | java | problem1.java | Java | []
| null | []
| import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
class TestClass {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
int N = Integer.parseInt(line);
ArrayList <Integer> vamp = new ArrayList<Integer>();
ArrayList <Integer> zombie = new ArrayList<Integer>();
String [] numb = br.readLine().split(" ");
for (int i = 0; i < N; i++) {
Integer power = Integer.parseInt(numb[i]);
if (power%2 == 0){
zombie.add(power);
}
else{
vamp.add(power);
}
}
Collections.sort(vamp);
Collections.sort(zombie);
Integer zombiePower = 0;
for (Integer j:zombie){
System.out.print(j+" ");
zombiePower +=j;
}
System.out.print(zombiePower+" ");
Integer vampPower = 0;
for (Integer k:vamp){
System.out.print(k+" ");
vampPower +=k;
}
System.out.print(vampPower);
}
}
| 1,269 | 0.520883 | 0.516943 | 46 | 26.586956 | 18.677557 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.543478 | false | false | 2 |
b067e9869faaa4883a644cc2f20cf22f7765a10e | 35,631,048,735,549 | 49fcf94e5f0d5c5a33b0563570a4548bd5ac23fb | /src/Player.java | 1be47f0b652edfd9aedcbecb1dee1a5ba57f11d3 | []
| no_license | onokatio/2world | https://github.com/onokatio/2world | a090d55737a96903595c91802aa0d5e97c627785 | d74576ca96052622b4bd168c71ce1ae462341bb0 | refs/heads/master | 2020-05-09T21:15:35.254000 | 2019-04-15T07:40:58 | 2019-04-15T07:40:58 | 181,436,801 | 0 | 0 | null | false | 2019-11-22T16:03:14 | 2019-04-15T07:40:18 | 2019-04-15T07:41:21 | 2019-11-22T16:03:12 | 12 | 0 | 0 | 1 | AngelScript | false | false | import javax.swing.*;
import java.awt.*;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
public class Player{
int x = 0;
int y = 0;
int z = 0;
String name;
Player(String name){
this.name = name;
}
void move(int x,int y){
this.x = x;
this.y = y;
}
void move(int x,int y,int z){
this.z = z;
}
void repaint(Graphics g){
g.setColor(Color.black);
g.drowRect(this.x, this.y, 16, 16);
g.fillRect(this.x+2, this.y+2, 4, 4);
g.fillRect(this.x+8, this.y+8, 4, 4);
// drow.dot(g,Player.x,Player.y);
}
}
| UTF-8 | Java | 589 | java | Player.java | Java | []
| null | []
| import javax.swing.*;
import java.awt.*;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
public class Player{
int x = 0;
int y = 0;
int z = 0;
String name;
Player(String name){
this.name = name;
}
void move(int x,int y){
this.x = x;
this.y = y;
}
void move(int x,int y,int z){
this.z = z;
}
void repaint(Graphics g){
g.setColor(Color.black);
g.drowRect(this.x, this.y, 16, 16);
g.fillRect(this.x+2, this.y+2, 4, 4);
g.fillRect(this.x+8, this.y+8, 4, 4);
// drow.dot(g,Player.x,Player.y);
}
}
| 589 | 0.595925 | 0.570458 | 31 | 18 | 12.451195 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.032258 | false | false | 2 |
2a39ccfc3376487fd0dbd736f05c6cdae25e4a8a | 35,631,048,733,060 | a691e1a89f6b9b6b3577898e321d987db21cba5d | /src/test/java/kakao/pay/test/invest/impl/jpa/InternalInvestRepositoryTest.java | 442245f0fc6b452b6e0c863311a2902a634f0e62 | []
| no_license | JeHuiPark/kakao-pay-test | https://github.com/JeHuiPark/kakao-pay-test | 1208b0cd4fb2ce9e6126f10523ec1af18e5325b4 | c17901a3252b2ed5819970dbaa7849b9d9953c59 | refs/heads/master | 2023-04-05T13:34:13.178000 | 2021-04-19T00:53:35 | 2021-04-19T00:53:35 | 359,054,288 | 0 | 0 | null | false | 2021-04-18T23:26:37 | 2021-04-18T05:36:16 | 2021-04-18T20:09:35 | 2021-04-18T23:26:37 | 170 | 0 | 0 | 0 | Java | false | false | package kakao.pay.test.invest.impl.jpa;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.OffsetDateTime;
import kakao.pay.test.invest.interfaces.InvestPeriod;
import kakao.pay.test.invest.interfaces.InvestProductType;
import kakao.pay.test.invest.interfaces.InvestingCommand;
import kakao.pay.test.invest.interfaces.ProductInvestor;
import kakao.pay.test.invest.interfaces.ProductInvestorUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.Import;
/**
* @see InternalInvestRepository
*/
@DisplayName("InternalInvestRepositoryTest")
class InternalInvestRepositoryTest {
@Import(InternalInvestRepository.class)
@DataJpaTest
private static class InternalInvestRepositoryTestContext extends PreparedInvestmentProductTestContext {
@Autowired
InvestmentReceiptRepository investmentReceiptRepository;
@Autowired
ProductInvestmentLogRepository productInvestmentLogRepository;
@Autowired
InternalInvestRepository internalInvestRepository;
@Override
InvestPeriod preparedProductPeriod() {
return new InvestPeriod(
OffsetDateTime.now().minusDays(1),
OffsetDateTime.now().plusDays(1));
}
@Override
long preparedProductTotalInvestingAmount() {
return 10_000_000;
}
}
static abstract class SaveInvestProductReceiptTestContext extends InternalInvestRepositoryTestContext {
InvestmentProduct subject(InvestmentReceipt given) {
internalInvestRepository.saveInvestProductReceipt(given);
return investmentProductRepository.findById(given.productId()).orElseThrow();
}
@BeforeEach
private void setupContext() {
if (preparedProductInvestor() == null) {
return;
}
var investmentReceipt = preparedProduct.invest(
InvestingCommand.builder()
.productInvestor(preparedProductInvestor())
.amount(500_000L)
.build()
);
internalInvestRepository.saveInvestProductReceipt(investmentReceipt);
}
abstract ProductInvestor preparedProductInvestor();
InvestmentReceipt given(InvestingCommand investingCommand) {
return preparedProduct.invest(investingCommand);
}
}
@Nested
@DisplayName("saveInvestProductReceipt")
class Describe_saveInvestProductReceipt {
@Nested
@DisplayName("투자정보가 기록된 적이 없으면")
class Context_case1 extends SaveInvestProductReceiptTestContext {
@Override
ProductInvestor preparedProductInvestor() {
return ProductInvestorUtil.build(preparedProduct.productId(), 1);
}
@Test
@DisplayName("총 투자자수와 투자금액을 집계합니다")
void test2() {
var actual = subject(
given(
InvestingCommand.builder()
.productInvestor(ProductInvestorUtil.build(preparedProduct.productId(), 2))
.amount(10_000L)
.build()
)
);
assertEquals(500_000 + 10_000, actual.accumulatedInvestingAmount());
assertEquals(2, actual.investorCount());
}
}
@Nested
@DisplayName("투자정보가 기록된 적이 있으면")
class Context_case2 extends SaveInvestProductReceiptTestContext {
@Override
ProductInvestor preparedProductInvestor() {
return ProductInvestorUtil.build(preparedProduct.productId(), 3);
}
@Test
@DisplayName("투자금액만 집계합니다")
void test3() {
var actual = subject(
given(
InvestingCommand.builder()
.productInvestor(preparedProductInvestor())
.amount(10_000L)
.build()
)
);
assertEquals(500_000 + 10_000, actual.accumulatedInvestingAmount());
assertEquals(1, actual.investorCount());
}
}
}
@Nested
@DisplayName("findById")
class Describe_findById {
@Nested
@DisplayName("주어진 ID와 일치하는 투자상품이 있으면")
class Context_case1 extends InternalInvestRepositoryTestContext {
@Test
@DisplayName("상품정보를 리턴한다")
void test5() {
var actual = internalInvestRepository.findById(preparedProduct.productId());
assertTrue(actual.isPresent());
}
}
@Nested
@DisplayName("주어진 ID와 일치하는 투자상품이 없으면")
class Context_case2 extends InternalInvestRepositoryTestContext {
@Test
@DisplayName("빈 값을 리턴한다")
void test6() {
var actual = internalInvestRepository.findById(-999);
assertTrue(actual.isEmpty());
}
}
}
}
| UTF-8 | Java | 5,060 | java | InternalInvestRepositoryTest.java | Java | []
| null | []
| package kakao.pay.test.invest.impl.jpa;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.OffsetDateTime;
import kakao.pay.test.invest.interfaces.InvestPeriod;
import kakao.pay.test.invest.interfaces.InvestProductType;
import kakao.pay.test.invest.interfaces.InvestingCommand;
import kakao.pay.test.invest.interfaces.ProductInvestor;
import kakao.pay.test.invest.interfaces.ProductInvestorUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.Import;
/**
* @see InternalInvestRepository
*/
@DisplayName("InternalInvestRepositoryTest")
class InternalInvestRepositoryTest {
@Import(InternalInvestRepository.class)
@DataJpaTest
private static class InternalInvestRepositoryTestContext extends PreparedInvestmentProductTestContext {
@Autowired
InvestmentReceiptRepository investmentReceiptRepository;
@Autowired
ProductInvestmentLogRepository productInvestmentLogRepository;
@Autowired
InternalInvestRepository internalInvestRepository;
@Override
InvestPeriod preparedProductPeriod() {
return new InvestPeriod(
OffsetDateTime.now().minusDays(1),
OffsetDateTime.now().plusDays(1));
}
@Override
long preparedProductTotalInvestingAmount() {
return 10_000_000;
}
}
static abstract class SaveInvestProductReceiptTestContext extends InternalInvestRepositoryTestContext {
InvestmentProduct subject(InvestmentReceipt given) {
internalInvestRepository.saveInvestProductReceipt(given);
return investmentProductRepository.findById(given.productId()).orElseThrow();
}
@BeforeEach
private void setupContext() {
if (preparedProductInvestor() == null) {
return;
}
var investmentReceipt = preparedProduct.invest(
InvestingCommand.builder()
.productInvestor(preparedProductInvestor())
.amount(500_000L)
.build()
);
internalInvestRepository.saveInvestProductReceipt(investmentReceipt);
}
abstract ProductInvestor preparedProductInvestor();
InvestmentReceipt given(InvestingCommand investingCommand) {
return preparedProduct.invest(investingCommand);
}
}
@Nested
@DisplayName("saveInvestProductReceipt")
class Describe_saveInvestProductReceipt {
@Nested
@DisplayName("투자정보가 기록된 적이 없으면")
class Context_case1 extends SaveInvestProductReceiptTestContext {
@Override
ProductInvestor preparedProductInvestor() {
return ProductInvestorUtil.build(preparedProduct.productId(), 1);
}
@Test
@DisplayName("총 투자자수와 투자금액을 집계합니다")
void test2() {
var actual = subject(
given(
InvestingCommand.builder()
.productInvestor(ProductInvestorUtil.build(preparedProduct.productId(), 2))
.amount(10_000L)
.build()
)
);
assertEquals(500_000 + 10_000, actual.accumulatedInvestingAmount());
assertEquals(2, actual.investorCount());
}
}
@Nested
@DisplayName("투자정보가 기록된 적이 있으면")
class Context_case2 extends SaveInvestProductReceiptTestContext {
@Override
ProductInvestor preparedProductInvestor() {
return ProductInvestorUtil.build(preparedProduct.productId(), 3);
}
@Test
@DisplayName("투자금액만 집계합니다")
void test3() {
var actual = subject(
given(
InvestingCommand.builder()
.productInvestor(preparedProductInvestor())
.amount(10_000L)
.build()
)
);
assertEquals(500_000 + 10_000, actual.accumulatedInvestingAmount());
assertEquals(1, actual.investorCount());
}
}
}
@Nested
@DisplayName("findById")
class Describe_findById {
@Nested
@DisplayName("주어진 ID와 일치하는 투자상품이 있으면")
class Context_case1 extends InternalInvestRepositoryTestContext {
@Test
@DisplayName("상품정보를 리턴한다")
void test5() {
var actual = internalInvestRepository.findById(preparedProduct.productId());
assertTrue(actual.isPresent());
}
}
@Nested
@DisplayName("주어진 ID와 일치하는 투자상품이 없으면")
class Context_case2 extends InternalInvestRepositoryTestContext {
@Test
@DisplayName("빈 값을 리턴한다")
void test6() {
var actual = internalInvestRepository.findById(-999);
assertTrue(actual.isEmpty());
}
}
}
}
| 5,060 | 0.6893 | 0.676132 | 168 | 27.928572 | 25.727642 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 2 |
f5bde46b86580e148750cf464afafa4a4aad79c7 | 23,699,629,553,291 | 52d6a4324aa175aa77f7de9f265c12db3482d02d | /Inheritance - Animal/src/Bat.java | 6fb0003e383745f74496a85e35df791d7a56818b | []
| no_license | MrGeorgeZhu/Animal-Inheritance | https://github.com/MrGeorgeZhu/Animal-Inheritance | 2d36f40b5ae72e53c3f5d58240a75ba5688507d2 | ffb176be6efb6fdb4cb2d732611222cd01c71491 | refs/heads/master | 2021-06-25T03:49:19.878000 | 2017-08-12T05:26:49 | 2017-08-12T05:26:49 | 100,091,242 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Bat extends Mammal
{
public Bat()
{
name = "bat";
food = "insects";
myFlightBehavior= (FlightBehavior) new CanFly();
}
@Override
public void makesNoise()
{
System.out.println("The " + name + " emits an ultrasonic pulse.");
}
}
| UTF-8 | Java | 266 | java | Bat.java | Java | [
{
"context": "Bat extends Mammal\n\t{\n\tpublic Bat()\n\t\t{\n\t\tname = \"bat\";\n\t\tfood = \"insects\";\n\t\tmyFlightBehavior= (Flight",
"end": 67,
"score": 0.8749459385871887,
"start": 64,
"tag": "NAME",
"value": "bat"
}
]
| null | []
|
public class Bat extends Mammal
{
public Bat()
{
name = "bat";
food = "insects";
myFlightBehavior= (FlightBehavior) new CanFly();
}
@Override
public void makesNoise()
{
System.out.println("The " + name + " emits an ultrasonic pulse.");
}
}
| 266 | 0.62406 | 0.62406 | 15 | 16.533333 | 19.400572 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.666667 | false | false | 2 |
9d602c69cc8360191a39afc47a0fbd22078e2624 | 37,263,136,287,672 | e7b17c17eb44c95f6c5244a02849235e9b1d71f8 | /src/main/java/com/chiefdata/engy/service/RTmnlTrafficService.java | 719fabf3f02d64288f3de10c9402e5f5c7f2a123 | []
| no_license | HZ00M/chiefdata-engy | https://github.com/HZ00M/chiefdata-engy | e248934f04cb1a7aaad723ed452bd7ff6940417f | 3dfbd9cf2884c154ba035a312e585f2201d8e9cf | refs/heads/master | 2020-07-18T08:59:52.039000 | 2019-11-05T07:50:59 | 2019-11-05T07:50:59 | 206,207,460 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chiefdata.engy.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chiefdata.engy.entity.RTmnlTraffic;
import com.chiefdata.engy.entity.Result;
public interface RTmnlTrafficService {
Result add(RTmnlTraffic rTmnlTraffic);
Result query(RTmnlTraffic rTmnlTraffic);
Result queryByPage(Page page);
Result update(RTmnlTraffic rTmnlTraffic);
Result delete(RTmnlTraffic rTmnlTraffic);
}
| UTF-8 | Java | 453 | java | RTmnlTrafficService.java | Java | []
| null | []
| package com.chiefdata.engy.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chiefdata.engy.entity.RTmnlTraffic;
import com.chiefdata.engy.entity.Result;
public interface RTmnlTrafficService {
Result add(RTmnlTraffic rTmnlTraffic);
Result query(RTmnlTraffic rTmnlTraffic);
Result queryByPage(Page page);
Result update(RTmnlTraffic rTmnlTraffic);
Result delete(RTmnlTraffic rTmnlTraffic);
}
| 453 | 0.79691 | 0.79691 | 17 | 25.647058 | 22.315758 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false | 2 |
90c2f6289a444ea3a9f51884a74e7e51418fa3d3 | 39,247,411,160,267 | d883f3b07e5a19ff8c6eb9c3a4b03d9f910f27b2 | /Tools/OracleJavaGen/src/main/resources/oracle_service_project/OracleDataService/src/main/java/com/sandata/lab/rest/oracle/model/AuthorizationService.java | 1b70f76ef31a8ea42c7114a24d20573d5fd47f3c | []
| no_license | dev0psunleashed/Sandata_SampleDemo | https://github.com/dev0psunleashed/Sandata_SampleDemo | ec2c1f79988e129a21c6ddf376ac572485843b04 | a1818601c59b04e505e45e33a36e98a27a69bc39 | refs/heads/master | 2021-01-25T12:31:30.026000 | 2017-02-20T11:49:37 | 2017-02-20T11:49:37 | 82,551,409 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.11.27 at 10:53:27 PM EST
//
package com.sandata.lab.rest.oracle.model;
import com.sandata.lab.data.model.*;
import com.google.gson.annotations.SerializedName;
import com.sandata.lab.data.model.base.BaseObject;
import com.sandata.lab.data.model.dl.annotation.Mapping;
import com.sandata.lab.data.model.dl.annotation.OracleMetadata;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* Defines a many-to-many relationship between the Authorization and Service entities.
*
* <p>Java class for Authorization_Service complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Authorization_Service">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="Authorization_Service_SK" use="required" type="{}Surrogate_Key" />
* <attribute name="Record_Create_Timestamp" use="required" type="{}Record_Create_Timestamp" />
* <attribute name="Record_Update_Timestamp" use="required" type="{}Record_Update_Timestamp" />
* <attribute name="Change_Version_ID" use="required" type="{}Change_Version_ID" />
* <attribute name="Authorization_SK" use="required" type="{}Surrogate_Key" />
* <attribute name="Business_Entity_ID" use="required" type="{}ID" />
* <attribute name="Service_Name" use="required" type="{}Service_Name" />
* <attribute name="Billing_Code" type="{}Billing_Code" />
* <attribute name="Rate_Type_Name" type="{}Rate_Type_Name" />
* <attribute name="Rate_Qualifier_Code" type="{}Rate_Qualifier_Code" />
* <attribute name="Authorization_Service_Rate_Amount" type="{}Money" />
* <attribute name="Authorization_Service_Start_Date" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
* <attribute name="Authorization_Service_End_Date" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
* <attribute name="Authorization_Limit_Type_Name" type="{}Authorization_Limit_Type_Name" />
* <attribute name="Authorization_Service_Unit_Name" use="required" type="{}Authorization_Service_Unit_Name" />
* <attribute name="Authorization_Service_Limit" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Day_1" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_1" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_1" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_2" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_2" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_2" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_3" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_3" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_3" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_4" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_4" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_4" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_5" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_5" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_5" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_6" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_6" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_6" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_7" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_7" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_7" type="{}Authorization_Limit_Time" />
* <attribute name="Payer_ID" type="{}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Authorization_Service")
@OracleMetadata(
packageName = "PKG_AUTH",
insertMethod = "insertAuthSvc",
updateMethod = "updateAuthSvc",
deleteMethod = "deleteAuthSvc",
getMethod = "getAuthSvc",
findMethod = "NotDefined_FindMethod",
jpubClass = "com.sandata.lab.data.model.jpub.model.AuthSvcT",
primaryKeys = {})
public class AuthorizationService extends BaseObject {
private static final long serialVersionUID = 1L;
@XmlAttribute(name = "Authorization_Service_SK", required = true)
@SerializedName("AuthorizationServiceSK")
@Mapping(getter = "getAuthSvcSk", setter = "setAuthSvcSk", type = "java.math.BigDecimal", index = 0)
protected BigInteger authorizationServiceSK;
@XmlAttribute(name = "Record_Create_Timestamp", required = true)
@SerializedName("RecordCreateTimestamp")
@XmlJavaTypeAdapter(Adapter1 .class)
@Mapping(getter = "getRecCreateTmstp", setter = "setRecCreateTmstp", type = "java.sql.Timestamp", index = 1)
protected Date recordCreateTimestamp;
@XmlAttribute(name = "Record_Update_Timestamp", required = true)
@SerializedName("RecordUpdateTimestamp")
@XmlJavaTypeAdapter(Adapter1 .class)
@Mapping(getter = "getRecUpdateTmstp", setter = "setRecUpdateTmstp", type = "java.sql.Timestamp", index = 2)
protected Date recordUpdateTimestamp;
@XmlAttribute(name = "Change_Version_ID", required = true)
@SerializedName("ChangeVersionID")
@Mapping(getter = "getChangeVersionId", setter = "setChangeVersionId", type = "java.math.BigDecimal", index = 3)
protected BigInteger changeVersionID;
@XmlAttribute(name = "Authorization_SK", required = true)
@SerializedName("AuthorizationSK")
@Mapping(getter = "getAuthSk", setter = "setAuthSk", type = "java.math.BigDecimal", index = 4)
protected BigInteger authorizationSK;
@XmlAttribute(name = "Business_Entity_ID", required = true)
@SerializedName("BusinessEntityID")
@Mapping(getter = "getBeId", setter = "setBeId", type = "String", index = 5)
protected String businessEntityID;
@XmlAttribute(name = "Service_Name", required = true)
@SerializedName("ServiceName")
@Mapping(getter = "getSvcName", setter = "setSvcName", type = "String", index = 6)
protected ServiceName serviceName;
@XmlAttribute(name = "Billing_Code")
@SerializedName("BillingCode")
@Mapping(getter = "getBillingCode", setter = "setBillingCode", type = "String", index = 7)
protected String billingCode;
@XmlAttribute(name = "Rate_Type_Name")
@SerializedName("RateTypeName")
@Mapping(getter = "getRateTypName", setter = "setRateTypName", type = "String", index = 8)
protected String rateTypeName;
@XmlAttribute(name = "Rate_Qualifier_Code")
@SerializedName("RateQualifierCode")
@Mapping(getter = "getRateQlfrCode", setter = "setRateQlfrCode", type = "String", index = 9)
protected RateQualifierCode rateQualifierCode;
@XmlAttribute(name = "Authorization_Service_Rate_Amount")
@SerializedName("AuthorizationServiceRateAmount")
@Mapping(getter = "getAuthSvcRateAmt", setter = "setAuthSvcRateAmt", type = "java.math.BigDecimal", index = 10)
protected BigDecimal authorizationServiceRateAmount;
@XmlAttribute(name = "Authorization_Service_Start_Date", required = true)
@SerializedName("AuthorizationServiceStartDate")
@XmlJavaTypeAdapter(Adapter2 .class)
@XmlSchemaType(name = "date")
@Mapping(getter = "getAuthSvcStartDate", setter = "setAuthSvcStartDate", type = "java.sql.Timestamp", index = 11)
protected Date authorizationServiceStartDate;
@XmlAttribute(name = "Authorization_Service_End_Date", required = true)
@SerializedName("AuthorizationServiceEndDate")
@XmlJavaTypeAdapter(Adapter2 .class)
@XmlSchemaType(name = "date")
@Mapping(getter = "getAuthSvcEndDate", setter = "setAuthSvcEndDate", type = "java.sql.Timestamp", index = 12)
protected Date authorizationServiceEndDate;
@XmlAttribute(name = "Authorization_Limit_Type_Name")
@SerializedName("AuthorizationLimitTypeName")
@Mapping(getter = "getAuthLmtTypName", setter = "setAuthLmtTypName", type = "String", index = 13)
protected AuthorizationLimitTypeName authorizationLimitTypeName;
@XmlAttribute(name = "Authorization_Service_Unit_Name", required = true)
@SerializedName("AuthorizationServiceUnitName")
@Mapping(getter = "getAuthSvcUnitName", setter = "setAuthSvcUnitName", type = "String", index = 14)
protected AuthorizationServiceUnitName authorizationServiceUnitName;
@XmlAttribute(name = "Authorization_Service_Limit")
@SerializedName("AuthorizationServiceLimit")
@Mapping(getter = "getAuthSvcLmt", setter = "setAuthSvcLmt", type = "java.math.BigDecimal", index = 15)
protected BigDecimal authorizationServiceLimit;
@XmlAttribute(name = "Authorization_Service_Limit_Day_1")
@SerializedName("AuthorizationServiceLimitDay1")
@Mapping(getter = "getAuthSvcLmtDay1", setter = "setAuthSvcLmtDay1", type = "java.math.BigDecimal", index = 16)
protected BigDecimal authorizationServiceLimitDay1;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_1")
@SerializedName("AuthorizationServiceLimitStartTimeDay1")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay1", setter = "setAuthSvcLmtStartTimeDay1", type = "java.sql.Timestamp", index = 17)
protected Date authorizationServiceLimitStartTimeDay1;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_1")
@SerializedName("AuthorizationServiceLimitEndTimeDay1")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay1", setter = "setAuthSvcLmtEndTimeDay1", type = "java.sql.Timestamp", index = 18)
protected Date authorizationServiceLimitEndTimeDay1;
@XmlAttribute(name = "Authorization_Service_Limit_Day_2")
@SerializedName("AuthorizationServiceLimitDay2")
@Mapping(getter = "getAuthSvcLmtDay2", setter = "setAuthSvcLmtDay2", type = "java.math.BigDecimal", index = 19)
protected BigDecimal authorizationServiceLimitDay2;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_2")
@SerializedName("AuthorizationServiceLimitStartTimeDay2")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay2", setter = "setAuthSvcLmtStartTimeDay2", type = "java.sql.Timestamp", index = 20)
protected Date authorizationServiceLimitStartTimeDay2;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_2")
@SerializedName("AuthorizationServiceLimitEndTimeDay2")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay2", setter = "setAuthSvcLmtEndTimeDay2", type = "java.sql.Timestamp", index = 21)
protected Date authorizationServiceLimitEndTimeDay2;
@XmlAttribute(name = "Authorization_Service_Limit_Day_3")
@SerializedName("AuthorizationServiceLimitDay3")
@Mapping(getter = "getAuthSvcLmtDay3", setter = "setAuthSvcLmtDay3", type = "java.math.BigDecimal", index = 22)
protected BigDecimal authorizationServiceLimitDay3;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_3")
@SerializedName("AuthorizationServiceLimitStartTimeDay3")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay3", setter = "setAuthSvcLmtStartTimeDay3", type = "java.sql.Timestamp", index = 23)
protected Date authorizationServiceLimitStartTimeDay3;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_3")
@SerializedName("AuthorizationServiceLimitEndTimeDay3")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay3", setter = "setAuthSvcLmtEndTimeDay3", type = "java.sql.Timestamp", index = 24)
protected Date authorizationServiceLimitEndTimeDay3;
@XmlAttribute(name = "Authorization_Service_Limit_Day_4")
@SerializedName("AuthorizationServiceLimitDay4")
@Mapping(getter = "getAuthSvcLmtDay4", setter = "setAuthSvcLmtDay4", type = "java.math.BigDecimal", index = 25)
protected BigDecimal authorizationServiceLimitDay4;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_4")
@SerializedName("AuthorizationServiceLimitStartTimeDay4")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay4", setter = "setAuthSvcLmtStartTimeDay4", type = "java.sql.Timestamp", index = 26)
protected Date authorizationServiceLimitStartTimeDay4;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_4")
@SerializedName("AuthorizationServiceLimitEndTimeDay4")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay4", setter = "setAuthSvcLmtEndTimeDay4", type = "java.sql.Timestamp", index = 27)
protected Date authorizationServiceLimitEndTimeDay4;
@XmlAttribute(name = "Authorization_Service_Limit_Day_5")
@SerializedName("AuthorizationServiceLimitDay5")
@Mapping(getter = "getAuthSvcLmtDay5", setter = "setAuthSvcLmtDay5", type = "java.math.BigDecimal", index = 28)
protected BigDecimal authorizationServiceLimitDay5;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_5")
@SerializedName("AuthorizationServiceLimitStartTimeDay5")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay5", setter = "setAuthSvcLmtStartTimeDay5", type = "java.sql.Timestamp", index = 29)
protected Date authorizationServiceLimitStartTimeDay5;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_5")
@SerializedName("AuthorizationServiceLimitEndTimeDay5")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay5", setter = "setAuthSvcLmtEndTimeDay5", type = "java.sql.Timestamp", index = 30)
protected Date authorizationServiceLimitEndTimeDay5;
@XmlAttribute(name = "Authorization_Service_Limit_Day_6")
@SerializedName("AuthorizationServiceLimitDay6")
@Mapping(getter = "getAuthSvcLmtDay6", setter = "setAuthSvcLmtDay6", type = "java.math.BigDecimal", index = 31)
protected BigDecimal authorizationServiceLimitDay6;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_6")
@SerializedName("AuthorizationServiceLimitStartTimeDay6")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay6", setter = "setAuthSvcLmtStartTimeDay6", type = "java.sql.Timestamp", index = 32)
protected Date authorizationServiceLimitStartTimeDay6;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_6")
@SerializedName("AuthorizationServiceLimitEndTimeDay6")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay6", setter = "setAuthSvcLmtEndTimeDay6", type = "java.sql.Timestamp", index = 33)
protected Date authorizationServiceLimitEndTimeDay6;
@XmlAttribute(name = "Authorization_Service_Limit_Day_7")
@SerializedName("AuthorizationServiceLimitDay7")
@Mapping(getter = "getAuthSvcLmtDay7", setter = "setAuthSvcLmtDay7", type = "java.math.BigDecimal", index = 34)
protected BigDecimal authorizationServiceLimitDay7;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_7")
@SerializedName("AuthorizationServiceLimitStartTimeDay7")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay7", setter = "setAuthSvcLmtStartTimeDay7", type = "java.sql.Timestamp", index = 35)
protected Date authorizationServiceLimitStartTimeDay7;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_7")
@SerializedName("AuthorizationServiceLimitEndTimeDay7")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay7", setter = "setAuthSvcLmtEndTimeDay7", type = "java.sql.Timestamp", index = 36)
protected Date authorizationServiceLimitEndTimeDay7;
@XmlAttribute(name = "Payer_ID")
@SerializedName("PayerID")
@Mapping(getter = "getPayerId", setter = "setPayerId", type = "String", index = 37)
protected String payerID;
/**
* Gets the value of the authorizationServiceSK property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAuthorizationServiceSK() {
return authorizationServiceSK;
}
/**
* Sets the value of the authorizationServiceSK property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAuthorizationServiceSK(BigInteger value) {
this.authorizationServiceSK = value;
}
/**
* Gets the value of the recordCreateTimestamp property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getRecordCreateTimestamp() {
return recordCreateTimestamp;
}
/**
* Sets the value of the recordCreateTimestamp property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRecordCreateTimestamp(Date value) {
this.recordCreateTimestamp = value;
}
/**
* Gets the value of the recordUpdateTimestamp property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getRecordUpdateTimestamp() {
return recordUpdateTimestamp;
}
/**
* Sets the value of the recordUpdateTimestamp property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRecordUpdateTimestamp(Date value) {
this.recordUpdateTimestamp = value;
}
/**
* Gets the value of the changeVersionID property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getChangeVersionID() {
return changeVersionID;
}
/**
* Sets the value of the changeVersionID property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setChangeVersionID(BigInteger value) {
this.changeVersionID = value;
}
/**
* Gets the value of the authorizationSK property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAuthorizationSK() {
return authorizationSK;
}
/**
* Sets the value of the authorizationSK property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAuthorizationSK(BigInteger value) {
this.authorizationSK = value;
}
/**
* Gets the value of the businessEntityID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBusinessEntityID() {
return businessEntityID;
}
/**
* Sets the value of the businessEntityID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBusinessEntityID(String value) {
this.businessEntityID = value;
}
/**
* Gets the value of the serviceName property.
*
* @return
* possible object is
* {@link ServiceName }
*
*/
public ServiceName getServiceName() {
return serviceName;
}
/**
* Sets the value of the serviceName property.
*
* @param value
* allowed object is
* {@link ServiceName }
*
*/
public void setServiceName(ServiceName value) {
this.serviceName = value;
}
/**
* Gets the value of the billingCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingCode() {
return billingCode;
}
/**
* Sets the value of the billingCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingCode(String value) {
this.billingCode = value;
}
/**
* Gets the value of the rateTypeName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRateTypeName() {
return rateTypeName;
}
/**
* Sets the value of the rateTypeName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRateTypeName(String value) {
this.rateTypeName = value;
}
/**
* Gets the value of the rateQualifierCode property.
*
* @return
* possible object is
* {@link RateQualifierCode }
*
*/
public RateQualifierCode getRateQualifierCode() {
return rateQualifierCode;
}
/**
* Sets the value of the rateQualifierCode property.
*
* @param value
* allowed object is
* {@link RateQualifierCode }
*
*/
public void setRateQualifierCode(RateQualifierCode value) {
this.rateQualifierCode = value;
}
/**
* Gets the value of the authorizationServiceRateAmount property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceRateAmount() {
return authorizationServiceRateAmount;
}
/**
* Sets the value of the authorizationServiceRateAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceRateAmount(BigDecimal value) {
this.authorizationServiceRateAmount = value;
}
/**
* Gets the value of the authorizationServiceStartDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceStartDate() {
return authorizationServiceStartDate;
}
/**
* Sets the value of the authorizationServiceStartDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceStartDate(Date value) {
this.authorizationServiceStartDate = value;
}
/**
* Gets the value of the authorizationServiceEndDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceEndDate() {
return authorizationServiceEndDate;
}
/**
* Sets the value of the authorizationServiceEndDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceEndDate(Date value) {
this.authorizationServiceEndDate = value;
}
/**
* Gets the value of the authorizationLimitTypeName property.
*
* @return
* possible object is
* {@link AuthorizationLimitTypeName }
*
*/
public AuthorizationLimitTypeName getAuthorizationLimitTypeName() {
return authorizationLimitTypeName;
}
/**
* Sets the value of the authorizationLimitTypeName property.
*
* @param value
* allowed object is
* {@link AuthorizationLimitTypeName }
*
*/
public void setAuthorizationLimitTypeName(AuthorizationLimitTypeName value) {
this.authorizationLimitTypeName = value;
}
/**
* Gets the value of the authorizationServiceUnitName property.
*
* @return
* possible object is
* {@link AuthorizationServiceUnitName }
*
*/
public AuthorizationServiceUnitName getAuthorizationServiceUnitName() {
return authorizationServiceUnitName;
}
/**
* Sets the value of the authorizationServiceUnitName property.
*
* @param value
* allowed object is
* {@link AuthorizationServiceUnitName }
*
*/
public void setAuthorizationServiceUnitName(AuthorizationServiceUnitName value) {
this.authorizationServiceUnitName = value;
}
/**
* Gets the value of the authorizationServiceLimit property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimit() {
return authorizationServiceLimit;
}
/**
* Sets the value of the authorizationServiceLimit property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimit(BigDecimal value) {
this.authorizationServiceLimit = value;
}
/**
* Gets the value of the authorizationServiceLimitDay1 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay1() {
return authorizationServiceLimitDay1;
}
/**
* Sets the value of the authorizationServiceLimitDay1 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay1(BigDecimal value) {
this.authorizationServiceLimitDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay1() {
return authorizationServiceLimitStartTimeDay1;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay1(Date value) {
this.authorizationServiceLimitStartTimeDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay1() {
return authorizationServiceLimitEndTimeDay1;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay1(Date value) {
this.authorizationServiceLimitEndTimeDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay2 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay2() {
return authorizationServiceLimitDay2;
}
/**
* Sets the value of the authorizationServiceLimitDay2 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay2(BigDecimal value) {
this.authorizationServiceLimitDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay2() {
return authorizationServiceLimitStartTimeDay2;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay2(Date value) {
this.authorizationServiceLimitStartTimeDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay2() {
return authorizationServiceLimitEndTimeDay2;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay2(Date value) {
this.authorizationServiceLimitEndTimeDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay3 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay3() {
return authorizationServiceLimitDay3;
}
/**
* Sets the value of the authorizationServiceLimitDay3 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay3(BigDecimal value) {
this.authorizationServiceLimitDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay3() {
return authorizationServiceLimitStartTimeDay3;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay3(Date value) {
this.authorizationServiceLimitStartTimeDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay3() {
return authorizationServiceLimitEndTimeDay3;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay3(Date value) {
this.authorizationServiceLimitEndTimeDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay4 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay4() {
return authorizationServiceLimitDay4;
}
/**
* Sets the value of the authorizationServiceLimitDay4 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay4(BigDecimal value) {
this.authorizationServiceLimitDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay4() {
return authorizationServiceLimitStartTimeDay4;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay4(Date value) {
this.authorizationServiceLimitStartTimeDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay4() {
return authorizationServiceLimitEndTimeDay4;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay4(Date value) {
this.authorizationServiceLimitEndTimeDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay5 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay5() {
return authorizationServiceLimitDay5;
}
/**
* Sets the value of the authorizationServiceLimitDay5 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay5(BigDecimal value) {
this.authorizationServiceLimitDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay5() {
return authorizationServiceLimitStartTimeDay5;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay5(Date value) {
this.authorizationServiceLimitStartTimeDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay5() {
return authorizationServiceLimitEndTimeDay5;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay5(Date value) {
this.authorizationServiceLimitEndTimeDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay6 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay6() {
return authorizationServiceLimitDay6;
}
/**
* Sets the value of the authorizationServiceLimitDay6 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay6(BigDecimal value) {
this.authorizationServiceLimitDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay6() {
return authorizationServiceLimitStartTimeDay6;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay6(Date value) {
this.authorizationServiceLimitStartTimeDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay6() {
return authorizationServiceLimitEndTimeDay6;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay6(Date value) {
this.authorizationServiceLimitEndTimeDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay7 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay7() {
return authorizationServiceLimitDay7;
}
/**
* Sets the value of the authorizationServiceLimitDay7 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay7(BigDecimal value) {
this.authorizationServiceLimitDay7 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay7() {
return authorizationServiceLimitStartTimeDay7;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay7(Date value) {
this.authorizationServiceLimitStartTimeDay7 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay7() {
return authorizationServiceLimitEndTimeDay7;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay7(Date value) {
this.authorizationServiceLimitEndTimeDay7 = value;
}
/**
* Gets the value of the payerID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPayerID() {
return payerID;
}
/**
* Sets the value of the payerID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPayerID(String value) {
this.payerID = value;
}
}
| UTF-8 | Java | 39,871 | java | AuthorizationService.java | Java | []
| null | []
| //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.11.27 at 10:53:27 PM EST
//
package com.sandata.lab.rest.oracle.model;
import com.sandata.lab.data.model.*;
import com.google.gson.annotations.SerializedName;
import com.sandata.lab.data.model.base.BaseObject;
import com.sandata.lab.data.model.dl.annotation.Mapping;
import com.sandata.lab.data.model.dl.annotation.OracleMetadata;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* Defines a many-to-many relationship between the Authorization and Service entities.
*
* <p>Java class for Authorization_Service complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Authorization_Service">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="Authorization_Service_SK" use="required" type="{}Surrogate_Key" />
* <attribute name="Record_Create_Timestamp" use="required" type="{}Record_Create_Timestamp" />
* <attribute name="Record_Update_Timestamp" use="required" type="{}Record_Update_Timestamp" />
* <attribute name="Change_Version_ID" use="required" type="{}Change_Version_ID" />
* <attribute name="Authorization_SK" use="required" type="{}Surrogate_Key" />
* <attribute name="Business_Entity_ID" use="required" type="{}ID" />
* <attribute name="Service_Name" use="required" type="{}Service_Name" />
* <attribute name="Billing_Code" type="{}Billing_Code" />
* <attribute name="Rate_Type_Name" type="{}Rate_Type_Name" />
* <attribute name="Rate_Qualifier_Code" type="{}Rate_Qualifier_Code" />
* <attribute name="Authorization_Service_Rate_Amount" type="{}Money" />
* <attribute name="Authorization_Service_Start_Date" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
* <attribute name="Authorization_Service_End_Date" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
* <attribute name="Authorization_Limit_Type_Name" type="{}Authorization_Limit_Type_Name" />
* <attribute name="Authorization_Service_Unit_Name" use="required" type="{}Authorization_Service_Unit_Name" />
* <attribute name="Authorization_Service_Limit" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Day_1" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_1" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_1" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_2" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_2" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_2" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_3" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_3" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_3" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_4" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_4" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_4" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_5" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_5" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_5" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_6" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_6" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_6" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_Day_7" type="{}Authorization_Limit" />
* <attribute name="Authorization_Service_Limit_Start_Time_Day_7" type="{}Authorization_Limit_Time" />
* <attribute name="Authorization_Service_Limit_End_Time_Day_7" type="{}Authorization_Limit_Time" />
* <attribute name="Payer_ID" type="{}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Authorization_Service")
@OracleMetadata(
packageName = "PKG_AUTH",
insertMethod = "insertAuthSvc",
updateMethod = "updateAuthSvc",
deleteMethod = "deleteAuthSvc",
getMethod = "getAuthSvc",
findMethod = "NotDefined_FindMethod",
jpubClass = "com.sandata.lab.data.model.jpub.model.AuthSvcT",
primaryKeys = {})
public class AuthorizationService extends BaseObject {
private static final long serialVersionUID = 1L;
@XmlAttribute(name = "Authorization_Service_SK", required = true)
@SerializedName("AuthorizationServiceSK")
@Mapping(getter = "getAuthSvcSk", setter = "setAuthSvcSk", type = "java.math.BigDecimal", index = 0)
protected BigInteger authorizationServiceSK;
@XmlAttribute(name = "Record_Create_Timestamp", required = true)
@SerializedName("RecordCreateTimestamp")
@XmlJavaTypeAdapter(Adapter1 .class)
@Mapping(getter = "getRecCreateTmstp", setter = "setRecCreateTmstp", type = "java.sql.Timestamp", index = 1)
protected Date recordCreateTimestamp;
@XmlAttribute(name = "Record_Update_Timestamp", required = true)
@SerializedName("RecordUpdateTimestamp")
@XmlJavaTypeAdapter(Adapter1 .class)
@Mapping(getter = "getRecUpdateTmstp", setter = "setRecUpdateTmstp", type = "java.sql.Timestamp", index = 2)
protected Date recordUpdateTimestamp;
@XmlAttribute(name = "Change_Version_ID", required = true)
@SerializedName("ChangeVersionID")
@Mapping(getter = "getChangeVersionId", setter = "setChangeVersionId", type = "java.math.BigDecimal", index = 3)
protected BigInteger changeVersionID;
@XmlAttribute(name = "Authorization_SK", required = true)
@SerializedName("AuthorizationSK")
@Mapping(getter = "getAuthSk", setter = "setAuthSk", type = "java.math.BigDecimal", index = 4)
protected BigInteger authorizationSK;
@XmlAttribute(name = "Business_Entity_ID", required = true)
@SerializedName("BusinessEntityID")
@Mapping(getter = "getBeId", setter = "setBeId", type = "String", index = 5)
protected String businessEntityID;
@XmlAttribute(name = "Service_Name", required = true)
@SerializedName("ServiceName")
@Mapping(getter = "getSvcName", setter = "setSvcName", type = "String", index = 6)
protected ServiceName serviceName;
@XmlAttribute(name = "Billing_Code")
@SerializedName("BillingCode")
@Mapping(getter = "getBillingCode", setter = "setBillingCode", type = "String", index = 7)
protected String billingCode;
@XmlAttribute(name = "Rate_Type_Name")
@SerializedName("RateTypeName")
@Mapping(getter = "getRateTypName", setter = "setRateTypName", type = "String", index = 8)
protected String rateTypeName;
@XmlAttribute(name = "Rate_Qualifier_Code")
@SerializedName("RateQualifierCode")
@Mapping(getter = "getRateQlfrCode", setter = "setRateQlfrCode", type = "String", index = 9)
protected RateQualifierCode rateQualifierCode;
@XmlAttribute(name = "Authorization_Service_Rate_Amount")
@SerializedName("AuthorizationServiceRateAmount")
@Mapping(getter = "getAuthSvcRateAmt", setter = "setAuthSvcRateAmt", type = "java.math.BigDecimal", index = 10)
protected BigDecimal authorizationServiceRateAmount;
@XmlAttribute(name = "Authorization_Service_Start_Date", required = true)
@SerializedName("AuthorizationServiceStartDate")
@XmlJavaTypeAdapter(Adapter2 .class)
@XmlSchemaType(name = "date")
@Mapping(getter = "getAuthSvcStartDate", setter = "setAuthSvcStartDate", type = "java.sql.Timestamp", index = 11)
protected Date authorizationServiceStartDate;
@XmlAttribute(name = "Authorization_Service_End_Date", required = true)
@SerializedName("AuthorizationServiceEndDate")
@XmlJavaTypeAdapter(Adapter2 .class)
@XmlSchemaType(name = "date")
@Mapping(getter = "getAuthSvcEndDate", setter = "setAuthSvcEndDate", type = "java.sql.Timestamp", index = 12)
protected Date authorizationServiceEndDate;
@XmlAttribute(name = "Authorization_Limit_Type_Name")
@SerializedName("AuthorizationLimitTypeName")
@Mapping(getter = "getAuthLmtTypName", setter = "setAuthLmtTypName", type = "String", index = 13)
protected AuthorizationLimitTypeName authorizationLimitTypeName;
@XmlAttribute(name = "Authorization_Service_Unit_Name", required = true)
@SerializedName("AuthorizationServiceUnitName")
@Mapping(getter = "getAuthSvcUnitName", setter = "setAuthSvcUnitName", type = "String", index = 14)
protected AuthorizationServiceUnitName authorizationServiceUnitName;
@XmlAttribute(name = "Authorization_Service_Limit")
@SerializedName("AuthorizationServiceLimit")
@Mapping(getter = "getAuthSvcLmt", setter = "setAuthSvcLmt", type = "java.math.BigDecimal", index = 15)
protected BigDecimal authorizationServiceLimit;
@XmlAttribute(name = "Authorization_Service_Limit_Day_1")
@SerializedName("AuthorizationServiceLimitDay1")
@Mapping(getter = "getAuthSvcLmtDay1", setter = "setAuthSvcLmtDay1", type = "java.math.BigDecimal", index = 16)
protected BigDecimal authorizationServiceLimitDay1;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_1")
@SerializedName("AuthorizationServiceLimitStartTimeDay1")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay1", setter = "setAuthSvcLmtStartTimeDay1", type = "java.sql.Timestamp", index = 17)
protected Date authorizationServiceLimitStartTimeDay1;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_1")
@SerializedName("AuthorizationServiceLimitEndTimeDay1")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay1", setter = "setAuthSvcLmtEndTimeDay1", type = "java.sql.Timestamp", index = 18)
protected Date authorizationServiceLimitEndTimeDay1;
@XmlAttribute(name = "Authorization_Service_Limit_Day_2")
@SerializedName("AuthorizationServiceLimitDay2")
@Mapping(getter = "getAuthSvcLmtDay2", setter = "setAuthSvcLmtDay2", type = "java.math.BigDecimal", index = 19)
protected BigDecimal authorizationServiceLimitDay2;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_2")
@SerializedName("AuthorizationServiceLimitStartTimeDay2")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay2", setter = "setAuthSvcLmtStartTimeDay2", type = "java.sql.Timestamp", index = 20)
protected Date authorizationServiceLimitStartTimeDay2;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_2")
@SerializedName("AuthorizationServiceLimitEndTimeDay2")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay2", setter = "setAuthSvcLmtEndTimeDay2", type = "java.sql.Timestamp", index = 21)
protected Date authorizationServiceLimitEndTimeDay2;
@XmlAttribute(name = "Authorization_Service_Limit_Day_3")
@SerializedName("AuthorizationServiceLimitDay3")
@Mapping(getter = "getAuthSvcLmtDay3", setter = "setAuthSvcLmtDay3", type = "java.math.BigDecimal", index = 22)
protected BigDecimal authorizationServiceLimitDay3;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_3")
@SerializedName("AuthorizationServiceLimitStartTimeDay3")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay3", setter = "setAuthSvcLmtStartTimeDay3", type = "java.sql.Timestamp", index = 23)
protected Date authorizationServiceLimitStartTimeDay3;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_3")
@SerializedName("AuthorizationServiceLimitEndTimeDay3")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay3", setter = "setAuthSvcLmtEndTimeDay3", type = "java.sql.Timestamp", index = 24)
protected Date authorizationServiceLimitEndTimeDay3;
@XmlAttribute(name = "Authorization_Service_Limit_Day_4")
@SerializedName("AuthorizationServiceLimitDay4")
@Mapping(getter = "getAuthSvcLmtDay4", setter = "setAuthSvcLmtDay4", type = "java.math.BigDecimal", index = 25)
protected BigDecimal authorizationServiceLimitDay4;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_4")
@SerializedName("AuthorizationServiceLimitStartTimeDay4")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay4", setter = "setAuthSvcLmtStartTimeDay4", type = "java.sql.Timestamp", index = 26)
protected Date authorizationServiceLimitStartTimeDay4;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_4")
@SerializedName("AuthorizationServiceLimitEndTimeDay4")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay4", setter = "setAuthSvcLmtEndTimeDay4", type = "java.sql.Timestamp", index = 27)
protected Date authorizationServiceLimitEndTimeDay4;
@XmlAttribute(name = "Authorization_Service_Limit_Day_5")
@SerializedName("AuthorizationServiceLimitDay5")
@Mapping(getter = "getAuthSvcLmtDay5", setter = "setAuthSvcLmtDay5", type = "java.math.BigDecimal", index = 28)
protected BigDecimal authorizationServiceLimitDay5;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_5")
@SerializedName("AuthorizationServiceLimitStartTimeDay5")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay5", setter = "setAuthSvcLmtStartTimeDay5", type = "java.sql.Timestamp", index = 29)
protected Date authorizationServiceLimitStartTimeDay5;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_5")
@SerializedName("AuthorizationServiceLimitEndTimeDay5")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay5", setter = "setAuthSvcLmtEndTimeDay5", type = "java.sql.Timestamp", index = 30)
protected Date authorizationServiceLimitEndTimeDay5;
@XmlAttribute(name = "Authorization_Service_Limit_Day_6")
@SerializedName("AuthorizationServiceLimitDay6")
@Mapping(getter = "getAuthSvcLmtDay6", setter = "setAuthSvcLmtDay6", type = "java.math.BigDecimal", index = 31)
protected BigDecimal authorizationServiceLimitDay6;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_6")
@SerializedName("AuthorizationServiceLimitStartTimeDay6")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay6", setter = "setAuthSvcLmtStartTimeDay6", type = "java.sql.Timestamp", index = 32)
protected Date authorizationServiceLimitStartTimeDay6;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_6")
@SerializedName("AuthorizationServiceLimitEndTimeDay6")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay6", setter = "setAuthSvcLmtEndTimeDay6", type = "java.sql.Timestamp", index = 33)
protected Date authorizationServiceLimitEndTimeDay6;
@XmlAttribute(name = "Authorization_Service_Limit_Day_7")
@SerializedName("AuthorizationServiceLimitDay7")
@Mapping(getter = "getAuthSvcLmtDay7", setter = "setAuthSvcLmtDay7", type = "java.math.BigDecimal", index = 34)
protected BigDecimal authorizationServiceLimitDay7;
@XmlAttribute(name = "Authorization_Service_Limit_Start_Time_Day_7")
@SerializedName("AuthorizationServiceLimitStartTimeDay7")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtStartTimeDay7", setter = "setAuthSvcLmtStartTimeDay7", type = "java.sql.Timestamp", index = 35)
protected Date authorizationServiceLimitStartTimeDay7;
@XmlAttribute(name = "Authorization_Service_Limit_End_Time_Day_7")
@SerializedName("AuthorizationServiceLimitEndTimeDay7")
@XmlJavaTypeAdapter(Adapter3 .class)
@Mapping(getter = "getAuthSvcLmtEndTimeDay7", setter = "setAuthSvcLmtEndTimeDay7", type = "java.sql.Timestamp", index = 36)
protected Date authorizationServiceLimitEndTimeDay7;
@XmlAttribute(name = "Payer_ID")
@SerializedName("PayerID")
@Mapping(getter = "getPayerId", setter = "setPayerId", type = "String", index = 37)
protected String payerID;
/**
* Gets the value of the authorizationServiceSK property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAuthorizationServiceSK() {
return authorizationServiceSK;
}
/**
* Sets the value of the authorizationServiceSK property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAuthorizationServiceSK(BigInteger value) {
this.authorizationServiceSK = value;
}
/**
* Gets the value of the recordCreateTimestamp property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getRecordCreateTimestamp() {
return recordCreateTimestamp;
}
/**
* Sets the value of the recordCreateTimestamp property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRecordCreateTimestamp(Date value) {
this.recordCreateTimestamp = value;
}
/**
* Gets the value of the recordUpdateTimestamp property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getRecordUpdateTimestamp() {
return recordUpdateTimestamp;
}
/**
* Sets the value of the recordUpdateTimestamp property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRecordUpdateTimestamp(Date value) {
this.recordUpdateTimestamp = value;
}
/**
* Gets the value of the changeVersionID property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getChangeVersionID() {
return changeVersionID;
}
/**
* Sets the value of the changeVersionID property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setChangeVersionID(BigInteger value) {
this.changeVersionID = value;
}
/**
* Gets the value of the authorizationSK property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAuthorizationSK() {
return authorizationSK;
}
/**
* Sets the value of the authorizationSK property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAuthorizationSK(BigInteger value) {
this.authorizationSK = value;
}
/**
* Gets the value of the businessEntityID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBusinessEntityID() {
return businessEntityID;
}
/**
* Sets the value of the businessEntityID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBusinessEntityID(String value) {
this.businessEntityID = value;
}
/**
* Gets the value of the serviceName property.
*
* @return
* possible object is
* {@link ServiceName }
*
*/
public ServiceName getServiceName() {
return serviceName;
}
/**
* Sets the value of the serviceName property.
*
* @param value
* allowed object is
* {@link ServiceName }
*
*/
public void setServiceName(ServiceName value) {
this.serviceName = value;
}
/**
* Gets the value of the billingCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingCode() {
return billingCode;
}
/**
* Sets the value of the billingCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingCode(String value) {
this.billingCode = value;
}
/**
* Gets the value of the rateTypeName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRateTypeName() {
return rateTypeName;
}
/**
* Sets the value of the rateTypeName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRateTypeName(String value) {
this.rateTypeName = value;
}
/**
* Gets the value of the rateQualifierCode property.
*
* @return
* possible object is
* {@link RateQualifierCode }
*
*/
public RateQualifierCode getRateQualifierCode() {
return rateQualifierCode;
}
/**
* Sets the value of the rateQualifierCode property.
*
* @param value
* allowed object is
* {@link RateQualifierCode }
*
*/
public void setRateQualifierCode(RateQualifierCode value) {
this.rateQualifierCode = value;
}
/**
* Gets the value of the authorizationServiceRateAmount property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceRateAmount() {
return authorizationServiceRateAmount;
}
/**
* Sets the value of the authorizationServiceRateAmount property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceRateAmount(BigDecimal value) {
this.authorizationServiceRateAmount = value;
}
/**
* Gets the value of the authorizationServiceStartDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceStartDate() {
return authorizationServiceStartDate;
}
/**
* Sets the value of the authorizationServiceStartDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceStartDate(Date value) {
this.authorizationServiceStartDate = value;
}
/**
* Gets the value of the authorizationServiceEndDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceEndDate() {
return authorizationServiceEndDate;
}
/**
* Sets the value of the authorizationServiceEndDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceEndDate(Date value) {
this.authorizationServiceEndDate = value;
}
/**
* Gets the value of the authorizationLimitTypeName property.
*
* @return
* possible object is
* {@link AuthorizationLimitTypeName }
*
*/
public AuthorizationLimitTypeName getAuthorizationLimitTypeName() {
return authorizationLimitTypeName;
}
/**
* Sets the value of the authorizationLimitTypeName property.
*
* @param value
* allowed object is
* {@link AuthorizationLimitTypeName }
*
*/
public void setAuthorizationLimitTypeName(AuthorizationLimitTypeName value) {
this.authorizationLimitTypeName = value;
}
/**
* Gets the value of the authorizationServiceUnitName property.
*
* @return
* possible object is
* {@link AuthorizationServiceUnitName }
*
*/
public AuthorizationServiceUnitName getAuthorizationServiceUnitName() {
return authorizationServiceUnitName;
}
/**
* Sets the value of the authorizationServiceUnitName property.
*
* @param value
* allowed object is
* {@link AuthorizationServiceUnitName }
*
*/
public void setAuthorizationServiceUnitName(AuthorizationServiceUnitName value) {
this.authorizationServiceUnitName = value;
}
/**
* Gets the value of the authorizationServiceLimit property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimit() {
return authorizationServiceLimit;
}
/**
* Sets the value of the authorizationServiceLimit property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimit(BigDecimal value) {
this.authorizationServiceLimit = value;
}
/**
* Gets the value of the authorizationServiceLimitDay1 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay1() {
return authorizationServiceLimitDay1;
}
/**
* Sets the value of the authorizationServiceLimitDay1 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay1(BigDecimal value) {
this.authorizationServiceLimitDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay1() {
return authorizationServiceLimitStartTimeDay1;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay1(Date value) {
this.authorizationServiceLimitStartTimeDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay1() {
return authorizationServiceLimitEndTimeDay1;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay1(Date value) {
this.authorizationServiceLimitEndTimeDay1 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay2 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay2() {
return authorizationServiceLimitDay2;
}
/**
* Sets the value of the authorizationServiceLimitDay2 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay2(BigDecimal value) {
this.authorizationServiceLimitDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay2() {
return authorizationServiceLimitStartTimeDay2;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay2(Date value) {
this.authorizationServiceLimitStartTimeDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay2() {
return authorizationServiceLimitEndTimeDay2;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay2(Date value) {
this.authorizationServiceLimitEndTimeDay2 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay3 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay3() {
return authorizationServiceLimitDay3;
}
/**
* Sets the value of the authorizationServiceLimitDay3 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay3(BigDecimal value) {
this.authorizationServiceLimitDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay3() {
return authorizationServiceLimitStartTimeDay3;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay3(Date value) {
this.authorizationServiceLimitStartTimeDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay3() {
return authorizationServiceLimitEndTimeDay3;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay3(Date value) {
this.authorizationServiceLimitEndTimeDay3 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay4 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay4() {
return authorizationServiceLimitDay4;
}
/**
* Sets the value of the authorizationServiceLimitDay4 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay4(BigDecimal value) {
this.authorizationServiceLimitDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay4() {
return authorizationServiceLimitStartTimeDay4;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay4(Date value) {
this.authorizationServiceLimitStartTimeDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay4() {
return authorizationServiceLimitEndTimeDay4;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay4(Date value) {
this.authorizationServiceLimitEndTimeDay4 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay5 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay5() {
return authorizationServiceLimitDay5;
}
/**
* Sets the value of the authorizationServiceLimitDay5 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay5(BigDecimal value) {
this.authorizationServiceLimitDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay5() {
return authorizationServiceLimitStartTimeDay5;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay5(Date value) {
this.authorizationServiceLimitStartTimeDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay5() {
return authorizationServiceLimitEndTimeDay5;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay5(Date value) {
this.authorizationServiceLimitEndTimeDay5 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay6 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay6() {
return authorizationServiceLimitDay6;
}
/**
* Sets the value of the authorizationServiceLimitDay6 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay6(BigDecimal value) {
this.authorizationServiceLimitDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay6() {
return authorizationServiceLimitStartTimeDay6;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay6(Date value) {
this.authorizationServiceLimitStartTimeDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay6() {
return authorizationServiceLimitEndTimeDay6;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay6(Date value) {
this.authorizationServiceLimitEndTimeDay6 = value;
}
/**
* Gets the value of the authorizationServiceLimitDay7 property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getAuthorizationServiceLimitDay7() {
return authorizationServiceLimitDay7;
}
/**
* Sets the value of the authorizationServiceLimitDay7 property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setAuthorizationServiceLimitDay7(BigDecimal value) {
this.authorizationServiceLimitDay7 = value;
}
/**
* Gets the value of the authorizationServiceLimitStartTimeDay7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitStartTimeDay7() {
return authorizationServiceLimitStartTimeDay7;
}
/**
* Sets the value of the authorizationServiceLimitStartTimeDay7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitStartTimeDay7(Date value) {
this.authorizationServiceLimitStartTimeDay7 = value;
}
/**
* Gets the value of the authorizationServiceLimitEndTimeDay7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public Date getAuthorizationServiceLimitEndTimeDay7() {
return authorizationServiceLimitEndTimeDay7;
}
/**
* Sets the value of the authorizationServiceLimitEndTimeDay7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthorizationServiceLimitEndTimeDay7(Date value) {
this.authorizationServiceLimitEndTimeDay7 = value;
}
/**
* Gets the value of the payerID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPayerID() {
return payerID;
}
/**
* Sets the value of the payerID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPayerID(String value) {
this.payerID = value;
}
}
| 39,871 | 0.653758 | 0.644253 | 1,185 | 32.646412 | 30.107891 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.291139 | false | false | 2 |
546595f8f39468a421d7e3dcf18409b020e696ff | 22,093,311,830,467 | 9302c28575acae45a2f9081b108c9132a5f31802 | /LibraryManagementSystem/src/main/java/com/library/management/service/UserService.java | fbbf6bf963c52dc5073e9c936c9da0375a5baaa4 | []
| no_license | NapsterJane/LibraryManagement | https://github.com/NapsterJane/LibraryManagement | b9828c650637d0e94c457a18e55886af6092b197 | d49f990090c2f62afefaff2a6c41d55a60277b66 | refs/heads/master | 2022-12-19T00:47:09.462000 | 2020-09-27T15:17:13 | 2020-09-27T15:17:13 | 299,058,284 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.library.management.service;
import javax.transaction.Transactional;
import org.springframework.stereotype.Service;
import com.library.management.entity.Users;
@Service
@Transactional
public interface UserService {
Users saveNewUser(Users user);
}
| UTF-8 | Java | 266 | java | UserService.java | Java | []
| null | []
| package com.library.management.service;
import javax.transaction.Transactional;
import org.springframework.stereotype.Service;
import com.library.management.entity.Users;
@Service
@Transactional
public interface UserService {
Users saveNewUser(Users user);
}
| 266 | 0.819549 | 0.819549 | 15 | 16.733334 | 18.127205 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 2 |
b7a0ba5c36b3d06a3ca6c218bcdb4e318e49c68f | 34,462,817,638,798 | d01abdeb56562e7e45bd6b98096148907cba5476 | /src/main/java/com/ciin/pos/printer/Printer.java | e99ce0d71f1f88abeefa1fc6c53869b2c8c6d5ec | [
"Apache-2.0"
]
| permissive | housong12590/escpos | https://github.com/housong12590/escpos | 8eada36005df4d2cdad535911696ca08bb4b11d2 | f5e59b17d775e1b36fd6cb0be4d70bec973d89e3 | refs/heads/master | 2022-12-10T06:44:13.442000 | 2022-02-18T01:15:05 | 2022-02-18T01:15:05 | 186,653,521 | 4 | 0 | Apache-2.0 | false | 2022-11-16T09:31:28 | 2019-05-14T15:46:36 | 2022-02-18T01:06:37 | 2022-11-16T09:31:24 | 523 | 2 | 0 | 4 | Java | false | false | package com.ciin.pos.printer;
import com.ciin.pos.device.Device;
import com.ciin.pos.listener.OnPrinterListener;
import java.util.List;
public interface Printer {
/**
* 获取打印机设备信息
*/
Device getDevice();
/**
* 设置打印机名字
*/
void setPrinterName(String printerName);
/**
* 获取打印机名字
*/
String getPrinterName();
/**
* 获取打印机所有任务列表
*/
List<PrintTask> getPrintTasks();
/**
* 从打印队列中取消一个打印任务
*
* @param taskId 任务ID
*/
void cancel(String taskId);
/**
* 清空打印任务列表
*/
void clear();
/**
* 获取打印纸宽度
*/
int getPaperWidth();
/**
* 添加一个打印任务
*
* @param printTask 打印任务
*/
void print(PrintTask printTask);
/**
* 添加到打印队列的最前端
*
* @param printTask 打印任务
* @param first 为true时添加到队列的最前端,为false时则在最后
*/
void print(PrintTask printTask, boolean first);
/**
* 同步打印
*/
PrintResult syncPrint(PrintTask printTask);
/**
* 同步测试打印
*/
PrintResult syncTestPrint();
/**
* 测试打印
*/
void testPrint();
/**
* 设置打印机蜂蜜声
*/
void buzzer(boolean buzzer);
/**
* 是否有蜂鸣声
*/
boolean isBuzzer();
/**
* 设置打印机错误回调
*/
void addPrinterListener(OnPrinterListener printerListener);
/**
* 移除打印机错误回调
*/
void removePrinterListener(OnPrinterListener printerListener);
/**
* 开启保持打印
*/
void setEnabledKeepPrint(boolean enabled);
/**
* 获取打印时间间隔
*/
long getIntervalTime();
/**
* 设置打印时间间隔
*/
void setIntervalTime(long intervalTime);
/**
* 初始化打印列表
*/
void initPrintTasks(List<PrintTask> printTasks);
/**
* 备用打印机
*/
void setBackupPrinter(Printer printer);
/**
* 打印机是否可用
*/
boolean available();
/**
* 关闭打印机
*/
void close();
}
| UTF-8 | Java | 2,326 | java | Printer.java | Java | []
| null | []
| package com.ciin.pos.printer;
import com.ciin.pos.device.Device;
import com.ciin.pos.listener.OnPrinterListener;
import java.util.List;
public interface Printer {
/**
* 获取打印机设备信息
*/
Device getDevice();
/**
* 设置打印机名字
*/
void setPrinterName(String printerName);
/**
* 获取打印机名字
*/
String getPrinterName();
/**
* 获取打印机所有任务列表
*/
List<PrintTask> getPrintTasks();
/**
* 从打印队列中取消一个打印任务
*
* @param taskId 任务ID
*/
void cancel(String taskId);
/**
* 清空打印任务列表
*/
void clear();
/**
* 获取打印纸宽度
*/
int getPaperWidth();
/**
* 添加一个打印任务
*
* @param printTask 打印任务
*/
void print(PrintTask printTask);
/**
* 添加到打印队列的最前端
*
* @param printTask 打印任务
* @param first 为true时添加到队列的最前端,为false时则在最后
*/
void print(PrintTask printTask, boolean first);
/**
* 同步打印
*/
PrintResult syncPrint(PrintTask printTask);
/**
* 同步测试打印
*/
PrintResult syncTestPrint();
/**
* 测试打印
*/
void testPrint();
/**
* 设置打印机蜂蜜声
*/
void buzzer(boolean buzzer);
/**
* 是否有蜂鸣声
*/
boolean isBuzzer();
/**
* 设置打印机错误回调
*/
void addPrinterListener(OnPrinterListener printerListener);
/**
* 移除打印机错误回调
*/
void removePrinterListener(OnPrinterListener printerListener);
/**
* 开启保持打印
*/
void setEnabledKeepPrint(boolean enabled);
/**
* 获取打印时间间隔
*/
long getIntervalTime();
/**
* 设置打印时间间隔
*/
void setIntervalTime(long intervalTime);
/**
* 初始化打印列表
*/
void initPrintTasks(List<PrintTask> printTasks);
/**
* 备用打印机
*/
void setBackupPrinter(Printer printer);
/**
* 打印机是否可用
*/
boolean available();
/**
* 关闭打印机
*/
void close();
}
| 2,326 | 0.529106 | 0.529106 | 131 | 13.687023 | 14.356467 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.221374 | false | false | 2 |
f998a9a597a68f376691b040052f13bde7582441 | 39,530,879,014,171 | b22ce3f486a013947721c0f7936f50c6a5976a16 | /ftsp_android_client/tags/ftsp_android_clientv2.3.0.136406/common_library/src/main/java/com/kungeek/android/ftsp/common/ftspapi/apis/SdpQymhglApi.java | a5937699a95b13ecae1f4754aa7d7e40e42de9ef | []
| no_license | NeXtyin/kgcode | https://github.com/NeXtyin/kgcode | 8073c3e8465b0fce91a7fad77f82cefc58c0dc7f | 000f4caf87a038bc57ab01d75516b8b4355ef0d3 | refs/heads/master | 2018-09-10T01:52:27.219000 | 2018-06-05T07:02:11 | 2018-06-05T07:02:11 | 136,038,325 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kungeek.android.ftsp.common.ftspapi.apis;
import com.kungeek.android.ftsp.common.bean.infra.FtspInfraCodeValue;
import com.kungeek.android.ftsp.common.bean.qyfw.FtspQyfwAreaVO;
import com.kungeek.android.ftsp.common.bean.qyfw.FtspQyfwSbApplyVO;
import com.kungeek.android.ftsp.common.ftspapi.BaseFtspApiHelper;
import com.kungeek.android.ftsp.common.ftspapi.FtspApiConfig;
import com.kungeek.android.ftsp.common.ftspapi.exceptions.FtspApiException;
import com.kungeek.android.ftsp.utils.JsonUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 社保类型管理相关API。
* 企业服务地区维护管理相关API。
*
* @author changweiliang@kungeek.com
* @version v2.0.0
*/
public class SdpQymhglApi extends BaseFtspApiHelper {
/**
*
* @return
* @throws FtspApiException FtspApiException
*/
public List<FtspInfraCodeValue> listAvailableBlx() throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_SBLX_LISTAVAILABLESBLX;
return postSapBean4List(apiUrl, null, FtspInfraCodeValue.class);
}
/**
*
* @param parentCode
* @param type
* @return
* @throws FtspApiException FtspApiException
*/
public List<FtspQyfwAreaVO> listAreaByParent(String parentCode, String type)
throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_DQWH_LISTAREABYPARENT;
Map<String, String> param = new HashMap<>();
param.put("parentCode", parentCode);
param.put("type", type);
return postSapBean4List(apiUrl, param, FtspQyfwAreaVO.class);
}
/**
*
* @param ztZtxxId
* @param ftspQyfwSbApplyVO
* @return
* @throws FtspApiException FtspApiException
*/
public boolean insertSbApply(String ztZtxxId, FtspQyfwSbApplyVO ftspQyfwSbApplyVO) throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_APPLY_INSERTSBAPPLY;
Map<String, String> params = new HashMap<>();
params.put("ztZtxxId", ztZtxxId);
params.put("ftspQyfwSbApply", JsonUtil.toJson(ftspQyfwSbApplyVO));
return postForSapBeanIsSuccess(apiUrl, params);
}
}
| UTF-8 | Java | 2,198 | java | SdpQymhglApi.java | Java | [
{
"context": "\n * 社保类型管理相关API。\n * 企业服务地区维护管理相关API。\n *\n * @author changweiliang@kungeek.com\n * @version v2.0.0\n */\npublic class SdpQymhglApi ",
"end": 662,
"score": 0.999921441078186,
"start": 637,
"tag": "EMAIL",
"value": "changweiliang@kungeek.com"
}
]
| null | []
| package com.kungeek.android.ftsp.common.ftspapi.apis;
import com.kungeek.android.ftsp.common.bean.infra.FtspInfraCodeValue;
import com.kungeek.android.ftsp.common.bean.qyfw.FtspQyfwAreaVO;
import com.kungeek.android.ftsp.common.bean.qyfw.FtspQyfwSbApplyVO;
import com.kungeek.android.ftsp.common.ftspapi.BaseFtspApiHelper;
import com.kungeek.android.ftsp.common.ftspapi.FtspApiConfig;
import com.kungeek.android.ftsp.common.ftspapi.exceptions.FtspApiException;
import com.kungeek.android.ftsp.utils.JsonUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 社保类型管理相关API。
* 企业服务地区维护管理相关API。
*
* @author <EMAIL>
* @version v2.0.0
*/
public class SdpQymhglApi extends BaseFtspApiHelper {
/**
*
* @return
* @throws FtspApiException FtspApiException
*/
public List<FtspInfraCodeValue> listAvailableBlx() throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_SBLX_LISTAVAILABLESBLX;
return postSapBean4List(apiUrl, null, FtspInfraCodeValue.class);
}
/**
*
* @param parentCode
* @param type
* @return
* @throws FtspApiException FtspApiException
*/
public List<FtspQyfwAreaVO> listAreaByParent(String parentCode, String type)
throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_DQWH_LISTAREABYPARENT;
Map<String, String> param = new HashMap<>();
param.put("parentCode", parentCode);
param.put("type", type);
return postSapBean4List(apiUrl, param, FtspQyfwAreaVO.class);
}
/**
*
* @param ztZtxxId
* @param ftspQyfwSbApplyVO
* @return
* @throws FtspApiException FtspApiException
*/
public boolean insertSbApply(String ztZtxxId, FtspQyfwSbApplyVO ftspQyfwSbApplyVO) throws FtspApiException {
String apiUrl = FtspApiConfig.SDP_QYMHGL_APPLY_INSERTSBAPPLY;
Map<String, String> params = new HashMap<>();
params.put("ztZtxxId", ztZtxxId);
params.put("ftspQyfwSbApply", JsonUtil.toJson(ftspQyfwSbApplyVO));
return postForSapBeanIsSuccess(apiUrl, params);
}
}
| 2,180 | 0.71402 | 0.711699 | 66 | 31.636364 | 28.361111 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 2 |
cacdac31d5877b5d377a72b6a56c119eb08c60ba | 26,731,876,470,601 | bb70faa7915d7070527406051015f55b2130022c | /src/main/java/com/sura/arl/estadocuenta/modelo/DatosAdicionalesTasa.java | d0d5be1929fc9a403516a75077017d510916ffe0 | []
| no_license | juanpanore/reproceso_migra | https://github.com/juanpanore/reproceso_migra | 07bcb3cb30eef798c10b9ef412e88ef3e7200f7e | 37fe9282511fbef9c7f1c0aafe024a3dfa55338c | refs/heads/master | 2020-07-03T22:01:49.275000 | 2019-08-13T04:34:22 | 2019-08-13T04:34:22 | 202,064,868 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sura.arl.estadocuenta.modelo;
public class DatosAdicionalesTasa {
private String centroTrabajo;
private String centroTrabajoPagador;
public String getCentroTrabajo() {
return centroTrabajo;
}
public void setCentroTrabajo(String centroTrabajo) {
this.centroTrabajo = centroTrabajo;
}
public String getCentroTrabajoPagador() {
return centroTrabajoPagador;
}
public void setCentroTrabajoPagador(String centroTrabajoPagador) {
this.centroTrabajoPagador = centroTrabajoPagador;
}
}
| UTF-8 | Java | 569 | java | DatosAdicionalesTasa.java | Java | []
| null | []
| package com.sura.arl.estadocuenta.modelo;
public class DatosAdicionalesTasa {
private String centroTrabajo;
private String centroTrabajoPagador;
public String getCentroTrabajo() {
return centroTrabajo;
}
public void setCentroTrabajo(String centroTrabajo) {
this.centroTrabajo = centroTrabajo;
}
public String getCentroTrabajoPagador() {
return centroTrabajoPagador;
}
public void setCentroTrabajoPagador(String centroTrabajoPagador) {
this.centroTrabajoPagador = centroTrabajoPagador;
}
}
| 569 | 0.72232 | 0.72232 | 25 | 21.76 | 22.448662 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28 | false | false | 2 |
82ea2c98e710c22dc479c25b7a60c3dacc7b8f84 | 8,461,085,598,786 | d0a63049de5219407189e0f833b2b715e374d51a | /tree/NodeKDistanceFomLeaf.java | c05ada09a717db3486fcab3e91500671d72e957b | []
| no_license | akhileshnitt/geeks4geek | https://github.com/akhileshnitt/geeks4geek | cde08621fe727262551c726c35dcd3a24817a9b7 | d14b57b6de34a490d9ed7cc88a2f9fa2025de6a6 | refs/heads/master | 2021-05-13T13:09:11.967000 | 2020-10-23T03:50:38 | 2020-10-23T03:50:38 | 116,697,992 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tree;
import java.util.HashSet;
import java.util.Set;
public class NodeKDistanceFomLeaf {
public static void main(String[] args) {
Node root = new Node(1);
root.left = new Node(2);
root.right = new Node(3);
root.left.left = new Node(4);
root.left.right = new Node(5);
root.right.left = new Node(6);
root.right.right = new Node(7);
root.right.left.right = new Node(8);
int k=4;
int pathLength=0;
int []path = new int[100];
Set<Integer> set = new HashSet<>();
printNodeKDistanceFromLeaf(root,path,pathLength,k,set);
}
private static void printNodeKDistanceFromLeaf(Node root, int[] path, int pathLength, int k,Set set) {
if(root == null) return;
path[pathLength] = root.data;
pathLength = pathLength +1;
if(NodeUtil.isLeaf(root) && pathLength- k -1>=0 ){
// print ancesstor node at distance k
if(!set.contains(path[pathLength- k -1])) {
set.add(path[pathLength - k - 1]);
System.out.println(path[pathLength - k - 1]);
}
return;
}
printNodeKDistanceFromLeaf(root.left,path,pathLength,k,set);
printNodeKDistanceFromLeaf(root.right,path,pathLength,k,set);
}
}
| UTF-8 | Java | 1,332 | java | NodeKDistanceFomLeaf.java | Java | []
| null | []
| package tree;
import java.util.HashSet;
import java.util.Set;
public class NodeKDistanceFomLeaf {
public static void main(String[] args) {
Node root = new Node(1);
root.left = new Node(2);
root.right = new Node(3);
root.left.left = new Node(4);
root.left.right = new Node(5);
root.right.left = new Node(6);
root.right.right = new Node(7);
root.right.left.right = new Node(8);
int k=4;
int pathLength=0;
int []path = new int[100];
Set<Integer> set = new HashSet<>();
printNodeKDistanceFromLeaf(root,path,pathLength,k,set);
}
private static void printNodeKDistanceFromLeaf(Node root, int[] path, int pathLength, int k,Set set) {
if(root == null) return;
path[pathLength] = root.data;
pathLength = pathLength +1;
if(NodeUtil.isLeaf(root) && pathLength- k -1>=0 ){
// print ancesstor node at distance k
if(!set.contains(path[pathLength- k -1])) {
set.add(path[pathLength - k - 1]);
System.out.println(path[pathLength - k - 1]);
}
return;
}
printNodeKDistanceFromLeaf(root.left,path,pathLength,k,set);
printNodeKDistanceFromLeaf(root.right,path,pathLength,k,set);
}
}
| 1,332 | 0.578829 | 0.564565 | 48 | 26.75 | 24.438272 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 2 |
78bb9e9c26900ded36a54c96b774773914c1a9e0 | 2,070,174,282,632 | 5319605ef9be9e4e485c5923f8c36604227e48e3 | /src/com/hf/lesson09/RandomDoubles.java | ef37c299c56cd61bb6774eba0c6b4ca2e6bdb614 | []
| no_license | cikerkiller/thinkinjava | https://github.com/cikerkiller/thinkinjava | 88c49f3e916f3d660bfadc9c6f9a3e4e59e6cdc8 | b9a960991835cfa1679693435e28341e317084d4 | refs/heads/master | 2020-03-26T08:44:44.942000 | 2018-06-25T15:32:55 | 2018-06-25T15:32:55 | 137,057,644 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hf.lesson09;
import java.io.IOException;
import java.nio.CharBuffer;
import java.util.Random;
import java.util.Scanner;
public class RandomDoubles {
private static Random random=new Random(47);
public double next() {return random.nextDouble();}
public static void main(String[] args) {
// RandomDoubles doubles=new RandomDoubles();
// for(int i=0;i<7;i++) {
// System.out.println(doubles.next()+" ");
// }
AdaptedRandomDoubles adaptedRandomDoubles=new AdaptedRandomDoubles(7);
Scanner scanner=new Scanner(adaptedRandomDoubles);
while(scanner.hasNext()) {
System.out.println(scanner.nextDouble()+" ");
}
}
}
class AdaptedRandomDoubles extends RandomDoubles implements Readable{
private int count;
public AdaptedRandomDoubles(int count) {
super();
this.count = count;
}
@Override
public int read(CharBuffer cb) throws IOException {
if(count--==0) {
return -1;
}
String result=Double.valueOf(next())+" ";
cb.append(result);
return result.length();
}
} | UTF-8 | Java | 1,055 | java | RandomDoubles.java | Java | []
| null | []
| package com.hf.lesson09;
import java.io.IOException;
import java.nio.CharBuffer;
import java.util.Random;
import java.util.Scanner;
public class RandomDoubles {
private static Random random=new Random(47);
public double next() {return random.nextDouble();}
public static void main(String[] args) {
// RandomDoubles doubles=new RandomDoubles();
// for(int i=0;i<7;i++) {
// System.out.println(doubles.next()+" ");
// }
AdaptedRandomDoubles adaptedRandomDoubles=new AdaptedRandomDoubles(7);
Scanner scanner=new Scanner(adaptedRandomDoubles);
while(scanner.hasNext()) {
System.out.println(scanner.nextDouble()+" ");
}
}
}
class AdaptedRandomDoubles extends RandomDoubles implements Readable{
private int count;
public AdaptedRandomDoubles(int count) {
super();
this.count = count;
}
@Override
public int read(CharBuffer cb) throws IOException {
if(count--==0) {
return -1;
}
String result=Double.valueOf(next())+" ";
cb.append(result);
return result.length();
}
} | 1,055 | 0.688152 | 0.679621 | 42 | 23.166666 | 20.158794 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.738095 | false | false | 2 |
c29e014e6c95de4cd70a6b56b625379457e46331 | 26,929,444,987,170 | 16b2b5f13bb0b89a55d98174ced76c792ecfc29f | /app/src/main/java/com/xhr/mvpdemo/presenter/RepoListPresenter.java | d80a39604a1fa6b5bd3cce51681dab65c7fff314 | []
| no_license | boygaggoo/MvpDemo | https://github.com/boygaggoo/MvpDemo | 35aff1c343cb740811d4b0d292c2984258fe6197 | 039df8294dd6c155530b95f3771dda8703a4141d | refs/heads/master | 2021-01-18T14:14:49.480000 | 2016-01-21T09:36:59 | 2016-01-21T09:36:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xhr.mvpdemo.presenter;
import com.google.common.collect.ImmutableList;
import com.xhr.mvpdemo.model.IUser;
import com.xhr.mvpdemo.model.UserModel;
import com.xhr.mvpdemo.repository.model.Repository;
import com.xhr.mvpdemo.view.IRepoListView;
import rx.Subscriber;
/**
* Created by Miroslaw Stanek on 23.04.15.
*/
public class RepoListPresenter implements IRepoListPresenter {
private IRepoListView repoListView;
private IUser user;
public RepoListPresenter(IRepoListView repoListView) {
this.repoListView = repoListView;
this.user = new UserModel();
}
@Override
public void loadRepositories(String userName) {
repoListView.showLoading(true);
user.getRepositories(userName).subscribe(
new Subscriber<ImmutableList<Repository>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
repoListView.showLoading(false);
}
@Override
public void onNext(ImmutableList<Repository> repositories) {
repoListView.showLoading(false);
repoListView.setRepositories(repositories);
}
});
}
}
| UTF-8 | Java | 1,376 | java | RepoListPresenter.java | Java | [
{
"context": "stView;\n\nimport rx.Subscriber;\n\n\n/**\n * Created by Miroslaw Stanek on 23.04.15.\n */\npublic class RepoListPresenter i",
"end": 313,
"score": 0.9998624920845032,
"start": 298,
"tag": "NAME",
"value": "Miroslaw Stanek"
}
]
| null | []
| package com.xhr.mvpdemo.presenter;
import com.google.common.collect.ImmutableList;
import com.xhr.mvpdemo.model.IUser;
import com.xhr.mvpdemo.model.UserModel;
import com.xhr.mvpdemo.repository.model.Repository;
import com.xhr.mvpdemo.view.IRepoListView;
import rx.Subscriber;
/**
* Created by <NAME> on 23.04.15.
*/
public class RepoListPresenter implements IRepoListPresenter {
private IRepoListView repoListView;
private IUser user;
public RepoListPresenter(IRepoListView repoListView) {
this.repoListView = repoListView;
this.user = new UserModel();
}
@Override
public void loadRepositories(String userName) {
repoListView.showLoading(true);
user.getRepositories(userName).subscribe(
new Subscriber<ImmutableList<Repository>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
repoListView.showLoading(false);
}
@Override
public void onNext(ImmutableList<Repository> repositories) {
repoListView.showLoading(false);
repoListView.setRepositories(repositories);
}
});
}
}
| 1,367 | 0.600291 | 0.59593 | 47 | 28.276596 | 22.743437 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.340426 | false | false | 2 |
e042edffd94f342d70e6bb1d6bab0bf108a18a60 | 22,119,081,577,968 | a98e082043f6261cbf82945351096684031d14a6 | /app/src/main/java/com/example/flowers/view/Plant.java | e4b34fd447214396d6f7b7cfa70f5dc60bd355b0 | [
"Apache-2.0"
]
| permissive | guoinfinite/flower | https://github.com/guoinfinite/flower | 8130a50fe030f90a2b51b2cf7d3be970771427f3 | 8b779557a6a177a752bbc4656ec6b0dd126260d8 | refs/heads/master | 2020-12-15T13:41:50.762000 | 2020-01-20T14:37:38 | 2020-01-20T14:37:38 | 235,122,033 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.flowers.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.example.flowers.R;
import com.example.flowers.application.MyDataHelper;
import com.example.flowers.ui.utils.DensityUtil;
import com.example.flowers.ui.utils.L;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* 目的:实现种子落在地上,然后开始长花
* 种子,叶子(左右),底部,根茎,花朵-->共6种控件
* 种子(位移动画)
* 叶子(渐变动画+位移动画)
* 底部(无效果)
* 根茎(渐变动画)
* 花朵(渐变动画)
*/
public class Plant extends FrameLayout {
//常量
private final int DEFAULT_HEIGHT = DensityUtil.dip2px(getContext(), 200);//设置默认的高
private final int DEFAULT_WIDTH = DensityUtil.dip2px(getContext(), 100);//设置默认的宽
private final int WIDTH = 1;//宽
private final int HEIGHT = 2;//高
private Map<String, Integer> childViewValues = null;//存储一些宽高度值
//变量
private int parentWidth = 0;//控件的宽
private int parentHeight = 0;//控件的高
private int flowers_count;//中出的花的个数
//控件
private ImageView seedImg = null;//种子
private ImageView leftLeafImg = null;//叶子
private ImageView rightLeafImg = null;//叶子
private ImageView budImg = null;//花朵
private ImageView branchImg = null;//根茎
private ImageView gapImg = null;//地缝
//动画
private AnimatorSet animatorSetGroup;//第一步
private boolean isCirculation;//是否循环
private ArrayList<Integer> flower_list;//花朵的集合
private int plant_flower_index;//种的花的标记
private boolean getIndex = true;//获取标记
/**
* 构造方法
*
* @ram context
*/
public Plant(Context context) {
this(context, null);
}
public Plant(Context context, AttributeSet attrs) {
super(context, attrs);
setWillNotDraw(false);
//添加控件
addPlantChildView(context);
//默认
onlyShowGapImg();
}
/**
* 添加控件
*/
private void addPlantChildView(Context context) {
//种子
seedImg = new ImageView(context);
seedImg.setImageResource(R.mipmap.mrkj_grow_seed);
//左侧叶子
leftLeafImg = new ImageView(context);
leftLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_01);
//右侧叶子
rightLeafImg = new ImageView(context);
rightLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_02);
//花朵
budImg = new ImageView(context);
budImg.setImageResource(R.mipmap.mrkj_grow_bud_1);
//根茎
branchImg = new ImageView(context);
branchImg.setScaleType(ImageView.ScaleType.FIT_XY);
branchImg.setImageResource(R.mipmap.mrkj_plantflower_branch);
//地缝
gapImg = new ImageView(context);
gapImg.setImageResource(R.mipmap.mrkj_flowerplant_gap);
//添加控件
addView(gapImg);//地缝0
addView(branchImg);//根茎1
addView(leftLeafImg);//左侧叶子2
addView(rightLeafImg);//右侧叶子3
addView(budImg);//花朵4
addView(seedImg);//种子5
}
/**
* 初始化后的显示效果
* 默认只显示地缝
*/
private void onlyShowGapImg() {
branchImg.setVisibility(INVISIBLE);
leftLeafImg.setVisibility(INVISIBLE);
rightLeafImg.setVisibility(INVISIBLE);
budImg.setVisibility(INVISIBLE);
seedImg.setVisibility(INVISIBLE);
budImg.setImageResource(R.mipmap.mrkj_grow_bud_1);
leftLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_01);
rightLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_02);
}
/**
* 显示其余控件-->显示茎、叶
*/
private void otherView() {
branchImg.setVisibility(VISIBLE);//茎
leftLeafImg.setVisibility(VISIBLE);//左叶
rightLeafImg.setVisibility(VISIBLE);//右叶
}
/**
* 设置动画
* 动画的第一阶段
*/
private void startShowPlantFlower() {
final Bitmap[] bitmaps = MyDataHelper.getInstance().getBitmapArray(getContext());
animatorSetGroup = new AnimatorSet();//动画集合
// **********************************************************
// 成长阶段 **************************************************
// **********************************************************
//1.种子-->平移动画
ObjectAnimator seedTranslation = ObjectAnimator.ofFloat(seedImg, "translationY",
0, childViewValues.get("seedMoveLength"));
seedTranslation.setDuration(5 * 1000);
seedTranslation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
otherView();//用来显示控件
seedImg.setVisibility(INVISIBLE);
}
});
seedTranslation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
seedImg.setVisibility(VISIBLE);//显示种子
seedImg.setPivotY(0);
seedImg.invalidate();
}
});
//2.根茎-->缩放动画
ObjectAnimator branchAnimator = ObjectAnimator.ofFloat(branchImg, "scaleY", 0f, 1.0f);
branchAnimator.setDuration(10 * 1000);
branchImg.setPivotY(childViewValues.get("BranchHeight"));
branchImg.invalidate();
//3.叶子-->缩放+位移动画
//3.1(左)
//缩放
PropertyValuesHolder leftLeafScaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 0.5f);
PropertyValuesHolder leftLeafScaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 0.5f);
//平移
leftLeafImg.setPivotX(childViewValues.get("LeftLeafWidth"));
leftLeafImg.setPivotY(childViewValues.get("LeftLeafHeight"));
PropertyValuesHolder leftLeafTranslation = PropertyValuesHolder.ofFloat("translationY",
0, -childViewValues.get("BranchHeightHalf") * 2 / 3);
ObjectAnimator leftAnimator = ObjectAnimator.ofPropertyValuesHolder(leftLeafImg,
leftLeafScaleX, leftLeafScaleY, leftLeafTranslation);
leftAnimator.setDuration(8 * 1000);
//3.2(右)
PropertyValuesHolder rightLeafScaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 0.5f);
PropertyValuesHolder rightLeafScaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 0.5f);
//平移
rightLeafImg.setPivotX(0);
rightLeafImg.setPivotY(childViewValues.get("LeftLeafHeight"));
PropertyValuesHolder rightLeafTranslation = PropertyValuesHolder.ofFloat("translationY",
0, -childViewValues.get("BranchHeightHalf") * 2 / 3);
ObjectAnimator rightAnimator = ObjectAnimator.ofPropertyValuesHolder(rightLeafImg,
rightLeafScaleX, rightLeafScaleY, rightLeafTranslation);
rightAnimator.setDuration(8 * 1000);
//4.花朵的显示
PropertyValuesHolder budAnimatorScaleX = PropertyValuesHolder.ofFloat("scaleX", 0.1f, 1.0f);
PropertyValuesHolder budAnimatorScaleY = PropertyValuesHolder.ofFloat("scaleY", 0.1f, 1.0f);
ObjectAnimator budAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budAnimatorScaleX, budAnimatorScaleY);
budAnimator.setDuration(5 * 1000);
budAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
budImg.setVisibility(VISIBLE);
}
});
//5.叶子继续放大
PropertyValuesHolder leftLeafScaleXMore = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1.0f);
PropertyValuesHolder leftLeafScaleYMore = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1.0f);
ObjectAnimator leftLeafAnimatorMore = ObjectAnimator.ofPropertyValuesHolder(leftLeafImg,
leftLeafScaleXMore, leftLeafScaleYMore);
leftLeafAnimatorMore.setDuration(5 * 1000);
leftLeafAnimatorMore.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
leftLeafImg.setImageResource(R.mipmap.mrkj_grow_leaf_2);
}
});
PropertyValuesHolder rightLeafScaleXMore = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1.0f);
PropertyValuesHolder rightLeafScaleYMore = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1.0f);
ObjectAnimator rightLeafAnimatorMore = ObjectAnimator.ofPropertyValuesHolder(rightLeafImg,
rightLeafScaleXMore, rightLeafScaleYMore);
rightLeafAnimatorMore.setDuration(5 * 1000);
rightLeafAnimatorMore.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
rightLeafImg.setImageResource(R.mipmap.mrkj_grow_leaf_1);
}
});
//开始长花
PropertyValuesHolder budGroupToFlowerX = PropertyValuesHolder.ofFloat(
"scaleX", 0.5f, 1.0f);
PropertyValuesHolder budGroupToFlowerY = PropertyValuesHolder.ofFloat(
"scaleY", 0.5f, 1.0f);
ObjectAnimator budGroupAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budGroupToFlowerX, budGroupToFlowerY);
budGroupAnimator.setDuration(5 * 1000);
budGroupAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
budImg.setImageResource(R.mipmap.mrkj_grow_bud_2);
}
});
//最后开花
PropertyValuesHolder budGroupToFlowerXMore = PropertyValuesHolder.ofFloat(
"scaleX", 0.5f, 1.0f);
PropertyValuesHolder budGroupToFlowerYMore = PropertyValuesHolder.ofFloat(
"scaleY", 0.5f, 1.0f);
ObjectAnimator openFlowerAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budGroupToFlowerXMore, budGroupToFlowerYMore);
openFlowerAnimator.setDuration(5 * 1000);
openFlowerAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (getIndex) {
if (flower_list != null) {
L.e("length", flower_list.size() + "");
int length = flower_list.size();//获取数据的长度
plant_flower_index = flower_list.get(getIndex(length));//获取索引值
budImg.setImageBitmap(bitmaps[plant_flower_index]);//根据索引值设置图片
} else {
plant_flower_index = 0;//默认索引值
budImg.setImageResource(R.mipmap.mrkj_flower_01);//设置默认图片
}
getIndex = false;
}
}
});
//***************************** 分割线 *****************************
//播放动画集合
animatorSetGroup.play(branchAnimator).with(leftAnimator).with(rightAnimator).after(seedTranslation);
animatorSetGroup.play(rightLeafAnimatorMore).with(leftLeafAnimatorMore).after(leftAnimator);
animatorSetGroup.play(budAnimator).after(branchAnimator);
animatorSetGroup.play(budGroupAnimator).after(budAnimator);
animatorSetGroup.play(openFlowerAnimator).after(budGroupAnimator);
animatorSetGroup.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (isCirculation) {
onlyShowGapImg();
getIndex = true;
animatorSetGroup.start();
flowers_count++;
bloomFlowers();
}
}
});
}
/**
* 获取随机数
*
* @param length
* @return
*/
private int getIndex(int length) {
Random random = new Random();//用于获取随机数
plant_flower_index = random.nextInt(length);
return plant_flower_index;
}
/**
* 回调函数
*/
private onPlantFlowerCountsListener onPlantFlowerCountsListener;
public interface onPlantFlowerCountsListener {
void thePlantFlowerCounts(int counts);
void theFlowerIndex(int index, int count);
}
public void setonPlantFlowerCountsListener(onPlantFlowerCountsListener listener) {
this.onPlantFlowerCountsListener = listener;
}
/**
* 回调
*/
private void bloomFlowers() {
if (onPlantFlowerCountsListener != null) {
onPlantFlowerCountsListener.thePlantFlowerCounts(flowers_count);//返回计数
onPlantFlowerCountsListener.theFlowerIndex(plant_flower_index, 1);//返回图片索引
}
}
//*************************** 公开的方法 ***************************
/**
* 设置是否循环
*
* @param isCirculation
*/
public void setCirculation(boolean isCirculation) {
this.isCirculation = isCirculation;
}
/**
* 设置花朵的集合
*/
public void setFlowersList(ArrayList<Integer> list) {
this.flower_list = list;
}
/**
* 以上是功能性代码
* 以下是获取相关的属性
*/
//*************************** 测量和摆放子控件 ***************************
/**
* 测量-->设置大小
*
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//获取测量模式
int width_mode = MeasureSpec.getMode(widthMeasureSpec);
int height_mode = MeasureSpec.getMode(heightMeasureSpec);
//获取测量值
int width_size = MeasureSpec.getSize(widthMeasureSpec);
int height_size = MeasureSpec.getSize(heightMeasureSpec);
//根据测量结果设置最终的宽度和高度
parentWidth = opinionWidthOrHeight(width_mode, width_size, WIDTH);//宽度的测量结果
parentHeight = opinionWidthOrHeight(height_mode, height_size, HEIGHT);//高度的测量结果
//设置子控件
setChildLayoutParams();
setMeasuredDimension(parentWidth, parentHeight);
}
/**
* 返回当前的测量值(宽)
*
* @return
*/
public int plantWidth() {
return parentWidth;
}
/**
* 返回当前的测量值(高)
*
* @return
*/
public int plantHeight() {
return parentHeight;
}
/**
* 设置子控件的大小
*/
private void setChildLayoutParams() {
//获取子控件的个数
int childCounts = getChildCount();
//设置子控件的大小
for (int i = 0; i < childCounts; i++) {
View childView = getChildAt(i);
FrameLayout.LayoutParams params;
if (i == 1) {
params = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
} else {
params = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
childView.setLayoutParams(params);
}
}
/**
* 根据模式判断宽度或者高度
*
* @param mMode
* @param mSize
* @param what
* @return
*/
private int opinionWidthOrHeight(int mMode, int mSize, int what) {
int result = 0;
if (mMode == MeasureSpec.EXACTLY) {
result = mSize;
} else {
// 设置默认宽度
int size = what == WIDTH ? DEFAULT_WIDTH : DEFAULT_HEIGHT;
if (mMode == MeasureSpec.AT_MOST) {
result = Math.min(mSize, size);
}
}
return result;
}
/**
* 布局-->摆放位置
*
* @param changed
* @param left
* @param top
* @param right
* @param bottom
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
//储存子控件的宽度和高度信息
childViewValues = new HashMap<>();
//设置子控件的摆放位置
setGapImgPlace();//地缝
setBranchPlace();//根茎
setLeftLeafPlace();//左侧叶子
setRightLeafPlace();//右侧叶子
setBudOrSeedPlace(4);//花朵
setBudOrSeedPlace(5);//种子
startShowPlantFlower();
}
/**
* 获取子控件的宽高属性
*
* @param child
* @return
*/
private List<Integer> getChildValues(View child) {
List<Integer> list = new ArrayList<>();
list.add(child.getWidth());//宽0
list.add(child.getHeight());//高1
return list;
}
/**
* 地缝
*/
private void setGapImgPlace() {
View child = getChildAt(0);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = parentHeight - childValues.get(1);
int b = parentHeight;
child.layout(l, t, r, b);
//存放地缝的高度
childViewValues.put("GapHeight", childValues.get(1));//高度
}
/**
* 根茎
*/
private void setBranchPlace() {
View child = getChildAt(1);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = parentHeight / 3;//纯属为了好看才设置的这个值
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
//存放根茎的高度
childViewValues.put("BranchTopY", t);//距离顶部的高度
childViewValues.put("BranchWidth", childValues.get(0));//根茎的宽度
childViewValues.put("BranchHeight", Math.abs(t - b));//根茎的高度
childViewValues.put("BranchHeightHalf", Math.abs(t - b) / 2);//高度的一半
}
/**
* 叶子(左)
*/
private void setLeftLeafPlace() {
View child = getChildAt(2);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) - childViewValues.get("BranchWidth");
int r = parentWidth / 2 - childViewValues.get("BranchWidth");
int t = parentHeight - (childValues.get(1) + childViewValues.get("GapHeight") / 2);
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
childViewValues.put("LeftLeafWidth", childValues.get(0));//子控件的宽度
childViewValues.put("LeftLeafHeight", childValues.get(1));//子控件的高度
}
/**
* 叶子(右)
*/
private void setRightLeafPlace() {
View child = getChildAt(3);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 + childViewValues.get("BranchWidth");
int r = parentWidth / 2 + childValues.get(0) + childViewValues.get("BranchWidth");
int t = parentHeight - (childValues.get(1) + childViewValues.get("GapHeight") / 2);
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
}
/**
* 花朵或种子
*/
private void setBudOrSeedPlace(int index) {
View child = getChildAt(index);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = childViewValues.get("BranchTopY") - childValues.get(1) / 2;
int b = childViewValues.get("BranchTopY") + childValues.get(1) / 2;
child.layout(l, t, r, b);
switch (index) {
case 4://花朵
break;
case 5://种子
childViewValues.put("seedMoveLength",
Math.abs(parentHeight - t - childViewValues.get("GapHeight")));
break;
default:
break;
}
}
/*
* *********************** 对外的公有方法 *************************
* 设置动画的播放,停止,运行,取消
*/
/**
* 播放
*/
public void plantAnimatorStart() {
animatorSetGroup.start();
}
/**
* 运行
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void plantAnimatorResume() {
animatorSetGroup.resume();
}
/**
* 暂停
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void plantAnimatorPause() {
animatorSetGroup.pause();
}
/**
* 取消
*/
public void plantAnimatorCancel() {
animatorSetGroup.cancel();
onlyShowGapImg();
}
} | UTF-8 | Java | 22,267 | java | Plant.java | Java | []
| null | []
| package com.example.flowers.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.example.flowers.R;
import com.example.flowers.application.MyDataHelper;
import com.example.flowers.ui.utils.DensityUtil;
import com.example.flowers.ui.utils.L;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* 目的:实现种子落在地上,然后开始长花
* 种子,叶子(左右),底部,根茎,花朵-->共6种控件
* 种子(位移动画)
* 叶子(渐变动画+位移动画)
* 底部(无效果)
* 根茎(渐变动画)
* 花朵(渐变动画)
*/
public class Plant extends FrameLayout {
//常量
private final int DEFAULT_HEIGHT = DensityUtil.dip2px(getContext(), 200);//设置默认的高
private final int DEFAULT_WIDTH = DensityUtil.dip2px(getContext(), 100);//设置默认的宽
private final int WIDTH = 1;//宽
private final int HEIGHT = 2;//高
private Map<String, Integer> childViewValues = null;//存储一些宽高度值
//变量
private int parentWidth = 0;//控件的宽
private int parentHeight = 0;//控件的高
private int flowers_count;//中出的花的个数
//控件
private ImageView seedImg = null;//种子
private ImageView leftLeafImg = null;//叶子
private ImageView rightLeafImg = null;//叶子
private ImageView budImg = null;//花朵
private ImageView branchImg = null;//根茎
private ImageView gapImg = null;//地缝
//动画
private AnimatorSet animatorSetGroup;//第一步
private boolean isCirculation;//是否循环
private ArrayList<Integer> flower_list;//花朵的集合
private int plant_flower_index;//种的花的标记
private boolean getIndex = true;//获取标记
/**
* 构造方法
*
* @ram context
*/
public Plant(Context context) {
this(context, null);
}
public Plant(Context context, AttributeSet attrs) {
super(context, attrs);
setWillNotDraw(false);
//添加控件
addPlantChildView(context);
//默认
onlyShowGapImg();
}
/**
* 添加控件
*/
private void addPlantChildView(Context context) {
//种子
seedImg = new ImageView(context);
seedImg.setImageResource(R.mipmap.mrkj_grow_seed);
//左侧叶子
leftLeafImg = new ImageView(context);
leftLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_01);
//右侧叶子
rightLeafImg = new ImageView(context);
rightLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_02);
//花朵
budImg = new ImageView(context);
budImg.setImageResource(R.mipmap.mrkj_grow_bud_1);
//根茎
branchImg = new ImageView(context);
branchImg.setScaleType(ImageView.ScaleType.FIT_XY);
branchImg.setImageResource(R.mipmap.mrkj_plantflower_branch);
//地缝
gapImg = new ImageView(context);
gapImg.setImageResource(R.mipmap.mrkj_flowerplant_gap);
//添加控件
addView(gapImg);//地缝0
addView(branchImg);//根茎1
addView(leftLeafImg);//左侧叶子2
addView(rightLeafImg);//右侧叶子3
addView(budImg);//花朵4
addView(seedImg);//种子5
}
/**
* 初始化后的显示效果
* 默认只显示地缝
*/
private void onlyShowGapImg() {
branchImg.setVisibility(INVISIBLE);
leftLeafImg.setVisibility(INVISIBLE);
rightLeafImg.setVisibility(INVISIBLE);
budImg.setVisibility(INVISIBLE);
seedImg.setVisibility(INVISIBLE);
budImg.setImageResource(R.mipmap.mrkj_grow_bud_1);
leftLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_01);
rightLeafImg.setImageResource(R.mipmap.mrkj_plantflower_leaf_02);
}
/**
* 显示其余控件-->显示茎、叶
*/
private void otherView() {
branchImg.setVisibility(VISIBLE);//茎
leftLeafImg.setVisibility(VISIBLE);//左叶
rightLeafImg.setVisibility(VISIBLE);//右叶
}
/**
* 设置动画
* 动画的第一阶段
*/
private void startShowPlantFlower() {
final Bitmap[] bitmaps = MyDataHelper.getInstance().getBitmapArray(getContext());
animatorSetGroup = new AnimatorSet();//动画集合
// **********************************************************
// 成长阶段 **************************************************
// **********************************************************
//1.种子-->平移动画
ObjectAnimator seedTranslation = ObjectAnimator.ofFloat(seedImg, "translationY",
0, childViewValues.get("seedMoveLength"));
seedTranslation.setDuration(5 * 1000);
seedTranslation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
otherView();//用来显示控件
seedImg.setVisibility(INVISIBLE);
}
});
seedTranslation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
seedImg.setVisibility(VISIBLE);//显示种子
seedImg.setPivotY(0);
seedImg.invalidate();
}
});
//2.根茎-->缩放动画
ObjectAnimator branchAnimator = ObjectAnimator.ofFloat(branchImg, "scaleY", 0f, 1.0f);
branchAnimator.setDuration(10 * 1000);
branchImg.setPivotY(childViewValues.get("BranchHeight"));
branchImg.invalidate();
//3.叶子-->缩放+位移动画
//3.1(左)
//缩放
PropertyValuesHolder leftLeafScaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 0.5f);
PropertyValuesHolder leftLeafScaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 0.5f);
//平移
leftLeafImg.setPivotX(childViewValues.get("LeftLeafWidth"));
leftLeafImg.setPivotY(childViewValues.get("LeftLeafHeight"));
PropertyValuesHolder leftLeafTranslation = PropertyValuesHolder.ofFloat("translationY",
0, -childViewValues.get("BranchHeightHalf") * 2 / 3);
ObjectAnimator leftAnimator = ObjectAnimator.ofPropertyValuesHolder(leftLeafImg,
leftLeafScaleX, leftLeafScaleY, leftLeafTranslation);
leftAnimator.setDuration(8 * 1000);
//3.2(右)
PropertyValuesHolder rightLeafScaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 0.5f);
PropertyValuesHolder rightLeafScaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 0.5f);
//平移
rightLeafImg.setPivotX(0);
rightLeafImg.setPivotY(childViewValues.get("LeftLeafHeight"));
PropertyValuesHolder rightLeafTranslation = PropertyValuesHolder.ofFloat("translationY",
0, -childViewValues.get("BranchHeightHalf") * 2 / 3);
ObjectAnimator rightAnimator = ObjectAnimator.ofPropertyValuesHolder(rightLeafImg,
rightLeafScaleX, rightLeafScaleY, rightLeafTranslation);
rightAnimator.setDuration(8 * 1000);
//4.花朵的显示
PropertyValuesHolder budAnimatorScaleX = PropertyValuesHolder.ofFloat("scaleX", 0.1f, 1.0f);
PropertyValuesHolder budAnimatorScaleY = PropertyValuesHolder.ofFloat("scaleY", 0.1f, 1.0f);
ObjectAnimator budAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budAnimatorScaleX, budAnimatorScaleY);
budAnimator.setDuration(5 * 1000);
budAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
budImg.setVisibility(VISIBLE);
}
});
//5.叶子继续放大
PropertyValuesHolder leftLeafScaleXMore = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1.0f);
PropertyValuesHolder leftLeafScaleYMore = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1.0f);
ObjectAnimator leftLeafAnimatorMore = ObjectAnimator.ofPropertyValuesHolder(leftLeafImg,
leftLeafScaleXMore, leftLeafScaleYMore);
leftLeafAnimatorMore.setDuration(5 * 1000);
leftLeafAnimatorMore.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
leftLeafImg.setImageResource(R.mipmap.mrkj_grow_leaf_2);
}
});
PropertyValuesHolder rightLeafScaleXMore = PropertyValuesHolder.ofFloat("scaleX", 0.5f, 1.0f);
PropertyValuesHolder rightLeafScaleYMore = PropertyValuesHolder.ofFloat("scaleY", 0.5f, 1.0f);
ObjectAnimator rightLeafAnimatorMore = ObjectAnimator.ofPropertyValuesHolder(rightLeafImg,
rightLeafScaleXMore, rightLeafScaleYMore);
rightLeafAnimatorMore.setDuration(5 * 1000);
rightLeafAnimatorMore.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
rightLeafImg.setImageResource(R.mipmap.mrkj_grow_leaf_1);
}
});
//开始长花
PropertyValuesHolder budGroupToFlowerX = PropertyValuesHolder.ofFloat(
"scaleX", 0.5f, 1.0f);
PropertyValuesHolder budGroupToFlowerY = PropertyValuesHolder.ofFloat(
"scaleY", 0.5f, 1.0f);
ObjectAnimator budGroupAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budGroupToFlowerX, budGroupToFlowerY);
budGroupAnimator.setDuration(5 * 1000);
budGroupAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
budImg.setImageResource(R.mipmap.mrkj_grow_bud_2);
}
});
//最后开花
PropertyValuesHolder budGroupToFlowerXMore = PropertyValuesHolder.ofFloat(
"scaleX", 0.5f, 1.0f);
PropertyValuesHolder budGroupToFlowerYMore = PropertyValuesHolder.ofFloat(
"scaleY", 0.5f, 1.0f);
ObjectAnimator openFlowerAnimator = ObjectAnimator.ofPropertyValuesHolder(budImg,
budGroupToFlowerXMore, budGroupToFlowerYMore);
openFlowerAnimator.setDuration(5 * 1000);
openFlowerAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (getIndex) {
if (flower_list != null) {
L.e("length", flower_list.size() + "");
int length = flower_list.size();//获取数据的长度
plant_flower_index = flower_list.get(getIndex(length));//获取索引值
budImg.setImageBitmap(bitmaps[plant_flower_index]);//根据索引值设置图片
} else {
plant_flower_index = 0;//默认索引值
budImg.setImageResource(R.mipmap.mrkj_flower_01);//设置默认图片
}
getIndex = false;
}
}
});
//***************************** 分割线 *****************************
//播放动画集合
animatorSetGroup.play(branchAnimator).with(leftAnimator).with(rightAnimator).after(seedTranslation);
animatorSetGroup.play(rightLeafAnimatorMore).with(leftLeafAnimatorMore).after(leftAnimator);
animatorSetGroup.play(budAnimator).after(branchAnimator);
animatorSetGroup.play(budGroupAnimator).after(budAnimator);
animatorSetGroup.play(openFlowerAnimator).after(budGroupAnimator);
animatorSetGroup.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (isCirculation) {
onlyShowGapImg();
getIndex = true;
animatorSetGroup.start();
flowers_count++;
bloomFlowers();
}
}
});
}
/**
* 获取随机数
*
* @param length
* @return
*/
private int getIndex(int length) {
Random random = new Random();//用于获取随机数
plant_flower_index = random.nextInt(length);
return plant_flower_index;
}
/**
* 回调函数
*/
private onPlantFlowerCountsListener onPlantFlowerCountsListener;
public interface onPlantFlowerCountsListener {
void thePlantFlowerCounts(int counts);
void theFlowerIndex(int index, int count);
}
public void setonPlantFlowerCountsListener(onPlantFlowerCountsListener listener) {
this.onPlantFlowerCountsListener = listener;
}
/**
* 回调
*/
private void bloomFlowers() {
if (onPlantFlowerCountsListener != null) {
onPlantFlowerCountsListener.thePlantFlowerCounts(flowers_count);//返回计数
onPlantFlowerCountsListener.theFlowerIndex(plant_flower_index, 1);//返回图片索引
}
}
//*************************** 公开的方法 ***************************
/**
* 设置是否循环
*
* @param isCirculation
*/
public void setCirculation(boolean isCirculation) {
this.isCirculation = isCirculation;
}
/**
* 设置花朵的集合
*/
public void setFlowersList(ArrayList<Integer> list) {
this.flower_list = list;
}
/**
* 以上是功能性代码
* 以下是获取相关的属性
*/
//*************************** 测量和摆放子控件 ***************************
/**
* 测量-->设置大小
*
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//获取测量模式
int width_mode = MeasureSpec.getMode(widthMeasureSpec);
int height_mode = MeasureSpec.getMode(heightMeasureSpec);
//获取测量值
int width_size = MeasureSpec.getSize(widthMeasureSpec);
int height_size = MeasureSpec.getSize(heightMeasureSpec);
//根据测量结果设置最终的宽度和高度
parentWidth = opinionWidthOrHeight(width_mode, width_size, WIDTH);//宽度的测量结果
parentHeight = opinionWidthOrHeight(height_mode, height_size, HEIGHT);//高度的测量结果
//设置子控件
setChildLayoutParams();
setMeasuredDimension(parentWidth, parentHeight);
}
/**
* 返回当前的测量值(宽)
*
* @return
*/
public int plantWidth() {
return parentWidth;
}
/**
* 返回当前的测量值(高)
*
* @return
*/
public int plantHeight() {
return parentHeight;
}
/**
* 设置子控件的大小
*/
private void setChildLayoutParams() {
//获取子控件的个数
int childCounts = getChildCount();
//设置子控件的大小
for (int i = 0; i < childCounts; i++) {
View childView = getChildAt(i);
FrameLayout.LayoutParams params;
if (i == 1) {
params = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
} else {
params = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
childView.setLayoutParams(params);
}
}
/**
* 根据模式判断宽度或者高度
*
* @param mMode
* @param mSize
* @param what
* @return
*/
private int opinionWidthOrHeight(int mMode, int mSize, int what) {
int result = 0;
if (mMode == MeasureSpec.EXACTLY) {
result = mSize;
} else {
// 设置默认宽度
int size = what == WIDTH ? DEFAULT_WIDTH : DEFAULT_HEIGHT;
if (mMode == MeasureSpec.AT_MOST) {
result = Math.min(mSize, size);
}
}
return result;
}
/**
* 布局-->摆放位置
*
* @param changed
* @param left
* @param top
* @param right
* @param bottom
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
//储存子控件的宽度和高度信息
childViewValues = new HashMap<>();
//设置子控件的摆放位置
setGapImgPlace();//地缝
setBranchPlace();//根茎
setLeftLeafPlace();//左侧叶子
setRightLeafPlace();//右侧叶子
setBudOrSeedPlace(4);//花朵
setBudOrSeedPlace(5);//种子
startShowPlantFlower();
}
/**
* 获取子控件的宽高属性
*
* @param child
* @return
*/
private List<Integer> getChildValues(View child) {
List<Integer> list = new ArrayList<>();
list.add(child.getWidth());//宽0
list.add(child.getHeight());//高1
return list;
}
/**
* 地缝
*/
private void setGapImgPlace() {
View child = getChildAt(0);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = parentHeight - childValues.get(1);
int b = parentHeight;
child.layout(l, t, r, b);
//存放地缝的高度
childViewValues.put("GapHeight", childValues.get(1));//高度
}
/**
* 根茎
*/
private void setBranchPlace() {
View child = getChildAt(1);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = parentHeight / 3;//纯属为了好看才设置的这个值
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
//存放根茎的高度
childViewValues.put("BranchTopY", t);//距离顶部的高度
childViewValues.put("BranchWidth", childValues.get(0));//根茎的宽度
childViewValues.put("BranchHeight", Math.abs(t - b));//根茎的高度
childViewValues.put("BranchHeightHalf", Math.abs(t - b) / 2);//高度的一半
}
/**
* 叶子(左)
*/
private void setLeftLeafPlace() {
View child = getChildAt(2);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) - childViewValues.get("BranchWidth");
int r = parentWidth / 2 - childViewValues.get("BranchWidth");
int t = parentHeight - (childValues.get(1) + childViewValues.get("GapHeight") / 2);
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
childViewValues.put("LeftLeafWidth", childValues.get(0));//子控件的宽度
childViewValues.put("LeftLeafHeight", childValues.get(1));//子控件的高度
}
/**
* 叶子(右)
*/
private void setRightLeafPlace() {
View child = getChildAt(3);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 + childViewValues.get("BranchWidth");
int r = parentWidth / 2 + childValues.get(0) + childViewValues.get("BranchWidth");
int t = parentHeight - (childValues.get(1) + childViewValues.get("GapHeight") / 2);
int b = parentHeight - childViewValues.get("GapHeight") / 2;
child.layout(l, t, r, b);
}
/**
* 花朵或种子
*/
private void setBudOrSeedPlace(int index) {
View child = getChildAt(index);
List<Integer> childValues = getChildValues(child);
int l = parentWidth / 2 - childValues.get(0) / 2;
int r = parentWidth / 2 + childValues.get(0) / 2;
int t = childViewValues.get("BranchTopY") - childValues.get(1) / 2;
int b = childViewValues.get("BranchTopY") + childValues.get(1) / 2;
child.layout(l, t, r, b);
switch (index) {
case 4://花朵
break;
case 5://种子
childViewValues.put("seedMoveLength",
Math.abs(parentHeight - t - childViewValues.get("GapHeight")));
break;
default:
break;
}
}
/*
* *********************** 对外的公有方法 *************************
* 设置动画的播放,停止,运行,取消
*/
/**
* 播放
*/
public void plantAnimatorStart() {
animatorSetGroup.start();
}
/**
* 运行
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void plantAnimatorResume() {
animatorSetGroup.resume();
}
/**
* 暂停
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void plantAnimatorPause() {
animatorSetGroup.pause();
}
/**
* 取消
*/
public void plantAnimatorCancel() {
animatorSetGroup.cancel();
onlyShowGapImg();
}
} | 22,267 | 0.60289 | 0.592809 | 605 | 33.436363 | 27.34635 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.598347 | false | false | 2 |
11adc1b5900e025bb510b3e048b3e76a9a78bcf1 | 4,526,895,582,965 | 3330a9344b69ab898974dc07d30477e93e2c9b6b | /大二的短学期实践/duanxueqi2/src/com/hyx/ui/FrmGetHouseBudget_mainRoom.java | 516ac25731394778df66af8187fbe7ffc97ee94a | []
| no_license | HuY2x4/Short-Term-Two | https://github.com/HuY2x4/Short-Term-Two | c04c43ad50b88c909147e9f1941422f99fb9a896 | b874e15016943579926964101dc8632e66a4cbbc | refs/heads/master | 2020-04-03T05:22:58.650000 | 2018-10-28T07:52:30 | 2018-10-28T07:52:30 | 155,043,698 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hyx.ui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import com.hyx.startUtil;
import com.hyx.model.MSInfo;
import com.hyx.model.Material;
import com.hyx.model.MaterialBudget;
import com.hyx.model.Service;
import com.hyx.model.ServiceBudget;
import com.hyx.util.BaseException;
public class FrmGetHouseBudget_mainRoom extends JDialog implements ActionListener{
private JPanel panShang = new JPanel();
private JPanel panZhong = new JPanel();
private JPanel panXia = new JPanel();
private JPanel panZuo = new JPanel();
private JButton btnCancel = new JButton("返回");
private JButton btnCailiao = new JButton("材料信息");
private JButton btnFuwu = new JButton("服务信息");
private JLabel label = new JLabel("当前房间的信息:");
private JLabel labelB = new JLabel("材料预算:");
private JLabel labelBP ;
private JLabel labelS = new JLabel("服务预算:");
private JLabel labelSP ;
private JLabel labelSB = new JLabel("总预算:");
private JLabel labelSBP ;
private JTable table;
private DefaultTableModel model;
private JScrollPane scroll;
private int roomID;
private int state=0;
// String[] titles = { "房间编号", "房间面积","房子编号","房间结构","备注"};
//private DefaultTableModel model = new DefaultTableModel(datas, titles);;
// private JTable table = new JTable(model);;
//private JScrollPane scroll = new JScrollPane(table);
public FrmGetHouseBudget_mainRoom (FrmUpdHouse frmUpdHouse, String s, boolean b,int roomId) throws BaseException {
super(frmUpdHouse, s, b);
roomID=roomId;
this.setSize(600,300);
double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
double height = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
this.setLocation((int) (width - this.getWidth()) / 2,
(int) (height - this.getHeight()) / 2);
//获取数据
int[] price=startUtil.materialBudgetContr.getAllBudgetOfRoom(roomID);
labelBP = new JLabel(Integer.toString(price[0]));
labelSP = new JLabel(Integer.toString(price[1]));
labelSBP = new JLabel(Integer.toString(price[2]));
//布局
this.setLayout(new BorderLayout());
panShang.setLayout(new FlowLayout(FlowLayout.CENTER));
panXia.setLayout(new FlowLayout(FlowLayout.CENTER));
// panShang.add(label);
// panShang.add(labelZhu);
panShang.add(btnCailiao);
panShang.add(btnFuwu);
panXia.add(btnCancel);
panXia.add(labelB);
panXia.add(labelBP);
panXia.add(labelS);
panXia.add(labelSP);
panXia.add(labelSB);
panXia.add(labelSBP);
// panZhong.add(scroll);
btnCancel.addActionListener(this);
btnCailiao.addActionListener(this);
btnFuwu.addActionListener(this);
this.add("North",panShang);
this.add("Center",panZhong);
this.add("South",panXia);
//添加数据
getDatas(1);
this.validate();
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==this.btnCancel){
this.setVisible(false);
}
else if(e.getSource()==this.btnCailiao){
try {
getDatas(1);
} catch (BaseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
else if(e.getSource()==this.btnFuwu){
try {
getDatas(2);
} catch (BaseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
public void getDatas(int methon) throws BaseException{
Object[][] datas = new Object[25][10];
if(methon==1) {
state=1;
String[] titles = { "ID", "材料ID","材料名","房间ID","数量","单价","总价"};
List<MaterialBudget> list=null;
list=startUtil.materialBudgetContr.getAllMBOfRoom(roomID);
for(int i=0;i<list.size();i++) {
for(int j=0;j<7;j++) {
switch (j)
{
case 0:
datas[i][j]=list.get(i).getMbId();
break;
case 1:
datas[i][j]=list.get(i).getMaterialId();
break;
case 2:
Material ma=startUtil.materialContr.getMaterial(list.get(i).getMaterialId());
datas[i][j]=ma.getMaterialName();
break;
case 3:
datas[i][j]=list.get(i).getRoomId();
break;
case 4:
datas[i][j]=list.get(i).getCount();
break;
case 5:
datas[i][j]=list.get(i).getPrice();
break;
case 6:
datas[i][j]=list.get(i).getTotalPrice();
break;
}
}
}
int nulllenth=0;
for(int i=0;i<datas.length;i++) {
if(datas[i][0]==null) {
nulllenth=i;
break;
}
}
Object[][] newdatas = new Object[nulllenth][8];
for(int i=0;i<nulllenth;i++) {
for(int j=0;j<7;j++) {
newdatas[i][j]=datas[i][j];
}
}
model = new DefaultTableModel(newdatas, titles);
table = new JTable(model);
scroll = new JScrollPane(table);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panZhong.removeAll();
panZhong.add(scroll);
panZhong.repaint();
panZhong.updateUI();
}
else if(methon==2) {
state=2;
String[] titles = { "ID", "服务ID","服务名","材料ID","材料名","数量","时间","总价格","房间ID","备注"};
List<ServiceBudget> list=null;
list=startUtil.serviceBudgetContr.getAllSBOfRoom(roomID);
for(int i=0;i<list.size();i++) {
for(int j=0;j<10;j++) {
switch (j)
{
case 0:
datas[i][j]=list.get(i).getSbId();
break;
case 1:
datas[i][j]=list.get(i).getServiceId();
break;
case 2:
Service ma=startUtil.serviceContr.getService(list.get(i).getServiceId());
datas[i][j]=ma.getServiceName();
break;
case 3:
MSInfo ms=startUtil.msInfoContr.getMSByServiceId(list.get(i).getServiceId());
datas[i][j]=ms.getMaterialId();
break;
case 4:
MSInfo ms1=startUtil.msInfoContr.getMSByServiceId(list.get(i).getServiceId());
Material ma1=startUtil.materialContr.getMaterial(ms1.getMaterialId());
datas[i][j]=ma1.getMaterialName();
break;
case 5:
datas[i][j]=list.get(i).getCount();
break;
case 6:
datas[i][j]=list.get(i).getTime();
break;
case 7:
datas[i][j]=list.get(i).getTotalPrice();
break;
case 8:
datas[i][j]=list.get(i).getRoomId();
break;
case 9:
datas[i][j]=list.get(i).getRemark();
break;
}
}
}
int nulllenth=0;
for(int i=0;i<datas.length;i++) {
if(datas[i][0]==null) {
nulllenth=i;
break;
}
}
Object[][] newdatas = new Object[nulllenth][10];
for(int i=0;i<nulllenth;i++) {
for(int j=0;j<10;j++) {
newdatas[i][j]=datas[i][j];
}
}
model = new DefaultTableModel(newdatas, titles);
table = new JTable(model);
scroll = new JScrollPane(table);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panZhong.removeAll();
panZhong.add(scroll);
panZhong.repaint();
panZhong.updateUI();
}
}
}
| GB18030 | Java | 8,238 | java | FrmGetHouseBudget_mainRoom.java | Java | []
| null | []
| package com.hyx.ui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import com.hyx.startUtil;
import com.hyx.model.MSInfo;
import com.hyx.model.Material;
import com.hyx.model.MaterialBudget;
import com.hyx.model.Service;
import com.hyx.model.ServiceBudget;
import com.hyx.util.BaseException;
public class FrmGetHouseBudget_mainRoom extends JDialog implements ActionListener{
private JPanel panShang = new JPanel();
private JPanel panZhong = new JPanel();
private JPanel panXia = new JPanel();
private JPanel panZuo = new JPanel();
private JButton btnCancel = new JButton("返回");
private JButton btnCailiao = new JButton("材料信息");
private JButton btnFuwu = new JButton("服务信息");
private JLabel label = new JLabel("当前房间的信息:");
private JLabel labelB = new JLabel("材料预算:");
private JLabel labelBP ;
private JLabel labelS = new JLabel("服务预算:");
private JLabel labelSP ;
private JLabel labelSB = new JLabel("总预算:");
private JLabel labelSBP ;
private JTable table;
private DefaultTableModel model;
private JScrollPane scroll;
private int roomID;
private int state=0;
// String[] titles = { "房间编号", "房间面积","房子编号","房间结构","备注"};
//private DefaultTableModel model = new DefaultTableModel(datas, titles);;
// private JTable table = new JTable(model);;
//private JScrollPane scroll = new JScrollPane(table);
public FrmGetHouseBudget_mainRoom (FrmUpdHouse frmUpdHouse, String s, boolean b,int roomId) throws BaseException {
super(frmUpdHouse, s, b);
roomID=roomId;
this.setSize(600,300);
double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
double height = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
this.setLocation((int) (width - this.getWidth()) / 2,
(int) (height - this.getHeight()) / 2);
//获取数据
int[] price=startUtil.materialBudgetContr.getAllBudgetOfRoom(roomID);
labelBP = new JLabel(Integer.toString(price[0]));
labelSP = new JLabel(Integer.toString(price[1]));
labelSBP = new JLabel(Integer.toString(price[2]));
//布局
this.setLayout(new BorderLayout());
panShang.setLayout(new FlowLayout(FlowLayout.CENTER));
panXia.setLayout(new FlowLayout(FlowLayout.CENTER));
// panShang.add(label);
// panShang.add(labelZhu);
panShang.add(btnCailiao);
panShang.add(btnFuwu);
panXia.add(btnCancel);
panXia.add(labelB);
panXia.add(labelBP);
panXia.add(labelS);
panXia.add(labelSP);
panXia.add(labelSB);
panXia.add(labelSBP);
// panZhong.add(scroll);
btnCancel.addActionListener(this);
btnCailiao.addActionListener(this);
btnFuwu.addActionListener(this);
this.add("North",panShang);
this.add("Center",panZhong);
this.add("South",panXia);
//添加数据
getDatas(1);
this.validate();
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==this.btnCancel){
this.setVisible(false);
}
else if(e.getSource()==this.btnCailiao){
try {
getDatas(1);
} catch (BaseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
else if(e.getSource()==this.btnFuwu){
try {
getDatas(2);
} catch (BaseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
public void getDatas(int methon) throws BaseException{
Object[][] datas = new Object[25][10];
if(methon==1) {
state=1;
String[] titles = { "ID", "材料ID","材料名","房间ID","数量","单价","总价"};
List<MaterialBudget> list=null;
list=startUtil.materialBudgetContr.getAllMBOfRoom(roomID);
for(int i=0;i<list.size();i++) {
for(int j=0;j<7;j++) {
switch (j)
{
case 0:
datas[i][j]=list.get(i).getMbId();
break;
case 1:
datas[i][j]=list.get(i).getMaterialId();
break;
case 2:
Material ma=startUtil.materialContr.getMaterial(list.get(i).getMaterialId());
datas[i][j]=ma.getMaterialName();
break;
case 3:
datas[i][j]=list.get(i).getRoomId();
break;
case 4:
datas[i][j]=list.get(i).getCount();
break;
case 5:
datas[i][j]=list.get(i).getPrice();
break;
case 6:
datas[i][j]=list.get(i).getTotalPrice();
break;
}
}
}
int nulllenth=0;
for(int i=0;i<datas.length;i++) {
if(datas[i][0]==null) {
nulllenth=i;
break;
}
}
Object[][] newdatas = new Object[nulllenth][8];
for(int i=0;i<nulllenth;i++) {
for(int j=0;j<7;j++) {
newdatas[i][j]=datas[i][j];
}
}
model = new DefaultTableModel(newdatas, titles);
table = new JTable(model);
scroll = new JScrollPane(table);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panZhong.removeAll();
panZhong.add(scroll);
panZhong.repaint();
panZhong.updateUI();
}
else if(methon==2) {
state=2;
String[] titles = { "ID", "服务ID","服务名","材料ID","材料名","数量","时间","总价格","房间ID","备注"};
List<ServiceBudget> list=null;
list=startUtil.serviceBudgetContr.getAllSBOfRoom(roomID);
for(int i=0;i<list.size();i++) {
for(int j=0;j<10;j++) {
switch (j)
{
case 0:
datas[i][j]=list.get(i).getSbId();
break;
case 1:
datas[i][j]=list.get(i).getServiceId();
break;
case 2:
Service ma=startUtil.serviceContr.getService(list.get(i).getServiceId());
datas[i][j]=ma.getServiceName();
break;
case 3:
MSInfo ms=startUtil.msInfoContr.getMSByServiceId(list.get(i).getServiceId());
datas[i][j]=ms.getMaterialId();
break;
case 4:
MSInfo ms1=startUtil.msInfoContr.getMSByServiceId(list.get(i).getServiceId());
Material ma1=startUtil.materialContr.getMaterial(ms1.getMaterialId());
datas[i][j]=ma1.getMaterialName();
break;
case 5:
datas[i][j]=list.get(i).getCount();
break;
case 6:
datas[i][j]=list.get(i).getTime();
break;
case 7:
datas[i][j]=list.get(i).getTotalPrice();
break;
case 8:
datas[i][j]=list.get(i).getRoomId();
break;
case 9:
datas[i][j]=list.get(i).getRemark();
break;
}
}
}
int nulllenth=0;
for(int i=0;i<datas.length;i++) {
if(datas[i][0]==null) {
nulllenth=i;
break;
}
}
Object[][] newdatas = new Object[nulllenth][10];
for(int i=0;i<nulllenth;i++) {
for(int j=0;j<10;j++) {
newdatas[i][j]=datas[i][j];
}
}
model = new DefaultTableModel(newdatas, titles);
table = new JTable(model);
scroll = new JScrollPane(table);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panZhong.removeAll();
panZhong.add(scroll);
panZhong.repaint();
panZhong.updateUI();
}
}
}
| 8,238 | 0.578137 | 0.569317 | 302 | 25.649006 | 21.363674 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.403974 | false | false | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.