blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b5600fedfcce7745fa250c685140dcbaca17ab19 | b8ce64fdec0061b861a03488e9823b780a51f07a | /DoitMission_15/app/src/androidTest/java/org/techtown/doitmission_15/ExampleInstrumentedTest.java | 5439cb3500a14a43e88ec20f78ae1c2528190b75 | [] | no_license | seorima/DoitAndroid | d89949af367d88a21109794e995e91b76361251f | 8fde09252a6594d5666c0727224f576450416de5 | refs/heads/master | 2023-03-25T01:30:08.315216 | 2021-03-13T16:24:46 | 2021-03-13T16:24:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package org.techtown.doitmission_15;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("org.techtown.doitmission_15", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
a68e06be10d443b4cb2f3a97961c99dfdec2c1da | cf42c103a1614dc9a88892e749ce59d53a233ce6 | /deleteAttr.java | 94117706de4cdf177e05f73d24cb6c4316900134 | [] | no_license | DimitrisPapavasileiou/Jabatzides | 6b402b53d2dd3d249ba780d16f4bf9ee6db354ee | 4e334caf9e08794bef5bdfe6b8e41e2dd9b45f91 | refs/heads/master | 2020-04-09T03:38:39.818676 | 2018-12-01T19:18:05 | 2018-12-01T19:18:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,419 | java | import java.lang.Object;
public Table deleteAttr () {
boolean findTable = true;
Table tableobj = null;
String name;
System.out.println("Give the table's name which contains the attribute you want to delete or EXIT to exit:");
while(findTable){
name = sc.nextLine();
if(name.equals("EXIT")) {
findTable = false;
} else {
tableobj = getTable(name);
if ( tableobj == null){
System.out.println("Table " + name + " does not exists");
} else {
findTable = false;
}
}
}
boolean findColumn = true;
String columnname;
System.out.println("Give the name of the column wich contains the attributte that you want to delete :");
while (findColumn) {
columnname = sc.nextLine();
for (int i = 0; i <= name.length; i++) {
if (columnname.equals(name.colname)) {
findColumn = false;
}
}
if (i=name.length && findColumn = true) {
System.out.println("This column name does not exist, please give another column name :");
}
}
boolean findValue = true;
String givenvalue;
System.out.println("Give the content of the value tha you want to delete :");
while (findValue) {
givenvalue = sc.nextLine();
for (int i = 0; i <= name.length; i++){
if (givenvalue.equals(name.get(key))){
name = ArrayUtils.removeElement(name, givenvalue);
}
}
}
return tableobj;
}
| [
"[email protected]"
] | |
43bbec57547910849222af3775bc40b3991be3fa | f6b20e204617d03af6a30728d5d8d539640ab782 | /src/com/biz/for_each/For_03.java | aeef9f1d79a8039fccd76673399edd01cebfdaec | [] | no_license | dbtls1000/JAVA_04 | 936fec95554ed32b6ebee36141f1e2c5229ed6ca | 5b807fc272b30b2f88c5db853dd6f0e40f85936d | refs/heads/master | 2020-05-30T04:50:03.979818 | 2019-05-31T07:33:18 | 2019-05-31T07:33:18 | 189,549,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.biz.for_each;
public class For_03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int intSum = 0;
int intE = 1;
intSum = intSum + intE; //1
intE++; //2
intSum = intSum + intE; //1 + 2
intE++; //3
intSum = intSum + intE; //1 + 2 + 3
intSum = 0;
for(int i =1; i <= 10 ; i++) {
System.out.println(i);
intSum += i;
}
// 짝수만 더하기
int intSum2 = 0;
for(int i =0; i <= 10 ; i+=2) {
System.out.println(i);
intSum2 += i;
}
System.out.println(intSum2);
// 홀수만 더하기
int intSum3 = 0;
for(int i =1; i <= 11 ; i+=2) {
System.out.println(i);
intSum3 += i;
}
System.out.println(intSum3);
intSum = 0;
// for를 이용해서 i값이 2,4,6,8,10 만 나타나도록
for (int i = 2; i <= 10 ; i +=2) {
intSum += i;
}
System.out.println("짝수의 합 :" + intSum);
intSum = 0;
// for를 이용해서 1값이 1,3,5,7,9 만 나타나도록
for (int i = 1; i <= 10 ; i +=2) {
intSum += i;
}
System.out.println("홀수의 합 :" + intSum);
for(int i = 1;i < 100; i++);
for(int i = 1; i < 100 ; i++) {
for(long j =1 ; j < 1000000000; j++);
System.out.println(i);
}
}
}
| [
"[email protected]"
] | |
1304ae9cb877260582cd2779b1086f60c20e5da8 | b4337734b343a0a424a117523ac04cb8eff32788 | /src/AESim/Nurse.java | ba525d1fb68f6dfacd42e32d06f773e43e9fd765 | [] | no_license | paescude/AESim | b8cf81743e9449897170b627e916001c38238844 | b195a443d07e3ed47b59201e3dc34824ccaf278e | refs/heads/master | 2020-05-17T16:04:14.750532 | 2013-12-06T17:07:57 | 2013-12-06T17:07:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,322 | java | package AESim;
import java.util.ArrayList;
import cern.jet.random.Uniform;
import Datos.Reader;
import Funciones.MathFunctions;
import repast.simphony.engine.schedule.IAction;
import repast.simphony.engine.schedule.ISchedule;
import repast.simphony.engine.schedule.ScheduleParameters;
import repast.simphony.engine.schedule.ScheduledMethod;
import repast.simphony.engine.watcher.Watch;
import repast.simphony.engine.watcher.WatcherTriggerSchedule;
import repast.simphony.random.RandomHelper;
import repast.simphony.space.grid.Grid;
import repast.simphony.space.grid.GridPoint;
public class Nurse extends Staff {
public static final double[] NURSE_TRIAGE_PARAMS = { 5, 10, 12 };
private static int count;
private double[] timeTriage = new double[3];
public Nurse(Grid<Object> grid, int x1, int y1, int idNum, int multiTasking) {
this.grid = grid;
this.available = true;
this.setId("Nurse " + idNum);
this.idNum = idNum;
this.numAvailable = 0;
this.initPosX = x1;
this.initPosY = y1;
this.myResource = null;
this.multiTaskingFactor = multiTasking;
this.patientsInMultitask = new ArrayList<Patient>();
this.setTimeTriage(NURSE_TRIAGE_PARAMS);
}
@Override
public void resetVariables() {
// TODO Auto-generated method stub
this.setInShift(false);
this.setAvailable(false);
int i = this.idNum;
int x = 18;
int y = i + 4;
grid.moveTo(this, x, y);
}
@Override
public void requiredAtWork() {
// TODO Auto-generated method stub
if (this.isInShift() == false) {
System.out.println(this.getId() + " will move to nurse area"
+ " method: schedule work"
+ " this method is being called by " + this.getId());
grid.moveTo(this, this.initPosX, this.initPosY);
this.numAvailable = this.multiTaskingFactor;
this.setInShift(true);
this.setAvailable(true);
System.out.println(this.getId() + " is in shift and is available at "
+ getTime());
}
}
@Override
public void decideWhatToDoNext() {
if (this.numAvailable == this.multiTaskingFactor && checkIfAnyForTriage()){
this.checkConditionsForTriage();
} else if (this.numAvailable > 0){
if (checkIfAnyForTriage()){
} else {
this.moveToNurseArea();
}
}
}
private void moveToNurseArea() {
if (this.patientsInMultitask.size() < this.multiTaskingFactor) {
boolean flag = false;
int y = 2;
int x;
for (int j = 0; j < 2; j++) {
for (int i = 1; i < 6; i++) {
Object o = grid.getObjectAt(i + 6, y + j);
if (o == null) {
x = i + 6;
grid.moveTo(this, x, y + j);
System.out.println(this.getId()
+ " has moved to nurses area "
+ this.getLoc().toString()
+ " at time " + getTime());
flag = true;
break;
}
if (flag) {
break;
}
}
if (flag) {
break;
}
}
this.setInShift(true);
this.setAvailable(true);
System.out.println(this.getId()
+ " is in shift and is available at " + getTime());
} else {
this.setAvailable(false);
}
}
private boolean checkIfAnyForTriage() {
Object o = getGrid().getObjectAt(2,2);
if (o instanceof Patient){
return true;
} else {
return false;
}
}
@Watch(watcheeClassName = "AESim.Patient", watcheeFieldNames = "wasFirstInQueueTriage", triggerCondition = "$watcher.getNumAvailable()==$watcher.getMultiTaskingFactor()", whenToTrigger = WatcherTriggerSchedule.IMMEDIATE)
public void checkConditionsForTriage() {
printTime();
Resource rAvailable = findResourceAvailable("triage cubicle ");
if (rAvailable != null) {
GridPoint loc = rAvailable.getLoc();
int locX = loc.getX();
int locY = loc.getY();
if (this.available) {
// System.out.println(" this is: " + this.getId());
Patient fstpatient = null;
// The head of the queue is at (x,y-1)
Object o = grid.getObjectAt(2, 2);
if (o != null) {
if (o instanceof Patient) {
fstpatient = (Patient) o;
grid.moveTo(this, locX, locY);
grid.moveTo(fstpatient, locX, locY);
this.setMyResource(rAvailable);
fstpatient.setMyResource(rAvailable);
GridPoint locQueue = this.getQueueLocation(
"queueTriage ", grid);
QueueSim queue = ((QueueSim) grid.getObjectAt(
locQueue.getX(), locQueue.getY()));
queue.removeFromQueue(fstpatient);
queue.elementsInQueue();
/* se utiliza esto (no engageWithPatient) porque el triage ocupa totalmente a la enfermera */
this.setNumAvailable(0);
this.setAvailable(false);
rAvailable.setAvailable(false);
System.out.println("Start triage " + fstpatient.getId() + " with " + this.getId());
scheduleEndTriage(fstpatient);
Patient newfst = null;
Object o2 = grid.getObjectAt(locQueue.getX(),
locQueue.getY());
if (o2 instanceof QueueSim) {
QueueSim newQueue = (QueueSim) o2;
if (newQueue.firstInQueue() != null) {
newfst = newQueue.firstInQueue();
grid.moveTo(newfst, locQueue.getX(),
(locQueue.getY() + 1));
}
}
}
}
} else {
// System.out.println("estoy en el watch y hay cola");
}
}
}
public void scheduleEndTriage(Patient fstpatient) {
double serviceTime = MathFunctions.distLognormal(NURSE_TRIAGE_PARAMS[0],
NURSE_TRIAGE_PARAMS[1], NURSE_TRIAGE_PARAMS[2]);
ISchedule schedule = repast.simphony.engine.environment.RunEnvironment
.getInstance().getCurrentSchedule();
double timeEndService = schedule.getTickCount() + serviceTime;
this.nextEndingTime= timeEndService;
fstpatient.settTriage(serviceTime);
System.out.println(" triage " + fstpatient.getId()
+ " expected to end at " + timeEndService);
ScheduleParameters scheduleParams = ScheduleParameters
.createOneTime(timeEndService);
EndTriage action2 = new EndTriage(this, fstpatient);
fstpatient.setTimeEndCurrentService(timeEndService);
schedule.schedule(scheduleParams, action2);
}
private static class EndTriage implements IAction {
private Nurse nurse;
private Patient patient;
private EndTriage(Nurse nurse, Patient patient) {
this.nurse = nurse;
this.patient = patient;
}
@Override
public void execute() {
nurse.endTriage(this.nurse, this.patient);
}
}
public void endTriage(Nurse nurse, Patient patient) {
printTime();
System.out.println("end triage " + patient.getId());
this.getMyResource().setAvailable(true);
this.setMyResource(null);
patient.setMyResource(null);
System.out.println(patient.getId() + " will get triage category");
nurse.startTriage(patient);
int totalProcess = patient.getTotalProcesses();
patient.setTotalProcesses(totalProcess+1);
this.setAvailable(true);
/* se utiliza esto (no releaseWithPatient) porque el triage ocupa totalmente a la enfermera */
this.setNumAvailable(this.multiTaskingFactor);
this.decideWhatToDoNext();
}
private void startTriage(Patient patient) {
Uniform unif = RandomHelper.createUniform();
double rnd = unif.nextDouble();
float[][] probsTriage = Reader.getMatrixTriagePropByArrival();
//only patients by walk in are triaged by nurse. Ambulance patients are triaged ny ambulanceIn
double rndDNW = RandomHelper.createUniform().nextDouble();
float [][] matrixDNW = Reader.getArrayDNW();
if (rndDNW <= matrixDNW[getHour()][0]) {
this.removePatientFromDepartment(patient);
}
else {
if (rnd <= probsTriage[0][0]) {
patient.setTriage("Blue ");
patient.setTriageNum(1);
double rndTreat = Math.random();
if (rndTreat < Patient.PROB_BLUE_PATIENT_IN_TREATMENT) {
patient.setGoToTreatRoom(true);
patient.addToQ("qBlue ");
} else {
this.removePatientFromDepartment(patient);
}
} else if (probsTriage[0][0] < rnd && rnd <= probsTriage[1][0]) {
patient.setTriage("Green ");
patient.setTriageNum(2);
patient.addToQ("qGreen ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[1][0] < rnd && rnd <= probsTriage[2][0]) {
patient.setTriage("Yellow ");
patient.setTriageNum(3);
patient.addToQ("qYellow ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[2][0] < rnd && rnd <= probsTriage[3][0]) {
patient.setTriage("Orange ");
patient.setTriageNum(4);
patient.addToQ("qOrange ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[3][0] < rnd && rnd <= probsTriage[4][0]) {
patient.setTriage("Red ");
patient.setTriageNum(5);
patient.addToQ("qRed ");
patient.setGoToTreatRoom(true);
}
System.out.println(patient.getId() + " triage num = "
+ patient.getTriageNum() + " has moved to "
+ patient.getCurrentQueue().getId());
}
}
@ScheduledMethod(start = 0, priority = 99, shuffle = false)
public void initNumNurses() {
printTime();
System.out.println("When simulation starts, the nurse conditions are "
+ this.getId());
GridPoint currentLoc = grid.getLocation(this);
int currentX = currentLoc.getX();
int currentY = currentLoc.getY();
if (currentX == 18) {
this.setAvailable(false);
this.setInShift(false);
System.out.println(this.getId()
+ " is not in shift and is not available, time: "
+ getTime());
} else if (currentY == 2) {
this.setAvailable(true);
this.setInShift(true);
System.out.println(this.getId()
+ " is in shift and is available, time: " + getTime());
}
int id = this.idNum;
float sum = 0;
switch (id) {
case 1:
this.setMyShiftMatrix(Reader.getMatrixNurse1());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse1()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 2:
this.setMyShiftMatrix(Reader.getMatrixNurse2());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse2()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 3:
this.setMyShiftMatrix(Reader.getMatrixNurse3());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse3()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 4:
this.setMyShiftMatrix(Reader.getMatrixNurse4());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse4()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 5:
this.setMyShiftMatrix(Reader.getMatrixNurse5());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse5()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
default:
break;
}
System.out.println(this.getId() + " shift's duration ["
+ this.durationOfShift[0] + " ," + this.durationOfShift[1]
+ "," + this.durationOfShift[2] + " ,"
+ this.durationOfShift[3] + " ," + this.durationOfShift[4]
+ ", " + this.durationOfShift[5] + ", "
+ this.durationOfShift[6] + "]");
}
public static void initSaticVars() {
setCount(1);
}
public static int getCount() {
return count;
}
public static void setCount(int count) {
Nurse.count = count;
}
public double[] getTimeTriage() {
return timeTriage;
}
public void setTimeTriage(double[] timeTriage) {
this.timeTriage = timeTriage;
}
}
| [
"[email protected]"
] | |
0ad09101b0dcb380f15efe39e60aca2e7ad43e41 | 3b74874edf06141944cc2032228eef6a5cf2ab80 | /src/main/java/mapTest/p01/iterator/MapTest.java | b3b433140b67321bcb5b8c8ec8e96564959e7117 | [] | no_license | HomeInGuanglunshan/CodeTestMavenized | 7e4797b6f7bed3715d6a5279b6971fdf1859a1df | b3a06bb5a13f39398b397e1917345d017259ef7a | refs/heads/master | 2023-07-25T12:33:10.245323 | 2023-07-13T07:56:59 | 2023-07-13T07:56:59 | 304,035,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package mapTest.p01.iterator;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public class MapTest {
public static void main(String[] args) {
Map<String, String> map = new HashMap<String, String>();
map.put("sgsfg", "1");
map.put("safsv", "2");
map.put("3uyijy", "3");
map.put("et6jgh4", "4");
for (Iterator<Entry<String, String>> it = map.entrySet().iterator(); it.hasNext();) {
Entry<String, String> entry = it.next();
System.out.println(entry.getKey() + "---" + entry.getValue());
}
// Map<?, ?> emptyMap = Collections.EMPTY_MAP;
// System.out.println(emptyMap);
System.out.println(map.put("sgsfg", "34456"));
}
}
| [
"[email protected]"
] | |
c96cfc16bf9eb5d4e3d10ef7009da25b220fed83 | 02733e43da8c998f69070ed558feb56654075f21 | /src/main/java/com/udacity/jwdnd/course1/cloudstorage/config/SecurityConfig.java | 4fd73f913c31d2ca404a7490cfdb5a0bbaa3ad77 | [] | no_license | anuragbnrj/cloudstorage | bd2f5ec55a58301d4f6f266bce59d398990c3717 | 108b04b0abbe96846e4c81c3d6a0bdc742d4c5cf | refs/heads/main | 2023-03-28T02:36:06.518942 | 2021-04-01T21:14:20 | 2021-04-01T21:14:20 | 353,439,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package com.udacity.jwdnd.course1.cloudstorage.config;
import com.udacity.jwdnd.course1.cloudstorage.service.AuthenticationService;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final AuthenticationService authenticationService;
public SecurityConfig(AuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) {
auth.authenticationProvider(this.authenticationService);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/signup", "/css/**", "/js/**", "/h2-console/**").permitAll()
.anyRequest().authenticated();
http.csrf().disable();
http.headers().frameOptions().disable();
http.authorizeRequests().and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/home", true)
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login?logout=true")
.permitAll();
}
}
| [
"[email protected]"
] | |
a231a985881e6de49ec9b09bb3e251ebc4c6f7b8 | dab155e9b0d5af19ac9d3fc9db0a4b02f8e6ac65 | /src/main/java/com/cathetine/simpleChat/response/CommonReturnType.java | 90ef009c99f556c58c05fb69e0adc3cac6850356 | [] | no_license | xjk971020/SimpleWeChat | d9b314679a7bdef296147e043af3e73077f69021 | 79680efda86282a78e55cc26b70a08499fd912d2 | refs/heads/master | 2022-06-27T11:22:03.208350 | 2019-12-01T09:06:08 | 2019-12-01T09:06:08 | 218,782,633 | 0 | 0 | null | 2022-06-21T02:09:03 | 2019-10-31T14:16:57 | Java | UTF-8 | Java | false | false | 904 | java | package com.cathetine.simpleChat.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author:xjk
* @Date 2019/10/31 15:01
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonReturnType {
/**
* 返回数据状态: "success" "fail"
*/
private String status;
/**
* 返回数据
* 如果状态为success,则返回ui显示所需数据
* 如果状态为fail,则返回失败信息
*/
private Object data;
public static CommonReturnType create(Object data) {
return new CommonReturnType("success", data);
}
public static CommonReturnType create(Object data, String status) {
CommonReturnType commonReturnType = new CommonReturnType();
commonReturnType.setData(data);
commonReturnType.setStatus(status);
return commonReturnType;
}
}
| [
"[email protected]"
] | |
9befa3e99ec9487763d8f2991772e98382f7add6 | 5acf068c99a9a642e0200806e38de11099c78fb3 | /src/main/java/io/example/Main.java | cb346159de54cf2e381c022b7f81a6e73497c7fc | [] | no_license | rrizun/kafka-embedded | dd9faa8e535b69216024f38cfe45dd22449e1e03 | 5726663919a4a90a92fdc81f7caf309f213dfb61 | refs/heads/master | 2020-04-27T21:36:13.739848 | 2019-03-09T14:30:06 | 2019-03-09T14:30:06 | 174,704,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,161 | java | package io.example;
import java.io.IOException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain;
/**
* Main
*/
@EnableScheduling
@SpringBootApplication
public class Main {
public static void main(String... args) {
SpringApplication.run(Main.class, args);
}
@EventListener
public void applicationStartedEvent(ApplicationStartedEvent event) throws Exception {
log("applicationStartedEvent");
new Thread() {
@Override
public void run() {
log("run");
try {
SchemaRegistryMain
.main(new String[] { "/tmp/confluent.kSXDqvVg/schema-registry/schema-registry.properties" });
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
private void log(Object... args) {
new LogHelper(this).log(args);
}
}
| [
"[email protected]"
] | |
17659a3b9e9089be965ce11daa17aa59ff15753f | 229922987e10fed06caa951efd88510a2c758f95 | /src/main/java/com/first/IOC/demo/MyApp.java | 0ecb31ccadce8db6ef4ae0c8809102dff7c2b199 | [] | no_license | Sinegubovskii/Spring | 8644c8b56304d2b3286d353d40bda82af7aaafb4 | 25d06dffd625c7214983808320d7fb0e957890fb | refs/heads/master | 2020-04-30T20:23:57.122339 | 2019-03-22T03:29:26 | 2019-03-22T03:29:26 | 177,065,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package com.first.IOC.demo;
public class MyApp {
public static void main(String[] arg){
iCoach theCoach = new BaseballCoach();
System.out.println(theCoach.getDailyWorkout());
}
}
| [
""
] | |
0fa3e76179493bd875e49604fa7660cf8cd38323 | 7a3d5f07072bee1b665ed80cc08bba455e790a8f | /src/com/xianhe/mis/PathSelectPanel.java | 178db20df33f57bf3c19c046186ffc03f2dcf8e9 | [] | no_license | 13950256550/DesignExpert | 9ec2911727a460abe41bfe89bcff37b7af7ee7bc | 609026b0a50b90e787b2bcadf7b49a906a23cdfe | refs/heads/master | 2020-04-05T13:08:44.429947 | 2017-07-07T09:20:59 | 2017-07-07T09:20:59 | 95,123,461 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,623 | java | package com.xianhe.mis;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.ini4j.Ini;
import org.ini4j.Profile.Section;
import com.xianhe.core.common.EnvReadWriteUtil;
import com.xianhe.core.common.WorkPath;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
public class PathSelectPanel extends BorderPane{
public static Logger logger = Logger.getLogger(PathSelectPanel.class);
private TableView<WorkPath> tableView = new TableView<WorkPath>();
private Stage stage = null;
public PathSelectPanel(Stage stage) {
this.stage = stage;
tableView.setEditable(true);
this.setCenter(tableView);
String[] columns = new String[]{"序号","目录名称","目录路径"};
String[] propertys = new String[]{"id","name","path"};
int[] widths = new int[]{50,120,300};
setColumns(columns,widths);
setDatas();
HBox buttonPanel = new HBox();
buttonPanel.setPadding(new Insets(5,5,5,5));
buttonPanel.setSpacing(20);
buttonPanel.setAlignment(Pos.CENTER);
this.setBottom(buttonPanel);
Button button1 = new Button("添加");
Button button2 = new Button("删除");
Button button3 = new Button("确定");
Button button4 = new Button("取消");
buttonPanel.getChildren().addAll(button1,button2,button3,button4);
button1.setOnAction((ActionEvent e) -> {
final DirectoryChooser directoryChooser =new DirectoryChooser();
final File selectedDirectory = directoryChooser.showDialog(MainFrame.primaryStage);
if(selectedDirectory!=null){
String id = String.valueOf(tableView.getItems().size()+1);
String name = selectedDirectory.getName();
String path = selectedDirectory.getAbsolutePath();
WorkPath workPath = new WorkPath(id,name,path,false);
tableView.getItems().add(workPath);
}
});
button2.setOnAction((ActionEvent e) -> {
int index = tableView.getSelectionModel().getSelectedIndex();
tableView.getItems().remove(index);
});
button3.setOnAction((ActionEvent e) -> {
Ini ini = EnvReadWriteUtil.getEvnIni();
File file = EnvReadWriteUtil.getEnvFile();
int id = 1;
for(WorkPath workPath:tableView.getItems()){
if(workPath.isDefaultPath()){
Section session = ini.get("ENVNUM");
session.put("DEFAULT", String.valueOf(id));
break;
}
id++;
}
List<Section> sections = ini.getAll("ITEM");
int count = sections.size();
for(int i=count-1;i>=0;i--){
sections.remove(i);
}
id = 1;
for(WorkPath workPath:tableView.getItems()){
Section session = ini.add("ITEM");
session.add("ID", String.valueOf(id));
session.add("NAME", workPath.getName());
session.add("PATH", workPath.getPath());
id++;
}
try {
ini.store(file);
} catch (IOException exception) {
exception.printStackTrace();
}
stage.close();
});
button4.setOnAction((ActionEvent e) -> {
stage.close();
});
this.setPrefHeight(200);
this.setPrefWidth(500);
}
public void setColumns(String[] columns, int[] widths) {
if (columns != null && widths != null && columns.length > 0) {
TableColumn<WorkPath, Boolean> col1 = new TableColumn<WorkPath, Boolean>("选择");
col1.setCellValueFactory(new PropertyValueFactory<WorkPath,Boolean>("defaultPath"));
col1.setCellFactory(CheckBoxTableCell.forTableColumn(col1));
col1.setEditable(true);
/*
col1.setOnEditCommit((CellEditEvent<WorkPath, Boolean> event)->{
logger.info(event.getNewValue()+":"+event.getOldValue());
ObservableList<WorkPath> list = tableView.getItems();
if(event.getNewValue()){
for(WorkPath workPath:list){
workPath.setDefaultPath(false);
logger.info(workPath);
}
}
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setDefaultPath(event.getNewValue());
logger.info(row);
});
*/
tableView.getColumns().add(col1);
TableColumn<WorkPath, String> col = new TableColumn<WorkPath, String>(columns[0]);
col.setPrefWidth(widths[0]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("id"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setId(event.getNewValue());
logger.info(row);
});
col.setEditable(true);
tableView.getColumns().add(col);
col = new TableColumn<WorkPath, String>(columns[1]);
col.setPrefWidth(widths[1]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("name"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setName(event.getNewValue());
logger.info(row);
});
col.setEditable(true);
tableView.getColumns().add(col);
col = new TableColumn<WorkPath, String>(columns[2]);
col.setPrefWidth(widths[2]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("path"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setPath(event.getNewValue());
logger.info(row);
});
//col.setEditable(true);
tableView.getColumns().add(col);
}
}
public void setDatas(){
Ini ini = EnvReadWriteUtil.getEvnIni();
Section session = ini.get("ENVNUM");
String defaultId = session.get("DEFAULT");
ObservableList<WorkPath> list = tableView.getItems();
for (Section aSession : ini.getAll("ITEM")) {
boolean defaultPath = false;
if(aSession.get("ID").equals(defaultId)){
defaultPath = true;
}
WorkPath dataRow = new WorkPath(aSession.get("ID"),aSession.get("NAME"),aSession.get("PATH"),defaultPath);
list.add(dataRow);
}
}
}
| [
"[email protected]"
] | |
b5f05d83a05f1ba42b35ed74e4297be8584ea1f2 | f8e6a972da48741270a273bcefece6dd846c7f62 | /app/src/main/java/com/example/lifestyleapp/DatabaseCustomFunctions.java | 7b100dc7649753cf954d8f559d6f5794b0d6a30a | [] | no_license | Matt-Parker99/LifestyleApp | 066349f8b297b24cd40d7aa1f564474d45265bf1 | 82bd6c6addcd921d9d953cf948ae01109b591970 | refs/heads/master | 2022-12-24T04:57:57.615839 | 2020-10-01T18:33:13 | 2020-10-01T18:33:13 | 256,202,401 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,811 | java | package com.example.lifestyleapp;
import android.util.Log;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FileDownloadTask;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class DatabaseCustomFunctions {
public final FirebaseAuth mAuth;
public final FirebaseFirestore mStorage;
public final StorageReference mStorageRef;
public final FirebaseUser user;
public final String UserId;
// Constructor
public DatabaseCustomFunctions(){
this.mAuth = FirebaseAuth.getInstance();
this.mStorage = FirebaseFirestore.getInstance();
this.mStorageRef = FirebaseStorage.getInstance().getReference();
this.user = this.mAuth.getCurrentUser();
this.UserId = this.user.getUid();
}
public void createNewIngredient(String name, Double price){
try {
Map<String, Object> data = new HashMap<>();
data.put("name", name);
data.put("price", price);
mStorage.collection("products").add(data);
} catch (Exception e) {
Log.e("databaseCustomFunctions : CreateNewIngredients", e.getLocalizedMessage());
e.printStackTrace();
}
}
public String getRecipeDescription(String recipeName) {
String result = "Error on reading "+recipeName+" !";
StorageReference recipeRef = mStorageRef.child("recipeDescriptions/"+recipeName);
File localFile = null;
try {
localFile = File.createTempFile(recipeName, "txt");
} catch (IOException e) {
e.printStackTrace();
}
try {
FileDownloadTask download = recipeRef.getFile(localFile);
while (download.isInProgress()) {
}
if (download.isSuccessful()){
StringBuilder text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(localFile));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
br.close();
result = text.toString();
}
catch (IOException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
| [
"[email protected]"
] | |
ff158945ac1e40b090885943c0e90c1e6b388baa | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Quartz/Quartz81.java | b282841baedf1422c8d21eb6509c3e08ee6de664 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) {
if (jobListener.getName() == null || jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (globalJobListeners) {
globalJobListeners.put(jobListener.getName(), jobListener);
LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>();
if(matchers != null && matchers.size() > 0)
matchersL.addAll(matchers);
else
matchersL.add(EverythingMatcher.allJobs());
globalJobListenersMatchers.put(jobListener.getName(), matchersL);
}
}
| [
"[email protected]"
] | |
33771895ecb54841535d53c2d92f8d8d90defb0f | afba6718a521e269f12d79bbe150e7c30b3696e6 | /app/src/main/java/me/kaede/frescosample/RecyclerView/RecyclerViewFragment.java | 8a464a4012373c0169661b539be9ab6299b6c277 | [] | no_license | xiangyunwan/fresco-sample-usage-master | 1407c7ce3350226011291755d2c429b5bbb8f0e5 | d715cf76128fbf8ee2a09ba118d9c91e5bf918b7 | refs/heads/master | 2020-12-24T19:12:40.287032 | 2016-04-13T09:20:21 | 2016-04-13T09:20:21 | 56,138,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,877 | java | package me.kaede.frescosample.recyclerview;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import me.kaede.frescosample.ImageApi;
import me.kaede.frescosample.R;
import java.util.List;
public class RecyclerViewFragment extends Fragment{
private static final String BUNDLE_INDEX = "BUNDLE_INDEX";
private int index;
public static RecyclerViewFragment newInstance(int index) {
RecyclerViewFragment fragment = new RecyclerViewFragment();
Bundle args = new Bundle();
args.putInt(BUNDLE_INDEX, index);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
index = getArguments().getInt(BUNDLE_INDEX);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
//find view
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
//init
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(index+1,StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
MyAdapter adapter = new MyAdapter(index);
recyclerView.setAdapter(adapter);
recyclerView.setHasFixedSize(false);
List<String> datas;
switch (index) {
case 0:
default:
datas = ImageApi.jk.getUrls();
break;
case 1:
datas = ImageApi.girly.getUrls();
break;
case 2:
datas = ImageApi.legs.getUrls();
break;
}
adapter.setDatas(datas);
return view;
}
}
| [
"[email protected]"
] | |
4ac7df5814e00d17ec9c192ddc0202bc192cf5ab | ebbcffc3521f2229b76898ced2d803b52d395cd9 | /src/main/java/com/kly/ants/Pattern/factory/ConcreteFactoryA2.java | 83764fb6abb683b06be91d82585f21f3bf908d2e | [] | no_license | lingyukong/ants | 2498e761b51abff624695efc7ff8342444d67fad | c99e07be0eb2f68dbacd78932f33fae753b107be | refs/heads/main | 2023-04-17T06:34:01.168961 | 2021-05-03T15:09:42 | 2021-05-03T15:09:42 | 330,420,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package com.kly.ants.Pattern.factory;
public class ConcreteFactoryA2 implements Factory{
public Product createProduct() {
return new ConcreteProductA2();
}
}
| [
"[email protected]"
] | |
c3e9d069e162d34d77d5f1834a529fd7efb93e34 | b5e265bcada4ec5934f86a27184c6707594bab18 | /Tropika_rev2/src/view/MainMenu.java | b12a8a23881c86bfc25b8acf9ec4e3a4d35c9a35 | [] | no_license | akmalulginan/jajaka | 0d99b64f9a378e069516c70d983b5147e52f1d05 | db121c02869d9963c71279ab03a6a4ac28ad2950 | refs/heads/master | 2021-01-10T14:58:37.039187 | 2016-02-18T19:41:10 | 2016-02-18T19:41:10 | 49,662,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,107 | java | /*
* 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 view;
import control.MenuControl;
import javax.swing.JButton;
import javax.swing.UIManager;
/**
*
* @author sipit
*/
public class MainMenu extends javax.swing.JFrame {
/**
* Creates new form Menu
*/
private MenuControl menuControl = new MenuControl();
public MainMenu() {
this.setExtendedState(this.getExtendedState() | MainMenu.MAXIMIZED_BOTH);
initComponents();
}
public JButton getCariButton() {
return cariButton;
}
public JButton getGudangButton() {
return gudangButton;
}
public JButton getHakAksesButton() {
return hakAksesButton;
}
public JButton getHargaButton() {
return hargaButton;
}
public JButton getHistoryButton() {
return historyButton;
}
public JButton getItemButton() {
return itemButton;
}
public JButton getKaryawanButton() {
return karyawanButton;
}
public JButton getKelompokButton() {
return kelompokButton;
}
public JButton getLaporanGudangButton() {
return laporanGudangButton;
}
public JButton getLaporanPembelianButton() {
return laporanPembelianButton;
}
public JButton getLaporanPenjualanButton() {
return laporanPenjualanButton;
}
public JButton getPasswordButton() {
return passwordButton;
}
public JButton getPembelianButton() {
return pembelianButton;
}
public JButton getPenjualanButton() {
return penjualanButton;
}
public JButton getSupplierButton() {
return supplierButton;
}
public JButton getTransaksiButton() {
return transaksiButton;
}
public JButton getTransaksiGudangButton() {
return transaksiGudangButton;
}
public JButton getUserButton() {
return userButton;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
masterDataTab = new javax.swing.JPanel();
gudangButton = new javax.swing.JButton();
itemButton = new javax.swing.JButton();
hargaButton = new javax.swing.JButton();
kelompokButton = new javax.swing.JButton();
supplierButton = new javax.swing.JButton();
karyawanTab = new javax.swing.JPanel();
karyawanButton = new javax.swing.JButton();
cariButton = new javax.swing.JButton();
securityTab = new javax.swing.JPanel();
userButton = new javax.swing.JButton();
passwordButton = new javax.swing.JButton();
hakAksesButton = new javax.swing.JButton();
historyButton = new javax.swing.JButton();
transaksiTab = new javax.swing.JPanel();
pembelianButton = new javax.swing.JButton();
penjualanButton = new javax.swing.JButton();
transaksiGudangButton = new javax.swing.JButton();
transaksiButton = new javax.swing.JButton();
laporanTab = new javax.swing.JPanel();
laporanGudangButton = new javax.swing.JButton();
laporanPembelianButton = new javax.swing.JButton();
laporanPenjualanButton = new javax.swing.JButton();
jPanel24 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
pane = new javax.swing.JTabbedPane();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Aplikasi PT Tropika");
setBackground(new java.awt.Color(51, 51, 51));
jTabbedPane1.setBackground(new java.awt.Color(255, 255, 255));
jTabbedPane1.setForeground(new java.awt.Color(40, 40, 40));
jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jTabbedPane1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jTabbedPane1.setOpaque(true);
masterDataTab.setBackground(new java.awt.Color(255, 255, 255));
gudangButton.setBackground(new java.awt.Color(204, 215, 222));
gudangButton.setForeground(new java.awt.Color(40, 40, 40));
gudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Gudang.png"))); // NOI18N
gudangButton.setText("<html><hr>Gudang");
gudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
gudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
gudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
gudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
gudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gudangButtonActionPerformed(evt);
}
});
itemButton.setBackground(new java.awt.Color(204, 215, 222));
itemButton.setForeground(new java.awt.Color(40, 40, 40));
itemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Item.png"))); // NOI18N
itemButton.setText("<html><hr>Item");
itemButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
itemButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
itemButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
itemButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
itemButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemButtonActionPerformed(evt);
}
});
hargaButton.setBackground(new java.awt.Color(204, 215, 222));
hargaButton.setForeground(new java.awt.Color(40, 40, 40));
hargaButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Harga.png"))); // NOI18N
hargaButton.setText("<html><hr>Harga");
hargaButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
hargaButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
hargaButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
hargaButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
hargaButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hargaButtonActionPerformed(evt);
}
});
kelompokButton.setBackground(new java.awt.Color(204, 215, 222));
kelompokButton.setForeground(new java.awt.Color(40, 40, 40));
kelompokButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Kelompok.png"))); // NOI18N
kelompokButton.setText("<html><hr>Kategori");
kelompokButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
kelompokButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
kelompokButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
kelompokButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
kelompokButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kelompokButtonActionPerformed(evt);
}
});
supplierButton.setBackground(new java.awt.Color(204, 215, 222));
supplierButton.setForeground(new java.awt.Color(40, 40, 40));
supplierButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Supplier.png"))); // NOI18N
supplierButton.setText("<html><hr>Supplier");
supplierButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
supplierButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
supplierButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
supplierButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
supplierButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
supplierButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout masterDataTabLayout = new javax.swing.GroupLayout(masterDataTab);
masterDataTab.setLayout(masterDataTabLayout);
masterDataTabLayout.setHorizontalGroup(
masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(masterDataTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(gudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(itemButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hargaButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(kelompokButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(supplierButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(584, Short.MAX_VALUE))
);
masterDataTabLayout.setVerticalGroup(
masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(masterDataTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gudangButton)
.addComponent(supplierButton)
.addComponent(kelompokButton)
.addComponent(hargaButton)
.addComponent(itemButton))
.addContainerGap(12, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Master Data", masterDataTab);
karyawanTab.setBackground(new java.awt.Color(255, 255, 255));
karyawanButton.setBackground(new java.awt.Color(204, 215, 222));
karyawanButton.setForeground(new java.awt.Color(40, 40, 40));
karyawanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/UserKaryawan.png"))); // NOI18N
karyawanButton.setText("<html><hr>Karyawan");
karyawanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
karyawanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
karyawanButton.setMaximumSize(new java.awt.Dimension(2147483647, 79));
karyawanButton.setMinimumSize(new java.awt.Dimension(77, 79));
karyawanButton.setPreferredSize(new java.awt.Dimension(77, 79));
karyawanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
karyawanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
karyawanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
karyawanButtonActionPerformed(evt);
}
});
cariButton.setBackground(new java.awt.Color(204, 215, 222));
cariButton.setForeground(new java.awt.Color(40, 40, 40));
cariButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Preview.png"))); // NOI18N
cariButton.setText("<html><hr>Cari");
cariButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
cariButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
cariButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
cariButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
cariButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cariButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout karyawanTabLayout = new javax.swing.GroupLayout(karyawanTab);
karyawanTab.setLayout(karyawanTabLayout);
karyawanTabLayout.setHorizontalGroup(
karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(karyawanTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(karyawanButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cariButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(845, Short.MAX_VALUE))
);
karyawanTabLayout.setVerticalGroup(
karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(karyawanTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(karyawanButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cariButton))
.addContainerGap(12, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Karyawan", karyawanTab);
securityTab.setBackground(new java.awt.Color(255, 255, 255));
userButton.setBackground(new java.awt.Color(204, 215, 222));
userButton.setForeground(new java.awt.Color(40, 40, 40));
userButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/UserSkurity.png"))); // NOI18N
userButton.setText("<html><hr>User");
userButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
userButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
userButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
userButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
userButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
userButtonActionPerformed(evt);
}
});
passwordButton.setBackground(new java.awt.Color(204, 215, 222));
passwordButton.setForeground(new java.awt.Color(40, 40, 40));
passwordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Password.png"))); // NOI18N
passwordButton.setText("<html><hr>Password");
passwordButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
passwordButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
passwordButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
passwordButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
passwordButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
passwordButtonActionPerformed(evt);
}
});
hakAksesButton.setBackground(new java.awt.Color(204, 215, 222));
hakAksesButton.setForeground(new java.awt.Color(40, 40, 40));
hakAksesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/HakAkses.png"))); // NOI18N
hakAksesButton.setText("<html><hr>Hak Akses");
hakAksesButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
hakAksesButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
hakAksesButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
hakAksesButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
hakAksesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hakAksesButtonActionPerformed(evt);
}
});
historyButton.setBackground(new java.awt.Color(204, 215, 222));
historyButton.setForeground(new java.awt.Color(40, 40, 40));
historyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/History.png"))); // NOI18N
historyButton.setText("<html><hr>History");
historyButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
historyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
historyButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
historyButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
javax.swing.GroupLayout securityTabLayout = new javax.swing.GroupLayout(securityTab);
securityTab.setLayout(securityTabLayout);
securityTabLayout.setHorizontalGroup(
securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(securityTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(userButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(passwordButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hakAksesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(665, Short.MAX_VALUE))
);
securityTabLayout.setVerticalGroup(
securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(securityTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hakAksesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(passwordButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(userButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Security", securityTab);
transaksiTab.setBackground(new java.awt.Color(255, 255, 255));
pembelianButton.setBackground(new java.awt.Color(204, 215, 222));
pembelianButton.setForeground(new java.awt.Color(40, 40, 40));
pembelianButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiPembelian.png"))); // NOI18N
pembelianButton.setText("<html><hr>Pembelian");
pembelianButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
pembelianButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
pembelianButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
pembelianButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
pembelianButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pembelianButtonActionPerformed(evt);
}
});
penjualanButton.setBackground(new java.awt.Color(204, 215, 222));
penjualanButton.setForeground(new java.awt.Color(40, 40, 40));
penjualanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiPenjualan.png"))); // NOI18N
penjualanButton.setText("<html><hr>Penjualan");
penjualanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
penjualanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
penjualanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
penjualanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
penjualanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
penjualanButtonActionPerformed(evt);
}
});
transaksiGudangButton.setBackground(new java.awt.Color(204, 215, 222));
transaksiGudangButton.setForeground(new java.awt.Color(40, 40, 40));
transaksiGudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiGudang.png"))); // NOI18N
transaksiGudangButton.setText("<html><hr>Gudang");
transaksiGudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
transaksiGudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
transaksiGudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
transaksiGudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
transaksiGudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
transaksiGudangButtonActionPerformed(evt);
}
});
transaksiButton.setBackground(new java.awt.Color(204, 215, 222));
transaksiButton.setForeground(new java.awt.Color(40, 40, 40));
transaksiButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Transfer.png"))); // NOI18N
transaksiButton.setText("<html><hr>Transaksi");
transaksiButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
transaksiButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
transaksiButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
transaksiButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
javax.swing.GroupLayout transaksiTabLayout = new javax.swing.GroupLayout(transaksiTab);
transaksiTab.setLayout(transaksiTabLayout);
transaksiTabLayout.setHorizontalGroup(
transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(transaksiTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(penjualanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(transaksiGudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(transaksiButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(667, Short.MAX_VALUE))
);
transaksiTabLayout.setVerticalGroup(
transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(transaksiTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(transaksiButton)
.addComponent(penjualanButton)
.addComponent(pembelianButton)
.addComponent(transaksiGudangButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Transaksi", transaksiTab);
laporanTab.setBackground(new java.awt.Color(255, 255, 255));
laporanGudangButton.setBackground(new java.awt.Color(204, 215, 222));
laporanGudangButton.setForeground(new java.awt.Color(40, 40, 40));
laporanGudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanGudang.png"))); // NOI18N
laporanGudangButton.setText("<html><hr>Gudang");
laporanGudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanGudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanGudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanGudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanGudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanGudangButtonActionPerformed(evt);
}
});
laporanPembelianButton.setBackground(new java.awt.Color(204, 215, 222));
laporanPembelianButton.setForeground(new java.awt.Color(40, 40, 40));
laporanPembelianButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanPembelian.png"))); // NOI18N
laporanPembelianButton.setText("<html><hr>Pembelian");
laporanPembelianButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanPembelianButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanPembelianButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanPembelianButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanPembelianButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanPembelianButtonActionPerformed(evt);
}
});
laporanPenjualanButton.setBackground(new java.awt.Color(204, 215, 222));
laporanPenjualanButton.setForeground(new java.awt.Color(40, 40, 40));
laporanPenjualanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanPenjualan.png"))); // NOI18N
laporanPenjualanButton.setText("<html><hr>Penjualan");
laporanPenjualanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanPenjualanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanPenjualanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanPenjualanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanPenjualanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanPenjualanButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout laporanTabLayout = new javax.swing.GroupLayout(laporanTab);
laporanTab.setLayout(laporanTabLayout);
laporanTabLayout.setHorizontalGroup(
laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(laporanGudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(laporanPembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(laporanPenjualanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(754, Short.MAX_VALUE))
);
laporanTabLayout.setVerticalGroup(
laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addGroup(laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(laporanPenjualanButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(laporanPembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(laporanTabLayout.createSequentialGroup()
.addComponent(laporanGudangButton)
.addGap(13, 13, 13))))
);
jTabbedPane1.addTab("Laporan", laporanTab);
jPanel24.setBackground(new java.awt.Color(75, 191, 96));
jLabel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Aplikasi PT Tropica SIC");
jLabel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Jl. Sunan Demak No. 01 Rawamangun Jakarta Timur DKI");
jPanel7.setBackground(new java.awt.Color(65, 166, 83));
jLabel3.setBackground(new java.awt.Color(255, 255, 255));
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/app.png"))); // NOI18N
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addContainerGap(36, Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(31, 31, 31))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addContainerGap(19, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
jPanel24.setLayout(jPanel24Layout);
jPanel24Layout.setHorizontalGroup(
jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel24Layout.createSequentialGroup()
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel24Layout.setVerticalGroup(
jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel24Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addContainerGap())
);
pane.setBackground(new java.awt.Color(204, 215, 222));
pane.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
paneMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTabbedPane1)
.addComponent(pane, javax.swing.GroupLayout.Alignment.TRAILING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pane, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void itemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemButtonActionPerformed
// TODO add your handling code here:
ItemPanel barang = new ItemPanel();
menuControl.newTab(barang, pane);
}//GEN-LAST:event_itemButtonActionPerformed
private void gudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gudangButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new GudangPanel(), pane);
}//GEN-LAST:event_gudangButtonActionPerformed
private void hargaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hargaButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new DataHargaPanel(), pane);
}//GEN-LAST:event_hargaButtonActionPerformed
private void kelompokButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kelompokButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new KategoriPanel(), pane);
}//GEN-LAST:event_kelompokButtonActionPerformed
private void supplierButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supplierButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new SupplierPanel(), pane);
}//GEN-LAST:event_supplierButtonActionPerformed
private void karyawanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_karyawanButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new KaryawanPanel(), pane);
}//GEN-LAST:event_karyawanButtonActionPerformed
private void cariButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cariButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new DataKaryawanPanel(), pane);
}//GEN-LAST:event_cariButtonActionPerformed
private void userButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new PenggunaPanel(), pane);
}//GEN-LAST:event_userButtonActionPerformed
private void passwordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordButtonActionPerformed
menuControl.newTab(new PasswordPanel(), pane);
}//GEN-LAST:event_passwordButtonActionPerformed
private void hakAksesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hakAksesButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new HakAksesPanel(), pane);
}//GEN-LAST:event_hakAksesButtonActionPerformed
private void pembelianButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pembelianButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new PembelianBarangPanel(), pane);
}//GEN-LAST:event_pembelianButtonActionPerformed
private void paneMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_paneMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_paneMouseClicked
private void penjualanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_penjualanButtonActionPerformed
menuControl.newTab(new PenjualanBarangPanel(), pane);
}//GEN-LAST:event_penjualanButtonActionPerformed
private void laporanGudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanGudangButtonActionPerformed
menuControl.newTab(new LaporanGudangPanel(), pane);
}//GEN-LAST:event_laporanGudangButtonActionPerformed
private void laporanPembelianButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanPembelianButtonActionPerformed
menuControl.newTab(new LaporanPembelianPanel(), pane);
}//GEN-LAST:event_laporanPembelianButtonActionPerformed
private void laporanPenjualanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanPenjualanButtonActionPerformed
menuControl.newTab(new LaporanPenjualanPanel(), pane);
}//GEN-LAST:event_laporanPenjualanButtonActionPerformed
private void transaksiGudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transaksiGudangButtonActionPerformed
menuControl.newTab(new TransaksiGudangPanel(), pane);
}//GEN-LAST:event_transaksiGudangButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
// try {
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
// } catch (Exception e) {
// System.out.println("UIManager Exception : " + e);
// }
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainMenu().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cariButton;
private javax.swing.JButton gudangButton;
private javax.swing.JButton hakAksesButton;
private javax.swing.JButton hargaButton;
private javax.swing.JButton historyButton;
private javax.swing.JButton itemButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel24;
private javax.swing.JPanel jPanel7;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JButton karyawanButton;
private javax.swing.JPanel karyawanTab;
private javax.swing.JButton kelompokButton;
private javax.swing.JButton laporanGudangButton;
private javax.swing.JButton laporanPembelianButton;
private javax.swing.JButton laporanPenjualanButton;
private javax.swing.JPanel laporanTab;
private javax.swing.JPanel masterDataTab;
private javax.swing.JTabbedPane pane;
private javax.swing.JButton passwordButton;
private javax.swing.JButton pembelianButton;
private javax.swing.JButton penjualanButton;
private javax.swing.JPanel securityTab;
private javax.swing.JButton supplierButton;
private javax.swing.JButton transaksiButton;
private javax.swing.JButton transaksiGudangButton;
private javax.swing.JPanel transaksiTab;
private javax.swing.JButton userButton;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
2e41a46a36d474993055305a4ec422543795047d | a36dce4b6042356475ae2e0f05475bd6aed4391b | /2005/NRI-AppLogic/source/com/nri/exception/DuplicateKeyException.java | 037783f2f1a8bcc67065d0e4bbe8e879ee5431f4 | [] | no_license | ildar66/WSAD_NRI | b21dbee82de5d119b0a507654d269832f19378bb | 2a352f164c513967acf04d5e74f36167e836054f | refs/heads/master | 2020-12-02T23:59:09.795209 | 2017-07-01T09:25:27 | 2017-07-01T09:25:27 | 95,954,234 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.nri.exception;
public class DuplicateKeyException extends MappingException {
/**
* Constructor for DuplicateKeyException
*/
public DuplicateKeyException() {
super();
}
/**
* Constructor for DuplicateKeyException
*/
public DuplicateKeyException(String arg0) {
super(arg0);
}
public DuplicateKeyException(Exception arg0, String desc) {
super(arg0, desc);
}
}
| [
"[email protected]"
] | |
a99013e81c0f8696bd567625a98ed00a8c75f3e6 | 7de840e11447e9784f63c4281b03e93d8cf69457 | /oneVRE/GWT/OneVREGWT/src/main/java/com/googlecode/onevre/gwt/client/ag/types/VectorJSO.java | 29e5b72115df3f4802689ac30af36d90570723e6 | [
"BSD-2-Clause"
] | permissive | rowleya/onevre | 553cedc7e868ae399608676310fd5274b7465ece | 4e6a6de560a8f4feea60e2e0010471c749fe8a6f | refs/heads/master | 2016-09-05T23:34:29.889486 | 2011-02-21T16:04:26 | 2011-02-21T16:04:26 | 32,145,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.googlecode.onevre.gwt.client.ag.types;
import com.google.gwt.core.client.JavaScriptObject;
public class VectorJSO<T extends JavaScriptObject> extends JavaScriptObject {
protected VectorJSO() {
}
public final native T get(int i) /*-{
return this.get(i);
}-*/;
public final native int size() /*-{
return this.size();
}-*/;
}
| [
"ts23gm@ff34145c-7872-3b35-6561-e9169588922b"
] | ts23gm@ff34145c-7872-3b35-6561-e9169588922b |
83547c6127b6adb7b93989b1cddbb1afcecc5c2e | 8270d89d5b7711806efc96d26380e7c51c7b8ec6 | /src/main/java/pattern/structural/adapter/AC220.java | 2b7cfe3dd90986efdcdc2688b3a44f7ae1ab7a30 | [] | no_license | luran0821/DesignPattern | 173fb57b3f4d90a88ee89f0ded05509eab5ca66f | 909545b6b6f2122e82369ff9f13522b4d72f9c1e | refs/heads/master | 2023-08-19T08:06:39.255340 | 2019-10-06T12:56:00 | 2019-10-06T12:56:00 | 212,748,434 | 0 | 0 | null | 2023-08-04T19:33:34 | 2019-10-04T06:17:57 | Java | UTF-8 | Java | false | false | 207 | java | package pattern.structural.adapter;
public class AC220 {
public int outputAC220V(){
int output = 220;
System.out.println("输出交流点" + output+ "V");
return output;
}
}
| [
"[email protected]"
] | |
fe2bbf8e6678ce286551e6961735c6e661f1ddf6 | 44aeaa528a9e3cfa0597808ca031695f7c836593 | /src/main/java/kr/ac/kopo/kopo08/domain/Board.java | ab938ec88c5c82361722fa4e911fdb509b9de9b5 | [] | no_license | EunbInn/BoardUsingSpring | 3fb691cd65f2fcdd88245847c6388443c83df6d6 | 5a6d6efc9bd36dfdd7a527a7c3038728b0920946 | refs/heads/master | 2023-07-03T04:24:53.002073 | 2021-07-21T12:13:58 | 2021-07-21T12:13:58 | 383,960,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package kr.ac.kopo.kopo08.domain;
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.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Board {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column
private Long id;
@Column
private String title;
//fetch type이 Lazy로 되어있으면 늦게 가져옴 느긋하게 eager은 바로
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "board")
private List<BoardItem> boardItems;
public Board() {
}
public Board(Long id) {
this.id = id;
}
public Board(Long id, String title) {
this.id = id;
this.title = title;
}
public Board(String title) {
this.title = title;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<BoardItem> getBoardItems() {
return boardItems;
}
public void setBoardItems(List<BoardItem> boardItem) {
this.boardItems = boardItem;
}
}
| [
"[email protected]"
] | |
14c906f33d047f8e8e668885dee99f72ea239185 | 682082f4ea06ea438e0243c5504918cef9d6c58a | /ReviewExamen/src/smokers/agent.java | 8023b49f40364e272ee90b51d65959b536177563 | [] | no_license | HassenBenSlima/Thread-Java | ae7883fb14430d75ab7e31b25cf06d0dbf07d231 | c113991f558deaaeda5038592fe5a49e58c28c13 | refs/heads/master | 2020-08-08T06:11:10.541014 | 2019-10-08T22:41:05 | 2019-10-08T22:41:05 | 213,749,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package smokers;
public class agent extends Thread {
private table smokingtable;
public agent(table pSmokingtable) {
smokingtable = pSmokingtable;
}
@Override
public void run() {
while (true) {
try {
Thread.sleep(5000);
smokingtable.setAgentElements();
// this triggers the smoker-threads to look at the table
output("The agents puts " + smokingtable.getAgentElements() + " on the table.");
// pause the agent while one smoker thread is running
pause();
} catch (Exception e) {
}
}
}
public synchronized void wake() {
try {
notify();
} catch (Exception e) {
}
}
public synchronized void pause() {
try {
this.wait();
} catch (Exception e) {
}
}
private void output(String pOutput) {
System.out.println(pOutput);
}
}
| [
"Hassen.BenSlima"
] | Hassen.BenSlima |
bc02a43245f3bbc60e37fa517ef2af3263db614d | e6c155058c93631bcc852e12af330fd0331a3b9e | /Problem1.java | 20547a449485624ada214439e17c3e2bf179c35f | [] | no_license | Breezy95/assignment | c938e401517785eeec069de274ffd456dae4cb4b | c017c7a6d9cc4076282cf5affd94a053e90df77e | refs/heads/master | 2020-03-29T01:22:03.912939 | 2018-09-19T03:16:18 | 2018-09-19T03:16:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | //Fabrice Benoit
//109108791
import java.io.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.*;
public class Problem1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList<Integer> arr = new ArrayList<Integer>();
try { // 1st part of question, creates file
File f = new File("integerFile.txt");
FileWriter fw = new FileWriter(f, false);
PrintWriter pw = new PrintWriter(fw);
for(int i = 0; i<100;i++) {
pw.print((int)(Math.random()*101) + " ");
pw.flush();
}
}
catch(IOException ex) { System.out.println("Cannot create the file");}
catch(Exception exc) { System.out.println("Error Occurred at file reading");}
try {
File f = new File("integerFile.txt");
Scanner input = new Scanner(f);
while(input.hasNext()) {
arr.add(input.nextInt());
}
} catch(IOException ex) {
System.out.println("scanner error");
}
catch(Exception excep){ System.out.println("Error in file reading");}
arr.sort(null);
//Collections.sort(arr);
System.out.println(arr.toString().substring(1, arr.toString().length()-1));
}
}
| [
"[email protected]"
] | |
341a7b8f22c200b4c8f600f08dda89f0fe4ef893 | ec67d903843cc666fa42bd4f25c68756d4f2774d | /api-service/src/main/java/com/bitmark/apiservice/params/query/AbsQueryBuilder.java | cdd77475904837605f8b50288c6f508270c7a494 | [
"ISC"
] | permissive | nguyennh-0786/bitmark-sdk-java | 13b0f37a9bcf1f37e17ebccab3503a493aa89963 | 63163440134fe19a2eb3e6e23d7e49e288cf869c | refs/heads/master | 2020-08-01T11:48:04.374810 | 2019-07-02T08:24:47 | 2019-07-02T08:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,299 | java | package com.bitmark.apiservice.params.query;
import com.bitmark.apiservice.utils.HttpUtils;
import com.google.gson.annotations.SerializedName;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.TreeMap;
import static com.bitmark.apiservice.utils.HttpUtils.buildArrayQueryString;
/**
* @author Hieu Pham
* @since 9/16/18
* Email: [email protected]
* Copyright © 2018 Bitmark. All rights reserved.
*/
public abstract class AbsQueryBuilder implements QueryBuilder {
@Override
public QueryParams build() {
return new QueryParamsImpl(this);
}
@Override
public String toUrlQuery() {
try {
StringBuilder builder = new StringBuilder();
Map<String, Object> valueMap = getValues(this);
int iteration = 0;
for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
iteration++;
String name = entry.getKey();
Object value = entry.getValue();
if (value.getClass().isArray()) {
builder.append(HttpUtils.buildArrayQueryString(name, value));
} else {
builder.append(name).append("=").append(value.toString());
}
if (iteration < valueMap.size()) builder.append("&");
}
return builder.toString();
} catch (IllegalAccessException e) {
return null;
}
}
private Map<String, Object> getValues(QueryBuilder builder) throws IllegalAccessException {
Map<String, Object> valueMap = new TreeMap<>();
Field[] fields = builder.getClass().getDeclaredFields();
if (fields.length > 0) {
for (Field field : fields) {
field.setAccessible(true);
Object value = field.get(builder);
if (value == null) continue;
SerializedName annotationName = field.getAnnotation(SerializedName.class);
String name;
if (annotationName != null) {
name = annotationName.value();
} else {
name = field.getName();
}
valueMap.put(name, value);
}
}
return valueMap;
}
}
| [
"[email protected]"
] | |
d995b6b0c4d0315068e59ae0309a2d167c2531b1 | 8f9ffa5632e7da3ce0737d4f3bb012aa10949183 | /app/src/test/java/com/khokan/todo_list/ExampleUnitTest.java | 2709d075c962199b598759da903af6b056365cd3 | [] | no_license | Khokan-Barai/ToDo-List | 3f9fe93536721c8cf4df7721b7ce4ab9b407328c | 91900c2dd34d1c7ef2c619863b97383bc569ae4a | refs/heads/master | 2020-04-07T00:39:40.079674 | 2018-11-16T19:48:18 | 2018-11-16T19:48:18 | 157,913,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.khokan.todo_list;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
589362dd27929720369b26ec15b824a0406d560b | fb6399ebaa4788ad52c288728044da3bd46dca67 | /src/main/java/com/sprint/models/domain/MemberWithoutPwd.java | ec0290f806eec1be17f98b9c620afe5c1346650b | [] | no_license | enough617/VIPManager | ffb00a6bbc181a8be4a58f633f204d771c825b9e | d5da17da4d4f6cce27d57227337c67e48124b894 | refs/heads/master | 2021-12-15T10:57:09.799586 | 2017-08-17T11:42:30 | 2017-08-17T11:44:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,484 | java | package com.sprint.models.domain;
import java.util.Date;
public class MemberWithoutPwd {
private int id;
private Date createTime;
private Date updateTime;
private String cardNumber;
private String memberRank;
private String memberName;
private String memberPhone;
private int status;
private double money;
public void setId(int id) {
this.id = id;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public void setMemeberRank(String memberRank) {
this.memberRank = memberRank;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public void setStatus(int status) {
this.status = status;
}
public void setMoney(double money) {
this.money = money;
}
public int getId() {
return id;
}
public Date getCreateTime() {
return createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public String getCardNumber() {
return cardNumber;
}
public String getMemberRank() {
return memberRank;
}
public String getMemberPhone() {
return memberPhone;
}
public String getMemberName() {
return memberName;
}
public int getStatus() {
return status;
}
public double getMoney() {
return money;
}
}
| [
"[email protected]"
] | |
4065828c5cc223171619166497d6c37ce1186671 | 4e2bc2fcb042672c53ba63b485eb6b6191b056a1 | /Digraph.java | 4b3c67251b43d8b1baffb56dab143db342b5f10a | [] | no_license | mmxcraft/java_sample | fe125924a8ce48b7009e50f89bb710728e9ca84c | 930945918234177e7ceaa97751bef07d9e26f31d | refs/heads/master | 2021-01-21T10:29:42.383169 | 2017-06-28T07:13:34 | 2017-06-28T07:13:34 | 91,693,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.Bag;
import edu.princeton.cs.algs4.StdOut;
/**
* Created by mofma on 2017/5/2.
*/
public class Digraph {
private final int V;
private int E;
private Bag<Integer>[] adj;
public Digraph(int V) {
this.V = V;
this.E = 0;
adj = (Bag<Integer> []) new Bag[V];
for (int v = 0; v < V; v++)
adj[v] = new Bag<Integer>();
}
public Digraph(In in) {
this(in.readInt());
int E = in.readInt();
for (int i = 0; i < E; i++) {
int v = in.readInt();
int w = in.readInt();
addEdge(v, w);
}
}
public int V() {
return V;
}
public int E() {
return E;
}
public void addEdge(int v, int w) {
adj[v].add(w);
E++;
}
public Iterable<Integer> adj(int v) {
return adj[v];
}
public Digraph reverse() {
Digraph R = new Digraph(V);
for (int v = 0; v < V; v++)
for ( int w: adj[v])
R.addEdge(w, v);
return R;
}
public String toString() {
String s = V + " vertices, " + E + " edges\n";
for (int v = 0 ; v < V; v++){
s += v + ": ";
for(int w: this.adj[v])
s += w + " ";
s += "\n";
}
return s;
}
public static void main(String[] args) {
String fileName = args[0];
In in = new In(fileName);
Digraph dG = new Digraph(in);
StdOut.print(dG);
}
}
| [
"[email protected]"
] | |
b7a93827e4c692d2ddc9841c5647c233936b310f | 962daca6d378f8a278657618990e7e43bd7a9d91 | /src/main/java/com/testRepository/testclass2.java | d8ceff5f05121043c8aba80b2cc6a2f11c50bbb2 | [] | no_license | PoojaSapre/testRepository | e838d2a83ceffdbb6e3a5bb97d43116a15e9f445 | 2942f87c1ce6909ccd377dcb9006549f5b4ec398 | refs/heads/master | 2021-05-19T00:33:26.867851 | 2020-03-31T05:13:54 | 2020-03-31T05:13:54 | 251,496,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package com.testRepository;
public class testclass2 {
}
| [
"[email protected]"
] | |
f3543250f2af6fc4699f47ceae4c60db20eb09ba | f94510f053eeb8dd18ea5bfde07f4bf6425401c2 | /app/src/main/java/com/zhiyicx/thinksnsplus/modules/currency/withdraw/WithdrawCurrencyComponent.java | 15e142a091d7487b71aa54e16884a8f6798a610f | [] | no_license | firwind/3fou_com_android | e13609873ae030f151c62dfaf836a858872fa44c | 717767cdf96fc2f89238c20536fa4b581a22d9aa | refs/heads/master | 2020-03-28T09:02:56.431407 | 2018-09-07T02:14:54 | 2018-09-07T02:14:54 | 148,009,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.zhiyicx.thinksnsplus.modules.currency.withdraw;
import com.zhiyicx.common.dagger.scope.FragmentScoped;
import com.zhiyicx.thinksnsplus.base.AppComponent;
import com.zhiyicx.thinksnsplus.base.InjectComponent;
import dagger.Component;
/**
* author: huwenyong
* date: 2018/7/18 14:23
* description:
* version:
*/
@FragmentScoped
@Component(dependencies = AppComponent.class, modules = WithdrawCurrencyPresenterMoudle.class)
public interface WithdrawCurrencyComponent extends InjectComponent<WithdrawCurrencyActivity>{
}
| [
"[email protected]"
] | |
d68fb4081deca0ce53385643a9ed2e78713cf0f9 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/dbeaver/2018/12/JDBCObjectCache.java | bbefbac9285d5806ba8359e81f408e8395e3b286 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 5,984 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.model.impl.jdbc.cache;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement;
import org.jkiss.dbeaver.model.impl.AbstractObjectCache;
import org.jkiss.dbeaver.model.messages.ModelMessages;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.sql.SQLException;
import java.util.*;
/**
* Various objects cache.
* Simple cache which may read objects from database and keep them.
*/
public abstract class JDBCObjectCache<OWNER extends DBSObject, OBJECT extends DBSObject> extends AbstractObjectCache<OWNER, OBJECT>
{
public static final int DEFAULT_MAX_CACHE_SIZE = 1000000;
private static final Log log = Log.getLog(JDBCObjectCache.class);
// Maximum number of objects in cache
private int maximumCacheSize = DEFAULT_MAX_CACHE_SIZE;
protected JDBCObjectCache() {
}
public void setMaximumCacheSize(int maximumCacheSize) {
this.maximumCacheSize = maximumCacheSize;
}
abstract protected JDBCStatement prepareObjectsStatement(@NotNull JDBCSession session, @NotNull OWNER owner)
throws SQLException;
@Nullable
abstract protected OBJECT fetchObject(@NotNull JDBCSession session, @NotNull OWNER owner, @NotNull JDBCResultSet resultSet)
throws SQLException, DBException;
@NotNull
@Override
public Collection<OBJECT> getAllObjects(@NotNull DBRProgressMonitor monitor, @Nullable OWNER owner)
throws DBException
{
if (!isFullyCached()) {
loadObjects(monitor, owner);
}
return getCachedObjects();
}
@Override
public OBJECT getObject(@NotNull DBRProgressMonitor monitor, @NotNull OWNER owner, @NotNull String name)
throws DBException
{
if (!isFullyCached()) {
this.loadObjects(monitor, owner);
}
return getCachedObject(name);
}
protected synchronized void loadObjects(DBRProgressMonitor monitor, OWNER owner)
throws DBException
{
if (isFullyCached() || monitor.isCanceled()) {
return;
}
List<OBJECT> tmpObjectList = new ArrayList<>();
DBPDataSource dataSource = owner.getDataSource();
if (dataSource == null) {
throw new DBException(ModelMessages.error_not_connected_to_database);
}
try {
try (JDBCSession session = DBUtils.openMetaSession(monitor, owner, "Load objects from " + owner.getName())) {
try (JDBCStatement dbStat = prepareObjectsStatement(session, owner)) {
monitor.subTask("Load " + getCacheName());
dbStat.setFetchSize(DBConstants.METADATA_FETCH_SIZE);
dbStat.executeStatement();
JDBCResultSet dbResult = dbStat.getResultSet();
if (dbResult != null) {
try {
while (dbResult.next()) {
if (monitor.isCanceled()) {
break;
}
OBJECT object = fetchObject(session, owner, dbResult);
if (object == null) {
continue;
}
tmpObjectList.add(object);
// Do not log every object load. This overheats UI in case of long lists
//monitor.subTask(object.getName());
if (tmpObjectList.size() == maximumCacheSize) {
log.warn("Maximum cache size exceeded (" + maximumCacheSize + ") in " + this);
break;
}
}
} finally {
dbResult.close();
}
}
}
} catch (SQLException ex) {
throw new DBException(ex, dataSource);
}
} catch (DBException e) {
if (!handleCacheReadError(e)) {
throw e;
}
}
Comparator<OBJECT> comparator = getListOrderComparator();
if (comparator != null) {
tmpObjectList.sort(comparator);
}
detectCaseSensitivity(owner);
mergeCache(tmpObjectList);
this.invalidateObjects(monitor, owner, new CacheIterator());
}
protected String getCacheName() {
return getClass().getSimpleName();
}
// Can be implemented to provide custom cache error handler
protected boolean handleCacheReadError(DBException error) {
return false;
}
}
| [
"[email protected]"
] | |
2681c6978abd53389e356d16c11618fe847e44ff | 2797280c63fb027887ad5db57b4f1938a7fb03bb | /src/com/fantest/Off.java | 05a6b9f4de0ed637e7400e74b5824916191cf799 | [] | no_license | NavyaK-T/FanTest-Problem | fba774f2c33b28ca3f43482a3084ec8c55d61e38 | e7dbae08c840536721b3a92418ab66ee3798ff7b | refs/heads/master | 2023-04-17T13:49:42.911148 | 2021-04-23T21:05:19 | 2021-04-23T21:05:19 | 361,004,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package com.fantest;
public class Off implements SpeedLevel {
@Override
public void pull(CeilingFanPullChain pullChain) {
pullChain.setCurrentState(new SpeedLevelOne());
System.out.println("Speed level 1 with direction "+pullChain.getCurrentDirection());
}
}
| [
"[email protected]"
] | |
cf5a65fb73a7d8cb62341898339e610bf30eb8db | 81834d4e4e7eff486f87f8a5138c951e88425cb7 | /autodownloader/AutodownloaderExtension.java | 646980288c876bb17e11a912a98b2f6934b4ad98 | [] | no_license | paul545/Autodownloader | 64e07c211e42bf383cd9ad32c705079e2672cd56 | 61a93cd7fe97c8058e19e9508b9e0b0660b7a28e | refs/heads/master | 2020-05-15T14:11:49.692061 | 2019-04-19T21:26:05 | 2019-04-19T21:26:05 | 169,258,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,769 | java | package org.jdownloader.extensions.autodownloader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownEvent;
import org.appwork.shutdown.ShutdownRequest;
import org.appwork.storage.config.ValidationException;
import org.appwork.storage.config.events.GenericConfigEventListener;
import org.appwork.storage.config.handler.KeyHandler;
import org.appwork.utils.Application;
import org.appwork.utils.event.queue.QueueAction;
import org.appwork.utils.swing.EDTRunner;
import org.jdownloader.controlling.contextmenu.ContextMenuManager;
import org.jdownloader.controlling.contextmenu.MenuContainerRoot;
import org.jdownloader.controlling.contextmenu.MenuExtenderHandler;
import org.jdownloader.controlling.contextmenu.MenuItemData;
import org.jdownloader.extensions.AbstractExtension;
import org.jdownloader.extensions.StartException;
import org.jdownloader.extensions.StopException;
import org.jdownloader.extensions.autodownloader.model.ProfileEntry;
import org.jdownloader.extensions.autodownloader.model.ProfileEntryStorable;
import org.jdownloader.extensions.autodownloader.translate.AutodownloaderTranslation;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.mainmenu.MenuManagerMainmenu;
import org.jdownloader.gui.toolbar.MenuManagerMainToolbar;
import jd.controlling.TaskQueue;
import jd.plugins.AddonPanel;
public class AutodownloaderExtension extends AbstractExtension<AutodownloaderConfig, AutodownloaderTranslation> implements MenuExtenderHandler, Runnable, GenericConfigEventListener<Object> {
private AutodownloaderConfigPanel configPanel;
private ScheduledExecutorService scheduler;
private final Object lock = new Object();
private CopyOnWriteArrayList<ProfileEntry> profileEntries = new CopyOnWriteArrayList<ProfileEntry>();
private final ShutdownEvent shutDownEvent = new ShutdownEvent() {
@Override
public void onShutdown(ShutdownRequest shutdownRequest) {
CFG_AUTODOWNLOADER.ENTRY_LIST.getEventSender().removeListener(AutodownloaderExtension.this);
saveProfileEntries(false);
}
};
@Override
public boolean isHeadlessRunnable() {
return true;
}
public void saveProfileEntries(final boolean async) {
if (async) {
TaskQueue.getQueue().addAsynch(new QueueAction<Void, RuntimeException>() {
@Override
protected Void run() throws RuntimeException {
saveProfileEntries(false);
return null;
}
});
} else {
final List<ProfileEntryStorable> profileStorables = new ArrayList<ProfileEntryStorable>();
for (ProfileEntry profile : getProfileEntries()) {
profileStorables.add(profile.getStorable());
}
CFG_AUTODOWNLOADER.CFG.setEntryList(profileStorables);
}
}
public List<ProfileEntry> getProfileEntries() {
return profileEntries;
}
/**
* private boolean needsRun(ProfileEntry plan) { if (!plan.isEnabled()) { return false; }
* org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_MAX_DOWNLOADS_SPEED_LIMIT.setValue(plan.getMinBandwidth()); }
**/
@Override
public void run() {
for (ProfileEntry entry : getProfileEntries()) {
getLogger().info("Available profile: " + entry.getName() + entry.isEnabled());
if (entry.isEnabled()) {
getLogger().info("Run action: " + entry.getAction().getReadableName());
try {
// entry.getAction().execute(getLogger());
org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_MAX_DOWNLOADS_SPEED_LIMIT.setValue(entry.getMinBandwidth() * 1000);
org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_MAX_DOWNLOADS_SPEED_LIMIT_MAX_DOWNLOADS.setValue(entry.getMaxNumDownloads());
org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_SIMULTANE_DOWNLOADS.setValue(entry.getMinNumDownloads());
org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_CHUNKS_PER_FILE.setValue(entry.getMaxNumChunks());
} catch (final Throwable e) {
getLogger().log(e);
}
}
}
}
@Override
protected void start() throws StartException {
if (!Application.isHeadless()) {
new EDTRunner() {
@Override
protected void runInEDT() {
getConfigPanel().updateLayout();
}
};
MenuManagerMainToolbar.getInstance().registerExtender(this);
MenuManagerMainmenu.getInstance().registerExtender(this);
}
loadProfileEntries();
updateTable();
ShutdownController.getInstance().addShutdownEvent(shutDownEvent);
getLogger().info("Start AutodownloaderThreadTimer");
synchronized (lock) {
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(this, 60 - Calendar.getInstance().get(Calendar.SECOND), 60l, TimeUnit.SECONDS);
}
CFG_AUTODOWNLOADER.ENTRY_LIST.getEventSender().addListener(this, true);
}
@Override
protected void stop() throws StopException {
CFG_AUTODOWNLOADER.ENTRY_LIST.getEventSender().removeListener(this);
saveProfileEntries(false);
if (!Application.isHeadless()) {
MenuManagerMainToolbar.getInstance().unregisterExtender(this);
MenuManagerMainmenu.getInstance().unregisterExtender(this);
}
ShutdownController.getInstance().removeShutdownEvent(shutDownEvent);
synchronized (lock) {
if (scheduler != null) {
scheduler.shutdown();
scheduler = null;
}
}
}
@Override
public void onConfigValidatorError(KeyHandler<Object> keyHandler, Object invalidValue, ValidationException validateException) {
}
@Override
public void onConfigValueModified(KeyHandler<Object> keyHandler, Object newValue) {
if (keyHandler == CFG_AUTODOWNLOADER.ENTRY_LIST) {
loadProfileEntries();
updateTable();
}
}
@Override
public AutodownloaderConfigPanel getConfigPanel() {
return configPanel;
}
@Override
public boolean hasConfigPanel() {
return true;
}
public AutodownloaderExtension() throws StartException {
setTitle(T.title());
}
@Override
public String getIconKey() {
return IconKey.ICON_DOWNLOAD;
}
public void removeProfileEntry(ProfileEntry entry) {
if (entry != null && profileEntries.remove(entry)) {
saveProfileEntries(true);
updateTable();
}
}
private void updateTable() {
if (!Application.isHeadless()) {
final AutodownloaderConfigPanel panel = getConfigPanel();
if (panel != null) {
panel.getTableModel().updateDataModel();
loadProfileEntries();
}
}
}
public void addProfileEntry(ProfileEntry entry) {
if (entry != null && profileEntries.addIfAbsent(entry)) {
saveProfileEntries(true);
updateTable();
}
}
public void replaceProfileEntry(long oldID, ProfileEntry newEntry) {
if (newEntry != null) {
int pos = -1;
for (int i = 0; i < profileEntries.size(); i++) {
if (oldID == profileEntries.get(i).getID()) {
pos = i;
break;
}
}
if (pos > -1) {
profileEntries.set(pos, newEntry);
saveProfileEntries(true);
updateTable();
}
}
}
private void loadProfileEntries() {
final List<ProfileEntryStorable> profileStorables = CFG_AUTODOWNLOADER.CFG.getEntryList();
final CopyOnWriteArrayList<ProfileEntry> profileEntries = new CopyOnWriteArrayList<ProfileEntry>();
if (profileStorables != null) {
for (int i = 0; i < profileStorables.size(); i++) {
try {
ProfileEntry entry = new ProfileEntry(profileStorables.get(i));
profileEntries.add(entry);
getLogger().info("Available profile: " + entry.getName() + " Enabled: " + entry.isEnabled());
if (entry.isEnabled()) {
org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_MAX_DOWNLOADS_SPEED_LIMIT.setValue(entry.getMinBandwidth() * 1000);
org.jdownloader.settings.staticreferences.CFG_GENERAL.AUTO_MAX_DOWNLOADS_SPEED_LIMIT_MAX_DOWNLOADS.setValue(entry.getMaxNumDownloads());
org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_SIMULTANE_DOWNLOADS.setValue(entry.getMinNumDownloads());
org.jdownloader.settings.staticreferences.CFG_GENERAL.MAX_CHUNKS_PER_FILE.setValue(entry.getMaxNumChunks());
org.jdownloader.settings.staticreferences.CFG_GENERAL.DOWNLOAD_SPEED_LIMIT.setValue(entry.getMaxBandwidth() * 1000);
}
} catch (Exception e) {
getLogger().log(e);
}
}
}
this.profileEntries = profileEntries;
}
@Override
public String getDescription() {
return T.description();
}
@Override
public AddonPanel<AutodownloaderExtension> getGUI() {
return null;
}
@Override
protected void initExtension() throws StartException {
if (!Application.isHeadless()) {
configPanel = new AutodownloaderConfigPanel(this);
}
}
@Override
public boolean isQuickToggleEnabled() {
return true;
}
@Override
public MenuItemData updateMenuModel(ContextMenuManager manager, MenuContainerRoot mr) {
return null;
}
}
| [
"[email protected]"
] | |
19f5478f637a73fcd2cb7216313bfeaf59588807 | 40dd5ac56b327cbd58cdc06859b13647634bf3de | /assignment_1/src/main/assignment/Assignment_1_1_24.java | f4c016f3b35d3dadc79a82c4b14255e767f882ed | [] | no_license | skomefen/algorithm | f7cc731b0bd641d1461160d2498f553c95fb78ad | 83dbf4e4a665bf4116e758efd0d7c4a06f8800d7 | refs/heads/master | 2020-12-30T12:44:22.775299 | 2017-07-06T14:25:19 | 2017-07-06T14:25:19 | 91,350,591 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 531 | java | package main.assignment;
public class Assignment_1_1_24 {
public static int gcd(int first,int second){
if(first<0||second<0){
throw new RuntimeException("请输入大于0的数");
}
if(first<second){
int key = 0;
key = first;
first = second;
second = key;
}
if(second==0){
return first;
}
if(first%second==0){
return second;
}
return gcd(second,first%second);
}
public static void main(String[] args){
int first = 0;
int second = 11111;
System.out.println(gcd(first, second));
}
}
| [
"[email protected]"
] | |
e03f42d26a36687ddbc4cde161d361ae36817e49 | cd688316a5bd8b1feca59b0229875c7ff1c6440e | /app/src/main/java/com/rachcode/peykman/mFood/MakananItem.java | 03f15726dd0d679b8784758726f471b1ea093ec7 | [] | no_license | mohsen-yousefi/taxi2 | 8829aba70de0d88830af839901ea12060c07f8dc | 9189108773bdbc5d51123150d0a197580d47f6b3 | refs/heads/master | 2022-01-29T22:20:45.714089 | 2019-08-04T06:22:56 | 2019-08-04T06:22:56 | 198,158,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,560 | java | package com.rachcode.peykman.mFood;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.rachcode.peykman.config.General;
import com.mikepenz.fastadapter.items.AbstractItem;
import com.rachcode.peykman.GoTaxiApplication;
import com.rachcode.peykman.R;
import com.rachcode.peykman.model.PesananFood;
import com.rachcode.peykman.utils.Log;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.realm.Realm;
/**
* Created by Androgo on 1/3/2017.
*/
public class MakananItem extends AbstractItem<MakananItem, MakananItem.ViewHolder> {
public int id;
public String namaMenu;
public String deskripsiMenu;
public long harga;
public long cost;
public int quantity;
public String catatan;
public String foto;
Context context;
OnCalculatePrice calculatePrice;
private Realm realm;
private TextWatcher catatanUpdater;
public MakananItem(Context context, OnCalculatePrice calculatePrice) {
this.context = context;
this.calculatePrice = calculatePrice;
catatanUpdater = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
catatan = s.toString();
if (quantity > 0) UpdatePesanan(id, cost, quantity, catatan);
}
@Override
public void afterTextChanged(Editable s) {
}
};
}
@Override
public int getType() {
return R.id.makanan_item;
}
@Override
public void bindView(final MakananItem.ViewHolder holder, List payloads) {
super.bindView(holder, payloads);
realm = GoTaxiApplication.getInstance(context).getRealmInstance();
holder.makananText.setText(namaMenu);
holder.deskripsiText.setText(deskripsiMenu);
holder.hargaText.setText(getFormattedPrice(harga));
holder.quantityText.setText(String.valueOf(quantity));
holder.notesText.setEnabled(quantity > 0);
holder.notesText.setText(catatan);
Glide.with(holder.imageproduct.getContext()).load(foto).centerCrop().into(holder.imageproduct);
holder.notesText.addTextChangedListener(catatanUpdater);
holder.addQuantity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
quantity++;
holder.quantityText.setText("" + quantity);
holder.notesText.setEnabled(true);
CalculateCost();
if (quantity == 1) {
AddPesanan(id, cost, quantity, catatan);
} else if (quantity > 1) {
UpdatePesanan(id, cost, quantity, catatan);
}
if (calculatePrice != null) calculatePrice.calculatePrice();
}
});
holder.removeQuantity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (quantity - 1 >= 0) {
quantity--;
holder.quantityText.setText(String.valueOf(quantity));
CalculateCost();
UpdatePesanan(id, cost, quantity, catatan);
if (quantity == 0) {
DeletePesanan(id);
holder.notesText.setText("");
holder.notesText.setEnabled(false);
}
}
if (calculatePrice != null) calculatePrice.calculatePrice();
}
});
}
private void CalculateCost() {
cost = quantity * harga;
//Log.e("Cost", cost+"");
}
private void AddPesanan(int idMakanan, long totalHarga, int qty, String notes) {
PesananFood pesananfood = new PesananFood();
pesananfood.setIdMakanan(idMakanan);
pesananfood.setTotalHarga(totalHarga);
pesananfood.setQty(qty);
pesananfood.setCatatan(notes);
realm.beginTransaction();
realm.copyToRealm(pesananfood);
realm.commitTransaction();
Log.e("Added", idMakanan + "");
Log.e("Added", qty + "");
}
private void UpdatePesanan(int idMakanan, long totalHarga, int qty, String notes) {
realm.beginTransaction();
PesananFood updateFood = realm.where(PesananFood.class).equalTo("idMakanan", idMakanan).findFirst();
updateFood.setTotalHarga(totalHarga);
updateFood.setQty(qty);
updateFood.setCatatan(notes);
realm.copyToRealm(updateFood);
realm.commitTransaction();
Log.e("Updated", qty + "");
}
private void DeletePesanan(int idMakanan) {
realm.beginTransaction();
PesananFood deleteFood = realm.where(PesananFood.class).equalTo("idMakanan", idMakanan).findFirst();
deleteFood.deleteFromRealm();
realm.commitTransaction();
}
@Override
public int getLayoutRes() {
return R.layout.item_makanan;
}
private String getFormattedPrice(long price) {
String formattedTotal = NumberFormat.getNumberInstance(Locale.US).format(price);
return String.format(Locale.US, General.MONEY +" %s .00", formattedTotal);
}
public interface OnCalculatePrice {
void calculatePrice();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.makanan_text)
TextView makananText;
@BindView(R.id.deskripsi_text)
TextView deskripsiText;
@BindView(R.id.harga_text)
TextView hargaText;
@BindView(R.id.notes_text)
EditText notesText;
@BindView(R.id.add_quantity)
TextView addQuantity;
@BindView(R.id.quantity_text)
TextView quantityText;
@BindView(R.id.remove_quantity)
TextView removeQuantity;
@BindView(R.id.image_product)
ImageView imageproduct;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| [
"[email protected]"
] | |
76da2efab00bff60a613ae7241357e1678eb5617 | f37aea479e86301b7e8160a5f2eb25012ddf2969 | /src/net/pixelcade/virtualautominer/Task.java | a5a1ac50e7f5b9db44b3b4342c53ff2e4af7b4e6 | [] | no_license | Unknowncall/VirtualAutoMiner | 58aaf8dc0cce20ebcf059e8d2d2c16284fbe5543 | b4f6b8aebdada5f5249204d138ca956e32e0df3a | refs/heads/master | 2021-05-13T14:41:33.818775 | 2018-01-14T23:41:38 | 2018-01-14T23:41:38 | 116,746,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,190 | java | package net.pixelcade.virtualautominer;
import java.text.DecimalFormat;
import org.bukkit.entity.Player;
import com.vk2gpz.tokenenchant.api.TokenEnchantAPI;
import net.md_5.bungee.api.ChatColor;
public class Task implements Runnable {
private VirtualAutoMiner plugin;
public Task(VirtualAutoMiner virtualAutoMiner) {
this.plugin = virtualAutoMiner;
}
@Override
public void run() {
for (Player player : this.plugin.getServer().getOnlinePlayers()) {
if (this.plugin.getSave().getString("players." + player.getUniqueId().toString()) != null) {
if (this.plugin.getSave().getInt("players." + player.getUniqueId().toString() + ".amount") > 0) {
double payout = this.plugin.getSave()
.getInt("players." + player.getUniqueId().toString() + ".amount")
* this.plugin.getProductivityPerMiner();
VirtualAutoMiner.getEconomy().depositPlayer(player, (payout * 5.00));
DecimalFormat df2 = new DecimalFormat("0.00");
df2.setGroupingUsed(true);
df2.setGroupingSize(3);
double tokenPayout = this.plugin.getSave()
.getInt("players." + player.getUniqueId().toString() + ".amount")
* VirtualAutoMiner.tokenProductivityPerMiner;
TokenEnchantAPI.getInstance().addTokens(player, tokenPayout * 5);
if (!(this.plugin.getSave().getBoolean("players." + player.getUniqueId().toString() + ".silentMessage"))) {
player.sendMessage(ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "-------" + ChatColor.RESET + " " + ChatColor.GREEN + "AutoMiner Payout " + ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "-------");
player.sendMessage("");
player.sendMessage(ChatColor.GREEN + "$: " + ChatColor.YELLOW + df2.format(payout * 5));
player.sendMessage(ChatColor.GREEN + "✪: " + ChatColor.YELLOW + tokenPayout * 5);
player.sendMessage("");
player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "TIP:");
player.sendMessage(ChatColor.GRAY + "/am silent to disable this.");
player.sendMessage("");
player.sendMessage(ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "------------------------------");
}
}
}
}
}
}
| [
"[email protected]"
] | |
f89155da2ad4e17f618edd44369dee883b9269cb | e418cd85b1280ad02495eff32096529518cefb11 | /app/src/main/java/com/icss/shopmax/Model/Rent_Car_Data.java | e57b775983f9e8bae9fb8b051146df805276ddf3 | [] | no_license | LokeshInfo/Shop_Max_Dual | 9dcd8cad02549de73403ac590d3b2242d5e630c9 | 9c7c745147bc88e40a99b661eb4ec8c1476f54eb | refs/heads/master | 2021-04-20T23:44:37.370545 | 2020-04-20T09:08:54 | 2020-04-20T09:08:54 | 249,726,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package com.icss.shopmax.Model;
public class Rent_Car_Data {
private String name;
private String car_model;
private String price;
private String type;
public Rent_Car_Data(String name, String car_model, String price, String type) {
this.name = name;
this.car_model = car_model;
this.price = price;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCar_model() {
return car_model;
}
public void setCar_model(String car_model) {
this.car_model = car_model;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
bc458b5db7a9fb59176808cbe62b3dbf146b0df3 | 343773ae835dbbaefde9f653f9211570bd8455d6 | /src/api/java/thaumcraft/api/aspects/AspectRegistryEvent.java | f671ccf092a3eab2d26ba935a567db782cc0f1ed | [
"MIT"
] | permissive | DaedalusGame/EmbersRekindled | a06895d5bc3d0cf6739965828eab96edcdd35a78 | a2437713ea29ee9ca76b3e14f6e67f8e8862ccaa | refs/heads/rekindled | 2022-05-01T12:03:20.268625 | 2021-03-03T19:13:27 | 2021-03-03T19:13:27 | 135,477,242 | 41 | 37 | MIT | 2022-03-26T17:47:02 | 2018-05-30T17:38:40 | Java | UTF-8 | Java | false | false | 737 | java | package thaumcraft.api.aspects;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* This event is called when Thaumcraft is ready to accept the registration of aspects associated with items or entities.
* Subscribe to this event like you would any other forge event. The <b>register</b> object contains the methods you use to register aspects.
* <p><i>IMPORTANT: Do NOT instantiate this class or AspectEventProxy and use the methods directly - there is no guarantee that they will work like you expect.</i>
*/
public class AspectRegistryEvent extends Event {
/** this should always be set by TC itself - do not assign your own proxy */
public AspectEventProxy register;
public AspectRegistryEvent() {
}
}
| [
"[email protected]"
] | |
984d77024a60a11a8edb0cf3c86f7644f7fcc2e3 | 5bc4b5337becaa4d55c620e9e078985e1743060b | /app/src/main/java/io/github/teccheck/bluechat/ChatMessagesListAdapter.java | 574c92f35c093aa42852813c1ad6b9d2d59de1d4 | [] | no_license | TecCheck/BlueChat | ab96b48404a7ce33b3126234f2df98ca91b05190 | b35e6366d1ff5ff50c0251747a631f815f671be2 | refs/heads/master | 2023-02-12T05:58:30.234847 | 2021-01-14T15:55:41 | 2021-01-14T15:55:41 | 328,942,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,464 | java | package io.github.teccheck.bluechat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class ChatMessagesListAdapter extends RecyclerView.Adapter<ChatMessagesListAdapter.ViewHolder> {
ArrayList<Message> messages = new ArrayList<>();
public ChatMessagesListAdapter() {
}
public void addMessage(Message message){
messages.add(message);
notifyItemChanged(messages.size() - 1);
}
@NonNull
@Override
public ChatMessagesListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ChatMessagesListAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_chat_message, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ChatMessagesListAdapter.ViewHolder holder, int position) {
Message message = messages.get(position);
View root = holder.itemView;
TextView text = root.findViewById(R.id.message_text);
text.setText(message.text);
}
@Override
public int getItemCount() {
return messages.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View view) {
super(view);
}
}
}
| [
"[email protected]"
] | |
14795730e96b05776f956c27c8e9f3f669229f68 | f03fa2e830454cbc54a2834b68f8d4490d429834 | /insight-log-storage/src/main/java/io/fabric8/insight/log/storage/InsightEventHandler.java | d9e9e66e08e58a49f3a09980aa0257c16c4fd0cb | [] | no_license | charanrsc/insight | 596521aa1d2c678704ad23d1198f06a00938269a | 57ebd6d71358a341edb747530df486e6e6156288 | refs/heads/master | 2021-05-28T17:10:44.665881 | 2015-01-09T14:00:44 | 2015-01-09T14:00:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,152 | java | /**
* Copyright 2005-2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.fabric8.insight.log.storage;
import io.fabric8.insight.storage.StorageService;
import org.apache.felix.scr.annotations.*;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import static io.fabric8.insight.log.storage.InsightUtils.formatDate;
import static io.fabric8.insight.log.storage.InsightUtils.quote;
@Component(immediate = true, name = "io.fabric8.insight.log.storage.events")
@Service(EventHandler.class)
@Properties({
@Property(name = "event.topics", value = "*")
})
public class InsightEventHandler implements EventHandler {
public static final String LOG_TYPE = "es.evt.type";
private static final Logger LOGGER = LoggerFactory.getLogger(InsightLogAppender.class);
private String name;
private String type = "events";
@Reference
private StorageService storageService;
@Activate
public void activate(Map<String, ?> configuration) {
name = System.getProperty("runtime.id");
if (configuration.containsKey(LOG_TYPE)) {
type = (String) configuration.get(LOG_TYPE);
}
}
@Modified
public void modified(Map<String, ?> configuration) {
if (configuration.containsKey(LOG_TYPE)) {
type = (String) configuration.get(LOG_TYPE);
} else {
type = "log";
}
}
public void handleEvent(final Event event) {
try {
StringBuilder writer = new StringBuilder();
writer.append("{ \"host\": ");
quote(name, writer);
writer.append(", \"topic\": ");
quote(event.getTopic(), writer);
writer.append(", \"properties\": { ");
boolean first = true;
long timestamp = 0;
for (String name : event.getPropertyNames()) {
if (first) {
first = false;
} else {
writer.append(", ");
}
quote(name, writer);
writer.append(": ");
Object value = event.getProperty(name);
if (value == null) {
writer.append("null");
} else if (EventConstants.TIMESTAMP.equals(name) && value instanceof Long) {
timestamp = (Long) value;
quote(formatDate(timestamp), writer);
} else if (value.getClass().isArray()) {
writer.append(" [ ");
boolean vfirst = true;
for (Object v : ((Object[]) value)) {
if (!vfirst) {
writer.append(", ");
} else {
vfirst = false;
}
quote(v.toString(), writer);
}
writer.append(" ] ");
} else {
quote(value.toString(), writer);
}
}
writer.append(" } }");
if (timestamp == 0) {
timestamp = System.currentTimeMillis();
}
if (type != null && storageService != null) {
storageService.store(type, timestamp, writer.toString());
}
} catch (Exception e) {
LOGGER.warn("Error appending log to elastic search", e);
}
}
}
| [
"[email protected]"
] | |
5240542f7ece60394fdcd529a31489bfbd559a9c | 4a55692a757cc5dcc6de7166638b0e5073e76c84 | /app/src/main/java/com/korsolution/antif/VehicleDBClass.java | 47c4958ab7e250a284e5380e434901f2a546d4ae | [] | no_license | Cutiesz/Antif | 56843385dddcf6640316a2603ddd786683b4c8e0 | f7ab2e0631a40c4cfe4eb645c77a83ac370c54a3 | refs/heads/master | 2021-08-31T12:17:02.617081 | 2017-12-21T08:18:27 | 2017-12-21T08:18:27 | 105,964,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,646 | java | package com.korsolution.antif;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;
/**
* Created by Kontin58 on 24/9/2559.
*/
public class VehicleDBClass extends SQLiteOpenHelper {
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "vehicledb";
// Table Name
private static final String TABLE_VEHICLE = "vehicle";
public VehicleDBClass(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("CREATE TABLE " + TABLE_VEHICLE +
"(ID INTEGER PRIMARY KEY AUTOINCREMENT," +
" IMEI TEXT(100)," +
" VEHICLE_DISPLAY TEXT(100)," +
" VEHICLE_NAME TEXT(100)," +
" HISTORY_DATETIME TEXT(100)," +
" LATITUDE TEXT(100)," +
" LONGITUDE TEXT(100)," +
" PLACE TEXT(100)," +
" ANGLE TEXT(100)," +
" SPEED TEXT(100)," +
" STATUS TEXT(100)," +
" IS_CUT_ENGINE TEXT(100)," +
" IS_IQNITION TEXT(100)," +
" IS_AUTHEN TEXT(100)," +
" SIM TEXT(100)," +
" TEL_EMERGING_1 TEXT(100)," +
" TEL_EMERGING_2 TEXT(100)," +
" TEL_EMERGING_3 TEXT(100)," +
" IS_UNPLUG_GPS TEXT(100)," +
" GSM_SIGNAL TEXT(100)," +
" NUM_SAT TEXT(100)," +
" CAR_IMAGE_FRONT TEXT(100)," +
" CAR_IMAGE_BACK TEXT(100)," +
" CAR_IMAGE_LEFT TEXT(100)," +
" CAR_IMAGE_RIGHT TEXT(100)," +
" STATUS_UPDATE TEXT(100)," +
" VEHICLE_TYPE_NAME TEXT(100)," +
" VEHICLE_BRAND_NAME TEXT(100)," +
" MODEL TEXT(100)," +
" YEAR TEXT(100)," +
" VEHICLE_COLOR TEXT(100));");
Log.d("CREATE TABLE","Create Table Successfully.");
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
// Insert Data
public long Insert(String strIMEI, String strVEHICLE_DISPLAY, String strVEHICLE_NAME,
String strHISTORY_DATETIME, String strLATITUDE, String strLONGITUDE,
String strPLACE, String strANGLE, String strSPEED, String strSTATUS,
String strIS_CUT_ENGINE, String strIS_IQNITION, String strIS_AUTHEN, String strSIM,
String strTEL_EMERGING_1, String strTEL_EMERGING_2, String strTEL_EMERGING_3,
String strIS_UNPLUG_GPS, String strGSM_SIGNAL, String strNUM_SAT,
String strCAR_IMAGE_FRONT, String strCAR_IMAGE_BACK, String strCAR_IMAGE_LEFT,
String strCAR_IMAGE_RIGHT, String strSTATUS_UPDATE,
String strVEHICLE_TYPE_NAME, String strVEHICLE_BRAND_NAME, String strMODEL, String strYEAR, String strVEHICLE_COLOR) {
// TODO Auto-generated method stub
try {
SQLiteDatabase db;
db = this.getWritableDatabase(); // Write Data
SQLiteStatement insertCmd;
String strSQL = "INSERT INTO " + TABLE_VEHICLE
+ "(IMEI, VEHICLE_DISPLAY, VEHICLE_NAME, HISTORY_DATETIME, LATITUDE, LONGITUDE, PLACE, ANGLE, SPEED, STATUS, IS_CUT_ENGINE, IS_IQNITION, IS_AUTHEN, SIM, TEL_EMERGING_1, TEL_EMERGING_2, TEL_EMERGING_3, IS_UNPLUG_GPS, GSM_SIGNAL, NUM_SAT, CAR_IMAGE_FRONT, CAR_IMAGE_BACK, CAR_IMAGE_LEFT, CAR_IMAGE_RIGHT, STATUS_UPDATE, VEHICLE_TYPE_NAME, VEHICLE_BRAND_NAME, MODEL, YEAR, VEHICLE_COLOR) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
insertCmd = db.compileStatement(strSQL);
insertCmd.bindString(1, strIMEI);
insertCmd.bindString(2, strVEHICLE_DISPLAY);
insertCmd.bindString(3, strVEHICLE_NAME);
insertCmd.bindString(4, strHISTORY_DATETIME);
insertCmd.bindString(5, strLATITUDE);
insertCmd.bindString(6, strLONGITUDE);
insertCmd.bindString(7, strPLACE);
insertCmd.bindString(8, strANGLE);
insertCmd.bindString(9, strSPEED);
insertCmd.bindString(10, strSTATUS);
insertCmd.bindString(11, strIS_CUT_ENGINE);
insertCmd.bindString(12, strIS_IQNITION);
insertCmd.bindString(13, strIS_AUTHEN);
insertCmd.bindString(14, strSIM);
insertCmd.bindString(15, strTEL_EMERGING_1);
insertCmd.bindString(16, strTEL_EMERGING_2);
insertCmd.bindString(17, strTEL_EMERGING_3);
insertCmd.bindString(18, strIS_UNPLUG_GPS);
insertCmd.bindString(19, strGSM_SIGNAL);
insertCmd.bindString(20, strNUM_SAT);
insertCmd.bindString(21, strCAR_IMAGE_FRONT);
insertCmd.bindString(22, strCAR_IMAGE_BACK);
insertCmd.bindString(23, strCAR_IMAGE_LEFT);
insertCmd.bindString(24, strCAR_IMAGE_RIGHT);
insertCmd.bindString(25, strSTATUS_UPDATE);
insertCmd.bindString(26, strVEHICLE_TYPE_NAME);
insertCmd.bindString(27, strVEHICLE_BRAND_NAME);
insertCmd.bindString(28, strMODEL);
insertCmd.bindString(29, strYEAR);
insertCmd.bindString(30, strVEHICLE_COLOR);
return insertCmd.executeInsert();
} catch (Exception e) {
return -1;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAll() {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE/* + " Where BlockId = '" + strBlockId + "'"*/;
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAllByVehicleName(String _VEHICLE_NAME) {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE + " Where VEHICLE_NAME = '" + _VEHICLE_NAME + "'";
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAllByVehicleDisplay(String _VEHICLE_DISPLAY) {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE + " Where VEHICLE_DISPLAY = '" + _VEHICLE_DISPLAY + "'";
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
public String[] SelectVehicleName() {
// TODO Auto-generated method stub
try {
String arrData[] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE/* + " Where BlockId = '" + strBlockId + "'"*/;
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null) {
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i] = cursor.getString(3);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Delete Data
public long Delete(/*String strMemberID*/) {
// TODO Auto-generated method stub
try {
SQLiteDatabase db;
db = this.getWritableDatabase(); // Write Data
// for API 11 and above
SQLiteStatement insertCmd;
String strSQL = "DELETE FROM " + TABLE_VEHICLE/* + " WHERE MemberID = ? "*/;
insertCmd = db.compileStatement(strSQL);
/*insertCmd.bindString(1, strMemberID);*/
return insertCmd.executeUpdateDelete();
} catch (Exception e) {
return -1;
}
}
}
| [
"[email protected]"
] | |
1d33ecdec3e92dd831bc0037e7fbe525f743959c | c813354639ebe71154d81b34892b1607a063b78c | /src/ConsoleExercises.java | c7325defc3f5b0a3a0ca32b123b3e459500e9e0d | [] | no_license | VictorFHernandez/codeup-java-exercises | 75cc9be52f8200c1a6b23ce23a76ba147307da7e | 716735a258dfee25dd745f55e7799516a8e2258b | refs/heads/main | 2023-04-22T21:00:20.913982 | 2021-05-11T02:42:38 | 2021-05-11T02:42:38 | 360,674,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | import java.util.Scanner;
public class ConsoleExercises {
public static void main(String[] args){
//part 1:
double pi = 3.14159;
System.out.format("The value of pi is approximately %.2f.\n", pi);
// part 2:
Scanner sc = new Scanner(System.in);
// System.out.println("Please enter your number.");
// int number = sc.nextInt();
// System.out.println("number " + number);
// System.out.println("Please enter 3 words.");
// String word1 = sc.next();
// String word2 = sc.next();
// String word3 = sc.next();
// System.out.printf("%s\n%s\n%s\n", word1, word2, word3);
// System.out.println("what do you want?");
// String something = sc.nextLine();
// System.out.println("you have entered:");
// System.out.println(something);
// part 3
System.out.println("enter length of classroom");
int length = Integer.parseInt(sc.nextLine());
System.out.println("enter the width of the classroom");
int width = Integer.parseInt(sc.nextLine());
int area = length * width;
int perimeter = (length * 2) + (width * 2);
System.out.printf("the area is: %d\n", area);
System.out.printf("the perimeter is: %d\n", perimeter);
}
}
| [
"[email protected]"
] | |
6bf846174950dfcc3d8b27a650917e534929b35e | 129da0925c791f91d471ffdd17392fcfc21face4 | /src/main/java/com/example/emos/wx/db/dao/TbFaceModelDao.java | 5eb82d358a4a1243dd6faa8615c0afed0e409704 | [] | no_license | GZK0329/OA_SYSTEM | 9751e0fce6d7e37da2db956a7a58096ae1d1b8e3 | dcd20584fc5649aed8b11556a8364a2c24618416 | refs/heads/master | 2023-08-18T07:17:24.507728 | 2021-09-16T16:25:16 | 2021-09-16T16:25:16 | 404,238,985 | 0 | 0 | null | 2021-09-16T16:25:17 | 2021-09-08T06:40:23 | Java | UTF-8 | Java | false | false | 301 | java | package com.example.emos.wx.db.dao;
import com.example.emos.wx.db.pojo.TbFaceModel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbFaceModelDao {
String searchFaceModel(int userId);
void insertFaceModel(TbFaceModel model);
void deleteFaceModel(int userId);
} | [
"[email protected]"
] | |
2acdc48baea3318d9ca57c2517790962a50c234e | 19aec9324bfdc393961cd83b1e1ddba9ca5540d1 | /src/java/entity/Timing.java | f2f9de2ad19cccc01aefdc8fb9950022726b43ad | [] | no_license | sumansta/Project404 | 2b40f6979ac70c15fd14379346165916771c8114 | 9e9d3e7fe49c8efb3ece729f62591136a2064c07 | refs/heads/master | 2021-07-03T11:25:36.957384 | 2017-09-24T10:44:55 | 2017-09-24T10:44:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entity;
/**
*
* @author Ark
*/
public class Timing {
private int id;
private String first, second, third, fourth;
public Timing() {
}
public Timing(int id, String first, String second, String third, String fourth) {
this.id = id;
this.first = first;
this.second = second;
this.third = third;
this.fourth = fourth;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getSecond() {
return second;
}
public void setSecond(String second) {
this.second = second;
}
public String getThird() {
return third;
}
public void setThird(String third) {
this.third = third;
}
public String getFourth() {
return fourth;
}
public void setFourth(String fourth) {
this.fourth = fourth;
}
}
| [
"[email protected]"
] | |
3d2381bcae64bfe3883baf5c25ee314bf36af452 | 3629e0b607aa7f44b4216280279e5f151ae58d8d | /src/main/java/me/brokenearthdev/eventbus/annotations/CallerEventBus.java | 84492a31fadc7827812f34ad7f93f24f86d8f6fe | [
"Apache-2.0"
] | permissive | BrokenEarthDev/EventBus | 2758c714d0afabf8c0bda4cadb5f08a26ad70ca0 | 974aaff489b74ca065376fed4369b5b84898059d | refs/heads/master | 2020-03-25T18:29:32.490911 | 2018-09-11T15:32:27 | 2018-09-11T15:32:27 | 144,033,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,565 | java | /*
* Copyright 2018 github.com/BrokenEarthDev
* 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 me.brokenearthdev.eventbus.annotations;
import java.lang.annotation.*;
import me.brokenearthdev.eventbus.entities.EventBus;
import me.brokenearthdev.eventbus.exceptions.EventBusException;
/**
* Annotate a non-static and non-final uninitialized {@link EventBus} object with this annotation
* in an event class in where an {@link EventBus} would call. When called by an {@link EventBus},
* the field will be initialized with the value equal to the event bus caller.
*
* However, {@link EventBusException} will be thrown when one of the conditions is not met:
* <ul>
* <li>The annotated object is not of type {@link EventBus}</li>
* <li>The annotated object is static</li>
* <li>The annotated object is final</li>
* </ul>
*
* @author BrokenEarth // BrokenEarthDev
* @version 1.0
* @since 4.0
*/
@Documented
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface CallerEventBus {
}
| [
"[email protected]"
] | |
0c7d0c649469be079f6f408b45f755c64924580b | 91495537eef3896888c47395ff4f8238a57842e3 | /src/main/java/com/blogspot/ofarukkurt/primeadminbsb/controllers/EmployeeController.java | c9d999a5c2eadf148654fab2461ef7dbe8728987 | [] | no_license | Doomsayeramg/ocoyoacac | fb585682d58a019c20aa5fa29f3cba85e6348168 | c211ae0e755a83156a193e26cfa3edbcc4013b92 | refs/heads/master | 2021-07-13T20:06:44.032230 | 2017-10-19T04:26:43 | 2017-10-19T04:26:43 | 107,495,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,675 | java | package com.blogspot.ofarukkurt.primeadminbsb.controllers;
import com.blogspot.ofarukkurt.primeadminbsb.models.Employee;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
@Named(value = "employeeController")
@ViewScoped
public class EmployeeController extends AbstractController<Employee> {
@Inject
private SalespersonController salespersonController;
@Inject
private PersonController personController;
public EmployeeController() {
// Inform the Abstract parent controller of the concrete Employee Entity
super(Employee.class);
}
/**
* Resets the "selected" attribute of any parent Entity controllers.
*/
public void resetParents() {
salespersonController.setSelected(null);
personController.setSelected(null);
}
/**
* Sets the "items" attribute with a collection of Purchaseorderheader
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Purchaseorderheader page
*/
public String navigatePurchaseorderheaderList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Purchaseorderheader_items", this.getSelected().getPurchaseorderheaderList());
}
return "/purchaseorderheader/index";
}
/**
* Sets the "selected" attribute of the Salesperson controller in order to
* display its data in its View dialog.
*
* @param event Event object for the widget that triggered an action
*/
public void prepareSalesperson(ActionEvent event) {
if (this.getSelected() != null && salespersonController.getSelected() == null) {
salespersonController.setSelected(this.getSelected().getSalesperson());
}
}
/**
* Sets the "items" attribute with a collection of Employeedepartmenthistory
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Employeedepartmenthistory page
*/
public String navigateEmployeedepartmenthistoryList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Employeedepartmenthistory_items", this.getSelected().getEmployeedepartmenthistoryList());
}
return "/employeedepartmenthistory/index";
}
/**
* Sets the "items" attribute with a collection of Jobcandidate entities
* that are retrieved from Employee?cap_first and returns the navigation
* outcome.
*
* @return navigation outcome for Jobcandidate page
*/
public String navigateJobcandidateList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Jobcandidate_items", this.getSelected().getJobcandidateList());
}
return "/jobcandidate/index";
}
/**
* Sets the "items" attribute with a collection of Document entities that
* are retrieved from Employee?cap_first and returns the navigation outcome.
*
* @return navigation outcome for Document page
*/
public String navigateDocumentList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Document_items", this.getSelected().getDocumentList());
}
return "/document/index";
}
/**
* Sets the "selected" attribute of the Person controller in order to
* display its data in its View dialog.
*
* @param event Event object for the widget that triggered an action
*/
public void preparePerson(ActionEvent event) {
if (this.getSelected() != null && personController.getSelected() == null) {
personController.setSelected(this.getSelected().getPerson());
}
}
/**
* Sets the "items" attribute with a collection of Employeepayhistory
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Employeepayhistory page
*/
public String navigateEmployeepayhistoryList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Employeepayhistory_items", this.getSelected().getEmployeepayhistoryList());
}
return "/employeepayhistory/index";
}
}
| [
"doomsayer@a06e73f0-31e7-469f-847e-579a3b180b19"
] | doomsayer@a06e73f0-31e7-469f-847e-579a3b180b19 |
a1055fb2e7fd00598ca1e55ec91208ddff26fab5 | f9dd598e066541b510c93120cc3aa198a814acf9 | /pulice_catering/src/main/java/com/huayu/CG_KC_SJ/acquisition_methods/sql/SelectSqla.java | 3e47a378d1712f64ac95a910298322e212f40974 | [] | no_license | lishuai524/-pulice_catering2 | a6f2b8c97809876d1d95888fffaa723a9943f28a | 742aec882eb3e18ee3b748da2026f2768a745687 | refs/heads/master | 2022-12-23T02:02:19.240396 | 2019-07-03T03:27:15 | 2019-07-03T03:27:15 | 194,971,373 | 0 | 0 | null | 2022-12-16T08:53:54 | 2019-07-03T03:15:31 | Rich Text Format | UTF-8 | Java | false | false | 909 | java | package com.huayu.CG_KC_SJ.acquisition_methods.sql;
import com.huayu.CG_KC_SJ.acquisition_methods.entity.Acquisition_methods;
public class SelectSqla {
public String select(Acquisition_methods acquisition_methods){
StringBuffer stringBuffer=new StringBuffer();
stringBuffer.append("select * from acquisition_methods where 1=1");
if(acquisition_methods!=null) {
if ( acquisition_methods.getAcquisition_Methods() != null && !"".equals(acquisition_methods.getAcquisition_Methods())) {
stringBuffer.append(" and Acquisition_Methods like '%" + acquisition_methods.getAcquisition_Methods() + "%'");
}else if (acquisition_methods.getSid() != null && !"".equals(acquisition_methods.getSid())) {
stringBuffer.append(" and sid =" + acquisition_methods.getSid());
}
}
return stringBuffer.toString();
}
}
| [
"[email protected]"
] | |
96b8092ad2926af2504e3d6e4c26cb7fb57f618b | 1962a223105a796233e6e100349497e6ba323b3b | /Threads Exercises 1+2/src/main/java/day2/rndnumberprodcon/RandomNumberProducer.java | d808f7fdf974e711c2e3ea3d5c6be3c9fdad1681 | [] | no_license | Jonsabban/SEM3Threads | 628609534a386300de3a0d705c8aad7b08f23e22 | 0a8b32cb659c632c90a1a22f870754695db22fea | refs/heads/master | 2021-05-16T08:42:24.249275 | 2017-09-22T11:44:32 | 2017-09-22T11:44:32 | 104,157,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | package day2.rndnumberprodcon;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class RandomNumberProducer implements Runnable {
public static final int MAX_NUMBERS_TO_PRODUCE = 100;
public static final int MAX_RANDOM = 100;
ArrayBlockingQueue<Integer> numbersProduced;
public RandomNumberProducer(ArrayBlockingQueue<Integer> numbersProduced) {
this.numbersProduced = numbersProduced;
}
@Override
public void run() {
for (int i = 0; i < MAX_NUMBERS_TO_PRODUCE; i++) {
int random = (int) ((Math.random() * MAX_RANDOM));
try {
numbersProduced.put(random);
} catch (InterruptedException ex) {
Logger.getLogger(RandomNumberProducer.class.getName()).log(Level.SEVERE, null, ex);
}
}
//Todo: Produce MAX_NUMBERS_TO_PRODUCE of random numbers between 0 and MAX_RANDOM and
// place the numbers in numbersProduced
}
//By now, you should know how to produce random numbers, but if not, use/run this as a guide
public static void main(String[] args) {
int MAX_RAND = 2;
for (int i = 0; i < 10; i++) {
int random = (int) ((Math.random() * MAX_RAND + 1));
System.out.println(random);
}
}
}
| [
"[email protected]"
] | |
2e26ea17f2de473accff88b0b4214232a2ab805c | 37ed62436a8174e28797e5a35de0ccd0a613fdde | /Graphics/Filter/src/ru/nsu/fit/g15203/kostyleva/XorBorder.java | 12db03ff1c51dd3e77946c2d55a49a0ca815dcb7 | [] | no_license | VictoriaKostyleva/nsu_labs | a2844064f64b3a45dca5f6a78003828d19112b39 | faa1dc76b8729c2891f691683815e72b910d4ae9 | refs/heads/master | 2021-09-11T01:23:45.609581 | 2018-04-05T15:44:32 | 2018-04-05T15:44:32 | 105,536,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,965 | java | package ru.nsu.fit.g15203.kostyleva;
import javax.swing.border.AbstractBorder;
import java.awt.*;
import java.awt.image.BufferedImage;
public class XorBorder extends AbstractBorder {
private final int DASH_LENGTH = 5;
private int x0;
private int y0;
private BufferedImage bufferedImage;
public XorBorder(int x0, int y0, BufferedImage bufferedImage) {
this.x0 = x0;
this.y0 = y0;
this.bufferedImage = bufferedImage;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
super.paintBorder(c, g, x, y, width, height);
width -= 2;
height -= 2;
Graphics2D g2d = (Graphics2D) g;
int count = 0;
boolean isDash = false;
// System.out.println(x);
// System.out.println(y);
for (int i = 0; i < width; i++) {
if (!isDash) {
Color color = new Color(bufferedImage.getRGB(i + x0, y0));//top
g2d.setColor(new Color(255 - color.getRed(),255 - color.getGreen(),255 - color.getBlue()));
g2d.drawLine(i, y, i, y);
color = new Color(bufferedImage.getRGB(i + x0, width - 1 + y0));//bottom
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(i, width - 1, i, width - 1);
isDash = count % DASH_LENGTH == 0;
} else {
Color color = new Color(bufferedImage.getRGB(i + x0, y0));
g2d.setColor(color);
g2d.drawLine(i, y, i, y);
color = new Color(bufferedImage.getRGB(i + x0, width - 1 + y0));
g2d.setColor(color);
g2d.drawLine(i, width - 1, i, width - 1);
isDash = count % DASH_LENGTH != 0;
}
count++;
}
for (int i = 0; i < height; i++) {
if (!isDash) {
Color color = new Color(bufferedImage.getRGB(x0, i + y0));
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(x, i, x, i);
color = new Color(bufferedImage.getRGB(height - 1 + x0, i + y0));
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(height - 1, i, height - 1, i);
isDash = count % DASH_LENGTH == 0;
}
else {
Color color = new Color(bufferedImage.getRGB(x0, i + y0));
g2d.setColor(color);
g2d.drawLine(x, i, x, i);
color = new Color(bufferedImage.getRGB(height - 1 + x0, i + y0));
g2d.setColor(color);
g2d.drawLine(height - 1, i, height - 1, i);
isDash = count % DASH_LENGTH != 0;
}
count++;
}
}
}
| [
"[email protected]"
] | |
302285bff0f7385b0c32b1183f3719c66d31e709 | ac9755d08b16d9a7ae3f7f97858889855068ad53 | /lang/lucene-chinese/src/test/java/org/carrot2/language/chinese/AbstractLanguageComponentsTest.java | f4aa5d045eaf064a6c8044f1d982cf32657859a9 | [
"LicenseRef-scancode-bsd-ack-carrot2",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | rahulanishetty/carrot2 | febaddececa6c18f435645ae74438e89561ab0ae | cb4adcc3b4ea030f4b64e2d0b881f43b51a90ae6 | refs/heads/master | 2022-02-19T03:18:34.730395 | 2022-01-10T08:32:00 | 2022-01-10T08:32:04 | 91,449,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | /*
* Carrot2 project.
*
* Copyright (C) 2002-2021, Dawid Weiss, Stanisław Osiński.
* All rights reserved.
*
* Refer to the full license file "carrot2.LICENSE"
* in the root folder of the repository checkout or at:
* https://www.carrot2.org/carrot2.LICENSE
*/
package org.carrot2.language.chinese;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.carrot2.language.LanguageComponents;
import org.carrot2.language.Stemmer;
import org.carrot2.language.StopwordFilter;
import org.carrot2.language.Tokenizer;
import org.carrot2.util.MutableCharArray;
import org.junit.Test;
public abstract class AbstractLanguageComponentsTest {
protected final LanguageComponents components;
private final String[][] stemmingPairs;
private final String[] stopWords;
AbstractLanguageComponentsTest(String language, String[] stopWords, String[][] stemmingPairs)
throws IOException {
this.components = LanguageComponents.loader().load().language(language);
this.stemmingPairs = stemmingPairs;
this.stopWords = stopWords;
}
/** */
@Test
public void testStemmerAvailable() {
assertNotNull(components.get(Stemmer.class));
}
/** */
@Test
public void testStemming() {
final Stemmer stemmer = components.get(Stemmer.class);
for (String[] pair : stemmingPairs) {
CharSequence stem = stemmer.stem(pair[0]);
Assertions.assertThat(stem == null ? null : stem.toString()).isEqualTo(pair[1]);
}
}
/** */
@Test
public void testCommonWords() {
StopwordFilter wordFilter = components.get(StopwordFilter.class);
for (String word : stopWords) {
Assertions.assertThat(wordFilter.test(new MutableCharArray(word))).as(word).isFalse();
}
}
protected List<String> tokenize(Tokenizer tokenizer, String input) throws IOException {
tokenizer.reset(new StringReader(input));
MutableCharArray buffer = new MutableCharArray();
ArrayList<String> tokens = new ArrayList<>();
while (tokenizer.nextToken() >= 0) {
tokenizer.setTermBuffer(buffer);
tokens.add(buffer.toString());
}
return tokens;
}
}
| [
"[email protected]"
] | |
afae2f4b17d0757022ad04cda52ffcf8d6be8e3f | fb8f2df4765cbb6c48b2ed3b6201176e4a7af208 | /cloudfoundry-client-lib/src/main/java/org/cloudfoundry/client/lib/util/CloudEntityResourceMapper.java | 079780cf6e65e24502c55955fab74b4c5ee42f6c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | philwebb/vcap-java-client | 39cfce5c2b5d9b933b5d1acbb29f8476d82be340 | bd6fc39637f20c43db3181f891d0c99bbbebfff4 | refs/heads/master | 2021-01-16T02:36:47.087221 | 2012-08-06T19:04:39 | 2012-08-06T19:04:39 | 2,829,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,796 | java | /*
* Copyright 2009-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cloudfoundry.client.lib.util;
import org.cloudfoundry.client.lib.domain.CloudEntity;
import org.cloudfoundry.client.lib.domain.CloudOrganization;
import org.cloudfoundry.client.lib.domain.CloudService;
import org.cloudfoundry.client.lib.domain.CloudServiceOffering;
import org.cloudfoundry.client.lib.domain.CloudServicePlan;
import org.cloudfoundry.client.lib.domain.CloudSpace;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Class handling the mapping of the cloud domain objects
*
* @author: Thomas Risberg
*/
//TODO: use some more advanced JSON mapping framework?
public class CloudEntityResourceMapper {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
@SuppressWarnings("unchecked")
public String getNameOfJsonResource(Map<String, Object> resource) {
return getEntityAttribute(resource, "name", String.class);
}
@SuppressWarnings("unchecked")
public <T> T mapJsonResource(Map<String, Object> resource, Class<T> targetClass) {
if (targetClass == CloudSpace.class) {
return (T) mapSpaceResource(resource);
}
if (targetClass == CloudService.class) {
return (T) mapServiceInstanceResource(resource);
}
if (targetClass == CloudServiceOffering.class) {
return (T) mapServiceResource(resource);
}
throw new IllegalArgumentException(
"Error during mapping - unsupported class for entity mapping " + targetClass.getName());
}
private CloudSpace mapSpaceResource(Map<String, Object> resource) {
Map<String, Object> organizationMap = getEmbeddedResource(resource, "organization");
CloudOrganization organization = null;
if (organizationMap != null) {
organization = mapOrganizationResource(organizationMap);
}
CloudSpace space =
new CloudSpace(getMeta(resource), getEntityAttribute(resource, "name", String.class), organization);
return space;
}
private CloudOrganization mapOrganizationResource(Map<String, Object> resource) {
CloudOrganization org = new CloudOrganization(getMeta(resource), getEntityAttribute(resource, "name", String.class));
return org;
}
private CloudService mapServiceInstanceResource(Map<String, Object> resource) {
CloudService cloudService = new CloudService(
getMeta(resource),
getEntityAttribute(resource, "name", String.class));
Map<String, Object> servicePlanResource = getEmbeddedResource(resource, "service_plan");
Map<String, Object> serviceResource = null;
if (servicePlanResource != null) {
serviceResource = getEmbeddedResource(servicePlanResource, "service");
}
if (servicePlanResource != null && serviceResource != null) {
//TODO: assuming vendor corresponds to the service.provider and not service_instance.vendor_data
cloudService.setLabel(getEntityAttribute(serviceResource, "label", String.class));
cloudService.setProvider(getEntityAttribute(serviceResource, "provider", String.class));
cloudService.setVersion(getEntityAttribute(serviceResource, "version", String.class));
}
if (servicePlanResource != null) {
cloudService.setPlan(getEntityAttribute(servicePlanResource, "name", String.class));
}
return cloudService;
}
private CloudServiceOffering mapServiceResource(Map<String, Object> resource) {
CloudServiceOffering cloudServiceOffering = new CloudServiceOffering(
getMeta(resource),
getEntityAttribute(resource, "label", String.class),
getEntityAttribute(resource, "provider", String.class),
getEntityAttribute(resource, "version", String.class));
cloudServiceOffering.setDescription(getEntityAttribute(resource, "description", String.class));
List<Map<String, Object>> servicePlanList = getEmbeddedResourceList(getEntity(resource), "service_plans");
if (servicePlanList != null) {
for (Map<String, Object> servicePlanResource : servicePlanList) {
CloudServicePlan servicePlan =
new CloudServicePlan(
getMeta(servicePlanResource),
getEntityAttribute(servicePlanResource, "name", String.class),
cloudServiceOffering);
cloudServiceOffering.addCloudServicePlan(servicePlan);
}
}
return cloudServiceOffering;
}
@SuppressWarnings("unchecked")
private CloudEntity.Meta getMeta(Map<String, Object> entity) {
Map<String, Object> metadata = (Map<String, Object>) entity.get("metadata");
UUID guid = UUID.fromString(String.valueOf(metadata.get("guid")));
Date createdDate = null;
String created = String.valueOf(metadata.get("created_at"));
if (created != null) {
try {
createdDate = dateFormatter.parse(created);
} catch (ParseException ignore) {}
}
Date updatedDate = null;
String updated = String.valueOf(metadata.get("updated_at"));
if (updated != null) {
try {
updatedDate = dateFormatter.parse(updated);
} catch (ParseException ignore) {}
}
int version = 2; // this is always 2 for v2
CloudEntity.Meta meta = new CloudEntity.Meta(guid, createdDate, updatedDate, version);
return meta;
}
@SuppressWarnings("unchecked")
private Map<String, Object> getEntity(Map<String, Object> resource) {
return (Map<String, Object>) resource.get("entity");
}
@SuppressWarnings("unchecked")
private <T> T getEntityAttribute(Map<String, Object> resource, String attributeName, Class<T> targetClass) {
Map<String, Object> entity = (Map<String, Object>) resource.get("entity");
if (targetClass == String.class) {
return (T) String.valueOf(entity.get(attributeName));
}
throw new IllegalArgumentException(
"Error during mapping - unsupported class for attribute mapping " + targetClass.getName());
}
@SuppressWarnings("unchecked")
private Map<String, Object> getEmbeddedResource(Map<String, Object> resource, String embeddedResourceName) {
Map<String, Object> entity = (Map<String, Object>) resource.get("entity");
return (Map<String, Object>) entity.get(embeddedResourceName);
}
@SuppressWarnings("unchecked")
private List<Map<String, Object>> getEmbeddedResourceList(Map<String, Object> resource, String embeddedResourceName) {
return (List<Map<String, Object>>) resource.get(embeddedResourceName);
}
}
| [
"[email protected]"
] | |
2430692c01390a7f153ad50197330ff7b57bce96 | 3afc16a1b4ff54ec5492edfc1ca3ca5b8d524a05 | /src/main/java/ru/zvezdov/ocprof/chapter_1/AdvancedClassDesign/StaticAndFinal/StaticBlocks.java | 462c6e14b3e690597998a93735efc01add74b7a5 | [] | no_license | Zvezdov7/MyOCP | 2646a56bd73426d15f11f697fdef472717904ca6 | f59c30d867e371f1b58ffc3eb90ad9dd34e19b47 | refs/heads/master | 2021-01-19T07:37:32.126591 | 2017-06-29T14:10:14 | 2017-06-29T14:10:14 | 87,561,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package ru.zvezdov.ocprof.chapter_1.AdvancedClassDesign.StaticAndFinal;
/**
* @author Dmitry Zvezdov
* 09.05.17.
*/
public class StaticBlocks {
public static void main(String[] args) {
Blocks b;
System.out.println("1");
b = new Blocks();
System.out.println("2");
String string = new String();
Blocks c = new Blocks();
}
public static long getLong(int i){
return i;
}
}
class Blocks{
static {
System.out.println("I'm statis");
}
{
System.out.println("I'm non-static");
}
}
| [
"[email protected]"
] | |
91402e063464d873d52dcc31edc5b4cd59de1859 | b24ebe2ab101a9c7a76de51fc72d30318a173ecf | /src/com/bmob/im/demo/ui/LoginActivity.java | b04fea7d3f40120512b5a38ab7c14ec4593fe053 | [
"Apache-2.0"
] | permissive | Domonlee/Bmob_IM | 4c726457fb01c0fdc5a900d38ecfcfc87c612c9d | 344de91fb94fb0154c8055b223e375895bc6dcdf | refs/heads/master | 2016-09-08T02:07:29.345875 | 2014-10-24T01:02:52 | 2014-10-24T01:02:52 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,630 | java | package com.bmob.im.demo.ui;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import cn.bmob.im.bean.BmobChatUser;
import cn.bmob.im.util.BmobLog;
import cn.bmob.v3.listener.SaveListener;
import com.bmob.im.demo.R;
import com.bmob.im.demo.config.BmobConstants;
import com.bmob.im.demo.util.CommonUtils;
/**
* @ClassName: LoginActivity
* @Description: TODO
* @author smile
* @date 2014-6-3 下午4:41:42
*/
public class LoginActivity extends BaseActivity implements OnClickListener {
EditText et_username, et_password;
Button btn_login;
TextView btn_register, btn_forgot;
BmobChatUser currentUser;
private MyBroadcastReceiver receiver = new MyBroadcastReceiver();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
init();
// 注册退出广播
IntentFilter filter = new IntentFilter();
filter.addAction(BmobConstants.ACTION_REGISTER_SUCCESS_FINISH);
registerReceiver(receiver, filter);
}
private void init() {
et_username = (EditText) findViewById(R.id.et_username);
et_password = (EditText) findViewById(R.id.et_password);
btn_login = (Button) findViewById(R.id.btn_login);
btn_register = (TextView) findViewById(R.id.btn_register);
btn_forgot = (TextView) findViewById(R.id.btn_forgotpsw);
btn_login.setOnClickListener(this);
btn_register.setOnClickListener(this);
}
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null
&& BmobConstants.ACTION_REGISTER_SUCCESS_FINISH
.equals(intent.getAction())) {
finish();
}
}
}
@Override
public void onClick(View v) {
if (v == btn_register) {
Intent intent = new Intent(LoginActivity.this,
RegisterActivity.class);
startActivity(intent);
} else {
boolean isNetConnected = CommonUtils.isNetworkAvailable(this);
if (!isNetConnected) {
ShowToast(R.string.network_tips);
return;
}
login();
}
}
private void login() {
String name = et_username.getText().toString();
String password = et_password.getText().toString();
if (TextUtils.isEmpty(name)) {
ShowToast(R.string.toast_error_username_null);
return;
}
if (TextUtils.isEmpty(password)) {
ShowToast(R.string.toast_error_password_null);
return;
}
final ProgressDialog progress = new ProgressDialog(LoginActivity.this);
progress.setMessage("正在登陆...");
progress.setCanceledOnTouchOutside(false);
progress.show();
userManager.login(name, password, new SaveListener() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progress.setMessage("正在获取好友列表...");
}
});
// 更新用户的地理位置以及好友的资料
updateUserInfos();
progress.dismiss();
Intent intent = new Intent(LoginActivity.this,
MainInActivity.class);
startActivity(intent);
finish();
}
@Override
public void onFailure(int errorcode, String arg0) {
progress.dismiss();
BmobLog.i(arg0);
ShowToast(arg0);
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(receiver);
}
}
| [
"[email protected]"
] | |
a374c8284580c8f40f3063c7a934652f065fe2a7 | ec01419a153633004a08a091d243bd63709f7956 | /appTramDocuConcytecAdvancedFD/src/tramitedoc/concytec/action/AActionPuenteDocumento.java | d67dc0b852dda7b9e8d95e610ca7bab1698fde06 | [] | no_license | angelnoa/TramiteDoc-FD | 5c3f4b024d4421486d92e1f3eb88a2de424e9472 | e2e2d3e60886efd44d91981a674d1a358cce6aa1 | refs/heads/master | 2021-01-10T13:50:01.720613 | 2016-01-25T15:20:57 | 2016-01-25T15:20:57 | 50,359,496 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 13,925 | java | package tramitedoc.concytec.action;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
import java.util.Vector;
import javax.sql.DataSource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import tramitedoc.concytec.dao.*;
import tramitedoc.concytec.form.*;
import tramitedoc.concytec.bean.*;
import tramitedoc.concytec.dao.interfaces.*;
import tramitedoc.concytec.util.*;
import tramitedoc.concytec.dao.sql.*;
import java.sql.Connection;
import java.sql.SQLException;
/**
* AUTOR : Machuca Ovalle
* FECHA : 03-04-2006
* VERSION : 1.0
* DESCRIPCIÓN : Accion de Logeo
*/
public class AActionPuenteDocumento extends ValidaSessionAction{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(false);
/*Verificar si la sesion se perdio*/
if (session==null){
return (mapping.findForward("expiracion"));
}
int li_retorno=0;
String ls_accion=null;
String ls_cod_doc=null;
String ls_estado=null;
String ls_secuencia=null;
String ls_pagina=null;
String ls_msg_error=null;
String ls_cod_padre=null;
String ls_codigo_inicia=null;
String codigo_oficina=null;
String ls_fecha_rpta=null;
String ls_codigo_expediente="";
String ls_descripcion_tipo="";
String ls_numero_documento="";
String ls_naturaleza_documento="";
String ls_correlativo_deriva="";
String ls_descripcion_oficina="";
String ls_oficina="";
codigo_oficina = String.valueOf(session.getAttribute("codigo_oficina"));
ls_accion = request.getParameter("operacion");
ls_cod_doc = request.getParameter("codigo");
ls_secuencia = request.getParameter("secuencia");
ls_estado = request.getParameter("estado");
ls_codigo_inicia = request.getParameter("codigo_inicia");
ls_fecha_rpta = request.getParameter("fecha_rpta");
ls_codigo_expediente = request.getParameter("codigo_expediente");
ls_descripcion_tipo = request.getParameter("descripcion_tipo");
ls_numero_documento = request.getParameter("numero_documento");
ls_naturaleza_documento = request.getParameter("naturaleza_documento");
ls_correlativo_deriva = request.getParameter("correlativo_deriva");
ls_descripcion_oficina = request.getParameter("descripcion_oficina");
ls_oficina = request.getParameter("oficina");
System.out.println("el ls_accion" + ls_accion);
System.out.println("el ls_cod_doc" + ls_cod_doc);
System.out.println("el ls_secuencia" + ls_secuencia);
System.out.println("el ls_estado" + ls_estado);
System.out.println("el ls_codigo_inicia" + ls_codigo_inicia);
System.out.println("el ls_fecha_rpta" + ls_fecha_rpta);
System.out.println("el ls_codigo_expediente" + ls_codigo_expediente);
System.out.println("el ls_descripcion_tipo" + ls_descripcion_tipo);
System.out.println("el ls_numero_documento" + ls_numero_documento);
System.out.println("el ls_naturaleza_documento" + ls_naturaleza_documento);
System.out.println("el ls_correlativo_deriva" + ls_correlativo_deriva);
System.out.println("el ls_nombre_personal" + ls_descripcion_oficina);
System.out.println("el ls_oficina" + ls_oficina);
try {
Connection cnx = getConnection(request, "principal");
System.out.println("El cnx ==> " + cnx);
IUsuarioDAO daoIUsuarioDAO = new SqlUsuarioDAO();
//BMesaPartes BMesaPartesVO=new BMesaPartes();
session.removeAttribute("accion_mp");
session.removeAttribute("documento");
session.removeAttribute("secuencia");
session.removeAttribute("codigo_inicia");
session.removeAttribute("codigo_expediente");
session.removeAttribute("descripcion_tipo");
session.removeAttribute("numero_documento");
session.removeAttribute("naturaleza_documento");
session.removeAttribute("fecha_rpta");
session.removeAttribute("correlativo_deriva");
session.removeAttribute("descripcion_oficina");
session.removeAttribute("detalleConsulta");
session.removeAttribute("mensaje");
session.setAttribute("accion_mp", ls_accion);
session.setAttribute("documento", ls_cod_doc);
session.setAttribute("secuencia",ls_secuencia);
session.setAttribute("codigo_inicia", ls_codigo_inicia);
session.setAttribute("codigo_expediente", ls_codigo_expediente);
session.setAttribute("descripcion_tipo", ls_descripcion_tipo);
session.setAttribute("numero_documento", ls_numero_documento);
session.setAttribute("naturaleza_documento", ls_naturaleza_documento);
session.setAttribute("fecha_rpta", ls_fecha_rpta);
session.setAttribute("correlativo_deriva", ls_correlativo_deriva);
session.setAttribute("descripcion_oficina", ls_descripcion_oficina);
session.setAttribute("oficina", ls_oficina);
System.out.println("ls_accion" + ls_accion);
if (ls_accion == null) {
ls_accion = "";
}
if (ls_accion.equals("R")) {
// Activamos el Action de Recorrido ....
if(ls_fecha_rpta.equals("") || ls_fecha_rpta==null ){
return (mapping.findForward("recorridofecnull"));
}else{
return (mapping.findForward("recorrido"));
}
}
if (ls_accion.equals("D")) {
// Activamos La Pagina de Derivación ....
if (ls_estado.equals("3") || ls_estado.equals("1"))
{
// Solo se puede Derivar cuando el Estado es Tramite ....
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.setAttribute("cod_padre", ls_cod_padre);
session.setAttribute("derivar", "derivar");
return (mapping.findForward("derivacion"));
}
else
{
ls_msg_error = "Para Derivar un Documento el estado debe ser Recibido..!";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("A")) {
// Activamos pagina de Archivar ....
if (ls_estado.equals("3") || ls_estado.equals("4"))
{
return (mapping.findForward("archivar"));
//ls_pagina = "pag_archivar.jsp";
}
else
{
ls_msg_error = "El Estado del Documento debe ser Recibido ó Derivado";
session.setAttribute("error", ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("E")) {
// Activamos pagina de Recibir un Doc ....
// ls_pagina = "pag_serie_expediente.jsp";
if (ls_estado.equals("2") || ls_estado.equals("3")|| ls_estado.equals("6"))
{
li_retorno = daoIUsuarioDAO.parametro(cnx);
System.out.println("li_retorno" + li_retorno);
session.setAttribute("correlativorecepcion",String.valueOf(li_retorno));
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
ls_codigo_inicia = request.getParameter("codigo_inicia");
System.out.println("ls_codigo_inicia" + ls_codigo_inicia);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.removeAttribute("estadodoc");
session.setAttribute("cod_padre",ls_cod_padre);
session.setAttribute("derivar","derivar");
session.setAttribute("estadodoc", ls_estado);
if(ls_cod_doc.equals(ls_cod_padre)){
System.out.println("si el codigo inicia es igual al codigo padre");
if(codigo_oficina.equals("1")&& ls_naturaleza_documento.equals("I")){
System.out.println("si el codigo de oficina es mesa de partes");
return (mapping.findForward("preliquidardoc"));
}
return (mapping.findForward("recibirdoc"));
}else{
System.out.println("si el codigo inicia es diferente al codigo padre");
if(codigo_oficina.equals("2")){
System.out.println("si el codigo de oficina es secretaria");
return (mapping.findForward("recibirdoc"));
}
if(codigo_oficina.equals("1")){
System.out.println("si el codigo de oficina es mesa de partes");
return (mapping.findForward("preliquidardoc"));
}
}
}
else
{
ls_msg_error = "El Estado del Documento debe ser Pendiente";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("S")) {
// la accion es salir del sistema
return (mapping.findForward("cerrarsession"));
}
if (ls_accion.equals("W")) {
// Activamos pagina de Recibir un Doc ....
// ls_pagina = "pag_serie_expediente.jsp";
if (ls_estado.equals("3"))
{
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.setAttribute("cod_padre",ls_cod_padre);
session.setAttribute("derivar","derivar");
return (mapping.findForward("asociarintent"));
}
else
{
ls_msg_error = "El Estado del Documento debe ser Recibido";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("M")) {
// Activamos pagina de Modificar Documento ....
BMesaPartes detalleConsulta = daoIUsuarioDAO.of_detalle_documento(cnx,ls_oficina,ls_cod_doc,ls_secuencia);
System.out.println("detalleConsulta" + detalleConsulta);
session.setAttribute("detalleConsulta", detalleConsulta);
return (mapping.findForward("modificardoc"));
}
}
catch (Exception e) {
e.printStackTrace();
}
return (mapping.findForward("error"));
}
}
| [
"[email protected]"
] | |
ca315b67168a436da8b0da83cb3bd36b915a5de9 | 2b622a23d85b74ab783931b4d5199c1efa784ecb | /tide-test/tide-test-server/src/main/java/org/granite/tide/test/security/ExceptionHandler.java | afee656d57701d3ae1cb55948795c8de39b53f77 | [] | no_license | sbwolff/graniteds-samples | 976e005c369e5735d14fa4b2c03555a6dd9595e9 | 4ed68b6956c7ab4a3303ca306999147a85bf86e6 | refs/heads/master | 2021-01-21T00:17:42.527249 | 2009-08-06T14:56:26 | 2009-08-06T14:56:26 | 33,420,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package org.granite.tide.test.security;
import java.util.Map;
import org.granite.messaging.service.ExceptionConverter;
import org.granite.messaging.service.ServiceException;
public class ExceptionHandler implements ExceptionConverter {
public boolean accepts(Throwable t) {
//return emsg.faultCode == "Persistence.EntityNotFound"; // only accept EntityNotFound exception
return true; // Accept every single exception...
}
public ServiceException convert(
Throwable t, String detail, Map<String, Object> extendedData) {
System.err.println("--- "+t);
ServiceException se = new ServiceException(
"AnyException", t.getMessage(), detail, t
);
se.getExtendedData().putAll(extendedData);
return se;
}
} | [
"anthibug@6f0b6db0-715c-11de-a9df-91707ec8e704"
] | anthibug@6f0b6db0-715c-11de-a9df-91707ec8e704 |
8dd825864c74ec1dba215680d9b55de153ed578b | dd429d4aaf2782f8f3e016c5c3e9730fa8c0de4d | /core/src/com/svmc/mixxgame/attribute/Entity.java | c742e2d01af9d6393f61e22d64ab704dd865f972 | [] | no_license | Coder5540/mixxgame | 3c7d32bc72993e762cb77e7b24903d1a1d342595 | 2ecf0ad687aad5cb5b1460fb35b694855a87de68 | refs/heads/master | 2021-01-09T22:48:39.065046 | 2014-12-18T09:26:09 | 2014-12-18T09:26:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67 | java | package com.svmc.mixxgame.attribute;
public interface Entity {
}
| [
"[email protected]"
] | |
7d3031811bd9cd06374c6b63e8cf1e928fc530a8 | e9f223191c660fdd5ba27d7b6b38cd13e6d9565b | /projects/MachineCoding/src/org/coding/textlineeditor/command/impl/PasteCommand.java | 41d85c80fbb184cda757288851210bd2e0607e6b | [] | no_license | kumarvishal09/Mywork | 99b100ae9022302c9bd8d9568a890d19ab36e081 | a27ff4c0d8c64f6da554d8561783f5a733366d4a | refs/heads/master | 2021-07-06T01:03:51.884212 | 2021-05-04T04:58:56 | 2021-05-04T04:58:56 | 236,689,268 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package org.coding.textlineeditor.command.impl;
import org.coding.textlineeditor.Doc;
import org.coding.textlineeditor.command.Changeable;
import org.coding.textlineeditor.event.Event;
import org.coding.textlineeditor.event.PasteEvent;
public class PasteCommand implements Changeable {
private Doc doc;
public PasteCommand(Doc doc) {
this.doc = doc;
}
@Override public void execute(Event event) {
PasteEvent pasteEvent = (PasteEvent)event;
this.doc.paste(pasteEvent.getLineNumber());
}
@Override public void undo() {
this.doc.unApplyMomento();
}
@Override public void redo() {
this.doc.applyMomento();
}
}
| [
"[email protected]"
] | |
efbd3dc9b2b944011b003e6d1d5aab4894ef178c | 0e1d9d284c0a9fdc60f06a144f6bc7cc94a18780 | /android/app/src/main/java/com/pesquisacnpj/MainApplication.java | 229a3d8486d46ae996cb259e3cd05dbdb6f1e751 | [] | no_license | CPessoni/pesquisacnpj | e6834ff0d9496666970f2b53ce796f6bba4375df | 3ebc4d4af4b7c623bb0158dd6d8233e1160a6385 | refs/heads/master | 2020-04-17T02:43:11.933133 | 2019-01-24T12:05:54 | 2019-01-24T12:05:54 | 166,149,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package com.pesquisacnpj;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"[email protected]"
] | |
b7d7514d83fc150c7b4923424e5f032d126fe6fc | c17cadd6dc969c37deb0bfc6ca0d3740c0e6940b | /BasicCoreJava/src/Array/EnhancedForLoop.java | 40a80f0effc1951be9e34ce7da8e7b6e5b9c9482 | [] | no_license | bilwa93/03072020automation | d16b41673f08b1bd1dc7018c3e158f1dde154de3 | d23b10d020cf323143d396afc79d13c53d4321a9 | refs/heads/master | 2022-11-13T14:54:48.841344 | 2020-07-04T06:49:45 | 2020-07-04T06:49:45 | 276,959,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package Array;
public class EnhancedForLoop {
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] name= {"Name1","Name2","Name3"};
}
}
| [
"[email protected]"
] | |
01cae1fb57830f71e53f815a427d6122a4003098 | 17537c091572a94c58975214094fdfeedb57fde1 | /core/server/clientProject/commonClient/src/main/java/com/home/commonClient/net/response/login/ClientHotfixResponse.java | d20e8986061b541e7937e4fed29c321381f29b46 | [
"Apache-2.0"
] | permissive | mengtest/home3 | dc2e5f910bbca6e536ded94d3f749671f0ca76d5 | a15a63694918483b2e4853edab197b5cdddca560 | refs/heads/master | 2023-01-29T13:49:23.822515 | 2020-12-11T10:17:39 | 2020-12-11T10:17:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,088 | java | package com.home.commonClient.net.response.login;
import com.home.commonBase.data.login.ClientVersionData;
import com.home.commonClient.constlist.generate.GameResponseType;
import com.home.commonClient.net.base.GameResponse;
import com.home.shine.bytes.BytesReadStream;
import com.home.shine.support.DataWriter;
import com.home.shine.support.collection.IntObjectMap;
import com.home.shine.support.pool.DataPool;
/** 客户端版本热更新消息(generated by shine) */
public class ClientHotfixResponse extends GameResponse
{
/** 数据类型ID */
public static final int dataID=GameResponseType.ClientHotfix;
/** 客户端版本 */
public ClientVersionData clientVersion;
public ClientHotfixResponse()
{
_dataID=GameResponseType.ClientHotfix;
}
/** 获取数据类名 */
@Override
public String getDataClassName()
{
return "ClientHotfixResponse";
}
/** 执行 */
@Override
protected void execute()
{
}
/** 读取字节流(完整版) */
@Override
protected void toReadBytesFull(BytesReadStream stream)
{
super.toReadBytesFull(stream);
stream.startReadObj();
this.clientVersion=new ClientVersionData();
this.clientVersion.readBytesFull(stream);
stream.endReadObj();
}
/** 读取字节流(简版) */
@Override
protected void toReadBytesSimple(BytesReadStream stream)
{
super.toReadBytesSimple(stream);
this.clientVersion=new ClientVersionData();
this.clientVersion.readBytesSimple(stream);
}
/** 转文本输出 */
@Override
protected void toWriteDataString(DataWriter writer)
{
super.toWriteDataString(writer);
writer.writeTabs();
writer.sb.append("clientVersion");
writer.sb.append(':');
if(this.clientVersion!=null)
{
this.clientVersion.writeDataString(writer);
}
else
{
writer.sb.append("ClientVersionData=null");
}
writer.writeEnter();
}
/** 回池 */
@Override
protected void toRelease(DataPool pool)
{
super.toRelease(pool);
this.clientVersion=null;
}
}
| [
"[email protected]"
] | |
c2e0fd1af53649c3a6b22f0b1830f4076a955e67 | d6efaccae1ce0e92347d55434101790f258fd9f7 | /src/textcomparer/Main.java | 82d697014a9d2dd5945efdceee7daf2a1ba54ba7 | [] | no_license | jankeymeulen/TextComparer | bdf86151e6ed5581803bcb2fe373e0d4f4960e62 | 49384242ee72bab39c6bc451428f851d5ab8c79e | refs/heads/master | 2021-01-10T08:53:41.101957 | 2015-06-03T11:07:05 | 2015-06-03T11:07:05 | 36,798,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,929 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package textcomparer;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author jan
*/
public class Main
{
public static void main(String[] args) throws IOException
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Model model = new Model();
MainWindow frame = model.createMainWindow();
if (args.length != 0)
{
if (args.length == 7)
{
model.setSrcFile(new File(args[0]));
model.setDstFile(new File(args[1]));
model.setMaxDist(new Integer(args[2]));
model.setMinLength(new Integer(args[3]));
model.setMaxWindow(new Integer(args[4]));
model.setMaxSkip(new Integer(args[5]));
model.setMinWords(new Integer(args[6]));
}
else
{
System.err.println("Usage: java -jar TextComparer.jar srcFile DstFile"
+ "maxDist minLength maxWindow maxSkip minWords");
}
}
frame.start();
}
}
| [
"[email protected]"
] | |
40fe0885f1945a334f06b52425d23daaead063e2 | 98119c1d07b88c31eee153bef508b4b33c701ae1 | /.svn/pristine/40/40fe0885f1945a334f06b52425d23daaead063e2.svn-base | 05a3cfc532ef3faec7360ffe4e45b3f10414d7cb | [] | no_license | ghyaolong/spay-admin | dc8e8b394f4f3ba0847eae9cec0d3a10d769c5c3 | 024dccd05b8a882e74540d288dd96f89ddf5d2cf | refs/heads/master | 2021-01-21T17:37:25.410908 | 2017-05-21T15:20:46 | 2017-05-21T15:20:46 | 91,966,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,277 | package com.syhbuy.spay.admin.entity;
import java.math.BigDecimal;
public class dispenseBuyRecord {
private String id;//购买记录ID
private String activityId; //活动ID
private BigDecimal buyAmount;//购买金额
private BigDecimal faceValue; //面值
private Long buyTime;//购买时间
private String purchaser;//购买人
private String status;//状态
private String isDel;
private Long delTime;
private String orderId;//订单id
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId == null ? null : activityId.trim();
}
public BigDecimal getBuyAmount() {
return buyAmount;
}
public void setBuyAmount(BigDecimal buyAmount) {
this.buyAmount = buyAmount;
}
public BigDecimal getFaceValue() {
return faceValue;
}
public void setFaceValue(BigDecimal faceValue) {
this.faceValue = faceValue;
}
public Long getBuyTime() {
return buyTime;
}
public void setBuyTime(Long buyTime) {
this.buyTime = buyTime;
}
public String getPurchaser() {
return purchaser;
}
public void setPurchaser(String purchaser) {
this.purchaser = purchaser == null ? null : purchaser.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel == null ? null : isDel.trim();
}
public Long getDelTime() {
return delTime;
}
public void setDelTime(Long delTime) {
this.delTime = delTime;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId == null ? null : orderId.trim();
}
} | [
"[email protected]"
] | ||
e9f35782772d4690e88434cf449b12d8c2321ec6 | a28267bfa0c90bc5b84ee427dcc972bc2e35411a | /i18n-spigot/src/main/java/com/blackypaw/mc/i18n/interceptor/v1_11/InterceptorScoreboard.java | 8417fcb0d2b7c1dc7f5af6ce420b32aaa9a5e512 | [
"BSD-3-Clause"
] | permissive | cieldeville/I18N | bff9ac0e3b8041b7c487a5461be20600a038eee0 | 1d105e5432c3dd99c3ce1173fe0babbda96f034d | refs/heads/master | 2021-06-20T08:50:59.685696 | 2017-06-21T15:45:06 | 2017-06-21T15:45:06 | 56,890,583 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | /*
* Copyright (c) 2016, BlackyPaw
* All rights reserved.
*
* This code is licensed under a BSD 3-Clause license. For further license details view the LICENSE file in the root folder of this source tree.
*/
package com.blackypaw.mc.i18n.interceptor.v1_11;
import com.blackypaw.mc.i18n.I18NSpigotImpl;
import com.blackypaw.mc.i18n.InterceptorBase;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.google.gson.Gson;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
/**
* @author BlackyPaw
* @version 1.0
*/
public class InterceptorScoreboard extends InterceptorBase {
public InterceptorScoreboard( Plugin plugin, Gson gson, I18NSpigotImpl i18n ) {
super( plugin, gson, i18n, ListenerPriority.LOWEST, PacketType.Play.Server.SCOREBOARD_OBJECTIVE, PacketType.Play.Server.SCOREBOARD_SCORE, PacketType.Play.Server.SCOREBOARD_TEAM );
}
@Override
public void onPacketSending( PacketEvent event ) {
if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_OBJECTIVE ) {
this.onScoreboardObjective( event );
} else if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_SCORE ) {
this.onScoreboardScore( event );
} else if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_TEAM ) {
this.onScoreboardTeam( event );
}
}
private void onScoreboardObjective( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
int mode = packet.getIntegers().read( 0 );
if ( mode == 0 || mode == 2 ) {
String message = packet.getStrings().read( 1 );
String translation = this.translateMessageIfAppropriate( this.i18n.getLocale( player.getUniqueId() ), message );
if ( message != translation ) {
packet.getStrings().write( 1, translation );
}
}
}
private void onScoreboardScore( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
String message = packet.getStrings().read( 0 );
String translation = this.translateMessageIfAppropriate( this.i18n.getLocale( player.getUniqueId() ), message );
if ( message != translation ) {
packet.getStrings().write( 0, translation );
}
}
private void onScoreboardTeam( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
final Locale locale = this.i18n.getLocale( player.getUniqueId() );
int mode = packet.getIntegers().read( 1 );
if ( mode == 0 || mode == 2 ) {
String displayName = packet.getStrings().read( 1 );
String prefix = packet.getStrings().read( 2 );
String suffix = packet.getStrings().read( 3 );
String translatedDisplayName = this.translateMessageIfAppropriate( locale, displayName );
String translatedPrefix = this.translateMessageIfAppropriate( locale, prefix );
String translatedSuffix = this.translateMessageIfAppropriate( locale, suffix );
if ( displayName != translatedDisplayName ) {
packet.getStrings().write( 1, translatedDisplayName );
}
if ( prefix != translatedPrefix ) {
packet.getStrings().write( 2, translatedPrefix );
}
if ( suffix != translatedSuffix ) {
packet.getStrings().write( 3, translatedSuffix );
}
}
if ( mode == 0 || mode == 3 || mode == 4 ) {
List<String> entries = (List<String>) packet.getSpecificModifier( Collection.class ).read( 0 );
if ( entries.size() > 0 ) {
for ( int i = 0; i < entries.size(); ++i ) {
String entry = entries.get( i );
String translatedEntry = this.translateMessageIfAppropriate( locale, entry );
if ( entry != translatedEntry ) {
entries.set( i, translatedEntry );
}
}
}
}
}
}
| [
"[email protected]"
] | |
c6243cbfc92da5da99d06e75e99fd11ac6c7fb27 | 19f2e871122e35ac830e2d00c9d90857371a70d9 | /score-board/app/src/main/java/com/codecool/scoreboard/apiservice/RetrofitClient.java | 236b87f588d445525102a1ae63a0eec1ae6ebe30 | [] | no_license | CodecoolGlobal/score-board-java-kagnest | ea7a458c26007e0d2b1c3fd393e681cdc8df9d93 | 3fd9ea2fca2e5808ee152dc5155085bbc7ad8c14 | refs/heads/development | 2022-11-07T01:39:44.356200 | 2020-06-26T13:19:59 | 2020-06-26T13:19:59 | 272,633,502 | 0 | 0 | null | 2020-06-26T13:20:00 | 2020-06-16T06:59:42 | Java | UTF-8 | Java | false | false | 1,134 | java | package com.codecool.scoreboard.apiservice;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient {
private static Retrofit retrofit = null;
private static String BASE_URL = "https://www.thesportsdb.com/api/v1/json/1/";
public static Retrofit getClient() {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(client)
.build();
}
return retrofit;
}
}
| [
"[email protected]"
] | |
12204995bfd388c53b1c4d353d3931b9c179670f | df37953eab4f6baabaa711f0f5a0297ae446660c | /src/AlexandraShokhan/lesson4/Task2.java | 10170b9d95553b383baa10f3dfb7ca405fde0b00 | [] | no_license | Shumski-Sergey/JC2019-09 | da54c55facd19242c439c3f900c48678eafcfc43 | 7065c371d1c83e86fec4180e6adb1b34d30739e5 | refs/heads/master | 2020-08-02T19:03:56.232185 | 2020-02-11T19:28:42 | 2020-02-11T19:28:42 | 211,473,198 | 0 | 17 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package AlexandraShokhan.lesson4;
// 1.В задаче на поиск максимальной оценки, вывести не саму оценку, а ее номер.
import java.util.concurrent.ThreadLocalRandom;
public class Task2 {
public static void main(String[] args) {
int[] grades;
grades = createRandomArray(6,1,100);
int maxGrade = findMaxIndex(grades);
int gradeNumber = maxGrade + 1;
System.out.println("The number of the max grade is " + gradeNumber + ".");
}
// Метод, который возврашает случайное число от min до max.
public static int getRandomNum(int min, int max) {
int i = ThreadLocalRandom.current().nextInt(min, max + 1);
return i;
}
// Метод, который возврашает массив случайных чисел определенной длины.
public static int[] createRandomArray(int arrayLength, int minValue, int maxValue) {
int [] randomArray;
randomArray = new int[arrayLength];
for (int i = 0; i < randomArray.length; i++) {
randomArray[i] = getRandomNum(minValue, maxValue);
}
return randomArray;
}
// Метод, который возврашает индекс максимального числа из массива.
public static int findMaxIndex(int array[]) {
int max = array[0];
int maxIndex = 0;
for (int i = 0; i < array.length; i++) {
if (max < array[i]) {
max = array[i];
maxIndex = i;
}
}
return maxIndex;
}
}
| [
"[email protected]"
] | |
fe3c3448bc8601af8babe1b9ef197ca88a9bb0d5 | 5693307cb78192cdea0cbbde015c39cc9c881f09 | /src/main/java/org/apache/storm/executionengine/topologyLayer/TopologyOperator.java | 46f899c16ef4efd07d8360a0e2e9105c6fa7cee3 | [] | no_license | caofangkun/apache-pig-on-storm | 1fe6e4aeb4078ebdf5c9b2b76414a5c0946c4310 | 725f70d7e52cc69f2ed2fa5f0cc367c7236c564c | refs/heads/master | 2016-09-06T17:14:37.473783 | 2015-08-04T09:54:24 | 2015-08-04T09:54:24 | 40,099,755 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,941 | java | package org.apache.storm.executionengine.topologyLayer;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.storm.executionengine.physicalLayer.PhysicalOperator;
import org.apache.storm.executionengine.physicalLayer.plans.PhysicalPlan;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POCounter;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POPartition;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.PORank;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POTap;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POUnion;
import org.apache.storm.executionengine.topologyLayer.plans.TopologyOperatorPlanVisitor;
import org.apache.pig.impl.plan.NodeIdGenerator;
import org.apache.pig.impl.plan.Operator;
import org.apache.pig.impl.plan.OperatorKey;
import org.apache.pig.impl.plan.PlanException;
import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.util.MultiMap;
/**
* An operator model for TopologyOperator.
*/
public class TopologyOperator extends Operator<TopologyOperatorPlanVisitor> {
private static final long serialVersionUID = 1L;
// The sub physical plan that should be executed
public PhysicalPlan topoPlan;
// Indicates that the map plan creation
// is complete
boolean topoDone = false;
// Indicates that there is an operator which uses endOfAllInput flag in the
// plan
boolean endOfAllInputInMap = false;
// Indicates if this job is an order by job
boolean globalSort = false;
// Indicates if this is a limit after a sort
boolean limitAfterSort = false;
// Indicate if the entire purpose for this map reduce job is doing limit,
// does not change
// anything else. This is to help POPackageAnnotator to find the right
// POPackage to annotate
boolean limitOnly = false;
// The sort order of the columns;
// asc is true and desc is false
boolean[] sortOrder;
// Sort order for secondary keys;
boolean[] secondarySortOrder;
public Set<String> UDFs;
public Set<PhysicalOperator> scalars;
// Indicates if a UDF comparator is used
boolean isUDFComparatorUsed = false;
transient NodeIdGenerator nig;
private String scope;
int requestedParallelism = -1;
// estimated at runtime
int estimatedParallelism = -1;
// calculated at runtime
int runtimeParallelism = -1;
/* Name of the Custom Partitioner used */
String customPartitioner = null;
// Map of the physical operator in physical plan to the one in MR plan: only
// needed
// if the physical operator is changed/replaced in MR compilation due to,
// e.g., optimization
public MultiMap<PhysicalOperator, PhysicalOperator> phyToMRMap;
//
private List<POPartition> outputPartitions = new ArrayList<POPartition>();
private List<POPartition> inputPartitions = new ArrayList<POPartition>();
private Map<String, List<PhysicalOperator>> partitionSeen = new HashMap<String, List<PhysicalOperator>>();
// private Map<PhysicalOperator, String> partitionSeen = new
// HashMap<PhysicalOperator, String>();
public TopologyOperator(OperatorKey k) {
super(k);
topoPlan = new PhysicalPlan();
UDFs = new HashSet<String>();
scalars = new HashSet<PhysicalOperator>();
nig = NodeIdGenerator.getGenerator();
scope = k.getScope();
phyToMRMap = new MultiMap<PhysicalOperator, PhysicalOperator>();
}
public boolean hasTap() {
if (this.topoPlan == null || this.topoPlan.size() == 0) {
return false;
}
for (PhysicalOperator root : this.topoPlan.getRoots()) {
if (root instanceof POTap) {
return true;
}
}
return false;
}
public List<POPartition> getOutputPartitions() {
return outputPartitions;
}
public List<POPartition> getInputPartitions() {
return inputPartitions;
}
public void setPartitionSeen(Map<String, List<PhysicalOperator>> partitionSeen) {
this.partitionSeen = partitionSeen;
}
/**
* TODO form Partition to other PhysicalOperators
*
* @param alias
* @return
*/
public Map<String, List<String>> getPartitionSuccessors() {
Map<String, List<String>> all = new HashMap<String, List<String>>();
for (POPartition po : inputPartitions) {
if (partitionSeen.containsKey(po.getAlias())) {
List<PhysicalOperator> tos = partitionSeen.get(po.getAlias());
List<String> ret = new ArrayList<String>();
for (PhysicalOperator to : tos) {
ret.add(to.getAlias());
}
all.put(po.getAlias(), ret);
}
}
return all;
}
private String shiftStringByTabs(String DFStr, String tab) {
StringBuilder sb = new StringBuilder();
String[] spl = DFStr.split("\n");
for (int i = 0; i < spl.length; i++) {
sb.append(tab);
sb.append(spl[i]);
sb.append("\n");
}
sb.delete(sb.length() - "\n".length(), sb.length());
return sb.toString();
}
/**
* Uses the string representation of the component plans to identify itself.
*/
@Override
public String name() {
String udfStr = getUDFsAsStr();
StringBuilder sb = new StringBuilder("Topology" + "("
+ requestedParallelism + (udfStr.equals("") ? "" : ",") + udfStr + ")"
+ " - " + mKey.toString() + ":\n");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (!topoPlan.isEmpty()) {
topoPlan.explain(baos);
String mp = new String(baos.toByteArray());
sb.append(shiftStringByTabs(mp, "| "));
} else
sb.append("Physical Plan Empty");
return sb.toString();
}
private String getUDFsAsStr() {
StringBuilder sb = new StringBuilder();
if (UDFs != null && UDFs.size() > 0) {
for (String str : UDFs) {
sb.append(str.substring(str.lastIndexOf('.') + 1));
sb.append(',');
}
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
@Override
public boolean supportsMultipleInputs() {
return true;
}
@Override
public boolean supportsMultipleOutputs() {
return true;
}
@Override
public void visit(TopologyOperatorPlanVisitor v) throws VisitorException {
v.visitTopologyOperator(this);
}
public boolean isTopoDone() {
return topoDone;
}
public void setTopoDone(boolean topoDone) {
this.topoDone = topoDone;
}
public void setTopoDoneSingle(boolean topoDone) throws PlanException {
this.topoDone = topoDone;
if (topoDone && topoPlan.getLeaves().size() > 1) {
topoPlan.addAsLeaf(getUnion());
}
}
public void setTopoDoneMultiple(boolean topoDone) throws PlanException {
this.topoDone = topoDone;
if (topoDone && topoPlan.getLeaves().size() > 0) {
topoPlan.addAsLeaf(getUnion());
}
}
private POUnion getUnion() {
return new POUnion(new OperatorKey(scope, nig.getNextNodeId(scope)));
}
public boolean isGlobalSort() {
return globalSort;
}
public void setGlobalSort(boolean globalSort) {
this.globalSort = globalSort;
}
public boolean isLimitAfterSort() {
return limitAfterSort;
}
public void setLimitAfterSort(boolean las) {
limitAfterSort = las;
}
public boolean isLimitOnly() {
return limitOnly;
}
public void setLimitOnly(boolean limitOnly) {
this.limitOnly = limitOnly;
}
public void setSortOrder(boolean[] sortOrder) {
if (null == sortOrder)
return;
this.sortOrder = new boolean[sortOrder.length];
for (int i = 0; i < sortOrder.length; ++i) {
this.sortOrder[i] = sortOrder[i];
}
}
public void setSecondarySortOrder(boolean[] secondarySortOrder) {
if (null == secondarySortOrder)
return;
this.secondarySortOrder = new boolean[secondarySortOrder.length];
for (int i = 0; i < secondarySortOrder.length; ++i) {
this.secondarySortOrder[i] = secondarySortOrder[i];
}
}
public boolean[] getSortOrder() {
return sortOrder;
}
public boolean[] getSecondarySortOrder() {
return secondarySortOrder;
}
/**
* @return whether end of all input is set in the map plan
*/
public boolean isEndOfAllInputSetInMap() {
return endOfAllInputInMap;
}
/**
* @param endOfAllInputInMap
* the streamInMap to set
*/
public void setEndOfAllInputInMap(boolean endOfAllInputInMap) {
this.endOfAllInputInMap = endOfAllInputInMap;
}
public int getRequestedParallelism() {
return requestedParallelism;
}
public String getCustomPartitioner() {
return customPartitioner;
}
public boolean isRankOperation() {
return getRankOperationId().size() != 0;
}
public ArrayList<String> getRankOperationId() {
ArrayList<String> operationIDs = new ArrayList<String>();
Iterator<PhysicalOperator> mapRoots = this.topoPlan.getRoots().iterator();
while (mapRoots.hasNext()) {
PhysicalOperator operation = mapRoots.next();
if (operation instanceof PORank)
operationIDs.add(((PORank) operation).getOperationID());
}
return operationIDs;
}
public boolean isCounterOperation() {
return (getCounterOperation() != null);
}
public boolean isRowNumber() {
POCounter counter = getCounterOperation();
return (counter != null) ? counter.isRowNumber() : false;
}
public String getOperationID() {
POCounter counter = getCounterOperation();
return (counter != null) ? counter.getOperationID() : null;
}
private POCounter getCounterOperation() {
PhysicalOperator operator;
Iterator<PhysicalOperator> it = this.topoPlan.getLeaves().iterator();
while (it.hasNext()) {
operator = it.next();
if (operator instanceof POCounter)
return (POCounter) operator;
}
return null;
}
}
| [
"[email protected]"
] | |
361df97718c238b8ac3ba616d2adcd87b9114e12 | cfc60fc1148916c0a1c9b421543e02f8cdf31549 | /src/testcases/CWE789_Uncontrolled_Mem_Alloc/CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d.java | fdbb176624fa51406685c61253a1dfbac2e1554a | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujinhua/GitFun | c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2 | 987f72fdccf871ece67f2240eea90e8c1971d183 | refs/heads/master | 2021-01-18T05:46:03.351267 | 2012-09-11T16:43:44 | 2012-09-11T16:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d.java
Label Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml
Template File: sources-sink-53d.tmpl.java
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: getQueryStringServlet Parse id param out of the querystring without getParam
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: HashMap
* BadSink : Create a HashMap using data as the initial size
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE789_Uncontrolled_Mem_Alloc;
import testcasesupport.*;
import javax.servlet.http.*;
import java.util.HashMap;
public class CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d
{
public void bad_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
/* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */
HashMap list = new HashMap(data);
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
/* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */
HashMap list = new HashMap(data);
}
}
| [
"[email protected]"
] | |
2df4c3c012454857f5f8a9879189705fb745a343 | b2c4cf8182f6f918ee1174d8bfc0c37a88e20244 | /src/javapreviousversion/com/lambda/Greeter.java | 9f97cf9916cc8984a71e2010f22c3e5b3e5870d7 | [] | no_license | fame2105/Lambda_Java_8 | 23ffb22389c0fef0798a8834c04b41f1058e1777 | 07f0e30e31b371db0e62751fabcd56e00ce3098a | refs/heads/master | 2021-07-02T16:08:13.541942 | 2017-09-22T03:36:55 | 2017-09-22T04:27:44 | 104,066,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package javapreviousversion.com.lambda;
public class Greeter {
public void greet(Greeting greeting) {
greeting.perform();
// System.out.print("Hello World");
}
public static void main(String[] args) {
Greeter greeter = new Greeter();
// greeter.greet();
Greeting helloWorldGreeting = new HelloWorldGreeting();
greeter.greet(helloWorldGreeting);
Greeting myLambdaFunction = () -> System.out.println("Hello World");
// MyAdd addFunction = (int a, int b) -> a+b;
}
}
/*interface MyLambda {
void foo();
}*/
/*interface MyAdd{
int add(int a, int b);
}*/
| [
"[email protected]"
] | |
c652cf54de86da2de3f3ecf90abdf0ae0d3671e9 | 3cf20776cd836f08414436fc01158ed114966ca6 | /JW_201802104029/src/bysj/Dao/TeacherDao.java | 21bfbe463c313bd38f7e1fe04c2f12be6857e394 | [] | no_license | chen-yiqian/JW_201802104029_27 | a91ae4eb57921f4cdbe5dfb13b11c00f88b21967 | 17f35902b9e0f0fb39e99c6b6117c5dd0b9a4477 | refs/heads/master | 2020-09-20T03:25:32.717672 | 2019-11-27T07:03:54 | 2019-11-27T07:03:54 | 224,366,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,522 | java | package bysj.Dao;
import bysj.Daomain.Degree;
import bysj.Daomain.Department;
import bysj.Daomain.ProfTitle;
import bysj.Daomain.Teacher;
import bysj.Service.DegreeService;
import bysj.Service.DepartmentService;
import bysj.Service.ProfTitleService;
import bysj.Service.TeacherService;
import bysj.Util.JdbcHelper;
import java.sql.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
public final class TeacherDao {
private static TeacherDao teacherDao=new TeacherDao();
public static TeacherDao getInstance(){
return teacherDao;
}
public Collection<Teacher> findAll() throws SQLException {
//创建一个HashSet对象,并把它加到set
Set teachers=new HashSet<Teacher>();
//获得连接对象
Connection connection = JdbcHelper.getConn();
//在该连接上创建语句盒子对象
Statement statement = connection.createStatement();
//执行sql查询语句并获得结果集对象
ResultSet resultSet= statement.executeQuery("select * from teacher");
//若结果集仍有下一条记录,则执行循环体
while (resultSet.next()){
ProfTitle profTitle=ProfTitleDao.getInstance().find(resultSet.getInt("proftitle_id"));
Degree degree=DegreeDao.getInstance().find(resultSet.getInt("degree_id"));
Department department=DepartmentDao.getInstance().find(resultSet.getInt("department_id"));
//获得数据库的信息,并用于在网页中显示
Teacher teacher = new Teacher(resultSet.getInt("id"),
resultSet.getString("name"),
profTitle,
degree,
department);
//添加到集合中
teachers.add(teacher);
}
return teachers;
}
public Teacher find(Integer id)throws SQLException{
Teacher teacher = null;
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String findteacher="select * from teacher where id=?";
//在该连接上创建预编译语句对象
PreparedStatement preparedStatement=connection.prepareStatement(findteacher);
//为预编译语句赋值
preparedStatement.setInt(1,id);
//创建ResultSet对象,执行预编译语句
ResultSet resultSet=preparedStatement.executeQuery();
//由于id不能取重复值,故结果集中最多有一条记录
//若结果集有一条记录,则以当前记录中的id,description,no,remarks值为参数,创建Degree对象
//若结果集中没有记录,则本方法返回null
if(resultSet.next()){
ProfTitle profTitle= ProfTitleService.getInstance().find(resultSet.getInt("proftitle_id"));
Degree degree= DegreeService.getInstance().find(resultSet.getInt("degree_id"));
Department department=DepartmentService.getInstance().find(resultSet.getInt("department_id"));
//获得数据库的信息
teacher=new Teacher(
resultSet.getInt("id"),
resultSet.getString("name"),
profTitle,
degree,
department
);
}
//关闭
JdbcHelper.close(preparedStatement,connection);
return teacher;
}
public boolean update(Teacher teacher)throws SQLException{
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String updateteacher="update teacher set name=?,proftitle_id=?,degree_id=?,department_id=? where id=?";
//创建PreparedStatement接口对象,包装编译后的目标代码(可以设置参数,安全性高)
PreparedStatement preparedStatement=connection.prepareStatement(updateteacher);
//为预编译的语句参数赋值
preparedStatement.setString(1,teacher.getName());
preparedStatement.setInt(2,teacher.getTitle().getId());
preparedStatement.setInt(3,teacher.getDegree().getId());
preparedStatement.setInt(4,teacher.getDepartment().getId());
preparedStatement.setInt(5,teacher.getId());
//执行预编译对象的executeUpdate()方法,获取修改记录的行数
int affected=preparedStatement.executeUpdate();
//关闭
JdbcHelper.close(preparedStatement,connection);
return affected>0;
}
public boolean add(Teacher teacher)throws SQLException{
//获得连接对象
Connection connection = JdbcHelper.getConn();
//创建sql语句
String addTeacher_sql = "insert into teacher(name,proftitle_id,degree_id,department_id) values " + "(?,?,?,?)";
//在该连接上创建预编译语句对象
PreparedStatement pstmt = connection.prepareStatement(addTeacher_sql);
//为预编译参数赋值
pstmt.setString(1,teacher.getName());
pstmt.setInt(2,teacher.getTitle().getId());
pstmt.setInt(3,teacher.getDegree().getId());
pstmt.setInt(4,teacher.getDepartment().getId());
//执行预编译对象的executeUpdate方法,获取添加的记录行数
int affectedRowNum=pstmt.executeUpdate();
//关闭
JdbcHelper.close(pstmt,connection);
return affectedRowNum>0;
}
public boolean delete(Integer id) throws SQLException {
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String deleteTeacher_sql="DELETE FROM teacher WHERE id=?";
//在该连接上创建预编译语句对象
PreparedStatement pstmt=connection.prepareStatement(deleteTeacher_sql);
//为预编译参数赋值
pstmt.setInt(1,id);
//执行预编译对象的executeUpdate()方法,获取删除记录的行数
int affectedRowNum=pstmt.executeUpdate();
//关闭
JdbcHelper.close(pstmt,connection);
return affectedRowNum > 0;
}
}
| [
"[email protected]"
] | |
868abe8d1e927ed028ea1da3b850b6eb23b9da3b | c9191f99c1af05b655609cbd11bd42240a6c5cc2 | /core/src/main/java/io/rainrobot/wake/core/json/IdabelCollectionDeSerializer.java | da5251ee9ef85f6962f4790eafe919ae9405abcc | [] | no_license | extremeFunk/WakeApp | 09a0df27c8a24961ceed04da31bc9363e1fe1493 | 2294c3007309b0af7e0c5993f64c31834aa594ee | refs/heads/master | 2020-07-24T20:19:02.526324 | 2019-11-11T21:48:16 | 2019-11-11T21:48:16 | 157,155,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package io.rainrobot.wake.core.json;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import io.rainrobot.wake.core.Idabel;
public abstract class IdabelCollectionDeSerializer <T extends Idabel>
extends JsonDeserializer<Collection<T>> {
@Override
public Collection<T> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = p.getCodec().readTree(p);
List<JsonNode> nodeList = tree.findValues(IdabelSerilizer.LABEL);
Collection<T> pojoList = getCollection();
nodeList.forEach(n -> {
T t = getInstance();
t.setId(n.asInt());
pojoList.add(t);
});
return pojoList;
}
protected abstract T getInstance();
protected abstract Collection<T> getCollection();
}
| [
"[email protected]"
] | |
e0726350e938059d6e2fa730b638ab59560c5235 | 53efcbcb8210a01c3a57cdc2784926ebc22d6412 | /src/main/java/br/com/fieesq/model54330/FieEsq05343.java | 0ea52701cdde3f344be411901c0fbc6606220415 | [] | no_license | fie23777/frontCercamento | d57846ac985f4023a8104a0872ca4a226509bbf2 | 6282f842544ab4ea332fe7802d08cf4e352f0ae3 | refs/heads/master | 2021-04-27T17:29:56.793349 | 2018-02-21T10:32:23 | 2018-02-21T10:32:23 | 122,322,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package br.com.fieesq.model54330;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
@Entity
public class FieEsq05343 {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String numEsq05343;
@Transient
private String esqParam;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNumEsq05343() {
return numEsq05343;
}
public void setNumEsq05343(String numEsq05343) {
this.numEsq05343 = numEsq05343;
}
public String getEsqParam() {
return esqParam;
}
public void setEsqParam(String esqParam) {
this.esqParam = esqParam;
}
}
| [
"[email protected]"
] | |
4619646ec0c4b4e57d804e4d84eb62b618931c20 | 6e0b9487e3b77b4ff7e9b91b68d85d53f5e3ca17 | /src/com/zhxy/chapter9/interfaces/Apply.java | 5cf87ff8f7d100f0b69d130616a52f52ccc9d53c | [] | no_license | zhxysky/thinginjava | ee1adcdce3d020ebbaa0d1a895fac061ecd96815 | dce8e09e08020631ffd0cff5d8b6d39a13169f73 | refs/heads/master | 2020-04-06T07:05:58.905479 | 2016-08-29T13:58:42 | 2016-08-29T13:58:42 | 65,739,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.zhxy.chapter9.interfaces;
public class Apply {
public static void process(Processor p,Object s) {
System.out.println("Using Processor "+p.name());
System.out.println(p.process(s));
}
}
| [
"[email protected]"
] | |
b04fa2f0141b68080849352afcb4e58ad3c819a9 | 7549c76c26095f2b6bb174cac78f7dd7b5094aad | /chicha/src/main/java/com/chicha/genericlib/FileLib.java | f691f6627db1d3a57cd190beb63462cab2805e2a | [] | no_license | yeshwanth135/chotu | 6d42db65c79ecbdfc735bf9beb1382ea84548169 | e2b5b5ddbd9880d10a3dce0196291d8d214fbefa | refs/heads/main | 2023-08-23T17:13:57.724168 | 2021-09-24T14:23:50 | 2021-09-24T14:23:50 | 405,900,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,566 | java | package com.chicha.genericlib;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Properties;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class FileLib {
public String readpropData(String propPath, String key) throws Throwable {
FileInputStream fis=new FileInputStream(propPath);
Properties prop=new Properties();
prop.load(fis);
String propValue=prop.getProperty(key, "incorrect key");
return propValue;
}
public void writeexcelData(String excelpath, String sheetname,int row,int cell,String data) throws Throwable {
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
wb.getSheet(sheetname).getRow(row).createCell(cell).setCellValue(data);
FileOutputStream fos=new FileOutputStream(excelpath);
wb.write(fos);
}
public String readexcelData(String excelpath,String sheetname,int row,int cell) throws Throwable{
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
String excelvalue=wb.getSheet(sheetname).getRow(row).getCell(cell).toString();
return excelvalue;
}
public int getrowCount(String excelpath,String sheetName) throws Throwable {
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
int rowCount=wb.getSheet(sheetName).getLastRowNum();
return rowCount;
}
}
| [
"sunny@DESKTOP-R6249JK"
] | sunny@DESKTOP-R6249JK |
9f641ead912ce88055e19105bef8f44570c891c0 | 0305ac4a0e235825dbb8fc05f54352341e290a2c | /src/test/Test2.java | 6443c92c2b9c3ef42b73d65c9a40ae9c137bad73 | [
"MIT"
] | permissive | benTrust/Test | c9d1f7b69a9fa84a6a6e7947331bbbb98fabc76b | 7d0ba9146fc895dc09bbd319515aefe4a42d70ca | refs/heads/master | 2021-07-02T19:31:45.134946 | 2017-02-01T20:31:55 | 2017-02-01T20:31:55 | 34,114,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package test;
public class Test2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Ca ne marche pas ?");
}
}
| [
"ben@debianBen"
] | ben@debianBen |
b8f71dd09952a950324c2289f320be70e9eb4835 | 17ea252660c5d98dc719ce1d2b1c9e89f306e5e6 | /src/top/lolcl/dao/RoleRightMapper.java | ebeba0b4151cae3b1a70038fc081c2b338301be8 | [] | no_license | sanchoziyan/MyBlogBack | 36e0195442bdcd836cedccb24f14fa557f8aa612 | abd344be7b6c7aa73672d9a147dac4e5eb5fd4c3 | refs/heads/master | 2020-04-14T19:10:51.928103 | 2019-01-04T02:46:11 | 2019-01-04T02:46:11 | 164,048,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package top.lolcl.dao;
import java.util.List;
import top.lolcl.entity.RoleRight;
public interface RoleRightMapper {
int insert(RoleRight record);
int insertSelective(RoleRight record);
List<RoleRight> selectByROID(String roid);
} | [
"[email protected]"
] | |
2e1947a55cf40dfda60e21fac390ea616c695e3e | 81b3d03841dd7039fed5b11e2f48859f23eec685 | /CareerCups/ReverseWords.java | 9972e7ed44fdf3f9c2f6228684a62c3c76adca31 | [] | no_license | choitom/Algorithm | 451f74856deee514ab96e6d60e755699646371a9 | 918da6bd8457a26e88beae528cd77856c586298f | refs/heads/master | 2020-05-22T08:14:35.772977 | 2016-09-26T02:50:01 | 2016-09-26T02:50:01 | 65,788,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | /**
Author : Tom Choi
Date : 08/16/2016
Problem
-> Given an input string, reverse the string word by word
where a word is defined as a sequence of non space characters
ex) the sky is blue -> blue is sky the
*/
public class ReverseWords{
public static void main(String[] args){
String str = "the sky is blue and sometimes is red";
String reverseStr = reverse(str);
System.out.println(str);
System.out.println(reverseStr);
}
/**
* Split the words by empty space and reverse append
*/
public static String reverse(String str){
String[] strArr = str.split(" ");
String reversed = "";
for(int i = strArr.length-1; i >= 0; i--){
if(i != 0){
reversed = reversed + strArr[i] + " ";
}else{
reversed = reversed + strArr[i];
}
}
return reversed;
}
} | [
"[email protected]"
] | |
1b914bb29552c69b2368065fca2ae541b4377041 | 3aff018554883e2def5ef477deb66cfcc7ff8d9a | /app/src/main/java/com/example/tutorial/GameObject.java | f70e0e3aff78058fba5eacf5ec2d8621ce56d438 | [] | no_license | LBWNB2020/GAME | 373682249779ac8bc6f28a75e90ba6c83014d983 | f60d19e8fc96033e02de6d3b2f63ffce7438b9a6 | refs/heads/master | 2022-11-12T21:06:52.684492 | 2020-06-30T05:32:46 | 2020-06-30T05:32:46 | 276,001,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package com.example.tutorial;
import android.graphics.Canvas;
public interface GameObject {
public void draw(Canvas canvas);
public void update();
}
| [
"[email protected]"
] | |
6d25d088b11b47f54fbff4d17bb0a308d611b261 | 55060cb3471b4d00543cde26e0b6f0e3f4cb525a | /src/test/_617mergeTrees.java | 86f870baff2cd21b8c78ba10bca1a9956bbc5f78 | [] | no_license | kuangbo/leetcode | 3fc72ac079ca586bc3f5260b4107a2d9c4d4d8c6 | a912371c27d27e49cb97c8f1149fbf20f0faec70 | refs/heads/main | 2023-04-16T10:28:22.182877 | 2021-04-13T13:23:30 | 2021-04-13T13:23:30 | 313,488,467 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package test;
/**
* Created with IntelliJ IDEA.
* User: kuangbo
* Date: 2020/8/21
* Time: 下午12:27
*/
public class _617mergeTrees {
public TreeNode mergeTrees(TreeNode t1, TreeNode t2) {
if(t1 == null && t2 == null)
return null;
if(t1 == null)
return t2;
if(t2 == null)
return t1;
t1.val = t1.val + t2.val;
t1.left = mergeTrees(t1.left, t2.left);
t1.right = mergeTrees(t1.right, t2.right);
return t1;
}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
}
| [
"[email protected]"
] | |
2d908925c99c6d98558eb732b534e714fcafe2fe | 9794e4557796766971bb365dfd1c5f336ee75351 | /src/main/java/com/jyall/mapper/ProductMapper.java | 8fbecfaa5afd1685d48e4453dd0c2bfa52aaa72f | [] | no_license | wanglinqiao/demo-provider | 8758d4aaa3a7a534587cf56641ae690df5444d97 | 2c8417cb556e3095126433d492094d5831efa3ab | refs/heads/master | 2021-01-13T13:18:06.395319 | 2016-12-02T09:01:15 | 2016-12-02T09:01:15 | 72,634,846 | 0 | 0 | null | 2016-12-02T09:01:15 | 2016-11-02T11:49:49 | Java | UTF-8 | Java | false | false | 503 | java | package com.jyall.mapper;
import com.jyall.mapper.provider.ProductMapperProvider;
import com.jyall.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
/**
* Created by wang.linqiao on 2016/10/31.
*/
@Mapper
public interface ProductMapper {
@SelectProvider(type = ProductMapperProvider.class,method = "getProductList")
public List<Product> getProductList(Map<String, String> param);
}
| [
"[email protected]"
] | |
5220f07c8bd9ef7a00934353761722df3a2eee80 | 7c8896ebd1acab1bcbe3c42f71337be1066e8e34 | /src/main/java/muic/ooc/zork/items/Spinach.java | 720c313d7933cdcea5890ebda12a6ff2d2b54c69 | [] | no_license | thecheesynachos/zork_game | 6cc1ca2e373fd3ab062dccc40fe6017b79164cf7 | 40af522b5d41d3cc679a0b10d985513b35473d4d | refs/heads/master | 2020-05-25T21:10:26.449729 | 2019-05-24T15:56:27 | 2019-05-24T15:56:27 | 187,994,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package muic.ooc.zork.items;
import muic.ooc.zork.gameplay.GameBag;
import muic.ooc.zork.gameplay.Observation;
public class Spinach extends Item {
public Observation use(GameBag gameBag) {
gameBag.getPlayer().incrementMaxHealth();
gameBag.getPlayer().incrementMaxAttack();
gameBag.getPlayer().incrementMaxMana();
gameBag.getPlayer().incrementMana();
gameBag.getPlayer().incrementHealth();
return new Observation("And like Popeye, you are now stronger than before!");
}
public boolean canDeplete() {
return true;
}
}
| [
"[email protected]"
] | |
545d30ec4a25908cecae3e9f6c02ab9c3a618ae5 | 39b05cd987000e95a68f70abe52c23cb73434f02 | /app/src/main/java/com/utsman/moviedb/model/Genre.java | fe3269a2a637c62488a1613f2ee7b24cfe632f86 | [] | no_license | TeknopediaAsia/MovieDb | f1d1eb3cd61541f98ec0e9d6815409a0bc783fe4 | 38fb63ff303bcac44ce14256e443d401ae9ac467 | refs/heads/master | 2020-06-22T19:27:13.149315 | 2019-07-19T14:42:18 | 2019-07-19T14:42:18 | 197,789,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.utsman.moviedb.model;
import com.google.gson.annotations.SerializedName;
public class Genre {
@SerializedName("id")
private Integer id;
@SerializedName("name")
private String name;
public Genre(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
366974d276e86daa033e6100599455635131548a | 5dbaa26cf3ee5c3d035f23466f57b4622f7887e9 | /day3-array/Concatenate.java | 6d895977e1e27cbcec9f49feef61cf73f0c51cc6 | [] | no_license | pssruthy/learnJava | 89a4e8c10d87d517709a9069e0d127fda00a8e3a | dd9012f0b6409b9a689639de5ad799cbb550717c | refs/heads/main | 2023-01-05T11:52:03.125366 | 2020-10-30T20:29:53 | 2020-10-30T20:29:53 | 306,053,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | public class Concatenate {
public static void printArray(int[] array) {
for (int i : array) {
System.out.println(i);
}
}
public static int[] concatenate(int[] array1, int[] array2) {
int[] concatenatedArray = new int[array1.length + array2.length];
for(int index = 0; index < array1.length; index++) {
concatenatedArray[index] = array1[index];
}
for(int index = array1.length; index < concatenatedArray.length; index++) {
concatenatedArray[index] = array2[index - array1.length];
}
return concatenatedArray;
}
public static void main(String[] args) {
int[] array1 = {1, 2, 3, 4};
int[] array2 = {5, 6, 7, 8, 4, 9};
printArray(concatenate(array1, array2));
}
} | [
"[email protected]"
] | |
1e5fadf6ba214ea3d914b3137d6e88da76d71dd1 | 46577474beb29b57604ab2887f56c388f4faa3c0 | /eventPlanner/src/main/java/com/anz/eventplanner/controller/UserController.java | 7d7c03c8558e2afe95662faf181227dc1178d742 | [] | no_license | Amuthalakshmi/eventPlanner | 7e0ec2cc2ab3d61bb75234f60c1d28607613178e | d665f58d1445984ba835ac8bb8c203dc775b2e42 | refs/heads/master | 2021-01-20T04:54:10.806426 | 2017-06-10T05:48:29 | 2017-06-10T05:48:29 | 89,747,139 | 0 | 0 | null | 2017-06-10T05:48:29 | 2017-04-28T21:47:01 | Java | UTF-8 | Java | false | false | 2,578 | java | package com.anz.eventplanner.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.anz.eventplanner.model.Event;
import com.anz.eventplanner.model.EventManager;
import com.anz.eventplanner.model.EventOrganiser;
import com.anz.eventplanner.model.Participant;
import com.anz.eventplanner.model.User;
import com.anz.eventplanner.service.EventManagerService;
import com.anz.eventplanner.service.EventOrganiserService;
import com.anz.eventplanner.service.EventService;
import com.anz.eventplanner.service.ParticipantService;
@Controller
public class UserController {
@Autowired
MessageSource messageSource;
User user = new User();
@Autowired
EventService eventService;
@Autowired
EventManagerService eventManagerService;
@Autowired
EventOrganiserService eventOrganiserService;
@Autowired
ParticipantService participantService;
public UserController() {
user.setLANId("USR1WLG");
}
@RequestMapping(value = { "/" }, method = RequestMethod.GET)
public String homepage(ModelMap model) {
String LANId = user.getLANId();
model.addAttribute("isEventManager", isEventManager(LANId));
if (isEventOrganiser(LANId)){
EventOrganiser eventOrganiser = eventOrganiserService.findByLANId(LANId);
model.addAttribute("isEventOrganiser", isEventOrganiser(LANId));
model.addAttribute("eventOrganiserId", eventOrganiser.getEventOrganiserId());
}
List<Participant> participation = participantService.findAllParticipantByLANId(LANId);
model.addAttribute("participation", participation);
List<Event> events = eventService.findAllEventByStatus("Initiated");
for(Participant p:participation){
if(events.contains(p.getEvent())){
events.remove(p.getEvent());
}
}
model.addAttribute("events", events);
return "home";
}
public boolean isEventManager(String LANId) {
EventManager eventManager = eventManagerService.findByLANId(LANId);
if (eventManager == null) {
return false;
}
return true;
}
public boolean isEventOrganiser(String LANId) {
EventOrganiser eventOrganiser = eventOrganiserService.findByLANId(LANId);
if (eventOrganiser == null) {
return false;
}
return true;
}
} | [
"[email protected]"
] | |
9582fbedf8f06d23cb24a463c11aeaaf441ed4fa | 653a0b15c48a5c12e8b6a841aacec1815384fdf8 | /src/main/java/com/wang/bean/Red.java | 928e3dfa55d9b781e794e17c3c3ac55b31271af7 | [] | no_license | SillyBoy007/spring-annotation | fe5eadb3d04c0a00a996cd657d99101eaad3465d | 1c467c0f09b5123f6fb099f38140f3cc6aa09761 | refs/heads/master | 2020-04-13T18:36:16.541103 | 2019-03-13T05:14:18 | 2019-03-13T05:14:18 | 163,379,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45 | java | package com.wang.bean;
public class Red {
}
| [
"[email protected]"
] | |
8f4fac14fa1f7077df8aae4adf403ba4f7773ae5 | 94e1a8cd679491c0d6b923f3164c151eb525fd44 | /app/src/main/java/roomies/com/roomies/controllers/secondactivity/lists/edit/EditListFragment.java | 080d81259053381e0c8e6997ad8acac4929e707f | [] | no_license | AlixAmoureux/Roomies-Android | 6ff6470760efb769dfb90ee27325d624538a6359 | d51b526bf6072d83661e9d65ebcb8b72dacfbddc | refs/heads/master | 2021-06-10T18:05:45.628942 | 2017-02-22T16:32:27 | 2017-02-22T16:32:27 | 79,747,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,529 | java | package roomies.com.roomies.controllers.secondactivity.lists.edit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import roomies.com.roomies.R;
import roomies.com.roomies.controllers.ManageObjects;
import roomies.com.roomies.controllers.secondactivity.lists.display.ManageListsFragment;
import roomies.com.roomies.models.lists.ListsItemsInfos;
public class EditListFragment extends Fragment {
private TextView mListName;
private ListView mListView;
private Button mEditList;
private Button mRemoveList;
private List<ListsItemsInfos> mListItems;
private TextView mMessage;
private String mListNameVal;
private String mToken;
private String mColocId;
private String mListId;
private EditListAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("EditListFragment", "onCreate !");
mListItems = new ArrayList<>();
mAdapter = new EditListAdapter();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_edit_list, container, false);
mListView = (ListView) v.findViewById(R.id.listview_edit_listitems);
mEditList = (Button) v.findViewById(R.id.edit_list_button);
mRemoveList = (Button) v.findViewById(R.id.remove_list_button);
mListName = (TextView) v.findViewById(R.id.list_name);
mMessage = (TextView) v.findViewById(R.id.edit_list_message);
return (v);
}
@Override
public void onResume() {
super.onResume();
Log.e("EditListFragment", "onResume !");
mMessage.setVisibility(View.INVISIBLE);
mColocId = ManageObjects.readColocInfosInPrefs("colocInfos", getActivity()).id;
mToken = ManageObjects.readUserInfosInPrefs("userInfos", getActivity()).token;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
mListId = prefs.getString("listId", "");
getActivity().setTitle("Manage your list");
mListItems.clear();
getListItems();
mEditList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
updateListItems();
}
});
mRemoveList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
deleteList();
}
});
}
private void deleteList() {
// HTTP DELETE
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId;
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
JSONObject object = new JSONObject();
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, url, object,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(getContext(), "The list has been removed", Toast.LENGTH_LONG).show();
Fragment newFragment = new ManageListsFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.container, newFragment);
transaction.addToBackStack(null);
transaction.commit();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Remove List", error.getMessage());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonObjectRequest);
}
private void getListItems() {
// HTTP GET
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId + "/items";
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
try {
StringRequest jsonobject = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray lists = new JSONArray(response);
for (int i = 0; i < lists.length(); i++) {
JSONObject item = lists.getJSONObject(i);
boolean done = item.getBoolean("done");
String title = item.getString("title");
String id = item.getString("id");
ListsItemsInfos tmpList = new ListsItemsInfos();
tmpList.setTitle(title);
tmpList.setDone(done);
tmpList.setId(id);
mListItems.add(tmpList);
}
mAdapter.setLists(mListItems);
mListView.setAdapter(mAdapter);
} catch (JSONException e) {
Log.e("ManageListFragment", e.getMessage());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "Application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonobject);
} catch (Exception e) {
e.printStackTrace();
}
}
private void updateListItems() {
mMessage.setVisibility(View.VISIBLE);
for (int i = 0; i < mListItems.size(); i++) {
updateItem(mListItems.get(i));
}
//mMessage.setText("The list has been updated");
//mMessage.setTextColor(getResources().getColor(R.color.messageSuccess));
Toast.makeText(getContext(), "The list has been updated", Toast.LENGTH_LONG).show();
Fragment newFragment = new ManageListsFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.container, newFragment);
transaction.addToBackStack(null);
transaction.commit();
}
private void updateItem(ListsItemsInfos item) {
// HTTP PUT
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId + "/items/" + item.getId();
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("title", item.getTitle());
jsonObject.put("done", item.isDone());
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, url, jsonObject,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("EditListFragment", "SUCCESS");
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Update Profile", error.getMessage());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonObjectRequest);
}
}
| [
"[email protected]"
] | |
e8ef82a8bd15642b9033784c35e60dc39bcb94e7 | 67cae444096bdc9d110c7bf2170e965fc963e527 | /WBHGEF_Palette/src/wbhgef/Perspective.java | b03209e53904621a786a47d52b057bfa973920d0 | [] | no_license | Jevinliu/GEF-Demo | 0b4110dfd74a0d04802ec9999c2dae60a8a26d78 | 7c7972370ea2db8ccb368c1539de3817680b1131 | refs/heads/master | 2021-05-04T10:02:31.447357 | 2016-12-14T02:25:54 | 2016-12-14T02:25:54 | 52,586,163 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package wbhgef;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
private static final String ID_TABS_FOLDER = "PropertySheet";
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(true);
IFolderLayout tabs = layout.createFolder(ID_TABS_FOLDER,
IPageLayout.LEFT, 0.3f, editorArea);
tabs.addView(IPageLayout.ID_OUTLINE);
tabs.addPlaceholder(IPageLayout.ID_PROP_SHEET);
}
}
| [
"[email protected]"
] | |
6fce2a6a7faf06a6a6e81cb3e66613c83a2d36c4 | 5df6e828df86c74c88b8ff686dd2e78fc14519a9 | /iDrive/src/com/ccpress/izijia/util/GDLocationUtil.java | ffef8dda240e4c794afdb15e3dc927a679440cc1 | [] | no_license | dmz1024/IDrive | 366d317e348ee73453bec08fff6f141ef7ae5986 | abc8c2853a7a385eb967b7a37df1d3d1225ec53d | refs/heads/master | 2020-12-25T14:39:05.753920 | 2016-06-22T02:31:05 | 2016-06-22T02:31:05 | 61,682,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,962 | java | package com.ccpress.izijia.util;
import android.content.Context;
import android.content.SharedPreferences;
import com.amap.api.location.AMapLocation;
import com.ccpress.izijia.Constant;
import com.ccpress.izijia.entity.CityEntity;
/**
* Created by Wu Jingyu
* Date: 2015/9/8
* Time: 10:27
*/
public class GDLocationUtil {
public static void setGDGpsLocation(Context ctx, AMapLocation location){
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_GPS_CITY_CODE, location.getCityCode());
editor.putString(Constant.GD_SP_LOCATION_GPS_CITY, location.getCity());
editor.putString(Constant.GD_SP_LOCATION_GPS_PROVINCE, location.getProvince());
editor.commit();
}
}
public static String getGDGpsCityCode(Context ctx) {
String cityCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
cityCode = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY_CODE,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE_DEFAULT);
}
return cityCode;
}
public static String getGDGpsCity(Context ctx){
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_DEFAULT);
}
return city;
}
public static String getGDGCity(Context ctx){
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_DEFAULT);
}
return city;
}
public static String getGDGpsProvince(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_PROVINCE,
Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_DEFAULT);
}
return province;
}
public static String getGDGpsProvinceCode(Context ctx) {
String provinceCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
provinceCode = sharedPref.getString(Constant.SP_LOCATION_GPS_PROVINCE_CODE,
Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE_DEFAULT);
}
return provinceCode;
}
public static void setGDCurrentLocation(Context ctx, CityEntity entity) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, entity.getCode());
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, entity.getName());
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, entity.getProvince());
editor.commit();
}
}
public static void setGDCurrentSetCity(Context ctx, String city) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, city);
editor.commit();
}
}
public static void setGDCurrentSetCityCode(Context ctx, String cityCode) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, cityCode);
editor.commit();
}
}
public static void setGDCurrentSetProvince(Context ctx, String province) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, province);
editor.commit();
}
}
public static void setGDCurrentSetProvinceCode(Context ctx, String provinceCode) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE, provinceCode);
editor.commit();
}
}
public static String getGDCurrentSetCityCode(Context ctx) {
String cityCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
cityCode = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE,
"");
}
return cityCode;
}
public static String getGDCurrentSetCity(Context ctx) {
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY,
"");
}
return city;
}
public static String getGDCurrentSetProvince(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE,
"");
}
return province;
}
public static String getGDCurrentSetProvinceCode(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE,
"");
}
return province;
}
public static void clearGDCurrentLocation(Context ctx) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE, "");
editor.commit();
}
}
public static String getGDProvinceCode(Context ctx) {
String provinceCode = "";
String provinceCode_sp = GDLocationUtil.getGDCurrentSetProvinceCode(ctx);
if(provinceCode_sp.equals("")){
provinceCode = GDLocationUtil.getGDGpsProvinceCode(ctx);
} else {
provinceCode = provinceCode_sp;
}
return provinceCode;
}
public static String getGDProvince(Context ctx) {
String province = "";
String province_sp = GDLocationUtil.getGDCurrentSetProvince(ctx);
if(province_sp.equals("")){
province = GDLocationUtil.getGDGpsProvince(ctx);
} else {
province = province_sp;
}
return province;
}
public static String getGDCityCode(Context ctx) {
String cityCode = "";
String cityCode_sp = GDLocationUtil.getGDCurrentSetCityCode(ctx);
if(cityCode_sp.equals("")){
cityCode = GDLocationUtil.getGDGpsCityCode(ctx);
} else {
cityCode = cityCode_sp;
}
return cityCode;
}
public static String getGDCity(Context ctx) {
String city = "";
String city_sp = GDLocationUtil.getGDCurrentSetCity(ctx);
if(city_sp.equals("")){
city = GDLocationUtil.getGDGpsCity(ctx);
} else {
city = city_sp;
}
return city;
}
}
| [
"[email protected]"
] | |
6eb6241244dbfda80afe984b66e27ca035e871a3 | 49009bfd3531fc9b326931f5f4f598840e2fa5ec | /app/src/main/java/cn/bsd/learn/transfer/files/utils/Utils.java | 5eccfa9e8191e9dcf1f097ba1298ccf53a185bd5 | [] | no_license | ApeCold/Learn_Transfer_Files | 04e08434d1b8be64a1d6f42c8e3a964a19db0f81 | 513c4401b6d7ddabbbbab27c7ab82da5dfed37be | refs/heads/master | 2020-05-27T05:58:21.042622 | 2019-05-25T02:26:06 | 2019-05-25T02:26:06 | 188,511,138 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package cn.bsd.learn.transfer.files.utils;
import com.netease.async.library.EventBus;
import com.netease.async.library.util.Constants;
import java.io.File;
import java.text.DecimalFormat;
public class Utils {
// 获取文件大小
public static String getFileSize(long length) {
DecimalFormat df = new DecimalFormat("######0.00");
double d1 = 3.23456;
double d2 = 0.0;
double d3 = 2.0;
df.format(d1);
df.format(d2);
df.format(d3);
long l = length / 1000;//KB
if (l < 1024) {
return df.format(l) + "KB";
} else if (l < 1024 * 1024.f) {
return df.format((l / 1024.f)) + "MB";
}
return df.format(l / 1024.f / 1024.f) + "GB";
}
// 删除所有文件
public static void deleteAll() {
File dir = Constants.DIR;
if (dir.exists() && dir.isDirectory()) {
File[] fileNames = dir.listFiles();
if (fileNames != null) {
for (File fileName : fileNames) {
fileName.delete();
}
}
}
EventBus.getDefault().post(Constants.RxBusEventType.LOAD_BOOK_LIST);
}
// 获取文件名
public static String getFileName(String pathandname) {
int start = pathandname.lastIndexOf("/");
int end = pathandname.lastIndexOf(".");
if (start != -1 && end != -1) {
return pathandname.substring(start + 1, end);
} else {
return null;
}
}
}
| [
"[email protected]"
] | |
34ed07d42150ad4cc31c677a8e7b32262ca1d33d | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/MATH-49b-3-17-Single_Objective_GGA-IntegrationSingleObjective-/org/apache/commons/math/linear/OpenMapRealVector_ESTest.java | 31fd48b76569e49c6a1d5d759170f7ce249d62ad | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,725 | java | /*
* This file was automatically generated by EvoSuite
* Mon May 18 02:42:33 UTC 2020
*/
package org.apache.commons.math.linear;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math.linear.OpenMapRealVector;
import org.apache.commons.math.linear.RealVector;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class OpenMapRealVector_ESTest extends OpenMapRealVector_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
Double[] doubleArray0 = new Double[3];
Double double0 = new Double(0.6299605249474366);
doubleArray0[0] = double0;
Double double1 = new Double(0.6299605249474366);
doubleArray0[1] = double1;
Double double2 = new Double(0.6299605249474366);
doubleArray0[2] = double2;
OpenMapRealVector openMapRealVector0 = new OpenMapRealVector(doubleArray0, (double) doubleArray0[1]);
openMapRealVector0.getDimension();
RealVector realVector0 = openMapRealVector0.mapDivideToSelf((double) doubleArray0[0]);
Double double3 = new Double(0.6299605249474366);
Double double4 = new Double(0.0);
Double double5 = new Double((double) doubleArray0[1]);
OpenMapRealVector openMapRealVector1 = new OpenMapRealVector(doubleArray0, (double) doubleArray0[0]);
realVector0.getDimension();
RealVector realVector1 = openMapRealVector0.mapDivideToSelf(185.043344952252);
// Undeclared exception!
openMapRealVector1.ebeMultiply(realVector1);
}
}
| [
"[email protected]"
] | |
7fd46490fdccb4f71dcf24988639b031ff2f5225 | bfdc2e4e6a1f329ea5fc0a5836744ed5ac6d0d2e | /jaql/src/main/java/com/bordereast/jaql/JAQL.java | b5e17341736467eeabb1c2fba41150bd5659f969 | [] | no_license | bordereast/jaql | edb1acde27a75bb82534122bd08a3ed1d7e16b46 | 99ffca171777590ddb4cfde614e37be69da18c91 | refs/heads/master | 2021-01-20T06:35:48.884267 | 2017-08-26T19:55:41 | 2017-08-26T19:55:41 | 101,509,551 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,998 | java | package com.bordereast.jaql;
import com.bordereast.jaql.arango.Keyword;
import com.bordereast.jaql.arango.Logical;
import com.bordereast.jaql.arango.Operator;
import java.util.Map;
import java.util.Optional;
import com.bordereast.jaql.arango.Filter;
import com.bordereast.jaql.arango.For;
import com.bordereast.jaql.arango.ReturnEntity;
import com.bordereast.jaql.arango.ReturnProperty;
public final class JAQL {
private JAQLCollections lists;
private String[] aliases = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","aa","bb","cc","dd","ee","ff","gg","hh","ii","jj","kk","ll","mm","nn","oo","pp","qq","rr","ss","tt","uu","vv","ww","xx","yy","zz"};
private int index = -1;
public JAQL() {
lists = new JAQLCollections();
}
public JAQL(int aliasIndex) {
super();
lists = new JAQLCollections();
index = aliasIndex;
}
public Map<String, Object> bindVars() {
return lists.paramList;
}
public <T extends Object> JAQL forEntity(T entity) {
lists.put(Keyword.FOR, new For<T>(entity, aliases[++index]));
lists.entityList.put(entity.getClass().getSimpleName(), entity);
return this;
}
public JAQL forCollection(String collection) {
lists.put(Keyword.FOR, new For(collection, aliases[++index]));
return this;
}
public <T extends Object> JAQL returnEntity(T entity) throws NoSuchFieldException, SecurityException {
for(Pair p : lists.queryList) {
if(p.getKey().equals(Keyword.FOR)) {
For f = (For)p.getValue();
if(f.entity.getClass().getSimpleName().equals(entity.getClass().getSimpleName())) {
lists.put(Keyword.RETURN, new ReturnEntity(entity, f));
break;
}
}
}
return this;
}
public JAQL returnProperty(String alias, String property) {
lists.put(Keyword.RETURN, new ReturnProperty(alias, property));
return this;
}
public JAQL withParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return this;
}
public String addParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return "@" + parameter;
}
public String addCollectionParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return "@@" + parameter;
}
public JAQL filter(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.BLANK, left, operator, right));
return this;
}
public JAQL filter(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.BLANK, left, operatorA, operatorB, right));
return this;
}
public JAQL and(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.AND, left, operator, right));
return this;
}
public JAQL and(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.AND, left, operatorA, operatorB, right));
return this;
}
public JAQL or(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.OR, left, operator, right));
return this;
}
public JAQL or(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.OR, left, operatorA, operatorB, right));
return this;
}
public JAQL not(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.NOT, left, operator, right));
return this;
}
public JAQL not(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.NOT, left, operatorA, operatorB, right));
return this;
}
public JAQL logical(Logical logical) {
lists.put(Keyword.LOGICAL, logical);
return this;
}
public JAQL keyword(Keyword keyword) {
lists.put(keyword, null);
return this;
}
public String currentAlias() {
return aliases[index];
}
public String build() throws InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException {
return new JAQLBuilder(lists, aliases, index).build().replaceAll(" {2,}", " ");
}
} | [
"[email protected]"
] | |
849fa88a038ce667d3ed57a04a1ab3af3498ad27 | 70d1d5547ba3faf5347f247ab3dbf7db62cd04a3 | /pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/DockerLabelStepTest.java | a602ed72eefdc0084eaec83a1844c7dfe0c21614 | [] | no_license | cloudbeers/pipeline-model-definition-plugin | c29b48ce0b75fad82653475286f92df1cc1ba84e | d646f0a758f7187c9808fb76d4091482942d848b | refs/heads/master | 2020-12-24T12:01:37.026433 | 2016-11-04T23:24:21 | 2016-11-04T23:24:21 | 73,097,623 | 0 | 2 | null | 2016-11-07T16:21:07 | 2016-11-07T16:21:06 | null | UTF-8 | Java | false | false | 5,381 | java | /*
* The MIT License
*
* Copyright (c) 2016, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
package org.jenkinsci.plugins.pipeline.modeldefinition.steps;
import com.cloudbees.hudson.plugins.folder.Folder;
import hudson.ExtensionList;
import hudson.model.Slave;
import org.jenkinsci.plugins.pipeline.modeldefinition.AbstractModelDefTest;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.DockerLabelProvider;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.GlobalConfig;
import org.junit.Test;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertThat;
/**
* Tests {@link DockerLabelStep}.
*
* And related configurations like {@link DockerLabelProvider}.
*/
public class DockerLabelStepTest extends AbstractModelDefTest {
@Test
public void plainSystemConfig() throws Exception {
GlobalConfig.get().setDockerLabel("config_docker");
expect("dockerLabel").logContains("Docker Label is: config_docker").go();
}
@Test
public void testExtensionOrdinal() {
ExtensionList<DockerLabelProvider> all = DockerLabelProvider.all();
assertThat(all, hasSize(2));
assertThat(all.get(0), instanceOf(FolderConfig.FolderDockerLabelProvider.class));
assertThat(all.get(1), instanceOf(GlobalConfig.GlobalConfigDockerLabelProvider.class));
}
@Test
public void directParent() throws Exception {
Folder folder = j.createProject(Folder.class);
folder.addProperty(new FolderConfig("folder_docker"));
expect("dockerLabel").inFolder(folder).runFromRepo(false).logContains("Docker Label is: folder_docker").go();
}
@Test
public void directParentNotSystem() throws Exception {
GlobalConfig.get().setDockerLabel("config_docker");
Folder folder = j.createProject(Folder.class);
folder.addProperty(new FolderConfig("folder_docker"));
expect("dockerLabel").inFolder(folder).runFromRepo(false)
.logContains("Docker Label is: folder_docker").logNotContains("config_docker").go();
}
@Test
public void grandParent() throws Exception {
Folder grandParent = j.createProject(Folder.class);
grandParent.addProperty(new FolderConfig("parent_docker"));
Folder parent = grandParent.createProject(Folder.class, "testParent"); //Can be static since grandParent should be unique
expect("dockerLabel").inFolder(parent).runFromRepo(false).logContains("Docker Label is: parent_docker").go();
}
@Test
public void grandParentOverride() throws Exception {
Folder grandParent = j.createProject(Folder.class);
grandParent.addProperty(new FolderConfig("grand_parent_docker"));
Folder parent = grandParent.createProject(Folder.class, "testParent"); //Can be static since grandParent should be unique
parent.addProperty(new FolderConfig("parent_docker"));
expect("dockerLabel").inFolder(parent).runFromRepo(false)
.logContains("Docker Label is: parent_docker")
.logNotContains("grand_parent_docker").go();
}
@Test
public void runsOnCorrectSlave() throws Exception {
assumeDocker();
Slave s = j.createOnlineSlave();
s.setLabelString("notthis");
env(s).put("DOCKER_INDICATOR", "WRONG").set();
s = j.createOnlineSlave();
s.setLabelString("thisone");
env(s).put("DOCKER_INDICATOR", "CORRECT").set();
GlobalConfig.get().setDockerLabel("thisone");
expect("agentDockerEnvTest").runFromRepo(false).logContains("Running on assumed Docker agent").go();
}
@Test
public void runsOnSpecifiedSlave() throws Exception {
assumeDocker();
Slave s = j.createOnlineSlave();
s.setLabelString("thisspec");
env(s).put("DOCKER_INDICATOR", "SPECIFIED").set();
s = j.createOnlineSlave();
s.setLabelString("thisone");
env(s).put("DOCKER_INDICATOR", "CORRECT").set();
GlobalConfig.get().setDockerLabel("thisone");
expect("agentDockerEnvSpecLabel").runFromRepo(false).logContains("Running on assumed Docker agent").go();
}
} | [
"[email protected]"
] | |
ed23ae7abff8e20f14aa7345ad588d3be6d06a58 | 096e59da5277993ea596bba4a23b5a1799fe8458 | /BloodBankSystem/src/main/java/org/hcl/Config/AppContext.java | 4a34d7136d784c99fceaee7af23d10884307108c | [] | no_license | sarumathy98/SarumathyM | adf7fbdec7b36c38a0d27ddc8ef153351b590d3b | 3ea4d905c7ddeb6c36153c513b06ed27f8b742cf | refs/heads/main | 2023-01-05T20:53:36.188791 | 2020-10-27T12:11:29 | 2020-10-27T12:11:29 | 307,687,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,342 | java | package org.hcl.Config;
import java.util.Properties;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@PropertySource("classpath:database.properties")
@EnableTransactionManagement
public class AppContext {
@Autowired
Environment environment;
@Bean
public DataSource getDataSource()
{
DriverManagerDataSource datasource= new DriverManagerDataSource();
datasource.setDriverClassName(environment.getProperty("jdbc.driverClassName"));
datasource.setUrl(environment.getProperty("jdbc.url"));
datasource.setUsername(environment.getProperty("jdbc.user"));
datasource.setPassword(environment.getProperty("jdbc.password"));
return datasource;
}
public Properties getProperties()
{
Properties properties= new Properties();
properties.setProperty("hibernate.dialect",environment.getProperty("hibernate.dialect"));
properties.setProperty("hibernate.show_sql", environment.getProperty("hibernate.show_sql"));
properties.setProperty("hibernate.format_sql", environment.getProperty("hibernate.format_sql"));
properties.setProperty("hibernate.hbm2ddl.auto", environment.getProperty("hibernate.hbm2ddl.auto"));
return properties;
}
@Bean
public LocalSessionFactoryBean getFactoryBean()
{
LocalSessionFactoryBean factory = new LocalSessionFactoryBean();
factory.setDataSource(getDataSource());
factory.setHibernateProperties(getProperties());
factory.setPackagesToScan("org.hcl.entities");
return factory;
}
@Bean
public HibernateTransactionManager getTransaction()
{
HibernateTransactionManager tx= new HibernateTransactionManager();
tx.setSessionFactory(getFactoryBean().getObject());
return tx;
}
}
| [
"[email protected]"
] | |
d7074a55a17d9f9cb665bf70e834045b8b2b664a | f3d2df2f2aff927bad0b6bae713fc93dcbba052c | /src/me/daddychurchill/CityWorld/Support/SupportChunk.java | ed8eb6f300673589dbab4fc29b5e8773a63592e8 | [] | no_license | lazareth241/CityWorld | dbbb8f709d3df905138c5f58db41339edffeb70b | 9112f4fb1f50ff30b18bb09c38dced3975038dda | refs/heads/master | 2021-01-16T20:42:59.610649 | 2013-05-24T16:49:45 | 2013-05-24T16:49:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,698 | java | package me.daddychurchill.CityWorld.Support;
import me.daddychurchill.CityWorld.WorldGenerator;
import org.bukkit.Material;
import org.bukkit.World;
public abstract class SupportChunk {
public World world;
public int chunkX;
public int chunkZ;
public int worldX;
public int worldZ;
public int width;
public int height;
// private byte[] ores;
public static final int chunksBlockWidth = 16;
public static final int sectionsPerChunk = 16;
public static final byte airId = (byte) Material.AIR.getId();
public static final byte stoneId = (byte) Material.STONE.getId();
public static final byte ironId = (byte) Material.IRON_ORE.getId();
public static final byte goldId = (byte) Material.GOLD_ORE.getId();
public static final byte lapisId = (byte) Material.LAPIS_ORE.getId();
public static final byte redstoneId = (byte) Material.REDSTONE_ORE.getId();
public static final byte diamondId = (byte) Material.DIAMOND_ORE.getId();
public static final byte coalId = (byte) Material.COAL_ORE.getId();
public static final byte dirtId = (byte) Material.DIRT.getId();
public static final byte grassId = (byte) Material.GRASS.getId();
public static final byte stepId = (byte) Material.STEP.getId();
public static final byte snowId = (byte) Material.SNOW.getId();
public static final byte iceId = (byte) Material.ICE.getId(); // the fluid type
public static final byte waterId = (byte) Material.WATER.getId(); // the fluid type
public static final byte lavaId = (byte) Material.LAVA.getId(); // the fluid type
public static final byte stillWaterId = (byte) Material.STATIONARY_WATER.getId(); // the fluid type
public static final byte stillLavaId = (byte) Material.STATIONARY_LAVA.getId(); // the fluid type
public SupportChunk(WorldGenerator generator) {
super();
world = generator.getWorld();
width = chunksBlockWidth;
height = generator.height;
}
public static int getBlockX(int chunkX, int x) {
return chunkX * chunksBlockWidth + x;
}
public static int getBlockZ(int chunkZ, int z) {
return chunkZ * chunksBlockWidth + z;
}
public final int getBlockX(int x) {
return getOriginX() + x;
}
public final int getBlockZ(int z) {
return getOriginZ() + z;
}
public final int getOriginX() {
return chunkX * width;
}
public final int getOriginZ() {
return chunkZ * width;
}
public abstract int getBlockType(int x, int y, int z);
public abstract void setBlock(int x, int y, int z, byte materialId);
public abstract void setBlocks(int x1, int x2, int y, int z1, int z2, byte materialId);
public abstract void setBlocks(int x, int y1, int y2, int z, byte materialId);
public abstract void clearBlock(int x, int y, int z);
public abstract void clearBlocks(int x, int y1, int y2, int z);
public abstract void clearBlocks(int x1, int x2, int y1, int y2, int z1, int z2);
public final boolean isType(int x, int y, int z, int type) {
return getBlockType(x, y, z) == type;
}
public final boolean isType(int x, int y, int z, Material material) {
return getBlockType(x, y, z) == material.getId();
}
public final boolean isOfTypes(int x, int y, int z, Material ... types) {
int type = getBlockType(x, y, z);
for (Material test : types)
if (type == test.getId())
return true;
return false;
}
public final boolean isOfTypes(int x, int y, int z, int ... types) {
int type = getBlockType(x, y, z);
for (int test : types)
if (type == test)
return true;
return false;
}
public final boolean isEmpty(int x, int y, int z) {
return getBlockType(x, y, z) == airId;
}
public final boolean isPlantable(int x, int y, int z) {
return getBlockType(x, y, z) == grassId;
}
public final boolean isWater(int x, int y, int z) {
return isOfTypes(x, y, z, stillWaterId, waterId);
}
public final boolean isLava(int x, int y, int z) {
return isOfTypes(x, y, z, stillLavaId, lavaId);
}
public final boolean isLiquid(int x, int y, int z) {
return isOfTypes(x, y, z, stillWaterId, stillLavaId, waterId, lavaId, iceId);
}
public final boolean isSurroundedByEmpty(int x, int y, int z) {
return (x > 0 && x < 15 && z > 0 && z < 15) &&
(isEmpty(x - 1, y, z) &&
isEmpty(x + 1, y, z) &&
isEmpty(x, y, z - 1) &&
isEmpty(x, y, z + 1));
}
public final boolean isSurroundedByWater(int x, int y, int z) {
return (x > 0 && x < 15 && z > 0 && z < 15) &&
(isWater(x - 1, y, z) ||
isWater(x + 1, y, z) ||
isWater(x, y, z - 1) ||
isWater(x, y, z + 1));
}
public final void setBlocks(int x, int y1, int y2, int z, byte primaryId, byte secondaryId, MaterialFactory maker) {
maker.placeMaterial(this, primaryId, secondaryId, x, y1, y2, z);
}
public final void setBlocks(int x1, int x2, int y1, int y2, int z1, int z2, byte primaryId, byte secondaryId, MaterialFactory maker) {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
setBlocks(x, y1, y2, z, primaryId, secondaryId, maker);
}
}
}
private void drawCircleBlocks(int cx, int cz, int x, int z, int y, byte materialId) {
// Ref: Notes/BCircle.PDF
setBlock(cx + x, y, cz + z, materialId); // point in octant 1
setBlock(cx + z, y, cz + x, materialId); // point in octant 2
setBlock(cx - z - 1, y, cz + x, materialId); // point in octant 3
setBlock(cx - x - 1, y, cz + z, materialId); // point in octant 4
setBlock(cx - x - 1, y, cz - z - 1, materialId); // point in octant 5
setBlock(cx - z - 1, y, cz - x - 1, materialId); // point in octant 6
setBlock(cx + z, y, cz - x - 1, materialId); // point in octant 7
setBlock(cx + x, y, cz - z - 1, materialId); // point in octant 8
}
private void drawCircleBlocks(int cx, int cz, int x, int z, int y1, int y2, byte materialId) {
for (int y = y1; y < y2; y++) {
drawCircleBlocks(cx, cz, x, z, y, materialId);
}
}
private void fillCircleBlocks(int cx, int cz, int x, int z, int y, byte materialId) {
// Ref: Notes/BCircle.PDF
setBlocks(cx - x - 1, cx - x, y, cz - z - 1, cz + z + 1, materialId); // point in octant 5
setBlocks(cx - z - 1, cx - z, y, cz - x - 1, cz + x + 1, materialId); // point in octant 6
setBlocks(cx + z, cx + z + 1, y, cz - x - 1, cz + x + 1, materialId); // point in octant 7
setBlocks(cx + x, cx + x + 1, y, cz - z - 1, cz + z + 1, materialId); // point in octant 8
}
private void fillCircleBlocks(int cx, int cz, int x, int z, int y1, int y2, byte materialId) {
for (int y = y1; y < y2; y++) {
fillCircleBlocks(cx, cz, x, z, y, materialId);
}
}
public final void setCircle(int cx, int cz, int r, int y, byte materialId, boolean fill) {
setCircle(cx, cz, r, y, y + 1, materialId, fill);
}
public final void setCircle(int cx, int cz, int r, int y1, int y2, byte materialId, boolean fill) {
// Ref: Notes/BCircle.PDF
int x = r;
int z = 0;
int xChange = 1 - 2 * r;
int zChange = 1;
int rError = 0;
while (x >= z) {
if (fill)
fillCircleBlocks(cx, cz, x, z, y1, y2, materialId);
else
drawCircleBlocks(cx, cz, x, z, y1, y2, materialId);
z++;
rError += zChange;
zChange += 2;
if (2 * rError + xChange > 0) {
x--;
rError += xChange;
xChange += 2;
}
}
}
public final void setSphere(int cx, int cy, int cz, int r, byte materialId, boolean fill) {
for (int r1 = 1; r1 < r; r1++) {
setCircle(cx, cz, r - r1, cy + r1, materialId, fill);
setCircle(cx, cz, r - r1, cy - r1, materialId, fill);
}
setCircle(cx, cz, r, cy, materialId, fill);
}
}
| [
"[email protected]"
] | |
69745b4e053f7823cde53f4c4a04449a36b67ed4 | 1a7c86c16e74a67db230e9eadf5239384cdb8d00 | /src/main/java/app/constant/UserRegistreationConstants.java | 4e61d42f46d1f12938d9e6fab479d8931c37aa59 | [] | no_license | tech-zinfinity/mumbanksocialapp | 4ed1fe48f5e011c2bfee7911ac53aafe9a6d7d23 | 21d10ea4d6286c8ad68c7028f2ff18f32ae2ba53 | refs/heads/master | 2023-06-30T13:55:28.066761 | 2021-01-10T17:55:20 | 2021-01-10T17:55:20 | 216,885,906 | 0 | 0 | null | 2023-06-14T22:31:46 | 2019-10-22T18:45:14 | Java | UTF-8 | Java | false | false | 72 | java | package app.constant;
public interface UserRegistreationConstants {
}
| [
"[email protected]"
] | |
ccac2b0df261e84b4cf6ab553e5afea06a66e54f | 680aff4a8cb4c1a933fc6ab4e2fc4291d09ca0b5 | /blankApp-jar/src/main/java/org/silverpeas/components/blankApp/blankStuff/BlankStuffService.java | 30e88a109216dd903027eb1144a2e910a1050538 | [] | no_license | ndup0nt/archetype-sandbox | 00987b92459a6ca4a19db2cee96ee81905c86eee | 5d5b0b03e4baad6914c9bf55479b19bb83af588d | refs/heads/master | 2021-01-18T18:32:17.179830 | 2012-10-30T14:47:14 | 2012-10-30T14:47:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java | /**
* Copyright (C) 2000 - 2012 Silverpeas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* As a special exception to the terms and conditions of version 3.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* Open Source Software ("FLOSS") applications as described in Silverpeas's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.silverpeas.components.blankApp.blankStuff;
import java.util.List;
public interface BlankStuffService {
BlankStuff createNewBlankStuff(BlankStuff blankStuff);
List<BlankStuff> getAllBlankStuffs();
}
| [
"[email protected]"
] | |
a160e48adafd625ce8e6e0f97b7c907c7b58b525 | 004c1c68ab5933be098633eacc158f1b45a1aad1 | /src/main/java/com/gmail/socraticphoenix/sponge/star/chat/command/conversation/CommandPrompt.java | 2074599a2a045b3fac3f30545522f7ef862a3b10 | [] | no_license | intronate67/StarAPI | 0a269e5f00769a7911384227291ad42510339302 | 06eaec7c93d3345e3abfdb3d97a737d2a47d6dfd | refs/heads/master | 2021-01-22T16:45:00.016330 | 2015-12-24T03:50:47 | 2015-12-24T03:50:47 | 48,661,770 | 0 | 0 | null | 2015-12-27T21:51:45 | 2015-12-27T21:51:44 | null | UTF-8 | Java | false | false | 2,589 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 [email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @author Socratic_Phoenix ([email protected])
*/
package com.gmail.socraticphoenix.sponge.star.chat.command.conversation;
import com.gmail.socraticphoenix.sponge.star.chat.arguments.StarArgumentValue;
import com.gmail.socraticphoenix.sponge.star.chat.condition.Verifier;
import com.gmail.socraticphoenix.sponge.star.chat.conversation.Conversation;
import com.gmail.socraticphoenix.sponge.star.chat.conversation.Prompt;
import java.util.Deque;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
public class CommandPrompt extends Prompt {
private Deque<Prompt> prompts;
private String argName;
private Verifier verifier;
public CommandPrompt(Deque<Prompt> prompts, String argName, Verifier verifier) {
this.prompts = prompts;
this.argName = argName;
this.verifier = verifier;
}
@Override
public Verifier getVerifier() {
return this.verifier;
}
@Override
public Text getMessage() {
return Texts.builder("Please enter '".concat(this.argName).concat("'")).color(TextColors.GOLD).build();
}
@Override
public Prompt process(StarArgumentValue value, Conversation conversation) {
conversation.getArguments().put(this.argName, value.getValue().orElse(null));
return this.prompts.isEmpty() ? Prompt.END : this.prompts.pollFirst();
}
}
| [
"[email protected]"
] | |
fab4e0e77db32618063b846904261599066f1fc1 | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_partial/13949581.java | 749e6bd5f503f268cdab2cb04b5c606743bfcf3f | [] | no_license | whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254688 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java |
class c13949581 {
public static String cryptografar(String senha) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
senha = hash.toString(16);
} catch (NoSuchAlgorithmException ns) {
ns.printStackTrace();
}
return senha;
}
}
| [
"[email protected]"
] | |
c99e90d76d7c5f9a85fd5014c658160390ae631b | 85f2b0db09ff47517d5c31368c862e714acdc614 | /FibBenchGithub/src/ExpectedSarsa/RewardCalculator.java | 6817e96e7bc99086bb5368bc7f48e82f90c3bca5 | [] | no_license | paridee/elasticDAGscheduler | 3db4df05ce3ee89ed9f23f122f50a31481642234 | 60e7171a54dc9570925fb0f7e087e50940bc3593 | refs/heads/master | 2021-01-01T04:12:59.852207 | 2016-05-26T22:07:42 | 2016-05-26T22:07:42 | 59,289,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package ExpectedSarsa;
public interface RewardCalculator {
double giveReward();
}
| [
"[email protected]"
] | |
1b1fde14f4f58b1f3bbaa233520a47327e12f1a3 | 056483e0e2fbe72fb86264f3aff0066d22b18db5 | /ch06/src/Exercise15/MemberService.java | a22d4fcddc974bcb186f5e66a2de6c6d1e0255da | [] | no_license | lx9203/java-lecture | f614f6b31f5ae547bd3d00104184dcb926255c16 | 6bf104b394fc25558c46c79bf65cf855a599bb9c | refs/heads/master | 2020-04-28T19:55:37.974525 | 2019-05-20T01:05:07 | 2019-05-20T01:05:07 | 175,526,926 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package Exercise15;
public class MemberService {
public boolean login(String string, String string2) {
if (string == "hong") {
if (string2 == "12345")
return true;
}
return false;
}
public void logout(String string) {
if (string == "hong")
System.out.println("로그아웃 되었습니다.");
}
}
| [
"[email protected]"
] | |
be9e469a51000737f85d0f51e4fdd780ca13fb93 | ebc4c021ba6cd87e08fdb344e1a6db3ab2abb758 | /xdengue/src/com/smartcommunities/xdengue/breedingSitesActivity.java | bfe49dd8ad82e7bf8743b2570da299d3e67d5fb1 | [] | no_license | achyut1991/Dengue | b2c614e7bd83ca605b19899985e00297e34ddccc | faf914ae39a077e30bc51ae3fbfb57e8ac60dfd2 | refs/heads/master | 2020-05-31T22:05:42.730609 | 2012-08-15T15:02:44 | 2012-08-15T15:02:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,521 | java | package com.smartcommunities.xdengue;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Toast;
public class breedingSitesActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.breedingsites);
// Reference the Gallery view
Gallery g = (Gallery) findViewById(R.id.breedingsites);
// Set the adapter to our custom adapter (below)
g.setAdapter(new ImageAdapter(this));
// Set a item click listener, and just Toast the clicked position
/*.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
Toast.makeText(Gallery1.this, "" + position, Toast.LENGTH_SHORT).show();
}
});*/
// We also want to show context menu for longpressed items in the gallery
registerForContextMenu(g);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
menu.add(R.string.breedingSitetext);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Toast.makeText(this, "Longpress: " + info.position, Toast.LENGTH_SHORT).show();
return true;
}
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
public ImageAdapter(Context c) {
mContext = c;
// See res/values/attrs.xml for the <declare-styleable> that defines
// Gallery1.
TypedArray a = obtainStyledAttributes(R.styleable.xdengue);
mGalleryItemBackground = a.getResourceId(
R.styleable.xdengue_android_galleryItemBackground, 0);
a.recycle();
}
public int getCount() {
return mImageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
i.setImageResource(mImageIds[position]);
i.setScaleType(ImageView.ScaleType.FIT_XY);
//i.setLayoutParams(new Gallery.LayoutParams(136, 88));
// The preferred Gallery item background
i.setBackgroundResource(mGalleryItemBackground);
return i;
}
private Context mContext;
private Integer[] mImageIds = {
R.drawable.breedingsites1,
R.drawable.breedingsites2,
R.drawable.breedingsites3,
R.drawable.breedingsites4,
R.drawable.breedingsites5
};
}
}
| [
"[email protected]"
] | |
c47014c5a3dc2dd4e7a11577d61155d406253c16 | 945b8742f6ce9eaaed44c374d453bcdec3f38376 | /src/main/java/demo/testdemo.java | 65bbcc312f0a1bf7e5719797ab154fd2236b7e69 | [] | no_license | bignyy/gmall2020-parent | ee7534aa45dbc1c071b888156a9083eac08dd4ea | cd1894b298ab5f3cc432dc1e21a6d00b55cafae6 | refs/heads/master | 2022-11-20T07:56:54.815100 | 2020-07-16T07:22:40 | 2020-07-16T07:22:40 | 280,075,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package demo;
public class testdemo {
public static void main(String[] args) {
System.out.println("hahaha");
}
}
| [
"[email protected]"
] | |
a2466f150ddf5a5987f9f65998a23194d8739362 | 55f0bb56c3e2cefe50f7f8573c6b63973ae57a68 | /src/main/java/com/zerphy/separategwt/web/rest/errors/InternalServerErrorException.java | d3c0b5a069503dbb545ff543b8a3331cffca4a7e | [] | no_license | szerphy/separate-gwt | 9e9fab573caf44fdf607001d64a02c654953201d | 1ff54871214a3f29c7d1da1561f4df05ac23a4df | refs/heads/master | 2020-04-08T14:58:01.894434 | 2018-11-28T07:16:48 | 2018-11-28T07:16:48 | 159,459,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.zerphy.separategwt.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
/**
* Simple exception with a message, that returns an Internal Server Error code.
*/
public class InternalServerErrorException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
public InternalServerErrorException(String message) {
super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR);
}
}
| [
"[email protected]"
] | |
2a50f2b53ddec8be24d16825d26a2a45ae4d5141 | 008e36b8328909c10deb72a6ce6c951d648498c7 | /tracker-storm/src/main/java/com/tracker/storm/drpc/drpcprocess/Drpc_Example.java | 65092f6698ddb9e7a6ea2e332b389914d758d93c | [] | no_license | luxr123/UserAnalysis | 3f090e32c35da31fd98412df673db5607a95b32c | e2c5740d5ba0db69bf6d9908714e2c3425702506 | refs/heads/master | 2021-01-10T19:58:49.544112 | 2014-10-31T02:04:22 | 2014-10-31T02:04:22 | 25,714,894 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package com.tracker.storm.drpc.drpcprocess;
//this is no longer used just for sampling
//Drpc request field value
//CLIENT-->DRPC SERVER-->TRANSPORT BOLT-->REAL TIME BOLT -->this-->Aggregate Bolt-->CLIENT
import java.io.Serializable;
import java.util.Calendar;
import java.util.Properties;
import java.util.Set;
import com.tracker.common.utils.ConfigExt;
import com.tracker.common.utils.StringUtil;
import com.tracker.storm.drpc.drpcresult.DrpcResult;
public class Drpc_Example extends DrpcProcess implements Serializable{
/**
*
*/
private static final long serialVersionUID = -7654832864335215661L;
private Properties m_properties;
public static String ProcessFunc = "toprecord";
public Drpc_Example(){
// get cluster infomation
String hdfsLocation = java.lang.System.getenv("HDFS_LOCATION");
String configFile = java.lang.System.getenv("COMMON_CONFIG");
m_properties = ConfigExt.getProperties(hdfsLocation,
configFile);
}
@Override
public boolean isProcessable(String input) {
// TODO Auto-generated method stub
boolean retVal = false;
String splits[] = input.split(StringUtil.ARUGEMENT_SPLIT);
if(input.contains("toprecord") && splits.length == 6){ //toprecord:ip/cost/:Engine:SearchType:startIndex:endIndex
retVal = true;
}
return retVal;
}
@Override
public DrpcResult process(String input, Object localbuff) {
// TODO Auto-generated method stub
// String splits[] = input.split(StringUtil.ARUGEMENT_SPLIT);
// Calendar cal = Calendar.getInstance();
// TopRecordResult trr = new TopRecordResult();
// String key = (cal.get(Calendar.MONTH) + 1) + StringUtil.ARUGEMENT_SPLIT + cal.get(Calendar.DAY_OF_MONTH)
// + StringUtil.ARUGEMENT_SPLIT + splits[1] + StringUtil.ARUGEMENT_SPLIT+ splits[2];
// if(splits[1].equals("ip") || splits[3].equals("")){
//
// }else{
// key += StringUtil.ARUGEMENT_SPLIT + splits[3];
// }
// Set<String> retStr = JedisUtil.getInstance(m_properties).SORTSET.zrevrange(key, Integer.parseInt(splits[4]), Integer.parseInt(splits[5]));
// trr.setString(retStr);
// trr.setTotal(JedisUtil.getInstance(m_properties).SORTSET.zlength(key));
// return trr;
return null;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.