blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
dbf8ea70b49e9bad1b625141072f650fe6d2cd5b
Java
mickeyshoes/lab
/android_test_01/app/src/main/java/com/example/android_test_01/HttpConnectTask.java
UTF-8
2,333
2.84375
3
[]
no_license
package com.example.android_test_01; import android.os.AsyncTask; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class HttpConnectTask extends AsyncTask<Void, Void, String> { // <execute되어 넘겨주는 매개변수 값,,background에서 return하는 값> String url = "http://10.0.2.2:8000/"; String parameter; URL url_final; HttpURLConnection con; InputStreamReader isr; BufferedReader reader; public void make_url(String parameter){ this.parameter = parameter; if(parameter == null){ Log.e("about url","파라미터에 아무런 값도 들어오지 않았음."); } else{ url = url + parameter; } } @Override protected String doInBackground(Void... voids) { StringBuilder output = new StringBuilder(); String read = null; try { while (true) { read = reader.readLine().toString(); if (read == null) { break; } output.append(read + "/"); } reader.close(); con.disconnect(); }catch(Exception e){ e.printStackTrace(); } return output.toString(); } @Override protected void onPreExecute() { super.onPreExecute(); try { url_final = new URL(url); con = (HttpURLConnection)url_final.openConnection(); if(con != null){ con.setConnectTimeout(10000); con.setRequestMethod("POST"); con.setDoInput(true); con.setDoOutput(true); isr = new InputStreamReader(con.getInputStream()); reader = new BufferedReader(isr); } } catch (MalformedURLException e) { e.printStackTrace(); Log.e("test01","주소가 잘못되었음."); } catch (IOException e) { e.printStackTrace(); Log.e("test01","연결이 잘못되었음."); } } @Override protected void onPostExecute(String s) { super.onPostExecute(s); } }
true
923826102b0e993e4f417af31fedca4b61a1af6d
Java
AlexandrosPlessias/BankManagement
/src/File_Management/Read.java
UTF-8
9,873
2.34375
2
[ "MIT" ]
permissive
/* * Δημιουργία Κλάσης Διαβάσματος (Read). */ package File_Management; import Bank_Management.SimpleCreditAccount; import Bank_Management.ReserveAccount; import Bank_Management.SuperCreditAccount; import Bank_Management.Transaction; import Bank_Management.Client; import Bank_Management.Account; import java.io.*; import java.util.*; import static java.lang.System.exit; import java.lang.reflect.Field; public class Read { // Methods. /** * Διαβάζει το filePath και φτιάχνει τους πελάτες. * @param filePath Η διαδρομή του αρχείου που περιέχει την ουρά των πελατών. * @return Η λίστα με όλους τους πελάτες του αρχείου. */ public static ArrayList<Client> clientsFromTxt(File filePath) { ArrayList<Client> allClients = new ArrayList<>(); try (Scanner sc = new Scanner(new FileReader(filePath))) { while (sc.hasNextLine()) { allClients.add(new Client(sc.nextLine(), null)); } sc.close(); } catch (IOException ioex) { System.err.println("Could not find file " + filePath + "."); System.err.println("Please, try to retrieve queueCustomers.txt."); exit(0); } return allClients; } /** * Διαβάζει τους πελάτες από το clientsDirectory. * @param clientsDirectory Η διαδρομή του αρχείου που περιέχει τα * αντικείμενα των πελατών. * @return Η λίστα με όλους τους πελάτες του αρχείου. */ public static ArrayList<Client> clientsFromFile(File clientsDirectory) { ArrayList<Client> allClients = new ArrayList<>(); int size = clientsDirectory.listFiles().length; // Μεγέθος αρχείων στον clientDirectory. try { for (int i = 1; i <= size; i++) { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(clientsDirectory + "\\Id_" + i + "\\Client.bin"))); Client clt = (Client) ois.readObject(); allClients.add(clt); } } catch (FileNotFoundException fnfe) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. System.err.println("Could Read from:" + clientsDirectory); } catch (IOException | ClassNotFoundException cnfe) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. System.err.println("Could Read from:" + clientsDirectory + ". Or Wrong Class as input."); } return allClients; } /** * Πέρασμα όλων των Active λογαριασμών στην λίστα (γίνεται έλεγχος * ορθότητας) και επίσεις αλλάζει η τιμή του static πεδίου lastIban στο * οποίο δεν έχω πρόσβαση με reflaction ώστε να μην χαλάσει η αλληλουχία των * IBANS. * * @param ActiveAccountsDirectory Η διαδρομή του αρχείου που περιέχει τα * αντικείμενα των ενεργών λογαριασμών. * @param ClosedAccountsDirectory Η διαδρομή του αρχείου που περιέχει τα * αντικείμενα των λειστών λογαριασμών. * @return Η λίστα με όλους τους ενεργούς λογαριασμους των αρχείου. */ public static ArrayList<Account> accountsFromFile(File ActiveAccountsDirectory, File ClosedAccountsDirectory) { ArrayList<Account> allAccounts = new ArrayList<>(); int sizeActive = 0; if (ActiveAccountsDirectory.exists()) { sizeActive = ActiveAccountsDirectory.listFiles().length; // Αριθμός ανοιχτών λογαριασμών. } int sizeClosed = 0; if (ClosedAccountsDirectory.exists()) { sizeClosed = ClosedAccountsDirectory.listFiles().length; // Αριθμός κλειστών λογαριασμών. } try { // Πέρασμα όλων των λογαριασμών ώστε ΝΑ ΜΗΝ ΧΑΘΕΙ Η ΣΩΣΤΗ ΣΕΙΡΑ ΤΩΝ ΙΒΑΝs. for (int i = 100001; i <= (100000 + sizeActive + sizeClosed); i++) { int typeCode = -1; // Ελένχουμε αν υπάρχει στους Active ο λογαριασμός που είναι προς εξέταση. if (new File(ActiveAccountsDirectory + "\\IBAN_" + i).exists()) { // Ελένχουμε τη τύπου είναι ο λογαριασμός απο την πρώρη σειρά των Details.txt . Scanner sc = new Scanner(new FileReader(ActiveAccountsDirectory + "\\IBAN_" + i + "\\Details.txt")); String type = sc.nextLine(); sc.close(); if (type.equalsIgnoreCase("Simple Credit Account")) { typeCode = 0; } else if (type.equalsIgnoreCase("Super Credit Account")) { typeCode = 1; } else if (type.equalsIgnoreCase("Reserved Account")) { typeCode = 2; } // Διαβάζουμε το αντικείμενο που ξέρουμε πλέον τη κλάση είναι και το προσθέτουμε στην λίστα λογαριασμών. ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(ActiveAccountsDirectory + "\\IBAN_" + i + "\\Account.bin"))); if (typeCode == 0) { SimpleCreditAccount simpleca = (SimpleCreditAccount) ois.readObject(); ois.close(); allAccounts.add(simpleca); } else if (typeCode == 1) { SuperCreditAccount superca = (SuperCreditAccount) ois.readObject(); ois.close(); allAccounts.add(superca); } else { ReserveAccount ra = (ReserveAccount) ois.readObject(); ois.close(); allAccounts.add(ra); } // Αν δεν υπάρχει στους Active δηλαδή είναι Closed τότε απλά φτιάχνουμε έναν "εικονικό" μόνο και μόνο για μην χαλάσει η σειρα των active λογαριασμων (static ΙΒΑΝ). } else { Transaction tran = new Transaction(-100, 0); SimpleCreditAccount ac = new SimpleCreditAccount(null, tran); } } } catch (FileNotFoundException e) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. System.err.println("Could Read from:" + ActiveAccountsDirectory); } catch (IOException | ClassNotFoundException ex) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. System.err.println("Could Read from:" + ActiveAccountsDirectory); } // Σβήνουμε τους λογαριασμούς που εχουν υπόλοιπο μηδέν. for (int i = allAccounts.size() - 1; i < 0; i++) { if (allAccounts.get(i).getOpen().getAmount() == 0) { allAccounts.remove(allAccounts.get(i)); } } // Αλλαγή του static πεδίου lastIban στο οποίο δεν έχω πρόσβαση με reflaction και πέρασμα τιμής ίση με εκείνη που είχε σταματήσει το πρόγραμμα την τελευταία φορά +1. try { Field field = Account.class.getDeclaredField("lastIban"); field.setAccessible(true); field.set(null, sizeActive + sizeClosed + 100000 - 1); } catch (NoSuchFieldException | SecurityException se) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. se.getCause(); } catch (IllegalArgumentException | IllegalAccessException iae) { // Αυτό δεν πρεπεί να συμβεί διότι αυτή η εξαίρεση αν δεν υπάρχει το αρχείο δεν θα φτάσει ποτέ εδω "πιάνεται" στην restore. iae.getCause(); } // Εάν δεν θέλαμε να κρατήσουμε τους κλειστούς λογαριασμούς τότε: DeleteFolder.allFolder(ClosedAccountsDirectory); return allAccounts; } }
true
1ac580529abc8f40b3cc57eb7cd263e48f6d903f
Java
cogu92/FragmentMannager
/app/src/main/java/com/example/dell/fragmentmannager/MainActivity.java
UTF-8
3,165
2.359375
2
[]
no_license
package com.example.dell.fragmentmannager; import android.content.res.Configuration; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import android.widget.LinearLayout; public class MainActivity extends AppCompatActivity implements View.OnClickListener,FirstFragment.IcomTowActivity{ private static final String TAG = MainActivity.class.getSimpleName(); private FrameLayout mFramecontainer; private View mMainLayout; private boolean mTowpane; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTowpane=getResources().getConfiguration().orientation== Configuration.ORIENTATION_PORTRAIT; if(mTowpane) { mFramecontainer = (FrameLayout) findViewById(R.id.frame_layout); mMainLayout = findViewById(R.id.activity_main); mMainLayout.setOnClickListener(this); } else { final Button btnSwap = (Button) findViewById(R.id.btn_Swap); btnSwap.setOnClickListener(this); FragmentManager fragm = getSupportFragmentManager(); fragm.beginTransaction().add(R.id.fragment_container_activity_main_land, new FirstFragment(), "First Fragment").commit(); } } @Override public void onClick(View v) { if(mTowpane) { if (v.getId() == R.id.activity_main) { Log.v(MainActivity.TAG, "Clicket"); FragmentManager fragm = getSupportFragmentManager(); fragm.beginTransaction().add(R.id.frame_layout, new FirstFragment(), "FirstFragment").commit(); } } else if (v.getId() == R.id.btn_Swap) { FragmentManager fm = getSupportFragmentManager(); boolean isFirstFragment= fm.findFragmentByTag("First Fragment")!=null; LinearLayout mlinearlayout =(LinearLayout)findViewById(R.id.Linear_content_button); int color; Fragment fragmet; String fragmentTag; if(isFirstFragment) {fragmet=new SecontFragment(); fragmentTag="Secont Fragment"; color=R.color.colorAccent; } else {fragmet=new FirstFragment(); fragmentTag="First Fragment"; color=R.color.colorPrimaryDark; } fm.beginTransaction() .replace(R.id.fragment_container_activity_main_land,fragmet,fragmentTag).commit(); mlinearlayout.setBackgroundColor(ContextCompat.getColor(this,color)); } } @Override public void getRandomNumberFromFragmentone() { double randomnumber=Math.random(); Log.e(MainActivity.TAG,"Random"+randomnumber); // Fragment fragment =findViewById(R.id.Fragment_secont_main); } }
true
1822e678f21aa2425e0b11aa7ec1b35f7ebd15c2
Java
bodya-android-samples/design-patterns
/BehaviorPatterns/src/ru/popov/bodya/command/commands/SelectCommand.java
UTF-8
365
2.15625
2
[]
no_license
package ru.popov.bodya.command.commands; import ru.popov.bodya.command.Command; import ru.popov.bodya.command.Database; public class SelectCommand implements Command { private Database mDatabase; public SelectCommand(Database database) { mDatabase = database; } @Override public void execute() { mDatabase.select(); } }
true
043b9ce397c777c5821119905e00407cb9d90a3c
Java
prafullkotecha/helix
/mockservice/src/main/java/com/linkedin/helix/MockRunner.java
UTF-8
1,819
2.171875
2
[ "Apache-2.0" ]
permissive
/** * Copyright (C) 2012 LinkedIn Inc <[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 com.linkedin.helix; import org.apache.log4j.Logger; import com.linkedin.helix.manager.zk.ZNRecordSerializer; import com.linkedin.helix.manager.zk.ZkClient; /** * Hello world! * */ public class MockRunner { private static final Logger logger = Logger.getLogger(MockRunner.class); protected static final String nodeType = "EspressoStorage"; protected static final String ZK_ADDR = "localhost:2184"; protected static final String INSTANCE_NAME = "localhost_1234"; protected static final String CLUSTER_NAME = "MockCluster"; public static void main( String[] args ) { //ZkClient zkClient = new ZkClient(ZK_ADDR, 3000, 10000, new ZNRecordSerializer()); CMConnector cm = null; try { cm = new CMConnector(CLUSTER_NAME, INSTANCE_NAME, ZK_ADDR); //, zkClient); } catch (Exception e) { logger.error("Unable to initialize CMConnector: "+e); e.printStackTrace(); System.exit(-1); } MockNode mock = MockNodeFactory.createMockNode(nodeType, cm); if (mock != null) { mock.run(); } else { logger.error("Unknown MockNode type "+nodeType); System.exit(-1); } } }
true
6ac152baaea61d04dfd15210affd25ce75145b04
Java
lucky7886/Code9
/NEW/DiceProbability.java
UTF-8
777
3.34375
3
[]
no_license
import java.util.Random; public class DiceProbability { public static void main(String[] args) { Random r = new Random(); int peterSum=0; int peterWins=0; int colinSum=0; int colinWins=0; int rounds=10000000; int c=0; for(int i=0;i<rounds;i++) { //System.out.println(); for(int j=0;j<9;j++) { c=1+r.nextInt(4); // System.out.println(c); peterSum+=c; } //System.out.println(); for(int k=0;k<6;k++){ c=1+r.nextInt(6); // System.out.println(c); colinSum+=c; } if(peterSum>colinSum) peterWins++; else if(peterSum<colinSum) colinWins++; } System.out.println("Results:----"); System.out.println(peterWins); System.out.println(colinWins); System.out.println((double)peterWins/rounds); } }
true
e998ea1d7588de154a92368cced9d8a7cd7e28aa
Java
matiu222/cuatroenlineaj
/src/java/com/cuatroenlineaj/modelo/Partida.java
UTF-8
1,935
2.453125
2
[]
no_license
/* * 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 com.cuatroenlineaj.modelo; import java.io.Serializable; public class Partida implements Serializable{ private String id_partida; private int numerojugadores=4; private Tablero id_tablero; private Double tiempo_jugador1; private Double tiempo_jugador2; public Partida(String id_partida, Tablero id_tablero, Double tiempo_jugador2) { this.id_partida = id_partida; this.id_tablero = id_tablero; this.tiempo_jugador2 = tiempo_jugador2; } public String getId_partida() { return id_partida; } public void setId_partida(String id_partida) { this.id_partida = id_partida; } public int getNumerojugadores() { return numerojugadores; } public void setNumerojugadores(int numerojugadores) { this.numerojugadores = numerojugadores; } public Tablero getId_tablero() { return id_tablero; } public void setId_tablero(Tablero id_tablero) { this.id_tablero = id_tablero; } public Double getTiempo_jugador1() { return tiempo_jugador1; } public void setTiempo_jugador1(Double tiempo_jugador1) { this.tiempo_jugador1 = tiempo_jugador1; } public Double getTiempo_jugador2() { return tiempo_jugador2; } public void setTiempo_jugador2(Double tiempo_jugador2) { this.tiempo_jugador2 = tiempo_jugador2; } @Override public String toString() { return "Partida{" + "id_partida=" + id_partida + ", numerojugadores=" + numerojugadores + ", id_tablero=" + id_tablero + ", tiempo_jugador1=" + tiempo_jugador1 + ", tiempo_jugador2=" + tiempo_jugador2 + '}'; } }
true
df9a777af70903b807d0320c2a42e065632083a1
Java
shidongdong1010/adminj
/adminj-basic/src/main/java/com/lhy/adminj/basic/enumeration/UUserIsLockedEnum.java
UTF-8
1,069
2.6875
3
[]
no_license
package com.lhy.adminj.basic.enumeration; /** * 是否锁定枚举 * * @author SDD * @version $v: 1.0.0, $time:2015-09-29 15:57:00 Exp $ */ public enum UUserIsLockedEnum { /** 正常 **/ NORMAL(0L, "正常"), /** 锁定 **/ LOCKED(1L, "锁定"), ; private Long code; private String desc; UUserIsLockedEnum(Long code, String desc) { this.code = code; this.desc = desc; } public Long getCode() { return code; } public String getDesc() { return desc; } public static UUserIsLockedEnum getByCode(Long code) { for (UUserIsLockedEnum enumObj : UUserIsLockedEnum.values()) { if (enumObj.getCode().equals(code)) { return enumObj; } } return null; } public static UUserIsLockedEnum getByDesc(String desc) { for (UUserIsLockedEnum enumObj : UUserIsLockedEnum.values()) { if (enumObj.getDesc().equals(desc)) { return enumObj; } } return null; } }
true
7bc1217d5d87f30a724942a229a8fd2707cf922f
Java
melwil/ingress-churches
/churches/src/main/java/net/melwil/churches/gps/GPS.java
UTF-8
1,699
2.703125
3
[]
no_license
package net.melwil.churches.gps; import org.im4java.core.*; import java.io.IOException; public class GPS { public static void main(String[] args) { String filename = "img/hagebostad-kirke.jpg"; double lat = 58.3407; double lng = 7.2056; markWithGpsTag(filename, lat, lng); /* try { Info imageInfo = new Info("/Users/melwil/git/ingress-churches/churches/img/hagebostad-kirke.jpg", true); System.out.println("Format: " + imageInfo.getImageFormat()); System.out.println("Width: " + imageInfo.getImageWidth()); System.out.println("Height: " + imageInfo.getImageHeight()); System.out.println("Geometry: " + imageInfo.getImageGeometry()); System.out.println("Depth: " + imageInfo.getImageDepth()); System.out.println("Class: " + imageInfo.getImageClass()); } catch (InfoException e) { e.printStackTrace(); } */ } public static boolean markWithGpsTag(String filename, double lat, double lng) { ExiftoolCmd cmd = new ExiftoolCmd(); ETOperation op = new ETOperation(); op.setTags( "gps:GPSLatitudeRef='N'", "gps:GPSLatitude='"+lat+"'", "gps:GPSLongitudeRef='W'", "gps:GPSLongitude='"+lng+"'" ); op.addImage(); try { cmd.run(op, filename); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (IM4JavaException e) { e.printStackTrace(); } return true; } }
true
1a5cafcb83da50f301edf282ed0ec5b926dd4f2e
Java
kfrankgh/kbtoolsautomation
/src/test/java/com/sersol/kbtools/bvt/dataServlet/holding/holdingImportState/HoldingImportStateResult.java
UTF-8
1,411
2.03125
2
[]
no_license
package com.sersol.kbtools.bvt.dataServlet.holding.holdingImportState; import org.joda.time.DateTime; public class HoldingImportStateResult { private Integer holdingImportDatabaseId; private String databaseName; private String databaseCode; private String username; private Integer userId; private DateTime processed; public Integer getHoldingImportDatabaseId() { return holdingImportDatabaseId; } public void setHoldingImportDatabaseId(Integer holdingImportDatabaseId) { this.holdingImportDatabaseId = holdingImportDatabaseId; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getDatabaseName() { return databaseName; } public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } public String getDatabaseCode() { return databaseCode; } public void setDatabaseCode(String databaseCode) { this.databaseCode = databaseCode; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public DateTime getProcessed() { return processed; } public void setProcessed(DateTime processed) { this.processed = processed; } }
true
64b96e95893d56602e77e212832a687f65dfd87e
Java
wisp1577/core
/src/main/java/com/rails/ecommerce/core/test/domain/Test.java
UTF-8
25,555
1.992188
2
[]
no_license
//package com.rails.ecommerce.core.test.domain; // //import java.io.Serializable; // //import javax.persistence.Column; //import javax.persistence.Entity; //import javax.persistence.Id; //import javax.persistence.Table; // // /** // * Class Name: Test.java // * Function:订单表 // * // * Modifications: // * // * @author gxl DateTime 2015-1-9 上午10:08:46 // * @version 1.0 // */ //@Entity //@Table(name = "ecommerce_test") //public class Test implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @Column(name = "test_id") // private String test_id; // // @Column(name = "test_id1") // private String test_id1; // // @Column(name = "test_id2") // private String test_id2; // // @Column(name = "test_id3") // private String test_id3; // // @Column(name = "test_id4") // private String test_id4; // // @Column(name = "test_id5") // private String test_id5; // // @Column(name = "test_id6") // private String test_id6; // // @Column(name = "test_id7") // private String test_id7; // // @Column(name = "test_id8") // private String test_id8; // // @Column(name = "test_id9") // private String test_id9; // // @Column(name = "test_id10") // private String test_id10; // // @Column(name = "test_id11") // private String test_id11; // // @Column(name = "test_id12") // private String test_id12; // // @Column(name = "test_id13") // private String test_id13; // // @Column(name = "test_id14") // private String test_id14; // // @Column(name = "test_id15") // private String test_id15; // // @Column(name = "test_id16") // private String test_id16; // // @Column(name = "test_id17") // private String test_id17; // // @Column(name = "test_id18") // private String test_id18; // // @Column(name = "test_id19") // private String test_id19; // // @Column(name = "test_id20") // private String test_id20; // // @Column(name = "test_id21") // private String test_id21; // // @Column(name = "test_id22") // private String test_id22; // // @Column(name = "test_id23") // private String test_id23; // // @Column(name = "test_id24") // private String test_id24; // // @Column(name = "test_id25") // private String test_id25; // // @Column(name = "test_id26") // private String test_id26; // // @Column(name = "test_id27") // private String test_id27; // // @Column(name = "test_id28") // private String test_id28; // // @Column(name = "test_id29") // private String test_id29; // // @Column(name = "test_id30") // private String test_id30; // // @Column(name = "test_id31") // private String test_id31; // // @Column(name = "test_id32") // private String test_id32; // // @Column(name = "test_id33") // private String test_id33; // // @Column(name = "test_id34") // private String test_id34; // // @Column(name = "test_id35") // private String test_id35; // // @Column(name = "test_id36") // private String test_id36; // // @Column(name = "test_id37") // private String test_id37; // // @Column(name = "test_id38") // private String test_id38; // // @Column(name = "test_id39") // private String test_id39; // // @Column(name = "test_id40") // private String test_id40; // // @Column(name = "test_id41") // private String test_id41; // // @Column(name = "test_id42") // private String test_id42; // // @Column(name = "test_id43") // private String test_id43; // // @Column(name = "test_id44") // private String test_id44; // // @Column(name = "test_id45") // private String test_id45; // // @Column(name = "test_id46") // private String test_id46; // // @Column(name = "test_id47") // private String test_id47; // // @Column(name = "test_id48") // private String test_id48; // // @Column(name = "test_id49") // private String test_id49; // // @Column(name = "test_id50") // private String test_id50; // // @Column(name = "test_id51") // private String test_id51; // // @Column(name = "test_id52") // private String test_id52; // // @Column(name = "test_id53") // private String test_id53; // // @Column(name = "test_id54") // private String test_id54; // // @Column(name = "test_id55") // private String test_id55; // // @Column(name = "test_id56") // private String test_id56; // // @Column(name = "test_id57") // private String test_id57; // // @Column(name = "test_id58") // private String test_id58; // // @Column(name = "test_id59") // private String test_id59; // // @Column(name = "test_id60") // private String test_id60; // // @Column(name = "test_id61") // private String test_id61; // // @Column(name = "test_id62") // private String test_id62; // // @Column(name = "test_id63") // private String test_id63; // // @Column(name = "test_id64") // private String test_id64; // // @Column(name = "test_id65") // private String test_id65; // // @Column(name = "test_id66") // private String test_id66; // // @Column(name = "test_id67") // private String test_id67; // // @Column(name = "test_id68") // private String test_id68; // // @Column(name = "test_id69") // private String test_id69; // // @Column(name = "test_id70") // private String test_id70; // // @Column(name = "test_id71") // private String test_id71; // // @Column(name = "test_id72") // private String test_id72; // // @Column(name = "test_id73") // private String test_id73; // // @Column(name = "test_id74") // private String test_id74; // // @Column(name = "test_id75") // private String test_id75; // // @Column(name = "test_id76") // private String test_id76; // // @Column(name = "test_id77") // private String test_id77; // // @Column(name = "test_id78") // private String test_id78; // // @Column(name = "test_id79") // private String test_id79; // // @Column(name = "test_id80") // private String test_id80; // // @Column(name = "test_id81") // private String test_id81; // // @Column(name = "test_id82") // private String test_id82; // // @Column(name = "test_id83") // private String test_id83; // // @Column(name = "test_id84") // private String test_id84; // // @Column(name = "test_id85") // private String test_id85; // // @Column(name = "test_id86") // private String test_id86; // // @Column(name = "test_id87") // private String test_id87; // // @Column(name = "test_id88") // private String test_id88; // // @Column(name = "test_id89") // private String test_id89; // // @Column(name = "test_id90") // private String test_id90; // // @Column(name = "test_id91") // private String test_id91; // // @Column(name = "test_id92") // private String test_id92; // // @Column(name = "test_id93") // private String test_id93; // // @Column(name = "test_id94") // private String test_id94; // // @Column(name = "test_id95") // private String test_id95; // // @Column(name = "test_id96") // private String test_id96; // // @Column(name = "test_id97") // private String test_id97; // // @Column(name = "test_id98") // private String test_id98; // // @Column(name = "test_id99") // private String test_id99; // // @Column(name = "test_id100") // private String test_id100; // // @Column(name = "test_id101") // private String test_id101; // // @Column(name = "test_id102") // private String test_id102; // // @Column(name = "test_id103") // private String test_id103; // // @Column(name = "test_id104") // private String test_id104; // // @Column(name = "test_id105") // private String test_id105; // // @Column(name = "test_id106") // private String test_id106; // // @Column(name = "test_id107") // private String test_id107; // // @Column(name = "test_id108") // private String test_id108; // // @Column(name = "test_id109") // private String test_id109; // // public String getTest_id() { // return test_id; // } // // public void setTest_id(String test_id) { // this.test_id = test_id; // } // // public String getTest_id1() { // return test_id1; // } // // public void setTest_id1(String test_id1) { // this.test_id1 = test_id1; // } // // public String getTest_id2() { // return test_id2; // } // // public void setTest_id2(String test_id2) { // this.test_id2 = test_id2; // } // // public String getTest_id3() { // return test_id3; // } // // public void setTest_id3(String test_id3) { // this.test_id3 = test_id3; // } // // public String getTest_id4() { // return test_id4; // } // // public void setTest_id4(String test_id4) { // this.test_id4 = test_id4; // } // // public String getTest_id5() { // return test_id5; // } // // public void setTest_id5(String test_id5) { // this.test_id5 = test_id5; // } // // public String getTest_id6() { // return test_id6; // } // // public void setTest_id6(String test_id6) { // this.test_id6 = test_id6; // } // // public String getTest_id7() { // return test_id7; // } // // public void setTest_id7(String test_id7) { // this.test_id7 = test_id7; // } // // public String getTest_id8() { // return test_id8; // } // // public void setTest_id8(String test_id8) { // this.test_id8 = test_id8; // } // // public String getTest_id9() { // return test_id9; // } // // public void setTest_id9(String test_id9) { // this.test_id9 = test_id9; // } // // public String getTest_id10() { // return test_id10; // } // // public void setTest_id10(String test_id10) { // this.test_id10 = test_id10; // } // // public String getTest_id11() { // return test_id11; // } // // public void setTest_id11(String test_id11) { // this.test_id11 = test_id11; // } // // public String getTest_id12() { // return test_id12; // } // // public void setTest_id12(String test_id12) { // this.test_id12 = test_id12; // } // // public String getTest_id13() { // return test_id13; // } // // public void setTest_id13(String test_id13) { // this.test_id13 = test_id13; // } // // public String getTest_id14() { // return test_id14; // } // // public void setTest_id14(String test_id14) { // this.test_id14 = test_id14; // } // // public String getTest_id15() { // return test_id15; // } // // public void setTest_id15(String test_id15) { // this.test_id15 = test_id15; // } // // public String getTest_id16() { // return test_id16; // } // // public void setTest_id16(String test_id16) { // this.test_id16 = test_id16; // } // // public String getTest_id17() { // return test_id17; // } // // public void setTest_id17(String test_id17) { // this.test_id17 = test_id17; // } // // public String getTest_id18() { // return test_id18; // } // // public void setTest_id18(String test_id18) { // this.test_id18 = test_id18; // } // // public String getTest_id19() { // return test_id19; // } // // public void setTest_id19(String test_id19) { // this.test_id19 = test_id19; // } // // public String getTest_id20() { // return test_id20; // } // // public void setTest_id20(String test_id20) { // this.test_id20 = test_id20; // } // // public String getTest_id21() { // return test_id21; // } // // public void setTest_id21(String test_id21) { // this.test_id21 = test_id21; // } // // public String getTest_id22() { // return test_id22; // } // // public void setTest_id22(String test_id22) { // this.test_id22 = test_id22; // } // // public String getTest_id23() { // return test_id23; // } // // public void setTest_id23(String test_id23) { // this.test_id23 = test_id23; // } // // public String getTest_id24() { // return test_id24; // } // // public void setTest_id24(String test_id24) { // this.test_id24 = test_id24; // } // // public String getTest_id25() { // return test_id25; // } // // public void setTest_id25(String test_id25) { // this.test_id25 = test_id25; // } // // public String getTest_id26() { // return test_id26; // } // // public void setTest_id26(String test_id26) { // this.test_id26 = test_id26; // } // // public String getTest_id27() { // return test_id27; // } // // public void setTest_id27(String test_id27) { // this.test_id27 = test_id27; // } // // public String getTest_id28() { // return test_id28; // } // // public void setTest_id28(String test_id28) { // this.test_id28 = test_id28; // } // // public String getTest_id29() { // return test_id29; // } // // public void setTest_id29(String test_id29) { // this.test_id29 = test_id29; // } // // public String getTest_id30() { // return test_id30; // } // // public void setTest_id30(String test_id30) { // this.test_id30 = test_id30; // } // // public String getTest_id31() { // return test_id31; // } // // public void setTest_id31(String test_id31) { // this.test_id31 = test_id31; // } // // public String getTest_id32() { // return test_id32; // } // // public void setTest_id32(String test_id32) { // this.test_id32 = test_id32; // } // // public String getTest_id33() { // return test_id33; // } // // public void setTest_id33(String test_id33) { // this.test_id33 = test_id33; // } // // public String getTest_id34() { // return test_id34; // } // // public void setTest_id34(String test_id34) { // this.test_id34 = test_id34; // } // // public String getTest_id35() { // return test_id35; // } // // public void setTest_id35(String test_id35) { // this.test_id35 = test_id35; // } // // public String getTest_id36() { // return test_id36; // } // // public void setTest_id36(String test_id36) { // this.test_id36 = test_id36; // } // // public String getTest_id37() { // return test_id37; // } // // public void setTest_id37(String test_id37) { // this.test_id37 = test_id37; // } // // public String getTest_id38() { // return test_id38; // } // // public void setTest_id38(String test_id38) { // this.test_id38 = test_id38; // } // // public String getTest_id39() { // return test_id39; // } // // public void setTest_id39(String test_id39) { // this.test_id39 = test_id39; // } // // public String getTest_id40() { // return test_id40; // } // // public void setTest_id40(String test_id40) { // this.test_id40 = test_id40; // } // // public String getTest_id41() { // return test_id41; // } // // public void setTest_id41(String test_id41) { // this.test_id41 = test_id41; // } // // public String getTest_id42() { // return test_id42; // } // // public void setTest_id42(String test_id42) { // this.test_id42 = test_id42; // } // // public String getTest_id43() { // return test_id43; // } // // public void setTest_id43(String test_id43) { // this.test_id43 = test_id43; // } // // public String getTest_id44() { // return test_id44; // } // // public void setTest_id44(String test_id44) { // this.test_id44 = test_id44; // } // // public String getTest_id45() { // return test_id45; // } // // public void setTest_id45(String test_id45) { // this.test_id45 = test_id45; // } // // public String getTest_id46() { // return test_id46; // } // // public void setTest_id46(String test_id46) { // this.test_id46 = test_id46; // } // // public String getTest_id47() { // return test_id47; // } // // public void setTest_id47(String test_id47) { // this.test_id47 = test_id47; // } // // public String getTest_id48() { // return test_id48; // } // // public void setTest_id48(String test_id48) { // this.test_id48 = test_id48; // } // // public String getTest_id49() { // return test_id49; // } // // public void setTest_id49(String test_id49) { // this.test_id49 = test_id49; // } // // public String getTest_id50() { // return test_id50; // } // // public void setTest_id50(String test_id50) { // this.test_id50 = test_id50; // } // // public String getTest_id51() { // return test_id51; // } // // public void setTest_id51(String test_id51) { // this.test_id51 = test_id51; // } // // public String getTest_id52() { // return test_id52; // } // // public void setTest_id52(String test_id52) { // this.test_id52 = test_id52; // } // // public String getTest_id53() { // return test_id53; // } // // public void setTest_id53(String test_id53) { // this.test_id53 = test_id53; // } // // public String getTest_id54() { // return test_id54; // } // // public void setTest_id54(String test_id54) { // this.test_id54 = test_id54; // } // // public String getTest_id55() { // return test_id55; // } // // public void setTest_id55(String test_id55) { // this.test_id55 = test_id55; // } // // public String getTest_id56() { // return test_id56; // } // // public void setTest_id56(String test_id56) { // this.test_id56 = test_id56; // } // // public String getTest_id57() { // return test_id57; // } // // public void setTest_id57(String test_id57) { // this.test_id57 = test_id57; // } // // public String getTest_id58() { // return test_id58; // } // // public void setTest_id58(String test_id58) { // this.test_id58 = test_id58; // } // // public String getTest_id59() { // return test_id59; // } // // public void setTest_id59(String test_id59) { // this.test_id59 = test_id59; // } // // public String getTest_id60() { // return test_id60; // } // // public void setTest_id60(String test_id60) { // this.test_id60 = test_id60; // } // // public String getTest_id61() { // return test_id61; // } // // public void setTest_id61(String test_id61) { // this.test_id61 = test_id61; // } // // public String getTest_id62() { // return test_id62; // } // // public void setTest_id62(String test_id62) { // this.test_id62 = test_id62; // } // // public String getTest_id63() { // return test_id63; // } // // public void setTest_id63(String test_id63) { // this.test_id63 = test_id63; // } // // public String getTest_id64() { // return test_id64; // } // // public void setTest_id64(String test_id64) { // this.test_id64 = test_id64; // } // // public String getTest_id65() { // return test_id65; // } // // public void setTest_id65(String test_id65) { // this.test_id65 = test_id65; // } // // public String getTest_id66() { // return test_id66; // } // // public void setTest_id66(String test_id66) { // this.test_id66 = test_id66; // } // // public String getTest_id67() { // return test_id67; // } // // public void setTest_id67(String test_id67) { // this.test_id67 = test_id67; // } // // public String getTest_id68() { // return test_id68; // } // // public void setTest_id68(String test_id68) { // this.test_id68 = test_id68; // } // // public String getTest_id69() { // return test_id69; // } // // public void setTest_id69(String test_id69) { // this.test_id69 = test_id69; // } // // public String getTest_id70() { // return test_id70; // } // // public void setTest_id70(String test_id70) { // this.test_id70 = test_id70; // } // // public String getTest_id71() { // return test_id71; // } // // public void setTest_id71(String test_id71) { // this.test_id71 = test_id71; // } // // public String getTest_id72() { // return test_id72; // } // // public void setTest_id72(String test_id72) { // this.test_id72 = test_id72; // } // // public String getTest_id73() { // return test_id73; // } // // public void setTest_id73(String test_id73) { // this.test_id73 = test_id73; // } // // public String getTest_id74() { // return test_id74; // } // // public void setTest_id74(String test_id74) { // this.test_id74 = test_id74; // } // // public String getTest_id75() { // return test_id75; // } // // public void setTest_id75(String test_id75) { // this.test_id75 = test_id75; // } // // public String getTest_id76() { // return test_id76; // } // // public void setTest_id76(String test_id76) { // this.test_id76 = test_id76; // } // // public String getTest_id77() { // return test_id77; // } // // public void setTest_id77(String test_id77) { // this.test_id77 = test_id77; // } // // public String getTest_id78() { // return test_id78; // } // // public void setTest_id78(String test_id78) { // this.test_id78 = test_id78; // } // // public String getTest_id79() { // return test_id79; // } // // public void setTest_id79(String test_id79) { // this.test_id79 = test_id79; // } // // public String getTest_id80() { // return test_id80; // } // // public void setTest_id80(String test_id80) { // this.test_id80 = test_id80; // } // // public String getTest_id81() { // return test_id81; // } // // public void setTest_id81(String test_id81) { // this.test_id81 = test_id81; // } // // public String getTest_id82() { // return test_id82; // } // // public void setTest_id82(String test_id82) { // this.test_id82 = test_id82; // } // // public String getTest_id83() { // return test_id83; // } // // public void setTest_id83(String test_id83) { // this.test_id83 = test_id83; // } // // public String getTest_id84() { // return test_id84; // } // // public void setTest_id84(String test_id84) { // this.test_id84 = test_id84; // } // // public String getTest_id85() { // return test_id85; // } // // public void setTest_id85(String test_id85) { // this.test_id85 = test_id85; // } // // public String getTest_id86() { // return test_id86; // } // // public void setTest_id86(String test_id86) { // this.test_id86 = test_id86; // } // // public String getTest_id87() { // return test_id87; // } // // public void setTest_id87(String test_id87) { // this.test_id87 = test_id87; // } // // public String getTest_id88() { // return test_id88; // } // // public void setTest_id88(String test_id88) { // this.test_id88 = test_id88; // } // // public String getTest_id89() { // return test_id89; // } // // public void setTest_id89(String test_id89) { // this.test_id89 = test_id89; // } // // public String getTest_id90() { // return test_id90; // } // // public void setTest_id90(String test_id90) { // this.test_id90 = test_id90; // } // // public String getTest_id91() { // return test_id91; // } // // public void setTest_id91(String test_id91) { // this.test_id91 = test_id91; // } // // public String getTest_id92() { // return test_id92; // } // // public void setTest_id92(String test_id92) { // this.test_id92 = test_id92; // } // // public String getTest_id93() { // return test_id93; // } // // public void setTest_id93(String test_id93) { // this.test_id93 = test_id93; // } // // public String getTest_id94() { // return test_id94; // } // // public void setTest_id94(String test_id94) { // this.test_id94 = test_id94; // } // // public String getTest_id95() { // return test_id95; // } // // public void setTest_id95(String test_id95) { // this.test_id95 = test_id95; // } // // public String getTest_id96() { // return test_id96; // } // // public void setTest_id96(String test_id96) { // this.test_id96 = test_id96; // } // // public String getTest_id97() { // return test_id97; // } // // public void setTest_id97(String test_id97) { // this.test_id97 = test_id97; // } // // public String getTest_id98() { // return test_id98; // } // // public void setTest_id98(String test_id98) { // this.test_id98 = test_id98; // } // // public String getTest_id99() { // return test_id99; // } // // public void setTest_id99(String test_id99) { // this.test_id99 = test_id99; // } // // public String getTest_id100() { // return test_id100; // } // // public void setTest_id100(String test_id100) { // this.test_id100 = test_id100; // } // // public String getTest_id101() { // return test_id101; // } // // public void setTest_id101(String test_id101) { // this.test_id101 = test_id101; // } // // public String getTest_id102() { // return test_id102; // } // // public void setTest_id102(String test_id102) { // this.test_id102 = test_id102; // } // // public String getTest_id103() { // return test_id103; // } // // public void setTest_id103(String test_id103) { // this.test_id103 = test_id103; // } // // public String getTest_id104() { // return test_id104; // } // // public void setTest_id104(String test_id104) { // this.test_id104 = test_id104; // } // // public String getTest_id105() { // return test_id105; // } // // public void setTest_id105(String test_id105) { // this.test_id105 = test_id105; // } // // public String getTest_id106() { // return test_id106; // } // // public void setTest_id106(String test_id106) { // this.test_id106 = test_id106; // } // // public String getTest_id107() { // return test_id107; // } // // public void setTest_id107(String test_id107) { // this.test_id107 = test_id107; // } // // public String getTest_id108() { // return test_id108; // } // // public void setTest_id108(String test_id108) { // this.test_id108 = test_id108; // } // // public String getTest_id109() { // return test_id109; // } // // public void setTest_id109(String test_id109) { // this.test_id109 = test_id109; // } // // //}
true
60a31bbaed99b6484284e29c82e41ac628f03bdb
Java
TatsianaKlasevich/Shape
/src/com/klasevich/quadrangle/entity/Quadrangle.java
UTF-8
1,817
2.75
3
[]
no_license
package com.klasevich.quadrangle.entity; import com.klasevich.quadrangle.observer.Observable; import com.klasevich.quadrangle.observer.Observer; import com.klasevich.quadrangle.observer.QuadrangleEvent; import java.util.Collections; import java.util.List; public class Quadrangle extends AbstractShape implements Observable { private List<Point2D> points; private List<Observer> observers; public Quadrangle() { } public Quadrangle(List<Point2D> points) { super(); this.points = points; } public Quadrangle(int id, List<Point2D> points) { super(id); this.points = points; } public Quadrangle(List<Point2D> points, List<Observer> observers) { super(); this.points = points; this.observers = observers; } @Override public void attach(Observer observer) { if (observer != null) { observers.add(observer); } } @Override public void detach(Observer observer) { observers.remove(observer); } @Override public void notifyObservers() { QuadrangleEvent event = new QuadrangleEvent(this); observers.forEach(o -> o.parameterChanged(event)); } public List<Point2D> getPoints() { return Collections.unmodifiableList(points); } public Point2D getPoints(int index) { return points.get(index); } public void setPoints(List<Point2D> points) { this.points = points; notifyObservers(); } @Override public String toString() { final StringBuilder sb = new StringBuilder("Quadrangle{"); sb.append("points=").append(points); sb.append('}'); return sb.toString(); } }
true
4b0e8b9975354b530f278b8c205cd794ed17cfa6
Java
youngseo9478/JavaSample0
/JavaSample0/자바/CheckBoxEx1.java
UHC
2,710
3.96875
4
[]
no_license
package graphicUI; import java.awt.Checkbox; import java.awt.CheckboxGroup; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Label; /*********Check Box*********** * üũڽ ׷ * ׷쳻 Ӽ Ѱ ִ¶ư ٲ. * (Label ܼϰ ̸ ִ * ı ־ ϸ )*/ public class CheckBoxEx1 { public static void main(String[] args) { Frame f = new Frame("Questions"); //ġ ָ (0,0) f.setSize(250,250); // ̾ƿ̶ ũ⿡ ׸ ȴ.->߿ Ұ //Frame LayoutManager FlowLayout Ѵ. f.setLayout(new FlowLayout()); //׷ ʾұ ϴ Label q1 = new Label("1. оߴ?( ð)"); //üũڽ Checkbox news = new Checkbox("new",true); //true üũȻ· дٴ . default false->ƹ͵ üũǾʴ Checkbox sports = new Checkbox("sports"); Checkbox movie = new Checkbox("movie"); Checkbox music = new Checkbox("music"); f.add(q1); //fӿ ׸ ߰ϴ . f.add(news); f.add(sports); f.add(movie); f.add(music); //׷ ָ üũڽ ư ٲԵǰ ׷ȿ ư߿ ϳ üũ ִ. Label q2 = new Label("2.󸶳 忡 ʴϱ?"); CheckboxGroup group = new CheckboxGroup(); Checkbox movie1 = new Checkbox(" ޿ ϴ.",group,true); Checkbox movie2 = new Checkbox("Ͽ ϴ.",group,false); Checkbox movie3 = new Checkbox("Ͽ ϴ.",group,false); f.add(q2); //׳ ޼ ̸ ӿ Ÿִ° Label ϴ f.add(movie1); f.add(movie2); f.add(movie3); Label q3 = new Label("3.Ϸ翡 󸶳 ǻ͸ Ͻʴϱ?"); CheckboxGroup group2 = new CheckboxGroup(); Checkbox com1 = new Checkbox("5ð ",group2,true); Checkbox com2 = new Checkbox("10ð ",group2,false); //^ ư Ѱ ֱ⶧ ⿡ true ϸ 5ð Ͽ üũ Ǯ.->߿ѰԿ켱 Checkbox com3 = new Checkbox("15ð ",group2,false); f.add(q3); f.add(com1); f.add(com2); f.add(com3); f.setVisible(true); } }
true
cca6afb852171446bca184efd596d60a5e61775d
Java
nupurrajal/practice-coding
/Sample/src/com/practice/greedy/MinNumberOfJumps.java
UTF-8
845
3.453125
3
[]
no_license
package com.practice.greedy; import java.util.Scanner; public class MinNumberOfJumps { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } System.out.println(printMinNumOfJumpsToEnd(arr, n)); sc.close(); } private static int printMinNumOfJumpsToEnd(int[] arr, int n) { int steps = 1, i = 0; while (i < n) { steps++; int currMax = 0; for (int k = i+1; k <= Math.min(i + arr[i], n-1); k++) { currMax = Math.max(currMax, arr[k]); } i += currMax+1; } return steps; } } /* 10 2 3 1 1 2 4 2 0 1 1 11 1 3 5 8 9 2 6 7 6 8 9 */
true
dc1876da616070719927a685d9887dc73abde24a
Java
Hetty38/Chat
/Downloads/ChatRMI/src/main/java/chatserver/IServer.java
UTF-8
582
2.203125
2
[]
no_license
package main.java.chatserver; import main.java.сhatсlient.IClient; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.concurrent.ConcurrentMap; public interface IServer extends Remote { void sendMessage(String message, String name) throws RemoteException; void reg(IClient server, String name) throws RemoteException; void disconnect(String name) throws RemoteException; ConcurrentMap<String, IClient> getClients() throws RemoteException; void sendPrivateMessage(String message, String nameClient) throws RemoteException; }
true
d48fa942caa257284e36bb220efd3e0286ab6778
Java
VitaliShchur/AT2019-03-12
/src/by/it/romanova/at27/Util.java
UTF-8
492
2.40625
2
[]
no_license
package by.it.romanova.at27; class Util { // private static Random rnd=new Random(); private Util() { } static int random(int start, int stop) { return start + (int) (Math.random() * (1 + stop - start)); } static int random(int max) { return random(1, max); } static void sleep(int timeout) { try { Thread.sleep(timeout); } catch (InterruptedException e) { e.printStackTrace(); } } }
true
339ff244017e8e418aff874cfb835d78830eb864
Java
gzhang428/Testing
/src/common/Rotation.java
UTF-8
649
3.09375
3
[]
no_license
package common; public class Rotation { /** * @param args */ public static void main(String[] args) { int[][] m = { { 1, 2, 3, 4}, { 5, 6, 7,8 }, { 9, 10,11, 12 }, {13,14,15,16} }; rotate(m, 4); } public static void rotate(int[][] m, int n) { for (int layer = 0; layer < n / 2; layer++) { int first = layer; int last = n - 1 - layer; for (int i=first; i <last; i++){ int offset = i - first; int top = m[first][i]; m[first][i]= m[last-offset][first]; m[last-offset][first] = m[last][last-offset]; m[last][last-offset] = m[i][last]; m[i][last] =top; } } } }
true
990697bbbc21ea62e529a8978df3544918cafab5
Java
veer23/TaxiSharingApp
/src/main/java/com/kumarvir/dev/service/DriverServiceImpl.java
UTF-8
3,291
2.625
3
[]
no_license
package com.kumarvir.dev.service; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.kumarvir.dev.controller.DriverController; import com.kumarvir.dev.model.BookRideRequest; import com.kumarvir.dev.model.BookRideResponse; import com.kumarvir.dev.model.Driver; import com.kumarvir.dev.model.Location; import com.kumarvir.dev.model.RideDetail; import com.kumarvir.dev.model.RideType; import com.kumarvir.dev.model.VehicleType; import com.kumarvir.dev.repository.DriverRepository; import com.kumarvir.dev.repository.RideRepository; @Component public class DriverServiceImpl implements DriverService { @Autowired DriverRepository driverRepo; @Autowired RideRepository rideRepo; @Autowired UserService userService; public static final Logger log = LoggerFactory.getLogger(DriverService.class); @Override public boolean addDriver(Driver driver) { driverRepo.addDriver(driver); return true; } @Override public List<Driver> getDrivers() { return driverRepo.getAllDrivers(); } @Override public BookRideResponse bookRide(BookRideRequest request) { List<Driver> driverList = driverRepo.getAllDrivers(); BookRideResponse response = new BookRideResponse(); double dist = 99999999999.0; for(Driver driver : driverList) { if(request.getRidePrefence().equals(driver.getRideType()) && request.getVehicleType().equals(driver.getVehicleType())) { double temp = Math.sqrt(Math.pow(driver.getLocation().getLatitude()-request.getSource().getLatitude(), 2) + Math.pow(driver.getLocation().getLongitude()- request.getSource().getLongitude(), 2)); //log.error("Value of temp "+temp); if(temp<=dist) { response.setDriverDetail(driver); log.info("source : "+request.getSource().getLatitude()+" dest : "+request.getDestination().getLatitude()); double fare = calculateFare(request.getSource(), request.getDestination(), request.getVehicleType(), request.getRidePrefence()); response.setFare(fare); } } } RideDetail ride = new RideDetail(response, userService.getUser(request.getUserid()).getUserid()); rideRepo.addRide(ride); return response; } private double calculateFare(Location source, Location dest, VehicleType vehicle, RideType ride) { double vehicleFactor = 1.0; if(vehicle.equals(VehicleType.MINI)) { vehicleFactor = 2.0; }else if(vehicle.equals(VehicleType.SEDAN)) { vehicleFactor = 3.0; }else if(vehicle.equals(VehicleType.LUXURY)) { vehicleFactor = 5.0; } double rideFactor = 1.0; if(ride.equals(RideType.GO)) { rideFactor = 2.0; }else if(ride.equals(RideType.HIRE)) { rideFactor = 2.0; }else if(ride.equals(RideType.PREMIUM)) { rideFactor = 5.0; } return rideFactor*vehicleFactor*Math.sqrt(Math.pow(source.getLatitude()-dest.getLatitude(), 2) + Math.pow(source.getLongitude()-dest.getLongitude(), 2))*10; } @Override public Driver getDriver(int id) { return driverRepo.getDriver(id); } @Override public List<RideDetail> getRidesByDriver(int id) { Driver driver = driverRepo.getDriver(id); log.info(driver.toString()); return rideRepo.getRideByDriver(driver); } }
true
0926b310bb17baebaeac089e36aa66e8fc8ae35b
Java
gaofeng4623/spring
/aop/src/test/java/test/bean/SmallDog.java
UTF-8
289
2.515625
3
[]
no_license
package test.bean; public class SmallDog{ public void testDog() { System.out.println("SmallDog.testDog()"); } public String toRun() { System.out.println("SmallDog.toRun()"); return "欢乐的奔跑"; } public void toTest() { System.out.println("SmallDog.toTest()"); } }
true
4a742c2f690f7ade4611fbe47d16588f39b18a2a
Java
nylecm/TicTacToe
/src/GridPositionButton.java
UTF-8
705
3.375
3
[ "MIT" ]
permissive
import javax.swing.*; import java.awt.*; /** * <b>File Name: </b> <p>GridPositionButton.java</p> * <b>Description: </b> * <p> * A JButton subclass that is used in a tic tac toe grid. * </p> * * @author nylecm */ class GridPositionButton extends JButton { private static final int BUTTON_TEXT_SIZE = 40; /** * Instantiates a new grid position button object setting text to grid * position number, and setting the buttons font. * * @param gridPosition the grid position that the button represents. */ GridPositionButton(Integer gridPosition) { setText(gridPosition.toString()); setFont(new Font("Ariel", Font.PLAIN, BUTTON_TEXT_SIZE)); } }
true
560800d2d8a1b9a867d819a24544f32202027d0c
Java
ninofelino11/felinodartmedia
/src/main/java/com/cware/back/entity/table/Treceiptsbank.java
UTF-8
3,291
1.789063
2
[]
no_license
package com.cware.back.entity.table; import com.cware.back.common.BaseEntity; /** * 입금은행 * * @version 1.0, 2006/07/07 * @author Commerceware Ins. */ public class Treceiptsbank extends BaseEntity { public Treceiptsbank(){ super();} private String bank_code; private String bank_seq; private String bank_name; private String bank_deposit_no; private String bank_addr; private String bank_branch; private String bank_man_name; private String bank_man_ddd; private String bank_man_tel1; private String bank_man_tel2; private String bank_man_tel3; private String vaccount_yn; private String use_yn; private String remark; private String type; private String insert_date; private String insert_id; /** Set Method **/ public void setBank_code( String bank_code ){ this.bank_code = bank_code; } public void setBank_seq( String bank_seq ){ this.bank_seq = bank_seq; } public void setBank_name( String bank_name ){ this.bank_name = bank_name; } public void setBank_deposit_no( String bank_deposit_no ){ this.bank_deposit_no = bank_deposit_no; } public void setBank_addr( String bank_addr ){ this.bank_addr = bank_addr; } public void setBank_branch( String bank_branch ){ this.bank_branch = bank_branch; } public void setBank_man_name( String bank_man_name ){ this.bank_man_name = bank_man_name; } public void setBank_man_ddd( String bank_man_ddd ){ this.bank_man_ddd = bank_man_ddd; } public void setBank_man_tel1( String bank_man_tel1 ){ this.bank_man_tel1 = bank_man_tel1; } public void setBank_man_tel2( String bank_man_tel2 ){ this.bank_man_tel2 = bank_man_tel2; } public void setBank_man_tel3( String bank_man_tel3 ){ this.bank_man_tel3 = bank_man_tel3; } public void setVaccount_yn( String vaccount_yn ){ this.vaccount_yn = vaccount_yn; } public void setUse_yn( String use_yn ){ this.use_yn = use_yn; } public void setRemark( String remark ){ this.remark = remark; } public void setType( String type ){ this.type = type; } public void setInsert_date( String insert_date ){ this.insert_date = insert_date; } public void setInsert_id( String insert_id ){ this.insert_id = insert_id; } /** Get Method **/ public String getBank_code(){ return bank_code; } public String getBank_seq(){ return bank_seq; } public String getBank_name(){ return bank_name; } public String getBank_deposit_no(){ return bank_deposit_no; } public String getBank_addr(){ return bank_addr; } public String getBank_branch(){ return bank_branch; } public String getBank_man_name(){ return bank_man_name; } public String getBank_man_ddd(){ return bank_man_ddd; } public String getBank_man_tel1(){ return bank_man_tel1; } public String getBank_man_tel2(){ return bank_man_tel2; } public String getBank_man_tel3(){ return bank_man_tel3; } public String getVaccount_yn(){ return vaccount_yn; } public String getUse_yn(){ return use_yn; } public String getRemark(){ return remark; } public String getType(){ return type; } public String getInsert_date(){ return insert_date; } public String getInsert_id(){ return insert_id; } }
true
f6fd9c9b68a0fd8d4a6387f5eefa4c3c291a74a8
Java
liuxianzhong/ruoyi-vue-pro
/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java
UTF-8
2,595
2.078125
2
[ "MIT" ]
permissive
package cn.iocoder.dashboard.modules.system.controller.logger; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO; import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert; import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @Api(tags = "登陆日志") @RestController @RequestMapping("/system/login-log") public class SysLoginLogController { @Resource private SysLoginLogService loginLogService; @ApiOperation("获得登陆日志分页列表") @GetMapping("/page") // @PreAuthorize("@ss.hasPermi('system:login-log:query')") public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Validated SysLoginLogPageReqVO reqVO) { PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO); return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); } @ApiOperation("导出登陆日志 Excel") @GetMapping("/export") // @Log(title = "登录日志", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException { List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO); // 拼接数据 List<SysLoginLogExcelVO> excelDataList = SysLoginLogConvert.INSTANCE.convertList(list); // 输出 ExcelUtils.write(response, "登陆日志.xls", "数据列表", SysLoginLogExcelVO.class, excelDataList); } }
true
260f5c36424f32509c5f28948f673cc7f60a9fac
Java
cha63506/CompSecurity
/lyft-source/src/com/google/android/gms/wearable/internal/zze.java
UTF-8
4,114
1.875
2
[]
no_license
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.android.gms.wearable.internal; import android.os.Parcel; import com.google.android.gms.common.internal.safeparcel.zza; import com.google.android.gms.common.internal.safeparcel.zzb; // Referenced classes of package com.google.android.gms.wearable.internal: // AncsNotificationParcelable public class zze implements android.os.Parcelable.Creator { public zze() { } static void a(AncsNotificationParcelable ancsnotificationparcelable, Parcel parcel, int i) { i = zzb.a(parcel); zzb.a(parcel, 1, ancsnotificationparcelable.a); zzb.a(parcel, 2, ancsnotificationparcelable.a()); zzb.a(parcel, 3, ancsnotificationparcelable.b(), false); zzb.a(parcel, 4, ancsnotificationparcelable.c(), false); zzb.a(parcel, 5, ancsnotificationparcelable.d(), false); zzb.a(parcel, 6, ancsnotificationparcelable.e(), false); zzb.a(parcel, 7, ancsnotificationparcelable.f(), false); zzb.a(parcel, 8, ancsnotificationparcelable.g(), false); zzb.a(parcel, 9, ancsnotificationparcelable.h()); zzb.a(parcel, 10, ancsnotificationparcelable.i()); zzb.a(parcel, 11, ancsnotificationparcelable.j()); zzb.a(parcel, 12, ancsnotificationparcelable.k()); zzb.a(parcel, i); } public AncsNotificationParcelable a(Parcel parcel) { int k = zza.b(parcel); int j = 0; int i = 0; String s5 = null; String s4 = null; String s3 = null; String s2 = null; String s1 = null; String s = null; byte byte3 = 0; byte byte2 = 0; byte byte1 = 0; byte byte0 = 0; do { if (parcel.dataPosition() < k) { int l = zza.a(parcel); switch (zza.a(l)) { default: zza.b(parcel, l); break; case 1: // '\001' j = zza.f(parcel, l); break; case 2: // '\002' i = zza.f(parcel, l); break; case 3: // '\003' s5 = zza.m(parcel, l); break; case 4: // '\004' s4 = zza.m(parcel, l); break; case 5: // '\005' s3 = zza.m(parcel, l); break; case 6: // '\006' s2 = zza.m(parcel, l); break; case 7: // '\007' s1 = zza.m(parcel, l); break; case 8: // '\b' s = zza.m(parcel, l); break; case 9: // '\t' byte3 = zza.d(parcel, l); break; case 10: // '\n' byte2 = zza.d(parcel, l); break; case 11: // '\013' byte1 = zza.d(parcel, l); break; case 12: // '\f' byte0 = zza.d(parcel, l); break; } } else if (parcel.dataPosition() != k) { throw new com.google.android.gms.common.internal.safeparcel.zza.zza((new StringBuilder()).append("Overread allowed size end=").append(k).toString(), parcel); } else { return new AncsNotificationParcelable(j, i, s5, s4, s3, s2, s1, s, byte3, byte2, byte1, byte0); } } while (true); } public AncsNotificationParcelable[] a(int i) { return new AncsNotificationParcelable[i]; } public Object createFromParcel(Parcel parcel) { return a(parcel); } public Object[] newArray(int i) { return a(i); } }
true
074a89d8d48bc232f8f553be75dbd89f55dae3d8
Java
dyhimos/jinshuo-mall
/jinshuo-service/src/main/java/com/jinshuo/mall/service/user/application/dto/WxConfigDto.java
UTF-8
970
1.6875
2
[]
no_license
package com.jinshuo.mall.service.user.application.dto; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * 微信返回前端信息表 */ @Data @AllArgsConstructor @NoArgsConstructor public class WxConfigDto { /** * 公众号的 appid */ @ApiModelProperty(value = "appid") private String appid; /** * 服务方的 appid */ @ApiModelProperty(value = "component_appid") private String component_appid; @ApiModelProperty(value = "type 0:商家 1:渠道商") private Integer type; @ApiModelProperty(value = "shopName") private String shopName; @ApiModelProperty(value = "logo") private String logo; @ApiModelProperty(value = "linkMan") private String linkMan; @ApiModelProperty(value = "phone") private String phone; @ApiModelProperty(value = "sketch") private String sketch; }
true
f5bb54e6fe2f55c3a9da2b1943665c4d74a40c48
Java
zhongxingyu/Seer
/Diff-Raw-Data/18/18_cdc4eb20f95ddef3f9b3bdb2a908e84da198551d/BaseModelerWorkspaceHelper/18_cdc4eb20f95ddef3f9b3bdb2a908e84da198551d_BaseModelerWorkspaceHelper_t.java
UTF-8
9,734
1.765625
2
[]
no_license
package org.pentaho.agilebi.modeler; import org.pentaho.agilebi.modeler.nodes.*; import org.pentaho.metadata.model.Category; import org.pentaho.metadata.model.Domain; import org.pentaho.metadata.model.LogicalColumn; import org.pentaho.metadata.model.LogicalModel; import org.pentaho.metadata.model.LogicalTable; import org.pentaho.metadata.model.concept.IConcept; import org.pentaho.metadata.model.concept.types.AggregationType; import org.pentaho.metadata.model.concept.types.DataType; import org.pentaho.metadata.model.concept.types.LocalizedString; import org.pentaho.metadata.model.olap.OlapCube; import org.pentaho.metadata.model.olap.OlapDimension; import org.pentaho.metadata.model.olap.OlapDimensionUsage; import org.pentaho.metadata.model.olap.OlapHierarchy; import org.pentaho.metadata.model.olap.OlapHierarchyLevel; import org.pentaho.metadata.model.olap.OlapMeasure; import java.util.ArrayList; import java.util.List; /** * User: nbaker * Date: Jul 16, 2010 */ public abstract class BaseModelerWorkspaceHelper implements IModelerWorkspaceHelper{ private static final List<AggregationType> DEFAULT_AGGREGATION_LIST = new ArrayList<AggregationType>(); private static final List<AggregationType> DEFAULT_NON_NUMERIC_AGGREGATION_LIST = new ArrayList<AggregationType>(); private static String locale; public static final String OLAP_SUFFIX = "_OLAP"; static { DEFAULT_AGGREGATION_LIST.add(AggregationType.NONE); DEFAULT_AGGREGATION_LIST.add(AggregationType.SUM); DEFAULT_AGGREGATION_LIST.add(AggregationType.AVERAGE); DEFAULT_AGGREGATION_LIST.add(AggregationType.MINIMUM); DEFAULT_AGGREGATION_LIST.add(AggregationType.MAXIMUM); DEFAULT_AGGREGATION_LIST.add(AggregationType.COUNT); DEFAULT_AGGREGATION_LIST.add(AggregationType.COUNT_DISTINCT); DEFAULT_NON_NUMERIC_AGGREGATION_LIST.add(AggregationType.NONE); DEFAULT_NON_NUMERIC_AGGREGATION_LIST.add(AggregationType.COUNT); DEFAULT_NON_NUMERIC_AGGREGATION_LIST.add(AggregationType.COUNT_DISTINCT); } public BaseModelerWorkspaceHelper(String locale){ BaseModelerWorkspaceHelper.locale = locale; } public void populateDomain(ModelerWorkspace model) throws ModelerException { Domain domain = model.getDomain(); domain.setId( model.getModelName() ); LogicalTable logicalTable = domain.getLogicalModels().get(0).getLogicalTables().get(0); if (model.getModelSource() != null) { model.getModelSource().serializeIntoDomain(domain); } LogicalModel logicalModel = domain.getLogicalModels().get(0); logicalModel.setId("MODEL_1"); logicalModel.setName( new LocalizedString(locale, model.getModelName() ) ); populateCategories(model); // =========================== OLAP ===================================== // List<OlapDimensionUsage> usages = new ArrayList<OlapDimensionUsage>(); List<OlapDimension> olapDimensions = new ArrayList<OlapDimension>(); List<OlapMeasure> measures = new ArrayList<OlapMeasure>(); for (DimensionMetaData dim : model.getModel().getDimensions()) { OlapDimension dimension = new OlapDimension(); String dimTitle = dim.getName(); dimension.setName(dimTitle); dimension.setTimeDimension(dim.isTime()); List<OlapHierarchy> hierarchies = new ArrayList<OlapHierarchy>(); for (HierarchyMetaData hier : dim) { OlapHierarchy hierarchy = new OlapHierarchy(dimension); hierarchy.setName(hier.getName()); hierarchy.setLogicalTable(logicalTable); List<OlapHierarchyLevel> levels = new ArrayList<OlapHierarchyLevel>(); for (LevelMetaData lvl : hier) { OlapHierarchyLevel level = new OlapHierarchyLevel(hierarchy); level.setName(lvl.getName()); if (lvl.getLogicalColumn() != null) { LogicalColumn lvlColumn = logicalModel.findLogicalColumn(lvl.getLogicalColumn().getId()); level.setReferenceColumn(lvlColumn); } level.setHavingUniqueMembers(lvl.isUniqueMembers()); levels.add(level); } hierarchy.setHierarchyLevels(levels); hierarchies.add(hierarchy); } if(hierarchies.isEmpty()) { // create a default hierarchy OlapHierarchy defaultHierarchy = new OlapHierarchy(dimension); defaultHierarchy.setLogicalTable(logicalTable); hierarchies.add(defaultHierarchy); } dimension.setHierarchies(hierarchies); olapDimensions.add(dimension); OlapDimensionUsage usage = new OlapDimensionUsage(dimension.getName(), dimension); usages.add(usage); } OlapCube cube = new OlapCube(); cube.setLogicalTable(logicalTable); // TODO find a better way to generate default names //cube.setName( BaseMessages.getString(ModelerWorkspaceUtil.class, "ModelerWorkspaceUtil.Populate.CubeName", model.getModelName() ) ); //$NON-NLS-1$ cube.setName( model.getModelName() ); //$NON-NLS-1$ cube.setOlapDimensionUsages(usages); for (MeasureMetaData f : model.getModel().getMeasures()) { OlapMeasure measure = new OlapMeasure(); if (f.getAggTypeDesc() != null) { f.getLogicalColumn().setAggregationType(AggregationType.valueOf(f.getAggTypeDesc())); } measure.setLogicalColumn(f.getLogicalColumn()); measures.add(measure); } cube.setOlapMeasures(measures); LogicalModel lModel = domain.getLogicalModels().get(0); if (olapDimensions.size() > 0) { // Metadata OLAP generator doesn't like empty lists. lModel.setProperty("olap_dimensions", olapDimensions); //$NON-NLS-1$ } List<OlapCube> cubes = new ArrayList<OlapCube>(); cubes.add(cube); lModel.setProperty("olap_cubes", cubes); //$NON-NLS-1$ } public static final String uniquify(final String id, final List<? extends IConcept> concepts) { boolean gotNew = false; boolean found = false; int conceptNr = 1; String newId = id; while (!gotNew) { for (IConcept concept : concepts) { if (concept.getId().equalsIgnoreCase(newId)) { found = true; break; } } if (found) { conceptNr++; newId = id + "_" + conceptNr; //$NON-NLS-1$ found = false; }else{ gotNew = true; } } return newId; } public String getLocale() { return locale; } public void setLocale(String locale) { BaseModelerWorkspaceHelper.locale = locale; } protected void populateCategories(ModelerWorkspace workspace) { RelationalModelNode model = workspace.getRelationalModel(); LogicalModel logicalModel = workspace.getDomain().getLogicalModels().get(0); logicalModel.getCategories().clear(); for (CategoryMetaData catMeta : model.getCategories()) { Category cat = new Category(); cat.setName(new LocalizedString(this.getLocale(), catMeta.getName())); cat.setId(catMeta.getName()); for (FieldMetaData fieldMeta : catMeta) { LogicalColumn lCol = fieldMeta.getLogicalColumn(); lCol.setName(new LocalizedString(locale, fieldMeta.getName())); AggregationType type = AggregationType.valueOf(fieldMeta.getAggTypeDesc()); lCol.setAggregationType(type); String formatMask = fieldMeta.getFormat(); if( BaseAggregationMetaDataNode.FORMAT_NONE.equals(formatMask) || (formatMask == null || formatMask.equals(""))) { formatMask = null; } if (formatMask != null) { lCol.setProperty("mask", formatMask); //$NON-NLS-1$ } else if(lCol.getDataType() == DataType.NUMERIC){ lCol.setProperty("mask", "#"); } else { // remove old mask that might have been set if (lCol.getChildProperty("mask") != null) { //$NON-NLS-1$ lCol.removeChildProperty("mask"); //$NON-NLS-1$ } } if (lCol.getDataType() != DataType.NUMERIC) { lCol.setAggregationList(DEFAULT_NON_NUMERIC_AGGREGATION_LIST); } else { lCol.setAggregationList(DEFAULT_AGGREGATION_LIST); } cat.addLogicalColumn(lCol); } logicalModel.addCategory(cat); } } public static String getCorrespondingOlapColumnId(LogicalColumn lc) { String tableId = lc.getLogicalTable().getId().replaceAll("BT", "LC"); String olapColId = tableId + OLAP_SUFFIX + "_" + lc.getPhysicalColumn().getId(); return olapColId; } public static void duplicateLogicalTablesForDualModelingMode(LogicalModel model) { String locale = "en-US"; int tableCount = model.getLogicalTables().size(); for (int i = 0; i < tableCount; i++) { LogicalTable table = model.getLogicalTables().get(i); LogicalTable copiedTable = (LogicalTable) table.clone(); copiedTable.setId(copiedTable.getId() + BaseModelerWorkspaceHelper.OLAP_SUFFIX); // clone of LogicalTable does not clone it's columns, so we must do that here copiedTable.getLogicalColumns().clear(); for(LogicalColumn lc : table.getLogicalColumns()) { LogicalColumn copiedColumn = (LogicalColumn)lc.clone(); copiedColumn.setId(BaseModelerWorkspaceHelper.getCorrespondingOlapColumnId(lc)); copiedColumn.setLogicalTable(copiedTable); copiedTable.addLogicalColumn(copiedColumn); } model.addLogicalTable(copiedTable); } } }
true
e1d6398a74ee099b329b139fdb3f95f8a4f74d69
Java
Simon-Lau/java_webApp
/src/cn/edu/hit/dao/BlacklistDAO.java
UTF-8
1,880
2.71875
3
[]
no_license
package cn.edu.hit.dao; import net.sf.json.JSONObject; import tools.db.DataDAO; public class BlacklistDAO { /** * 将用户加入黑名单 * @param uid * @return */ public int insertBlacklist(String uid) { JSONObject result = new JSONObject(); DataDAO dd = new DataDAO(); String insertBlacklistSql = "insert into blacklist set uid=?;"; try { result = dd.update("插入日志", insertBlacklistSql, uid); } catch (Exception e) { e.printStackTrace(); } return (Integer)result.get("resultflag"); } /** * 增加举报次数 * @param uid * @return */ public int addReportNum(String uid){ JSONObject result = new JSONObject(); String addReportNumSql = "update blacklist set " + "reportnum=reportnum+1 where uid=?"; DataDAO dd = new DataDAO(); try { result = dd.update("增加举报次数userid="+uid, addReportNumSql, uid); } catch (Exception e) { e.printStackTrace(); } return (Integer)result.get("resultflag"); } /** * 将用户移出黑名单 * @param uid * @return */ public int deleteBlacklist(String uid) { JSONObject result = new JSONObject(); DataDAO dd = new DataDAO(); String deleteBlacklistSql = "delete from blacklist where uid=?"; try { result = dd.update("删除用户userid="+uid, deleteBlacklistSql, uid); } catch (Exception e) { e.printStackTrace(); } return (Integer)result.get("resultflag"); } public static void main(String[] args) { // TODO Auto-generated method stub BlacklistDAO b = new BlacklistDAO(); //测试getDepartmentLogs(),已测试 // System.out.println("getDepartmentLogs(): " + u.getUserById("1")); //测试saveReview,已测试 // System.out.println("addReportNum(): "+b.addReportNum("3")); System.out.println("insertBlacklist(): " + b.insertBlacklist("1")); // System.out.println("deleteBlacklist(): " + b.deleteBlacklist("6")); } }
true
52f69798b5b5cdc996b4cb3f6000f466d478c3ed
Java
panoslep/java_fundamentals
/src/labs_examples/objects_classes_methods/labs/objects/Exercise_02.java
UTF-8
1,025
3.296875
3
[]
no_license
package labs_examples.objects_classes_methods.labs.objects; public class Exercise_02 { public static void main(String[]args){ Player messi = new Player("Lionel Messi", "Argentine", 33,"SS"); Team barcelona = new Team("Barcelona FC", "blue/red", "La Liga"); System.out.println(messi.name + " is a " + messi.age + " yo "+ messi.nationality + " footballer who plays in "+barcelona.league+ " for "+ barcelona.teamName+"."); } } class Player { String name; String nationality; int age; String position; public Player(String name, String nationality, int age, String position){ this.name = name; this.nationality = nationality; this.age = age; this.position = position; } } class Team { String teamName; String jerseyColours; String league; public Team(String teamName, String jerseyColours, String league) { this.teamName = teamName; this.jerseyColours = jerseyColours; this.league = league; } }
true
05b7d299a7e1585e98f5947a7cc969c732ad9c07
Java
mrthetkhine/TuringSwingJDBC
/src/secondbatch/TabPaneForm.java
UTF-8
9,421
2.140625
2
[]
no_license
/* * 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 secondbatch; import javax.swing.JOptionPane; /** * * @author thetkhine */ public class TabPaneForm extends javax.swing.JFrame { /** * Creates new form TabPaneForm */ public TabPaneForm() { initComponents(); } /** * 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(); jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jButton2 = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); mnuOpen = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); mnuInputDialog = new javax.swing.JMenuItem(); mnuConfirmDialog = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTabbedPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Process")); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jButton1.setText("Sale"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(61, 61, 61) .addComponent(jButton1) .addContainerGap(302, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(79, 79, 79) .addComponent(jButton1) .addContainerGap(226, Short.MAX_VALUE)) ); jTabbedPane1.addTab("SaleTab", jPanel1); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jButton2.setText("Order"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(200, Short.MAX_VALUE) .addComponent(jButton2) .addGap(159, 159, 159)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jButton2) .addContainerGap(287, Short.MAX_VALUE)) ); jTabbedPane1.addTab("OrderTab", jPanel2); jMenu1.setText("File"); mnuOpen.setText("Open"); mnuOpen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnuOpenActionPerformed(evt); } }); jMenu1.add(mnuOpen); jMenuItem2.setText("Exit"); jMenu1.add(jMenuItem2); jMenu3.setText("Dialog"); mnuInputDialog.setText("InputDialog"); mnuInputDialog.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnuInputDialogActionPerformed(evt); } }); jMenu3.add(mnuInputDialog); mnuConfirmDialog.setText("Confirm"); mnuConfirmDialog.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnuConfirmDialogActionPerformed(evt); } }); jMenu3.add(mnuConfirmDialog); jMenu1.add(jMenu3); jMenuBar1.add(jMenu1); jMenu2.setText("Edit"); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 475, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(53, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING) ); pack(); }// </editor-fold>//GEN-END:initComponents private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuOpenActionPerformed {//GEN-HEADEREND:event_mnuOpenActionPerformed // TODO add your handling code here: }//GEN-LAST:event_mnuOpenActionPerformed private void mnuConfirmDialogActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuConfirmDialogActionPerformed {//GEN-HEADEREND:event_mnuConfirmDialogActionPerformed // TODO add your handling code here: int result = JOptionPane.showConfirmDialog(null, "Confirm","Are you sure",JOptionPane.YES_NO_OPTION); if( result == JOptionPane.YES_OPTION) { JOptionPane.showMessageDialog(null, "Yes"); } else { JOptionPane.showMessageDialog(null, "No"); } }//GEN-LAST:event_mnuConfirmDialogActionPerformed private void mnuInputDialogActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuInputDialogActionPerformed {//GEN-HEADEREND:event_mnuInputDialogActionPerformed // TODO add your handling code here: String data = JOptionPane.showInputDialog("Enter something"); JOptionPane.showMessageDialog(null, data); }//GEN-LAST:event_mnuInputDialogActionPerformed /** * @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(TabPaneForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TabPaneForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TabPaneForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TabPaneForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TabPaneForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JMenuItem mnuConfirmDialog; private javax.swing.JMenuItem mnuInputDialog; private javax.swing.JMenuItem mnuOpen; // End of variables declaration//GEN-END:variables }
true
49792f833ac78a1a8ac954799d48bcc04764ec82
Java
willwill1101/hbase
/src/test/java/hbase/Main.java
UTF-8
2,560
2.265625
2
[]
no_license
package hbase; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import java.net.URL; import java.util.Iterator; import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; import org.junit.After; import org.junit.Before; import org.junit.Test; public class Main { private static Connection conn = null; private static HTable table = null; @Before public void init() throws IOException { System.setProperty("hadoop.home.dir", "C:\\hadoop-common-2.2.0-bin-master"); Configuration conf = HBaseConfiguration.create(); conf.set("hbase.zookeeper.quorum", "10.150.27.219:2181,10.150.27.223:2181"); conn = ConnectionFactory.createConnection(conf); table = (HTable) conn.getTable(TableName.valueOf("test")); } @Test public void get() throws IOException { Get get = new Get(Bytes.toBytes("row1")); Result result = table.get(get); byte[] bs = result.getValue(Bytes.toBytes("cf"), Bytes.toBytes("cf1")); System.out.println(Bytes.toString(bs)); } @Test public void scan() throws IOException { Scan scan = new Scan(Bytes.toBytes("row1"), Bytes.toBytes("row2")); ResultScanner results = table.getScanner(scan); Iterator<Result> rs = results.iterator(); while (rs.hasNext()) { byte[] bs = rs.next().getValue(Bytes.toBytes("cf"), Bytes.toBytes("cf1")); System.out.println(Bytes.toString(bs)); } } @After public void clear() throws IOException { conn.close(); } public static void main(String[] args) throws IOException, URISyntaxException { String path = "http://c.hiphotos.baidu.com/image/pic/item/f3d3572c11dfa9ec78e256df60d0f703908fc12e.jpg"; URL u = new URL(path); InputStream input =u.openStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(input, out); input.close(); String s = Bytes.toStringBinary(out.toByteArray()); out.close(); //s=Bytes.toString(Bytes.toBytesBinary(s)); System.out.println(s); } }
true
1a191de920fc34dc1c0cb07e11137120356f0371
Java
nayaguiar/SistemaVenda
/src/Beans/ClienteB.java
UTF-8
1,340
2.453125
2
[]
no_license
package Beans; public class ClienteB { private int cod_cliente; private String nome_cliente; private String cpf; private String endereco; private String telefone; private String nascimento; public int getCod_cliente() { return cod_cliente; } public void setCod_cliente(int cod_cliente) { this.cod_cliente = cod_cliente; } public String getNome_cliente() { return nome_cliente; } public void setNome_cliente(String nome_cliente) { this.nome_cliente = nome_cliente; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public String getEndereco() { return endereco; } public void setEndereco(String endereco) { this.endereco = endereco; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public String getNascimento() { return nascimento; } public void setNascimento(String nasciemnto) { this.nascimento = nasciemnto; } public void create() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
true
8100099dea30ae2e6e1416d7522585d8f16de8d1
Java
xxxuxonezero/Problem
/src/cn/onezero/services/PageImpl.java
UTF-8
1,775
2.15625
2
[]
no_license
package cn.onezero.services; import cn.onezero.Dao.PageDao; import cn.onezero.domain.Page; import cn.onezero.domain.QuestionChoice; import cn.onezero.domain.QuestionZG; import java.util.List; public class PageImpl { private PageDao pd=new PageDao(); /** *获取选择题当前页的数据 * @param course_id * @param currentPage * @param pageSize * @return */ public Page queryPage(int course_id,int user_id,int currentPage,int pageSize){ Page p=new Page(); p.setCurrentPage(currentPage); p.setPageSize(pageSize); int totalCount=pd.getTotalCount(course_id); p.setTotalCount(totalCount); int begin=(currentPage-1)*pageSize; int totalPage=totalCount%pageSize==0 ? totalCount/pageSize:(totalCount/pageSize)+1; p.setTotalPage(totalPage); List<QuestionChoice> queryPage = pd.getQueryPage(course_id,user_id,begin, pageSize); p.setList(queryPage); return p; } /** * 获取客观题当前页的数据 * @param course_id * @param type_id * @param currentPage * @param pageSize * @return */ public Page queryPage(int course_id,int type_id,int user_id,int currentPage,int pageSize){ Page p=new Page(); p.setCurrentPage(currentPage); p.setPageSize(pageSize); int totalCount=pd.getTotalCount(course_id,type_id); p.setTotalCount(totalCount); int begin=(currentPage-1)*pageSize; int totalPage=totalCount%pageSize==0 ? totalCount/pageSize:(totalCount/pageSize)+1; p.setTotalPage(totalPage); List<QuestionZG> queryPage = pd.getQueryPage(course_id, type_id,user_id,begin, pageSize); p.setList(queryPage); return p; } }
true
d83de6b2ca1dab1271031d98eafaaa98a1124e36
Java
ansonvarghese/MediPharm-1
/app/src/main/java/com/zibbix/hospital/medipharm/ViewActivity.java
UTF-8
2,035
1.953125
2
[]
no_license
package com.zibbix.hospital.medipharm; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class ViewActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view); final String appointID = getIntent().getExtras().getString("appointID"); final TextView pres = (TextView) findViewById(R.id.presct); DatabaseReference databaseRefConsultpres = FirebaseDatabase.getInstance().getReference().child("Consultation").child(appointID).child("Prescriptiton"); databaseRefConsultpres.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { pres.setText(dataSnapshot.getValue().toString()); } @Override public void onCancelled(DatabaseError databaseError) { } }); final EditText cash = findViewById(R.id.cash); Button proceed = (Button)findViewById(R.id.Proceed); proceed.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Toast.makeText(ViewActivity.this, cash.getText(), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(ViewActivity.this,QRActivity.class); intent.putExtra("cash", cash.getText().toString()); startActivity(intent); } }); } }
true
9d5150d386d2a62177dcc5a18edd3af7e849b32d
Java
Vygovsky/homework
/src/lesson5_6/task4/Massiv2D.java
UTF-8
240
2.203125
2
[]
no_license
package lesson5_6.task4; /** * Created by roman_v on 16.05.17. */ public class Massiv2D { public static void main(String[] args) { MyMassiv m = new MyMassiv(); m.setArrayMinMax(); m.printArreyMinMax(); } }
true
bb1aa55fd24c884f19376c7a83d843e0d3981bf1
Java
vitakras/Habits
/app/src/main/java/com/example/vitaliy/habits/Interfaces/IDatabaseHabits.java
UTF-8
947
2.59375
3
[]
no_license
package com.example.vitaliy.habits.Interfaces; import java.util.List; /** * Created by Vitaliy on 15-06-15. */ public interface IDataBaseHabits { /** * Add a new habit into the db * @param habit habit to add * @return id of the new habit */ public long addHabit(IHabit habit); /** * update an existing habit in the db * @param habit habit to update * @return id of the updated habit */ public long updateHabit(IHabit habit); /** * Returns the habit based on its ID * @param id the id of the habit * @return Habit */ public IHabit getHabit(int id); /** * Returns a List of all the habbits in the db * @return */ public List<IHabit> getAllHabits(); /** * Deletes a habit from the db * @param id of the habit you are trying to delete * @return id of the deleted habit */ public int deleteHabit(int id); }
true
127a826a2e4f00b8a8d7d83b155b5edf791ba55a
Java
avikj/USACO-Solutions
/Feb 2016/FencedIn.java
UTF-8
2,615
3.125
3
[]
no_license
import java.util.*; import java.io.File; import java.io.PrintWriter; import java.io.FileNotFoundException; public class FencedIn{ public static void main(String[] args) throws Exception{ Scanner in = new Scanner(new File("fencedin.in")); int A = in.nextInt(); int B = in.nextInt(); int n = in.nextInt(); int m = in.nextInt(); int[] a = new int[n+2]; int[] b = new int[m+2]; a[0] = 0; b[0] = 0; for(int i = 1; i < n+1; i++) a[i] = in.nextInt(); for(int i = 1; i < m+1; i++) b[i] = in.nextInt(); a[n+1] = A; b[m+1] = B; ArrayList<Edge> allEdges = new ArrayList<Edge>(); ArrayList<Edge> treeEdges = new ArrayList<Edge>(); ArrayList<Node> allNodes = new ArrayList<Node>(); ArrayList<Node> containedNodes = new ArrayList<Node>(); for(int i = 0; i < n+1; i++){ for(int j = 0; j < m+1; j++){ allNodes.add(new Node(i, j)); } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ allEdges.add(new Edge(new Node(i, j), new Node(i+1, j), b[j+1]-b[j])); allEdges.add(new Edge(new Node(i, j), new Node(i, j+1), a[i+1]-a[i])); } } for(int i = 0; i < n; i++){ allEdges.add(new Edge(new Node(i, m), new Node(i+1, m), b[m+1]-b[m])); } for(int j = 0; j < m; j++){ allEdges.add(new Edge(new Node(n, j), new Node(n, j+1), a[n+1]-a[n])); } long result = 0; Collections.sort(allEdges); for(int i = 0; i < allEdges.size(); i++){ if(!containedNodes.contains(allEdges.get(i).a) || !containedNodes.contains(allEdges.get(i).b)){ treeEdges.add(allEdges.get(i)); containedNodes.add(allEdges.get(i).a); containedNodes.add(allEdges.get(i).a); } } for(Edge e : treeEdges){ result+=e.weight; } PrintWriter out = new PrintWriter("fencedin.out"); out.print(result);out.close(); } } class Node{ public int i; public int j; public Node(int a, int b){ i = a; j = b; } public boolean equals(Node n){ return i==n.i && j==n.j; } } class Edge implements Comparable<Edge>{ public Node a; public Node b; int weight; public Edge(Node x, Node y, int w){ a = x; b = y; weight = w; } public int compareTo(Edge e){ return weight-e.weight; } }
true
909c98e65900dd57410b892f2fe67eeb0c8d2bcb
Java
satishjs2297/local-admin-right-hub-repo
/local-admin-dao/src/main/java/com/alti/local/admin/dao/model/pk/TicketIdGenerator.java
UTF-8
1,343
2.1875
2
[]
no_license
/** * */ package com.alti.local.admin.dao.model.pk; import java.io.Serializable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.SimpleDateFormat; import java.util.Date; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.IdentifierGenerator; /** * @author syandagudita * */ public class TicketIdGenerator implements IdentifierGenerator { private static final String TICKETSEQ_QUERY = "SELECT SEQUENCE.NEXTVAL('LADMIN-TICKET-SEQUENCE') AS NEXT_TCK_SEQ"; @Override public Serializable generate(SessionImplementor session, Object obj) { Connection connection = session.connection(); String currentSeq = null; int seqValue = -1; try { PreparedStatement statement = connection .prepareStatement(TICKETSEQ_QUERY); ResultSet resultSet = statement.executeQuery(); while (resultSet.next()) { seqValue = resultSet.getInt("NEXT_TCK_SEQ"); break; } System.out.println("Current Ticket Sequence ::: " + seqValue); SimpleDateFormat sDateFormat = new SimpleDateFormat("YYYYMMdd"); String dateInStr = sDateFormat.format(new Date(System .currentTimeMillis())); currentSeq = "LA" + dateInStr + String.format("%04d", seqValue); } catch (Exception ex) { ex.printStackTrace(); } return currentSeq; } }
true
8ee2bb7cba4ce2104836cf725ec1d741cc757a08
Java
sourabh-paswan/ELF-06June19-Covalense-SourabhPaswan
/CoreJava/src/com/covalense/java/doublecolon/TestAdd.java
UTF-8
261
3.15625
3
[]
no_license
/* * package com.covalense.java.doublecolon; * * public class TestAdd { static void sum(int a, int b) { int c = a+b; * System.out.println(c); } * * public static void main(String[] args) { MyMath m = TestAdd :: sum; int i * =m.add(60,8); } * * } */
true
c8698a086a94dac00c4fd09a7bdf15676d99a380
Java
whatafree/JCoffee
/benchmark/bigclonebenchdata_completed/5198625.java
UTF-8
5,292
2.4375
2
[]
no_license
import java.io.*; import java.lang.*; import java.util.*; import java.net.*; import java.applet.*; import java.security.*;import java.awt.*; class c5198625 { public static Pedido insert(Pedido objPedido) { MyHelperClass DBConnection = new MyHelperClass(); final Connection c =(Connection)(Object) DBConnection.getConnection(); PreparedStatement pst = null; int result; if (c == null) { return null; } try { c.setAutoCommit(false); String sql = ""; int idPedido; MyHelperClass PedidoDAO = new MyHelperClass(); idPedido =(int)(Object) PedidoDAO.getLastCodigo(); if (idPedido < 1) { return null; } sql = "insert into pedido " + "(id_pedido, id_funcionario,data_pedido,valor) " + "values(?,?,now(),truncate(?,2))"; pst =(PreparedStatement)(Object) c.prepareStatement(sql); pst.setInt(1, idPedido); pst.setInt(2,(int)(Object) objPedido.getFuncionario().getCodigo()); pst.setString(3, (String)(Object)new DecimalFormat("#0.00").format(objPedido.getValor())); result =(int)(Object) pst.executeUpdate(); pst = null; if (result > 0) { Iterator<ItemPedido> itItemPedido =(Iterator<ItemPedido>)(Object) (objPedido.getItemPedido()).iterator(); while ((itItemPedido != null) && (itItemPedido.hasNext())) { ItemPedido objItemPedido = (ItemPedido) itItemPedido.next(); sql = ""; sql = "insert into item_pedido " + "(id_pedido,id_produto,quantidade,subtotal) " + "values (?,?,?,truncate(?,2))"; pst =(PreparedStatement)(Object) c.prepareStatement(sql); pst.setInt(1, idPedido); pst.setInt(2,(int)(Object) (objItemPedido.getProduto()).getCodigo()); pst.setInt(3,(int)(Object) objItemPedido.getQuantidade()); pst.setString(4, (String)(Object)new DecimalFormat("#0.00").format(objItemPedido.getSubtotal())); result =(int)(Object) pst.executeUpdate(); } } pst = null; sql = ""; sql = "insert into pedido_situacao " + "(id_pedido,id_situacao, em, observacao, id_funcionario) " + "values (?,?,now(), ?, ?)"; pst =(PreparedStatement)(Object) c.prepareStatement(sql); pst.setInt(1, idPedido); pst.setInt(2, 1); pst.setString(3, "Inclus�o de pedido"); pst.setInt(4,(int)(Object) objPedido.getFuncionario().getCodigo()); result =(int)(Object) pst.executeUpdate(); pst = null; sql = ""; sql = "insert into tramitacao " + "(data_tramitacao, id_pedido, id_dep_origem, id_dep_destino) " + "values (now(),?,?, ?)"; pst =(PreparedStatement)(Object) c.prepareStatement(sql); pst.setInt(1, idPedido); pst.setInt(2, 6); pst.setInt(3, 2); result =(int)(Object) pst.executeUpdate(); c.commit(); objPedido.setCodigo(idPedido); } catch (final Exception e) { try { c.rollback(); } catch (final Exception e1) { System.out.println("[PedidoDAO.insert] Erro ao inserir -> " + e1.getMessage()); } System.out.println("[PedidoDAO.insert] Erro ao inserir -> " + e.getMessage()); } finally { // MyHelperClass DBConnection = new MyHelperClass(); DBConnection.closePreparedStatement(pst); // MyHelperClass DBConnection = new MyHelperClass(); DBConnection.closeConnection(c); } return objPedido; } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass closePreparedStatement(PreparedStatement o0){ return null; } public MyHelperClass getConnection(){ return null; } public MyHelperClass iterator(){ return null; } public MyHelperClass getCodigo(){ return null; } public MyHelperClass getLastCodigo(){ return null; } public MyHelperClass closeConnection(Connection o0){ return null; }} class Pedido { public MyHelperClass getValor(){ return null; } public MyHelperClass getItemPedido(){ return null; } public MyHelperClass getFuncionario(){ return null; } public MyHelperClass setCodigo(int o0){ return null; }} class Connection { public MyHelperClass prepareStatement(String o0){ return null; } public MyHelperClass rollback(){ return null; } public MyHelperClass setAutoCommit(boolean o0){ return null; } public MyHelperClass commit(){ return null; }} class PreparedStatement { public MyHelperClass setInt(int o0, int o1){ return null; } public MyHelperClass setString(int o0, String o1){ return null; } public MyHelperClass executeUpdate(){ return null; }} class DecimalFormat { DecimalFormat(String o0){} DecimalFormat(){} public MyHelperClass format(MyHelperClass o0){ return null; }} class ItemPedido { public MyHelperClass getProduto(){ return null; } public MyHelperClass getQuantidade(){ return null; } public MyHelperClass getSubtotal(){ return null; }}
true
3f9449c00e555b1b3d031a93701c1229eda56b71
Java
curran/portfolio
/2007/3D Graphing Calculator/CodeBase/RecursiveDescentParser/operators/RealNumberBinaryOperator.java
UTF-8
2,777
3.6875
4
[]
no_license
package operators; import parser.ExpressionNode; import parser.Value; import valueTypes.DecimalValue; import valueTypes.ErrorValue; /** * An abstract BinaryOperator which will deal exclusively with real numbers * (DecimalValue objects) as operands. It is indended to be subclassed easily to * generate custom operators. All the subclass needs to do is define a method * double evaluate(double l,double r) which performs the operation on two double * values. * * RealNumberBinaryOperator provides optimization for repeated evaluations by * having each instance hold a persistant Value which gets set to the result of * the operation and returned each time the operator is evaluated. * Alternatively, one could create new Value objects each time the operator is * evaluated, but this would put the garbage collector to work, resulting in * poor performance. * * @author Curran Kelleher * */ public abstract class RealNumberBinaryOperator extends BinaryOperator { /** * The persistant result, a memory optimization for repeated evaluations. */ DecimalValue persistantValue = new DecimalValue(0); /** * The persistant left and right values, a memory optimization for repeated evaluations. */ Value leftValue, rightValue; /** * Constructs a real number binary operator which operates on the specified left-child and right-child evaluation trees. * * @param symbol the symbol of the operator ('+' for the plus operator) This is necessary for generating informative error messages. * @param leftChild the left-child evaluation tree * @param rightChild the right-child evaluation tree */ protected RealNumberBinaryOperator(char symbol, ExpressionNode leftChild, ExpressionNode rightChild) { super(""+symbol,leftChild, rightChild); } /** * The method which evaluates the operator. * @return the resulting Value */ public Value evaluate() { leftValue = leftChild.evaluate(); rightValue = rightChild.evaluate(); try { persistantValue.value = evaluate(((DecimalValue) leftValue).value, ((DecimalValue) rightValue).value); return persistantValue; } catch (Exception e) { return new ErrorValue("'" + symbol + "' is not a valid operator for the types " + leftValue.getType() + " and " + rightValue.getType() + ", so " + leftValue + " " + symbol + " " + rightValue + " could not be evaluated"); } } /** * The method which performs the operation on two double values. * * @param l the value on the left of the operator (a in a+b) * @param r the value on the right of the operator (b in a+b) * @return the value resulting from the operation. */ abstract double evaluate(double l, double r); }
true
66a8d0918defc25236af714cd235f3507e328e34
Java
xue12345/design
/src/main/java/prototype/EnemyPlaneFactory.java
UTF-8
524
3.015625
3
[]
no_license
package prototype; /** * 工程名 :design * * @author wangx * @version 1.0 * @createDate 2019/4/2 * @功能: 造飞机的工厂 * @since JDK1.8 */ public class EnemyPlaneFactory { /**造一个敌机原型(痴汉模式)*/ private static EnemyPlane prptotype = new EnemyPlane(); /**获取敌机克隆实例*/ public static EnemyPlane getInstance(int x) throws CloneNotSupportedException { EnemyPlane clone = prptotype.clone(); clone.setX(x); return clone; } }
true
2fa362fc96cc96497b0e5657570330b1e0ebd52f
Java
feliciano99/api-wine-cep
/src/main/java/br/com/wine/model/Cep.java
UTF-8
1,177
2.28125
2
[]
no_license
package br.com.wine.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; import lombok.Data; @Data @Entity @Table(name = "CEP") public class Cep { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID") private Long id; @Column(nullable = false, name = "CODIGO_LOJA", updatable = false) @NotEmpty(message = "O campo 'Código da Loja' é obrigatório!") private String codigoLoja; @Column(nullable = false, name = "FAIXA_INICIO", unique = true, updatable = true) @NotEmpty(message = "O campo 'Faixa Início' é obrigatório!") @Size(min = 8, max = 8, message = "O campo 'Faixa Início' deve ter 8 caracteres!") private String faixaInicio; @Column(nullable = false, name = "FAIXA_FIM", unique = true, updatable = true) @NotEmpty(message = "O campo 'Código Fim' é obrigatório!") @Size(min = 8, max = 8, message = "O campo 'Faixa Fim' deve ter 8 caracteres!") private String faixaFim; }
true
4feb110d3e09103f42b226ec24a97158463b2e08
Java
june0103/java
/ch10-collections/src/com/s07/score/ScoreMain.java
UHC
3,161
3.5
4
[]
no_license
package com.s07.score; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import com.s06.product.Product; public class ScoreMain { BufferedReader br; ArrayList<Score> list; // public ScoreMain() { list = new ArrayList<Score>(); try { br = new BufferedReader(new InputStreamReader(System.in)); callMenu(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) try { br.close(); } catch (IOException e) { } } } // ޴ public void callMenu() throws IOException { while (true) { try { System.out.print("1.Է 2. 3. >"); int num = Integer.parseInt(br.readLine()); if (num == 1) { input(); // Է } else if (num == 2) { output(); // } else if (num == 3) { System.out.println("α׷ "); break; } else { System.out.println("߸Էϼ̽ϴ."); } } catch (NumberFormatException e) { // TODO: handle exception System.out.println("ڸ !"); } } } // Է public void input() throws IOException { Score sc = new Score(); System.out.print("̸:"); sc.setName(br.readLine()); sc.setKorean(parseInputData(":")); sc.setEnglish(parseInputData(":")); sc.setMath(parseInputData(":")); // System.out.print(":"); // sc.setKorean(Integer.parseInt(br.readLine())); // System.out.print(":"); // sc.setEnglish(Integer.parseInt(br.readLine())); // System.out.print(":"); // sc.setMath(Integer.parseInt(br.readLine())); // score arraylist list.add(sc); } // public void output() { // System.out.println("̸\t\t\t\t\t\tе\t\t"); System.out.println("̸\t\t\t\t\t\t"); for (Score sc : list) { System.out.printf("%s\t", sc.getName()); System.out.printf("%d\t", sc.getKorean()); // System.out.printf("%s\t", sc.makeGrade()); System.out.printf("%d\t", sc.getEnglish()); // System.out.printf("%s\t", sc.makeGrade()); System.out.printf("%d\t", sc.getMath()); // System.out.printf("%s\t", sc.makeGrade()); System.out.printf("%d\t", sc.makeSum()); System.out.printf("%.2f\t", sc.makeAvg()); System.out.printf("%s\t\n", sc.makeGrade()); } } // Է½ 0~100 Էϴ üũ public int parseInputData(String cours) throws IOException { while (true) { System.out.println(cours); try { int num = Integer.parseInt(br.readLine()); if (num < 0 || num > 100) { throw new ScoreValueException("0~100 Է"); } return num; } catch (NumberFormatException e) { System.out.println("ڸ Էϼ!"); } catch (ScoreValueException e) { System.out.println(e.getMessage()); } } } public static void main(String[] args) { new ScoreMain(); } }
true
818f7cedba9d38dd024ee0feae8f1aa973f8b5eb
Java
maddy65/Basic-Sorting-techniques
/Collection/Group.java
UTF-8
853
3.140625
3
[]
no_license
package CollectionTest; import java.io.*; public class Group { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Employee arr[] = new Employee[5]; for(int i=0;i<5;i++){ System.out.println("Enter Name"); String name = br.readLine(); System.out.println("Enter Department"); String department = br.readLine(); System.out.println("Enter ID"); String id = br.readLine(); System.out.println("Enter Salary"); String salary = br.readLine(); System.out.println("Enter Sex"); //char sex = (char)br.read(); String sex = br.readLine(); arr[i] = new Employee(name,department,id,salary,sex); } System.out.println("\n Employee data is:"); for(int i=0;i<arr.length;i++){ arr[i].displayData(); } } }
true
c6670289b9a05d298b28f52653b4f2324eef4a60
Java
zhongxingyu/Seer
/Diff-Raw-Data/26/26_e06246cf424cd5714e24e01205fad1ff60dfc276/SipFactory/26_e06246cf424cd5714e24e01205fad1ff60dfc276_SipFactory_s.java
UTF-8
14,678
2.546875
3
[]
no_license
/** * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Unpublished - rights reserved under the Copyright Laws of the United States. * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * * U.S. Government Rights - Commercial software. Government users are subject * to the Sun Microsystems, Inc. standard license agreement and applicable * provisions of the FAR and its supplements. * * Use is subject to license terms. * * This distribution may include materials developed by third parties. Sun, * Sun Microsystems, the Sun logo, Java, Jini and JAIN are trademarks or * registered trademarks of Sun Microsystems, Inc. in the U.S. and other * countries. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Module Name : JAIN SIP Specification * File Name : SipFactory.java * Author : Phelim O'Doherty * * HISTORY * Version Date Author Comments * 1.1 08/10/2002 Phelim O'Doherty *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ package javax.sip; import javax.sip.address.AddressFactory; import javax.sip.message.MessageFactory; import javax.sip.header.HeaderFactory; import java.util.*; import java.lang.reflect.Constructor; /** * The SipFactory is a singleton class which applications can use a single * access point to obtain proprietary implementations of this specification. * As the SipFactory is a singleton class there will only ever be one instance of * the SipFactory. The single instance of the SipFactory can be obtained using * the {@link SipFactory#getInstance()} method. If an instance of the SipFactory * already exists it will be returned to the application, otherwise a new * instance will be created. * A peer implementation object can be obtained from the SipFactory by invoking * the appropriate create method on the SipFactory e.g. to create a peer * SipStack, an application would invoke the * {@link SipFactory#createSipStack(Properties)} method. * <p> * <b>Naming Convention</b><br> * Note that the SipFactory utilises a naming convention defined by this * specification to identify the location of proprietary objects that * implement this specification. The naming convention is defined * as follows: * <ul> * <li>The <b>upper-level package structure</b> referred to by the SipFactory * with the attribute <var>pathname</var> can be used to differentiate between * proprietary implementations from different SIP stack vendors. The * <var>pathname</var> used by each SIP vendor <B>must be</B> the domain name * assigned to that vendor in reverse order. For example, the pathname used by * Sun Microsystem's would be <code>com.sun</code>. * <li>The <b>lower-level package structure and classname</b> of a peer object * is also mandated by this specification. The lowel-level * package must be identical to the package structure defined by this * specification and the classname is mandated to the interface name * appended with the <code>Impl</code> post-fix. For example, the lower-level * package structure and classname of a proprietary implementation of the * <code>javax.sip.SipStack</code> interface <B>must</B> be * <code>javax.sip.SipStackImpl</code>. * </ul> * * Using this naming convention the SipFactory can locate a vendor's * implementation of this specification without requiring an application to * supply a user defined string to each create method in the SipFactory. Instead * an application merely needs to identify the vendors SIP implementation it * would like to use by setting the pathname of that vendors implementation. * <p> * It follows that a proprietary implementation of a peer object of this * specification can be located at: <p> * <code>'pathname'.'lower-level package structure and classname'.</code><p> * For example an application can use the SipFactory to instantiate a Sun * Microsystems's peer SipStack object by setting the pathname to * <code>com.sun</code> and calling the createSipStack method. The SipFactory * would return a new instance of the SipStack object at the following * location: <code>com.sun.javax.sip.SipStackImpl.java</code> * Because the space of domain names is managed, this scheme ensures that * collisions between two different vendor's implementations will not happen. * For example: a different vendor with a domain name 'foo.com' would have * their peer SipStack object located at <code>com.foo.javax.sip.SipStackImpl.java</code>. * <p> * <b>Default Namespace:</b><br> * This specification defines a default namespace for the SipFactory, this * namespace is the location of the Reference Implementation. The default namespace is * <code>gov.nist</code> the author of the Reference Implementation, therefore * the <var>pathname</var> will have the initial value of <code>gov.nist</code> * for a new instance of the SipFactory. An application must set the * <var>pathname</var> of the SipFactory on retrieval of a new instance of the * factory in order to use a different vendors SIP stack from that of the Reference * Implementation. An application can not mix different vendor's peer implementation * objects. * * @author Sun Microsystems * @version 1.1 */ public class SipFactory{ /** * Returns an instance of a SipFactory. This is a singleton class so * this method is the global access point for the SipFactory. * * @return the single instance of this singleton SipFactory */ public synchronized static SipFactory getInstance() { if(myFactory == null) { myFactory = new SipFactory(); } return myFactory; } /** * Creates an instance of a SipStack implementation based on the * configuration properties object passed to this method. A property of * "javax.sip.IP_ADDRESS" is mandatory in the supplied properties file. * This method ensures that only one instance of a SipStack is returned to * the application per IP Address, no matter how often this method is * called for the same IP Address. Different SipStack instances are returned * for each different IP address. See {@link SipStack} for the expected * format of the <code>properties</code> argument. * * @throws PeerUnavailableException if the peer class could not be found */ public SipStack createSipStack(Properties properties) throws PeerUnavailableException { // If the properties is null, then throw an exception if(properties == null) { throw new NullPointerException("Empty Properties file"); } // if no stacks are created, create a new one if (sipStackList == null) { sipStackList = new LinkedList(); sipStack = createStack(properties); } else { // Check to see if a stack with that IP Address is already created, // if so slect it to be returned for (int i=0; i<sipStackList.size();i++){ if (((SipStack)sipStackList.get(i)).getIPAddress() == properties.getProperty("javax.sip.IP_ADDRESS")) { sipStack = (SipStack)sipStackList.get(i); // otherwise create new one } else { sipStack = createStack(properties); } } } return sipStack; } /** * Creates an instance of the MessageFactory implementation. This method * ensures that only one instance of a MessageFactory is returned to the * application, no matter how often this method is called. * * @throws PeerUnavailableException if peer class could not be found */ public MessageFactory createMessageFactory() throws PeerUnavailableException { if (messageFactory == null) { messageFactory = (MessageFactory)createSipFactory("javax.sip.message.MessageFactoryImpl"); } return messageFactory; } /** * Creates an instance of the HeaderFactory implementation. This method * ensures that only one instance of a HeaderFactory is returned to the * application, no matter how often this method is called. * * @throws PeerUnavailableException if peer class could not be found */ public HeaderFactory createHeaderFactory() throws PeerUnavailableException { if (headerFactory == null) { headerFactory = (HeaderFactory)createSipFactory("javax.sip.header.HeaderFactoryImpl"); } return headerFactory; } /** * Creates an instance of the AddressFactory implementation. This method * ensures that only one instance of an AddressFactory is returned to the * application, no matter how often this method is called. * * @throws PeerUnavailableException if peer class could not be found */ public AddressFactory createAddressFactory() throws PeerUnavailableException { if (addressFactory == null) { addressFactory = (AddressFactory)createSipFactory("javax.sip.address.AddressFactoryImpl"); } return addressFactory; } /** * Sets the <var>pathname</var> that identifies the location of a particular * vendor's implementation of this specification. The <var>pathname</var> * must be the reverse domain name assigned to the vendor * providing the implementation. An application must call * {@link SipFactory#resetFactory()} before changing between different * implementations of this specification. * * @param pathName - the reverse domain name of the vendor, e.g. Sun * Microsystem's would be 'com.sun' */ public void setPathName(String pathName) { this.pathName = pathName; } /** * Returns the current <var>pathname</var> of the SipFactory. The * <var>pathname</var> identifies the location of a particular vendor's * implementation of this specification as defined the naming convention. * The pathname must be the reverse domain name assigned to the vendor * providing this implementation. This value is defaulted to * <code>gov.nist</code> the location of the Reference Implementation. * * @return the string identifying the current vendor implementation. */ public String getPathName() { return pathName; } /** * This method reset's the SipFactory's references to the object's it has * created. It allows these objects to be garbage collected * assuming the application no longer holds references to them. This method * must be called to reset the factories references to a specific * vendors implementation of this specification before it creates another * vendors implementation of this specification by changing the * <var>pathname</var> of the SipFactory. * * @since v1.1 */ public void resetFactory() { sipStackList = null; messageFactory = null; headerFactory = null; addressFactory = null; } /** * Private Utility method used by all create methods to return an instance * of the supplied object. */ private Object createSipFactory(String objectClassName) throws PeerUnavailableException { // If the stackClassName is null, then throw an exception if(objectClassName == null) { throw new NullPointerException(); } try { Class peerObjectClass = Class.forName(getPathName() + "." + objectClassName); // Creates a new instance of the class represented by this Class object. Object newPeerObject = peerObjectClass.newInstance(); return (newPeerObject); } catch(Exception e){ String errmsg = "The Peer JAIN SIP Factory: " + getPathName() + "." + objectClassName + " could not be instantiated. Ensure the Path Name has been set."; throw new PeerUnavailableException(errmsg, e); } } /** * Private Utility method used to create a new SIP Stack instance. */ private SipStack createStack(Properties properties) throws PeerUnavailableException { try { // create parameters argument to identify constructor Class[] paramTypes = new Class[1]; paramTypes[0] = Class.forName("java.util.Properties"); // get constructor of SipSatck in order to instantiate Constructor sipStackConstructor = Class.forName(getPathName() + ".javax.sip.SipStackImpl").getConstructor(paramTypes); // Wrap properties object in order to pass to constructor of SipSatck Object[] conArgs = new Object[1]; conArgs[0] = properties; // Creates a new instance of SipStack Class with the supplied properties. sipStack = (SipStack)sipStackConstructor.newInstance(conArgs); sipStackList.add(sipStack); return sipStack; } catch(Exception e){ String errmsg = "The Peer SIP Stack: " + getPathName() + ".javax.sip.SipStackImpl" + " could not be instantiated. Ensure the Path Name has been set."; throw new PeerUnavailableException(errmsg, e); } } /** * Constructor for SipFactory class. This is private because applications * are not permitted to create an instance of the SipFactory using "new". */ private SipFactory() { } // default domain to locate Reference Implementation private String pathName = "gov.nist"; //intrenal variable to ensure SipFactory only returns a single instance //of the other Factories and SipStack private List sipStackList = null; private SipStack sipStack = null; private MessageFactory messageFactory = null; private HeaderFactory headerFactory = null; private AddressFactory addressFactory = null; // static representation of this factory private static SipFactory myFactory = null; }
true
f052a4940a0b1165dacb5c6400ed8233e69939db
Java
beBetterFather/niblet
/src/main/java/com/encdata/corn/niblet/security/KeycloakConfigResolverNew.java
UTF-8
8,929
1.78125
2
[]
no_license
package com.encdata.corn.niblet.security; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Maps; import org.keycloak.adapters.HttpClientBuilder; import org.keycloak.adapters.KeycloakDeployment; import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils; import org.keycloak.adapters.authorization.PolicyEnforcer; import org.keycloak.adapters.rotation.HardcodedPublicKeyLocator; import org.keycloak.adapters.rotation.JWKPublicKeyLocator; import org.keycloak.adapters.spi.HttpFacade; import org.keycloak.common.enums.SslRequired; import org.keycloak.common.util.PemUtils; import org.keycloak.enums.TokenStore; import org.keycloak.representations.adapters.config.AdapterConfig; import org.keycloak.representations.adapters.config.PolicyEnforcerConfig; import org.keycloak.util.SystemPropertiesJsonParserFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.IOException; import java.io.InputStream; import java.security.PublicKey; import java.util.Map; /** * Copyright (c) 2015-2017 Enc Group * * @Description keycloak配置处理类 * @Author Siwei Jin * @Date 2018/10/26 13:31 */ @Service public class KeycloakConfigResolverNew implements org.keycloak.adapters.KeycloakConfigResolver { private static final Logger LOG = LoggerFactory.getLogger(KeycloakConfigResolverNew.class); @Value(value = "${keycloak.realm}") private String realm; @Value(value = "${keycloak.auth-server-url}") private String authServerUrl; @Value(value = "${keycloak.ssl-required}") private String sslRequired; @Value(value = "${keycloak.resource}") private String resource; @Value(value = "${keycloak.credentials.secret}") private String credentialsSecret; @Value(value = "${keycloak.use-resource-role-mappings}") private Boolean useResourceRoleMappings; protected KeycloakDeployment deployment = new KeycloakDeployment(); private AdapterConfig adapterConfig; @Override public KeycloakDeployment resolve(HttpFacade.Request request) { adapterConfig = loadAdapterConfig(null); return internalBuild(adapterConfig); } protected AdapterConfig loadAdapterConfig(InputStream is) { AdapterConfig adapterConfig = new AdapterConfig(); ObjectMapper mapper = new ObjectMapper(new SystemPropertiesJsonParserFactory()); mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); try { if(null!=is){ adapterConfig = (AdapterConfig)mapper.readValue(is, AdapterConfig.class); } adapterConfig.setRealm(realm); adapterConfig.setAuthServerUrl(authServerUrl); adapterConfig.setSslRequired(sslRequired); adapterConfig.setResource(resource); Map<String, Object> credentials = Maps.newHashMap(); credentials.put("secret", credentialsSecret); adapterConfig.setCredentials(credentials); adapterConfig.setUseResourceRoleMappings(useResourceRoleMappings); return adapterConfig; } catch (IOException var4) { throw new RuntimeException(var4); } } protected KeycloakDeployment internalBuild(AdapterConfig adapterConfig) { if (adapterConfig.getRealm() == null) { throw new RuntimeException("Must set 'realm' in config"); } else { this.deployment.setRealm(adapterConfig.getRealm()); String resource = adapterConfig.getResource(); if (resource == null) { throw new RuntimeException("Must set 'resource' in config"); } else { this.deployment.setResourceName(resource); String realmKeyPem = adapterConfig.getRealmKey(); if (realmKeyPem != null) { try { PublicKey realmKey = PemUtils.decodePublicKey(realmKeyPem); HardcodedPublicKeyLocator pkLocator = new HardcodedPublicKeyLocator(realmKey); this.deployment.setPublicKeyLocator(pkLocator); } catch (Exception var6) { throw new RuntimeException(var6); } } else { JWKPublicKeyLocator pkLocator = new JWKPublicKeyLocator(); this.deployment.setPublicKeyLocator(pkLocator); } if (adapterConfig.getSslRequired() != null) { this.deployment.setSslRequired(SslRequired.valueOf(adapterConfig.getSslRequired().toUpperCase())); } else { this.deployment.setSslRequired(SslRequired.EXTERNAL); } if (adapterConfig.getTokenStore() != null) { this.deployment.setTokenStore(TokenStore.valueOf(adapterConfig.getTokenStore().toUpperCase())); } else { this.deployment.setTokenStore(TokenStore.SESSION); } if (adapterConfig.getPrincipalAttribute() != null) { this.deployment.setPrincipalAttribute(adapterConfig.getPrincipalAttribute()); } this.deployment.setResourceCredentials(adapterConfig.getCredentials()); this.deployment.setClientAuthenticator(ClientCredentialsProviderUtils.bootstrapClientAuthenticator(this.deployment)); this.deployment.setPublicClient(adapterConfig.isPublicClient()); this.deployment.setUseResourceRoleMappings(adapterConfig.isUseResourceRoleMappings()); this.deployment.setExposeToken(adapterConfig.isExposeToken()); if (adapterConfig.isCors()) { this.deployment.setCors(true); this.deployment.setCorsMaxAge(adapterConfig.getCorsMaxAge()); this.deployment.setCorsAllowedHeaders(adapterConfig.getCorsAllowedHeaders()); this.deployment.setCorsAllowedMethods(adapterConfig.getCorsAllowedMethods()); } this.deployment.setBearerOnly(adapterConfig.isBearerOnly()); this.deployment.setAutodetectBearerOnly(adapterConfig.isAutodetectBearerOnly()); this.deployment.setEnableBasicAuth(adapterConfig.isEnableBasicAuth()); this.deployment.setAlwaysRefreshToken(adapterConfig.isAlwaysRefreshToken()); this.deployment.setRegisterNodeAtStartup(adapterConfig.isRegisterNodeAtStartup()); this.deployment.setRegisterNodePeriod(adapterConfig.getRegisterNodePeriod()); this.deployment.setTokenMinimumTimeToLive(adapterConfig.getTokenMinimumTimeToLive()); this.deployment.setMinTimeBetweenJwksRequests(adapterConfig.getMinTimeBetweenJwksRequests()); this.deployment.setPublicKeyCacheTtl(adapterConfig.getPublicKeyCacheTtl()); if (realmKeyPem == null && adapterConfig.isBearerOnly() && adapterConfig.getAuthServerUrl() == null) { throw new IllegalArgumentException("For bearer auth, you must set the realm-public-key or auth-server-url"); } else { if (realmKeyPem == null || !this.deployment.isBearerOnly() || this.deployment.isEnableBasicAuth() || this.deployment.isRegisterNodeAtStartup() || this.deployment.getRegisterNodePeriod() != -1) { this.deployment.setClient((new HttpClientBuilder()).build(adapterConfig)); } if (adapterConfig.getAuthServerUrl() != null || this.deployment.isBearerOnly() && realmKeyPem != null) { this.deployment.setAuthServerBaseUrl(adapterConfig); if (adapterConfig.getTurnOffChangeSessionIdOnLogin() != null) { this.deployment.setTurnOffChangeSessionIdOnLogin(adapterConfig.getTurnOffChangeSessionIdOnLogin().booleanValue()); } PolicyEnforcerConfig policyEnforcerConfig = adapterConfig.getPolicyEnforcerConfig(); if (policyEnforcerConfig != null) { this.deployment.setPolicyEnforcer(new PolicyEnforcer(this.deployment, adapterConfig)); } LOG.debug("Use authServerUrl: " + this.deployment.getAuthServerBaseUrl() + ", tokenUrl: " + this.deployment.getTokenUrl() + ", relativeUrls: " + this.deployment.getRelativeUrls()); return this.deployment; } else { throw new RuntimeException("You must specify auth-server-url"); } } } } } }
true
6a9206c9ef7e49cc4cdcfb262d31c3c97443a591
Java
Zhuzhujinsi/DataImport
/src/com/imooc/io/FileUtilTest1.java
UTF-8
197
1.78125
2
[]
no_license
package com.imooc.io; import java.io.File; public class FileUtilTest1 { public static void main(String[] args) throws Exception{ FileUtils.listDirectory(new File("E:\\jd")); } }
true
e9468f61c28c15cc5f6dc8f1c0ea3cb17588d6ce
Java
franciscospaeth/poc
/poc-app-base-meta/poc-app-base-api/src/main/java/com/spaeth/appbase/event/ViewCloseEvent.java
UTF-8
266
1.75
2
[]
no_license
package com.spaeth.appbase.event; import java.util.EventObject; public class ViewCloseEvent extends EventObject { private static final long serialVersionUID = 1L; public ViewCloseEvent(final Object source) { super(source); } public void proceed() { } }
true
1e022220a3036e81ce26db963068c25e12b11df2
Java
JetBrains/intellij-community
/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/PullAsAbstractUpFix.java
UTF-8
8,841
1.65625
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.CommonBundle; import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.intention.HighPriorityAction; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.impl.BaseIntentionAction; import com.intellij.codeInsight.intention.impl.RunRefactoringAction; import com.intellij.codeInsight.navigation.PsiTargetNavigator; import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement; import com.intellij.codeInspection.util.IntentionName; import com.intellij.java.JavaBundle; import com.intellij.lang.LanguageRefactoringSupport; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.refactoring.memberPullUp.JavaPullUpHandlerBase; import com.intellij.refactoring.util.DocCommentPolicy; import com.intellij.refactoring.util.classMembers.MemberInfo; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiElement implements HighPriorityAction { private static final Logger LOG = Logger.getInstance(PullAsAbstractUpFix.class); private final @IntentionName String myName; public PullAsAbstractUpFix(PsiMethod psiMethod, final @IntentionName String name) { super(psiMethod); myName = name; } @Override @NotNull public String getText() { return myName; } @Override @NotNull public String getFamilyName() { return CommonBundle.message("title.pull.up"); } @Override public boolean isAvailable(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { return startElement instanceof PsiMethod && ((PsiMethod)startElement).getContainingClass() != null; } @Override public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final PsiMethod method = (PsiMethod)startElement; if (!FileModificationService.getInstance().prepareFileForWrite(method.getContainingFile())) return; final PsiClass containingClass = method.getContainingClass(); LOG.assertTrue(containingClass != null); if (containingClass instanceof PsiAnonymousClass) { final PsiClassType baseClassType = ((PsiAnonymousClass)containingClass).getBaseClassType(); final PsiClass baseClass = baseClassType.resolve(); if (baseClass != null && BaseIntentionAction.canModify(baseClass)) { pullUp(method, containingClass, baseClass); } } else { AtomicBoolean noClassesFound = new AtomicBoolean(false); PsiTargetNavigator<PsiClass> navigator = new PsiTargetNavigator<>(() -> { final LinkedHashSet<PsiClass> classesToPullUp = new LinkedHashSet<>(); collectClassesToPullUp(classesToPullUp, containingClass.getExtendsListTypes()); collectClassesToPullUp(classesToPullUp, containingClass.getImplementsListTypes()); noClassesFound.set(classesToPullUp.isEmpty()); return new ArrayList<>(classesToPullUp); }); PsiElementProcessor<PsiClass> processor = element -> { pullUp(method, containingClass, element); return false; }; if (editor != null) { navigator.navigate(editor, JavaBundle.message("choose.super.class.popup.title"), processor); } else { navigator.performSilently(project, processor); } if (noClassesFound.get()) { //check visibility var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE); var handler = supportProvider.getExtractInterfaceHandler(); if (handler == null) { throw new IllegalStateException("Handler is null, supportProvider class = " + supportProvider.getClass()); } handler.invoke(project, new PsiElement[]{containingClass}, null); } } } private static void collectClassesToPullUp(LinkedHashSet<? super PsiClass> classesToPullUp, PsiClassType[] extendsListTypes) { for (PsiClassType extendsListType : extendsListTypes) { PsiClass resolve = extendsListType.resolve(); if (resolve != null && BaseIntentionAction.canModify(resolve)) { classesToPullUp.add(resolve); } } } private static void pullUp(PsiMethod method, PsiClass containingClass, PsiClass baseClass) { if (!FileModificationService.getInstance().prepareFileForWrite(baseClass.getContainingFile())) return; final MemberInfo memberInfo = new MemberInfo(method); memberInfo.setChecked(true); memberInfo.setToAbstract(true); var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE); var handler = (JavaPullUpHandlerBase)supportProvider.getPullUpHandler(); if (handler == null) { throw new IllegalStateException("Handler is null, supportProvider class = " + supportProvider.getClass()); } handler.runSilently(containingClass, baseClass, new MemberInfo[]{memberInfo}, new DocCommentPolicy<>(DocCommentPolicy.ASIS)); } @Override public boolean startInWriteAction() { return false; } public static void registerQuickFix(@NotNull PsiMethod methodWithOverrides, @NotNull List<? super IntentionAction> registrar) { PsiClass containingClass = methodWithOverrides.getContainingClass(); if (containingClass == null) return; boolean canBePulledUp = true; String name = JavaBundle.message("intention.name.pull.method.up", methodWithOverrides.getName()); if (containingClass instanceof PsiAnonymousClass) { final PsiClassType baseClassType = ((PsiAnonymousClass)containingClass).getBaseClassType(); final PsiClass baseClass = baseClassType.resolve(); if (baseClass == null) return; if (!BaseIntentionAction.canModify(baseClass)) return; if (!baseClass.hasModifierProperty(PsiModifier.ABSTRACT)) { name = JavaBundle.message("intention.name.pull.method.up.make.it.abstract", methodWithOverrides.getName()); } } else { final LinkedHashSet<PsiClass> classesToPullUp = new LinkedHashSet<>(); collectClassesToPullUp(classesToPullUp, containingClass.getExtendsListTypes()); collectClassesToPullUp(classesToPullUp, containingClass.getImplementsListTypes()); if (classesToPullUp.isEmpty()) { name = JavaBundle.message("intention.name.extract.method.to.new.interface", methodWithOverrides.getName()); canBePulledUp = false; } else if (classesToPullUp.size() == 1) { final PsiClass baseClass = classesToPullUp.iterator().next(); name = JavaBundle.message("intention.name.pull.method.up.and.make.it.abstract.conditionally", methodWithOverrides.getName(), baseClass.getName(), !baseClass.hasModifierProperty(PsiModifier.ABSTRACT) ? 0 : 1); } } registrar.add(new PullAsAbstractUpFix(methodWithOverrides, name)); if (canBePulledUp) { var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE); registrar.add(new RunRefactoringAction(supportProvider.getPullUpHandler(), JavaBundle.message("pull.members.up.fix.name"))); } if (! (containingClass instanceof PsiAnonymousClass)){ var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE); registrar.add(new RunRefactoringAction(supportProvider.getExtractInterfaceHandler(), JavaBundle.message("extract.interface.command.name"))); registrar.add(new RunRefactoringAction(supportProvider.getExtractSuperClassHandler(), JavaBundle.message("extract.superclass.command.name"))); } } }
true
ee0b14fcf36eb65b780bd32fee26b4561d3f26f8
Java
aigeek/MyOpenGLDemo
/app/src/main/java/com/test/myopengldemo/GLUtils.java
UTF-8
2,464
2.734375
3
[]
no_license
package com.test.myopengldemo; import android.content.Context; import android.opengl.GLES20; import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.InputStream; import javax.microedition.khronos.opengles.GL; /** * Created by yao on 2020 2020/4/22 at 12:50 */ public class GLUtils { /** * 才脚本中加载shader内容 * @param context * @param type * @param name * @return */ public static int loadShaderAssets(Context context,int type,String name){ String result = null; try { InputStream in = context.getAssets().open(name); int ch = 0; ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((ch = in.read())!=-1){ out.write(ch); } byte[] buff = out.toByteArray(); out.close(); in.close(); result = new String(buff,"UTF-8"); result = result.replaceAll("\\r\\n","\n"); }catch (Exception e){ e.printStackTrace(); } return loadShader(type,result); } /** * 加载着色器 * @param type 着色器类型 * 顶点着色 {@link GLES20.GL_VERTEX_SHADER} * 片元着色 {@link GLES20.GL_FRAGMENT_SHADER} * @param shaderCode 着色代码 * @return 着色器 */ private static int loadShader(int type, String shaderCode) { int shader = GLES20.glCreateShader(type);//创建着色器 if (shader == 0){//加载失败直接返回 return 0; } GLES20.glShaderSource(shader,shaderCode);//加载着色器代码 GLES20.glCompileShader(shader);//编译 return checkCompile(type,shader); } /** * 检查shader代码是否编译成功 * @param type 着色器类型 * @param shader 着色器 * @return 着色器 */ private static int checkCompile(int type, int shader) { int[] compiled = new int[1];//存放编译成功的shader数量的数组 GLES20.glGetShaderiv(shader,GLES20.GL_COMPILE_STATUS,compiled,0); if (compiled[0] == 0){//弱编译失败则显示错误日志并删除着色器 Log.e("ES20_COMPILE_ERROR","Could not compile shader "+type+":"+GLES20.glGetShaderInfoLog(shader)); GLES20.glDeleteShader(shader);//删除此shader shader = 0; } return shader; } }
true
37cffe0ff7fb53ca70d7b42a334a8f5a47a79c4d
Java
chrgu000/DOCRecord
/DOCRecord/ResteasyComplexDemo/src/test/threaddownloadfile/GetMIMETypeForFile.java
UTF-8
851
2.4375
2
[]
no_license
package test.threaddownloadfile; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.activation.MimetypesFileTypeMap; public class GetMIMETypeForFile { public static void main(String args[]) throws IOException { File f = new File("ggg/gumby.tml"); System.out.println("Mime Type of " + f.getName() + " is--------- " + new MimetypesFileTypeMap().getContentType(f)); // expected output : // "Mime Type of gumby.gif is image/gif" System.out.println( new MimetypesFileTypeMap().getContentType("ggg/gumby.pdf"));; String type = null; Path path = Paths.get("ggg/gumby.pdf"); System.out.println(Files.probeContentType(path)); ; } }
true
d99283fdfb677e4c3b2ef3ce7ea472f607e3041a
Java
vinodhabiradar17b21/dst-java
/recommender/src/main/java/com/increasingly/recommender/server/WebServer.java
UTF-8
7,629
2.03125
2
[]
no_license
package com.increasingly.recommender.server; import java.io.FileInputStream; import java.io.IOException; import java.lang.management.ManagementFactory; import java.util.EnumSet; import java.util.Properties; import javax.servlet.DispatcherType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlets.CrossOriginFilter; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.springframework.context.support.FileSystemXmlApplicationContext; import com.increasingly.recommender.impl.Configuration; import com.increasingly.recommender.utils.AESBouncyCastle; /** * Main Entry point for Embedded jetty server * * Reads in the Application Context * Reads in Properties File * Auto setup of Log4j2 (through System Property set in run configuration -D param) * @author Shreehari Padaki * */ public class WebServer implements Runnable { private static final Logger logger = LogManager.getLogger(WebServer.class.getName()); private static Properties properties = null; private final String SERVERPROPSFILE = "webapp/WEB-INF/service.properties"; private final String SERVERAPPLICATIONCONTEXT = "webapp/WEB-INF/applicationContext.xml"; private final String KEYSTORE = "webapp/WEB-INF/increasingly.co.jks"; private final String RESOURCEBASE = "webapp"; private FileSystemXmlApplicationContext applicationContext = null; private static Server server = null; public static AESBouncyCastle aes; public static void main(String[] args) { WebServer webServer = new WebServer(); webServer.run(); } /** * Run the Jetty Web Server configured with Jersey */ public void run() { try { aes = AESBouncyCastle.getInstance("AirFrameBegining"); logger.info("Starting Spring.."); applicationContext = new FileSystemXmlApplicationContext(SERVERAPPLICATIONCONTEXT); readProperties(SERVERPROPSFILE); Configuration.setConfiguration(); } catch (Exception e) { logger.error("Error reading prop file " + e.getMessage(), e); return; } try { logger.info("Starting Web Server..."); /** * Setup Threadpool for Jetty Server */ QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(Integer.parseInt(properties.getProperty("InitialThreadpoolSize"))); threadPool.setMaxThreads(Integer.parseInt(properties.getProperty("MaxThreadpoolSize"))); /** * Jetty Server */ server = new Server(threadPool); /** * setup http configuration */ HttpConfiguration http_config = new HttpConfiguration(); http_config.setSecureScheme("https"); http_config.setSecurePort(Integer.parseInt(properties.getProperty("WebServerSSLPort"))); http_config.setOutputBufferSize(Integer.parseInt(properties.getProperty("OutputBufferSize"))); http_config.setRequestHeaderSize(Integer.parseInt(properties.getProperty("RequestHeaderSize"))); http_config.setResponseHeaderSize(Integer.parseInt(properties.getProperty("ResponseHeaderSize"))); http_config.setSendServerVersion(Boolean.parseBoolean((properties.getProperty("SendServerVersion")))); http_config.setSendDateHeader(Boolean.parseBoolean((properties.getProperty("SendDateHeader")))); /** * Http connection/context setup */ ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(Integer.parseInt(properties.getProperty("WebServerPort"))); http.setIdleTimeout(Integer.parseInt(properties.getProperty("IdleTimeoutMS"))); server.addConnector(http); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); context.setResourceBase(RESOURCEBASE); context.setContextPath("/"); FilterHolder cors = context.addFilter(CrossOriginFilter.class,"/*",EnumSet.of(DispatcherType.INCLUDE,DispatcherType.REQUEST)); cors.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, "false"); cors.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, properties.getProperty("AllowedOriginList")); //cors.setInitParameter(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "null"); cors.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "GET,POST,HEAD,OPTIONS"); cors.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "X-Requested-With,Content-Type,Accept,Origin"); /** * Static Content handler */ ResourceHandler resource_handler = new ResourceHandler(); resource_handler.setResourceBase("."); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] {resource_handler,context, new DefaultHandler() }); server.setHandler(handlers); /** * Jersey Configuration */ ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*"); jerseyServlet.setInitOrder(1); jerseyServlet.setInitParameter("jersey.config.server.provider.packages", properties.getProperty("ServicePackage") + ";" + properties.getProperty("JSONProvider")); jerseyServlet.setInitParameter("jersey.config.disableMoxyJson.server", "true"); /** * Setup JMX data collection for Jetty */ MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addBean(mbContainer); /** * SSL Context Factory for Jetty */ SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStorePath(KEYSTORE); sslContextFactory.setKeyStorePassword(properties.getProperty("KeyStorePassword")); sslContextFactory.setKeyManagerPassword(properties.getProperty("KeyManagerPassword")); /** * Add SSL HTTP Configuration to Jetty */ HttpConfiguration https_config = new HttpConfiguration(http_config); https_config.addCustomizer(new SecureRequestCustomizer()); // SSL Connector ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config)); sslConnector.setPort(Integer.parseInt(properties.getProperty("WebServerSSLPort"))); server.addConnector(sslConnector); /** * Start Jetty Server */ server.start(); server.join(); } catch (Throwable t) { t.printStackTrace(System.err); } } /** * Read Properties file * @param fileURL - location of file * @return -success or failure * @throws IOException */ private boolean readProperties(String fileURL) throws IOException { properties = new Properties(); FileInputStream is = new FileInputStream(fileURL); properties.load(is); is.close(); logger.info("Read properties file..."); return true; } public static Properties getProperties() { return properties; } }
true
bb6490dbc21264d45331a3bd3d9b41abf370b3fc
Java
andychen83/iWellnessCN2
/app/src/main/java/com/lefu/es/adapter/BabylistviewAdapter.java
UTF-8
3,604
1.914063
2
[]
no_license
package com.lefu.es.adapter; import android.content.Context; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.graphics.Bitmap; import android.net.Uri; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.lefu.es.constant.BluetoothTools; import com.lefu.es.constant.UtilConstants; import com.lefu.es.db.DBOpenHelper; import com.lefu.es.entity.UserModel; import com.lefu.es.service.UserService; import com.lefu.iwellness.newes.cn.system.R; import java.io.File; import java.util.ArrayList; import java.util.List; /** * 抱婴列表适配器 * @author Leon * 2015-11-17 */ public class BabylistviewAdapter extends BaseAdapter { public List<UserModel> users = new ArrayList<UserModel>(); private int resource; private int selectedPosition = -1; private UserService uservice; private Context cont; private boolean isEdit; private Bitmap bitmap; private UserModel user; public BabylistviewAdapter(Context cont, int resource, List<UserModel> users) { this.cont = cont; this.resource = resource; this.users = users; inflater = (LayoutInflater) cont.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public void clearALL(List<UserModel> ls){ users.clear(); users.addAll(ls); notifyDataSetChanged(); } public void setEdit(boolean isEdit) { this.isEdit = isEdit; } @Override public int getCount() { if (null == users || 0 == users.size()) { return 0; } return users.size(); } @Override public Object getItem(int arg0) { if (null == users || 0 == users.size()) { return null; } return users.get(arg0); } public int getItemID(int index) { return users.get(index).getId(); } @Override public long getItemId(int arg0) { return arg0; } public void setSelectedPosition(int position) { selectedPosition = position; } @Override public View getView(final int posintion, View convertView, ViewGroup viewGroup) { ViewCache cache = new ViewCache(); convertView = inflater.inflate(resource, null); cache.photo = (ImageView) convertView.findViewById(R.id.reviseHead); cache.nameView = (TextView) convertView.findViewById(R.id.username_textView); cache.deletimg = (ImageView) convertView.findViewById(R.id.delted_imageView); user = users.get(posintion); if (null != user) { bitmap = null; cache.nameView.setText(user.getUserName()); if (null != user.getPer_photo() && !"".equals(user.getPer_photo())) { cache.photo.setImageURI(Uri.fromFile(new File(UtilConstants.CURRENT_USER.getPer_photo()))); //cache.photo.setImageBitmap(bitmap); } } if (!isEdit) { cache.deletimg.setVisibility(View.GONE); } else { cache.deletimg.setVisibility(View.VISIBLE); } cache.deletimg.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (null == uservice) { uservice = new UserService(cont); } int uid = getItemID(posintion); uservice.delete(uid); users.remove(posintion); notifyDataSetChanged(); Intent startService = new Intent(BluetoothTools.ACTION_NO_USER); startService.putExtra("babyId",uid); cont.sendBroadcast(startService); } catch (Exception e) { e.printStackTrace(); } } }); return convertView; } private final class ViewCache { public ImageView photo; public TextView nameView; public ImageView deletimg; } private LayoutInflater inflater; }
true
0d6eba57d9bc0f2f291ff964401449ae2944db5e
Java
leeef/AuctionOne
/app/src/main/java/com/hlnwl/auction/ui/category/ContentAdapter.java
UTF-8
1,809
1.945313
2
[]
no_license
package com.hlnwl.auction.ui.category; import android.content.Context; import android.content.Intent; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import androidx.annotation.Nullable; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.hlnwl.auction.R; import com.hlnwl.auction.app.MyApplication; import com.hlnwl.auction.bean.category.CategoryErji; import com.hlnwl.auction.ui.goods.GoodsListActivity; import com.hlnwl.auction.utils.photo.ImageLoaderUtils; import java.util.List; /** * 版权:XXX公司 版权所有 * 作者:yougui * 版本:1.0 * 创建日期:2018/12/25 * 描述:分类内容适配器 */ public class ContentAdapter extends BaseQuickAdapter<CategoryErji, BaseViewHolder> { private Context mContext; public ContentAdapter(Context context) { super(R.layout.item_category_content); this.mContext=context; } @Override protected void convert(BaseViewHolder helper, final CategoryErji item) { helper.setText(R.id.item_category_right_name,item.getName()); ImageView img=helper.getView(R.id.item_category_right_icon); ImageLoaderUtils.display(mContext,img, item.getIcon()); LinearLayout content=helper.getView(R.id.category_content_item); content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mContext.startActivity(new Intent(mContext, GoodsListActivity.class) .putExtra("title", item.getName()) .putExtra("id", item.getId()) .putExtra("keyword","") .putExtra("tag","class")); } }); } }
true
12b2c9825813466f90156da79ca1110f2b9a99fe
Java
alexganu/contact-service-test
/src/main/java/it/ding/contact/client/ContactRestClient.java
UTF-8
2,093
2.359375
2
[]
no_license
package it.ding.contact.client; import static io.restassured.http.ContentType.JSON; import static it.ding.contact.data.CommonData.PROPERTY_BASE_URI; import io.restassured.response.Response; import it.ding.contact.model.Contact; import it.ding.contact.util.GlobalProperties; import java.util.Map; public class ContactRestClient extends RestClient { private static final GlobalProperties globalProperties = GlobalProperties.getInstance(); private static final String BASE_URI = globalProperties.getString(PROPERTY_BASE_URI); private static final String BASE_URI_API = BASE_URI + "/api"; private static final String CONTACTS = "/contacts"; public ContactRestClient() { super(BASE_URI_API); } public Response createContact(Map<String, String> contact) { return requestSpec() .contentType(JSON) .body(contact) .post(CONTACTS); } public Response createContact(Contact contact) { return requestSpec() .contentType(JSON) .body(contact) .post(CONTACTS); } public Response retrieveContacts() { return requestSpec() .contentType(JSON) .get(CONTACTS); } public Response retrieveContacts(int page, int size, String sortBy) { return requestSpec() .contentType(JSON) .queryParam("page", page) .queryParam("size", size) .queryParam("sort", sortBy == null ? "id,asc" : sortBy) .get(CONTACTS); } public Response retrieveSingleContact(Long contactId) { return requestSpec() .contentType(JSON) .get(CONTACTS + "/" + contactId); } public Response updateContact(Long contactId, Contact contact) { return requestSpec() .contentType(JSON) .body(contact) .put(CONTACTS + "/" + contactId); } public Response deleteContact(Long contactId) { return requestSpec() .contentType(JSON) .delete(CONTACTS + "/" + contactId); } }
true
e118500923ad1927873bff0b16340958d4e0291e
Java
gagauz/tapestry-webapp-core
/src/main/java/com/xl0e/testdata/DataBaseScenario.java
UTF-8
2,203
2.40625
2
[]
no_license
package com.xl0e.testdata; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Random; import java.util.Set; import org.apache.tapestry5.web.config.Global; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class DataBaseScenario { private static final Set<Class<?>> executedScenarios = new HashSet<>(); protected final Logger LOG; protected final Random rand = new Random(System.currentTimeMillis()); protected abstract void execute(); public DataBaseScenario() { LOG = LoggerFactory.getLogger(getClass()); } public synchronized final void run() { if (wasExecuted()) { return; } for (DataBaseScenario scenario : getDependsOn()) { if (scenario.equals(this)) { throw new IllegalStateException("Scenario " + this.getClass() + " must not depend on itself!"); } if (!scenario.wasExecuted()) { scenario.run(); } } for (Class<? extends DataBaseScenario> cls : getDependsOnClasses()) { if (cls.equals(this.getClass())) { throw new IllegalStateException("Scenario " + this.getClass() + " must not depend on itself!"); } DataBaseScenario scenario = Global.getApplicationContext().getBean(cls); if (!scenario.wasExecuted()) { scenario.run(); } } try { final long start = System.currentTimeMillis(); execute(); LOG.info("Executed scenario {} in [{}] ms", getClass().getSimpleName(), (System.currentTimeMillis() - start)); } finally { executedScenarios.add(this.getClass()); } } protected final boolean wasExecuted() { return executedScenarios.contains(this.getClass()); } protected DataBaseScenario[] getDependsOn() { return new DataBaseScenario[0]; } protected List<Class<? extends DataBaseScenario>> getDependsOnClasses() { return Collections.emptyList(); } }
true
2b498658beca8d3780a29c36c729d107fc09f5c0
Java
mageru/softwarereuse
/reuze/test/FOLKnowledgeBaseTest.java
UTF-8
2,920
2.0625
2
[]
no_license
package reuze.test; //package aima.test.core.unit.logic.fol.kb; import java.util.ArrayList; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import reuze.mf_Clause; import reuze.mf_DomainExamples; import reuze.mf_KnowledgeBase; import reuze.mf_Literal; import reuze.mf_Predicate; import reuze.mf_StandardizeApartIndexicalFactory; import reuze.mf_i_NodeTerm; import reuze.mf_NodeTermVariable; /*import aima.core.logic.fol.StandardizeApartIndexicalFactory; import aima.core.logic.fol.domain.DomainFactory; import aima.core.logic.fol.kb.FOLKnowledgeBase; import aima.core.logic.fol.kb.data.Clause; import aima.core.logic.fol.kb.data.Literal; import aima.core.logic.fol.parsing.ast.Predicate; import aima.core.logic.fol.parsing.ast.Term; import aima.core.logic.fol.parsing.ast.Variable;*/ /** * @author Ravi Mohan * @author Ciaran O'Reilly * */ public class FOLKnowledgeBaseTest { private mf_KnowledgeBase weaponsKB, kingsKB; @Before public void setUp() { mf_StandardizeApartIndexicalFactory.flush(); weaponsKB = new mf_KnowledgeBase(mf_DomainExamples.weaponsDomain()); kingsKB = new mf_KnowledgeBase(mf_DomainExamples.kingsDomain()); } @Test public void testAddRuleAndFact() { weaponsKB.tell("(Missile(x) => Weapon(x))"); Assert.assertEquals(1, weaponsKB.getNumberRules()); weaponsKB.tell("American(West)"); Assert.assertEquals(1, weaponsKB.getNumberRules()); Assert.assertEquals(1, weaponsKB.getNumberFacts()); } @Test public void testAddComplexRule() { weaponsKB .tell("( (((American(x) AND Weapon(y)) AND Sells(x,y,z)) AND Hostile(z)) => Criminal(x))"); Assert.assertEquals(1, weaponsKB.getNumberRules()); weaponsKB.tell("American(West)"); Assert.assertEquals(1, weaponsKB.getNumberRules()); List<mf_i_NodeTerm> terms = new ArrayList<mf_i_NodeTerm>(); terms.add(new mf_NodeTermVariable("v0")); mf_Clause dcRule = weaponsKB.getAllDefiniteClauseImplications().get(0); Assert.assertNotNull(dcRule); Assert.assertEquals(true, dcRule.isImplicationDefiniteClause()); Assert.assertEquals(new mf_Literal(new mf_Predicate("Criminal", terms)), dcRule.getPositiveLiterals().get(0)); } @Test public void testFactNotAddedWhenAlreadyPresent() { kingsKB.tell("((King(x) AND Greedy(x)) => Evil(x))"); kingsKB.tell("King(John)"); kingsKB.tell("King(Richard)"); kingsKB.tell("Greedy(John)"); Assert.assertEquals(1, kingsKB.getNumberRules()); Assert.assertEquals(3, kingsKB.getNumberFacts()); kingsKB.tell("King(John)"); kingsKB.tell("King(Richard)"); kingsKB.tell("Greedy(John)"); Assert.assertEquals(1, kingsKB.getNumberRules()); Assert.assertEquals(3, kingsKB.getNumberFacts()); kingsKB.tell("(((King(John))))"); kingsKB.tell("(((King(Richard))))"); kingsKB.tell("(((Greedy(John))))"); Assert.assertEquals(1, kingsKB.getNumberRules()); Assert.assertEquals(3, kingsKB.getNumberFacts()); } }
true
81b4fce28879566695f0190c1ebc45507339ef37
Java
anthonycanino1/entbench
/pi_bench/sunflow/build/classes/org/sunflow/core/light/DirectionalSpotlight.java
UTF-8
23,379
2.21875
2
[]
no_license
package org.sunflow.core.light; public class DirectionalSpotlight implements org.sunflow.core.LightSource { private org.sunflow.math.Point3 src; private org.sunflow.math.Vector3 dir; private org.sunflow.math.OrthoNormalBasis basis; private float r; private float r2; private org.sunflow.image.Color radiance; public DirectionalSpotlight() { super(); src = new org.sunflow.math.Point3(0, 0, 0); dir = new org.sunflow.math.Vector3(0, 0, -1); dir.normalize(); basis = org.sunflow.math.OrthoNormalBasis. makeFromW( dir); r = 1; r2 = r * r; radiance = org.sunflow.image.Color.WHITE; } public boolean update(org.sunflow.core.ParameterList pl, org.sunflow.SunflowAPI api) { src = pl. getPoint( "source", src); dir = pl. getVector( "dir", dir); dir. normalize( ); r = pl. getFloat( "radius", r); basis = org.sunflow.math.OrthoNormalBasis. makeFromW( dir); r2 = r * r; radiance = pl. getColor( "radiance", radiance); return true; } public int getNumSamples() { return 1; } public int getLowSamples() { return 1; } public void getSamples(org.sunflow.core.ShadingState state) { if (org.sunflow.math.Vector3. dot( dir, state. getGeoNormal( )) < 0 && org.sunflow.math.Vector3. dot( dir, state. getNormal( )) < 0) { float x = state. getPoint( ). x - src. x; float y = state. getPoint( ). y - src. y; float z = state. getPoint( ). z - src. z; float t = x * dir. x + y * dir. y + z * dir. z; if (t >= 0.0) { x -= t * dir. x; y -= t * dir. y; z -= t * dir. z; if (x * x + y * y + z * z <= r2) { org.sunflow.math.Point3 p = new org.sunflow.math.Point3( ); p. x = src. x + x; p. y = src. y + y; p. z = src. z + z; org.sunflow.core.LightSample dest = new org.sunflow.core.LightSample( ); dest. setShadowRay( new org.sunflow.core.Ray( state. getPoint( ), p)); dest. setRadiance( radiance, radiance); dest. traceShadow( state); state. addSample( dest); } } } } public void getPhoton(double randX1, double randY1, double randX2, double randY2, org.sunflow.math.Point3 p, org.sunflow.math.Vector3 dir, org.sunflow.image.Color power) { float phi = (float) (2 * java.lang.Math. PI * randX1); float s = (float) java.lang.Math. sqrt( 1.0F - randY1); dir. x = r * (float) java.lang.Math. cos( phi) * s; dir. y = r * (float) java.lang.Math. sin( phi) * s; dir. z = 0; basis. transform( dir); org.sunflow.math.Point3. add( src, dir, p); dir. set( this. dir); power. set( radiance). mul( (float) java.lang.Math. PI * r2); } public float getPower() { return radiance.copy1( ). mul( (float) java.lang.Math. PI * r2). getLuminance( ); } public static final java.lang.String jlc$CompilerVersion$jl7 = "2.7.0"; public static final long jlc$SourceLastModified$jl7 = 1457076400000L; public static final java.lang.String jlc$ClassType$jl7 = ("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"); public static final java.lang.String jlc$CompilerVersion$jl5 = "2.7.0"; public static final long jlc$SourceLastModified$jl5 = 1457076400000L; public static final java.lang.String jlc$ClassType$jl5 = ("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"); }
true
327a9f9869c7c9c47109224bbffcc8def3a8afbd
Java
ddyzhang/cpsc304-project
/src/seaquellersbb/Forum.java
UTF-8
563
2.25
2
[ "MIT" ]
permissive
/* * 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 seaquellersbb; /** * * @author derek */ public class Forum { public int id; public String name; public String description; public int userId; public Forum(int id, String name, String description, int userId) { this.id = id; this.name = name; this.description = description; this.userId = userId; } }
true
4cb6fd685d75ae4d61893d5f476634043ae19ba8
Java
MellowCo/java_demo
/workspace/Idea_workspace/spring/spring-boot2/security/src/main/java/com/li/springboot/security/config/SecurityConfig.java
UTF-8
3,319
2.4375
2
[]
no_license
package com.li.springboot.security.config; 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; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; /** * @Description: * @Author: li * @Create: 2019-09-16 09:54 */ @EnableWebSecurity //开启WebSecurity模式 public class SecurityConfig extends WebSecurityConfigurerAdapter { /* * 认证 */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .passwordEncoder(new BCryptPasswordEncoder()).withUser("zhangsan").password(new BCryptPasswordEncoder().encode("123456")).roles("VIP1", "VIP2") .and() .passwordEncoder(new BCryptPasswordEncoder()).withUser("lisi").password(new BCryptPasswordEncoder().encode("123456")).roles("VIP2", "VIP3") .and() .passwordEncoder(new BCryptPasswordEncoder()).withUser("wangwu").password(new BCryptPasswordEncoder().encode("123456")).roles("VIP1", "VIP3"); } /* * 授权 */ @Override protected void configure(HttpSecurity http) throws Exception { //定制请求的授权规则 http.authorizeRequests() //允许所有用户访问"/"和"/index.html" .antMatchers("/", "/index.html").permitAll() //访问均需验证权限 .antMatchers("/level1/**").hasRole("VIP1") .antMatchers("/level2/**").hasRole("VIP2") .antMatchers("/level3/**").hasRole("VIP3") .and() //开启自动配置的登陆功能,效果,如果没有登陆,没有权限就会来到登陆页面 //设置自定义的登陆页,默认为 // /login GET - 登录页 /userlogin GET // /login POST - 登陆认证 /userlogin POST // /login?error GET - 认证失败 /userlogin?error GET // /login?logout GET - 退出 /userlogin?logout GET //重定向到/login?error表示登陆失败 .formLogin().loginPage("/userlogin") //默认登陆页,用户名name为 username 密码name为 password .usernameParameter("user").passwordParameter("pwd") .and() //开启自动配置的注销功能。注销成功会返回 /login?logout 页面 //设置注销成功去 "/" 主页 //发送post请求的 /logout,注销退出 .logout().logoutSuccessUrl("/") .and() //开启记住我功能 //默认记住我的checkbox name为 remember-me .rememberMe().rememberMeParameter("remeber"); //登陆成功以后,将cookie发给浏览器保存,以后访问页面带上这个cookie,只要通过检查就可以免登录 //点击注销会删除cookie } }
true
1e64eefff021f995769694cf8cc3a13632a7452c
Java
HassenBenSlima/SOLID-LambdaExpression-DesignPattern-Junit5-Java8
/junit-5-project/src/com/impl/Calculator.java
UTF-8
144
2.25
2
[]
no_license
package com.impl; public class Calculator { public static int add(int i, int j) { // TODO Auto-generated method stub return i + j; } }
true
3955281cacc18ad1d76ebf485ef8c7990b8345b7
Java
almeidaah/my-own-cv-api
/src/main/java/almeida/fernando/myowncv/service/QualificationService.java
UTF-8
759
2.078125
2
[]
no_license
package almeida.fernando.myowncv.service; import almeida.fernando.myowncv.model.Qualification; import almeida.fernando.myowncv.repository.QualificationRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class QualificationService { QualificationRepository qualificationRepository; public QualificationService(QualificationRepository qualificationRepository){ this.qualificationRepository = qualificationRepository; } public List<Qualification> findAllQualifications(Qualification qualification) { return this.qualificationRepository.findAllByFullName(qualification.getFullName()).get(); } }
true
081e41a667945ef6424cc1e847c30aed3a97ca93
Java
oakscode/Others
/paymentapp/src/main/java/com/payment/controller/HomeController.java
UTF-8
2,906
2.109375
2
[]
no_license
package com.payment.controller; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.payment.Service.CommenService; import com.payment.model.Account; import com.payment.model.Login; import com.payment.model.Payee; @Controller public class HomeController { @Autowired CommenService ser; @RequestMapping(value = "/addaccount") public ModelAndView getuser(Login l) { ModelAndView mv = new ModelAndView("admin.jsp"); return mv; } @RequestMapping(value = "/profile") public ModelAndView profile(HttpSession ses) { ModelAndView mv = new ModelAndView("profile.jsp"); long id = (long) ses.getAttribute("id"); Account a = ser.findByid(id); mv.addObject("obj", a); return mv; } @RequestMapping(value = "/addaccount", method = RequestMethod.POST) public ModelAndView adduser(Login l, Account a) { ModelAndView mv = new ModelAndView("admin.jsp"); ser.newaccount(a, l); return mv; } @RequestMapping(value = "/accounts",produces="application/json") @ResponseBody public Account getaccounts(HttpSession ses,String mobile) throws Exception { System.out.println(mobile+"--"); try { return ser.findBymobile(mobile); } catch (Exception e) { return null; } } @RequestMapping(value = "/addpayee", method = RequestMethod.POST) public ModelAndView addpayee(HttpSession ses,@RequestParam("id")long id,@RequestParam("toid")long toid) { Account a = ser.findByid(toid); Payee p = new Payee(); p.setFromid(id); p.setToid(toid); p.setFullname(a.getFirstname()+" "+a.getLastname()); ser.addPayee(p); ModelAndView mv = new ModelAndView("account.jsp"); return mv; } //transfer @RequestMapping(value = "/transfer") public ModelAndView transfer(HttpSession ses,@RequestParam("id")long id) { System.out.println("ses-->"+id); List<Payee> li = ser.ListPayee(id); for(Payee p : li) { System.out.println(p.toString()); } ModelAndView mv = new ModelAndView("transfer.jsp"); mv.addObject("payee", li); return mv; } //moneytransfer @RequestMapping(value = "/moneytransfer", method = RequestMethod.POST) public ModelAndView moneytransfer(HttpSession ses,@RequestParam("amount")int amt,@RequestParam("toid")long toid ) { System.out.println(toid+"----"); long fromid = (long) ses.getAttribute("id"); ser.MoneyProcess(amt, fromid, toid); return transfer(ses,fromid); } }
true
f1b75bd6ab06963a7ccdf758bedf7c968db03fb9
Java
wqc910605/SkipFragment
/app/src/main/java/com/zhongyuan/fragmentanimation/Constant.java
UTF-8
184
1.507813
2
[]
no_license
package com.zhongyuan.fragmentanimation; /** * Created by zy01060 on 2018/1/5. */ public class Constant { public static int currentCount = -1;//回退栈中fragment的数量 }
true
25fbc9937b61d33a1e3c4299ed9b02b8ae9ac4ea
Java
Elailson/udemy-free-courses-verifier
/src/main/java/com/ess/udemyfreecoursesverifier/core/FirebaseCrud.java
UTF-8
260
1.9375
2
[]
no_license
package com.ess.udemyfreecoursesverifier.core; import java.util.List; public interface FirebaseCrud<T> { T save(T item); List<T> findAll(); T findOneBy(String attribute, String value); List<T> findAllBy(String attribute, String value); }
true
d8faa13180e28b8dbdb3dacdf45be563a4c47326
Java
webwalker/Server-AppMonitor
/src/main/java/com/bestv/monitor/dao/MsgLogMapper.java
UTF-8
607
1.75
2
[]
no_license
package com.bestv.monitor.dao; import java.util.List; import java.util.Map; import com.bestv.monitor.model.MsgLog; public interface MsgLogMapper { MsgLog selectLogsCount(Map<String, Object> map); List<MsgLog> selectLogs(Map<String, Object> map); int deleteByPrimaryKey(Integer ID); int deleteBeforeDate(String date); int insert(MsgLog record); int insertSelective(MsgLog record); MsgLog selectByPrimaryKey(Integer ID); int updateByPrimaryKeySelective(MsgLog record); int updateByPrimaryKeyWithBLOBs(MsgLog record); int updateByPrimaryKey(MsgLog record); }
true
a7dae3e72112287ae34c1a6fc75d11f23025e08b
Java
xdomes/smlmor
/src/org/oostethys/smlmor/gwt/client/SvContainer.java
UTF-8
4,305
2.34375
2
[]
no_license
package org.oostethys.smlmor.gwt.client; import java.util.ArrayList; import java.util.List; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.PushButton; import com.google.gwt.user.client.ui.TabPanel; import com.google.gwt.user.client.ui.Widget; /** * container used for systems and variables * @author Carlos Rueda */ abstract class SvContainer { static SvContainer createTabPanel() { return new TabPanelSvContainer(); } interface Listener { void addElement(); void elementRemoved(int idx); } /** interface to an added element */ interface IElement { void setName(String name); } protected static PushButton createButton(String name, ClickListener cl) { PushButton btn = new PushButton(name); DOM.setElementAttribute(btn.getElement(), "id", "my-button-id"); if ( cl != null ) { btn.addClickListener(cl); } return btn; } protected PushButton addBtn = createButton("Add", null); protected Listener _listener; protected SvContainer() { addBtn.setTitle("Add a new element"); } protected void setListener(Listener listener) { this._listener = listener; } abstract IElement add(Widget widget, String name) ; abstract void setElementName(int idx, String name) ; abstract int getWidgetCount(); abstract Widget getPanel(); abstract void remove(int idx) ; static class TabPanelSvContainer extends SvContainer { TabPanel tabPanel = new TabPanel(); class TabWidget extends HorizontalPanel implements IElement { final HTML nameLabel = new HTML(""); final PushButton removeBtn = createButton("x", new ClickListener() { public void onClick(Widget sender) { removeCalled(TabWidget.this); } });; TabWidget(String name) { setName(name); removeBtn.setTitle("Remove this element"); setVerticalAlignment(ALIGN_MIDDLE); add(nameLabel); add(removeBtn); } public void setName(String name) { // &#8209 = non-breaking hyphen // &nbsp; = non-breaking space name = name.trim().replaceAll("-", "&#8209"); name = name.replaceAll("\\s", "&nbsp;") + "&nbsp;"; nameLabel.setHTML(name); } } List<TabWidget> tabWidgets = new ArrayList<TabWidget>(); TabPanelSvContainer() { addBtn = createButton("+", new ClickListener() { public void onClick(Widget sender) { addCalled(); } }); addBtn.setTitle("Add a new element"); tabPanel.add(new HTML("Click + to add a new element"), addBtn); } private void addCalled() { if ( _listener != null ) { _listener.addElement(); } } private void removeCalled(TabWidget tabWidget) { if ( _listener != null ) { int idx = tabWidgets.indexOf(tabWidget); Main.log("removeCalled: idx = " +idx); if ( idx >= 0 ) { _listener.elementRemoved(idx); } } } @Override Widget getPanel() { return tabPanel; } @Override IElement add(final Widget widget, String name) { TabWidget tabWidget = new TabWidget(name); tabPanel.insert(widget, tabWidget, tabPanel.getWidgetCount() - 1); final int idx = tabPanel.getWidgetIndex(widget); tabWidgets.add(tabWidget); DeferredCommand.addCommand(new Command() { public void execute() { tabPanel.selectTab(idx); } }); return tabWidget; } @Override int getWidgetCount() { return tabPanel.getWidgetCount() - 1; // -1: do not include addBtn } @Override void remove(final int idx) { tabWidgets.remove(idx); tabPanel.remove(idx); DeferredCommand.addCommand(new Command() { public void execute() { int idxSel = idx; // we can always select at the same position, but prefer // to select a normal element, if any, instead of the "+" tab: if ( idxSel == tabPanel.getWidgetCount() - 1 && idxSel > 0 ) { idxSel--; } tabPanel.selectTab(idxSel); } }); } @Override void setElementName(int idx, String name) { // tabPanel.getTabBar().setTabText(idx, name); tabWidgets.get(idx).nameLabel.setText(name); } } }
true
35cec43684d20111a31bd0bef0c58dd12fbaca4f
Java
John-Jianglei/SuiServer
/game/src/main/java/com/shinian/dao/JingjiDao.java
UTF-8
752
2.171875
2
[]
no_license
package com.shinian.dao; import java.math.BigInteger; import java.util.List; import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper; import org.springframework.stereotype.Repository; import com.shinian.dao.impl.WebConstant; @Repository public class JingjiDao { public int getAmount(){ int id = 1; final String sql = " select `amount` from game_jingji_amount where id=?"; int amount = WebConstant.gameJdbc.getJdbcTemplate().queryForInt(sql,new Object[]{id}); return amount; } public int setAmount(int amount){ int id = 1; String sql = "update game_jingji_amount set `amount` = ? where id = ?"; int row = WebConstant.gameJdbc.getJdbcTemplate().update(sql, amount, id); return row; } }
true
ad36407f3669216fcf78b150ef58e3ac378a4acf
Java
Veranicus/DesignPatterns
/src/com/patrikpolacek/creational/factory/FactoryChallenge/Client.java
UTF-8
1,197
3.359375
3
[]
no_license
package com.patrikpolacek.creational.factory.FactoryChallenge; import com.patrikpolacek.creational.factory.FactoryChallenge.Creator.AnimalFactoryInterface; import com.patrikpolacek.creational.factory.FactoryChallenge.Creator.ConcreteAnimalFactory; import com.patrikpolacek.creational.factory.FactoryChallenge.Creator.ConcreteAnimalFactory2; import com.patrikpolacek.creational.factory.FactoryChallenge.Product.Animal; public class Client { public static void main(String[] args) throws Exception { ConcreteAnimalFactory concreteAnimalFactory = new ConcreteAnimalFactory(); Animal cat = concreteAnimalFactory.getAnimalType("cat"); cat.eat(); Animal lion = concreteAnimalFactory.getAnimalType("Lion"); lion.eat(); Animal tiger = concreteAnimalFactory.getAnimalType("Tiger"); tiger.eat(); // alternative way with AnimalFactoryInterface AnimalFactoryInterface animalFactoryInterface = new ConcreteAnimalFactory2(); Animal cat2 = animalFactoryInterface.getAnimalType("cat"); cat2.eat(); Animal errorAnimalType = concreteAnimalFactory.getAnimalType("Tigers"); errorAnimalType.eat(); } }
true
192db9c012429288e8c510c98958c77818aef7f3
Java
5800LDW/Test0925_02
/ldw_mlibrary/src/main/java/com/ldw/xyz/util/exception/ExceptionUtil.java
UTF-8
12,925
2.59375
3
[]
no_license
package com.ldw.xyz.util.exception; /** * Created by liudongwen on 06/02/2018. */ import android.content.Context; import android.os.Environment; import android.os.Looper; import android.util.Log; import android.widget.Toast; import com.ldw.xyz.control.Controller; import com.ldw.xyz.util.LogUtil; import com.ldw.xyz.util.compress.Zipper; import com.ldw.xyz.util.device.DeviceUtil; import com.ldw.xyz.util.exit.ExitUtil; import com.ldw.xyz.util.file.MyFileUtil; import com.ldw.xyz.util.version.VersionUtil; import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; import mail.util.EmailUtil; import mail.util.EmailUtil.OnSendEmailListener; /** * 异常统一处理 * * @author ldw */ public class ExceptionUtil { public static Context context; public final static String crashAbsolutePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip"; public static void handleException(Throwable e) { printAndSendEmail(e); if (!Controller.isRelease) { if (e != null) { e.printStackTrace(); } else { LogUtil.i("ExceptionUtil", "e = null"); } } } public static void handleExceptionAndExit(Throwable e){ if(e!=null){ e.printStackTrace(); } ExceptionUtil.recordAndSendEmailWithAdjunct(context,e); } /** * 发送邮件,不带附件,直接发送 * * @param e */ public static void printAndSendEmail(Throwable e) { // 手机型号 String DeviceModel = DeviceUtil.getDeviceModel() + ""; // 系统版本 String DeviceSystemVersion = DeviceUtil.getDeviceSystemVersion() + ""; //把异常信息变成字符串 StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); String string = stringWriter.toString(); // LogUtil.i("ExceptionUtil", string); //发邮件,发到服务器 EmailUtil.sendMessage("" + e.getClass().getName(), "DeviceModel 手机型号 = " + DeviceModel + "\n" + "DeviceSystemVersion 系统版本号 = " + DeviceSystemVersion + "\n" + string); } /** * 带附件,发送邮件 * <p> * 你要先自己手动记录错误信息 * 例如: * @Override * public void uncaughtException(Thread thread, Throwable throwable) { * RecordCrash2SDUtil.record(this,throwable); * } * * 你要先要自己处理好要发送的文件(这个文件要不要压缩, 发送之前要不要先判断存不存在, 存在的话要不要先进行删除) * * @param e * @param file 这个文件的绝对路径 */ public static void sendWithAdjunct(Throwable e, File file) { // 手机型号 String DeviceModel = DeviceUtil.getDeviceModel() + ""; // 系统版本 String DeviceSystemVersion = DeviceUtil.getDeviceSystemVersion() + ""; //把异常信息变成字符串 StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); String string = stringWriter.toString(); // LogUtil.i("ExceptionUtil", string); //发邮件,发到服务器 EmailUtil.sendMessageWithAttachments("" + e.getClass().getName(), "DeviceModel 手机型号 = " + DeviceModel + "\n" + "DeviceSystemVersion 系统版本号 = " + DeviceSystemVersion + "\n" + string, file, new OnSendEmailListener() { @Override public void onSucceed() {} @Override public void onFailed() {} }); } /** * 记录到本地保存,带附件,发送邮件; * 1. 有网络就记录本地然后发送; * 2. 没网络就记录本地; * 3. 有网络的时候会把10天内的记录发送; * * * 使用方法, 一话搞定: ExceptionUtil.recordAndSendEmailWithAdjunct(this,throwable); * * 错误信息是记录在RecordCrash2SDUtil.getGlobalpath() 这个路径下 * * * @param context * @param e * @param path 要保存的文件的路径例如:Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip" * @param listener 发送成功或发送失败会回调 * * 参考写法,例子如下: * @Override * public void uncaughtException(Thread thread, Throwable throwable) { * final String TAG = "TAG"; * //使用Toast来显示异常信息 * new Thread() { * @Override * public void run() { * Looper.prepare(); * DialogUtil.appCrashDialog(context); * Looper.loop(); * } * }.start(); * * ExceptionUtil.recordAndSendEmailWithAdjunct(context, throwable, Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip", * new EmailUtil.OnSendEmailListener() { * @Override * public void onSucceed() { * * //删除log信息 * MyFileUtil.deleteDir(RecordCrash2SDUtil.getGlobalpath()); * Log.e("TAG", "==发送成功 下面进行自动退出=="); * //删除压缩文件 * new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip").delete(); * //强制退出程序 * ExitUtil.normalExit(); * } * * @Override * public void onFailed() { * try { * Thread.sleep(1000); * // mDefaultHandler.uncaughtException(thread, ex); * } catch (InterruptedException e) { * Log.e(TAG, "error : ", e); * } * Log.e("TAG", "==下面进行自动退出=="); * //删除压缩文件 * new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip").delete(); * //强制退出程序 * ExitUtil.normalExit(); * } * }); * } * * * * * * * */ public static void recordAndSendEmailWithAdjunct(Context context, Throwable e,String path,OnSendEmailListener listener) { //记录错误信息 RecordCrash2SDUtil.record(context, e); //365天前的信息要删除 RecordCrash2SDUtil.autoClear(365); //下面进行压缩 if (MyFileUtil.isFileExists(path)) { Log.e("TAG", "存在,要删除"); new File(path).delete(); } else { Log.e("TAG", "不存在,要生成"); } try { Zipper.zip(crashAbsolutePath, RecordCrash2SDUtil.getGlobalpath()); } catch (final Exception exception) { Log.e("TAG", "出错了 " + exception.toString()); } // 手机型号 String DeviceModel = DeviceUtil.getDeviceModel() + ""; // 系统版本 String DeviceSystemVersion = DeviceUtil.getDeviceSystemVersion() + ""; //把异常信息变成字符串 StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); String string = stringWriter.toString(); //begin 20180919 新增 String appInfo = getAppInfo(context); //end //发邮件,发到服务器 EmailUtil.sendMessageWithAttachments("" + e.getClass().getName(), "DeviceModel 手机型号 = " + DeviceModel + "\n" + "DeviceSystemVersion 系统版本号 = " + DeviceSystemVersion + "\n" + appInfo + string, new File((path)),listener); } /** * 记录到本地保存,带附件,发送邮件,并且有默认的提示; * * @param context * @param e */ public static void recordAndSendEmailWithAdjunct(Context context, Throwable e) { //压缩文件的绝对路径 String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash.zip"; //使用Toast来显示异常信息 new Thread() { @Override public void run() { Looper.prepare(); Toast.makeText(context, "很抱歉,程序出现异常,正在收集错误信息,即将自动退出.", Toast.LENGTH_SHORT).show(); Looper.loop(); } }.start(); // //下面的没用, 经测试, 不知道为什么; // DialogUtil.appCrashDialog(context);//来显示信息, 这工具类来自 compile project(':ldw_mstylelib') recordAndSendEmailWithAdjunct(context, e, path, new EmailUtil.OnSendEmailListener() { @Override public void onSucceed() { //进行删除 // MyFileUtil.deleteDir(RecordCrash2SDUtil.getGlobalpath()); Log.e("TAG", "==发送成功 下面进行自动退出=="); //删除压缩文件 new File(path).delete(); //强制退出程序//todo ExitUtil.normalExit(); } @Override public void onFailed() { try { Thread.sleep(1000); // mDefaultHandler.uncaughtException(thread, ex); } catch (InterruptedException e) { Log.e("TAG", "error : ", e); } Log.e("TAG", "==下面进行自动退出=="); //删除压缩文件 new File(path).delete(); //强制退出程序//todo ExitUtil.normalExit(); } }); } public static void handleException(Exception e, String appName) { if (true) { // if (Controller.isRelease) { printAndSendEmail(e, appName); } if (!Controller.isRelease) { if (e != null) { e.printStackTrace(); } else { LogUtil.i("ExceptionUtil", "e = null"); } } } public static void printAndSendEmail(Throwable e, String appName) { // 手机型号 String DeviceModel = DeviceUtil.getDeviceModel() + ""; // 系统版本 String DeviceSystemVersion = DeviceUtil.getDeviceSystemVersion() + ""; //把异常信息变成字符串 StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); String string = stringWriter.toString(); // LogUtil.i("ExceptionUtil", string); //发邮件,发到服务器 EmailUtil.sendMessage("" + e.getClass().getName() + " 软件名称:" + appName, "DeviceModel 手机型号 = " + DeviceModel + "\n" + "DeviceSystemVersion 系统版本号 = " + DeviceSystemVersion + "\n" + string ); } public static String getAppInfo(Context context){ StringBuffer sb = new StringBuffer(); sb.append("PackageName:"); sb.append(VersionUtil.getPackageName(context)); sb.append("\n"); sb.append("VersionCode:"); sb.append(VersionUtil.getVersionCode(context)); sb.append("\n"); sb.append("VersionName:"); sb.append(VersionUtil.getVersionName(context)); sb.append("\n"); return sb.toString(); } }
true
2c424cc38ae5c1c3740f183a7b2aa725bb9f1891
Java
LuaiCOMP4382/BakingApp
/app/src/main/java/com/student/luai/bakingapp/adapters/StepAdapter.java
UTF-8
2,304
2.5
2
[]
no_license
package com.student.luai.bakingapp.adapters; import android.content.Context; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.student.luai.bakingapp.R; public class StepAdapter extends RecyclerView.Adapter<StepAdapter.StepViewHolder> { private String[] mShortDescriptions; private Context mContext; private StepClickListener mStepClickListener; public StepAdapter(Context context, StepClickListener listener) { mStepClickListener = listener; mContext = context; } @Override public StepViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View view = inflater.inflate(R.layout.step_item, parent, false); return new StepViewHolder(view); } @Override public int getItemCount() { if (mShortDescriptions == null) return 0; return mShortDescriptions.length; } @Override public void onBindViewHolder(StepViewHolder holder, int position) { holder.mTextViewStep.setText("Step " + position); holder.mTextViewShortDescription.setText(mShortDescriptions[position]); } public void setStepData(String[] shortDesc) { mShortDescriptions = shortDesc; notifyDataSetChanged(); } public interface StepClickListener { void onStepClick(int id); } class StepViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mTextViewStep; private TextView mTextViewShortDescription; public StepViewHolder(View itemView) { super(itemView); mTextViewStep = (TextView) itemView.findViewById(R.id.item_tv_recipe_details_step_number); mTextViewShortDescription = (TextView) itemView.findViewById(R.id.item_tv_recipe_details_short_desc); itemView.setOnClickListener(this); } @Override public void onClick(View view) { int position = getAdapterPosition(); mStepClickListener.onStepClick(position); } } }
true
4f02800d533029ea157bf9f17c51552652ddc1a4
Java
ggoksu/rh-integration
/3_service-registry/rest-device/target/generated/src/main/java/org/example/s2/FulfillmentRequest.java
UTF-8
7,786
1.992188
2
[ "Apache-2.0" ]
permissive
package org.example.s2; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="Type" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="ClientId" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="SystemId" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Device"&gt; * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="Brand" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Model" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Size" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Color" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * &lt;/element&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "type", "clientId", "systemId", "device" }) @XmlRootElement(name = "FulfillmentRequest") public class FulfillmentRequest { @XmlElement(name = "Type", required = true) protected String type; @XmlElement(name = "ClientId", required = true) protected String clientId; @XmlElement(name = "SystemId", required = true) protected String systemId; @XmlElement(name = "Device", required = true) protected FulfillmentRequest.Device device; /** * Gets the value of the type property. * * @return * possible object is * {@link String } * */ public String getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link String } * */ public void setType(String value) { this.type = value; } /** * Gets the value of the clientId property. * * @return * possible object is * {@link String } * */ public String getClientId() { return clientId; } /** * Sets the value of the clientId property. * * @param value * allowed object is * {@link String } * */ public void setClientId(String value) { this.clientId = value; } /** * Gets the value of the systemId property. * * @return * possible object is * {@link String } * */ public String getSystemId() { return systemId; } /** * Sets the value of the systemId property. * * @param value * allowed object is * {@link String } * */ public void setSystemId(String value) { this.systemId = value; } /** * Gets the value of the device property. * * @return * possible object is * {@link FulfillmentRequest.Device } * */ public FulfillmentRequest.Device getDevice() { return device; } /** * Sets the value of the device property. * * @param value * allowed object is * {@link FulfillmentRequest.Device } * */ public void setDevice(FulfillmentRequest.Device value) { this.device = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="Brand" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Model" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Size" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Color" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "brand", "model", "size", "color" }) public static class Device { @XmlElement(name = "Brand", required = true) protected String brand; @XmlElement(name = "Model", required = true) protected String model; @XmlElement(name = "Size", required = true) protected String size; @XmlElement(name = "Color", required = true) protected String color; /** * Gets the value of the brand property. * * @return * possible object is * {@link String } * */ public String getBrand() { return brand; } /** * Sets the value of the brand property. * * @param value * allowed object is * {@link String } * */ public void setBrand(String value) { this.brand = value; } /** * Gets the value of the model property. * * @return * possible object is * {@link String } * */ public String getModel() { return model; } /** * Sets the value of the model property. * * @param value * allowed object is * {@link String } * */ public void setModel(String value) { this.model = value; } /** * Gets the value of the size property. * * @return * possible object is * {@link String } * */ public String getSize() { return size; } /** * Sets the value of the size property. * * @param value * allowed object is * {@link String } * */ public void setSize(String value) { this.size = value; } /** * Gets the value of the color property. * * @return * possible object is * {@link String } * */ public String getColor() { return color; } /** * Sets the value of the color property. * * @param value * allowed object is * {@link String } * */ public void setColor(String value) { this.color = value; } } }
true
b13662b47a0a1e41bf4734de036003ef33f83ac4
Java
Sidetalker/mp4
/src/mp4/Condiment.java
UTF-8
450
2.765625
3
[]
no_license
package mp4; abstract class Condiment { private double amount; private IObserver[] observerList; private String name; private int shelfLife; public abstract void NotifyObserver(); public double Amount() { return amount; } public void Amount(double d) { amount = d; } public String Name() { return name; } public void setShelfLife(int days) { shelfLife = days; } public int setShelfLife() { return shelfLife; } }
true
3b25feafa9e848c0f280c235f1a38bacc6ac60de
Java
srchase/smithy
/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedDefault.java
UTF-8
7,333
1.898438
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 software.amazon.smithy.diff.evaluators; import java.util.ArrayList; import java.util.List; import software.amazon.smithy.diff.ChangedShape; import software.amazon.smithy.diff.Differences; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.knowledge.NullableIndex; import software.amazon.smithy.model.node.Node; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeType; import software.amazon.smithy.model.traits.AddedDefaultTrait; import software.amazon.smithy.model.traits.DefaultTrait; import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.utils.SmithyInternalApi; @SmithyInternalApi public final class ChangedDefault extends AbstractDiffEvaluator { @Override public List<ValidationEvent> evaluate(Differences differences) { List<ValidationEvent> events = new ArrayList<>(); // Find changes in the DefaultTrait. differences.changedShapes().forEach(change -> { change.getTraitDifferences().forEach((traitId, pair) -> { if (traitId.equals(DefaultTrait.ID)) { if ((pair.left == null || pair.left instanceof DefaultTrait) && (pair.right == null || pair.right instanceof DefaultTrait)) { validateChange(events, differences.getNewModel(), change, (DefaultTrait) pair.left, (DefaultTrait) pair.right); } } }); }); return events; } private void validateChange( List<ValidationEvent> events, Model model, ChangedShape<Shape> change, DefaultTrait oldTrait, DefaultTrait newTrait ) { if (newTrait == null) { if (!isInconsequentialRemovalOfDefaultTrait(model, oldTrait, change.getNewShape())) { events.add(error(change.getNewShape(), "@default trait was removed. This will break previously generated code.")); } } else if (oldTrait == null) { if (change.getNewShape().getType() != ShapeType.MEMBER) { events.add(error(change.getNewShape(), newTrait, "Adding the @default trait to a root-level shape will break previously generated " + "code. Added @default: " + Node.printJson(newTrait.toNode()))); } else if (!change.getNewShape().hasTrait(AddedDefaultTrait.class)) { if (!newTrait.toNode().isNullNode()) { events.add(error(change.getNewShape(), newTrait, "Adding the @default trait to a member without also adding the @addedDefault " + "trait will break previously generated code. Added @default: " + Node.printJson(newTrait.toNode()))); } } } else if (!oldTrait.toNode().equals(newTrait.toNode())) { if (change.getNewShape().isMemberShape()) { evaluateChangedTrait(model, change.getNewShape().asMemberShape().get(), oldTrait, newTrait, events); } else { events.add(error(change.getNewShape(), newTrait, "Changing the @default value of a root-level shape will break previously generated " + "code. Old value: " + Node.printJson(oldTrait.toNode()) + ". New value: " + Node.printJson(newTrait.toNode()))); } } } private boolean isInconsequentialRemovalOfDefaultTrait(Model model, DefaultTrait trait, Shape removedFrom) { // Removing a default of null if the target is nullable is not an issue. return removedFrom.asMemberShape() .map(member -> { if (trait.toNode().isNullNode()) { // If the target has no defined default, then removing a default(null) trait is fine. Node targetDefault = model.expectShape(member.getTarget()) .getTrait(DefaultTrait.class) .map(DefaultTrait::toNode) .orElse(Node.nullNode()); // If no default, then assume target has a default of null. return targetDefault.isNullNode(); } else { // Removing a non-null trait is always an issue. return false; } }) .orElse(false); } private void evaluateChangedTrait(Model model, MemberShape member, DefaultTrait oldTrait, DefaultTrait newTrait, List<ValidationEvent> events) { Shape target = model.expectShape(member.getTarget()); Node oldValue = oldTrait.toNode(); Node newValue = newTrait.toNode(); boolean oldZeroValue = NullableIndex.isDefaultZeroValueOfTypeInV1(oldValue, target.getType()); boolean newZeroValue = NullableIndex.isDefaultZeroValueOfTypeInV1(newValue, target.getType()); if (oldZeroValue == newZeroValue) { events.add(danger(member, newTrait, "Changing the @default value of a member is dangerous and could break " + "previously generated code or lead to subtle errors. Do this only " + "when strictly necessary. Old value: " + Node.printJson(oldValue) + ". New value: " + Node.printJson(newValue))); } else if (oldZeroValue) { events.add(error(member, newTrait, "The @default trait of this member changed from the zero value of the " + "target shape, `" + Node.printJson(oldValue) + "`, to a value that " + "is not the zero value, `" + Node.printJson(newValue) + "`. This " + "will break previously generated code.")); } else { events.add(error(member, newTrait, "The @default trait of this member changed from something other than " + "the zero value of the target shape, `" + Node.printJson(oldValue) + "`, to the zero value, `" + Node.printJson(newValue) + "`. This " + "will break previously generated code.")); } } }
true
12963dd6762ac8a5fbbf6dffd7b0009b4542c4b4
Java
dingey/cloud-sample
/microservice/user/user-api/src/main/java/com/d/user/fallback/UserClientFallback.java
UTF-8
423
1.851563
2
[]
no_license
package com.d.user.fallback; import com.d.base.BaseFallback; import com.d.base.Result; import com.d.user.feign.UserClient; import com.d.user.model.User; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @Slf4j @Component public class UserClientFallback extends BaseFallback implements UserClient { @Override public Result<User> get(Long id) { return fallback(id); } }
true
bfa73240a43f0d58700b071620a0e8359be6c168
Java
BobSimon/SCMS
/SCMS-admin-base/src/main/java/com/xmscltd/scms/base/service/impl/QuartzServiceImpl.java
UTF-8
1,568
1.882813
2
[ "Apache-2.0" ]
permissive
package com.xmscltd.scms.base.service.impl; import java.util.List; import javax.inject.Singleton; import com.jfinal.plugin.activerecord.Page; import com.xmscltd.scms.base.model.Quartz; import com.xmscltd.scms.base.service.QuartzService; import io.jboot.aop.annotation.Bean; import io.jboot.core.rpc.annotation.JbootrpcService; import io.jboot.db.model.Columns; import io.jboot.service.JbootServiceBase; /** * QuartzServiceImpl * com.xmscltd.scms.base.service.impl * Created with IntelliJ IDEA. * Description: * Author: Administrator-cmchen * Date: 2018-03-02 * Time: 15:52 * Version: V1.0.0 */ @Bean @Singleton @JbootrpcService public class QuartzServiceImpl extends JbootServiceBase<Quartz> implements QuartzService { @Override public Page<Quartz> findPage(Quartz sysQuartz, int pageNumber, int pageSize) { return null; } @Override public Quartz findByJobNameAndJobGroup(String jobName,String jobGroup) { Columns columns = Columns.create(); columns.eq("jobName", jobName); columns.eq("jobGroup", jobGroup); return DAO.findFirstByColumns(columns); } @Override public Page<Quartz> findPage(int pageNumber, int pageSize, String sortName, String sortOrder, String searchText) { if(searchText!=null) { Columns columns = Columns.create(); columns.like("jobName", "%"+searchText+"%"); return DAO.paginateByColumns(pageNumber, pageSize, columns.getList(), sortName + " " + sortOrder); }else { return DAO.paginate(pageNumber, pageSize, sortName + " " + sortOrder); } } }
true
70f492f9cdb877e1b07dc4e7704df5f724a0f1bc
Java
chrizzly765/Travel2gether
/app/src/main/java/de/traveltogether/comments/CommentListFragment.java
UTF-8
1,607
2.34375
2
[]
no_license
package de.traveltogether.comments; import android.app.ListFragment; import android.content.res.Resources; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import de.traveltogether.R; import de.traveltogether.model.Comment; /** * A fragment representing a list of comments. */ public class CommentListFragment extends ListFragment{ private Comment[] comments; private CommentAdapter adapter; /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ public CommentListFragment() { } public static CommentListFragment newInstance(Comment[] _comments) { CommentListFragment fragment = new CommentListFragment(); fragment.comments = _comments; return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_commentlist_list, container, false); return view; } public void onStart(){ super.onStart(); if(!(comments==null || comments.length==0)){ adapter = new CommentAdapter(getActivity(), comments); setListAdapter(adapter); if (adapter == null) { return; } } } }
true
ba061b1acf654a62064ee1457c71d53b6e34a8ce
Java
songkailiang/project-seed
/server/src/main/java/com/yupaits/wx/handler/SubscribeHandler.java
UTF-8
1,872
2.0625
2
[ "MIT" ]
permissive
package com.yupaits.wx.handler; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.yupaits.wx.dto.WxMpReplyMessage; import com.yupaits.wx.entity.MpWelcomeMessage; import com.yupaits.wx.mapper.MpWelcomeMessageMapper; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Map; /** * 关注事件回复(欢迎语) * @author yupaits * @date 2018/11/12 */ @Slf4j @Component public class SubscribeHandler implements WxMpMessageHandler { private final MpWelcomeMessageMapper welcomeMessageMapper; private Long id; private MpWelcomeMessage welcomeMessage; @Autowired public SubscribeHandler(MpWelcomeMessageMapper welcomeMessageMapper) { this.welcomeMessageMapper = welcomeMessageMapper; } public WxMpMessageHandler getHandler(Long id) { this.id = id; this.welcomeMessage = welcomeMessageMapper.selectOne(new QueryWrapper<MpWelcomeMessage>().eq("account_id", id)); return this; } @Override public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map, WxMpService wxMpService, WxSessionManager wxSessionManager) { log.info("{}关注了公众号{}", wxMpXmlMessage.getFromUser(), id); if (welcomeMessage == null || !welcomeMessage.isActive()) { return null; } return JSON.parseObject(welcomeMessage.getMessage(), WxMpReplyMessage.class).replyToOutMessage(wxMpXmlMessage); } }
true
c6521fdd6b3d8e4f3628dc540d97ab0932ea1299
Java
Amila1991/DS_Project
/src/main/java/org/sem8/ds/util/constant/NodeConstant.java
UTF-8
1,524
2.171875
2
[]
no_license
package org.sem8.ds.util.constant; /** * @author amila karunathilaka. */ public class NodeConstant { public static final String PROTOCOL = "http://"; public static final String REST_API = "/rest"; public static final String NODE_SERVICE = "/node"; public static final int HOP_COUNT = 5; public static final class RestRequest { public static final String JOIN = "/join"; public static final String LEAVE = "/leave"; public static final String SEARCH = "/search"; public static final String SEARCH_RESPONSE = "/searchResponse"; public static final String PING = "/ping"; } public static final class BootstrapRequest { public static final String NODE_REG = "REG"; public static final String NODE_UNREG = "UNREG"; } public enum NodeMsgType { SEARCH { @Override public String toString() { return "SEARCH"; } }, SEARCHRESPONSE { @Override public String toString() { return "SEARCHRESPONSE"; } }, JOIN { @Override public String toString() { return "JOIN"; } }, LEAVE { @Override public String toString() { return "LEAVE"; } }, FORWARD { @Override public String toString() { return "FORWARD"; } } } }
true
60f2a16bd66317347507b0c2988dd11ce591b0e0
Java
Pecsj/note
/j2ee知识点/3filter,listener,xml,session/付费一阶段第74课---Listener/代码/TestFilterChain/src/myfiterchain/FilterFour.java
UTF-8
325
2.203125
2
[]
no_license
package myfiterchain; public class FilterFour extends HttpFilter { public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) { System.out.println("four之前的事情"); chain.doFilter(request,response); System.out.println("four之后的事情"); } }
true
e714e7bc7f4b94690fe825545c2ca406b4ae554e
Java
sebastian-king/Peg-Soltaire-Java
/Board.java
UTF-8
1,113
3.609375
4
[]
no_license
package PegSolitaireJava; public class Board { private int cells[]; private int number_occupied; Board(int[] cells) { this.cells = cells; this.number_occupied = calculate_number_occupied(); } Board(int[] cells, int number_occupied) { this.cells = cells; this.number_occupied = number_occupied; } private int calculate_number_occupied() { int number_occupied = 0; for (int i = 0; i < cells.length; i++) { if (cells[i] == 1) { number_occupied++; } } return number_occupied; } public int get_total_cells() { return cells.length; } public int get_number_occupied() { int n = 0; for (int i = 0; i < 15; i++) { if (cells[i] == 1) { n++; } } return n; } public void set_number_occupied(int number_occupied) { this.number_occupied = number_occupied; } public int get_cell(int cell_number) { return cells[cell_number]; } public void set_cell(int cell_number, int value) { cells[cell_number] = value; } public int[] get_all_cells() { return this.cells; } public Board clone() { return new Board(this.cells, this.number_occupied); } }
true
7942ffe5925dac665776ef2ae9181c507086c675
Java
prajapatip00ja/UiElementWithVisitor
/src/ViewElement.java
UTF-8
211
2.203125
2
[]
no_license
/** * Created by saylik on 04/05/15. */ public abstract class ViewElement { public abstract ViewElement accept(Visitor visitor); public abstract String getId(); public abstract String getText(); }
true
627b2e30e6b7b70e96bee5eb987e1c699f39a324
Java
EaseTech/log-aggregator
/src/main/java/org/easetech/aggregator/ExceptionCountBean.java
UTF-8
1,367
2.15625
2
[]
no_license
package org.easetech.aggregator; import java.util.List; /** * TODO Describe me * */ public class ExceptionCountBean implements LogInfoData{ List<ExceptionAndCountMap> uniqueExceptions; private String description; private String componentName; /** * @return the uniqueExceptions */ public List<ExceptionAndCountMap> getUniqueExceptions() { return uniqueExceptions; } /** * @param uniqueExceptions the uniqueExceptions to set */ public void setUniqueExceptions(List<ExceptionAndCountMap> uniqueExceptions) { this.uniqueExceptions = uniqueExceptions; } /** * @return the description */ @Override public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * @return the componentName */ @Override public String getComponentName() { return componentName; } /** * @param componentName the componentName to set */ public void setComponentName(String componentName) { this.componentName = componentName; } @Override public List<?> getLogData() { return uniqueExceptions; } }
true
de3e5ffa2e35a0f1ac043db7f4f9df5c3712adcd
Java
SeventeenToOne/daily
/src/main/java/demo/DataOrderDemo.java
UTF-8
4,270
2.640625
3
[]
no_license
package demo; import java.util.*; import java.util.stream.Collectors; import edu.princeton.cs.algs4.In; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import sun.jvm.hotspot.jdi.ArrayReferenceImpl; import sun.tools.jconsole.ProxyClient; public class DataOrderDemo { public static void main(String[] args) { List<Integer> l1 = new ArrayList<>(); l1.add(70001); List<Integer> test = new ArrayList<>(); List<Integer> l2 = new ArrayList<>(); l2.add(1003); l2.add(10002); System.out.println(l1.addAll(l2)); test.addAll(l2); new ArrayList<>().add(7001); List<Integer> single = Collections.singletonList(123); List<Integer> list = new ArrayList<>(); list.addAll(single); list.addAll(l2); System.out.println(list); List<Integer> virParam = new ArrayList<>(); List<Integer> isVirtualList = Optional.ofNullable(virParam).orElse(new ArrayList<>()); System.out.println(CollectionUtils.isEmpty(isVirtualList)); System.out.println(isVirtualList == null); CollectionUtils.addIgnoreNull(isVirtualList, 1); System.out.println(isVirtualList); List<Integer> virNull = null; List<Integer> virtualNullList = Optional.ofNullable(virNull).orElse(new ArrayList<>()); System.out.println(CollectionUtils.isEmpty(virtualNullList)); System.out.println(isVirtualList == null); CollectionUtils.addIgnoreNull(virtualNullList, null); System.out.println(virtualNullList); String[] actualSoldNumKdtIds = "123,1,1,1,3,4,5".split(","); if (0 == actualSoldNumKdtIds.length) { System.out.println("0 == actualSoldNumKdtIds.length"); } System.out.println(Arrays.stream(actualSoldNumKdtIds).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet())); Set<Long> testSet = Collections.emptySet(); System.out.println(testSet.contains(123)); List<Integer> testList = Arrays.asList(1, 2, 3, 4, 5); List<String> wordList = testList.stream() .map(String::valueOf) .limit(1) .collect(Collectors.toList()); System.out.println(wordList); String str = " 9787535394255002 "; System.out.println(str); System.out.println(StringUtils.trim(str)); Integer val = null; //System.out.println(Optional.of(val).orElse(1)); User user = new User(null, null); User nullUser = null; //System.out.println(Optional.ofNullable(nullUser.getName()).orElse("123")); //System.out.println(Optional.ofNullable(nullUser.getName()).equals("123")); User user1 = new User("n1", "bir"); Student stu = new Student(); stu.setAge(1); stu.setName("23"); print(user1, stu); } public static void print(Object o1, Object o2) { System.out.println(o1.toString()); System.out.println(o2.toString()); } public static void sort(List<User> list) { list.sort(Comparator.comparing(User::getBirthday).thenComparing(User::getName)); //System.out.println(list); } } class Student { private String name; private Integer age; @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", age='" + age + '\'' + '}'; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } } class User { private String name; private String birthday; public User(String name, String birthday) { this.name = name; this.birthday = birthday; } public String getBirthday() { return birthday; } public String getName() { return name; } @Override public String toString() { return "User{" + "name='" + name + '\'' + ", birthday='" + birthday + '\'' + '}' + "\n"; } }
true
d7bce8adcea478de0dc662a4b352ab90265af50e
Java
WenJunKing/diqiuren
/src/com/earthman/app/bean/MyBankListReponse.java
UTF-8
2,309
2.421875
2
[]
no_license
package com.earthman.app.bean; import java.util.ArrayList; /** * @Title: MyBankListReponse * @Description: * @Company: 地球人 * @author ERIC * @date 2016年3月10日 */ public class MyBankListReponse extends BaseResponse { // { // "code": "000000", // "result": [ // { // "banktype": 0, // "cardtype": 1, // "destaccnumber": "123456789", // "userid": 10 // } // ] // } // destaccnumber:银行卡号 // cardtype:银行卡类型0:储蓄卡 1:信用卡 // banktype:发卡行 // 银行名称0:招商银行;1:广发银行;2:华夏银行;3:工商银行;4:中信银行;5:中国银行;6:农业银行;7:邮政储蓄;8:平安银行;9:建设银行;10:交通银行;11:广大银行;12:兴业银行;13:浦发银行;14:民生银行 private ArrayList<MyBankList> result; /** * @return the result */ public ArrayList<MyBankList> getResult() { return result; } /** * @param result * the result to set */ public void setResult(ArrayList<MyBankList> result) { this.result = result; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "MyBankListReponse [result=" + result + "]"; } public class MyBankList { private int destaccnumber; private int cardtype; private int banktype; /** * @return the destaccnumber */ public int getDestaccnumber() { return destaccnumber; } /** * @param destaccnumber * the destaccnumber to set */ public void setDestaccnumber(int destaccnumber) { this.destaccnumber = destaccnumber; } /** * @return the cardtype */ public int getCardtype() { return cardtype; } /** * @param cardtype * the cardtype to set */ public void setCardtype(int cardtype) { this.cardtype = cardtype; } /** * @return the banktype */ public int getBanktype() { return banktype; } /** * @param banktype * the banktype to set */ public void setBanktype(int banktype) { this.banktype = banktype; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "MyBankList [destaccnumber=" + destaccnumber + ", cardtype=" + cardtype + ", banktype=" + banktype + "]"; } } }
true
3fac5999eefed99983399ec63ed6317111b4dd8e
Java
Maryann0704/Java-Enterprise-Development
/lesson18_my/springstart/src/main/java/by/pvt/impls/Chukovskiy.java
UTF-8
855
2.859375
3
[]
no_license
package by.pvt.impls; import by.pvt.i_face.Lyricist; public class Chukovskiy implements Lyricist { @Override public String generate() { return "У меня зазвонил телефон.\n" + "- Кто говорит?\n" + "- Слон.\n" + "- Откуда?\n" + "- От верблюда.\n" + "- Что вам надо?\n" + "- Шоколада.\n" + "- Для кого?\n" + "- Для сына моего.\n" + "- А много ли прислать?\n" + "- Да пудов этак пять\n" + "Или шесть:\n" + "Больше ему не съесть,\n" + "Он у меня еще маленький!\n"; } }
true
c6fd3a8ed99d17e6bf7d466836ae6938d4243807
Java
Yashwanthgoud/WalletApplication-Sprint-2
/src/main/java/com/cg/paymentapp/repo/IAccountRepository.java
UTF-8
652
1.890625
2
[]
no_license
package com.cg.paymentapp.repo; import java.math.BigDecimal; import java.util.List; import javax.persistence.NamedQuery; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import com.cg.paymentapp.beans.BankAccount; import com.cg.paymentapp.beans.Wallet; public interface IAccountRepository extends JpaRepository<BankAccount, Integer> { @Query("from BankAccount where walletid=:wall") List<BankAccount> viewAllAccounts(@Param("wall") int walletid); }
true
76739557e609c9efc1fe6111da4fb855584e0954
Java
DP102G4/LaviLog
/app/src/main/java/com/example/lavilog/userStatusListFragment.java
UTF-8
32,025
1.703125
2
[]
no_license
package com.example.lavilog; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.cardview.widget.CardView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.SearchView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.QuerySnapshot; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.util.ArrayList; import java.util.List; import static android.graphics.Color.RED; import static androidx.constraintlayout.widget.Constraints.TAG; public class userStatusListFragment extends Fragment { Activity activity; FirebaseFirestore db; FirebaseStorage storage; RecyclerView rvUserList; SearchView svUserStatus; Spinner spStatus; Context context; ArrayList<User> users = new ArrayList<>(); ArrayList<User> usersNoBlock = new ArrayList<>(); ArrayList<User> usersBlock = new ArrayList<>(); List<User> searchUsers = new ArrayList<>(); String searchViewText = ""; // userAdapter userAdapter; int position = 0; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = getActivity(); activity.setTitle("使用者列表"); db = FirebaseFirestore.getInstance(); storage = FirebaseStorage.getInstance(); context = getContext(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_user_status_list, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); rvUserList = view.findViewById(R.id.rvUserList); svUserStatus = view.findViewById(R.id.svUserStatus); spStatus = view.findViewById(R.id.spStatus); ArrayAdapter<CharSequence> nAdapter = ArrayAdapter.createFromResource( context, R.array.blockage_spinner, android.R.layout.simple_spinner_dropdown_item); // nAdapter.setDropDownViewResource( // android.R.layout.simple_spinner_dropdown_item); spStatus.setAdapter(nAdapter); db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if (!user.getStatus().equals("1")) { users.add(user); } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); spStatus.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Toast.makeText(activity,"i="+i,Toast.LENGTH_SHORT).show(); switch (i) { case 0://下拉選單選擇全部使用者 if (position != 0 ) { users = new ArrayList<>(); if (searchViewText.isEmpty()) { db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if (!user.getStatus().equals("1")) { users.add(user); } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); // rvUserList.setLayoutManager(new LinearLayoutManager(activity)); // rvUserList.setAdapter(new userAdapter(activity, users)); } else { db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { users = new ArrayList<>(); QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if (!user.getStatus().equals("1")) { for (User sruser : searchUsers) { if(user.getAccount().equals(sruser.getAccount())){ users.add(sruser); } } } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); // rvUserList.setLayoutManager(new LinearLayoutManager(activity)); // rvUserList.setAdapter(new userAdapter(activity, searchUsers)); } position = i; } break; case 1://下拉選單選擇未封鎖使用者 if (position != 1) { if (searchViewText.isEmpty()) { db.collection("users").whereEqualTo("status", "0"). get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; usersNoBlock = new ArrayList<>(); userAdapter adapter = (userAdapter) rvUserList.getAdapter(); for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User userNoBlock = documentSnapshot.toObject(User.class); usersNoBlock.add(userNoBlock); } adapter.setUsers(usersNoBlock); rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, usersNoBlock)); } }); } else { db.collection("users").whereEqualTo("status", "0"). get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; usersNoBlock = new ArrayList<>(); userAdapter adapter = (userAdapter) rvUserList.getAdapter(); for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User userNoBlock = documentSnapshot.toObject(User.class); for (User user : searchUsers) { if (user.getAccount().equals(userNoBlock.getAccount())) { usersNoBlock.add(userNoBlock); } } } adapter.setUsers(usersNoBlock); rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, usersNoBlock)); } }); } position = i; } break; case 2://下拉選單選擇封鎖使用者 if (position != 2) { if (searchViewText.isEmpty()) { db.collection("users").whereEqualTo("status", "2").get() .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { usersBlock = new ArrayList<>(); userAdapter adapter = (userAdapter) rvUserList.getAdapter(); QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User userBlock = documentSnapshot.toObject(User.class); usersBlock.add(userBlock); } adapter.setUsers(usersBlock); rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, usersBlock)); } }); } else { db.collection("users").whereEqualTo("status", "2"). get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; usersBlock = new ArrayList<>(); userAdapter adapter = (userAdapter) rvUserList.getAdapter(); for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User userBlock = documentSnapshot.toObject(User.class); for (User user : searchUsers) { if (user.getAccount().equals(userBlock.getAccount())) { usersBlock.add(userBlock); } } } adapter.setUsers(usersBlock); rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, usersBlock)); } }); } position = i; } break; default: Toast.makeText(activity, "資料庫設錯status了,快檢查", Toast.LENGTH_SHORT).show(); } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); svUserStatus.setOnQueryTextListener(new SearchView.OnQueryTextListener() { // 必須能監聽到searchView內文字的改變 // onQueryTextSubmit 打完才搜尋 @Override public boolean onQueryTextSubmit(String newText) { // 打完才搜尋 // 當user輸入東西,searchView會傳回內容(newText) // rvUserList.setLayoutManager(new LinearLayoutManager(activity)); // rvUserList.setAdapter(new userAdapter(activity, users)); // userAdapter userAdapter = (userAdapter) rvUserList.getAdapter(); // // 要做SearchView時,須先做好SearchView的內容,本文為recyclerView // List<User> searchUsers = new ArrayList<>(); // // 為了搜集依照使用者提供的關鍵字,須設定一個新的List // // 將符合條件的data匯入 // // 搜尋原始資料內有無包含關鍵字(不區別大小寫) // if (userAdapter != null) { // 如果適配器 不等於 空值 // // 如果搜尋條件為空字串,就顯示原始資料(User原始為空白);否則就顯示搜尋後結果 // if (newText.isEmpty()) { // 如果搜尋條件為空字串 // if (users != null) { // 如果user資料 不等於 空值 // userAdapter.setUsers(users); // } // } else { // // users = getUsers(); // // users= getusers(); // // 搜尋原始資料 equals // for (User user : users) { // // 搜尋名字 //// if (user.getName().toUpperCase().equals(newText.toUpperCase())) { //// // contain為比對內容的動作,是否包含關鍵字 //// searchUserIds.add(user); //// } // // // 搜尋帳號 // if (user.getAccount().toUpperCase().contains(newText.toUpperCase())) { // // contain為比對內容的動作,是否包含關鍵字 // searchUsers.add(user); // } // } // userAdapter.setUsers(searchUsers); // } // } return false; // return false代表事件沒有被處理到,需要往下走,不要終止 // webView的onKeyDown同理,返回上一頁是該返回網頁還是widget } // onQueryTextChange 打字就搜尋 @Override public boolean onQueryTextChange(String newText) { // 打字就搜尋 searchViewText = newText; rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); userAdapter adapter = (userAdapter) rvUserList.getAdapter(); searchUsers = new ArrayList<>(); if (adapter != null) { // 如果適配器 不等於 空值 // 如果搜尋條件為空字串,就顯示原始資料(User原始為空白);否則就顯示搜尋後結果 if (newText.isEmpty()) { // 如果搜尋條件為空字串 if (users != null) { // 如果user資料 不等於 空值 switch (position) { case 0: db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { users = new ArrayList<>(); QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if (!user.getStatus().equals("1")) { users.add(user); } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); // adapter.setUsers(users); break; case 1: db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { users = new ArrayList<>(); QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if ((!user.getStatus().equals("1") && (!user.getStatus().equals("2")))){ users.add(user); } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); // adapter.setUsers(usersNoBlock); break; case 2: db.collection("users").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { users = new ArrayList<>(); QuerySnapshot querySnapshot = (task.isSuccessful()) ? task.getResult() : null; for (DocumentSnapshot documentSnapshot : querySnapshot.getDocuments()) { User user = documentSnapshot.toObject(User.class); if ((!user.getStatus().equals("1") && (!user.getStatus().equals("0")))){ users.add(user); } } rvUserList.setLayoutManager(new LinearLayoutManager(activity)); rvUserList.setAdapter(new userAdapter(activity, users)); } }); // adapter.setUsers(usersBlock); break; default: Toast.makeText(activity, "資料庫設錯了,快檢查", Toast.LENGTH_SHORT).show(); } } } else { // users = getUsers(); // users= getusers(); // 搜尋原始資料 equals switch (position) { case 0: for (User user : users) { // 搜尋帳號 if (user.getAccount().toUpperCase().contains(newText.toUpperCase())) { // contain為比對內容的動作,是否包含關鍵字 searchUsers.add(user); } } adapter.setUsers(searchUsers); break; case 1: for (User user : usersNoBlock) { // 搜尋帳號 if (user.getAccount().toUpperCase().contains(newText.toUpperCase())) { // contain為比對內容的動作,是否包含關鍵字 searchUsers.add(user); } } adapter.setUsers(searchUsers); break; case 2: for (User user : usersBlock) { // 搜尋帳號 if (user.getAccount().toUpperCase().contains(newText.toUpperCase())) { // contain為比對內容的動作,是否包含關鍵字 searchUsers.add(user); } } adapter.setUsers(searchUsers); break; default: Toast.makeText(activity, "資料庫設錯了,快檢查", Toast.LENGTH_SHORT).show(); } } } return false; // return false代表事件沒有被處理到,需要往下走,不要終止 // webView的onKeyDown同理,返回上一頁是該返回網頁還是widget } }); } private class userAdapter extends RecyclerView.Adapter<userAdapter.userViewHolder> { Context context; List<User> users; userAdapter(Context context, List<User> users) { this.context = context; this.users = users; } public void setUsers(List<User> users) { this.users = users; } @Override public int getItemCount() { return users.size(); } @NonNull @Override public userAdapter.userViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(context); View itemView = layoutInflater.inflate(R.layout.user_list_item, parent, false); return new userAdapter.userViewHolder(itemView); } @Override public void onBindViewHolder(@NonNull final userAdapter.userViewHolder holder, final int position) { final User user = users.get(position); String imagePath = user.getImagePath(); showImage(holder.ivUserList, imagePath); holder.tvUserName.setText(user.getName()); holder.tvUserAccount.setText(user.getAccount()); if (user.getStatus().equals("0")) { holder.tvUserStatus.setText("狀態 : 正常"); holder.btBlockadeCancel.setVisibility(View.GONE); holder.btBlockade.setVisibility(View.VISIBLE); holder.CLUser.setBackgroundColor(Color.rgb(213, 213, 213)); } else { holder.tvUserStatus.setText("狀態 : 封鎖"); holder.CLUser.setBackgroundColor(RED); holder.btBlockade.setVisibility(View.GONE); holder.btBlockadeCancel.setVisibility(View.VISIBLE); } holder.btBlockade.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String account = holder.tvUserAccount.getText().toString(); AlertDialog.Builder builder1 = new AlertDialog.Builder(activity); builder1.setMessage("確定封鎖使用者" + account) .setPositiveButton("確定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { User userBlock = users.get(position); userBlock.setStatus("2"); db.collection("users").document(userBlock.getId()).set(userBlock); notifyDataSetChanged(); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); // Create the AlertDialog object and return it builder1.show(); } }); holder.btBlockadeCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String account = holder.tvUserAccount.getText().toString(); AlertDialog.Builder builder2 = new AlertDialog.Builder(activity); builder2.setMessage("確定解除封鎖使用者" + account) .setPositiveButton("確定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { User userBlockCancel = users.get(position); userBlockCancel.setStatus("0"); db.collection("users").document(userBlockCancel.getId()).set(userBlockCancel); notifyDataSetChanged(); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder2.show(); } }); } class userViewHolder extends RecyclerView.ViewHolder { ImageView ivUserList; TextView tvUserName, tvUserAccount, tvUserStatus; Button btBlockadeCancel, btBlockade; CardView cardViewUser; ConstraintLayout CLUser; userViewHolder(View itemView) { super(itemView); ivUserList = itemView.findViewById(R.id.ivUserList); tvUserName = itemView.findViewById(R.id.tvUserName); tvUserAccount = itemView.findViewById(R.id.tvUserAccount); tvUserStatus = itemView.findViewById(R.id.tvUserStatus); btBlockade = itemView.findViewById(R.id.btBlockade); btBlockadeCancel = itemView.findViewById(R.id.btBlockadeCancel); cardViewUser = itemView.findViewById(R.id.cardViewUser); CLUser = itemView.findViewById(R.id.CLUser); } } } private void showImage(final ImageView imageView, final String imagePath) { final int ONE_MEGABYTE = 1024 * 1024; StorageReference imageRef = storage.getReference().child(imagePath); imageRef.getBytes(ONE_MEGABYTE) .addOnCompleteListener(new OnCompleteListener<byte[]>() { @Override public void onComplete(@NonNull Task<byte[]> task) { // 若拿到完整的圖,回傳byte陣列 if (task.isSuccessful() && task.getResult() != null) { byte[] bytes = task.getResult(); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); imageView.setImageBitmap(bitmap); } else { String message = task.getException() == null ? getString(R.string.textImageDownloadFail) + ": " + imagePath : task.getException().getMessage() + ": " + imagePath; Log.e(TAG, message); Toast.makeText(activity, message, Toast.LENGTH_SHORT).show(); } } }); } }
true
7d1e0914ab3397234cf93d8233bc5b073e7c791a
Java
xiaoshitou13/MyYuekaoDemo
/app/src/main/java/byc/by/com/myyuekaodemo/presenter/Mypresenter.java
UTF-8
715
1.804688
2
[]
no_license
package byc.by.com.myyuekaodemo.presenter; import android.content.Context; import byc.by.com.myyuekaodemo.bean.Mydatas; import byc.by.com.myyuekaodemo.model.Mymodel; import byc.by.com.myyuekaodemo.view.Iviews; /** * Created by 白玉春 on 2017/11/22. */ public class Mypresenter { Mymodel mymodel; Context context; Iviews iviews; public Mypresenter(Context context, Iviews iviews) { this.context = context; this.iviews = iviews; this.mymodel = new Mymodel(); } public void Fnagfa(){ mymodel.Qing(new Iviews() { @Override public void Success(Mydatas m) { iviews.Success(m); } }); } }
true
e09167e6922673b1956879599fdc19f6df253553
Java
dsrodrigues/vote-no-restaurante
/src/main/java/br/com/bluesoft/votenorestaurante/model/Restaurant.java
UTF-8
1,865
2.421875
2
[ "MIT" ]
permissive
package br.com.bluesoft.votenorestaurante.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; @Entity @NamedQueries(value = { @NamedQuery(name = "restaurantFindAll", query = "SELECT r FROM Restaurant r"), @NamedQuery(name = "listByVoteDesc", query = "SELECT r FROM Restaurant r ORDER BY r.vote DESC"), @NamedQuery(name = "restaurantById", query = "SELECT r FROM Restaurant r WHERE r.id = ?")}) public class Restaurant { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer id; @Column(length = 45, nullable = false) String name; @Column(name = "image_path", length = 150) String imagePath; @Column(nullable = false) Integer vote = 0; public Restaurant() { } public Restaurant(int id, String name, String imagePath) { this.id = id; this.name = name; this.imagePath = imagePath; } public Restaurant(String name, String imagePath) { this.name = name; this.imagePath = imagePath; } 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; } public String getImagePath() { return imagePath; } public void setImagePath(String imagePath) { this.imagePath = imagePath; } public Integer getVote() { return vote; } public void setVote(Integer vote) { this.vote = vote; } @Override public String toString() { return "Restaurant [id=" + id + ", name=" + name + ", imagePath=" + imagePath + ", vote=" + vote + "]"; } public void addVote() { this.vote += 1; } }
true
eb9699392745f731b1c5df9caff8d656de190515
Java
yujie462714789/mygit
/branch_server/src/com/action/BaseAction.java
GB18030
1,408
2
2
[]
no_license
package com.action; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; public abstract class BaseAction { private static Log log = LogFactory.getLog(BaseAction.class); public abstract String add() throws Exception; public abstract String save() throws Exception; public abstract String edit() throws Exception; public abstract String update() throws Exception; public abstract String delete() throws Exception; public abstract String list() throws Exception; public abstract String detail() throws Exception; public abstract String search() throws Exception; /** * ȡrequest * * @return */ public HttpServletRequest getRequest() { return ServletActionContext.getRequest(); } /** * ȡresponse * * @return */ public HttpServletResponse getResponse() { return ServletActionContext.getResponse(); } /** * ȡsession * * @return */ @SuppressWarnings("unchecked") public Map<String, Object> getSession() { return ActionContext.getContext().getSession(); } }
true
452a4047a810b22a8b0dee11326b2dbe465b47da
Java
Aleemkhanaaa/demoB
/Oddtestclass.java
UTF-8
233
2.40625
2
[]
no_license
package Task1; import static org.junit.Assert.*; import org.junit.Test; public class Oddtestclass { @Test public void test() { Task1 obj=new Task1(); int output=obj.odd(5); assertEquals(5, output); } }
true
779414a5b6b7f32504e141a1f8015453a37d25f8
Java
pedrogodoy/obd-trip
/app/src/main/java/com/unigran/obd_trip/retrofit/service/TrajetoService.java
UTF-8
290
1.867188
2
[]
no_license
package com.unigran.obd_trip.retrofit.service; import com.unigran.obd_trip.model.Trajeto; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.POST; public interface TrajetoService { @POST("trajeto/criar") Call<Trajeto> enviaTrajeto(@Body Trajeto trajeto); }
true
87a60a3119b99df01cc64a2d61b5133253225d16
Java
epintos/image-treatment
/src/main/java/gui/tp0/Tp0.java
UTF-8
4,891
2.453125
2
[]
no_license
package gui.tp0; import app.ImageCreator; import app.ImageLoader; import app.ImageSaver; import gui.ExtensionFilter; import gui.MessageFrame; import gui.Panel; import gui.Window; import model.Image; import org.apache.sanselan.ImageWriteException; import javax.swing.*; import javax.swing.filechooser.FileFilter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; public class Tp0 extends JMenu { public JMenuItem saveImage = new JMenuItem("Guardar imagen"); private static final long serialVersionUID = 1L; public Tp0() { super("TP 0"); this.setEnabled(true); JMenuItem loadImage = new JMenuItem("Cargar imagen"); loadImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); FileFilter type = new ExtensionFilter("Imágenes", new String[] { ".pgm", ".PGM", ".ppm", ".PPM", ".bmp", ".BMP" }); chooser.addChoosableFileFilter(type); chooser.setAcceptAllFileFilterUsed(false); chooser.setFileFilter(type); chooser.showOpenDialog(Tp0.this); File arch = chooser.getSelectedFile(); Panel panel = (((Window) getTopLevelAncestor()).getPanel()); if (arch != null) { Image image = null; try { image = ImageLoader.loadImage(arch); } catch (Exception ex) { ex.printStackTrace(); new MessageFrame("No se pudo cargar la imagen"); } if (image != null) { // Loads the image to the panel panel.loadImage(image); // This will repaint the panel with the previous image // loaded panel.repaint(); } } } }); JMenuItem loadRaw = new JMenuItem("Cargar imagen Raw"); loadRaw.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); FileFilter type = new ExtensionFilter("Imágenes RAW", new String[] { ".raw", ".RAW" }); chooser.addChoosableFileFilter(type); chooser.setAcceptAllFileFilterUsed(false); chooser.setFileFilter(type); chooser.showOpenDialog(Tp0.this); File arch = chooser.getSelectedFile(); Panel panel = (((Window) getTopLevelAncestor()).getPanel()); if (arch != null) { JDialog rawParams = new RawImageDialog(panel, arch); rawParams.setVisible(true); } } }); saveImage.setEnabled(false); saveImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser selector = new JFileChooser(); selector.setApproveButtonText("Save"); selector.showSaveDialog(Tp0.this); File arch = selector.getSelectedFile(); if (arch != null) { Image image = (((Window) getTopLevelAncestor()).getPanel() .getWorkingImage()); try { ImageSaver.saveImage(arch, image); } catch (ImageWriteException ex) { new MessageFrame("No se pudo guardar la imagen"); } catch (IOException ex) { new MessageFrame("No se pudo guardar la imagen"); } } } }); JMenuItem binaryImage = new JMenuItem("Imagen binaria"); binaryImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Panel panel = (((Window) getTopLevelAncestor()).getPanel()); JDialog binaryImage = new CreateBinaryImageDialog(panel); binaryImage.setVisible(true); } }); JMenuItem circleBinaryImage = new JMenuItem("Imagen binaria círculo"); circleBinaryImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Panel panel = (((Window) getTopLevelAncestor()).getPanel()); Image img = ImageCreator.circle(300, 300); if (img != null) { panel.loadImage(img); panel.repaint(); } } }); JMenuItem degradeBW = new JMenuItem("Degrade de grises"); degradeBW.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Panel panel = (((Window) getTopLevelAncestor()).getPanel()); JDialog degrade = new DegradeDialog(panel, false); degrade.setVisible(true); } }); JMenuItem degradeColor = new JMenuItem("Degrade de colores"); degradeColor.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Panel panel = (((Window) getTopLevelAncestor()).getPanel()); JDialog degrade = new DegradeDialog(panel, true); degrade.setVisible(true); } }); this.add(loadImage); this.add(loadRaw); this.add(saveImage); this.add(new JSeparator()); this.add(binaryImage); this.add(circleBinaryImage); this.add(degradeBW); this.add(degradeColor); } }
true
75cc4bb6fe40a3b43dbd7aa8c0e978e5381726f5
Java
zhanght86/jeefuseMDA
/jeefuse-core/src/main/java/com/jeefuse/base/utils/compare/Match.java
UTF-8
262
2.34375
2
[]
no_license
package com.jeefuse.base.utils.compare; /**匹配器. * @author yonclv * @email [email protected] */ public interface Match<T> { /** * 如果匹配则返回true,否则返回false. * @param obj * @return */ public boolean isMatch(T obj); }
true
04f1531c257333da45535d9097f56fc75bfe2660
Java
upenderm/SampleApplication
/src/main/java/com/temporary/TempEnum.java
UTF-8
781
2.75
3
[]
no_license
package com.temporary; public enum TempEnum { DELHI("Delhi", "011", "Delhi STD code"), MUMBAI("Mumbai", "022", "Mumbai STD code"), CALCUTTA("Calcutta", "033", "Calcutta STD code"), CHENNAI( "Chennai", "044", "Chennai STD code"), HYDERABAD("Hyderabad", "040", "Hyderabad STD code"), BANGALORE("Bangalore", "080", "Bangalore"); private String cityName; private String stdCode; private String description; TempEnum(String cityName, String stdCode, String description) { this.cityName = cityName; this.stdCode = stdCode; this.description = description; } public String getCityName() { return cityName; } public String getStdCode() { return stdCode; } public String getDescription() { return description; } }
true
23f448cfb468657d4423e9c23bce89b10f4a4c3d
Java
LegendChen572/bobo
/src/server/buffs/cygnus/BlazeWizardBuff.java
UTF-8
2,833
2.328125
2
[]
no_license
/* * Decompiled with CFR 0.150. */ package server.buffs.cygnus; import client.MapleJob; import client.status.MonsterStatus; import handling.opcodes.MapleBuffStat; import java.util.ArrayList; import server.MapleStatEffect; import server.buffs.AbstractBuffClass; import tools.Pair; public class BlazeWizardBuff extends AbstractBuffClass { @Override public /* synthetic */ boolean containsJob(int a2) { return MapleJob.is\u70c8\u7130\u5deb\u5e2b(a2); } public /* synthetic */ BlazeWizardBuff() { BlazeWizardBuff a2; } @Override public /* synthetic */ ArrayList<Pair<MapleBuffStat, Integer>> handleBuff(MapleStatEffect a2, int a3) { ArrayList<Pair<MapleBuffStat, Integer>> arrayList = new ArrayList<Pair<MapleBuffStat, Integer>>(); switch (a3) { case 12101001: { a2.monsterStatus.put(MonsterStatus.SPEED, a2.x); return arrayList; } case 12111007: { a2.mpCon = (short)a2.y; a2.duration = 2100000000; ArrayList<Pair<MapleBuffStat, Integer>> arrayList2 = arrayList; arrayList2.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.TELEPORT_MASTERY, a2.x)); return arrayList2; } case 12101004: { ArrayList<Pair<MapleBuffStat, Integer>> arrayList3 = arrayList; arrayList3.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.BOOSTER, a2.x)); return arrayList3; } case 12001001: { ArrayList<Pair<MapleBuffStat, Integer>> arrayList4 = arrayList; arrayList4.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MAGIC_GUARD, a2.x)); return arrayList4; } case 12101005: { ArrayList<Pair<MapleBuffStat, Integer>> arrayList5 = arrayList; arrayList5.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ELEMENT_RESET, a2.x)); return arrayList5; } case 12000006: { ArrayList<Pair<MapleBuffStat, Integer>> arrayList6 = arrayList; while (false) { } arrayList6.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ELEMENT_WEAKEN, a2.x)); return arrayList6; } case 12001004: case 12111004: { ArrayList<Pair<MapleBuffStat, Integer>> arrayList7 = arrayList; arrayList7.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SUMMON, 1)); return arrayList7; } case 12111002: { a2.monsterStatus.put(MonsterStatus.SEAL, 1); return arrayList; } } return arrayList; } }
true
d20ec6442c34dcedec1d10fe0c3e1e3047907282
Java
binaryguy1001101/BuildCraft
/common/buildcraft/energy/EnergyProxyClient.java
UTF-8
1,318
1.976563
2
[]
no_license
/** * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team * http://www.mod-buildcraft.com * * BuildCraft is distributed under the terms of the Minecraft Mod Public * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.energy; import buildcraft.BuildCraftEnergy; import buildcraft.core.render.RenderingEntityBlocks; import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex; import buildcraft.energy.render.RenderEngine; import cpw.mods.fml.client.registry.ClientRegistry; public class EnergyProxyClient extends EnergyProxy { @Override public void registerTileEntities() { super.registerTileEntities(); ClientRegistry.bindTileEntitySpecialRenderer(TileEngine.class, new RenderEngine()); } @Override public void registerBlockRenderers() { RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 0), new RenderEngine(TileEngine.WOOD_TEXTURE)); RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 1), new RenderEngine(TileEngine.STONE_TEXTURE)); RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 2), new RenderEngine(TileEngine.IRON_TEXTURE)); } }
true
debc75d009119d822bda4e95c2fd4781b9dafe67
Java
LyuLv/springcloudDemo
/mysql-master-slave/src/main/java/com/lyu/mms/config/DBContextHolder.java
UTF-8
707
2.734375
3
[]
no_license
package com.lyu.mms.config; /** * @Author: Lyu * @Description: 通过ThreadLocal将数据源设置到每个线程上下文中 * @Date: Created in 17:06 2020/12/29 * @Modified By: */ public class DBContextHolder { private final static ThreadLocal<String> contextHolder = new ThreadLocal<>(); /** * 设置数据源 * @param dbType */ public static void set(String dbType) { contextHolder.set(dbType); } /** * 设置数据源 * @return */ public static String get() { return contextHolder.get(); } /** * 清除ThreadLocal中的上下文 */ public static void clear() { contextHolder.remove(); } }
true
a9279c74b83ec466ec694450ca26fd76ac410ea3
Java
GoncalvesGabriel/controle-usuario
/src/main/java/br/com/fiap/usuarios/repository/user/UserRepository.java
UTF-8
276
1.671875
2
[]
no_license
package br.com.fiap.usuarios.repository.user; import br.com.fiap.usuarios.entity.User; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<User, Long>, UserCustomRepository { User cpfCnpj(String cpfCnpj); }
true
8e018c49d40a71e82cbb85ddafd124103f02df09
Java
lizhenjuan/myfirstDemo
/demo/src/main/java/com/example/demo/message/Receiver.java
UTF-8
1,694
2.09375
2
[]
no_license
package com.example.demo.message; import com.alibaba.fastjson.JSON; import com.example.demo.coutmapper.CountMapper; import com.example.demo.service.IUserService; import com.example.demo.service.ServiceImpl.RedisService; import com.fasterxml.jackson.databind.util.JSONPObject; import com.alibaba.fastjson.JSONObject; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; @Component public class Receiver { @Autowired private IUserService userService; @Autowired RedisService redisService; @KafkaListener(topics = "demo") public void processMessage(String record){ //解析接收到的数据 MessageVo messageVo=JSON.parseObject(record,MessageVo.class); if (record!=null) { Integer recordId = messageVo.getRecordId(); System.out.println("========consumer开始消费"); //从redis中查询消费状态 Integer consumeStatus= (Integer) redisService.get("consumeStatus"+recordId); if (consumeStatus!=null && consumeStatus.equals(1)) { // 1:未消费,执行消费操作 Integer num = userService.updateCount(messageVo.getUserId(), messageVo.getCount()); System.out.println("==========consumer消费数量:" + num); if (num>0){ //将消费状态更新在redis中 redisService.set("consumeStatus",2); }else { //执行失败,将消息写入DB userService.insertFailureRecord(record); } } } } }
true