blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
527d7b09d5a53c81c915aa20a2839dedf675454c
fd6459b98e721a12a3bbf88bf5d9ee97ebe0dc69
/src/me/StevenLawson/TotalFreedomMod/Commands/SOURCE_TYPE_ALLOWED.java
376c22c97b28305a50096ca29a5da666e2d915e7
[]
no_license
xenosaga01/TotalFreedomMod
9b5c5378cee0c2066dbab7816a0a235e968726f9
bfa0324af9482df0da3517f0552d1e774fc5554e
refs/heads/master
2021-01-20T23:32:37.772343
2012-12-22T03:22:08
2012-12-22T03:22:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
124
java
package me.StevenLawson.TotalFreedomMod.Commands; public enum SOURCE_TYPE_ALLOWED { ONLY_IN_GAME, ONLY_CONSOLE, BOTH }
0f23cfe5ebc3005a2b2d428644096309c885e7b2
919502462a5b3378fc8d6f7467f3f1487f8924ef
/GUI.java
9e2c1e6261e06f87ffc474b19cc08e5ba16351c0
[]
no_license
ettextranamn/MontyHall
9d17d2659ad8bb93ee5a4cfaa54bb2a9e6802c79
f5eba45e1da2b0f0e55f4df8d5dbcf288cd61b45
refs/heads/main
2023-03-07T20:29:29.508529
2021-02-20T20:42:07
2021-02-20T20:42:07
340,742,831
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,809
java
//Kod skriven av William Hellberg import java.awt.*; import java.awt.event.*; import javax.swing.*; //klassen har 3 uppgifter och dessa har varsin funktion. //1: Skapa ett GUI, konstruktorn GUI() hanterar detta. //2: Reagera när användaren ber om simuleringar, funktionen actionPerformed(...) hanterar detta. //3: Visa resultaten av simuleringarna, funktionen resultOutput(...) hanterar detta. //Den tredje uppgiften är beroende på den andra, och både den andra och tredje är beroende av GUI:et. public class GUI implements ActionListener{ JFrame f; JMenuBar menuBar; JTextField tF1; JTextArea textArea; JScrollPane jSP; JPanel jP1; JButton b1; JLabel jL1; SimulationManager mySM; public GUI(){ //här skapas de olika delarna av GUI:et mySM=new SimulationManager(); menuBar=new JMenuBar(); b1=new JButton("Simulate"); tF1=new JTextField(); jL1=new JLabel("Enter number of simulations:"); textArea = new JTextArea(); textArea.setColumns(50); textArea.setLineWrap(true); textArea.setRows(32); textArea.setWrapStyleWord(true); textArea.setEditable(false); jSP = new JScrollPane(textArea); jP1=new JPanel(); jP1.setBorder(BorderFactory.createEtchedBorder()); jP1.add(jSP); menuBar.add(new JSeparator()); menuBar.add(jL1); menuBar.add(tF1); menuBar.add(b1); // Här lägger vi till en actionListener till "Simulate" knappen, så att programmet märker när någon trycker på knappen. b1.addActionListener(this); //Här sammanställer vi alla delarna i en JFrame. f = new JFrame("Monty Hall Simulations"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add("Center", jP1); f.pack(); f.setSize(new Dimension(600,600)); f.setVisible(true); f.setJMenuBar(menuBar); } public void resultOutput(long sSR,long simulations){ //Här skriver koden ut hur många simuleringar som kördes och vilka resultat som dessa fick. //Detta uttrycks i antalet gånger det var bättre att byta respektive stanna kvar vid den ursprungliga gissningen. long cases=simulations; long change=sSR; long remain=cases-change; textArea.append("Out of "+cases+" simulations"+System.lineSeparator()); textArea.append("It was favorable to change your mind in "+change+" cases"+System.lineSeparator()); textArea.append("While it was unfavorable to change your mind in "+remain+" cases"+System.lineSeparator()); if (change>remain){ textArea.append("Overall it was more favorable to change your mind"+System.lineSeparator()); }else if(change==remain) { textArea.append("Overall changing your mind didn't change the result"+System.lineSeparator()); }else{ textArea.append("Overall it was less favorable to change your mind"+System.lineSeparator()); } textArea.append(""+System.lineSeparator()); } public void actionPerformed(ActionEvent aE){ if (aE.getSource()==b1){ //Här reagerar programmet om någon trycker på knappen "Simulate". long iter=100; try { iter = Long.parseUnsignedLong(tF1.getText()); //Vi kollar då om användaren har skrivit in antalet simuleringar i textfältet bredvid knappen. } catch (Exception e){ System.out.println("That was not an unsigned integer, defaulting to "+iter); //Om användaren inte skriver något som känns igen så är standarden att köra 100 simuleringar. } //SimulationManager klassens funktion simulateSwitchRate(x) ser till att vi kör x stycken simuleringar. //Utfallet från dessa, samt antalet simuleringar, skickas vidare för att uttryckas som ett resultat. resultOutput(mySM.simulateSwitchRate(iter),iter); } } }
3f75f27bffdd9e2a7db0752a846b8b5865458712
3a00e51875596f9f618ab2548b95f6c1a1be9be6
/src/main/java/com/learn/java/constructorreference/ConstructorRefeEx.java
cf8a3e092b55f2814db243d96848af7f5953f018
[]
no_license
KuberPujar/Java8
21afa189f11946142affab426388f3aef92ee35e
b425af80b8ec9ad83091dc22c8044b3b836a2056
refs/heads/master
2023-05-06T09:52:44.524642
2021-06-01T17:34:08
2021-06-01T17:34:08
359,209,545
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.learn.java.constructorreference; import com.learn.java.data.Student; import java.util.function.Function; import java.util.function.Supplier; public class ConstructorRefeEx { static Supplier<Student> studentSupplier=Student::new; static Function<String,Student> studentFunction=Student::new; public static void main(String[] args) { System.out.println(studentSupplier.get()); System.out.println(studentFunction.apply("kuber")); } }
522c27b1709deab5e33723118893d249a682c200
f810087a17e41f7c8a1e16931cb8583ac8f064fb
/sardine-wms-common/src/main/java/com/hd123/sardine/wms/common/exception/WMSException.java
72e030ac52209ee5862b766eff99721539c40652
[]
no_license
SardineWMS/sardine-wms
262e7ecd2ee490030ea7eddbcac3ea789dae8816
919722dddeb938329ca75fbc684008a844ce296b
refs/heads/master
2021-04-29T06:16:35.374281
2017-12-05T10:42:22
2017-12-05T10:42:22
77,969,026
6
3
null
null
null
null
UTF-8
Java
false
false
1,097
java
/** * 版权所有(C),上海海鼎信息工程股份有限公司,2016,所有权利保留。 * * 项目名: sardine-wms-common * 文件名: WMSException.java * 模块说明: * 修改历史: * 2016年12月12日 - zhangsai - 创建。 */ package com.hd123.sardine.wms.common.exception; import java.text.MessageFormat; /** * WMS业务异常 * * @author zhangsai * */ public class WMSException extends Exception { private static final long serialVersionUID = 8596402022797074626L; public WMSException() { // do nothing } public WMSException(String message) { super(message); } public WMSException(Throwable caught) { super(caught); } public WMSException(Throwable caught, String message) { super(message, caught); } public WMSException(String pattern, Object... arguments) { super(MessageFormat.format(pattern, arguments)); } public WMSException(Throwable caught, String pattern, Object... arguments) { super(MessageFormat.format(pattern, arguments), caught); } }
4ff2f67213b4e65c6acacb06e9c2d72de8c0aa01
c5959330e2cd7b6af4e4dff24a268577b025add7
/project/src/mini_project/JobposServer.java
87a3385cc45d1830df7d0cec2f60aa4668d353dc
[]
no_license
eutic/the_beer
7f1ef821a0529879606a4fcb4e0202a55d0ee6a2
543a359b3d7ddabb5179a00f4d2983f09ebf3c10
refs/heads/master
2020-05-18T23:20:06.962084
2019-05-10T09:00:09
2019-05-10T09:00:09
184,709,659
0
0
null
null
null
null
UTF-8
Java
false
false
5,260
java
package mini_project; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Scanner; import static java.lang.Integer.*; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class JobposServer { ExceptionMethod em = new ExceptionMethod(); List<JobPosition> jobposes = new ArrayList<>(); // 입력순 Scanner scanner = new Scanner(System.in); // 기능수행 JobposServer() { read_data_file_jobpos(); // jobposes.add(new JobPosition("10", "대표이사")); // jobposes.add(new JobPosition("20", "전무")); // jobposes.add(new JobPosition("30", "상무")); // jobposes.add(new JobPosition("40", "이사")); // jobposes.add(new JobPosition("50", "부장")); // jobposes.add(new JobPosition("60", "차장")); // jobposes.add(new JobPosition("70", "과장")); // jobposes.add(new JobPosition("80", "대리")); // jobposes.add(new JobPosition("90", "사원")); } // 1.직급 조회 list void list(int sort_type) { order(sort_type); for (int i = 0; i < jobposes.size(); i++) { System.out.println(jobposes.get(i)); } } // 2.직급 추가 add void add() throws NumberFormatException, ExceptionNumberType { while (true) { System.out.print("직급 코드 >"); String jobpos = scanner.nextLine(); em.validateDigitsOfNumber("직급 코드", 2, jobpos); System.out.print("직급 이름 >"); String jobposName = scanner.nextLine(); em.validateKorean(jobposName); jobposes.add(new JobPosition(jobpos, jobposName)); System.out.println("이전메뉴[0], 계속[아무키] : "); jobpos = scanner.nextLine(); if (jobpos.equals("0")) break; } } private void order(int type) { // sort Collections.sort(jobposes, new Comparator<JobPosition>() { public int compare(JobPosition o1, JobPosition o2) { if (type == 1) { return (((JobPosition) o1).getJobpos()).compareTo(((JobPosition) o2).getJobpos()); } else { return (((JobPosition) o1).getJobposName()).compareTo(((JobPosition) o2).getJobposName()); } } }); } // 3. 직급 수정 modify void modify() throws ExceptionNumberType { Scanner scanner = new Scanner(System.in); System.out.println(); System.out.println("수정할 코드를 입력하세요."); String num = scanner.nextLine(); System.out.println("1.직급코드 수정 2.직급이름 수정"); int input = Integer.parseInt(scanner.nextLine()); int num1 = 0; switch (input) { case 1: // 코드 System.out.println("변경할 코드 번호를 입력하세요"); String jobpos = scanner.nextLine(); for (JobPosition jobPosition : jobposes) { if (jobPosition.getJobpos().equals(num)) { jobPosition.setJobpos(jobpos); } } em.validateDigitsOfNumber("직급 코드", 2, jobpos); break; case 2: // 직급 이름 System.out.println("변경할 직급명을 입력하세요"); String jobposName = scanner.nextLine(); for (int i = 0; i < jobposes.size(); i++) { if (jobposes.get(i).getJobpos().equals(num)) { num1 = i; } } jobposes.get(num1).setJobposName(jobposName); em.validateKorean(jobposName); break; default: break; } } // 4.직급 삭제 delete void delete() { System.out.print("삭제할 부서의 코드를 입력하세요 >"); String input = scanner.nextLine(); for (int i = 0; i < jobposes.size(); i++) { if (input.equals(jobposes.get(i).getJobpos())) { System.out.println(i + " " + jobposes.get(i).getJobpos()); jobposes.remove(i); break; } } } //파일로 저장된 자료를 읽어 Pay class의 필드로 binding함 public void read_data_file_jobpos() { String fpath="D:\\data\\"; try { FileReader fr = new FileReader(fpath+"jobpos.dat"); BufferedReader br = new BufferedReader(fr); String linebuf = ""; while((linebuf=br.readLine())!=null) { String[] arrbuf = linebuf.split("\t"); String Jobpos = arrbuf[0]; String Jobposname = arrbuf[1]; jobposes.add(new JobPosition(Jobpos,Jobposname)); } br.close(); } catch (IOException e) { e.printStackTrace(); } } //Pay class의 필드 자료들을 파일로 저장함. public void write_date_file_jobpos() { String fpath="D:\\data\\"; if (jobposes==null) { System.out.println("자료 Instance가 없습니다."); return; } try { FileWriter fw = new FileWriter(fpath+"jobpos.dat"); BufferedWriter bw = new BufferedWriter(fw); Iterator<JobPosition> iter = jobposes.iterator(); while(iter.hasNext()) { JobPosition jp = iter.next(); String sb=""; sb+=jp.getJobpos()+"\t"; sb+=jp.getJobposName()+"\r\n"; bw.write(sb); } bw.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "Admin@Admin-PC" ]
Admin@Admin-PC
aa8b9e36a09fc90da07de966858b3767aa505988
ed5159d056e98d6715357d0d14a9b3f20b764f89
/src/irvine/oeis/a022/A022300.java
ce2121e93e2afaa21ee5966b8478113009f2e9ab
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,001
java
package irvine.oeis.a022; import irvine.math.z.Z; import irvine.oeis.Sequence; import irvine.util.array.LongDynamicBooleanArray; /** * A022300 The sequence a of <code>1</code>'s and <code>2</code>'s starting with <code>(1,1,2,1)</code> such that <code>a(n)</code> is the length of the <code>(n+2)nd</code> run of a. * @author Sean A. Irvine */ public class A022300 implements Sequence { private final LongDynamicBooleanArray mA = new LongDynamicBooleanArray(); { mA.set(2); } protected long mN = -1; private long mS = 0; private long mT = 3; @Override public Z next() { if (++mN == mT) { final boolean next = !mA.isSet(mT - 1); final boolean b = mA.isSet(mS++); if (b) { // i.e. a "2" if (next) { mA.set(mT); mA.set(mT + 1); } mT += 2; } else { // i.e. a "1" if (next) { mA.set(mT); } ++mT; } } return mA.isSet(mN) ? Z.TWO : Z.ONE; } }
0d632ade8173e7d94826ec09353f304733c3de36
3778c175fd6bbed9f9bbd86fb92146a930cca87c
/src/main/java/com/siemens/industrialbenchmark/ExampleMain.java
d6a75ac0e93cd166dd7401389b851976405c1fe6
[ "Apache-2.0" ]
permissive
code4funn/industrialbenchmark
dc32c7d0beffc456d8a2f699e3f25e86920d798c
76a36e09f832c16f9f71f068a8af58eab9dc7b81
refs/heads/master
2021-03-01T03:49:24.503192
2020-06-14T22:12:15
2020-06-14T22:12:15
245,751,359
0
0
null
2020-03-08T04:25:27
2020-03-08T04:25:26
null
UTF-8
Java
false
false
4,459
java
/** Copyright 2016 Siemens AG. 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.siemens.industrialbenchmark; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Properties; import java.util.Random; import com.siemens.industrialbenchmark.datavector.action.ActionDelta; import com.siemens.industrialbenchmark.datavector.state.MarkovianStateDescription; import com.siemens.industrialbenchmark.dynamics.IndustrialBenchmarkDynamics; import com.siemens.industrialbenchmark.properties.PropertiesException; import com.siemens.industrialbenchmark.properties.PropertiesUtil; import com.siemens.industrialbenchmark.util.PlotCurve; import com.siemens.rl.interfaces.DataVector; import com.siemens.rl.interfaces.Environment; public class ExampleMain { /** * Run example benchmark with random actions for data generation purposes. * * @param args * @throws IOException * @throws PropertiesException */ public static void main(String[] args) throws IOException, PropertiesException { // configuration of the properties file String filename = "src/main/resources/sim.properties"; // default filepath if (args.length >= 1) { // if filepath was given to main() filename = args[0]; System.out.println("Using config file: '" + filename + "'"); } else { System.out.println("Using default config file: '" + filename + "'. A custom config file can be passed as an additional parameter."); } /** * Instantiate benchmark */ // setpoint configuration parameters Properties props = PropertiesUtil.setpointProperties( new File (filename)); // instantiate industrial benchmark Environment db = new IndustrialBenchmarkDynamics(props); // seed PRNG from configured seed in configuration file long seed = PropertiesUtil.getLong(props, "SEED", System.currentTimeMillis()); System.out.println("main seed: " + seed); Random rand = new Random(seed); DataVector markovState = db.getInternalMarkovState(); DataVector observableState = db.getState(); // apply constant action (gain and velocity transitions from 0 => 100) final ActionDelta deltaAction = new ActionDelta(0.1f, 0.1f, 0.1f); // write column headers FileWriter fwm = new FileWriter("dyn-markov.csv"); fwm.write("time "); for (String key : db.getInternalMarkovState().getKeys()) { fwm.write(key + " "); } fwm.write("\n"); FileWriter fw = new FileWriter("dyn-observable.csv"); fw.write("time "); for (String key : db.getState().getKeys()) { fw.write(key + " "); } fw.write("\n"); // data array for memorizing the reward final int steps = PropertiesUtil.getInt(props, "SIM_STEPS", 1500); double data[] = new double[steps]; /************************************************************* * Perform random actions and write markov state to text file *************************************************************/ for (int i = 0; i < steps; i++) { // set random action from the interval [-1, 1] deltaAction.setDeltaGain(2.f * (rand.nextFloat() - 0.5f)); deltaAction.setDeltaVelocity(2.f * (rand.nextFloat() - 0.5f)); deltaAction.setDeltaShift(2.f * (rand.nextFloat() - 0.5f)); db.step(deltaAction); markovState = db.getInternalMarkovState(); observableState = db.getState(); // write data fw.write(Integer.toString(i+1) + " "); for (String key : observableState.getKeys()) { fw.write(observableState.getValue(key) + " "); } fw.write("\n"); fwm.write(Integer.toString(i+1) + " "); for (String key : markovState.getKeys()) { fwm.write(markovState.getValue(key) + " "); } fwm.write("\n"); data[i] = db.getState().getValue(MarkovianStateDescription.RewardTotal); } fw.close(); fwm.close(); // plot reward PlotCurve.plot("RewardTotal", "t", "reward", data); } }
817809084b5012414c861e709dca1b591924fa59
122d31cb917902f44fceace16ba008f86c25738e
/Avant/src/cl/zpricing/avant/web/ShowMarkersController.java
b159c6d2c2614c4ce77c3cfa96c256571c10366f
[ "MIT" ]
permissive
zpricing/AvantPricing
5df76defbe557751b9b35605d73686ee8506975a
a274f511dd62d06e6abcf60192caf89a4b942f34
refs/heads/master
2021-02-11T07:19:02.616013
2020-07-14T15:49:46
2020-07-14T15:49:46
244,467,534
0
0
null
null
null
null
UTF-8
Java
false
false
4,889
java
/** * */ package cl.zpricing.avant.web; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import cl.zpricing.avant.model.Marker; import cl.zpricing.avant.servicios.MarkerDao; import cl.zpricing.avant.util.Util; /** * <b>Controlador encargado de mostrar el modulo de markers segun los parametros * entregados. Muestra la lista de markers pedidos.</b> * * Registro de versiones: * <ul> * <li>1.0 21-01-2009 MARIO: versi�n inicial.</li> * </ul> * <P> * <B>Todos los derechos reservados por ZhetaPricing.</B> * <P> */ public class ShowMarkersController implements Controller { /** * Impresi�n de log. */ private Logger log = (Logger) Logger.getLogger(this.getClass()); /* * (non-Javadoc) * * @see * org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ private MarkerDao markerDao; /** * @return the markerDao */ public MarkerDao getMarkerDao() { return markerDao; } /** * @param markerDao * the markerDao to set */ public void setMarkerDao(MarkerDao markerDao) { this.markerDao = markerDao; } @Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("handelRequest..."); HashMap<String, Object> map = new HashMap<String, Object>(); String[] peliculaIds = null; @SuppressWarnings("unused") String complejoId; // Obtengo un set de rangos de fecha. String rangoFechas = request.getParameter("rangoFechas"); String[] rangos = rangoFechas.split("/"); // Obtengo los rangos. ArrayList<HashMap<String, Object>> arrayMapRangos = new ArrayList<HashMap<String, Object>>(); for (int i = 0; i < rangos.length; i++) { String[] temp = rangos[i].split("_"); HashMap<String, Object> tempMap = new HashMap<String, Object>(2); tempMap.put("inicio", Util.StringToDate(temp[0])); tempMap.put("fin", Util.StringToDate(temp[1])); arrayMapRangos.add(tempMap); } // Obtengo los ids de peliculas si es que son pasados como parametros. if (request.getParameter("peliculaIds") != null) { String listaPeliculaIds = request.getParameter("peliculaIds"); peliculaIds = listaPeliculaIds.split("_"); } // Obtengo el id de complejo if (request.getParameter("complejoId") != null) { complejoId = request.getParameter("complejoId"); } // Itero sobre los rangos para obtener todos los markers en esos rangos. Iterator<HashMap<String, Object>> iterFechas = arrayMapRangos .iterator(); ArrayList<Marker> listaMarkers = new ArrayList<Marker>(); while (iterFechas.hasNext()) { HashMap<String, Object> temp = iterFechas.next(); Date inicio = (Date) temp.get("inicio"); Date fin = (Date) temp.get("fin"); listaMarkers.addAll(markerDao.listaMarkersEntreFechas(inicio, fin)); } // Reviso los markers y obtengo todos los que no son especificos. ArrayList<Marker> markersGenerales = new ArrayList<Marker>(); Iterator<Marker> iterMarkers = listaMarkers.iterator(); while (iterMarkers.hasNext()) { Marker tempM = iterMarkers.next(); if (tempM.getComplejo() == null && tempM.getPelicula() == null && !isMarkerInArray(tempM, markersGenerales)) { markersGenerales.add(tempM); } } if (request.getParameter("peliculaIds") != null) { for (int i = 0; i < peliculaIds.length; i++) { // Reviso los markers y obtengo todos los que tengan relacion // con una pelicula. iterMarkers = listaMarkers.iterator(); while (iterMarkers.hasNext()) { Marker tempM = iterMarkers.next(); if (tempM.getPelicula() != null && tempM.getPelicula().getId() == Integer .parseInt(peliculaIds[i])) { } } } } // Reviso los markers y obtengo todos los que tengan relacion con el // complejo. return new ModelAndView("showmarkers", "map", map); } /** * Revisa si existe el marker en el array dado. Lo hace comparando el Id del * marker. * * <P> * Registro de versiones: * <ul> * <li>1.0 26-01-2009 MARIO : Versi�n Inicial</li> * </ul> * </P> * * @param marker * @param array * @return * @since 1.0 */ private boolean isMarkerInArray(Marker marker, ArrayList<Marker> array) { Iterator<Marker> iter = array.iterator(); while (iter.hasNext()) { Marker m = iter.next(); if (marker.getId() == m.getId()) return true; } return false; } }
ab6f0f68c63cb27b30fba2f20e496d2e4ce3eac7
9fa19f83f16397d836887ada0e151f4ee8f7b429
/new_Android_APIs/app/src/main/java/me/blog/eyeballss/android_api/RecyclerViews/MyRecyclerViewAdapter2.java
07bd0defa7d4b39582cda00fd696395b89feeee6
[]
no_license
eyeballss/JAVA-Android-API
4e67c2146a25e7bedbe2d75f5de36597d1aeefd7
b5eca6047b39972144e6758010eae4f8b7471328
refs/heads/master
2021-01-20T07:20:50.018573
2018-04-17T11:22:17
2018-04-17T11:22:17
89,992,282
1
1
null
null
null
null
UTF-8
Java
false
false
1,814
java
package me.blog.eyeballss.android_api.RecyclerViews; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import me.blog.eyeballss.android_api.R; /** * Created by eye on 18. 3. 12. */ public class MyRecyclerViewAdapter2 extends RecyclerView.Adapter<MyRecyclerViewAdapter2.ViewHolder> { private ArrayList<String> mDataset; private int resource; public void add(ArrayList<String> data){ mDataset.addAll(data); notifyDataSetChanged(); } public MyRecyclerViewAdapter2(int resource) { this.resource = resource; mDataset = new ArrayList<String>(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(resource,parent,false); return new ViewHolder(view); } @Override public int getItemCount() { return mDataset.size(); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.mTextView.setText(mDataset.get(position)); if(position%2==0){ holder.mImageView.setImageResource(R.mipmap.ic_launcher); }else{ holder.mImageView.setImageResource(R.mipmap.ic_launcher_round); } } public static class ViewHolder extends RecyclerView.ViewHolder { public TextView mTextView; public ImageView mImageView; public ViewHolder(View view) { super(view); mTextView = (TextView) view.findViewById(R.id.textView2); mImageView = (ImageView) view.findViewById(R.id.imageView); } } }
5a6b5ca82fed0508870697dff24762b10d60716f
1da08e8c0d273e7ddebce33b6865a0aeabb77cc4
/src/main/java/edu/whu/irlab/client/web/wechat/TestWcPayController.java
21b7e01291eecd4668e819b89337c713c7ef85db
[]
no_license
RogerFang/WechatService
e8602fd3fa4537e5c1043bd7facb80cfb01b55ed
3bbb18878142486224942099487ff0cd61ede4b3
refs/heads/master
2021-01-20T18:08:26.380766
2016-12-02T08:15:40
2016-12-02T08:15:40
62,390,000
0
1
null
null
null
null
UTF-8
Java
false
false
10,049
java
package edu.whu.irlab.client.web.wechat; import com.alibaba.fastjson.JSONObject; import edu.whu.irlab.wechat.common.Configure; import edu.whu.irlab.wechat.common.XMLUtil; import edu.whu.irlab.wechat.util.CommonUtil; import edu.whu.irlab.wechat.wcpay.PayCommonUtil; import org.jdom2.JDOMException; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.Date; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; /** * Created by Roger on 2016/7/9. */ @Controller @RequestMapping("/testpay") public class TestWcPayController { @RequestMapping(value = "/payindex", method = RequestMethod.GET) public String testpay(){ System.out.println("pay index-------------------"); return "payindex"; } @RequestMapping(value = "/orderForActivity", method = RequestMethod.POST) @ResponseBody public Map<Object, Object> orderForActivity(String fee, HttpServletRequest request, HttpSession session) throws JDOMException, IOException { String openId = (String) session.getAttribute("openId"); fee = String.valueOf(new Double(Double.valueOf(fee)*100).intValue()); System.out.println("fee:" + fee); SortedMap<Object, Object> parameters = new TreeMap<>(); parameters.put("appid", Configure.getAppid()); parameters.put("mch_id", Configure.getMchid()); parameters.put("nonce_str", PayCommonUtil.CreateNoncestr()); parameters.put("body", "付费活动下订单"); parameters.put("out_trade_no", Long.toString(new Date().getTime())); parameters.put("total_fee", "1"); parameters.put("spbill_create_ip", "127.0.0.1"); parameters.put("notify_url", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); parameters.put("trade_type", "JSAPI"); parameters.put("openid", openId); //根据API给的签名规则进行签名 String sign = PayCommonUtil.createSign("UTF-8", parameters); parameters.put("sign", sign); String requestXML = PayCommonUtil.getRequestXml(parameters); System.out.println("requestXML: " + requestXML); String resultXml = CommonUtil.httpsRequestStr(Configure.UNIFIED_ORDER_URL, "POST", requestXML); System.out.println("resultXml: " + resultXml); Map<String, String> map = XMLUtil.doXMLParse(resultXml); SortedMap<Object,Object> params = new TreeMap<>(); params.put("appId", Configure.getAppid()); params.put("timeStamp", Long.toString(new Date().getTime())); params.put("nonceStr", PayCommonUtil.CreateNoncestr()); params.put("package", "prepay_id="+map.get("prepay_id")); params.put("signType", "MD5"); String paySign = PayCommonUtil.createSign("UTF-8", params); params.put("packageValue", "prepay_id="+map.get("prepay_id")); //这里用packageValue是预防package是关键字在js获取值出错 params.put("paySign", paySign); //paySign的生成规则和Sign的生成规则一致 params.put("sendUrl", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); //付款成功后跳转的页面 String userAgent = request.getHeader("user-agent"); char agent = userAgent.charAt(userAgent.indexOf("MicroMessenger")+15); params.put("agent", new String(new char[]{agent}));//微信版本号,用于前面提到的判断用户手机微信的版本是否是5.0以上版本。 for (Map.Entry<Object, Object> entry: params.entrySet()){ System.out.println(entry.getKey()+"\t"+entry.getValue()); } return params; } @RequestMapping(value = "/unifiedorder", method = RequestMethod.GET) @ResponseBody public Map<Object, Object> unifiedorder(String openId, HttpServletRequest request) throws IllegalAccessException, JDOMException, IOException { openId = "oNuNJv1RXGZfslerdEzC0SkGNeSQ"; SortedMap<Object, Object> parameters = new TreeMap(); parameters.put("appid", "wx61afb7c6dddd0806"); parameters.put("mch_id", Configure.getMchid()); parameters.put("nonce_str", PayCommonUtil.CreateNoncestr()); parameters.put("body", "LEO测试"); parameters.put("out_trade_no", Long.toString(new Date().getTime())); parameters.put("total_fee", "1"); parameters.put("spbill_create_ip", "127.0.0.1"); parameters.put("notify_url", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); parameters.put("trade_type", "JSAPI"); parameters.put("openid", openId); //根据API给的签名规则进行签名 String sign = PayCommonUtil.createSign("UTF-8", parameters); parameters.put("sign", sign); // for (Map.Entry<Object, Object> entry: parameters.entrySet()){ // System.out.println(entry.getKey()+"\t"+entry.getValue()); // } String requestXML = PayCommonUtil.getRequestXml(parameters); System.out.println("requestXML: " + requestXML); String resultXml = CommonUtil.httpsRequestStr(Configure.UNIFIED_ORDER_URL, "POST", requestXML); System.out.println("resultXml: " + resultXml); Map<String, String> map = XMLUtil.doXMLParse(resultXml); SortedMap<Object,Object> params = new TreeMap<Object,Object>(); params.put("appId", Configure.getAppid()); params.put("timeStamp", Long.toString(new Date().getTime())); params.put("nonceStr", PayCommonUtil.CreateNoncestr()); params.put("package", "prepay_id="+map.get("prepay_id")); params.put("signType", "MD5"); String paySign = PayCommonUtil.createSign("UTF-8", params); params.put("packageValue", "prepay_id="+map.get("prepay_id")); //这里用packageValue是预防package是关键字在js获取值出错 params.put("paySign", paySign); //paySign的生成规则和Sign的生成规则一致 params.put("sendUrl", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); //付款成功后跳转的页面 String userAgent = request.getHeader("user-agent"); char agent = userAgent.charAt(userAgent.indexOf("MicroMessenger")+15); params.put("agent", new String(new char[]{agent}));//微信版本号,用于前面提到的判断用户手机微信的版本是否是5.0以上版本。 for (Map.Entry<Object, Object> entry: params.entrySet()){ System.out.println(entry.getKey()+"\t"+entry.getValue()); } return params; } @RequestMapping(value = "/notify", method = RequestMethod.GET) public String notifySuccess(){ return "notify"; } @RequestMapping(value = "/testorder", method = RequestMethod.GET) public String testorder(HttpServletRequest request, Model model) throws JDOMException, IOException { String openId = "oNuNJv1RXGZfslerdEzC0SkGNeSQ"; SortedMap<Object, Object> parameters = new TreeMap(); parameters.put("appid", "wx61afb7c6dddd0806"); parameters.put("mch_id", Configure.getMchid()); parameters.put("nonce_str", PayCommonUtil.CreateNoncestr()); parameters.put("body", "LEO测试"); parameters.put("out_trade_no", "201607091510"); parameters.put("total_fee", "1"); parameters.put("spbill_create_ip", "127.0.0.1"); parameters.put("notify_url", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); parameters.put("trade_type", "JSAPI"); parameters.put("openid", openId); //根据API给的签名规则进行签名 String sign = PayCommonUtil.createSign("UTF-8", parameters); parameters.put("sign", sign); // for (Map.Entry<Object, Object> entry: parameters.entrySet()){ // System.out.println(entry.getKey()+"\t"+entry.getValue()); // } String requestXML = PayCommonUtil.getRequestXml(parameters); System.out.println("requestXML: " + requestXML); String resultXml = CommonUtil.httpsRequestStr(Configure.UNIFIED_ORDER_URL, "POST", requestXML); System.out.println("resultXml: " + resultXml); Map<String, String> map = XMLUtil.doXMLParse(resultXml); SortedMap<Object,Object> params = new TreeMap<Object,Object>(); params.put("appId", Configure.getAppid()); params.put("timeStamp", Long.toString(new Date().getTime())); params.put("nonceStr", PayCommonUtil.CreateNoncestr()); params.put("package", "prepay_id="+map.get("prepay_id")); params.put("signType", "MD5"); String paySign = PayCommonUtil.createSign("UTF-8", params); params.put("packageValue", "prepay_id="+map.get("prepay_id")); //这里用packageValue是预防package是关键字在js获取值出错 params.put("paySign", paySign); //paySign的生成规则和Sign的生成规则一致 params.put("sendUrl", "http://roger.tunnel.qydev.com/WechatService/testpay/notify"); //付款成功后跳转的页面 String userAgent = request.getHeader("user-agent"); char agent = userAgent.charAt(userAgent.indexOf("MicroMessenger")+15); params.put("agent", new String(new char[]{agent}));//微信版本号,用于前面提到的判断用户手机微信的版本是否是5.0以上版本。 model.addAttribute("orderParam", params); return "payorder"; } }
9ef5793e81b2b863e1a6a91451b293f530417547
ab87c1951cb6e0abc57d5698636317102e53f8f2
/heaplib/src/test/java/org/perfkit/heaplib/cli/CliCheck.java
cf22a98934f40629b2e4688ef4b104fef7836a44
[]
no_license
rive-n/heaplib
265c65916aa0f442c62aa3338067d3072a7666e6
04ae8ef5a2a7e75eb56de433c8814e04d6ca344e
refs/heads/master
2023-03-16T22:04:27.868602
2021-01-27T07:43:20
2021-01-27T07:43:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,423
java
/** * Copyright 2019 Alexey Ragozin * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.perfkit.heaplib.cli; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.lang.management.ManagementFactory; import org.junit.Assert; import org.junit.Assume; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.perfkit.heaplib.cli.HeapCLI; /** * JUnit command runner. * * @author Alexey Ragozin ([email protected]) */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CliCheck { private static String PID; static { PID = ManagementFactory.getRuntimeMXBean().getName(); PID = PID.substring(0, PID.indexOf('@')); } private static void assume_64bit() { Assume.assumeTrue("Should run on 64bit VM", ManagementFactory.getRuntimeMXBean().getVmName().contains("64")); } public void copy(String path, String target) { if (new File(target).isFile()) { new File(target).delete(); } if (new File(target).getParentFile() != null) { new File(target).getParentFile().mkdirs(); } try { FileInputStream fis = new FileInputStream(path); FileOutputStream fos = new FileOutputStream(target); byte[] buf = new byte[16 << 10]; while (true) { int n = fis.read(buf); if (n < 0) { break; } fos.write(buf, 0, n); } fis.close(); fos.close(); } catch (IOException e) { throw new RuntimeException(e); } } @Test public void help() { exec("--help"); } @Test public void list_commands() { exec("--commands"); } @Test public void histo() { exec("histo", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin"); } @Test public void histo_index() { exec("histo", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "--index", "target/hprof.aux"); } @Test public void histo_fast() { exec("histo", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin"); } @Test public void histo_big_dump() { assume_64bit(); exec("histo", "--noindex", "-d", "../dumps/dump1.live.hprof"); } @Test public void histo_big_dump2() { assume_64bit(); exec("histo", "-d", "../dumps/dump1.live.hprof", "-X"); } @Test public void mask() { exec("mask", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-s", "(**.Thread).name"); } @Test public void mask_rex() { exec("mask", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-s", "(**.Thread).name", "-m", ".*(Com).*(Thread).*"); } @Test public void mask_string() { exec("mask", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-s", "name", "-m", ".*(java).*"); } @Test public void mask_string_patch() { String target = "target/tmp/small_heap_mask_string_patch.bin"; copy("../hprof-oql-engine/src/test/resources/small_heap.bin", target); exec("mask", "--noindex", "--patch", "-d", target, "-s", "name", "-m", ".*(java).*"); exec("mask", "--noindex", "-d", target, "-s", "name"); } @Test public void mask_rex_patch() { String target = "target/tmp/small_heap_mask_rex_patch.bin"; copy("../hprof-oql-engine/src/test/resources/small_heap.bin", target); exec("mask", "--noindex", "--patch", "-d", target, "-s", "(**.Thread).name", "-m", ".*(Com).*(Thread).*"); exec("mask", "--noindex", "-d", target, "-s", "(**.Thread).name"); } @Test public void mask_bin_rex() { assume_64bit(); exec("mask", "--noindex", "-d", "../dumps/dump1.live.hprof", "-s", "(**.Thread).name", "-m", ".*serverUUID.*"); } @Test public void mask_bin_rex_patch() { assume_64bit(); exec("mask", "--noindex", "--patch", "-d", "../dumps/dump1.live.hprof", "-s", "(**.Thread).name", "-m", ".*serverUUID=([0-9a-z]+).*"); } @Test public void grep() { exec("grep", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-s", "name:.*(java).*", "(**.Thread).name", "-X"); } @Test public void exec() { exec("exec", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-e", "select a from java.lang.Thread a", "-X"); } @Test public void exec2() { exec("exec", "--noindex", "-d", "../hprof-oql-engine/src/test/resources/small_heap.bin", "-e", "select {name: a.name, priority: a.priority} from java.lang.Thread a", "-X"); } @Test public void exec_rwlock_dump_visvm() { exec("exec", "--noindex", "-X", "-d", "../hprof-oql-engine/src/test/resources/rwdeadlock.hprof", "-f", "../hprof-oql-engine/src/test/resources/oql/rwlock_dump_visvm.js"); } @Test public void exec_rwlock_dump() { exec("exec", "--noindex", "-X", "-d", "../hprof-oql-engine/src/test/resources/rwdeadlock.hprof", "-f", "../hprof-oql-engine/src/test/resources/oql/rwlock_dump_console.js"); } @Test public void exec_thread_dump() { exec("exec", "--index", "../blcdump.hprof.hwcache", "-X", "-d", "../dumps/blcdump.hprof", "-f", "../hprof-oql-engine/src/test/resources/oql/thread_dump_console.js"); } @Test public void exec_test() { String script = "length(map(\n" + " filter(\n" + " heap.roots(),\n" + " function(r) {\n" + " return root(r) && root(r).type == \"thread object\";\n" + " }\n" + " ),\n" + " function(t) {\n" + " \n" + " print(\"\\n#\" + t.id + \" \" + t.name.toString());\n" + " Java.type(\"java.util.Arrays\").asList(root(t).wrapped.getStackTrace()).forEach(function(e){ \n" + " print(\" \" + e);\n" + " }); \n" + " }\n" + "))\n" + "\n" + "\"\"" + ""; exec("exec", "--index", "../dumps/blcdump.hprof.hwcache", "-X", "-d", "../dumps/blcdump.hprof", "-e", script); } @Test public void exec_test2() { String script = "map(heap.finalizables(), function(f) {return f.value});" + ""; exec("exec", "--index", "../dumps/blcdump.hprof.hwcache", "-X", "-d", "../dumps/blcdump.hprof", "-e", script); } @Test public void exec_test3() { String script = "map(heap.classes(), function(f) {return f});" + ""; exec("exec", "--index", "../dumps/blcdump.hprof.hwcache", "-X", "-d", "../dumps/blcdump.hprof", "-e", script); } private void exec(String... cmd) { HeapCLI sjk = new HeapCLI(); sjk.suppressSystemExit(); StringBuilder sb = new StringBuilder(); sb.append("CLI"); for (String c : cmd) { sb.append(' ').append(escape(c)); } System.out.println(sb); Assert.assertTrue(sjk.start(cmd)); } private Object escape(String c) { if (c.split("\\s").length > 1) { return '\"' + c + '\"'; } else { return c; } } }
e3aafcfc6111485949b63ed7daaca9daa44bb211
8c99f97891d62d0dd996b1e062e17ad26532d6e7
/InfoPubLib/src/com/routon/inforelease/plan/create/pictureAdd/ListImageDirPopupWindow.java
ab6053b050ea0f252e59e7c59780b80401d06b3e
[ "Apache-2.0" ]
permissive
wyl710819/MyProject
0e2af8d521f975d718cae581b17f8797f1f92435
3001137d1593a8fac48a3c7ad2d278fab8f03711
refs/heads/master
2020-03-30T07:55:16.548450
2018-09-30T14:58:35
2018-09-30T14:58:35
150,974,722
0
0
null
null
null
null
UTF-8
Java
false
false
1,984
java
package com.routon.inforelease.plan.create.pictureAdd; import java.util.List; import com.routon.inforelease.R; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; public class ListImageDirPopupWindow extends BasePopupWindowForListView<ImageFloder> { private final String TAG = "ListImageDirPopupWindow"; private ListView mListDir; public ListImageDirPopupWindow(int width, int height, List<ImageFloder> datas, View convertView) { super(convertView, width, height, true, datas); } @Override public void initViews() { mListDir = (ListView) findViewById(R.id.id_list_dir); mListDir.setAdapter(new CommonAdapter<ImageFloder>(context, mDatas, R.layout.list_dir_item) { @Override public void convert(PictureSelViewHolder helper, ImageFloder item, int position) { // Log.i(TAG, "convert------------item:"+item.getName()); helper.setText(R.id.id_dir_item_name, item.getName()); helper.setImageByUrl(R.id.id_dir_item_image, item.getFirstImagePath()); helper.setText(R.id.id_dir_item_count, item.getCount() + "张"); } }); } public interface OnImageDirSelected { void selected(ImageFloder floder); } private OnImageDirSelected mImageDirSelected; public void setOnImageDirSelected(OnImageDirSelected mImageDirSelected) { this.mImageDirSelected = mImageDirSelected; } @Override public void initEvents() { mListDir.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mImageDirSelected != null) { mImageDirSelected.selected(mDatas.get(position)); } } }); } @Override public void init() { // TODO Auto-generated method stub } @Override protected void beforeInitWeNeedSomeParams(Object... params) { // TODO Auto-generated method stub } }
81723462d3e51448b5746ea37adb680a8e9241fc
7adb1d4a5734336ab2f2b1f51bf7bd44d200f71c
/app/src/main/java/com/example/jbihm_000/andrioidstudiohelloworld/MainActivity.java
616153100e29ccc7acc6f9f9754e7f03e6175351
[]
no_license
JBihms/AndrioidStudioHelloWorld
2a1d6ade8666ac4b207ecaf63a614d4b3935254e
d9bcb83f51879695fe71487572fa92d1faaab0f2
refs/heads/master
2021-01-01T06:44:43.674659
2015-01-15T00:15:41
2015-01-15T00:15:41
29,272,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.example.jbihm_000.andrioidstudiohelloworld; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
b185c3d3e6b34d7f6484cd7b03a76a09caaa005e
f82113b498d6b80541378753044381cf918bd547
/ PhilosophyJava/Сhapter 1-2/Ch-3/src/Interfaces/filters/LowPass.java
e40a5f060ef6c6263c72afc81f1b638dac241fb9
[]
no_license
TheForest13/Lessons
fd389702e24e18ca59ae59f4c128fc906ef8bd8f
739f9e9ba61817378b5834fe56b360ba10192f46
refs/heads/master
2023-02-08T14:15:06.536674
2021-01-03T18:33:28
2021-01-03T18:33:28
326,474,463
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package Interfaces.filters; public class LowPass extends Filter { double cutoff; public LowPass(double cutoff) { this.cutoff = cutoff; } public Waveform process(Waveform input) { return input; // Фиктивная обработка } }
72796834e5fbd42bfaf441292dbc946758257634
ec7495612b783f0c2423c310fb53126fdc035448
/kk/src/com/ista/demo/model/Language.java
bfc25cee26377c2def184f9359250cf4cbb3804a
[]
no_license
jmagit/ISTA
89e31f99e787f685d86c630cd0862a779a5a1cdd
f4ab391b8cffbecfa041821d3b9afed98c6b9de2
refs/heads/master
2020-05-01T16:26:28.540515
2019-11-03T20:45:55
2019-11-03T20:45:55
177,571,953
0
0
null
null
null
null
UTF-8
Java
false
false
2,076
java
package com.ista.demo.model; import java.io.Serializable; import javax.persistence.*; import java.util.Date; import java.util.List; /** * The persistent class for the "LANGUAGE" database table. * */ @Entity @Table(name="\"LANGUAGE\"") @NamedQuery(name="Language.findAll", query="SELECT l FROM Language l") public class Language implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="LANGUAGE_ID") private long languageId; @Temporal(TemporalType.DATE) @Column(name="LAST_UPDATE") private Date lastUpdate; private String name; //bi-directional many-to-one association to Film @OneToMany(mappedBy="language1") private List<Film> films1; //bi-directional many-to-one association to Film @OneToMany(mappedBy="language2") private List<Film> films2; public Language() { } public long getLanguageId() { return this.languageId; } public void setLanguageId(long languageId) { this.languageId = languageId; } public Date getLastUpdate() { return this.lastUpdate; } public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public List<Film> getFilms1() { return this.films1; } public void setFilms1(List<Film> films1) { this.films1 = films1; } public Film addFilms1(Film films1) { getFilms1().add(films1); films1.setLanguage1(this); return films1; } public Film removeFilms1(Film films1) { getFilms1().remove(films1); films1.setLanguage1(null); return films1; } public List<Film> getFilms2() { return this.films2; } public void setFilms2(List<Film> films2) { this.films2 = films2; } public Film addFilms2(Film films2) { getFilms2().add(films2); films2.setLanguage2(this); return films2; } public Film removeFilms2(Film films2) { getFilms2().remove(films2); films2.setLanguage2(null); return films2; } }
bd2e228105dfe7a5664a3e7973c0464bb9d73559
1c064e603636299ce39fe2fee4271da1b82446bc
/src/main/java/com/example/socketdemo/netty/DiscardServer.java
61c04527990e9257f40dee4d51e7f4a090d7f107
[]
no_license
dengchengli/io
744876c5b335028dcd0d3a265d5421b4100c8a26
dffe16d2f57723866884a7ec068fd3af09954728
refs/heads/master
2020-11-28T04:31:32.019463
2019-12-23T08:06:41
2019-12-23T08:06:41
229,703,778
0
0
null
null
null
null
UTF-8
Java
false
false
1,870
java
package com.example.socketdemo.netty; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; /** * @Author: Dely * @Date: 2019/11/3 14:27 */ public class DiscardServer { private int port = 9001; public void run() throws Exception { /** * */ EventLoopGroup bossGroup = new NioEventLoopGroup(); /** * */ EventLoopGroup workerGroup = new NioEventLoopGroup(); ServerBootstrap bootstrap = new ServerBootstrap(); try { bootstrap.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new DiscardServerHandler()); } }) .option(ChannelOption.SO_BACKLOG, 128) .childOption(ChannelOption.SO_KEEPALIVE, true); ChannelFuture future = bootstrap.bind(port).sync(); future.channel().closeFuture().sync(); } finally { workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); } } public static void main(String[] args) { try { new DiscardServer().run(); } catch (Exception e) { System.out.println("服务器出现异常:***********************"+e.getMessage()); } } }
ea9ffdec26f491a550048afd7b7616156e5d11b3
72077b271e4d59a41a96c70a4cf67839242840c6
/app/src/main/java/com/java/zhangjiayou/ui/home/TypeSettingActivity.java
c6c9f643b9d8a93026ab8bf789429292580497f3
[]
no_license
TB5z035/COVID-19News
ce42d0ee02b81c3d506a690798f2a353ca0f7e57
28b8efd3ca9f11bd40c5bd63aa2fea17fb2b662f
refs/heads/master
2023-02-13T18:43:38.537332
2021-01-12T12:43:10
2021-01-12T12:43:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,042
java
package com.java.zhangjiayou.ui.home; import android.animation.ValueAnimator; import android.content.ClipData; import android.content.ClipDescription; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.DragEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.RotateAnimation; import android.view.animation.ScaleAnimation; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import com.java.zhangjiayou.R; import java.util.ArrayList; import java.util.List; //TODO:Add animation public class TypeSettingActivity extends AppCompatActivity { private static final Integer TYPE_SETTING_ACTIVITY = 0; private LinearLayout selectedLinearLayout; private LinearLayout unselectedLinearLayout; private List<CardView> items; private static final String[] AllTypes = {"News", "Paper","经济与发展", "病毒研究进展", "感染形势"}; private ArrayList<String> availableList; class MyItemView extends RelativeLayout { private String type; public MyItemView(@NonNull Context context, String type) { super(context); this.type = type; setTag(type); inflate(context, R.layout.drag_item, this); CardView cardView = findViewById(R.id.select_card_view); cardView.setLongClickable(true); cardView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { v.startDragAndDrop( ClipData.newPlainText("Type", type), new View.DragShadowBuilder(MyItemView.this), MyItemView.this, 0 ); return false; } }); TextView textView = findViewById(R.id.select_text_view); textView.setText(type); } } private void startShakeByView(View view, float scaleSmall, float scaleLarge, float shakeDegrees, long duration) { Animation scaleAnim = new ScaleAnimation(scaleSmall, scaleLarge, scaleSmall, scaleLarge); Animation rotateAnim = new RotateAnimation(-shakeDegrees, shakeDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnim.setDuration(duration); scaleAnim.setRepeatMode(Animation.REVERSE); scaleAnim.setRepeatCount(ValueAnimator.INFINITE); rotateAnim.setDuration(duration); rotateAnim.setRepeatMode(Animation.REVERSE); rotateAnim.setRepeatCount(ValueAnimator.INFINITE); AnimationSet smallAnimationSet = new AnimationSet(false); smallAnimationSet.addAnimation(scaleAnim); smallAnimationSet.addAnimation(rotateAnim); view.startAnimation(smallAnimationSet); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_type_setting); getSupportActionBar().setTitle("Passage Types"); availableList = getIntent().getStringArrayListExtra("available"); Intent intent = new Intent(); intent.putExtra("available", new ArrayList<>(availableList)); TypeSettingActivity.this.setResult(TYPE_SETTING_ACTIVITY, intent); selectedLinearLayout = findViewById(R.id.selected_layout); unselectedLinearLayout = findViewById(R.id.unselected_layout); for (String item : AllTypes) { if (!availableList.contains(item)) { unselectedLinearLayout.addView(new MyItemView(this, item)); } } for (String item : availableList) { selectedLinearLayout.addView(new MyItemView(this, item)); } selectedLinearLayout.setOnDragListener((v, event) -> { final int action = event.getAction(); MyItemView child = (MyItemView) event.getLocalState(); ViewGroup parent = (ViewGroup) child.getParent(); ViewGroup target = (ViewGroup) v; switch (action) { case DragEvent.ACTION_DRAG_STARTED: // 拖拽开始 startShakeByView(child, 1f, 1f, 5, 50); return event.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN); case DragEvent.ACTION_DRAG_ENTERED: // 被拖拽View进入目标区域 child.clearAnimation(); parent.removeView(child); target.addView(child); startShakeByView(child, 1f, 1f, 5, 50); if (availableList.contains(child.type)) { availableList.remove(child.type); } if (!availableList.contains(child.type)) { availableList.add(child.type); } break; case DragEvent.ACTION_DRAG_LOCATION: // 被拖拽View在目标区域移动 break; case DragEvent.ACTION_DRAG_EXITED: // 被拖拽View离开目标区域 break; case DragEvent.ACTION_DROP: // 放开被拖拽View child.clearAnimation(); break; case DragEvent.ACTION_DRAG_ENDED: // 拖拽完成 break; default: return false; } Intent intent1 = new Intent(); intent1.putExtra("available", new ArrayList<>(availableList)); TypeSettingActivity.this.setResult(TYPE_SETTING_ACTIVITY, intent1); return true; }); unselectedLinearLayout.setOnDragListener((v, event) -> { final int action = event.getAction(); MyItemView child = (MyItemView) event.getLocalState(); ViewGroup parent = (ViewGroup) child.getParent(); ViewGroup target = (ViewGroup) v; switch (action) { case DragEvent.ACTION_DRAG_STARTED: // 拖拽开始 startShakeByView(child, 1f, 1f, 5, 50); return event.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN); case DragEvent.ACTION_DRAG_ENTERED: // 被拖拽View进入目标区域 child.clearAnimation(); parent.removeView(child); target.addView(child); startShakeByView(child, 1f, 1f, 5, 50); if (availableList.contains(child.type)) { availableList.remove(child.type); } break; case DragEvent.ACTION_DRAG_LOCATION: // 被拖拽View在目标区域移动 break; case DragEvent.ACTION_DRAG_EXITED: // 被拖拽View离开目标区域 break; case DragEvent.ACTION_DROP: // 放开被拖拽View child.clearAnimation(); break; case DragEvent.ACTION_DRAG_ENDED: // 拖拽完成 break; default: return false; } Intent intent1 = new Intent(); intent1.putExtra("available", new ArrayList<>(availableList)); TypeSettingActivity.this.setResult(TYPE_SETTING_ACTIVITY, intent1); return true; }); } }
f814dc3bab98e4c61553258ac250f9fa6df0b614
498747a0de9a3ea5eb38d34c4a3594d57df5f84e
/j/programmers/level1/p17_stars/Main.java
8f937c894d1e04b0e0f642b0eb2672431cde455d
[]
no_license
kiskim/study
aa79a1e5e021ee198b21375c2ccc78854bb3810e
2b43c9c733efa83d96aff82ff0a82b96b2997bd5
refs/heads/master
2023-04-21T10:53:36.563710
2021-05-02T11:05:39
2021-05-02T11:05:39
284,629,526
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package programmers.level1.p17_stars; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); for(int i = 0; i < b; i++) { for(int j = 0; j < a; j++) System.out.print("*"); System.out.println(); } sc.close(); } }
ddf9e4ef50da5e13aaa9ce2b4b6e267071a2ec58
31a19a4357ac4e5af88c88ae215e65aba5eec9de
/src/com/hh/app/api/RsBaseAction.java
26ffd6de32d29731cd673c507d8123a5243d07fb
[]
no_license
BuiXuanBach93/senhong
7fc4a7fec50dee4807230e95e4212fa8c672b87d
81d42847d8621ec3c9d7216c290c66a687ab60fb
refs/heads/master
2020-03-10T03:39:46.334567
2018-04-12T00:42:33
2018-04-12T00:42:33
129,170,994
0
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.hh.app.api; import com.hh.action.BaseAction; import com.hh.web.HttpSession; import com.hh.web.HttpUtils; import java.util.HashMap; /** * * @author agiletech */ public class RsBaseAction extends BaseAction{ public RsBaseAction(HttpUtils hu) { super(hu); returnData.put("data", ""); returnData.put("response_message", ""); returnData.put("error_code", ""); returnData.put("error_message", ""); } public Object getApiSessionAttribute(String key) { String accessToken = httpUtils.httpExchange.getRequestHeaders().get("access_token").get(0); HashMap apiSession = (HashMap)HttpSession.getInstance().getCacheAttribute(accessToken.getBytes()); return apiSession.get(key); } public void setApiSessionAttribute(String key, Object value) { String accessToken = httpUtils.httpExchange.getRequestHeaders().get("access_token").get(0); HashMap apiSession = (HashMap)HttpSession.getInstance().getCacheAttribute(accessToken.getBytes()); apiSession.put(key, value); HttpSession.getInstance().setCacheAttribute(accessToken.getBytes(), apiSession); } }
6c1924b88afb9c183d8e437224d310e2f1ec98fd
227539d7b04610862fb4b0d54a5b3aa936775ed1
/tn.esprit.liveup.ejb/ejbModule/services/JournalistServicesLocal.java
c812f48d2a3f9cf277720222771b3112334ab669
[]
no_license
liveupworldcup/liveup
22313773beb169e6ce7f6ea71a2ecade11df9827
b8b9db255fc6e715203cc300fef2daa870b0c3b6
refs/heads/master
2016-09-10T17:56:04.148969
2013-09-30T10:39:34
2013-09-30T10:39:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
package services; import java.util.List; import javax.ejb.Local; import tn.esprit.liveup.ejb.Journalist; @Local public interface JournalistServicesLocal { public void createJournalist(Journalist journalist); public void updateJournalist(Journalist journalist); public void deleteJournalist (Journalist journalist); public Journalist findJournalistById(int idJournalist); public List<Journalist> findAllJournalist(); }
0dbf13b07235e4602f88f0fd54f86e82c74deb8a
6583c5d44956aaca1295272dee4437690e3f99bb
/JeftyModulo2/src/java/Services/tarjetas.java
b18b3a3d8cef70af22b687a4f91889908a75a270
[]
no_license
jalvabus/jefty
bfb7b936567880b01ecfacfc2cfb5ad1d2f65d0d
a22c09c462a69c37e001a38f149ce3e72f823470
refs/heads/master
2020-03-23T17:18:18.727016
2018-07-21T23:57:08
2018-07-21T23:57:08
141,853,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,837
java
package Services; import DAO.DAO_TarjetaCredito; import DAO.DAO_TarjetaPrepago; import com.google.gson.Gson; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import Model.Cliente; import DAO.DAO_Cliente; @WebServlet(name = "tarjetas", urlPatterns = {"/tarjetas"}) public class tarjetas extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String action = request.getParameter("action"); DAO_TarjetaCredito tcredito = new DAO_TarjetaCredito(); DAO_TarjetaPrepago tprepago = new DAO_TarjetaPrepago(); Gson gson = new Gson(); if (action.equalsIgnoreCase("getSaldoCredito")) { String usuario = request.getParameter("id_usuario"); String tarjeta = request.getParameter("no_tarjeta"); Cliente cliente = new DAO.DAO_Cliente().getCliente(usuario); String tajeta = gson.toJson(tcredito.getTarjeta(tarjeta, String.valueOf(cliente.getId_cliente()))); out.println(tajeta); } if (action.equalsIgnoreCase("getSaldoPrepago")) { String usuario = request.getParameter("id_usuario"); String tarjeta = request.getParameter("no_tarjeta"); Cliente cliente = new DAO.DAO_Cliente().getCliente(usuario); String tajeta = gson.toJson(tprepago.getTarjeta(tarjeta, String.valueOf(cliente.getId_cliente()))); out.println(tajeta); } } }
385acc1697cb194383c6385dc4de38922ef7d6ea
51da6b1e71d5af9e0b058532f917fe366de5a016
/src/main/java/com/defaria/service/GreetingService.java
75602ed5cb25300547e081bd9c0b68517fd8b9c1
[]
no_license
krooksoma/spring-app-2
3f79f1b6e6c034fdf9e9cce8ffbd3dbace7b8e97
3106e65c9d3362c407e7340fbad6718e50a62e97
refs/heads/main
2023-08-15T07:59:58.150705
2021-10-18T19:55:26
2021-10-18T19:55:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.defaria.service; import com.defaria.aspect.Loggable; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; //stereotype of app component @Service public class GreetingService { @Value("${app.greeting}") private String greeting; public GreetingService(){ super(); } @Loggable public String getGreeting(String name){ return greeting + " " + name; } } // private final String greeting; // public GreetingService(String greeting){ // super(); // this.greeting = greeting; // }
ce1ce7eeb2ea020a4461fb1694676d95bb9c68fe
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-compute/samples/snippets/generated/com/google/cloud/compute/v1/backendservices/addsignedurlkey/SyncAddSignedUrlKey.java
6530bd9049cab523ab7494f809ce46d6ad635315
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481897
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
2023-09-13T21:21:23
2014-11-04T17:57:16
Java
UTF-8
Java
false
false
2,166
java
/* * Copyright 2023 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.compute.v1.samples; // [START compute_v1_generated_BackendServices_AddSignedUrlKey_sync] import com.google.cloud.compute.v1.AddSignedUrlKeyBackendServiceRequest; import com.google.cloud.compute.v1.BackendServicesClient; import com.google.cloud.compute.v1.Operation; import com.google.cloud.compute.v1.SignedUrlKey; public class SyncAddSignedUrlKey { public static void main(String[] args) throws Exception { syncAddSignedUrlKey(); } public static void syncAddSignedUrlKey() throws Exception { // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) { AddSignedUrlKeyBackendServiceRequest request = AddSignedUrlKeyBackendServiceRequest.newBuilder() .setBackendService("backendService-1884714623") .setProject("project-309310695") .setRequestId("requestId693933066") .setSignedUrlKeyResource(SignedUrlKey.newBuilder().build()) .build(); Operation response = backendServicesClient.addSignedUrlKeyAsync(request).get(); } } } // [END compute_v1_generated_BackendServices_AddSignedUrlKey_sync]
7886f1196364526bb48a08f25154bee2a1e3b382
93ed3ced0638593665b9842ad08945849b0b1574
/app/src/main/java/com/avaya/android/vantage/basic/fragments/IncomingCallFragment.java
d2b1d84584ed3a5f558aa32a2b28b2c2f46a9033
[]
no_license
AvayaCalaPoCDevGroup/AvayaBroadcastBasicAndroid
7eb9f41aa06ade27a680bc268bb8435b6a334438
7c3f77104fcadc1e726dc2d04f7d33a6751cb9a5
refs/heads/master
2021-03-31T05:38:43.810199
2020-03-17T22:27:41
2020-03-17T22:27:41
248,081,996
0
0
null
null
null
null
UTF-8
Java
false
false
14,248
java
package com.avaya.android.vantage.basic.fragments; import android.app.Dialog; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.os.PowerManager; import android.provider.MediaStore; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import com.avaya.android.vantage.basic.R; import com.avaya.android.vantage.basic.RingerService; import com.avaya.android.vantage.basic.Utils; import com.avaya.android.vantage.basic.activities.MainActivity; import com.avaya.android.vantage.basic.adaptors.UICallViewAdaptor; import com.avaya.android.vantage.basic.csdk.LocalContactInfo; import com.avaya.android.vantage.basic.csdk.SDKManager; import com.avaya.android.vantage.basic.model.UICall; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import static android.content.Context.POWER_SERVICE; /** * A simple {@link Fragment} subclass. */ public class IncomingCallFragment extends DialogFragment { protected static final String TAG = "IncomingCallFragment"; private static final int DIALOG_POSITION = 64; View mView; //Context mContext; UICallViewAdaptor mCallViewAdaptor = null; Map<Integer, View> map = new HashMap<Integer, View>(); private IncomingCallInteraction mCallBack; private PowerManager.WakeLock mScreenLock; private boolean mIsDismissed=false; public IncomingCallFragment() { } public void init(UICallViewAdaptor callViewAdaptor) { //mContext=context; mCallViewAdaptor=callViewAdaptor; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new Dialog(getActivity(), getTheme()){ @Override public void onBackPressed() { //do nothing if back was pressed during incoming call return; } }; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment mView = inflater.inflate(R.layout.incoming_call_list_layout, container, false); mCallBack = (IncomingCallInteraction) getActivity(); if ( getDialog().getWindow() != null ) { getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); getDialog().getWindow().setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); getDialog().setCanceledOnTouchOutside(false); WindowManager.LayoutParams params = getDialog().getWindow().getAttributes(); params.y = DIALOG_POSITION; getDialog().getWindow().setAttributes(params); } mCallBack.onIncomingCallStarted(); PowerManager pm = ((PowerManager) getContext().getSystemService(POWER_SERVICE)); if (!pm.isInteractive()) { mScreenLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG); mScreenLock.acquire(); } setupFullscreen(); return mView; } public boolean isDismissed() { return mIsDismissed; } /** * Sets IncomingCallView child elements with the values form the current call: * name, number, contact image * @param view View Incoming Call View object * @param call Current UICall object */ protected void setParameters(View view, UICall call){ TextView incomingName = (TextView) view.findViewById(R.id.incoming_dialog_name); TextView incomingNumber = (TextView) view.findViewById(R.id.incoming_dialog_number); TextView incomingSubject = (TextView) view.findViewById(R.id.incoming_dialog_subject); String contactName = Utils.getContactName(call.getRemoteNumber(), mCallViewAdaptor.getRemoteDisplayName(call.getCallId()), mCallViewAdaptor.isCMConferenceCall(call.getCallId())); if (incomingName != null) incomingName.setText(contactName); if (incomingNumber !=null) incomingNumber.setText(call.getRemoteNumber()); if (incomingSubject !=null) incomingSubject.setText(call.getSubject()); boolean isVideo = call.isVideo() && SDKManager.getInstance().getDeskPhoneServiceAdaptor().isVideoEnabled(); setListeners(view, call.getCallId(), isVideo); setContactImage(view, call.getRemoteNumber(),call.getRemoteDisplayName()); } /** * Implements on click listener for the accept and reject buttons of the * Incoming Call View * @param view Incoming Call View * @param callId ID of the current call * @param isVideo true if this is a video call */ protected void setListeners( View view, final int callId, boolean isVideo) { View reject = view.findViewById(R.id.reject_call); reject.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.i(TAG, "Dismiss activity"); mCallViewAdaptor.denyCall(callId); removeCall(callId); } }); View accept = view.findViewById(R.id.accept_audio); accept.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.i(TAG, "Activate another call"); mCallViewAdaptor.acceptCall(callId, false); removeCall(callId); } }); if (isVideo) { View acceptVideo = view.findViewById(R.id.accept_video); acceptVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.i(TAG, "Activate another call"); mCallViewAdaptor.acceptCall(callId, true); removeCall(callId); } }); } } /** * Accepts the specified Call and removes it from the list of incoming calls * @param callId ID of the call */ public void acceptAudioCall(int callId){ if (map.get(callId) != null) { mCallViewAdaptor.acceptCall(callId, false); removeCall(callId); } } /** * Removes the specified call from the map of the incoming calls, * Stops playing the ringtone * @param callId id of the Call to be removed */ synchronized public void removeCall(int callId){ Log.d(TAG, "remove call " + callId); View view = map.get(callId); if (view ==null) { return; } view.setVisibility(View.GONE); map.remove(callId); if (map.isEmpty()) { if (mView != null) { mIsDismissed = true; dismissAllowingStateLoss(); } stopPlayRingtone(); } FragmentManager fragmentManager = getFragmentManager(); List<Fragment> fragments = fragmentManager.getFragments(); if(fragments != null){ for(Fragment fragment : fragments){ if(fragment != null && fragment.isVisible() && fragment instanceof VideoCallFragment ) { if((MainActivity)getActivity()!=null) { ((MainActivity) getActivity()).changeUiForFullScreenInLandscape(true); } } } } } /** * If the specified call is still valid and actual incoming call, * it'll be assigned the IncomingCallView and be added in to the map * of incoming calls. * * @param call {@link UICall} object of the new incoming call. */ synchronized public void addCall(UICall call){ Log.d(TAG, "add call " + call.getCallId()); if (map.get(call.getCallId()) != null) { Log.i(TAG, "Call already exists"); return; } // prevent addition of the call that was ended meanwhile if (SDKManager.getInstance().getCallAdaptor().getCall(call.getCallId()) == null) { Log.i(TAG, "Call already ended"); return; } boolean isVideo = call.isVideo() && SDKManager.getInstance().getDeskPhoneServiceAdaptor().isVideoEnabled(); View view = getIncomingView(isVideo); if (map.isEmpty()){ startPlayRingtone(); } view.setVisibility(View.VISIBLE); setParameters(view, call); map.put(call.getCallId(), view); } /** * The Fragment can accommodate up to two incoming call views. This method * returns the first or the second View object (or their variation * if this is a video call) depending on the current status of incoming calls. * @param isVideo true if this is a video call * @return View object that for the incoming call dialog */ protected View getIncomingView(boolean isVideo){ View incomingVideo2 = mView.findViewById(R.id.incoming_video2); View incomingAudio2 = mView.findViewById(R.id.incoming2); if (map.isEmpty() || (!map.isEmpty() && (incomingVideo2.getVisibility() == View.VISIBLE) || incomingAudio2.getVisibility() == View.VISIBLE)){ if (isVideo) return mView.findViewById(R.id.incoming_video1); else return mView.findViewById(R.id.incoming1); } else { if (isVideo) return incomingVideo2; else return incomingAudio2; } } /** * Displaying contact photo thumbnail */ private void setContactImage(View view, String number, String name) { ImageView incomingImage = (ImageView) view.findViewById(R.id.incoming_dialog_image); String[] searchResult = LocalContactInfo.phoneNumberSearch(number); if (getActivity() == null) { //fragment is not attched to activity Log.d(TAG, "setContactImage: Fragment not attched to Activity"); return; } if(name.isEmpty()) { incomingImage.setContentDescription(number + getString(R.string.is_calling_content_description)); } else { incomingImage.setContentDescription(name + getString(R.string.is_calling_content_description)); } if (searchResult != null && searchResult.length > 2 && searchResult[3] != null && searchResult[3].trim().length() > 0){ Uri photoURI = Uri.parse(searchResult[3]); try { Bitmap uriImage = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), photoURI); RoundedBitmapDrawable contactThumbnail = RoundedBitmapDrawableFactory.create(getResources(), uriImage); contactThumbnail.setCircular(true); incomingImage.setBackground(contactThumbnail); } catch (IOException e) { e.printStackTrace(); } } else { incomingImage.setImageResource(R.drawable.ic_avatar_generic); } } /** * Change screen params to fullscreen preferences. */ private void setupFullscreen() { if (mView != null) { mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); } } /** * Stops playing the ringtone */ public void stopPlayRingtone(){ if (getContext() == null) return; getContext().stopService(new Intent(getContext(), RingerService.class)); } /** * Starts playing the ringtone */ private void startPlayRingtone(){ // loading admin ringtone settings if (getContext() == null) return; getContext().startService(new Intent(getContext(), RingerService.class)); } @Override public void onDestroyView() { super.onDestroyView(); if(mScreenLock != null && mScreenLock.isHeld()) { mScreenLock.release(); } } @Override public void onDetach() { super.onDetach(); if (!map.isEmpty()) { Log.d(TAG, "onDetach map is NOT empty"); stopPlayRingtone(); } } /** * Updates the corresponding Incoming call View with the remote contact name. * @param call {@link UICall} reference * @param newDisplayName String. Name of teh remote contact. */ public void setNewRemoteName(UICall call, final String newDisplayName) { if (call == null) return; View view = map.get(call.getCallId()); if (view == null) return; final TextView incomingName = (TextView) view.findViewById(R.id.incoming_dialog_name); if (incomingName != null) { String contactName = Utils.getContactName(call.getRemoteNumber(), newDisplayName, mCallViewAdaptor.isCMConferenceCall(call.getCallId())); if (contactName != null) { incomingName.setText(contactName); } } TextView incomingNumber = (TextView) view.findViewById(R.id.incoming_dialog_number); if (incomingNumber != null) { incomingNumber.setText(call.getRemoteNumber()); } setContactImage(view, call.getRemoteNumber(), newDisplayName); } public interface IncomingCallInteraction { void onIncomingCallEnded(); void onIncomingCallStarted(); } }
b285e7f1841d40a25d9b9b17c2d9d74617a3a24d
2cf2f09783273600991b360caf6c7464f6ea100c
/app/src/main/java/com/test/antony/megakittest/ui/base/BaseActivity.java
45a83d4604438659d10299bd174955d818d68d60
[]
no_license
Rotenkampf/test-application
f771ab97824b299b04611bbdc0f2cccbdb434d13
2bc5eef6a950c4ba02b95809a51ea0e921cc7688
refs/heads/master
2021-01-16T18:38:19.973816
2017-08-15T13:56:10
2017-08-15T13:56:10
100,104,621
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.test.antony.megakittest.ui.base; import android.app.Fragment; import android.support.v7.app.AppCompatActivity; import butterknife.Unbinder; /** * Created by Antony Mosin */ public class BaseActivity extends AppCompatActivity { private Unbinder mUnBinder; public void setUnBinder(Unbinder unBinder) { mUnBinder = unBinder; } public void onFragmentAttached(Fragment fragment){ } public void onFragmentDetached(){ } }
39f26b4c64c5615e3e1281e22d3806aaa6a9c3d4
7131fb7c4c7b71f3890ff7a7dc5fe3fc014aaf04
/src/com/dbvalidator/core/HanaMigrator.java
4a449ef002e751d3766a82c38815a5e48f48b94c
[]
no_license
abhishek-jain11/ValidationTool
046d9c8c91384339a165f2c62e2c09a3b0ba8b9a
1531b220b05e25646cde5b6e89c179114a41d527
refs/heads/master
2020-04-18T20:04:20.708288
2016-08-26T17:52:52
2016-08-26T17:52:52
66,667,432
0
0
null
null
null
null
UTF-8
Java
false
false
1,866
java
package com.dbvalidator.core; import java.sql.Connection; import java.sql.DriverManager; import java.util.HashMap; import java.util.List; import org.apache.logging.log4j.Logger; import com.dbvalidator.exception.ValidationToolException; import com.dbvalidator.logging.LoggerFactory; public class HanaMigrator { public static HashMap<String, List<String>> dataBasePoolMap = new HashMap<String, List<String>>(); private static final Logger logger = LoggerFactory.getLogger(HanaMigrator.class); public static final String HIERATCHY_VIEW_FILE = "create_company_hierarchy_views.sql"; public static final String PROCEDURE_FILE = "create_procedures.sql"; public static final String SUCCESS = "success"; public static final String FAIL = "fail"; public static String status = SUCCESS; public static int batchSize = 100; public static int tableCount = 0; public static int seqCount = 0; public static int indexCount = 0; public String databaseTimeZone = null; public static final String HANA_MIGRATION_config_id = "HANA_MIGRATION"; // Doing it this way cause SVN hook was preventing checking in otherwise. public static final String sDate = new StringBuilder("SYS").append("DATE").toString(); public static Connection getConnection(final String[] DBInput, final String DBJNDI, Connection Conn, String[] DBInfo, boolean hasExceptions) throws ValidationToolException { try { DBInfo = DBInput; logger.info("Conn: " + DBInfo[0] + "--" + DBInfo[1] + "--"); Conn = DriverManager.getConnection(DBInfo[0], DBInfo[1], DBInfo[2]); if (DBInfo[0].contains("sap")) { Conn.setAutoCommit(false); } } catch (final Exception e) { hasExceptions = true; status = FAIL; // logException(e, bw); throw new ValidationToolException(e); } return Conn; } }
c6c9a998545bde44d2129dc5b3bc232edba1afee
fb4d9beea2df2eb18c24127ad1b77171d6ee3995
/src/main/java/it/maraschi/testapp/web/rest/errors/BadRequestAlertException.java
aa139f8dc5962a685cac048071def5b21744ca45
[]
no_license
dandymi/jhtestapp
c0e56329c8d741d9e6b1a3b8930157a86c44d1e4
5e9ea6f16444badf56ac2b9a5f74a0a4b0b5fbec
refs/heads/master
2020-05-21T06:24:11.753982
2019-05-10T08:16:34
2019-05-10T08:16:34
185,943,368
0
0
null
2019-05-10T08:16:35
2019-05-10T07:47:28
Java
UTF-8
Java
false
false
1,322
java
package it.maraschi.testapp.web.rest.errors; import org.zalando.problem.AbstractThrowableProblem; import org.zalando.problem.Status; import java.net.URI; import java.util.HashMap; import java.util.Map; public class BadRequestAlertException extends AbstractThrowableProblem { private static final long serialVersionUID = 1L; private final String entityName; private final String errorKey; public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); } public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); this.entityName = entityName; this.errorKey = errorKey; } public String getEntityName() { return entityName; } public String getErrorKey() { return errorKey; } private static Map<String, Object> getAlertParameters(String entityName, String errorKey) { Map<String, Object> parameters = new HashMap<>(); parameters.put("message", "error." + errorKey); parameters.put("params", entityName); return parameters; } }
9e7f0153725c2be77baa4a1d4990e781a518473b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_fb48802e16b7d1c24f1f4488362e8c07f30e0219/FramesetFragment/7_fb48802e16b7d1c24f1f4488362e8c07f30e0219_FramesetFragment_t.java
d2faac13f37639f256454a1211908c1cf9c45274
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,141
java
/************************************************************************************* * Copyright (c) 2004 Actuate Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - Initial implementation. ************************************************************************************/ package org.eclipse.birt.report.presentation.aggregation.layout; import java.io.File; import java.io.IOException; import java.rmi.RemoteException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.axis.AxisFault; import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.IBirtConstants; import org.eclipse.birt.report.context.BaseAttributeBean; import org.eclipse.birt.report.context.BirtContext; import org.eclipse.birt.report.context.IContext; import org.eclipse.birt.report.presentation.aggregation.BirtBaseFragment; import org.eclipse.birt.report.presentation.aggregation.control.ToolbarFragment; import org.eclipse.birt.report.service.ReportEngineService; import org.eclipse.birt.report.service.actionhandler.BirtRenderReportActionHandler; import org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler; import org.eclipse.birt.report.soapengine.api.GetUpdatedObjectsResponse; import org.eclipse.birt.report.soapengine.api.Operation; import org.eclipse.birt.report.utility.ParameterAccessor; /** * Root fragment for web viewer composite. * <p> * * @see BaseFragment */ public class FramesetFragment extends BirtBaseFragment { /** * Override build method. */ protected void build( ) { addChild( new ToolbarFragment( ) ); addChild( new ReportFragment( ) ); } /** * Service provided by the fragment. This is the entry point of engine * framgent. It generally includes a JSP page to render a certain part of * web viewer. * * @param request * incoming http request * @param response * http response * @exception ServletException * @exception IOException */ public void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, BirtException { BaseAttributeBean attrBean = (BaseAttributeBean) request .getAttribute( IBirtConstants.ATTRIBUTE_BEAN ); if ( attrBean != null && !attrBean.isMissingParameter( ) && !ParameterAccessor.PARAM_FORMAT_HTML .equalsIgnoreCase( attrBean.getFormat( ) ) ) { this.doPreService( request, response ); this.doService( request, response ); this.doPostService( request, response ); } else { super.doPreService( request, response ); super.doService( request, response ); String target = super.doPostService( request, response ); if ( target != null && target.length( ) > 0 ) { RequestDispatcher rd = request.getRequestDispatcher( target ); rd.include( request, response ); } } } /** * Anything before do service. * * @param request * incoming http request * @param response * http response * @exception ServletException * @exception IOException */ protected void doPreService( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { String format = ParameterAccessor.getFormat( request ); if ( ParameterAccessor.PARAM_FORMAT_PDF.equalsIgnoreCase( format ) ) { response.setContentType( "application/pdf" ); //$NON-NLS-1$ String filename = ParameterAccessor.generateFileName( request ); response .setHeader( "Content-Disposition", "inline; filename=\"" + filename + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else { String mimeType = ReportEngineService.getInstance( ).getMIMEType( format ); if ( mimeType != null && mimeType.length( ) > 0 ) response.setContentType( mimeType ); else response.setContentType( "application/octet-stream" ); //$NON-NLS-1$ } } /** * Render the report in html/pdf format by calling frameset service. * * @param request * incoming http request * @param response * http response * @exception ServletException * @exception IOException */ protected void doService( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, BirtException { BaseAttributeBean attrBean = (BaseAttributeBean) request .getAttribute( IBirtConstants.ATTRIBUTE_BEAN ); assert attrBean != null; ServletOutputStream out = response.getOutputStream( ); IContext context = new BirtContext( request, response ); GetUpdatedObjectsResponse upResponse = new GetUpdatedObjectsResponse( ); Operation op = null; File file = new File( attrBean.getReportDocumentName( ) ); if ( !file.exists( ) ) { BirtRunReportActionHandler runReport = new BirtRunReportActionHandler( context, op, upResponse ); runReport.execute( ); } try { BirtRenderReportActionHandler renderReport = new BirtRenderReportActionHandler( context, op, upResponse, out ); renderReport.execute( ); } catch ( RemoteException e ) { AxisFault fault = (AxisFault) e; String message = "<html><body><font color=\"red\">" //$NON-NLS-1$ + ParameterAccessor.htmlEncode( fault.getFaultString( ) ) + "</font></body></html>"; //$NON-NLS-1$ out.write( message.getBytes( ) ); } } /** * Override implementation of doPostService. */ protected String doPostService( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { return null; } }
b0a1857f7a4753ffbc0c7c974d87e23b4f99e1e5
74af4ce5d2cd510ca87d7aee648dc37376f45f8b
/src/Inlämningsuppgift2/Model/models/Review.java
a474d79486fea34629ed8c769e10d20e8d196331
[]
no_license
PiXHULA/webshop-inlamning2
fd2e3f21a5ecbb196994f15d15fe00f6ff8bd036
ded599b20a1f240ded59ab4f10caaebc345da6bf
refs/heads/master
2020-12-22T17:02:10.853230
2020-01-29T00:17:09
2020-01-29T00:17:09
236,866,382
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package Inlämningsuppgift2.Model.models; import Inlämningsuppgift2.Model.models.ReviewProperties.Grade; public class Review { String comment; Grade grade; }
f7ad824659c4cffa49021cbe82495076b4b4b44f
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/model_seeding/52_lagoon-nu.staldal.lagoon.core.OutputEntry-1.0-9/nu/staldal/lagoon/core/OutputEntry_ESTest.java
c671b7ec494ac89f9bf83e3b1e1d08365e9f052f
[]
no_license
tigerqiu712/evosuite-model-seeding-empirical-evaluation
c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6
11a920b8213d9855082d3946233731c843baf7bc
refs/heads/master
2020-12-23T21:04:12.152289
2019-10-30T08:02:29
2019-10-30T08:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
/* * This file was automatically generated by EvoSuite * Sat Oct 26 00:47:57 GMT 2019 */ package nu.staldal.lagoon.core; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class OutputEntry_ESTest extends OutputEntry_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
2c261e7ebe55a3edf056391148f4368c09e2d404
36ac2ea1d385828a9e241accc58ca0b3bebb963d
/src/kpm/ls/TestActivity.java
3eca2c686018422f0a9fc9f66e983220716db7fe
[]
no_license
kkrystos/LifeStats_new
2d01aeb96f77995ebac3a5283ae417a312786402
3f5691953e1c0da99b9ee9505113bb95386d8878
refs/heads/master
2021-01-01T15:50:07.808274
2013-10-23T14:54:52
2013-10-23T14:54:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package kpm.ls; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class TestActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(getApplicationContext(), MainFragmentActivity.class)); } }); } }
2e27cd1ebea61386444d65710c4c6fefaec9171c
a90f7c740673b0089439009267a454a26c41aa88
/JasonXu-DialogFragment/app/src/androidTest/java/com/jasonxu/dialogfragment/ApplicationTest.java
62af5cdfe05d690b121bdc7948f2dd9e3b7bc6b1
[ "Apache-2.0" ]
permissive
ZhebaoXu/JasonXu-Dialogs
a723279b748fd4eddf24a773f01d36f4e8568116
2eef09ad4a65c3b61203a6e2bc703de8224f4d7f
refs/heads/master
2021-01-17T11:32:07.363819
2016-12-20T04:00:54
2016-12-20T04:00:54
61,767,528
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.jasonxu.dialogfragment; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
e5ea6ac9650c7a0a7b84c9c515328137fff8cc59
0a5f303dee6b8bd9049a7be8d6ee7282a5d3b213
/Command/DeviceRemote/DeviceButton.java
2300d6e4eaa72676dc38378703c8f0cff802cc4a
[]
no_license
tedahn/Java-Design-Patterns
c4788550e7b4bf8d8cf2f0e7540742f934be97b5
ce095de047fb008a08cd7a4d2eb54a926202ec79
refs/heads/master
2020-05-16T06:24:41.771638
2019-04-25T12:47:22
2019-04-25T12:47:22
182,846,712
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package DeviceRemote; public class DeviceButton { Command theCommand; public DeviceButton(Command newCommand) { theCommand = newCommand; } public void press() { theCommand.execute(); } public void pressUndo() { theCommand.undo(); } }
06358c9f2b951637a1d0a49cb909d5066ff17d63
141e2c950f1585fbd185aa225d6e673309d4919d
/webservice/ClientHello/src/com/fault/HelloWorldServiceLocator.java
2a7a847b82ea962d723fdcde53d1d34e17f25744
[]
no_license
priyas35/Mode1-Training
bf619f34c7758c0d9cbac39f68c521fae4e52395
ac9c50ecd95beaab957626d0dcdce7b4073552da
refs/heads/master
2022-12-31T20:10:30.751017
2019-09-27T06:52:23
2019-09-27T06:52:23
212,010,111
0
0
null
2022-12-15T23:31:07
2019-10-01T04:08:36
JavaScript
UTF-8
Java
false
false
5,179
java
/** * HelloWorldServiceLocator.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.fault; public class HelloWorldServiceLocator extends org.apache.axis.client.Service implements com.fault.HelloWorldService { public HelloWorldServiceLocator() { } public HelloWorldServiceLocator(org.apache.axis.EngineConfiguration config) { super(config); } public HelloWorldServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { super(wsdlLoc, sName); } // Use to get a proxy class for HelloWorldPort private java.lang.String HelloWorldPort_address = "http://127.0.0.1:1111/helloworld"; public java.lang.String getHelloWorldPortAddress() { return HelloWorldPort_address; } // The WSDD service name defaults to the port name. private java.lang.String HelloWorldPortWSDDServiceName = "HelloWorldPort"; public java.lang.String getHelloWorldPortWSDDServiceName() { return HelloWorldPortWSDDServiceName; } public void setHelloWorldPortWSDDServiceName(java.lang.String name) { HelloWorldPortWSDDServiceName = name; } public com.fault.HelloWorld getHelloWorldPort() throws javax.xml.rpc.ServiceException { java.net.URL endpoint; try { endpoint = new java.net.URL(HelloWorldPort_address); } catch (java.net.MalformedURLException e) { throw new javax.xml.rpc.ServiceException(e); } return getHelloWorldPort(endpoint); } public com.fault.HelloWorld getHelloWorldPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { try { com.fault.HelloWorldPortBindingStub _stub = new com.fault.HelloWorldPortBindingStub(portAddress, this); _stub.setPortName(getHelloWorldPortWSDDServiceName()); return _stub; } catch (org.apache.axis.AxisFault e) { return null; } } public void setHelloWorldPortEndpointAddress(java.lang.String address) { HelloWorldPort_address = address; } /** * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { try { if (com.fault.HelloWorld.class.isAssignableFrom(serviceEndpointInterface)) { com.fault.HelloWorldPortBindingStub _stub = new com.fault.HelloWorldPortBindingStub(new java.net.URL(HelloWorldPort_address), this); _stub.setPortName(getHelloWorldPortWSDDServiceName()); return _stub; } } catch (java.lang.Throwable t) { throw new javax.xml.rpc.ServiceException(t); } throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); } /** * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { if (portName == null) { return getPort(serviceEndpointInterface); } java.lang.String inputPortName = portName.getLocalPart(); if ("HelloWorldPort".equals(inputPortName)) { return getHelloWorldPort(); } else { java.rmi.Remote _stub = getPort(serviceEndpointInterface); ((org.apache.axis.client.Stub) _stub).setPortName(portName); return _stub; } } public javax.xml.namespace.QName getServiceName() { return new javax.xml.namespace.QName("http://fault.com/", "HelloWorldService"); } private java.util.HashSet ports = null; public java.util.Iterator getPorts() { if (ports == null) { ports = new java.util.HashSet(); ports.add(new javax.xml.namespace.QName("http://fault.com/", "HelloWorldPort")); } return ports.iterator(); } /** * Set the endpoint address for the specified port name. */ public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { if ("HelloWorldPort".equals(portName)) { setHelloWorldPortEndpointAddress(address); } else { // Unknown Port Name throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); } } /** * Set the endpoint address for the specified port name. */ public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { setEndpointAddress(portName.getLocalPart(), address); } }
125115a22bb261d370cbec34b22d235833230b16
c8aa1bf917efd8d11e143491e9e48c24f6848e0b
/src/main/java/com/example/demo/leetcode/AddTwoNumbers.java
25e91788626ed1040badc66029153c858eeb988a
[]
no_license
yuhonghao123/cache
b93ef9ce4fa84f824c08a9d89b0d24d3848ac0a9
510329aec1bd3b78af87600c07f48451bfb97d85
refs/heads/master
2023-07-02T00:22:12.953376
2021-08-09T03:25:16
2021-08-09T03:25:16
366,596,457
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
java
package com.example.demo.leetcode; /* 给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。 请你将两个数相加,并以相同形式返回一个表示和的链表。 你可以假设除了数字 0 之外,这两个数都不会以 0 开头 */ public class AddTwoNumbers { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode pre = new ListNode(0); ListNode cur = pre; int carry = 0; while(l1 != null || l2 != null) { int x = l1 == null ? 0 : l1.val; int y = l2 == null ? 0 : l2.val; int sum = x + y + carry; carry = sum / 10; sum = sum % 10; cur.next = new ListNode(sum); cur = cur.next; if(l1 != null) l1 = l1.next; if(l2 != null) l2 = l2.next; } if(carry == 1) { cur.next = new ListNode(carry); } return pre.next; } }
cca21b398be7163c54bdca38cf7a3d31ae904055
fd50b442a60a80eb1d1ff85893a35fb47c9ee7de
/src/main/java/com/wargame/service/DamageMonitoringService.java
d5f6ecba89b5688fa4334efc614d31c865adfdde
[]
no_license
coskunpeker/wargame
0556b16a1048de4bd6392c02a0eaf8a69b87e8a8
4e34b7f02888beba61f7c04f94ef85f69143db12
refs/heads/master
2021-05-22T23:04:19.731636
2020-04-05T04:17:32
2020-04-05T04:17:32
253,134,674
0
0
null
2021-01-05T23:42:20
2020-04-05T01:44:27
Java
UTF-8
Java
false
false
418
java
package com.wargame.service; import com.wargame.constants.MonitoringType; import org.springframework.stereotype.Service; import java.util.Random; @Service public class DamageMonitoringService implements MonitorService { @Override public int getStatistics() { return new Random().nextInt(100); } @Override public MonitoringType getType() { return MonitoringType.DAMAGE; } }
585634a28578772cad5f38dedf8a6aa298fe0869
c125914f47f16dee8d4bc0cf0a5687a169800852
/entry/src/ohosTest/java/com/nikitagordia/cosinloading/CosinTest.java
1d3d1adfb6e7fbecf4c0f01f029a68a061e45b44
[ "MIT", "Apache-2.0" ]
permissive
applibgroup/Cosin
b7c46e4478ed977c50a51bbafb7f456afb88fbc6
4db59ad971d149c80574afa96f28601d2f8fa578
refs/heads/master
2023-07-04T14:45:35.840442
2021-08-02T07:21:26
2021-08-02T07:21:26
389,899,655
0
1
NOASSERTION
2021-08-02T05:29:59
2021-07-27T08:07:53
Java
UTF-8
Java
false
false
4,703
java
/* * Copyright (C) 2020-21 Application Library Engineering Group * * 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.nikitagordia.cosinloading; import static org.junit.Assert.*; import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; import ohos.agp.components.Attr; import ohos.agp.components.AttrSet; import ohos.app.Context; import com.nikitagordia.cosin.Cosin; import org.junit.Before; import org.junit.Test; import java.util.Optional; public class CosinTest { private Cosin.ColorAdapter colorAdapter; private Cosin.TextAdapter textAdapter; private Cosin cosin; @Before public void setUp() { Context context; AttrSet attrSet; context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext(); attrSet = new AttrSet() { @Override public Optional<String> getStyle() { return Optional.empty(); } @Override public int getLength() { return 0; } @Override public Optional<Attr> getAttr(int i) { return Optional.empty(); } @Override public Optional<Attr> getAttr(String s) { return Optional.empty(); } }; cosin = new Cosin(context, attrSet); } @Test public void testGetSpeed() { double speed = cosin.getSpeed(); assertTrue(0.005d == speed); } @Test public void testSetSpeed() { double speed = 0.01d; cosin.setSpeed(speed); assertTrue(speed == cosin.getSpeed()); } @Test public void testIsLoadingData() { assertFalse(cosin.isLoadingData()); } @Test public void testSetLoadingData() { cosin.setLoadingData(true); assertTrue(cosin.isLoadingData()); } @Test public void testGetRectWidth() { int rectWidth = 60; assertEquals(rectWidth, cosin.getRectWidth()); } @Test public void testSetRectWidth() { int rectWidth = 50; cosin.setRectWidth(rectWidth); assertEquals(cosin.getRectWidth(), rectWidth); } @Test public void testGetPeriod() { double period = Math.PI; assertTrue(period == cosin.getPeriod()); } @Test public void testSetPeriod() { double period = Math.PI / 2d; cosin.setPeriod(period); assertTrue(period == cosin.getPeriod()); } @Test public void testGetViewWidth() { int viewWidth = 0; assertEquals(viewWidth, cosin.getViewWidth()); } @Test public void testSetLayoutWidth() { int width = 400; cosin.setLayoutWidth(width); assertEquals(width, cosin.getViewWidth()); } @Test public void testGetViewHeight() { int viewHeight = 0; assertEquals(viewHeight, cosin.getViewHeight()); } @Test public void testSetLayoutHeight() { int height = 400; cosin.setLayoutHeight(height); assertEquals(height, cosin.getViewHeight()); } @Test public void testGetColorAdapter() { assertNotNull(cosin.getColorAdapter()); } @Test public void testSetColorAdapter() { cosin.setColorAdapter(colorAdapter); assertEquals(colorAdapter, cosin.getColorAdapter()); } @Test public void testGetOffset() { double offset = 1.5d; assertTrue(offset == cosin.getOffset()); } @Test public void testSetOffset() { double offset = 1.0d; cosin.setOffset(offset); assertTrue(offset == cosin.getOffset()); } @Test public void testGetTextAdapter() { assertNotNull(cosin.getTextAdapter()); } @Test public void testSetTextAdapter() { cosin.setTextAdapter(textAdapter); assertEquals(textAdapter, cosin.getTextAdapter()); } @Test public void testIsDirectionRight() { assertFalse(cosin.isDirectionRight()); } @Test public void testSetDirectionRight() { cosin.setDirectionRight(true); assertEquals(true, cosin.isDirectionRight()); } }
a4a9251171879d7ad66fb4f1934e51000f639898
786a11c50986cf5b8538fce2506fbd96f49ca2ce
/app/src/androidTest/java/com/da08/threadstudy/ExampleInstrumentedTest.java
9cfd2bf5a97b360adf1e8e94e77d390ed57d407f
[]
no_license
daaa08/ThreadStudy
ab129ff79649d44839827a0aad89116f0a5c2f96
e2e3287faf912f61c02b93f3b38e747b6436c258
refs/heads/master
2021-01-20T23:09:15.898442
2017-09-04T14:24:19
2017-09-04T14:24:19
101,841,008
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.da08.threadstudy; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.da08.threadstudy", appContext.getPackageName()); } }
d621724c323ea6bf8e0905b256c1805cdf568db3
1c858615f0858dc2957f60896ed5e4cedd52ab10
/src/test/java/com/digitalpebble/classification/test/TestMultiFieldDocs.java
af8fdeaaf1cff8ce4e90c34aeeff3ee4e5a04f3d
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
DigitalPebble/TextClassification
f4008683028424ed3ffa4a393cb4f277aa1f4929
00bdf831195035697ef8aa3b1bd994bdbdc733c5
refs/heads/master
2021-12-26T03:39:43.109837
2021-09-24T13:26:48
2021-09-24T13:26:48
3,101,099
36
13
Apache-2.0
2021-09-24T13:26:49
2012-01-04T10:08:38
Java
UTF-8
Java
false
false
3,912
java
/** * Copyright 2009 DigitalPebble Ltd * * 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.digitalpebble.classification.test; import java.util.Map; import com.digitalpebble.classification.Document; import com.digitalpebble.classification.Field; import com.digitalpebble.classification.Parameters; import com.digitalpebble.classification.RAMTrainingCorpus; import com.digitalpebble.classification.TextClassifier; import com.digitalpebble.classification.Vector; public class TestMultiFieldDocs extends AbstractLearnerTest { public void testMultiField() throws Exception { Field[] fields = new Field[3]; fields[0] = new Field("title", new String[] { "This", "is", "a", "title" }); fields[1] = new Field("abstract", new String[] { "abstract" }); fields[2] = new Field("content", new String[] { "This", "is", "the", "content", "this", "will", "have", "a", "large", "value" }); learner.setMethod(Parameters.WeightingMethod.TFIDF); Document doc = learner.createDocument(fields, "large"); Field[] fields2 = new Field[2]; fields2[0] = new Field("title", new String[] { "This", "is", "not", "a", "title" }); // fields2[1] = new Field("abstract", new String[]{"abstract"}); fields2[1] = new Field("content", new String[] { "This", "is", "the", "content", "this", "will", "have", "a", "small", "value" }); learner.setMethod(Parameters.WeightingMethod.TFIDF); Document doc2 = learner.createDocument(fields2, "small"); // try putting the same field several times Field[] fields3 = new Field[3]; fields3[0] = new Field("title", new String[] { "This", "is", "not", "a", "title" }); // fields2[1] = new Field("abstract", new String[]{"abstract"}); fields3[1] = new Field("content", new String[] { "This", "is", "the", "content", "this", "will", "have", "a", "small", "value" }); fields3[2] = new Field("title", new String[] { "some", "different", "content" }); learner.setMethod(Parameters.WeightingMethod.TFIDF); Document doc3 = learner.createDocument(fields3, "small"); RAMTrainingCorpus corpus = new RAMTrainingCorpus(); corpus.add(doc); corpus.add(doc2); learner.learn(corpus); TextClassifier classi = TextClassifier.getClassifier(tempFile); double[] scores = classi.classify(doc); assertEquals("large", classi.getBestLabel(scores)); scores = classi.classify(doc2); assertEquals("small", classi.getBestLabel(scores)); scores = classi.classify(doc3); assertEquals("small", classi.getBestLabel(scores)); } public void testCustomWeightingScheme() throws Exception { Field[] fields = new Field[1]; fields[0] = new Field("keywords", new String[] { "test","keywords"}); learner.setMethod(Parameters.WeightingMethod.FREQUENCY); learner.getLexicon().setMethod(Parameters.WeightingMethod.BOOLEAN, "keywords"); Document doc = learner.createDocument(fields, "large"); Vector vector = doc.getFeatureVector(learner.getLexicon()); // check that the values for the field keywords are boolean int[] indices = vector.getIndices(); double[] values = vector.getValues(); Map<Integer, String> invertedIndex = learner.getLexicon() .getInvertedIndex(); for (int i = 0; i < indices.length; i++) { // retrieve the corresponding entry in the lexicon String label = invertedIndex.get(indices[i]); double expected = 1.0; assertEquals("label: "+label,expected, values[i]); } } }
a3dd0ac462dc887b9d8c8bd07acf12be08ee0582
9318c2be291d6f53518fda8ac82d64a61f1cba74
/364507/src/com/stackoverflow/solution/Pedido.java
55e3069e23fab1b4917d7767f9ff72bb6a04911f
[]
no_license
joellobo/stackoverflow
d44d04fdd5fd9ae77f07bce28562abfe24ffc75c
8d741f923e3dffae31cac651439d2d5e1257e994
refs/heads/master
2020-04-22T23:20:46.994499
2019-02-26T01:54:15
2019-02-26T01:54:15
170,738,417
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.stackoverflow.solution; public class Pedido { private Cliente cliente; private Pagamento pagamento; public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; } public Pagamento getPagamento() { return pagamento; } public void setPagamento(Pagamento pagamento) { this.pagamento = pagamento; } }
b7288ba2f6b453fa7b60b437ccdb88ae20c68c26
c9e6bf888590fa0d15efd3e51b7699db375328e1
/app/src/main/java/com/example/wahaybi/jar/RegisterdPost.java
0b63403c12069541e5274fed11d52cee032ca1bb
[]
no_license
ali7developer/Jar
461f16725f98ed7695847385c6d5a92c9cadc90c
b352acffee62d1f9d035775fa916564c985fe5ee
refs/heads/master
2020-04-10T23:59:10.694473
2018-12-18T11:35:32
2018-12-18T11:35:32
161,371,376
0
0
null
null
null
null
UTF-8
Java
false
false
1,569
java
package com.example.wahaybi.jar; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; public class RegisterdPost extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registerd_post); LinearLayout rootView = findViewById(R.id.rootView); TextView textR = new TextView(this); textR.setText(MainActivity.textP); textR.setTextSize(24); rootView.addView(textR); Button postButton = new Button(this); postButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); postButton.setText("Post"); postButton.setBackgroundColor(getResources().getColor(R.color.g)); rootView.addView(postButton); //RegisterdPost post = new RegisterdPost(); //Toast toast = new Toast(this); postButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Your Post Has Been Registerd!", Toast.LENGTH_LONG).show(); } }); } }
3d4f49bed748889b8a7d5fc25a6bf506bc6a8deb
8b7d00e56964f55e5a59d75d85bef81a07fac74c
/app/src/main/java/com/example/williamsumitro/dress/view/view/openstore/adapter/StepAdapter.java
24dfe34f056a3bd1d2294289ab83730bf72aef79
[]
no_license
williamsumitro/pj001
308b58085b9d10626b06178bbb587f514c89cfd0
bd9236b129045c411512df41e85b9cdd2b0ac700
refs/heads/master
2021-09-20T17:35:18.436745
2018-08-13T15:19:21
2018-08-13T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,916
java
package com.example.williamsumitro.dress.view.view.openstore.adapter; import android.content.Context; import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.v4.app.FragmentManager; import com.example.williamsumitro.dress.view.view.openstore.fragment.Openstore_choosestorenameFragment; import com.example.williamsumitro.dress.view.view.openstore.fragment.Openstore_storeinformationFragment; import com.stepstone.stepper.Step; import com.stepstone.stepper.adapter.AbstractFragmentStepAdapter; import com.stepstone.stepper.viewmodel.StepViewModel; /** * Created by WilliamSumitro on 01/05/2018. */ public class StepAdapter extends AbstractFragmentStepAdapter { private static final String CURRENT_STEP_POSITION = "CURRENT_STEP_POSITION"; public StepAdapter(@NonNull FragmentManager fm, @NonNull Context context) { super(fm, context); getPagerAdapter().notifyDataSetChanged(); } @Override public Step createStep(int position) { switch (position){ case 0: return new Openstore_choosestorenameFragment(); case 1: return new Openstore_storeinformationFragment(); default: throw new IllegalArgumentException("Unsupported position: " + position); } } @Override public int getCount() { return 2; } @NonNull @Override public StepViewModel getViewModel(@IntRange(from = 0) int position) { //Override this method to set Step title for the Tabs, not necessary for other stepper types StepViewModel.Builder builder = new StepViewModel.Builder(context); if (position == 0) { builder.setTitle("Choose Store Name"); } else if(position == 1){ builder.setTitle("Store Information"); } return builder.create(); } }
584492c028d06be3f935f32637e33863cc1062f6
d237a9cc0dccf9db65ca011364c4def39ac42e58
/src/main/java/net/technoage/springboot/saml/service/SAMLUserDetailsServiceImpl.java
b2aae29bf69f7dd6af9727d4ae6ec2e77fffd114
[ "Apache-2.0" ]
permissive
devilcius/SpringBootSAMLWithLoginForm
e984cb5b2a06eb81163d74876f55f5a29e6ef1dd
43375f86d26d55e633b9661eec6d61bffe0cd5d2
refs/heads/master
2020-06-03T03:22:59.655842
2019-07-15T09:53:39
2019-07-15T09:53:39
191,415,473
1
0
null
null
null
null
UTF-8
Java
false
false
1,594
java
package net.technoage.springboot.saml.service; import net.technoage.springboot.saml.domain.CurrentUser; import net.technoage.springboot.saml.entity.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.saml.SAMLCredential; import org.springframework.security.saml.userdetails.SAMLUserDetailsService; import org.springframework.stereotype.Service; @Service public class SAMLUserDetailsServiceImpl implements SAMLUserDetailsService { // Logger private static final Logger LOGGER = LoggerFactory.getLogger(SAMLUserDetailsServiceImpl.class); private final UserServiceInterface userService; public SAMLUserDetailsServiceImpl(UserServiceInterface userService) { this.userService = userService; } @Override public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundException { // The method is supposed to identify local account of user referenced by // data in the SAML assertion and return UserDetails object describing the user. String userEmail = credential.getNameID().getValue(); LOGGER.debug("Authenticating user with mail = {}", userEmail); User user = this.userService.getUserByEmail(userEmail) .orElseThrow(() -> new UsernameNotFoundException(String.format("User with email=%s was not found", userEmail)) ); return new CurrentUser(user); } }
1018be80fed1a4a309ffafcb4815108713271b5a
026db508c5e287ceb593cfa14d0bce8eb01742ba
/grocery-modules/grocery-upms-service/src/main/java/com/ribuluo/admin/common/util/baiduUtil/BaiduResult.java
f08ba5f89f505fbd3aa11011f72e8cc9f1a1ece0
[ "MIT" ]
permissive
ren85153/grocery
c9d9c03a329c3107317862c85e9197ed1eef5de6
7b93f264fe789d70123e9f022ecc18112b040fc8
refs/heads/master
2020-12-13T20:41:10.325473
2019-12-29T17:02:52
2019-12-29T17:02:52
234,526,297
0
0
NOASSERTION
2020-01-17T10:29:53
2020-01-17T10:29:52
null
UTF-8
Java
false
false
800
java
package com.ribuluo.admin.common.util.baiduUtil; import java.util.List; public class BaiduResult { private int spam; private List<String> review; private List<String> reject; private List<BaiduPass> pass; public void setSpam(int spam) { this.spam = spam; } public int getSpam() { return spam; } public void setReview(List<String> review) { this.review = review; } public List<String> getReview() { return review; } public void setReject(List<String> reject) { this.reject = reject; } public List<String> getReject() { return reject; } public void setPass(List<BaiduPass> pass) { this.pass = pass; } public List<BaiduPass> getPass() { return pass; } }
b425f836f8f49155611876712b84ae54b9f9dcd4
f1369672dccbd6318d8876f9cf7c2b74f16730bf
/CSI2110/Labs/lab1_sol/lab1_sol/GLinkList.java
e732fe6f8b6d77ca24be70cc960380541fb9dc5d
[]
no_license
obenn/Academic
d1460a2a192be778d1e2e7ae99c6b8d2cbf4df7d
c81cadc0b4173322ef797e378d393929cf8e51ed
refs/heads/master
2021-09-06T17:39:58.560670
2018-02-09T05:24:26
2018-02-09T05:24:26
119,112,398
1
0
null
null
null
null
UTF-8
Java
false
false
1,945
java
/** * Builds a singly linked list of size 5 and prints it to the console. * * @author Jochen Lang */ class GLinkList { GNode<String> llist; //Type is String GLinkList( int sz ) { if ( sz <= 0 ) { llist = null; } else { // start with list of size 1 llist = new GNode<String>( "0", null ); GNode<String> current = llist; // temp node for loop // add further nodes for ( int i=1; i<sz; ++i ) { // create node and attach it to the list GNode<String> node2Add = new GNode<String>( Integer.toString(i), null ); current.setNext(node2Add); // add first node current=node2Add; } } } /** * Print all the elements of the list assuming that they are Strings */ public void print() { /* Print the list */ GNode<String> current = llist; // point to the first node while (current != null) { System.out.print((String)current.getElement() + " "); current = current.getNext(); // move to the next } System.out.println(); } public void deleteFirst() { if ( llist != null ) { llist = llist.getNext(); } } public void deleteLast() { if ( llist == null ) return; // no node GNode<String> prev = llist; GNode<String> current = prev.getNext(); if ( current == null ) { // only 1 node llist = null; return; } while ( current.getNext() != null ) { // more than 1 node prev = current; current = current.getNext(); } prev.setNext( null ); return; } // create and display a linked list public static void main(String [] args){ /* Create the list */ GLinkList llist = new GLinkList( 5 ); /* Print the list */ llist.print(); /* delete first and print */ llist.deleteFirst(); llist.print(); /* delete last and print 5 times */ for ( int i=0; i< 5; ++i ) { llist.deleteLast(); llist.print(); } } }
67b231427b26af245a8d6811e21c046d0f8228b1
266eaca28edbe6da6221c1b1b48ea271fbe1c077
/app/src/main/java/com/sevenlearn/googlemapsample/MainActivity.java
4bd3b105dd36ab13bacc11abd6724a8a4e2e96e9
[]
no_license
saeedsh92/googlemap-sample
fe491468dff164c2f4aebd6c0f412dee08df91a9
6c72795dd586520d8e24bcd059e692987d102c1d
refs/heads/master
2021-05-04T14:25:14.190530
2018-02-08T15:45:43
2018-02-08T15:45:43
120,200,206
3
1
null
null
null
null
UTF-8
Java
false
false
343
java
package com.sevenlearn.googlemapsample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
59568f325d1c0dc870b4449abf890244c86812b1
c186dfd092ca810b57f045fa186dccaf54d68f68
/java/org/apache/catalina/filters/RemoteHostFilter.java
12318bed01352376b1b216fbe7913dd7ef1b4591
[ "Zlib", "LZMA-exception", "CPL-1.0", "bzip2-1.0.6", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "EPL-2.0", "CDDL-1.0", "LicenseRef-scancode-public-domain" ]
permissive
fhanik/tomcat
138e0da6b80014c9aa973553db6dc571d0580bba
40387a24e7f63771d255639abb2d8639a26a750e
refs/heads/master
2022-01-22T05:35:59.582430
2020-10-02T22:17:35
2020-10-05T17:35:48
235,397,078
1
0
Apache-2.0
2020-01-21T17:11:14
2020-01-21T17:11:14
null
UTF-8
Java
false
false
2,431
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.filters; import java.io.IOException; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletResponse; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; /** * Concrete implementation of <code>RequestFilter</code> that filters * based on the remote client's host name. * * @author Craig R. McClanahan * */ public final class RemoteHostFilter extends RequestFilter { // Log must be non-static as loggers are created per class-loader and this // Filter may be used in multiple class loaders private final Log log = LogFactory.getLog(RemoteHostFilter.class); // must not be static /** * Extract the desired request property, and pass it (along with the * specified request and response objects and associated filter chain) to * the protected <code>process()</code> method to perform the actual * filtering. * * @param request The servlet request to be processed * @param response The servlet response to be created * @param chain The filter chain for this request * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { process(request.getRemoteHost(), request, response, chain); } @Override protected Log getLogger() { return log; } }
e2d6cc39494e171d8eeda942f1511d974dbaab24
b5de080d322295a70e5fc5e32fd89979440ba610
/RandomNumbers.java
945c7f97e193cf800c88d793246c0e1db4dd41bd
[]
no_license
Vyand/JavaBegginer
90c9a28328e390f14751ed2013f154fe6766eb75
a4a9abb9f799c73db4a95ba5cfc42d7c04a9e7a5
refs/heads/main
2023-08-17T18:10:27.351182
2021-10-26T11:50:56
2021-10-26T11:50:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,322
java
//Number Guessing Game in Java Swing //Also posted at import java.util.Random; import java.util.Scanner; public class RandomNumbers { public static void main(String[] args) { Random rand = new Random(); int numberToGuess = rand.nextInt(10); int numberOfTries = 0; Scanner input = new Scanner(System.in); int guess; boolean win = false; while(win == false) { System.out.println("Guess a number between 1 and 10"); guess = input.nextInt(); numberOfTries++; if(guess == numberOfTries) { win = true; } else if(guess> numberToGuess) { System.out.println("Your guess is to high"); } else if(guess< numberToGuess) { System.out.println("Your guess is to low"); } } System.out.println("You win!!"); System.out.println("The number was " + numberToGuess); System.out.println("It took you " + numberOfTries + " tries"); } } /*import java.util.Random; public class RandomNumbers{ public static void main(String[] args) { Random objGenerator = new Random(); for (int iCount = 0; iCount< 7; iCount++){ int randomNumber = objGenerator.nextInt(49); System.out.println("Random No : " + randomNumber); } } }*/
c3d4e08ead927b0e085dccba517409d440777325
9f12069e97712a791f626c71891879aeb262a2dc
/src/main/java/data/dao/MemberDao.java
8fc4bfdb45f3f85c86e73287082b681af2528526
[]
no_license
jse6146/SpringBoardTest
e0182c9488c4af9360fa2ed7bbb233a04e1d37bc
97b9b19badb66f726e1c7a59bc776707569a1e26
refs/heads/master
2022-12-14T01:31:03.178113
2020-09-15T13:27:25
2020-09-15T13:27:25
291,722,042
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package data.dao; import java.util.List; import java.util.Map; import org.mybatis.spring.support.SqlSessionDaoSupport; import org.springframework.stereotype.Repository; import data.dto.MemberDto; @Repository public class MemberDao extends SqlSessionDaoSupport implements MemberDaoInter{ @Override public List<MemberDto> getList() { // TODO Auto-generated method stub return getSqlSession().selectList("memberList"); } @Override public int join(MemberDto dto) { // TODO Auto-generated method stub return getSqlSession().insert("memberJoin", dto); } @Override public MemberDto login(Map<String, String> map) { // TODO Auto-generated method stub return getSqlSession().selectOne("memberLogin", map); } }
7fd51dc86de7edf5d7a83a840e67bb774be8b822
93fb5de69d1049db47b989b9964b397aa8bdf567
/iot-cloud/src/main/java/com/vidots/lot/model/Device.java
e7c955c39d0a70b7bf48e30072778b94bc2f7b0e
[]
no_license
vidots/iot
d06d4385148e97f5306287fb54ba52466af2d7c0
44988dc82032ad4b78433f31a2defdc1c3632ed4
refs/heads/main
2023-04-03T14:29:12.727292
2021-04-27T04:30:36
2021-04-27T04:30:36
361,979,094
2
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.vidots.lot.model; import lombok.Data; import javax.persistence.Id; import javax.persistence.Table; @Data @Table(name = "device") public class Device { @Id private Integer id; private String deviceKey; private String deviceSecret; private String name; private String properties; }
c68db0ffbbb97b77c0ca41dd48d5735af034edb7
e579388f6011e21d9f73dd171a2a37377f1991d8
/src/com/example/cacaniquel/RankingActivity.java
91c93b0a18aea49cd3095213a3b1f726d0a455c9
[]
no_license
gustavobrigatti/CacaNiquel
66f569a2cbbfbb01cbbc733b00e8062e7666a18d
4e06f23c534e6a8c4209aa9f285e21406e50634b
refs/heads/master
2022-03-11T17:30:31.836794
2019-12-09T22:05:35
2019-12-09T22:05:35
117,553,004
2
0
null
null
null
null
UTF-8
Java
false
false
1,110
java
package com.example.cacaniquel; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListView; import sp.senai.br.dao.JogadorDAO; public class RankingActivity extends Activity { ListView lvRanking; private Jogador jogador; private List<Jogador> alJogador; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ranking); lvRanking = (ListView) findViewById(R.id.lvListaRanking); //Avisa o layout que o componente possui um menu de contexto. registerForContextMenu(lvRanking); JogadorDAO dao = new JogadorDAO(this); alJogador=dao.getLista(); dao.close(); //ArrayAdapter<Aluno> adapter = new ArrayAdapter<Aluno>(this, android.R.layout.simple_list_item_1, alAluno); ArrayAdapter<Jogador> adapter = new ArrayAdapter<Jogador>(this, android.R.layout.simple_list_item_1, alJogador); lvRanking.setAdapter(adapter); } }
5da355fa1cef566c488182f0ea5d956f6bd00077
cd15756c7e57947dd98eb3a8e4942b8ad3e694d9
/google-ads/src/main/java/com/google/ads/googleads/v0/services/GenderViewServiceGrpc.java
b8b88b58b858016615ee1addf4ba9e331a701bbb
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
DalavanCloud/google-ads-java
e4d967d3f36c4c9f0f06b98a74cd12cda90d5a85
70d951aa0202833b3e487fb909fd5294e1dda405
refs/heads/master
2020-04-21T13:07:19.440871
2019-02-06T13:54:21
2019-02-06T13:54:21
169,587,855
1
0
Apache-2.0
2019-02-07T14:49:54
2019-02-07T14:49:54
null
UTF-8
Java
false
false
12,309
java
package com.google.ads.googleads.v0.services; import static io.grpc.MethodDescriptor.generateFullMethodName; import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; import static io.grpc.stub.ClientCalls.asyncUnaryCall; import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; import static io.grpc.stub.ClientCalls.blockingUnaryCall; import static io.grpc.stub.ClientCalls.futureUnaryCall; import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; import static io.grpc.stub.ServerCalls.asyncUnaryCall; import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; /** * <pre> * Service to manage gender views. * </pre> */ @javax.annotation.Generated( value = "by gRPC proto compiler (version 1.10.0)", comments = "Source: google/ads/googleads/v0/services/gender_view_service.proto") public final class GenderViewServiceGrpc { private GenderViewServiceGrpc() {} public static final String SERVICE_NAME = "google.ads.googleads.v0.services.GenderViewService"; // Static method descriptors that strictly reflect the proto. @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") @java.lang.Deprecated // Use {@link #getGetGenderViewMethod()} instead. public static final io.grpc.MethodDescriptor<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView> METHOD_GET_GENDER_VIEW = getGetGenderViewMethodHelper(); private static volatile io.grpc.MethodDescriptor<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView> getGetGenderViewMethod; @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") public static io.grpc.MethodDescriptor<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView> getGetGenderViewMethod() { return getGetGenderViewMethodHelper(); } private static io.grpc.MethodDescriptor<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView> getGetGenderViewMethodHelper() { io.grpc.MethodDescriptor<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView> getGetGenderViewMethod; if ((getGetGenderViewMethod = GenderViewServiceGrpc.getGetGenderViewMethod) == null) { synchronized (GenderViewServiceGrpc.class) { if ((getGetGenderViewMethod = GenderViewServiceGrpc.getGetGenderViewMethod) == null) { GenderViewServiceGrpc.getGetGenderViewMethod = getGetGenderViewMethod = io.grpc.MethodDescriptor.<com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName( "google.ads.googleads.v0.services.GenderViewService", "GetGenderView")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.google.ads.googleads.v0.services.GetGenderViewRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.google.ads.googleads.v0.resources.GenderView.getDefaultInstance())) .setSchemaDescriptor(new GenderViewServiceMethodDescriptorSupplier("GetGenderView")) .build(); } } } return getGetGenderViewMethod; } /** * Creates a new async stub that supports all call types for the service */ public static GenderViewServiceStub newStub(io.grpc.Channel channel) { return new GenderViewServiceStub(channel); } /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ public static GenderViewServiceBlockingStub newBlockingStub( io.grpc.Channel channel) { return new GenderViewServiceBlockingStub(channel); } /** * Creates a new ListenableFuture-style stub that supports unary calls on the service */ public static GenderViewServiceFutureStub newFutureStub( io.grpc.Channel channel) { return new GenderViewServiceFutureStub(channel); } /** * <pre> * Service to manage gender views. * </pre> */ public static abstract class GenderViewServiceImplBase implements io.grpc.BindableService { /** * <pre> * Returns the requested gender view in full detail. * </pre> */ public void getGenderView(com.google.ads.googleads.v0.services.GetGenderViewRequest request, io.grpc.stub.StreamObserver<com.google.ads.googleads.v0.resources.GenderView> responseObserver) { asyncUnimplementedUnaryCall(getGetGenderViewMethodHelper(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( getGetGenderViewMethodHelper(), asyncUnaryCall( new MethodHandlers< com.google.ads.googleads.v0.services.GetGenderViewRequest, com.google.ads.googleads.v0.resources.GenderView>( this, METHODID_GET_GENDER_VIEW))) .build(); } } /** * <pre> * Service to manage gender views. * </pre> */ public static final class GenderViewServiceStub extends io.grpc.stub.AbstractStub<GenderViewServiceStub> { private GenderViewServiceStub(io.grpc.Channel channel) { super(channel); } private GenderViewServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected GenderViewServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new GenderViewServiceStub(channel, callOptions); } /** * <pre> * Returns the requested gender view in full detail. * </pre> */ public void getGenderView(com.google.ads.googleads.v0.services.GetGenderViewRequest request, io.grpc.stub.StreamObserver<com.google.ads.googleads.v0.resources.GenderView> responseObserver) { asyncUnaryCall( getChannel().newCall(getGetGenderViewMethodHelper(), getCallOptions()), request, responseObserver); } } /** * <pre> * Service to manage gender views. * </pre> */ public static final class GenderViewServiceBlockingStub extends io.grpc.stub.AbstractStub<GenderViewServiceBlockingStub> { private GenderViewServiceBlockingStub(io.grpc.Channel channel) { super(channel); } private GenderViewServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected GenderViewServiceBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new GenderViewServiceBlockingStub(channel, callOptions); } /** * <pre> * Returns the requested gender view in full detail. * </pre> */ public com.google.ads.googleads.v0.resources.GenderView getGenderView(com.google.ads.googleads.v0.services.GetGenderViewRequest request) { return blockingUnaryCall( getChannel(), getGetGenderViewMethodHelper(), getCallOptions(), request); } } /** * <pre> * Service to manage gender views. * </pre> */ public static final class GenderViewServiceFutureStub extends io.grpc.stub.AbstractStub<GenderViewServiceFutureStub> { private GenderViewServiceFutureStub(io.grpc.Channel channel) { super(channel); } private GenderViewServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected GenderViewServiceFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new GenderViewServiceFutureStub(channel, callOptions); } /** * <pre> * Returns the requested gender view in full detail. * </pre> */ public com.google.common.util.concurrent.ListenableFuture<com.google.ads.googleads.v0.resources.GenderView> getGenderView( com.google.ads.googleads.v0.services.GetGenderViewRequest request) { return futureUnaryCall( getChannel().newCall(getGetGenderViewMethodHelper(), getCallOptions()), request); } } private static final int METHODID_GET_GENDER_VIEW = 0; private static final class MethodHandlers<Req, Resp> implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { private final GenderViewServiceImplBase serviceImpl; private final int methodId; MethodHandlers(GenderViewServiceImplBase serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { case METHODID_GET_GENDER_VIEW: serviceImpl.getGenderView((com.google.ads.googleads.v0.services.GetGenderViewRequest) request, (io.grpc.stub.StreamObserver<com.google.ads.googleads.v0.resources.GenderView>) responseObserver); break; default: throw new AssertionError(); } } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public io.grpc.stub.StreamObserver<Req> invoke( io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { default: throw new AssertionError(); } } } private static abstract class GenderViewServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { GenderViewServiceBaseDescriptorSupplier() {} @java.lang.Override public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { return com.google.ads.googleads.v0.services.GenderViewServiceProto.getDescriptor(); } @java.lang.Override public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { return getFileDescriptor().findServiceByName("GenderViewService"); } } private static final class GenderViewServiceFileDescriptorSupplier extends GenderViewServiceBaseDescriptorSupplier { GenderViewServiceFileDescriptorSupplier() {} } private static final class GenderViewServiceMethodDescriptorSupplier extends GenderViewServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { private final String methodName; GenderViewServiceMethodDescriptorSupplier(String methodName) { this.methodName = methodName; } @java.lang.Override public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { return getServiceDescriptor().findMethodByName(methodName); } } private static volatile io.grpc.ServiceDescriptor serviceDescriptor; public static io.grpc.ServiceDescriptor getServiceDescriptor() { io.grpc.ServiceDescriptor result = serviceDescriptor; if (result == null) { synchronized (GenderViewServiceGrpc.class) { result = serviceDescriptor; if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new GenderViewServiceFileDescriptorSupplier()) .addMethod(getGetGenderViewMethodHelper()) .build(); } } } return result; } }
8737c53cc283e47e2b4887b576021a8d686b9739
b4f1132ca2c4804f81695df5600e4c3888fb18f5
/eMallEJB/business/com/codeholic/business/util/.svn/text-base/PropertyManager.java.svn-base
ba40087271d59012535dbdf78deeea9a30307f57
[]
no_license
zhouzx9999/eMall
a4eea0ad2ae58a0eaccb0cb94bdf4a4a79a1dc6e
e37734007d17a41f8b2410cb852a75ab9f89bcef
refs/heads/master
2020-12-01T03:02:58.034143
2014-06-25T05:36:21
2014-06-25T05:36:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
829
package com.codeholic.business.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; public class PropertyManager { public PropertyManager() { // } /** * * @param filename:properties文件路径名 * @return:一个Properties对象 */ public static Properties openFile(String filename) { File propertyFile = new File(filename); FileInputStream fis = null; Properties prop = null; try { fis = new FileInputStream(propertyFile); prop = new Properties(); prop.load(fis); } catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); } catch (IOException ioe){ ioe.printStackTrace(); } return prop; } }
16f5531123792ff9ba1be5ae09d4953ec8c85682
582f9a9d67e23d757b2684b9553632580140773f
/modules/objectracking/src/main/java/boofcv/metrics/point/WrapPointTracker.java
a7135c337a790655310e92ca5acaaf8b27a1d158
[]
no_license
amisare/ValidationBoof
c8b4cc4a790aa89dfe5f742e9b5602f275cb78b8
cc6554aaa0959d6708a98211d7a45a7a9b6daf40
refs/heads/master
2022-11-26T05:58:24.759726
2018-10-17T04:21:11
2018-10-17T04:21:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,436
java
package boofcv.metrics.point; import boofcv.abst.feature.tracker.PointTrack; import boofcv.abst.feature.tracker.PointTracker; import boofcv.struct.image.ImageGray; import georegression.struct.point.Point2D_F64; import java.util.ArrayList; import java.util.List; /** * @author Peter Abeles */ public class WrapPointTracker<I extends ImageGray<I>> implements EvaluationTracker<I> { PointTracker<I> tracker; boolean first = true; public WrapPointTracker(PointTracker<I> tracker) { this.tracker = tracker; } @Override public void track(I image) { tracker.process(image); if( first ) { first = false; tracker.spawnTracks(); List<PointTrack> tracks = tracker.getNewTracks(null); for( PointTrack t : tracks ) { Point2D_F64 initial = new Point2D_F64(t.x,t.y); t.setCookie(initial); } } } @Override public void reset() { tracker.reset(); first = true; } @Override public List<Point2D_F64> getInitial() { List<Point2D_F64> initial = new ArrayList<Point2D_F64>(); List<PointTrack> tracks = tracker.getActiveTracks(null); for( PointTrack t : tracks ) { initial.add((Point2D_F64) t.getCookie()); } return initial; } @Override public List<Point2D_F64> getCurrent() { List<Point2D_F64> current = new ArrayList<Point2D_F64>(); List<PointTrack> tracks = tracker.getActiveTracks(null); for( PointTrack t : tracks ) { current.add(t); } return current; } }
44defc842d489a1f1b57942a1da9d4c39da9c5d6
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/no_seeding/21_geo-google-oasis.names.tc.ciq.xsdschema.xal._2.DependentLocalityType-1.0-2/oasis/names/tc/ciq/xsdschema/xal/_2/DependentLocalityType_ESTest_scaffolding.java
7b74d6f3b515506efbc673fe74ecc76b4d61e27c
[]
no_license
tigerqiu712/evosuite-model-seeding-empirical-evaluation
c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6
11a920b8213d9855082d3946233731c843baf7bc
refs/heads/master
2020-12-23T21:04:12.152289
2019-10-30T08:02:29
2019-10-30T08:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Oct 28 14:26:01 GMT 2019 */ package oasis.names.tc.ciq.xsdschema.xal._2; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class DependentLocalityType_ESTest_scaffolding { // Empty scaffolding for empty test suite }
b849a34a7051ecd3b85b1468429cd0b23d35bcdb
6eebcac42ffa345783902fa971139af44284769a
/subsets.java
e70999516509755fcf5c1b8692679900db1a3cc2
[]
no_license
alias-pyking/competitive-programming
8b59ddfa2257dc9915b6540016197d5a4b2325a7
1ec6bbc3696d6bcb66ad5d3e2ffd7258e60dd8ac
refs/heads/master
2022-03-20T16:14:51.602861
2019-09-28T09:59:19
2019-09-28T09:59:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
import java.util.ArrayList; import java.util.*; import java.math.*; class Main{ public static void main(String[] args) { } public static int[][] subsets(int input[]) { int n = input.length; int size = Math.pow(2,n); int [][] output = new int[size][1]; if (n == 0){ output[0][0] = {0}; return 1; } return null; } }
9e1ad09f86081c34d10987747a494a19b4561a29
ce55aaf3d1c9933dd06e48c5ab96afaa4a26651e
/spring-study/spring_proxy/src/main/java/com/li/demo2/Rent.java
cd3bccbfa614805e24b5c98797fb5ace4f6165a6
[]
no_license
liyan234/SpringLeran
06af0f46d476a7990944da85697ef9d9e8917cb8
746ee6a8c242306fdd632df5afc24ffbfff47fc8
refs/heads/master
2023-04-01T02:43:35.509638
2021-04-09T14:58:28
2021-04-09T14:58:28
308,349,935
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package com.li.demo2; public interface Rent { public void rent(); }
d170fb7cf2fa74abf7d7733fe3a450831df8b5b5
e124cd3ec2798df143d719b596a29b8fd5427860
/app/src/main/java/com/example/mateo/Firebasepro/RegistrarActivity.java
10a24a3d9a9c95c75d4ae0ae91cea80e68dec818
[]
no_license
MateoBonilla/FireBaseAuth
9bad4f6a884c665c499095f5d2127dd8002d60e4
66dc102223d4d9c98e2d631ce571b5bc739425e7
refs/heads/master
2020-06-11T06:50:30.030680
2016-12-06T15:04:10
2016-12-06T15:04:10
75,742,181
0
0
null
null
null
null
UTF-8
Java
false
false
6,432
java
package com.example.mateo.Firebasepro; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.UserProfileChangeRequest; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; public class RegistrarActivity extends AppCompatActivity { private Button btnregistrar; private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; private EditText txtNombre; private EditText txtEmail; private EditText txtConfirmarEmail; private EditText txtPassword; private EditText txtTelefono; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registrar); btnregistrar = (Button) findViewById(R.id.btnRegistrar); txtConfirmarEmail= (EditText) findViewById(R.id.txtConfirmarEmail); txtEmail=(EditText) findViewById(R.id.txtEmail); txtNombre=(EditText) findViewById(R.id.txtNombre); txtPassword=(EditText) findViewById(R.id.txtPassword); txtTelefono= (EditText) findViewById(R.id.txtTelefono); mAuth= FirebaseAuth.getInstance(); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if (user != null) { // User is signed in Log.d("LoginActivity", "onAuthStateChanged:signed_in:" + user.getUid()); } else { // User is signed out Log.d("LoginActivity", "onAuthStateChanged:signed_out"); } } }; btnregistrar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(txtEmail.getText().toString().trim().equals(txtConfirmarEmail.getText().toString().trim())){ mAuth.createUserWithEmailAndPassword(txtEmail.getText().toString().trim(), txtPassword.getText().toString().trim()) .addOnCompleteListener(RegistrarActivity.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (!task.isSuccessful()) { Toast.makeText(RegistrarActivity.this, "Registro Fallido :"+task.getException().getMessage(), Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(RegistrarActivity.this, "Registro Exitoso :", Toast.LENGTH_SHORT).show(); mAuth.getCurrentUser().sendEmailVerification() .addOnCompleteListener(RegistrarActivity.this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if(!task.isSuccessful()){ Toast.makeText(RegistrarActivity.this, "Error al enviar email. "+task.getException().getMessage(), Toast.LENGTH_SHORT).show(); System.out.println(task.getException().getMessage()); }else{ Toast.makeText(RegistrarActivity.this, "Recuerde validar su email validar su email", Toast.LENGTH_SHORT).show(); } } }); UserProfileChangeRequest usuario = new UserProfileChangeRequest.Builder() .setDisplayName(txtNombre.getText().toString().trim()).build(); mAuth.getCurrentUser().updateProfile(usuario); FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference usuariosRef = database.getReference("Usuarios").child(mAuth.getCurrentUser().getUid()); usuariosRef.child("nombre").setValue(txtNombre.getText().toString().trim()); usuariosRef.child("email").setValue(txtEmail.getText().toString().trim()); usuariosRef.child("telefono").setValue(txtTelefono.getText().toString().trim()); usuariosRef.child("uid").setValue(mAuth.getCurrentUser().getUid()); txtEmail.setText(""); txtPassword.setText(""); txtTelefono.setText(""); txtNombre.setText(""); txtConfirmarEmail.setText(""); Intent intent = new Intent(RegistrarActivity.this,MainActivity.class); startActivity(intent); } // ... } }); } } }); } }
af11adabeea67271937000cacb2872ce936bd4c0
067ee1d2d21add6388d407b22443c018262c2141
/WqComponent/src/main/java/com/weqia/wq/component/view/flowlayout/FlowLayout.java
1749f285c8a5d0001ea37a1382fbd72a655e0411
[]
no_license
luoguofu/ccbimpoi
2c86e046f32124ddaf90810e75b6ebcd7cfc6111
8a33078ddacf6d7dfd4b3fcc9714b9f5117395cc
refs/heads/master
2020-04-28T16:45:41.308619
2019-11-13T03:24:06
2019-11-13T03:24:06
175,422,913
1
0
null
null
null
null
UTF-8
Java
false
false
12,476
java
/* * Copyright 2013 Blaz Solar * * 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.weqia.wq.component.view.flowlayout; import java.util.ArrayList; import java.util.List; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public class FlowLayout extends ViewGroup { private int mGravity = (isIcs() ? Gravity.START : Gravity.LEFT) | Gravity.TOP; private final List<List<View>> mLines = new ArrayList<List<View>>(); private final List<Integer> mLineHeights = new ArrayList<Integer>(); private final List<Integer> mLineMargins = new ArrayList<Integer>(); public FlowLayout(Context context) { this(context, null); } public FlowLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public FlowLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TypedArray a = context.obtainStyledAttributes(attrs, // R.styleable.FlowLayout, defStyle, 0); // // try { // int index = a.getInt(R.styleable.FlowLayout_android_gravity, -1); // if (index > 0) { // setGravity(index); // } // } finally { // a.recycle(); // } } /** * {@inheritDoc} */ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int sizeWidth = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight(); int sizeHeight = MeasureSpec.getSize(heightMeasureSpec); int modeWidth = MeasureSpec.getMode(widthMeasureSpec); int modeHeight = MeasureSpec.getMode(heightMeasureSpec); int width = 0; int height = getPaddingTop() + getPaddingBottom(); int lineWidth = 0; int lineHeight = 0; int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); boolean lastChild = i == childCount - 1; if (child.getVisibility() == View.GONE) { if (lastChild) { width = Math.max(width, lineWidth); height += lineHeight; } continue; } measureChildWithMargins(child, widthMeasureSpec, lineWidth, heightMeasureSpec, height); LayoutParams lp = (LayoutParams) child.getLayoutParams(); int childWidthMode = MeasureSpec.AT_MOST; int childWidthSize = sizeWidth; int childHeightMode = MeasureSpec.AT_MOST; int childHeightSize = sizeHeight; if (lp.width == LayoutParams.MATCH_PARENT) { childWidthMode = MeasureSpec.EXACTLY; childWidthSize -= lp.leftMargin + lp.rightMargin; } else if (lp.width >= 0) { childWidthMode = MeasureSpec.EXACTLY; childWidthSize = lp.width; } if (lp.height >= 0) { childHeightMode = MeasureSpec.EXACTLY; childHeightSize = lp.height; } else if (modeHeight == MeasureSpec.UNSPECIFIED) { childHeightMode = MeasureSpec.UNSPECIFIED; childHeightSize = 0; } child.measure( MeasureSpec.makeMeasureSpec(childWidthSize, childWidthMode), MeasureSpec.makeMeasureSpec(childHeightSize, childHeightMode) ); int childWidth = child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin; if (lineWidth + childWidth > sizeWidth) { width = Math.max(width, lineWidth); lineWidth = childWidth; height += lineHeight; lineHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin; } else { lineWidth += childWidth; lineHeight = Math.max(lineHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); } if (lastChild) { width = Math.max(width, lineWidth); height += lineHeight; } } width += getPaddingLeft() + getPaddingRight(); setMeasuredDimension( (modeWidth == MeasureSpec.EXACTLY) ? sizeWidth : width, (modeHeight == MeasureSpec.EXACTLY) ? sizeHeight : height); } /** * {@inheritDoc} */ @SuppressLint("DrawAllocation") @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { mLines.clear(); mLineHeights.clear(); mLineMargins.clear(); int width = getWidth(); int height = getHeight(); int linesSum = getPaddingTop(); int lineWidth = 0; int lineHeight = 0; List<View> lineViews = new ArrayList<View>(); float horizontalGravityFactor; switch ((mGravity & Gravity.HORIZONTAL_GRAVITY_MASK)) { case Gravity.LEFT: default: horizontalGravityFactor = 0; break; case Gravity.CENTER_HORIZONTAL: horizontalGravityFactor = .5f; break; case Gravity.RIGHT: horizontalGravityFactor = 1; break; } for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (child.getVisibility() == View.GONE) { continue; } LayoutParams lp = (LayoutParams) child.getLayoutParams(); int childWidth = child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin; int childHeight = child.getMeasuredHeight() + lp.bottomMargin + lp.topMargin; if (lineWidth + childWidth > width) { mLineHeights.add(lineHeight); mLines.add(lineViews); mLineMargins.add((int) ((width - lineWidth) * horizontalGravityFactor) + getPaddingLeft()); linesSum += lineHeight; lineHeight = 0; lineWidth = 0; lineViews = new ArrayList<View>(); } lineWidth += childWidth; lineHeight = Math.max(lineHeight, childHeight); lineViews.add(child); } mLineHeights.add(lineHeight); mLines.add(lineViews); mLineMargins.add((int) ((width - lineWidth) * horizontalGravityFactor) + getPaddingLeft()); linesSum += lineHeight; int verticalGravityMargin = 0; switch ((mGravity & Gravity.VERTICAL_GRAVITY_MASK)) { case Gravity.TOP: default: break; case Gravity.CENTER_VERTICAL: verticalGravityMargin = (height - linesSum) / 2; break; case Gravity.BOTTOM: verticalGravityMargin = height - linesSum; break; } int numLines = mLines.size(); int left; int top = getPaddingTop(); for (int i = 0; i < numLines; i++) { lineHeight = mLineHeights.get(i); lineViews = mLines.get(i); left = mLineMargins.get(i); int children = lineViews.size(); for (int j = 0; j < children; j++) { View child = lineViews.get(j); if (child.getVisibility() == View.GONE) { continue; } LayoutParams lp = (LayoutParams) child.getLayoutParams(); // if height is match_parent we need to remeasure child to line height if (lp.height == LayoutParams.MATCH_PARENT) { int childWidthMode = MeasureSpec.AT_MOST; int childWidthSize = lineWidth; if (lp.width == LayoutParams.MATCH_PARENT) { childWidthMode = MeasureSpec.EXACTLY; } else if (lp.width >= 0) { childWidthMode = MeasureSpec.EXACTLY; childWidthSize = lp.width; } child.measure( MeasureSpec.makeMeasureSpec(childWidthSize, childWidthMode), MeasureSpec.makeMeasureSpec(lineHeight - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY) ); } int childWidth = child.getMeasuredWidth(); int childHeight = child.getMeasuredHeight(); int gravityMargin = 0; if (Gravity.isVertical(lp.gravity)) { switch (lp.gravity) { case Gravity.TOP: default: break; case Gravity.CENTER_VERTICAL: case Gravity.CENTER: gravityMargin = (lineHeight - childHeight - lp.topMargin - lp.bottomMargin) / 2; break; case Gravity.BOTTOM: gravityMargin = lineHeight - childHeight - lp.topMargin - lp.bottomMargin; break; } } child.layout(left + lp.leftMargin, top + lp.topMargin + gravityMargin + verticalGravityMargin, left + childWidth + lp.leftMargin, top + childHeight + lp.topMargin + gravityMargin + verticalGravityMargin); left += childWidth + lp.leftMargin + lp.rightMargin; } top += lineHeight; } } @Override protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return new LayoutParams(p); } /** * {@inheritDoc} */ @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } /** * {@inheritDoc} */ @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void setGravity(int gravity) { if (mGravity != gravity) { if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { gravity |= isIcs() ? Gravity.START : Gravity.LEFT; } if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { gravity |= Gravity.TOP; } mGravity = gravity; requestLayout(); } } public int getGravity() { return mGravity; } /** * @return <code>true</code> if device is running ICS or grater version of Android. */ private static boolean isIcs() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; } public static class LayoutParams extends MarginLayoutParams { public int gravity = -1; public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); // TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FlowLayout_Layout); // // try { // gravity = a.getInt(R.styleable.FlowLayout_Layout_android_layout_gravity, -1); // } finally { // a.recycle(); // } } public LayoutParams(int width, int height) { super(width, height); } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } }
f0859a2648bdae2eb873a02756ffdecdace3f901
928bdfb9b0f4b6db0043526e095fe1aa822b8e64
/src/main/java/com/taobao/api/domain/WlbItemInventoryLog.java
d3b9849ed8d4d876c340c504f0ddbd9a43af78ac
[]
no_license
yu199195/jsb
de4f4874fb516d3e51eb3badb48d89be822e00f7
591ad717121dd8da547348aeac551fc71da1b8bd
refs/heads/master
2021-09-07T22:25:09.457212
2018-03-02T04:54:18
2018-03-02T04:54:18
102,316,111
4
3
null
null
null
null
UTF-8
Java
false
false
3,498
java
package com.taobao.api.domain; import com.taobao.api.TaobaoObject; import com.taobao.api.internal.mapping.ApiField; import java.util.Date; public class WlbItemInventoryLog extends TaobaoObject { private static final long serialVersionUID = 7454698236943667264L; @ApiField("batch_code") private String batchCode; @ApiField("biz_order_code") private String bizOrderCode; @ApiField("gmt_create") private Date gmtCreate; @ApiField("id") private Long id; @ApiField("invent_type") private String inventType; @ApiField("item_id") private Long itemId; @ApiField("op_type") private String opType; @ApiField("op_user_id") private Long opUserId; @ApiField("order_code") private String orderCode; @ApiField("order_item_id") private Long orderItemId; @ApiField("quantity") private Long quantity; @ApiField("remark") private String remark; @ApiField("result_quantity") private Long resultQuantity; @ApiField("store_code") private String storeCode; @ApiField("user_id") private Long userId; public String getBatchCode() { return this.batchCode; } public void setBatchCode(String batchCode) { this.batchCode = batchCode; } public String getBizOrderCode() { return this.bizOrderCode; } public void setBizOrderCode(String bizOrderCode) { this.bizOrderCode = bizOrderCode; } public Date getGmtCreate() { return this.gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getInventType() { return this.inventType; } public void setInventType(String inventType) { this.inventType = inventType; } public Long getItemId() { return this.itemId; } public void setItemId(Long itemId) { this.itemId = itemId; } public String getOpType() { return this.opType; } public void setOpType(String opType) { this.opType = opType; } public Long getOpUserId() { return this.opUserId; } public void setOpUserId(Long opUserId) { this.opUserId = opUserId; } public String getOrderCode() { return this.orderCode; } public void setOrderCode(String orderCode) { this.orderCode = orderCode; } public Long getOrderItemId() { return this.orderItemId; } public void setOrderItemId(Long orderItemId) { this.orderItemId = orderItemId; } public Long getQuantity() { return this.quantity; } public void setQuantity(Long quantity) { this.quantity = quantity; } public String getRemark() { return this.remark; } public void setRemark(String remark) { this.remark = remark; } public Long getResultQuantity() { return this.resultQuantity; } public void setResultQuantity(Long resultQuantity) { this.resultQuantity = resultQuantity; } public String getStoreCode() { return this.storeCode; } public void setStoreCode(String storeCode) { this.storeCode = storeCode; } public Long getUserId() { return this.userId; } public void setUserId(Long userId) { this.userId = userId; } }
66e0d942d0d28a288d68fa818ea5fd2da70143dc
732a25c63442f40347847f342624620e044d7f0f
/wipro.java
a579620a287fb782d2878a369556ff91161453f7
[]
no_license
Bhakti2607/MultiNationalRecruitmetInformation
df202525ff2cd6c36c01242b8069b83bb696cdc4
674218fe0fea8ce161b6248f3f8bc9513bcd38f2
refs/heads/master
2022-12-05T16:23:39.254755
2020-09-03T09:53:36
2020-09-03T09:53:36
292,524,482
0
0
null
null
null
null
UTF-8
Java
false
false
1,582
java
package com.example.mri; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class wipro extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.wipro); Button bt1 = (Button) findViewById(R.id.button2); Button bt2 = (Button) findViewById(R.id.button1); Button bt3 = (Button) findViewById(R.id.button3); bt1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent it = new Intent(wipro.this, WiproaboutusActivity.class); startActivity(it); } }); bt2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stubZ Intent myWebLink = new Intent( android.content.Intent.ACTION_VIEW); myWebLink.setData(Uri .parse("http://www.glassdoor.co.in/Reviews/Wipro-Reviews-E9936.htm")); startActivity(myWebLink); } }); bt3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent myWebLink = new Intent( android.content.Intent.ACTION_VIEW); myWebLink.setData(Uri.parse("http://www.wipro.com//")); startActivity(myWebLink); } }); } }
9fbb039220a02f2fba02d59b51db7fa3e22630fa
de8866b31a93ced4998e4de40bc6fcf676bd857d
/app/src/main/java/com/fmcg/Activity/OtherUsefulActivitys/RemainderActivity.java
22ae9ca61e9c82a675c40dbf7854a87e158d20c0
[]
no_license
ShivaCherupally/exampleFMCG
d4dc692ac7f652480a376db584e26eeef5c72a07
aee724246275a5a6bdbfdf8e430589df1261ecd1
refs/heads/master
2021-01-23T00:20:44.713831
2018-05-14T18:52:34
2018-05-14T18:52:34
92,807,311
0
0
null
null
null
null
UTF-8
Java
false
false
2,307
java
//package com.fmcg.ui; // //import android.content.Intent; //import android.os.Bundle; //import android.support.annotation.Nullable; //import android.support.v7.app.AppCompatActivity; //import android.support.v7.widget.LinearLayoutManager; //import android.support.v7.widget.RecyclerView; //import android.view.View; //import android.widget.Button; //import android.widget.TextView; // //import RemainderAdapter; //import com.fmcg.database.RemainderDataBase; //import com.fmcg.models.RemainderData; // //import java.util.ArrayList; //import java.util.List; // ///** // * Created by RuchiTiwari on 5/26/2017. // */ // //public class RemainderActivity extends AppCompatActivity //{ // RecyclerView mRecyclerView; // TextView nodata; // RemainderDataBase remainderDb; // RemainderData _RemainderData = null; // RecyclerView.Adapter mAdapter; // Button addRemainder; // // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // setContentView(R.layout.); // // nodata = (TextView) findViewById(R.id.nodata); // mRecyclerView = (RecyclerView) findViewById(R.id.remainderRecyclerView); // mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); // mRecyclerView.setHasFixedSize(true); // // addRemainder = (Button) findViewById(R.id.addRemainder); // // addRemainder.setOnClickListener(new View.OnClickListener() // { // @Override // public void onClick(final View v) // { // Intent i = new Intent(RemainderActivity.this, AddRemainderActivity.class); // startActivity(i); // } // }); // // // try // { // remainderDb = new RemainderDataBase(getApplicationContext()); // List<RemainderData> bookaTestDatas = new ArrayList<>(); // bookaTestDatas = remainderDb.getRemainderListData(); // List<RemainderData> mRemainderData = new ArrayList<>(); // for (RemainderData bookdata : bookaTestDatas) // { // mRemainderData.add(bookdata); // } // if (mRemainderData.size() != 0) // { // nodata.setVisibility(View.GONE); // mAdapter = new RemainderAdapter(RemainderActivity.this, mRemainderData); // mRecyclerView.setAdapter(mAdapter); // } // else // { // nodata.setVisibility(View.VISIBLE); // } // } // catch (Exception e) // { // // } // } // // //}
775f1adb45130aba34f19de41619d60aede80b4e
63217f5ff45656e95da95e157b920db599cc3287
/javacs602/src/javacs602/Application.java
1b398e645256333ad5ee8aa18a75c822ff93c727
[]
no_license
amitoj9/Practice-
9560a09187fdfca82ba03ebce8e252cd3a7c96f4
8bc420097eb51b427f5291eb6cec02c7d1964384
refs/heads/master
2020-07-09T22:26:29.337857
2018-02-02T04:23:25
2018-02-02T04:23:25
94,263,566
0
0
null
2017-11-24T20:04:29
2017-06-13T22:24:22
Java
UTF-8
Java
false
false
9,374
java
package javacs602; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.Scanner; public class Application { private static Integer txtFirstClassArrival; private static Integer txtCoachArrival; private static Integer txtFirstClassService; private static Integer txtCoachService; private static Integer txtDuration; private List<Station> stations; private boolean flag = false; /** * Launch the application. */ public static void main(String[] args) { /*Application application = new Application(); Scanner sc = new Scanner(System.in); // Idhar likhna sysout; txtFirstClassArrival = sc.nextInt(); txtCoachArrival = sc.nextInt(); txtFirstClassService = sc.nextInt(); txtCoachService = sc.nextInt(); txtDuration = sc.nextInt(); application.testSimulation(); */ solve(); } static void solve() { // Complete this function Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[][]=new int[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { arr[i][j]=0; } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { System.out.print(arr[i][j]); } System.out.println(); } int m = in.nextInt(); boolean flag=true; for(int a0 = 0; a0 < m; a0++){ int x = in.nextInt(); int y = in.nextInt(); int w = in.nextInt(); // Write Your Code Here int ww=w; int minX=0,minY=0,maxX=0,maxY=0; int tt=1; arr[x][y]=w; w-=1; while(w>0) { minX=x-tt; minY=y-tt; if(minX<0) { minX=0; } if(minY<0) { minY=0; } maxX=x+tt; maxY=y+tt; if(maxX>=n) { maxX=n-1; } if(maxY>=n) { maxY=n-1; } tt++; for(int i=minX;i<=maxX;i++) { if(arr[i][minY]==0 &&flag) arr[i][minY]=w; } for(int i=minX;i<=maxX;i++) { arr[i][maxY]=w; } for(int i=minY;i<=maxY;i++) { arr[minX][i]=w; } for(int i=minY;i<=maxY;i++) { arr[maxX][i]=w; } w--; } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { System.out.print(arr[i][j]); } System.out.println(); } } private void testSimulation() { // Initialize parameters. IQueue first = new Queue(); IQueue coach = new Queue(); List<Passenger> allPassengers = new ArrayList<Passenger>(); stations = new ArrayList<Station>(); Passenger.count = 1; stations.add(new FirstClassStation(1)); stations.add(new FirstClassStation(2)); stations.add(new Station(1)); stations.add(new Station(2)); stations.add(new Station(3)); final int A1, A2, B1, B2, DUR; try { A1 = txtFirstClassArrival; A2 = txtCoachArrival; B1 = txtFirstClassService; B2 = txtCoachService; DUR = txtDuration; } catch (NumberFormatException e) { return; } int duration = 0; int maxQueueLengthFirstClass = 0, maxQueueLengthCoach = 0; // Begin simulation. while (duration++ < DUR) { Random rand = new Random(); // Check for passengers. if (rand.nextDouble() < (1 / (double) A1)) { Passenger p = new FirstClassPassenger(duration); allPassengers.add(p); first.enQueue(p); } if (rand.nextDouble() < (1 / (double) A2)) { Passenger p = new Passenger(duration); allPassengers.add(p); coach.enQueue(p); } // Assign passengers to stations if passengers are waiting and // stations are available. while (!first.isEmptyQueue()) { Station s = getFreeStation(true); if (s == null) break; Passenger p = (Passenger) first.deQueue(); int serviceTime = rand.nextInt(B1) + 1; p.serviceStarting(duration, serviceTime, s); s.servicePassenger(p, serviceTime); } while (!coach.isEmptyQueue()) { Station s = getFreeStation(false); if (s == null) break; Passenger p = (Passenger) coach.deQueue(); int serviceTime = rand.nextInt(B2) + 1; p.serviceStarting(duration, serviceTime, s); s.servicePassenger(p, serviceTime); } // Pass one unit of time. for (Station s : stations) s.tick(); // Check statistics. if (first.queueSize() > maxQueueLengthFirstClass) maxQueueLengthFirstClass = first.queueSize(); if (coach.queueSize() > maxQueueLengthCoach) maxQueueLengthCoach = coach.queueSize(); } // Print statistics. int totalServiceTimeCoach = 0, totalServiceTimeFirstClass = 0; int totalPassengersCoach = 0, totalPassengersFirstClass = 0, totalCoachPassengersAtFirstClass = 0; int maxServiceTimeCoach = 0, maxServiceTimeFirstClass = 0; int totalWaitTimeCoach = 0, totalWaitTimeFirstClass = 0; for (Passenger p : allPassengers) { if (flag) System.out.println(p.toString()); if (p instanceof FirstClassPassenger) totalWaitTimeFirstClass += p.waitTime(); else { totalWaitTimeCoach += p.waitTime(); if (p.station != null && p.station instanceof FirstClassStation) totalCoachPassengersAtFirstClass++; } } for (Station s : stations) { if (flag) System.out.println(s.toString()); if (s instanceof FirstClassStation) { totalServiceTimeFirstClass += s.totalServiceTime; totalPassengersFirstClass += s.passengersServiced; if (s.maxServiceTime > maxServiceTimeFirstClass) maxServiceTimeFirstClass = s.maxServiceTime; } else { totalServiceTimeCoach += s.totalServiceTime; totalPassengersCoach += s.passengersServiced; if (s.maxServiceTime > maxServiceTimeCoach) maxServiceTimeCoach = s.maxServiceTime; } } if (flag) { System.out.println("Average First Class Service Time: " + Double.valueOf((new DecimalFormat("#.##")) .format((double) totalServiceTimeFirstClass / totalPassengersFirstClass))); System.out.println("Average Coach Service Time: " + Double.valueOf( (new DecimalFormat("#.##")).format((double) totalServiceTimeCoach / totalPassengersCoach))); System.out.println("Max First Class Service Time: " + maxServiceTimeFirstClass); System.out.println("Max Coach Service Time: " + maxServiceTimeCoach); System.out.println("Total First Class Passengers Served: " + totalPassengersFirstClass); System.out.println("Total Coach Passengers Served: " + totalPassengersCoach); System.out.println("Total Coach Passengers Served at First Class: " + totalCoachPassengersAtFirstClass); System.out.println("Max First Class Queue Length: " + maxQueueLengthFirstClass); System.out.println("Max Coach Queue Length: " + maxQueueLengthCoach); System.out.println("Average First Class Wait Time: " + Double.valueOf( (new DecimalFormat("#.##")).format((double) totalWaitTimeFirstClass / totalPassengersFirstClass))); System.out.println("Average Coach Wait Time: " + Double.valueOf( (new DecimalFormat("#.##")).format((double) totalWaitTimeCoach / totalPassengersFirstClass))); } System.out.println(("Average Service Time at First Class Station: " + Double.valueOf((new DecimalFormat("#.##")) .format((double) totalServiceTimeFirstClass / totalPassengersFirstClass)) + "\nAverage Service Time at Coach Station: " + Double.valueOf( (new DecimalFormat("#.##")).format((double) totalServiceTimeCoach / totalPassengersCoach)) + "\nMaximum Service Time at First Class Station: " + maxServiceTimeFirstClass + "\nMaximum Service Time at Coach Station: " + maxServiceTimeCoach + "\nTotal Passengers Serviced at First Class Station: " + totalPassengersFirstClass + "\nCoach Passengers Serviced at First Class Station: " + totalCoachPassengersAtFirstClass + "\nTotal Passengers Serviced at Coach Station: " + totalPassengersCoach + "\nMaximum Queve Length for First Class Passengers: " + maxQueueLengthFirstClass + "\nMaximum Queue Length for Coach Passengers: " + maxQueueLengthCoach + "\nAverage Wait Time for First Class Passengers: " + Double.valueOf((new DecimalFormat("#.##")) .format((double) totalWaitTimeFirstClass / totalPassengersFirstClass)) + "\nAverage Wait Time for Coach Passengers: " + Double.valueOf( (new DecimalFormat("#.##")).format((double) totalWaitTimeCoach / totalPassengersFirstClass)))); } private Station getFreeStation(boolean firstClassOnly) { if (!firstClassOnly) for (Station s : stations) if (!(s instanceof FirstClassStation) && s.isAvailable()) return s; for (Station s : stations) if (s instanceof FirstClassStation && s.isAvailable()) return s; return null; } }
e0be15db0db2b5c244f52c622701e2d933a4ad49
da7b0c75437555cf250b6f9f16155bd073180368
/src/main/java/com/pirate3d/piratefileflusher/watcher/RoutineChecker.java
1e33b7c2cc2d2d196e0482d8d18519c97c3251d7
[]
no_license
francisregan/File-Flusher
cefb0f169459907fa14aa087fee3c1e4b057f6d1
940b4eb3b7c5efc3281bc40e0c68e4819c2e2ff3
refs/heads/master
2021-01-10T19:58:13.431194
2013-11-27T08:24:18
2013-11-27T08:24:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,083
java
package com.pirate3d.piratefileflusher.watcher; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Map; import org.apache.log4j.Logger; import com.pirate3d.piratefileflusher.filehandler.MigrationCalculator; import com.pirate3d.piratefileflusher.parser.TextSorter; import com.pirate3d.piratefileflusher.utils.FetchDirectoryImpl; public class RoutineChecker { private static Logger logger = Logger.getLogger(RoutineChecker.class); public void checkFolder() { FetchDirectoryImpl impl = new FetchDirectoryImpl(); MigrationCalculator calc = new MigrationCalculator(); TextSorter sort = new TextSorter(); File[] filelist = null; File file = null; ArrayList<String> fileInFolder = null; ArrayList<String> calculatedFileInfo = null; try { file = impl.getDefaultFolder(); filelist = file.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { if (name.startsWith(".")) { return false; } else { return true; } } }); fileInFolder = convertToList(filelist); calculatedFileInfo = getHashmapKeys(sort.getMigrationValues()); System.out.println("File in folder " + fileInFolder.size()); System.out.println("Calculated file size in folder " + calculatedFileInfo.size()); } catch (Exception e) { logger.error("File list is empty" + e); } try { if (fileInFolder.size() > calculatedFileInfo.size() && (calculatedFileInfo.size() > 0) ) { for (String fileExisting : fileInFolder) { if (!calculatedFileInfo.contains(fileExisting)) { calc.updateFileInformation(fileExisting,1.0); } } } else if((calculatedFileInfo.size() < 1) && (fileInFolder.size() > 0)){ System.out.println(fileInFolder.get(0)); calc.updateFileInformation(fileInFolder.get(0),1.0); } else if((fileInFolder.size() > 0) && (calculatedFileInfo.size() == 0)){ calc.updateFileInformation(fileInFolder.get(0),1.0); } } catch (Exception e) { logger.error("Exception in calculating size " + e); } } @SuppressWarnings("null") public ArrayList<String> convertToList(File[] arrayOfFiles) { ArrayList<String> listOfFiles = new ArrayList<String>(); try { if (!(arrayOfFiles == null) || (arrayOfFiles.length == 0)) { for (int i = 0; i < arrayOfFiles.length; i++) { listOfFiles.add(arrayOfFiles[i].getName()); } } } catch (NullPointerException nullException) { logger.error(nullException); } catch (IllegalArgumentException illegalArgument) { logger.error(illegalArgument); } return listOfFiles; } public ArrayList<String> getHashmapKeys(Map<String, Double> keyList) { ArrayList<String> listOfKeys = new ArrayList<String>(); try { if (!(keyList.isEmpty())) { for (Map.Entry<String, Double> entry : keyList.entrySet()) { listOfKeys.add(entry.getKey()); } } } catch (NullPointerException nullException) { logger.error(nullException); } catch (IllegalArgumentException illegalArgument) { logger.error(illegalArgument); } return listOfKeys; } }
41cf7021ab5c28ec9ea3255c7e1ab42f5ed62b36
ffd4dc5a8b9d7d47e7a0d31d4d81b26ffda79cb2
/app/src/main/java/com/example/android/navigationdrawerexample/MainActivity.java
bc64fccef31369d0c831814006b528bcba6d4e17
[]
no_license
SHi-ON/RTLNavigationDrawer
4f8b4f93b51920976f8935e43dc5b4924b6a97b4
eb6b2465fe9a29725c5edb011f30f1d27f81a073
refs/heads/master
2020-04-11T10:49:18.358242
2018-03-07T20:40:10
2018-03-07T20:40:10
32,320,991
1
1
null
null
null
null
UTF-8
Java
false
false
10,455
java
/* * Copyright 2013 The Android Open Source Project * * 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.example.android.navigationdrawerexample; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.SearchManager; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.Toast; import java.util.Locale; /** * This example illustrates a common usage of the DrawerLayout widget * in the Android support library. * <p/> * <p>When a navigation (left) drawer is present, the host activity should detect presses of * the action bar's Up affordance as a signal to open and close the navigation drawer. The * ActionBarDrawerToggle facilitates this behavior. * Items within the drawer should fall into one of two categories:</p> * <p/> * <ul> * <li><strong>View switches</strong>. A view switch follows the same basic policies as * list or tab navigation in that a view switch does not create navigation history. * This pattern should only be used at the root activity of a task, leaving some form * of Up navigation active for activities further down the navigation hierarchy.</li> * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate * parent for Up navigation. This allows a user to jump across an app's navigation * hierarchy at will. The application should treat this as it treats Up navigation from * a different task, replacing the current task stack using TaskStackBuilder or similar. * This is the only form of navigation drawer that should be used outside of the root * activity of a task.</li> * </ul> * <p/> * <p>Right side drawers should be used for actions, not navigation. This follows the pattern * established by the Action Bar that navigation should be to the left and actions to the right. * An action should be an operation performed on the current contents of the window, * for example enabling or disabling a data overlay on top of the current content.</p> */ public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; private String[] mPlanetTitles; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); mPlanetTitles = getResources().getStringArray(R.array.planets_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener // set up the drawer's list view with items and click listener mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } /* Called whenever we call invalidateOptionsMenu() */ @Override public boolean onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content view boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); menu.findItem(R.id.action_websearch).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. /*if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }*/ if (item != null && item.getItemId() == android.R.id.home) { if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) { mDrawerLayout.closeDrawer(Gravity.RIGHT); } else { mDrawerLayout.openDrawer(Gravity.RIGHT); } return false; } // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } } /* The click listner for ListView in the navigation drawer */ private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } } private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new PlanetFragment(); Bundle args = new Bundle(); args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position); fragment.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); } @Override public void setTitle(CharSequence title) { mTitle = title; getActionBar().setTitle(mTitle); } /** * When using the ActionBarDrawerToggle, you must call it during * onPostCreate() and onConfigurationChanged()... */ @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggls mDrawerToggle.onConfigurationChanged(newConfig); } /** * Fragment that appears in the "content_frame", shows a planet */ public static class PlanetFragment extends Fragment { public static final String ARG_PLANET_NUMBER = "planet_number"; public PlanetFragment() { // Empty constructor required for fragment subclasses } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_planet, container, false); int i = getArguments().getInt(ARG_PLANET_NUMBER); String planet = getResources().getStringArray(R.array.planets_array)[i]; int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()), "drawable", getActivity().getPackageName()); ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId); getActivity().setTitle(planet); return rootView; } } }
fc96eba2b535884f50c2a1b9a78aa8e4ce872d34
40573b9ac6e5bf89bbe95c2fc339057c8da3639d
/src/objetosNegocio/Cancion.java
a0edf02136f2ef284f9fcf77c7dda840b2b2b400
[]
no_license
andresmao23/amanteMusicaVersionListas
70c4d9964554625570bd68c621f6373e961ebb39
ee4d8c6bfa59af74ba408ce4a06a216bf66e5b5c
refs/heads/master
2021-01-19T01:29:56.738137
2017-04-05T19:43:36
2017-04-05T19:43:36
87,244,115
0
0
null
null
null
null
UTF-8
Java
false
false
1,393
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package objetosNegocio; /** * * @author asus */ public class Cancion extends Medio{ private String interprete; private String autor; private String album; public Cancion() { super(); } public Cancion(String interprete, String autor, String album, String clave, String titulo, Genero genero, int duracion) { super(clave, titulo, genero, duracion); this.interprete = interprete; this.autor = autor; this.album = album; } public Cancion(String clave){ this(null, null, null, clave, null, null, 0); } //Métodos getter y setter public String getInterprete() { return interprete; } public void setInterprete(String interprete) { this.interprete = interprete; } public String getAutor() { return autor; } public void setAutor(String autor) { this.autor = autor; } public String getAlbum() { return album; } public void setAlbum(String album) { this.album = album; } @Override public String toString() { return super.toString() + ", " + interprete + ", " + autor + ", " + album; } }
11c3179acda54cbd602cb61c2adea20211ef6787
2942337c6f74b84a9ab3ee33ed1807255c6f10ff
/order/order-service/src/main/java/com/wdbyte/order/controller/ClientController.java
ef2285b3d2de5722a1a01645d3855a72c45826e3
[]
no_license
niumoo/springcloud-study
ef1c699f829ffd011125fc62a3c9d7412dcfca74
f338b91c24b79b7d950a5b57275594db66f566d9
refs/heads/master
2022-12-31T23:02:28.556634
2020-04-15T03:37:08
2020-04-15T03:37:08
256,906,221
0
0
null
2020-10-13T21:18:32
2020-04-19T03:34:14
Java
UTF-8
Java
false
false
2,518
java
//package com.wdbyte.order.controller; // //import com.wdbyte.order.dataobject.ProductInfo; //import com.wdbyte.order.dto.CartDTO; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.web.bind.annotation.GetMapping; //import org.springframework.web.bind.annotation.RestController; // //import com.wdbyte.order.client.ProductClient; // //import lombok.extern.slf4j.Slf4j; // //import java.util.Arrays; //import java.util.List; // ///** // * <p> // * // * @author niujinpeng // * @Date 2020/3/12 22:32 // */ //@RestController //@Slf4j //public class ClientController { // // // @Autowired // // private LoadBalancerClient loadBalancerClient; // // // @Autowired // // private RestTemplate restTemplate; // // @Autowired // private ProductClient productClient; // // @GetMapping("/getProductMsg") // public String getProductMsg() { // // 1. 第一种方式,直接使用,url写死,不能多个服务地址 // // RestTemplate restTemplate = new RestTemplate(); // // String response = restTemplate.getForObject("http://localhost:8080/msg", String.class); // // // 2. 第二种方式(利用 loadBalancerClient通过应用名获取 url + port) // // ServiceInstance serviceInstance = loadBalancerClient.choose("PRODUCT"); // // String host = serviceInstance.getHost(); // // int port = serviceInstance.getPort(); // // String url = String.format("http://%s:%s", host, port + "/msg"); // // RestTemplate restTemplate = new RestTemplate(); // // String response = restTemplate.getForObject(url, String.class); // // // 3. 第三种方式,利用注解 LoadBalancerClient,在 restTemplate 里使用应用名字 // // String response = restTemplate.getForObject("http://PRODUCT/msg", String.class); // String response = productClient.msg(); // log.info("response={}", response); // return response; // } // // @GetMapping("/findByProductId") // public String findByProductId() { // List<String> list = Arrays.asList("157875196366160022", "157875227953464068"); // List<ProductInfo> productIdList = productClient.findByProductId(list); // log.info("response = {}", productIdList); // return "ok"; // } // // @GetMapping("/decreaseStock") // public String decreaseStock() { // productClient.decreaseStock(Arrays.asList(new CartDTO("157875196366160022", 111111))); // return "ok"; // } //}
520e326b205df29f5e3db82b18d4458d8ac5a616
2817ffa9f58ca178ae89f95d28c8238b68965a53
/src/main/java/com/pd/springboot/produer/RabbitOrderSender.java
5b879f0b2dbfebedb8c4d064f6494bcd9196742d
[]
no_license
dupeihui/rabbitmq-reliable-delivery
ef3fab0592ff3840fe7983966f52fec6af00457e
504a063fce532d9ebf1dbfd6b621581b40e949e0
refs/heads/master
2023-03-07T04:10:55.642319
2021-02-17T09:56:22
2021-02-17T09:56:22
338,584,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,774
java
package com.pd.springboot.produer; import com.pd.springboot.constant.Constants; import com.pd.springboot.entity.Order; import com.pd.springboot.mapper.BrokerMessageLogMapper; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; import java.util.Date; @Component public class RabbitOrderSender { @Autowired private RabbitTemplate rabbitTemplate; @Autowired private BrokerMessageLogMapper brokerMessageLogMapper; //回调函数:confirm确认 final RabbitTemplate.ConfirmCallback confirmCallback = new RabbitTemplate.ConfirmCallback() { @Override public void confirm(@Nullable CorrelationData correlationData, boolean ack, @Nullable String cause) { System.out.println("correlationData:" + correlationData); String messageId = correlationData.getId(); if(ack) { brokerMessageLogMapper.changeBrokerMessageLogStatus(messageId, Constants.ORDER_SEND_SUCCESS, new Date()); } else { //失败则进行具体的后续操作:重试或者补偿等手段 System.out.println("异常处理......"); } } }; //发送消息方法调用:构建自定义对象消息 public void sendOrder(Order order)throws Exception{ rabbitTemplate.setConfirmCallback(confirmCallback); //消息唯一Id CorrelationData correlationData = new CorrelationData(order.getMessageId()); rabbitTemplate.convertAndSend("order-exchange","order.abc",order,correlationData); } }
68d12b2982953bb87b77090a8ce7e09c281687a7
91575aaad07b28b06acf1502292186f22e0f0873
/java/beanclass/src/com/ustglobal/beanclass/Student.java
f8f589585b8ff1e4631c916a8ee2a88ab35e3f37
[]
no_license
aisirisubramanya/USTglobal-16-sept-19-aisiri-ks
1639581efe62033f443c80a8bc83f39f644a7475
7a705ddd607a7ec1260d5a6d9691e10c94a2aa69
refs/heads/master
2023-01-11T23:25:49.488253
2019-12-22T03:33:05
2019-12-22T03:33:05
215,539,247
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.ustglobal.beanclass; public class Student { private int id; private String name; private int rollno; public Student() { } public void setId(int id) { this.id=id; } public int getId() { return id; } public void setName(String name) { this.name=name; } public String getName() { return name; } public void setRollNo(int rollno) { this.rollno=rollno; } public int getRollNo() { return rollno; } }
64c51071a7b3c6bab656f0eb679bcb9adf5df390
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/1/1_f35953df19ca41e9174799ccf32a16c61d8c1ce3/LinphoneService/1_f35953df19ca41e9174799ccf32a16c61d8c1ce3_LinphoneService_s.java
e67b47760035af2c30838591f14c3cce0eb7fd99
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
15,119
java
/* LinphoneService.java Copyright (C) 2010 Belledonne Communications, Grenoble, France This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.linphone.LinphoneManager.NewOutgoingCallUiListener; import org.linphone.LinphoneSimpleListener.LinphoneServiceListener; import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.Log; import org.linphone.core.OnlineStatus; import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCore.GlobalState; import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.mediastream.Version; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.preference.PreferenceManager; /** * * Linphone service, reacting to Incoming calls, ...<br /> * * Roles include:<ul> * <li>Initializing LinphoneManager</li> * <li>Starting C libLinphone through LinphoneManager</li> * <li>Reacting to LinphoneManager state changes</li> * <li>Delegating GUI state change actions to GUI listener</li> * * * @author Guillaume Beraudo * */ public final class LinphoneService extends Service implements LinphoneServiceListener { /* Listener needs to be implemented in the Service as it calls * setLatestEventInfo and startActivity() which needs a context. */ private Handler mHandler = new Handler(); private static LinphoneService instance; // private boolean mTestDelayElapsed; // add a timer for testing private boolean mTestDelayElapsed = true; // no timer public static boolean isReady() { return instance!=null && instance.mTestDelayElapsed; } /** * @throws RuntimeException service not instantiated */ static LinphoneService instance() { if (isReady()) return instance; throw new RuntimeException("LinphoneService not instantiated yet"); } private final static int NOTIF_ID=1; private final static int INCALL_NOTIF_ID=2; private Notification mNotif; private Notification mIncallNotif; private PendingIntent mNotifContentIntent; private String mNotificationTitle; private static final int IC_LEVEL_ORANGE=0; /*private static final int IC_LEVEL_GREEN=1; private static final int IC_LEVEL_RED=2;*/ private static final int IC_LEVEL_OFFLINE=3; @Override public void onCreate() { super.onCreate(); // In case restart after a crash. Main in LinphoneActivity LinphonePreferenceManager.getInstance(this); // Set default preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, true); mNotificationTitle = getString(R.string.app_name); // Dump some debugging information to the logs Log.i(START_LINPHONE_LOGS); dumpDeviceInformation(); dumpInstalledLinphoneInformation(); mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotif = new Notification(R.drawable.status_level, "", System.currentTimeMillis()); mNotif.iconLevel=IC_LEVEL_ORANGE; mNotif.flags |= Notification.FLAG_ONGOING_EVENT; Intent notifIntent = new Intent(this, LinphoneActivity.class); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, 0); mNotif.setLatestEventInfo(this, mNotificationTitle,"", mNotifContentIntent); LinphoneManager.createAndStart(this, this); LinphoneManager.getLc().setPresenceInfo(0, null, OnlineStatus.Online); instance = this; // instance is ready once linphone manager has been created // Retrieve methods to publish notification and keep Android // from killing us and keep the audio quality high. if (Version.sdkStrictlyBelow(Version.API05_ECLAIR_20)) { try { mSetForeground = getClass().getMethod("setForeground", mSetFgSign); } catch (NoSuchMethodException e) { Log.e(e, "Couldn't find foreground method"); } } else { try { mStartForeground = getClass().getMethod("startForeground", mStartFgSign); mStopForeground = getClass().getMethod("stopForeground", mStopFgSign); } catch (NoSuchMethodException e) { Log.e(e, "Couldn't find startGoreground or stopForeground"); } } startForegroundCompat(NOTIF_ID, mNotif); if (!mTestDelayElapsed) { // Only used when testing. Simulates a 5 seconds delay for launching service mHandler.postDelayed(new Runnable() { @Override public void run() { mTestDelayElapsed = true; } }, 5000); } } private enum IncallIconState {INCALL, PAUSE, VIDEO, IDLE} private IncallIconState mCurrentIncallIconState = IncallIconState.IDLE; private synchronized void setIncallIcon(IncallIconState state) { if (state == mCurrentIncallIconState) return; mCurrentIncallIconState = state; if (mIncallNotif == null) mIncallNotif = new Notification(); int notificationTextId = 0; switch (state) { case IDLE: mNM.cancel(INCALL_NOTIF_ID); return; case INCALL: mIncallNotif.icon = R.drawable.conf_unhook; notificationTextId = R.string.incall_notif_active; break; case PAUSE: mIncallNotif.icon = R.drawable.conf_status_paused; notificationTextId = R.string.incall_notif_paused; break; case VIDEO: mIncallNotif.icon = R.drawable.conf_video; notificationTextId = R.string.incall_notif_video; break; default: throw new IllegalArgumentException("Unknown state " + state); } mIncallNotif.iconLevel = 0; mIncallNotif.when=System.currentTimeMillis(); mIncallNotif.flags &= Notification.FLAG_ONGOING_EVENT; mIncallNotif.setLatestEventInfo(this, mNotificationTitle, getString(notificationTextId), mNotifContentIntent); mNM.notify(INCALL_NOTIF_ID, mIncallNotif); } public void refreshIncallIcon(LinphoneCall currentCall) { LinphoneCore lc = LinphoneManager.getLc(); if (currentCall != null) { if (currentCall.getCurrentParamsCopy().getVideoEnabled() && currentCall.cameraEnabled()) { // checking first current params is mandatory setIncallIcon(IncallIconState.VIDEO); } else { setIncallIcon(IncallIconState.INCALL); } } else if (lc.getCallsNb() == 0) { setIncallIcon(IncallIconState.IDLE); } else if (lc.isInConference()) { setIncallIcon(IncallIconState.INCALL); } else { setIncallIcon(IncallIconState.PAUSE); } } private static final Class<?>[] mSetFgSign = new Class[] {boolean.class}; private static final Class<?>[] mStartFgSign = new Class[] { int.class, Notification.class}; private static final Class<?>[] mStopFgSign = new Class[] {boolean.class}; private NotificationManager mNM; private Method mSetForeground; private Method mStartForeground; private Method mStopForeground; private Object[] mSetForegroundArgs = new Object[1]; private Object[] mStartForegroundArgs = new Object[2]; private Object[] mStopForegroundArgs = new Object[1]; void invokeMethod(Method method, Object[] args) { try { method.invoke(this, args); } catch (InvocationTargetException e) { // Should not happen. Log.w(e, "Unable to invoke method"); } catch (IllegalAccessException e) { // Should not happen. Log.w(e, "Unable to invoke method"); } } /** * This is a wrapper around the new startForeground method, using the older * APIs if it is not available. */ void startForegroundCompat(int id, Notification notification) { // If we have the new startForeground API, then use it. if (mStartForeground != null) { mStartForegroundArgs[0] = Integer.valueOf(id); mStartForegroundArgs[1] = notification; invokeMethod(mStartForeground, mStartForegroundArgs); return; } // Fall back on the old API. if (mSetForeground != null) { mSetForegroundArgs[0] = Boolean.TRUE; invokeMethod(mSetForeground, mSetForegroundArgs); // continue } mNM.notify(id, notification); } /** * This is a wrapper around the new stopForeground method, using the older * APIs if it is not available. */ void stopForegroundCompat(int id) { // If we have the new stopForeground API, then use it. if (mStopForeground != null) { mStopForegroundArgs[0] = Boolean.TRUE; invokeMethod(mStopForeground, mStopForegroundArgs); return; } // Fall back on the old API. Note to cancel BEFORE changing the // foreground state, since we could be killed at that point. mNM.cancel(id); if (mSetForeground != null) { mSetForegroundArgs[0] = Boolean.FALSE; invokeMethod(mSetForeground, mSetForegroundArgs); } } public static final String START_LINPHONE_LOGS = " ==== Phone information dump ===="; private void dumpDeviceInformation() { StringBuilder sb = new StringBuilder(); sb.append("DEVICE=").append(Build.DEVICE).append("\n"); sb.append("MODEL=").append(Build.MODEL).append("\n"); //MANUFACTURER doesn't exist in android 1.5. //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); sb.append("SDK=").append(Build.VERSION.SDK); Log.i(sb.toString()); } private void dumpInstalledLinphoneInformation() { PackageInfo info = null; try { info = getPackageManager().getPackageInfo(getPackageName(),0); } catch (NameNotFoundException nnfe) {} if (info != null) { Log.i("Linphone version is ", info.versionCode); } else { Log.i("Linphone version is unknown"); } } private void sendNotification(int level, int textId) { mNotif.iconLevel = level; mNotif.when=System.currentTimeMillis(); String text = getString(textId); if (text.contains("%s")) { LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); String id = lpc != null ? lpc.getIdentity() : ""; text = String.format(text, id); } mNotif.setLatestEventInfo(this, mNotificationTitle, text, mNotifContentIntent); mNM.notify(NOTIF_ID, mNotif); } @Override public IBinder onBind(Intent intent) { return null; } @Override public void onDestroy() { super.onDestroy(); // Make sure our notification is gone. stopForegroundCompat(NOTIF_ID); mNM.cancel(INCALL_NOTIF_ID); LinphoneManager.getLcIfManagerNotDestroyedOrNull().setPresenceInfo(0, null, OnlineStatus.Offline); LinphoneManager.destroy(); instance=null; } private static final LinphoneGuiListener guiListener() { return DialerActivity.instance(); } public void onDisplayStatus(final String message) { mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onDisplayStatus(message); } }); } public void onGlobalStateChanged(final GlobalState state, final String message) { if (state == GlobalState.GlobalOn) { sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started); mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onGlobalStateChangedToOn(message); } }); } } public void onRegistrationStateChanged(final RegistrationState state, final String message) { if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) { sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); } if (state == RegistrationState.RegistrationFailed) { sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure); } if (state == RegistrationState.RegistrationOk || state == RegistrationState.RegistrationFailed) { mHandler.post(new Runnable() { public void run() { if (LinphoneActivity.isInstanciated()) LinphoneActivity.instance().onRegistrationStateChanged(state, message); } }); } } public void onCallStateChanged(final LinphoneCall call, final State state, final String message) { if (state == LinphoneCall.State.IncomingReceived) { //wakeup linphone startActivity(new Intent() .setClass(this, LinphoneActivity.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } if (state == State.StreamsRunning) { // Workaround bug current call seems to be updated after state changed to streams running refreshIncallIcon(call); } else { refreshIncallIcon(LinphoneManager.getLc().getCurrentCall()); } mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onCallStateChanged(call, state, message); } }); } public interface LinphoneGuiListener extends NewOutgoingCallUiListener { void onDisplayStatus(String message); void onGlobalStateChangedToOn(String message); void onCallStateChanged(LinphoneCall call, State state, String message); } public void onRingerPlayerCreated(MediaPlayer mRingerPlayer) { final Uri ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); try { mRingerPlayer.setDataSource(getApplicationContext(), ringtoneUri); } catch (IOException e) { Log.e(e, "cannot set ringtone"); } } public void tryingNewOutgoingCallButAlreadyInCall() { mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onAlreadyInCall(); } }); } public void tryingNewOutgoingCallButCannotGetCallParameters() { mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onCannotGetCallParameters(); } }); } public void tryingNewOutgoingCallButWrongDestinationAddress() { mHandler.post(new Runnable() { public void run() { if (guiListener() != null) guiListener().onWrongDestinationAddress(); } }); } public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted, final String authenticationToken) { // IncallActivity registers itself to this event and handle it. } }
57ef1c27854407fbe92bf407be463a3beb28ba6d
310fc08690dee34da872872ccfb42b64c780e38f
/CargadeImagenesdeInternetenunRecyclerViewyCardView/app/src/main/java/net/vyl/imagenesdeinternet/view/HeroesFragment.java
4042028a2dedd152562d593d8e3401e629aa544a
[]
no_license
Batishavo/Carga-de-Imagenes-de-Internet-en-un-RecyclerView-y-CardView
a7527b3025d7724452823e4f7992e7a3af68d31a
9686871012429525d34daa81ab76e27c6fff8f67
refs/heads/main
2023-03-09T03:44:08.216952
2021-02-28T19:18:48
2021-02-28T19:18:48
343,192,147
1
0
null
null
null
null
UTF-8
Java
false
false
3,134
java
package net.vyl.imagenesdeinternet.view; import android.app.AlertDialog; import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import net.vyl.imagenesdeinternet.MainActivity; import net.vyl.imagenesdeinternet.R; import net.vyl.imagenesdeinternet.data.HeroRequest; /** * A simple {@link Fragment} subclass. * Use the {@link HeroesFragment#newInstance} factory method to * create an instance of this fragment. */ public class HeroesFragment extends Fragment { private RecyclerView heroRecyclerView; private HeroesAdapter adapter; private GridLayoutManager layoutManager; MainActivity mainActivity; Context context; @Override public void onAttach(@NonNull Context context) { super.onAttach(context); this.context = context; if (context instanceof MainActivity){ mainActivity = (MainActivity) context; } } // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public HeroesFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment HeroesFragment. */ // TODO: Rename and change types and number of parameters public static HeroesFragment newInstance(String param1, String param2) { HeroesFragment fragment = new HeroesFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_heroes, container, false); heroRecyclerView = v.findViewById(R.id.hero_recyclerView); layoutManager = new GridLayoutManager(getActivity(), 2); adapter = new HeroesAdapter(getActivity(), MainActivity.heroesArrayList); heroRecyclerView.setLayoutManager(layoutManager); heroRecyclerView.setAdapter(adapter); return v; } }
012943b80d32cf526e9015b9adef1d1249b3dfb0
28aca46bcb9300ff9c04f99e34e0f9e24ec0a3d6
/api-gateway/src/main/java/ba/unsa/etf/apigateway/model/Role.java
4313d45cc32cd36272e729b7ae7b6591ff88d506
[]
no_license
idedic2/NWT-RentACar-1
d60d181e4dd08334ff3a924c4164cb713f489ed1
19de46674b90fcda0d1170ccaedd5370dfaa0c00
refs/heads/master
2023-05-31T22:10:19.722781
2021-06-06T18:24:44
2021-06-06T18:24:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
538
java
package ba.unsa.etf.apigateway.model; import ba.unsa.etf.apigateway.RoleName; public class Role { private Integer id; private RoleName roleName; public Role(RoleName roleAdmin) { this.roleName=roleAdmin; } public Role() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public RoleName getRoleName() { return roleName; } public void setRoleName(RoleName roleName) { this.roleName = roleName; } }
ba0266d944c6a4d64ea3b6d5ecbaa9891081d696
0308ca5b152a082c1a206a1a136fd45e79b48143
/usvao/prototype/iris/trunk/iris-common/src/main/java/cfa/vo/iris/sdk/IrisPlugin.java
173ec6923bd5268cfa345972419fb9113acbda6d
[]
no_license
Schwarzam/usvirtualobservatory
b609bf21a09c187b70e311a4c857516284049c31
53fe6c14cc9312d048326acfa25377e3eac59858
refs/heads/master
2022-03-28T23:38:58.847018
2019-11-27T16:05:47
2019-11-27T16:05:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cfa.vo.iris.sdk; import cfa.vo.iris.IrisComponent; import java.util.List; /** * * @author olaurino */ public interface IrisPlugin { public String getName(); public String getDescription(); public String getVersion(); public String getAuthor(); public List<IrisComponent> getComponents(); public String getAcknowledgments(); }
[ "usvirtualobservatory@5a1e9bf7-f4d4-f7d4-5b89-e7d39643c4b5" ]
usvirtualobservatory@5a1e9bf7-f4d4-f7d4-5b89-e7d39643c4b5
c07a66f3dd011250b6dd622aba3ed34a56a23c3e
fd1435962c83c0943280332fcd80279ddcbb2ad0
/src/main/java/eu/javaspecialists/course/master/logging/solution1011/ThreadPool.java
7482855e37bb267db0c4d5d8c77be43ef5c6714b
[]
no_license
prasincs/JavaMasters
c525beae42674be1906ddff44a6ba7e39d4d4e5c
ebdef62f75ce4f2ca72be424a50202f435bdba55
refs/heads/master
2021-01-02T09:33:27.064740
2011-09-09T22:37:09
2011-09-09T22:37:09
2,334,871
0
0
null
null
null
null
UTF-8
Java
false
false
4,554
java
package eu.javaspecialists.course.master.logging.solution1011; import eu.javaspecialists.course.master.util.*; import java.util.concurrent.*; import java.util.logging.*; public class ThreadPool { private final ThreadGroup group = new ThreadGroup("thread pool"); private final BlockingQueue<Job> runQueue = new LinkedBlockingQueue<Job>(); public static final int MAXIMUM_POOL_SIZE = 1024; private static final Logger log = Logger .getLogger(ThreadPool.class.getName()); private volatile boolean running = true; /** * @param poolSize the pool size which should be between 1 and * the maximum allowed * @throws IllegalArgumentException when the pool size is less * than 1 or larger than the * maximum allowed * @see #MAXIMUM_POOL_SIZE */ public ThreadPool(int poolSize) { if (poolSize < 1 || poolSize > MAXIMUM_POOL_SIZE) { throw new IllegalArgumentException("Pool size: " + poolSize + ", " + "must be between 0 and " + MAXIMUM_POOL_SIZE); } for (int i = 0; i < poolSize; i++) { ThreadPool.Worker worker = new ThreadPool.Worker(group, "Worker" + i); worker.setDaemon(false); worker.start(); log.info("Worker thread " + worker + " created"); } log.info("ThreadPool with size " + poolSize + " constructed"); } /** * @param job * @throws IllegalArgumentException if job is null */ public void submit(Runnable job) { if (job == null) { throw new IllegalArgumentException("job may not be null"); } if (!running) { throw new IllegalStateException("pool shut down - cannot accept new jobs"); } log.info("Submitting job to work queue: " + job); runQueue.add(new Job(job)); } private Runnable take() throws InterruptedException { Benchmark bm = null; if (log.isLoggable(Level.INFO)) { bm = new Benchmark(); bm.start(); } Job job = runQueue.take(); assert job != null; if (log.isLoggable(Level.INFO)) { log.info(job + " was in the queue for " + job.getNumberOfSecondsWaiting() + "ms"); if (bm == null) { log.info("Job retrieved from queue: " + job + ", do not know how long we waited"); } else { bm.stop(); log.info("Job retrieved from queue: " + job + ", " + "waited for " + bm + " for a job to arrive in queue"); } } return job.getRunnable(); } public int getRunQueueLength() { return runQueue.size(); } public void shutdown() { running = false; log.info("ThreadPool worker threads being interrupted"); group.interrupt(); log.info("ThreadPool shut down"); } private class Worker extends Thread { public Worker(ThreadGroup group, String name) { super(group, name); } public void run() { log.info("Worker " + this + " started"); while (running && !isInterrupted()) { try { log.info("Worker " + this + " waiting for task"); Runnable job = take(); log.info("Worker " + this + " starting job " + job); Benchmark bm = new Benchmark(); bm.start(); job.run(); bm.stop(); log.info("Worker " + this + " finished job " + job + " in " + bm); } catch (InterruptedException e) { interrupt(); break; } } assert !running || isInterrupted(); log.info("Worker " + this + " shut down"); } } private static class Job { private final long submitTime = System.currentTimeMillis(); private final Runnable runnable; public Job(Runnable runnable) { this.runnable = runnable; } public long getNumberOfSecondsWaiting() { return System.currentTimeMillis() - submitTime; } public Runnable getRunnable() { return runnable; } public String toString() { return "Job: " + runnable; } } }
89df0cdf1a2a4844a4b99cc4ebd05f2fd2158bd1
605f73592fc8bccde426d7ab80d169d913cc486b
/src/main/java/com/komarmoss/model/entity/OwnerEntity.java
7ddc5b68e4f38a82c0bdae1362e687c4cf3afd04
[]
no_license
nexen505/driverExamineesREST
50f7e5b446dd48a18c776398373fbaa21233deac
fc6e78dd846c0d90795c6703b8501ec29988fe96
refs/heads/master
2020-03-15T19:52:55.580991
2018-06-03T17:31:33
2018-06-03T17:31:33
132,319,373
1
0
null
null
null
null
UTF-8
Java
false
false
2,936
java
package com.komarmoss.model.entity; import javax.persistence.*; import java.util.Date; import java.util.List; import java.util.Objects; /** * Владелец транспортных средств. Имеет удостоверения и перечень транспортных средств. */ @Entity @Table(name = "exdr_owner", schema = "public", catalog = "postgres") public class OwnerEntity implements Identifiable { /** * Идентификатор */ private Integer id; /** * Имя владельца */ private String name; /** * Отчество владельца */ private String patronymic; /** * Фамилия владельца */ private String surname; /** * Дата рождения */ private Date dateOfBirth; /** * Транспортные средства владельца */ private List<VehicleEntity> transportList; @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) public Integer getId() { return id; } public void setId(Integer idOwner) { this.id = idOwner; } @Basic @Column(name = "name") public String getName() { return name; } public void setName(String name) { this.name = name; } @Basic @Column(name = "patronymic") public String getPatronymic() { return patronymic; } public void setPatronymic(String patronymic) { this.patronymic = patronymic; } @Basic @Column(name = "surname") public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @Basic @Column(name = "date_of_birth") public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } @OneToMany(mappedBy = "owner", cascade = {CascadeType.ALL}) public List<VehicleEntity> getTransportList() { return transportList; } public void setTransportList(List<VehicleEntity> transportList) { this.transportList = transportList; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OwnerEntity that = (OwnerEntity) o; return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(patronymic, that.patronymic) && Objects.equals(surname, that.surname) && Objects.equals(dateOfBirth, that.dateOfBirth) && Objects.equals(transportList, that.transportList); } @Override public int hashCode() { return Objects.hash(id, name, patronymic, surname, dateOfBirth, transportList); } }
90293ea52d7fd157957c1637808a58c7f160de2c
a587ea37accb4c83c0de0fede782ce2007a90d0f
/Practicas1trimestre/Tema3/Problemas propuestos (el tipo de bucle lo eliges tú)/src/Prac5.java
7611b2d5c4ec4f8725951d25a4eb328190c3bd35
[]
no_license
Borja92/Programacion202021
b3a9db7888b283fb072604ea159e73908abd1050
7c2e78bcfd4498886b2b8b1d097cc2e68c97c27e
refs/heads/master
2023-05-23T13:28:51.542405
2021-06-14T08:19:28
2021-06-14T08:19:28
301,442,781
0
0
null
null
null
null
UTF-8
Java
false
false
1,751
java
/*5- Representa el funcionamiento de un reloj. Ya sabes que tiene 24 horas, cada hora 60 minutos y cada minuto 60 segundos. El programa pregunta ¿Quieres que funcione el reloj (s/n)? En caso afirmativo funcionará durante 24 horas y volverá a preguntar una vez que se llegue a 23:59:59 termina al indicar que no queremos que funcione.*/ import java.util.Scanner; public class Prac5 { public static void main(String[] args) throws InterruptedException { Scanner src = new Scanner(System.in); String opcion1, opcion2 = ""; int hora = 0, minuto = 0, segundo = 0; System.out.println("¿Quieres que funcione el reloj (s/n)?"); opcion1=src.nextLine(); while (opcion1.equalsIgnoreCase("s")){ //Bloque interfaz/visualización if(hora<10){ System.out.print("0"); } System.out.print(hora+":"); if (minuto<10) { System.out.print("0"); } System.out.print(minuto+":"); if (segundo<10){ System.out.print("0"); } System.out.println(segundo); //Bloque lógico aumentar tiempo segundo a segundo segundo++; if (segundo==60){ segundo=0; minuto++; if (minuto==60){ minuto=0; hora++; if (hora==24){ hora=0; } } } //Thread.sleep(1000); //Esta instrucción retrasa la ejeción haciendolo más realista //Bloque de código de control sobre seguir o no ejecutando el reloj if (hora==23&minuto==59&segundo==59){ System.out.println("¿Desea salir finalizar el reloj) s/n"); opcion2=src.nextLine(); } if (opcion2.equalsIgnoreCase("s")){ break; } } } }
713d05fe63b5a85c4144803212f387d1e43150f1
aae9bf883d14940cc5735d4239b23af1ecf0b59d
/CRMP-glassfishv2-flex-blazeds/MADZ_ENTERPRISE_PLATFORM/BizCore/samples/samples/Main.java
1b12a921a1969d35bcdb1a4d4a4cacbb5b6b29a2
[]
no_license
zhongdj/madz-garbagies
5ebe419ce1bb40a99c97694e32774e9469e360cb
316e2f35a0a0454fe3b6ce017ec24e03470b8bce
refs/heads/master
2016-08-04T13:09:09.592658
2012-12-15T15:42:49
2012-12-15T15:42:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,698
java
package samples; import java.util.Date; import net.madz.core.state.IObserver; import net.madz.core.state.State; import net.madz.core.state.StateContext; import net.madz.infra.util.BizObjectUtil; import samples.domain.ILadingRequest; import samples.domain.LadingRequest; public class Main { private static final class SimpleObserver implements IObserver<LadingRequest> { @Override public void update(LadingRequest bizObject, State<LadingRequest> currentState, StateContext<LadingRequest> context) { System.out.println(bizObject + " has been changed to " + currentState.getName()); } } public static void main(String[] args) { LadingRequest bill = new LadingRequest(); bill.setId(1L); bill.setStartDate(new Date()); bill.setStateName("RequestedState"); ILadingRequest bizProxy = BizObjectUtil.newProxy(bill); SimpleObserver observer = new SimpleObserver(); // ObserverControl.getInstance().attach(LadingRequest.class, // LadingRequestState.ConfirmedState.toString(), observer); // ObserverControl.getInstance().attach(LadingRequest.class, // LadingRequestState.PickedState.toString(), observer); bizProxy.doConfirm(); bizProxy.doPick(); // ObserverControl.getInstance().detach(LadingRequest.class, // LadingRequestState.ConfirmedState.toString(), observer); // ObserverControl.getInstance().detach(LadingRequest.class, // LadingRequestState.PickedState.toString(), observer); bill = new LadingRequest(); bill.setId(1L); bill.setStartDate(new Date()); bill.setStateName("RequestedState"); bizProxy = BizObjectUtil.newProxy(bill); bizProxy.doConfirm(); bizProxy.doPick(); } }
c52deda6c79da743a830c66472069124a9f53129
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-dms/src/main/java/com/amazonaws/services/databasemigrationservice/model/ReleaseStatusValues.java
d22b7160cdcc5d8b1b19d20911a706f33f575f49
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
1,794
java
/* * Copyright 2017-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 com.amazonaws.services.databasemigrationservice.model; import javax.annotation.Generated; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public enum ReleaseStatusValues { Beta("beta"); private String value; private ReleaseStatusValues(String value) { this.value = value; } @Override public String toString() { return this.value; } /** * Use this in place of valueOf. * * @param value * real value * @return ReleaseStatusValues corresponding to the value * * @throws IllegalArgumentException * If the specified value does not map to one of the known values in this enum. */ public static ReleaseStatusValues fromValue(String value) { if (value == null || "".equals(value)) { throw new IllegalArgumentException("Value cannot be null or empty!"); } for (ReleaseStatusValues enumEntry : ReleaseStatusValues.values()) { if (enumEntry.toString().equals(value)) { return enumEntry; } } throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); } }
[ "" ]
64243812634db29eef8c51c2c6b3672a339e4f21
3dfd4d40f6b9faa66d72f207be555d81c0ae8b38
/src/com/iflytek/entity/TProductTypeExample.java
54f1fa32425e9478c470825184109021c489fb1d
[ "MIT" ]
permissive
JavaZwsADream/mybatis-generator-master
e241f64e3e236eaefea726881b3ce109a212f60e
30e5f562d43f5eaaed6133f87fca9dd7d3971c58
refs/heads/master
2023-01-06T14:29:07.335355
2020-10-20T14:14:56
2020-10-20T14:14:56
305,730,326
0
0
null
null
null
null
UTF-8
Java
false
false
13,014
java
package com.iflytek.entity; import java.util.ArrayList; import java.util.List; public class TProductTypeExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public TProductTypeExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andPidIsNull() { addCriterion("pid is null"); return (Criteria) this; } public Criteria andPidIsNotNull() { addCriterion("pid is not null"); return (Criteria) this; } public Criteria andPidEqualTo(Integer value) { addCriterion("pid =", value, "pid"); return (Criteria) this; } public Criteria andPidNotEqualTo(Integer value) { addCriterion("pid <>", value, "pid"); return (Criteria) this; } public Criteria andPidGreaterThan(Integer value) { addCriterion("pid >", value, "pid"); return (Criteria) this; } public Criteria andPidGreaterThanOrEqualTo(Integer value) { addCriterion("pid >=", value, "pid"); return (Criteria) this; } public Criteria andPidLessThan(Integer value) { addCriterion("pid <", value, "pid"); return (Criteria) this; } public Criteria andPidLessThanOrEqualTo(Integer value) { addCriterion("pid <=", value, "pid"); return (Criteria) this; } public Criteria andPidIn(List<Integer> values) { addCriterion("pid in", values, "pid"); return (Criteria) this; } public Criteria andPidNotIn(List<Integer> values) { addCriterion("pid not in", values, "pid"); return (Criteria) this; } public Criteria andPidBetween(Integer value1, Integer value2) { addCriterion("pid between", value1, value2, "pid"); return (Criteria) this; } public Criteria andPidNotBetween(Integer value1, Integer value2) { addCriterion("pid not between", value1, value2, "pid"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andFlagIsNull() { addCriterion("flag is null"); return (Criteria) this; } public Criteria andFlagIsNotNull() { addCriterion("flag is not null"); return (Criteria) this; } public Criteria andFlagEqualTo(Boolean value) { addCriterion("flag =", value, "flag"); return (Criteria) this; } public Criteria andFlagNotEqualTo(Boolean value) { addCriterion("flag <>", value, "flag"); return (Criteria) this; } public Criteria andFlagGreaterThan(Boolean value) { addCriterion("flag >", value, "flag"); return (Criteria) this; } public Criteria andFlagGreaterThanOrEqualTo(Boolean value) { addCriterion("flag >=", value, "flag"); return (Criteria) this; } public Criteria andFlagLessThan(Boolean value) { addCriterion("flag <", value, "flag"); return (Criteria) this; } public Criteria andFlagLessThanOrEqualTo(Boolean value) { addCriterion("flag <=", value, "flag"); return (Criteria) this; } public Criteria andFlagIn(List<Boolean> values) { addCriterion("flag in", values, "flag"); return (Criteria) this; } public Criteria andFlagNotIn(List<Boolean> values) { addCriterion("flag not in", values, "flag"); return (Criteria) this; } public Criteria andFlagBetween(Boolean value1, Boolean value2) { addCriterion("flag between", value1, value2, "flag"); return (Criteria) this; } public Criteria andFlagNotBetween(Boolean value1, Boolean value2) { addCriterion("flag not between", value1, value2, "flag"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
2730536191cbd4cf3823e26bbd0c63fda36b60d3
84697ef0659fa70c7fe3db858d390536fbdfc527
/src/jp/co/nssys/shinjin_kenshu/chart_drawing/ChartDataController.java
55c838da2901cefef2405ad4b5335c2a73cc3307
[]
no_license
takehiro-eguchi/nss-oyo-java
471886f98ca98bc8b00572e232bd8a6b839d2943
d17f0b3d459eddf61457d7b7b5460fa2ee963653
refs/heads/master
2020-06-27T16:55:01.450588
2019-08-20T00:58:27
2019-08-20T00:58:27
200,002,273
0
0
null
null
null
null
UTF-8
Java
false
false
1,776
java
package jp.co.nssys.shinjin_kenshu.chart_drawing; import jp.co.nssys.shinjin_kenshu.chart_drawing.draw.IChartDataDrawer; import jp.co.nssys.shinjin_kenshu.chart_drawing.read.ChartDataReadResult; import jp.co.nssys.shinjin_kenshu.chart_drawing.read.IChartDataReader; /** * 海図データを管理するオブジェクト。 */ public class ChartDataController { /** 座標値を整数で計算するために乗ずる数値。 */ public static final int FACTOR_FOR_COORDINATE_CALC = 10; /** 海図のマスの辺の長さ(度)。 */ public static final double CHART_CELL_EDGE_LENGTH_DEGREE = 0.1; /** 海図のマスの辺の長さ(度)(計算用)。 */ public static final int CHART_CELL_EDGE_LENGTH_DEGREE_FOR_CALC = (int)(CHART_CELL_EDGE_LENGTH_DEGREE * FACTOR_FOR_COORDINATE_CALC); /** 海図データを読み込むオブジェクト。 */ private IChartDataReader reader; /** 海図データを描画するオブジェクト。 */ private IChartDataDrawer drawer; /** * コンストラクタ。 * * @param reader 海図データを読み込むオブジェクト。 * @param drawer 海図データを描画するオブジェクト。 */ public ChartDataController(IChartDataReader reader, IChartDataDrawer drawer) { this.reader = reader; this.drawer = drawer; } /** * 海図を描画します。 */ public void drawChart() { // 読み込み ChartDataReadResult readResult = this.reader.read(); if (!readResult.getIsSuccess()) { System.out.println("海図データファイルの読み込みに失敗しました。"); return; } // 描画 this.drawer.draw( readResult.getMinX(), readResult.getMinY(), readResult.getMaxX(), readResult.getMaxY(), readResult.getFeatures()); } }
55eb421e6a41fae64918b1c00f616ac400b1a6fe
376d07a9723d931ce2508b885bcade202c40b119
/code/src/main/java/com/zhang/interview/code/design/creational/singleton/s3/LazySingletonUnsafe.java
343c3f400ac0f995cbe4f83b0d205eefec092f41
[]
no_license
bgitter/interview
1cc41a32433f2074504db7bb5f26e8bf35d61777
2c74089d85ed9514f6f4e2ef5b7fe95419e4e965
refs/heads/master
2023-03-19T08:53:18.238527
2021-03-11T09:57:06
2021-03-11T09:57:06
297,675,168
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package com.zhang.interview.code.design.creational.singleton.s3; /** * @Copyright (C), 2018-2020, 北京数知科技股份有限公司 * @FileName: LazySingletonUnsafe * @Author: zxb * @Date: 2020/10/12 10:46 * @Description: 单例模式-懒汉单例,线程不安全 */ public class LazySingletonUnsafe { private static LazySingletonUnsafe instance = null; private LazySingletonUnsafe() { } public static LazySingletonUnsafe getInstance() { if (instance == null) { instance = new LazySingletonUnsafe(); } return instance; } public void showMessage() { System.out.println("Hello World!"); } }
dfbb4ba2f0f6f938fcc79ae5e88f6cd87c6dc016
d52fd93e19f1b228589cde9f983ac4eaeb2b2e2f
/flexodesktop/model/flexofoundation/src/main/java/org/openflexo/foundation/dm/action/CreateDMMethod.java
de686714475175f2ddd4006bb5d0cadf44988f70
[]
no_license
bmangez/openflexo
597dbb3836bcb0ebe7ab1e4f601a22fca470d4d7
7d8773c59b96f460864b4408cf1f2cfc9633cf8d
refs/heads/master
2020-12-25T04:54:16.874230
2012-12-05T16:19:04
2012-12-06T15:41:49
2,393,923
0
0
null
null
null
null
UTF-8
Java
false
false
3,225
java
/* * (c) Copyright 2010-2011 AgileBirds * * This file is part of OpenFlexo. * * OpenFlexo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenFlexo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenFlexo. If not, see <http://www.gnu.org/licenses/>. * */ package org.openflexo.foundation.dm.action; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import org.openflexo.foundation.FlexoEditor; import org.openflexo.foundation.action.FlexoAction; import org.openflexo.foundation.action.FlexoActionType; import org.openflexo.foundation.dm.DMEntity; import org.openflexo.foundation.dm.DMMethod; import org.openflexo.foundation.dm.DMObject; public class CreateDMMethod extends FlexoAction<CreateDMMethod, DMEntity, DMObject> { private static final Logger logger = Logger.getLogger(CreateDMMethod.class.getPackage().getName()); public static FlexoActionType<CreateDMMethod, DMEntity, DMObject> actionType = new FlexoActionType<CreateDMMethod, DMEntity, DMObject>( "add_method", FlexoActionType.newMenu, FlexoActionType.defaultGroup, FlexoActionType.ADD_ACTION_TYPE) { /** * Factory method */ @Override public CreateDMMethod makeNewAction(DMEntity entity, Vector<DMObject> globalSelection, FlexoEditor editor) { return new CreateDMMethod(entity, globalSelection, editor); } @Override protected boolean isVisibleForSelection(DMEntity entity, Vector<DMObject> globalSelection) { return true; } @Override protected boolean isEnabledForSelection(DMEntity entity, Vector<DMObject> globalSelection) { return ((entity != null) && (!entity.getIsReadOnly())); } }; private DMEntity _entity; private String _newMethodName; private DMMethod _newMethod; CreateDMMethod(DMEntity entity, Vector<DMObject> globalSelection, FlexoEditor editor) { super(actionType, entity, globalSelection, editor); } @Override protected void doAction(Object context) { if (logger.isLoggable(Level.FINE)) { logger.fine("CreateDMMethod"); } if (getEntity() != null) { if (_newMethodName == null || getEntity().getMethod(_newMethodName + "()") != null) { _newMethodName = getEntity().getDMModel().getNextDefautMethodName(getEntity()); } _newMethod = new DMMethod(getEntity().getDMModel(),/* getEntity(),*/_newMethodName); _newMethod.setEntity(getEntity()); getEntity().registerMethod(_newMethod); } } public String getNewMethodName() { return _newMethodName; } public void setNewMethodName(String name) { this._newMethodName = name; } public DMEntity getEntity() { if (_entity == null) { if (getFocusedObject() != null) { _entity = getFocusedObject(); } } return _entity; } public DMMethod getNewMethod() { return _newMethod; } }
b7fd5622e3858e7022c12073d52f7bf1b834fddb
d7b5b5c28a498680029b945448e3adc24b6a10f0
/ENTREGABLE_OO/src/main/java/views/fig/FigFactory.java
881a26ec95c78154c277f253a83f2f14accfc4b5
[]
no_license
Kune08/Pracs_ProgramacionIT
d839042f7c7b052d8194d607a14be5d5e560f922
8d7645b38bac927eebb329fd76ccadb3c7e05572
refs/heads/master
2022-04-01T03:36:51.178386
2020-01-27T17:10:20
2020-01-27T17:10:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,503
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package views.fig; import game.Bee; import game.Bee; import game.Blossom; import game.Fly; import game.IGameObject; import game.RidingHood; import game.Spider; import game.Stone; import views.IAWTGameView; import views.IViewFactory; /** * * @author aruznieto */ public class FigFactory implements IViewFactory { public IAWTGameView getView(IGameObject gObj, int length) throws Exception { IAWTGameView view = null; if (gObj instanceof Fly){ view = new VFigFly(gObj, length); } else if (gObj instanceof Bee){ view = new VFigBee(gObj, length); } else if (gObj instanceof RidingHood){ view = new VFigHood(gObj, length); } else if (gObj instanceof Spider){ view = new VFigSpider(gObj, length); } else if (gObj instanceof Stone){ view = new VFigStone(gObj, length); } else if (gObj instanceof Blossom){ if (gObj.getValue() < 10){ view = new VFigDandelion(gObj, length); } else { view = new VFigClover(gObj, length); } } return view; } }
930d8845ff8de6615da5004b7191802eeb624e0a
b585c1f30b7cdef2463564c5a894a82aaf8483e4
/src/geekbrains/java2/chat/server/ClientHandler.java
bdfb527feb106c6583b1fee8c9d5af396397c114
[]
no_license
SandyQwe/beginJava1
4999eb79fc031da9c3671638f99e5fac85e82001
30b134cb5913aa148fedefc76702ccb1ea1963a4
refs/heads/master
2020-05-21T20:13:24.851810
2016-11-27T03:52:44
2016-11-27T03:52:44
65,224,250
0
0
null
null
null
null
UTF-8
Java
false
false
5,969
java
package geekbrains.java2.chat.server; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; class ClientHandler implements Runnable { private Socket sock; private MyServer owner; private DataInputStream in; private DataOutputStream out; private String nick; ClientHandler(MyServer owner, Socket sock) { this.owner = owner; this.sock = sock; this.nick = ""; try { in = new DataInputStream(sock.getInputStream()); out = new DataOutputStream(sock.getOutputStream()); } catch (IOException e) { System.out.println("Проблема с созданием обработчиков потоков in и out(неизвестно у кого)"); } } String getNick() { return nick; } @Override public void run() { try { while (true) { String str = in.readUTF(); if (str != null && str.startsWith("/auth")) { String login = str.split(" ")[1]; String pass = str.split(" ")[2]; String user = SQLHandler.getNickByLoginPass(login, pass); if (user != null) { if (!owner.isNickBusy(user)) { nick = user; sendMessage("/authok " + nick); owner.broadCastMessage("Сервер", nick + " подключился к чату"); break; } else sendMessage("...Такой ник уже занят"); } else sendMessage("...Неверный логин/пароль"); } } while (true) { String str = in.readUTF(); if (str != null) { if (str.startsWith("/")) { if (str.equals("/end")) { sendMessage("Вы вышли из чата"); sendMessage("/endsession"); break; // } else if (str.startsWith("/changenick")) { // String newNick = str.split(" ")[1]; // if (newNick.length() > 2 && SQLHandler.tryToChangeNick(nick, newNick)) { // sendMessage("/nickchanged " + newNick); // owner.broadCastMessage("Сервер", "Пользователь " + nick + " сменил ник на " + newNick); // this.nick = newNick; // } else { // sendMessage("Невозможно поменять ник"); // } // } else if (str.startsWith("/pm")) { // /pm geekbrains hello java // String sto = str.split(" ")[1]; // String getmsg = str.substring(sto.length() + 5); // owner.personalMessage(this, sto, getmsg); // System.out.println("pm from " + this.getNick() + " to " + sto + ": " + getmsg); } else serviceCommandHandler(str); } else { // if (!nick.equals("")) System.out.println(nick + ": " + str); owner.broadCastMessage(nick, str); } } } } catch (IOException e) { System.out.println("Обрыв соединения с клиентом"); } finally { disconnect(); } } void sendMessage(String message) { try { out.writeUTF(message); out.flush(); } catch (IOException e) { e.printStackTrace(); } } private void serviceCommandHandler(String command) { String[] commands = command.split(" "); switch (commands[0]) { // case "/auth": { // String login = commands[1]; // String pass = commands[2]; // String user = SQLHandler.getNickByLoginPass(login, pass); // if (user != null) { // nick = user; // sendMessage("/auth complete"); // } else sendMessage("Auth error"); // break; // } case "/changenick": { String newNick = commands[1]; if (newNick.length() > 2 && SQLHandler.tryToChangeNick(nick, newNick)) { sendMessage("/nickchanged " + newNick); owner.broadCastMessage("Сервер", "Пользователь " + nick + " сменил ник на " + newNick); this.nick = newNick; } else { sendMessage("Невозможно поменять ник"); } break; } case "/pm": { String sto = commands[1]; String getmsg = command.substring(sto.length() + 5); owner.personalMessage(this, sto, getmsg); System.out.println("pm from " + this.getNick() + " to " + sto + ": " + getmsg); } // case "/end": { // sendMessage("end"); // disconnect(); // break; // } default: { sendMessage("Unknown command"); } } } private void disconnect() { try { owner.broadCastMessage("server", "Client " + nick + " disconnected..."); owner.unsubscribe(this); sock.close(); } catch (IOException e) { System.out.println("Проблема с закрытием сокета"); } } }
2e8db534dc6aecfb0e8507743b42a22c2657615c
bfb3d1b0cb936eca75722960ba30100abf627e08
/flow-server/src/main/java/com/vaadin/flow/component/template/internal/ParserData.java
db697619fcfb3782b85740674154e12b536cf7d9
[ "Apache-2.0" ]
permissive
javier-godoy/flow
4cedb4620708f69a36b3b28d44820f251c3ebe8f
32bc751631f8432bc4554327287f2ca3cd566e20
refs/heads/master
2023-03-19T00:51:51.678362
2022-12-30T05:37:40
2022-12-30T05:37:40
231,390,127
0
0
Apache-2.0
2020-01-02T13:43:33
2020-01-02T13:43:32
null
UTF-8
Java
false
false
2,481
java
/* * Copyright 2000-2022 Vaadin Ltd. * * 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.vaadin.flow.component.template.internal; import java.lang.reflect.Field; import java.util.Collections; import java.util.Map; /** * * Immutable parser data which may be stored in cache. * <p> * For internal use only. May be renamed or removed in a future release. * * @author Vaadin Ltd * @since * */ public class ParserData { private final Map<String, String> tagById; private final Map<Field, String> idByField; private final Map<String, Map<String, String>> attributesById; /** * Constructs an immutable data object with the given information. * * @param fields * a map of fields to their ids * @param tags * a map of ids to their tags * @param attributes * a map of attributes values to the element id */ public ParserData(Map<Field, String> fields, Map<String, String> tags, Map<String, Map<String, String>> attributes) { tagById = Collections.unmodifiableMap(tags); idByField = Collections.unmodifiableMap(fields); attributesById = Collections.unmodifiableMap(attributes); } /** * Applies the given consumer to each mapped field. * * @param consumer * the consumer to call for each mapped field */ public void forEachInjectedField(InjectableFieldConsumer consumer) { idByField.forEach( (field, id) -> consumer.apply(field, id, tagById.get(id))); } /** * Gets template element data (attribute values). * * @param id * the id of the element * @return template data */ public Map<String, String> getAttributes(String id) { Map<String, String> attrs = attributesById.get(id); if (attrs == null) { return Collections.emptyMap(); } return attrs; } }
bb67837dfc8e06ddaeee7af16e740df016d7a2bc
fbf9e6efabc0bd86a08cd5dddbfd7c4e524f3ac8
/src/main/java/io/renren/modules/test/service/StressTestFileService.java
1ad57bce0c8a256d76e124c239689cb72c84dfdf
[]
no_license
a287931704/performanceTestSystem
806df49621a15bf79ed76224bbb23192725f1c1e
aeaf85c65c8e1086f5ea68759635ce4d5edc1b4d
refs/heads/master
2022-10-20T17:58:14.010778
2020-08-11T07:57:07
2020-08-11T07:57:07
223,900,284
0
0
null
null
null
null
UTF-8
Java
false
false
2,964
java
package io.renren.modules.test.service; import io.renren.modules.test.entity.StressTestEntity; import io.renren.modules.test.entity.StressTestFileEntity; import io.renren.modules.test.entity.StressTestReportsEntity; import io.renren.modules.test.jmeter.JmeterRunEntity; import io.renren.modules.test.jmeter.JmeterStatEntity; import org.springframework.web.multipart.MultipartFile; import java.util.List; import java.util.Map; /** * 性能测试压测文件 */ public interface StressTestFileService { /** * 根据ID,查询文件 */ StressTestFileEntity queryObject(Long fileId); /** * 查询文件列表 */ List<StressTestFileEntity> queryList(Map<String, Object> map); /** * 查询文件列表 */ List<StressTestFileEntity> queryList(Long caseId); /** * 查询总数 */ int queryTotal(Map<String, Object> map); /** * 保存性能测试用例文件 */ void save(StressTestFileEntity stressCaseFile); /** * 保存性能测试用例文件 */ void save(MultipartFile file, String filePath, StressTestEntity stressCase, StressTestFileEntity stressCaseFile); /** * 更新性能测试用例信息 */ void update(StressTestFileEntity stressTestFile); /** * 更新性能测试用例信息 */ void update(StressTestFileEntity stressTestFile, StressTestReportsEntity stressTestReports); /** * 更新性能测试用例信息 */ void update(MultipartFile file, String filePath, StressTestEntity stressCase, StressTestFileEntity stressCaseFile); /** * 批量更新性能测试用例状态 */ void updateStatusBatch(StressTestFileEntity stressTestFile); /** * 批量删除 */ void deleteBatch(Object[] fileIds); /** * 立即执行 */ String run(Long[] fileIds); /** * 立即执行 */ String run2(Long fileId, Long caseId); /** * 立即停止 */ void stop(Long[] fileIds); /** * 停止运行 */ void stopAll(); /** * 立即停止运行 */ void stopAllNow(); /** * 获取轮询监控结果 */ JmeterStatEntity getJmeterStatEntity(Long fileId); /** * 同步参数化文件到节点机 */ void synchronizeFile(Long[] fileIds); /** * 分割同步参数化文件到节点机 */ void synchronizeFileBySplit(Long[] fileIds); /** * 获取文件路径,是文件的真实绝对路径 */ String getFilePath(StressTestFileEntity stressTestFile); /** * 相同进程内执行的脚本,可以使用这个方法停止 */ void stopLocal(Long fileId, JmeterRunEntity jmeterRunEntity); /** * 启动单个脚本 */ String runSingle(Long fileId); /** * 某个进程内执行的脚本,可以使用这个方法停止 */ void stopSingle(Long fileId); }
f7f2cc14cab13fec6be4b7d7692688637c8c8208
9168e501806e1c739c03d5ed0a91779294ab1615
/src/cfeditorxtext/edu.kit.scc.cfeditor.cfengine/src-gen/edu/kit/scc/cfeditor/cfengine/cfengine/CfengineFactory.java
78c6ef6d9208c2b66742001149cc18f24d15c221
[]
no_license
oldulov/cfeditor
d40500b9c985794460127d1b1b2c6c5aecb1c14c
989ea3f629bb259999841cefd8743da500574ad2
refs/heads/master
2021-05-10T09:26:53.666800
2018-01-25T14:56:17
2018-01-25T14:56:17
118,924,730
0
0
null
null
null
null
UTF-8
Java
false
false
4,735
java
/** * <copyright> * </copyright> * */ package edu.kit.scc.cfeditor.cfengine.cfengine; import org.eclipse.emf.ecore.EFactory; /** * <!-- begin-user-doc --> * The <b>Factory</b> for the model. * It provides a create method for each non-abstract class of the model. * <!-- end-user-doc --> * @see edu.kit.scc.cfeditor.cfengine.cfengine.CfenginePackage * @generated */ public interface CfengineFactory extends EFactory { /** * The singleton instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ CfengineFactory eINSTANCE = edu.kit.scc.cfeditor.cfengine.cfengine.impl.CfengineFactoryImpl.init(); /** * Returns a new object of class '<em>Cf Model</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Cf Model</em>'. * @generated */ CfModel createCfModel(); /** * Returns a new object of class '<em>Abstract Element</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Abstract Element</em>'. * @generated */ AbstractElement createAbstractElement(); /** * Returns a new object of class '<em>Bundle</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Bundle</em>'. * @generated */ Bundle createBundle(); /** * Returns a new object of class '<em>Bundle Promise Type</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Bundle Promise Type</em>'. * @generated */ BundlePromiseType createBundlePromiseType(); /** * Returns a new object of class '<em>Bundle Class</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Bundle Class</em>'. * @generated */ BundleClass createBundleClass(); /** * Returns a new object of class '<em>Bundle Promise</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Bundle Promise</em>'. * @generated */ BundlePromise createBundlePromise(); /** * Returns a new object of class '<em>Promise Value</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Promise Value</em>'. * @generated */ PromiseValue createPromiseValue(); /** * Returns a new object of class '<em>Body</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Body</em>'. * @generated */ Body createBody(); /** * Returns a new object of class '<em>Body Class</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Body Class</em>'. * @generated */ BodyClass createBodyClass(); /** * Returns a new object of class '<em>Body Function</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Body Function</em>'. * @generated */ BodyFunction createBodyFunction(); /** * Returns a new object of class '<em>Simple Function</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Simple Function</em>'. * @generated */ SimpleFunction createSimpleFunction(); /** * Returns a new object of class '<em>Special Function</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Special Function</em>'. * @generated */ SpecialFunction createSpecialFunction(); /** * Returns a new object of class '<em>Body Promise Type</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Body Promise Type</em>'. * @generated */ BodyPromiseType createBodyPromiseType(); /** * Returns a new object of class '<em>Bundle Component</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Bundle Component</em>'. * @generated */ BundleComponent createBundleComponent(); /** * Returns a new object of class '<em>Body Component</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Body Component</em>'. * @generated */ BodyComponent createBodyComponent(); /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the package supported by this factory. * @generated */ CfenginePackage getCfenginePackage(); } //CfengineFactory
967a28e33985acae6800a6f76a2fe2399f8d1da2
914921a9d200449be61364505e85afc7c4e41a03
/app/src/main/java/com/nagpal/shivam/instamath/Activity/ScientificCalculatorActivity.java
8e01cc9febddfde3217da9cb75dbb26cac8ae271
[ "Apache-2.0" ]
permissive
ShivamNagpal/Instamath_Android_App
7ca8e6c422edc2d4adf716b81b17526798afb7d6
ad28bfdffd2a3491445b3d9a2cdf3aed97429982
refs/heads/master
2023-09-01T21:27:47.797926
2023-08-30T12:03:35
2023-08-30T12:03:35
125,372,583
0
0
Apache-2.0
2023-08-30T12:03:36
2018-03-15T13:38:14
Java
UTF-8
Java
false
false
22,416
java
/* * Copyright 2018 Shivam Nagpal * * 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.nagpal.shivam.instamath.Activity; import android.annotation.SuppressLint; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.nagpal.shivam.expressionparser.Expression; import com.nagpal.shivam.expressionparser.ExpressionParserException; import com.nagpal.shivam.instamath.Adapter.BottomSheetAdapter; import com.nagpal.shivam.instamath.R; import com.nagpal.shivam.instamath.Utils.ConstantMethods; import com.nagpal.shivam.instamath.Utils.Constants; import com.nagpal.shivam.instamath.Utils.ExpressionToken; import com.nagpal.shivam.instamath.Utils.TouchEventLinearLayout; import java.text.DecimalFormat; import java.util.ArrayList; public class ScientificCalculatorActivity extends AppCompatActivity implements BottomSheetAdapter.ItemClickHandler { private static final String PREFERENCES_KEY_SINE = "preferences_key_sine"; private static final String PREFERENCES_KEY_COSINE = "preferences_key_cosine"; private static final String PREFERENCES_KEY_TANGENT = "preferences_key_tangent"; private static final String PREFERENCES_KEY_SQRT = "preferences_key_sqrt"; private static final String PREFERENCES_KEY_LOG = "preferences_key_log"; private static final String PREFERENCES_KEY_DOT = "preferences_key_dot"; private static final String UNICODE_SQRT = "\u221A"; private static final String UNICODE_CBRT = "\u221B"; private static final String UNICODE_PI = "\u03C0"; private AlertDialog expandableButtonDialog; private DecimalFormat decimalFormat; private double result; private HorizontalScrollView hsvResult; private SharedPreferences scientificCalculatorSharedPreferences; private StringBuilder stringBuilder; private TextView txtViewScientificResultDisplay; private TextView txtViewScientificExpressionDisplay; private RecyclerView bottomSheetRecyclerView; private BottomSheetBehavior bottomSheetBehavior; @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); } @SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scientific_calculator); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } stringBuilder = new StringBuilder(); initViews(); scientificCalculatorSharedPreferences = getPreferences(MODE_PRIVATE); SharedPreferences preferencesSharedPreferences = getSharedPreferences(Constants.PREFERENCES_ACTIVITY_KEY, MODE_PRIVATE); StringBuilder patternDecimalFormat = new StringBuilder("#0."); for (int i = 0; i < preferencesSharedPreferences.getFloat(PreferencesActivity.PREFERENCES_FIX_KEY, PreferencesActivity.PREFERENCES_FIX_DEFAULT_VALUE); i++) { patternDecimalFormat.append("0"); } decimalFormat = new DecimalFormat(patternDecimalFormat.toString()); switch (PreferencesActivity.PREFERENCE_ANGLE_UNITS[preferencesSharedPreferences.getInt(PreferencesActivity.PREFERENCES_ANGLE_UNIT_KEY, PreferencesActivity.PREFERENCES_ANGLE_UNIT_DEFAULT_VALUE)]) { case PreferencesActivity.PREFERENCES_ANGLE_UNIT_DEGREE: Expression.setAngleUnits(Expression.ANGLE_UNITS_DEGREE); break; case PreferencesActivity.PREFERENCES_ANGLE_UNIT_RADIAN: Expression.setAngleUnits(Expression.ANGLE_UNITS_RADIAN); break; } Expression.setNormalizeTrigonometricFunctions(true); View bottomSheet = findViewById(R.id.scientific_bottom_sheet); bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); final TouchEventLinearLayout touchEventLinearLayout = findViewById(R.id.scientific_linear_layout_root); touchEventLinearLayout.setTouchEventListener(new TouchEventLinearLayout.TouchEventListener() { @Override public void onActionUp() { if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } @Override public void onSlideUp() { if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); } } @Override public void onSlideDown() { if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } }); bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { switch (newState) { case BottomSheetBehavior.STATE_COLLAPSED: touchEventLinearLayout.setActionUpActive(false); break; case BottomSheetBehavior.STATE_EXPANDED: touchEventLinearLayout.setActionUpActive(true); break; } } @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { } }); Button btnZero = findViewById(R.id.button_scientific_zero); btnZero.setOnClickListener(buttonOnClickListener(false)); Button btnOne = findViewById(R.id.button_scientific_one); btnOne.setOnClickListener(buttonOnClickListener(false)); Button btnTwo = findViewById(R.id.button_scientific_two); btnTwo.setOnClickListener(buttonOnClickListener(false)); Button btnThree = findViewById(R.id.button_scientific_three); btnThree.setOnClickListener(buttonOnClickListener(false)); Button btnFour = findViewById(R.id.button_scientific_four); btnFour.setOnClickListener(buttonOnClickListener(false)); Button btnFive = findViewById(R.id.button_scientific_five); btnFive.setOnClickListener(buttonOnClickListener(false)); Button btnSix = findViewById(R.id.button_scientific_six); btnSix.setOnClickListener(buttonOnClickListener(false)); Button btnSeven = findViewById(R.id.button_scientific_seven); btnSeven.setOnClickListener(buttonOnClickListener(false)); Button btnEight = findViewById(R.id.button_scientific_eight); btnEight.setOnClickListener(buttonOnClickListener(false)); Button btnNine = findViewById(R.id.button_scientific_nine); btnNine.setOnClickListener(buttonOnClickListener(false)); Button btnPlus = findViewById(R.id.button_scientific_plus); btnPlus.setOnClickListener(buttonOnClickListener(false)); Button btnMinus = findViewById(R.id.button_scientific_minus); btnMinus.setOnClickListener(buttonOnClickListener(false)); Button btnMultiply = findViewById(R.id.button_scientific_multiply); btnMultiply.setOnClickListener(buttonOnClickListener(false)); Button btnDivide = findViewById(R.id.button_scientific_divide); btnDivide.setOnClickListener(buttonOnClickListener(false)); Button btnDot = findViewById(R.id.button_scientific_dot); btnDot.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_DOT, ".")); btnDot.setOnClickListener(buttonOnClickListener(false)); btnDot.setOnLongClickListener(buttonOnLongClickListener(btnDot, new String[]{".", ","}, false, PREFERENCES_KEY_DOT)); Button btnSine = findViewById(R.id.button_scientific_sine); btnSine.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_SINE, "sin")); btnSine.setOnClickListener(buttonOnClickListener(true)); btnSine.setOnLongClickListener(buttonOnLongClickListener(btnSine, new String[]{"sin", "asin", "sinh"}, true, PREFERENCES_KEY_SINE)); Button btnCosine = findViewById(R.id.button_scientific_cosine); btnCosine.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_COSINE, "cos")); btnCosine.setOnClickListener(buttonOnClickListener(true)); btnCosine.setOnLongClickListener(buttonOnLongClickListener(btnCosine, new String[]{"cos", "acos", "cosh"}, true, PREFERENCES_KEY_COSINE)); Button btnTangent = findViewById(R.id.button_scientific_tangent); btnTangent.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_TANGENT, "tan")); btnTangent.setOnClickListener(buttonOnClickListener(true)); btnTangent.setOnLongClickListener(buttonOnLongClickListener(btnTangent, new String[]{"tan", "atan", "tanh"}, true, PREFERENCES_KEY_TANGENT)); Button btnFactorial = findViewById(R.id.button_scientific_factorial); btnFactorial.setOnClickListener(buttonOnClickListener(false)); Button btnNaturalLog = findViewById(R.id.button_scientific_natural_log); btnNaturalLog.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_LOG, "ln")); btnNaturalLog.setOnClickListener(buttonOnClickListener(true)); btnNaturalLog.setOnLongClickListener(buttonOnLongClickListener(btnNaturalLog, new String[]{"ln", "log"}, true, PREFERENCES_KEY_LOG)); Button btnBottomSheetToggle = findViewById(R.id.button_scientific_bottom_sheet_toggle); btnBottomSheetToggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); } }); Button btnSquareRoot = findViewById(R.id.button_scientific_square_root); btnSquareRoot.setText(scientificCalculatorSharedPreferences.getString(PREFERENCES_KEY_SQRT, UNICODE_SQRT)); btnSquareRoot.setOnClickListener(buttonOnClickListener(true)); btnSquareRoot.setOnLongClickListener(buttonOnLongClickListener(btnSquareRoot, new String[]{UNICODE_SQRT, UNICODE_CBRT}, true, PREFERENCES_KEY_SQRT)); Button btnPower = findViewById(R.id.button_scientific_power); btnPower.setOnClickListener(buttonOnClickListener(false)); Button btnEular = findViewById(R.id.button_scientific_eular); btnEular.setOnClickListener(buttonOnClickListener(false)); Button btnPi = findViewById(R.id.button_scientific_pi); btnPi.setOnClickListener(buttonOnClickListener(false)); Button btnParenthesis = findViewById(R.id.button_scientific_parenthesis_left); btnParenthesis.setOnClickListener(buttonOnClickListener(false)); Button btnParenthesisRight = findViewById(R.id.button_scientific_parenthesis_right); btnParenthesisRight.setOnClickListener(buttonOnClickListener(false)); Button btnEquate = findViewById(R.id.button_scientific_equate); btnEquate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (stringBuilder.length() == 0) { return; } updateExpressionDisplay(stringBuilder.toString()); result = Double.NaN; try { Expression expression = new Expression(convertToExpressionString(stringBuilder.toString())); result = expression.evaluate(); result = Double.parseDouble(decimalFormat.format(result)); if (Math.abs(result) == 0) { result = Math.abs(result); } } catch (NumberFormatException e) { e.printStackTrace(); } catch (ExpressionParserException e) { e.printStackTrace(); Toast.makeText(ScientificCalculatorActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } stringBuilder.setLength(0); stringBuilder.append(result); String temp = "= " + result; txtViewScientificResultDisplay.setText(temp); new Handler().postDelayed(new Runnable() { @Override public void run() { hsvResult.fullScroll(View.FOCUS_LEFT); } }, 25); } }); Button btnBack = findViewById(R.id.button_scientific_back); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (stringBuilder.length() != 0) { stringBuilder.deleteCharAt(stringBuilder.length() - 1); updateResultDisplay(stringBuilder.toString()); } } }); Button btnClear = findViewById(R.id.button_scientific_clear); btnClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { stringBuilder.setLength(0); updateResultDisplay(null); updateExpressionDisplay(null); } }); txtViewScientificExpressionDisplay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { stringBuilder.setLength(0); String expression = txtViewScientificExpressionDisplay.getText().toString(); if (!expression.isEmpty()) { stringBuilder.append(expression); updateResultDisplay(stringBuilder.toString()); } updateExpressionDisplay(null); } }); bottomSheetRecyclerView = findViewById(R.id.scientific_bottom_sheet_recycler_view); bottomSheetRecyclerView.setLayoutManager(new LinearLayoutManager(ScientificCalculatorActivity.this, LinearLayoutManager.HORIZONTAL, false)); bottomSheetRecyclerView.setHasFixedSize(true); ArrayList<ExpressionToken> expressionTokenArrayList = new ArrayList<>(); expressionTokenArrayList.add(new ExpressionToken("P", false)); expressionTokenArrayList.add(new ExpressionToken("C", false)); expressionTokenArrayList.add(new ExpressionToken("der", true)); expressionTokenArrayList.add(new ExpressionToken("X", false)); expressionTokenArrayList.add(new ExpressionToken("e", false)); expressionTokenArrayList.add(new ExpressionToken(UNICODE_PI, false)); expressionTokenArrayList.add(new ExpressionToken(UNICODE_SQRT, true)); expressionTokenArrayList.add(new ExpressionToken(UNICODE_CBRT, true)); expressionTokenArrayList.add(new ExpressionToken("sin", true)); expressionTokenArrayList.add(new ExpressionToken("cos", true)); expressionTokenArrayList.add(new ExpressionToken("tan", true)); expressionTokenArrayList.add(new ExpressionToken("asin", true)); expressionTokenArrayList.add(new ExpressionToken("acos", true)); expressionTokenArrayList.add(new ExpressionToken("atan", true)); expressionTokenArrayList.add(new ExpressionToken("sinh", true)); expressionTokenArrayList.add(new ExpressionToken("cosh", true)); expressionTokenArrayList.add(new ExpressionToken("tanh", true)); BottomSheetAdapter bottomSheetAdapter = new BottomSheetAdapter(expressionTokenArrayList); bottomSheetAdapter.setItemClickHandler(this); bottomSheetRecyclerView.setAdapter(bottomSheetAdapter); } private void initViews() { txtViewScientificExpressionDisplay = findViewById(R.id.text_view_scientific_expression_display); txtViewScientificResultDisplay = findViewById(R.id.text_view_scientific_result_display); hsvResult = (HorizontalScrollView) txtViewScientificResultDisplay.getParent(); } /** * updateResultDisplay Method in ScientificCalculatorActivity * * @param string (A String Variable) * Updates the text in the View with the string. */ private void updateExpressionDisplay(String string) { txtViewScientificExpressionDisplay.setText(string); } private void updateResultDisplay(String string) { txtViewScientificResultDisplay.setText(string); new Handler().postDelayed(new Runnable() { @Override public void run() { hsvResult.fullScroll(View.FOCUS_RIGHT); } }, 25); } private View showExpandableButtons(final Button expandableButton, String[] buttonLabels, final Boolean isFunction, final String preferenceKey) { Resources resources = getResources(); LinearLayout rootLayout = new LinearLayout(ScientificCalculatorActivity.this); rootLayout.setGravity(Gravity.CENTER); int buttonMargin = (int) ConstantMethods.dpToFloat(resources, 16); LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams((int) ConstantMethods.dpToFloat(resources, 56), (int) ConstantMethods.dpToFloat(resources, 56)); buttonLayoutParams.setMargins(buttonMargin, buttonMargin, buttonMargin, buttonMargin); View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View view) { String string = ((Button) view).getText().toString(); expandableButton.setText(string); stringBuilder.append(string); if (isFunction) { stringBuilder.append("("); } updateResultDisplay(stringBuilder.toString()); SharedPreferences.Editor editor = scientificCalculatorSharedPreferences.edit(); editor.putString(preferenceKey, string); editor.apply(); dismissExpandableButtonDialog(); } }; for (String label : buttonLabels) { Button button = new Button(ScientificCalculatorActivity.this); button.setLayoutParams(buttonLayoutParams); button.setText(label); button.setAllCaps(false); button.setBackground(resources.getDrawable(R.drawable.drawable_background_button_calculator)); button.setOnClickListener(onClickListener); rootLayout.addView(button); } return rootLayout; } private void dismissExpandableButtonDialog() { if (expandableButtonDialog != null) { expandableButtonDialog.dismiss(); expandableButtonDialog = null; } } private String convertToExpressionString(String string) { string = string.replaceAll("\u00D7", "*"); string = string.replaceAll("\u00F7", "/"); string = string.replaceAll("\u221A", "sqrt"); string = string.replaceAll("\u221B", "cbrt"); string = string.replaceAll("\u03C0", "pi"); return string; } private View.OnClickListener buttonOnClickListener(final Boolean isFunction) { return new View.OnClickListener() { @Override public void onClick(View view) { stringBuilder.append(((Button) view).getText().toString()); if (isFunction) { stringBuilder.append("("); } updateResultDisplay(stringBuilder.toString()); } }; } private View.OnLongClickListener buttonOnLongClickListener(final Button expandableButton, final String[] buttonLabels, final Boolean isFunction, final String preferenceKey) { return new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(ScientificCalculatorActivity.this); builder.setView(showExpandableButtons(expandableButton, buttonLabels, isFunction, preferenceKey)); expandableButtonDialog = builder.create(); expandableButtonDialog.show(); return true; } }; } @Override public void onBackPressed() { if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); return; } super.onBackPressed(); } @Override public void onBottomSheetAdapterItemClick(String token, boolean isFunction) { stringBuilder.append(token); if (isFunction) { stringBuilder.append("("); } updateResultDisplay(stringBuilder.toString()); } }
1afd9a959ad35156c3d6f2b4f813d35e0b37180a
d61cacfca3a0077aa889fc6dfdabf822ad2fc30f
/uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/validation/ClientUserValidator.java
d6298bd5d746351dc1bb918ea84876cc474d1050
[ "Apache-2.0" ]
permissive
akumar074/appformer
59468c3c29eb04a9a5d441e3a2a4f2eb495d55d8
eec892e30e1d1570e22ead844385a31ea78b4b61
refs/heads/master
2023-04-16T01:50:36.234071
2019-10-07T14:20:17
2019-10-07T14:20:17
213,605,464
1
0
Apache-2.0
2019-10-08T09:47:43
2019-10-08T09:47:43
null
UTF-8
Java
false
false
1,155
java
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.uberfire.ext.security.management.client.validation; import org.uberfire.ext.security.management.api.validation.UserValidator; import org.uberfire.ext.security.management.client.resources.i18n.UsersManagementClientConstants; public class ClientUserValidator extends UserValidator { @Override public String getMessage(String key) { if (KEY_NAME_NOT_EMPTY.equals(key)) { return UsersManagementClientConstants.INSTANCE.user_validation_nameNotEmpty(); } return null; } }
e8d97cb301f50444a47addfa03678dbf08169727
05c1ff702a2dbc52d355e15787c38a1f148e129f
/app/src/main/java/com/example/safsaf/noon4/PreOneActivity.java
8ccd346abe68f735e759a9da4873926e04595892
[]
no_license
safaamostafa/Noon4
1298eb2fc75ae662bdbe5faf109a28e438ed7580
5f1207e2a201dd606e9678b9af205a050b926e58
refs/heads/master
2021-01-13T11:18:11.076295
2017-02-09T05:44:31
2017-02-09T05:44:31
81,413,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,208
java
package com.example.safsaf.noon4; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import java.util.ArrayList; public class PreOneActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.word_list); ArrayList<Word> words=new ArrayList<Word>(); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); words.add(new Word("محمد مصطفى محسب", "طيار ")); WordAdapter adapter = new WordAdapter(this,words); ListView listView = (ListView)findViewById(R.id.list); listView.setAdapter(adapter); } }
e3b3130da7d5a76927b9e85491c895c9137e87db
5db950ca2131533c077c89f288c5a5ece25011e1
/src/main/java/com/tummala/util/ResponseDTO.java
342c3e194c4fd142fd7bbaaa001e25400710863d
[]
no_license
tummalasrikanth/spring-boot
32b6f1f9a93351e1adbbac1c09850349366b4f67
c746157c73e938a84673547acdab99cad575c3b3
refs/heads/master
2022-11-05T21:29:05.982181
2020-06-23T05:09:54
2020-06-23T05:09:54
274,313,793
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
package com.tummala.util; import java.util.HashSet; import java.util.Set; import org.springframework.hateoas.ResourceSupport; import com.tummala.util.ApiStatusCode; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) public class ResponseDTO<T> extends ResourceSupport { private ApiStatusCode status; private Set<MessageBean> messages =new HashSet<>(); private T body; public boolean addMessage(APIErrorCodes apiErrorCodes) { return messages.add(new MessageBean(apiErrorCodes.getErrorCode(),apiErrorCodes.getErrorDesc())); } public boolean addMessage(MessageBean apiMessage) { return messages.add(apiMessage); } }
[ "srikanth@LAPTOP-19SHH9A3" ]
srikanth@LAPTOP-19SHH9A3
63b96d61f302defd8b9ef6888c59ad252783abef
1b37b1d9a4d24bced12dfee21a12ed5723c4aebc
/android/versioned-abis/expoview-abi42_0_0/src/main/java/abi42_0_0/expo/modules/updates/UpdatesModule.java
a929d8390cdcfa825464f7f118dae5dcb0f66a37
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
permissive
JeffGuKang/expo
37bbff55f657d8efe90dad2cb676db122e5621cf
fd06ac0fc2296b3441d1e48896fded19883d8a43
refs/heads/master
2021-12-12T23:07:31.775102
2021-12-04T02:43:30
2021-12-04T02:43:30
247,704,988
1
0
NOASSERTION
2020-03-16T13:09:02
2020-03-16T13:09:02
null
UTF-8
Java
false
false
9,701
java
package abi42_0_0.expo.modules.updates; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; import abi42_0_0.org.unimodules.core.ExportedModule; import abi42_0_0.org.unimodules.core.ModuleRegistry; import abi42_0_0.org.unimodules.core.Promise; import abi42_0_0.org.unimodules.core.interfaces.ExpoMethod; import androidx.annotation.Nullable; import expo.modules.updates.db.DatabaseHolder; import expo.modules.updates.db.entity.AssetEntity; import expo.modules.updates.db.entity.UpdateEntity; import expo.modules.updates.launcher.Launcher; import expo.modules.updates.loader.FileDownloader; import expo.modules.updates.manifest.UpdateManifest; import expo.modules.updates.loader.RemoteLoader; import expo.modules.updates.manifest.ManifestMetadata; // this unused import must stay because of versioning import expo.modules.updates.UpdatesConfiguration; public class UpdatesModule extends ExportedModule { private static final String NAME = "ExpoUpdates"; private static final String TAG = UpdatesModule.class.getSimpleName(); private ModuleRegistry mModuleRegistry; public UpdatesModule(Context context) { super(context); } @Override public String getName() { return NAME; } @Override public void onCreate(ModuleRegistry moduleRegistry) { mModuleRegistry = moduleRegistry; } private UpdatesInterface getUpdatesService() { return mModuleRegistry.getModule(UpdatesInterface.class); } @Override public Map<String, Object> getConstants() { Map<String, Object> constants = new HashMap<>(); try { UpdatesInterface updatesService = getUpdatesService(); if (updatesService != null) { constants.put("isEmergencyLaunch", updatesService.isEmergencyLaunch()); constants.put("isMissingRuntimeVersion", updatesService.getConfiguration().isMissingRuntimeVersion()); UpdateEntity launchedUpdate = updatesService.getLaunchedUpdate(); if (launchedUpdate != null) { constants.put("updateId", launchedUpdate.getId().toString()); constants.put("manifestString", launchedUpdate.getManifest() != null ? launchedUpdate.getManifest().toString() : "{}"); } Map<AssetEntity, String> localAssetFiles = updatesService.getLocalAssetFiles(); if (localAssetFiles != null) { Map<String, String> localAssets = new HashMap<>(); for (AssetEntity asset : localAssetFiles.keySet()) { if (asset.getKey() != null) { localAssets.put(asset.getKey(), localAssetFiles.get(asset)); } } constants.put("localAssets", localAssets); } constants.put("isEnabled", updatesService.getConfiguration().isEnabled()); constants.put("releaseChannel", updatesService.getConfiguration().getReleaseChannel()); constants.put("isUsingEmbeddedAssets", updatesService.isUsingEmbeddedAssets()); } } catch (Exception e) { // do nothing; this is expected in a development client constants.put("isEnabled", false); // In a development client, we normally don't have access to the updates configuration, but // we should attempt to see if the runtime/sdk versions are defined in AndroidManifest.xml // and warn the developer if not. This does not take into account any extra configuration // provided at runtime in MainApplication.java, because we don't have access to that in a // debug build. UpdatesConfiguration configuration = new UpdatesConfiguration().loadValuesFromMetadata(getContext()); constants.put("isMissingRuntimeVersion", configuration.isMissingRuntimeVersion()); } return constants; } @ExpoMethod public void reload(final Promise promise) { try { UpdatesInterface updatesService = getUpdatesService(); if (!updatesService.canRelaunch()) { promise.reject("ERR_UPDATES_DISABLED", "You cannot reload when expo-updates is not enabled."); return; } updatesService.relaunchReactApplication(new Launcher.LauncherCallback() { @Override public void onFailure(Exception e) { Log.e(TAG, "Failed to relaunch application", e); promise.reject("ERR_UPDATES_RELOAD", e.getMessage(), e); } @Override public void onSuccess() { promise.resolve(null); } }); } catch (IllegalStateException e) { promise.reject( "ERR_UPDATES_RELOAD", "The updates module controller has not been properly initialized. If you're using a development client, you cannot use `Updates.reloadAsync`. Otherwise, make sure you have called the native method UpdatesController.initialize()." ); } } @ExpoMethod public void checkForUpdateAsync(final Promise promise) { try { final UpdatesInterface updatesService = getUpdatesService(); if (!updatesService.getConfiguration().isEnabled()) { promise.reject("ERR_UPDATES_DISABLED", "You cannot check for updates when expo-updates is not enabled."); return; } DatabaseHolder databaseHolder = updatesService.getDatabaseHolder(); JSONObject extraHeaders = ManifestMetadata.getServerDefinedHeaders(databaseHolder.getDatabase(), updatesService.getConfiguration()); databaseHolder.releaseDatabase(); updatesService.getFileDownloader().downloadManifest(updatesService.getConfiguration(), extraHeaders, getContext(), new FileDownloader.ManifestDownloadCallback() { @Override public void onFailure(String message, Exception e) { promise.reject("ERR_UPDATES_CHECK", message, e); Log.e(TAG, message, e); } @Override public void onSuccess(UpdateManifest updateManifest) { UpdateEntity launchedUpdate = updatesService.getLaunchedUpdate(); Bundle updateInfo = new Bundle(); if (launchedUpdate == null) { // this shouldn't ever happen, but if we don't have anything to compare // the new manifest to, let the user know an update is available updateInfo.putBoolean("isAvailable", true); updateInfo.putString("manifestString", updateManifest.getManifest().toString()); promise.resolve(updateInfo); return; } if (updatesService.getSelectionPolicy().shouldLoadNewUpdate(updateManifest.getUpdateEntity(), launchedUpdate, updateManifest.getManifestFilters())) { updateInfo.putBoolean("isAvailable", true); updateInfo.putString("manifestString", updateManifest.getManifest().toString()); promise.resolve(updateInfo); } else { updateInfo.putBoolean("isAvailable", false); promise.resolve(updateInfo); } } }); } catch (IllegalStateException e) { promise.reject( "ERR_UPDATES_CHECK", "The updates module controller has not been properly initialized. If you're using a development client, you cannot check for updates. Otherwise, make sure you have called the native method UpdatesController.initialize()." ); } } @ExpoMethod public void fetchUpdateAsync(final Promise promise) { try { final UpdatesInterface updatesService = getUpdatesService(); if (!updatesService.getConfiguration().isEnabled()) { promise.reject("ERR_UPDATES_DISABLED", "You cannot fetch updates when expo-updates is not enabled."); return; } AsyncTask.execute(() -> { final DatabaseHolder databaseHolder = updatesService.getDatabaseHolder(); new RemoteLoader(getContext(), updatesService.getConfiguration(), databaseHolder.getDatabase(), updatesService.getFileDownloader(), updatesService.getDirectory()) .start( new RemoteLoader.LoaderCallback() { @Override public void onFailure(Exception e) { databaseHolder.releaseDatabase(); promise.reject("ERR_UPDATES_FETCH", "Failed to download new update", e); } @Override public void onAssetLoaded(AssetEntity asset, int successfulAssetCount, int failedAssetCount, int totalAssetCount) { } @Override public boolean onUpdateManifestLoaded(UpdateManifest updateManifest) { return updatesService.getSelectionPolicy().shouldLoadNewUpdate( updateManifest.getUpdateEntity(), updatesService.getLaunchedUpdate(), updateManifest.getManifestFilters()); } @Override public void onSuccess(@Nullable UpdateEntity update) { databaseHolder.releaseDatabase(); Bundle updateInfo = new Bundle(); if (update == null) { updateInfo.putBoolean("isNew", false); } else { updatesService.resetSelectionPolicy(); updateInfo.putBoolean("isNew", true); updateInfo.putString("manifestString", update.getManifest().toString()); } promise.resolve(updateInfo); } } ); }); } catch (IllegalStateException e) { promise.reject( "ERR_UPDATES_FETCH", "The updates module controller has not been properly initialized. If you're using a development client, you cannot fetch updates. Otherwise, make sure you have called the native method UpdatesController.initialize()." ); } } }
efd75905e42d9dc60dfcc546ad8a4631cfbd7b2e
6569c7463da35a49efce203b98d2c26d47fd54c8
/ServiceTest/src/com/example/servicetest/MainActivity.java
9b78cf5cf3c12bca38271a40f248528d6a9e4ba2
[]
no_license
Hsingmin/android_work
0bdb25afca3e36a79833c1029e1e208bbc68ac8d
6ea72ad5528e7aa9f15920604e05a53b47cec785
refs/heads/master
2021-01-23T22:30:50.017140
2017-09-09T08:07:49
2017-09-09T08:07:49
102,937,525
1
0
null
null
null
null
UTF-8
Java
false
false
2,466
java
package com.example.servicetest; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity implements OnClickListener { private Button startService; private Button stopService; private Button bindService; private Button unbindService; private Button startIntentService; private MyService.DownloadBinder downloadBinder; private ServiceConnection connection = new ServiceConnection(){ @Override public void onServiceDisconnected(ComponentName name){ } @Override public void onServiceConnected(ComponentName name, IBinder service){ downloadBinder = (MyService.DownloadBinder) service; downloadBinder.startDownload(); downloadBinder.getProgress(); } }; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startService = (Button) findViewById(R.id.start_service); stopService = (Button) findViewById(R.id.stop_service); startService.setOnClickListener(this); stopService.setOnClickListener(this); bindService = (Button) findViewById(R.id.bind_service); unbindService = (Button) findViewById(R.id.unbind_service); bindService.setOnClickListener(this); unbindService.setOnClickListener(this); startIntentService = (Button) findViewById(R.id.start_intent_service); startIntentService.setOnClickListener(this); } @Override public void onClick(View v){ switch(v.getId()){ case R.id.start_service: Intent startIntent = new Intent(this, MyService.class); startService(startIntent); break; case R.id.stop_service: Intent stopIntent = new Intent(this, MyService.class); stopService(stopIntent); break; case R.id.bind_service: Intent bindIntent = new Intent(this, MyService.class); bindService(bindIntent, connection, BIND_AUTO_CREATE); break; case R.id.unbind_service: unbindService(connection); break; case R.id.start_intent_service: Log.d("MainActivity", "Thread id is " + Thread.currentThread().getId()); Intent intentService = new Intent(this, MyIntentService.class); startService(intentService); break; default: break; } } }
96cddf87fe693ba3d6c87c157332efbc41fad89b
435df73ec11d40229406abfc90b18996d8090dbe
/src/tools/fasttrack_perturbation/FastTrackToolWithPerturbation.java
b0a670a600344c260c83fe5ed0dabe7ab035e9eb
[ "SMLNJ", "BSD-3-Clause" ]
permissive
Hrugved/CS636_asssignment_01
3d19745107d8792fd67b2f359e0fabd50e9a9b1f
8ce0ac1f53ae9ae6dd66ecf32774d72ae9f9f8bc
refs/heads/main
2023-04-25T11:46:57.402051
2021-05-13T04:37:25
2021-05-13T04:37:25
339,490,397
0
0
null
null
null
null
UTF-8
Java
false
false
36,025
java
/****************************************************************************** * * Copyright (c) 2016, Cormac Flanagan (University of California, Santa Cruz) and Stephen Freund * (Williams College) * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions * and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions * and the following disclaimer in the documentation and/or other materials provided with the * distribution. * * Neither the names of the University of California, Santa Cruz and Williams College nor the names * of its contributors may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************/ package tools.fasttrack_perturbation; import acme.util.Assert; import acme.util.Util; import acme.util.count.AggregateCounter; import acme.util.count.ThreadLocalCounter; import acme.util.decorations.Decoration; import acme.util.decorations.DecorationFactory.Type; import acme.util.decorations.DefaultValue; import acme.util.decorations.NullDefault; import acme.util.io.XMLWriter; import acme.util.option.CommandLine; import acme.util.option.CommandLineOption; import rr.RRMain; import rr.annotations.Abbrev; import rr.barrier.BarrierEvent; import rr.barrier.BarrierListener; import rr.barrier.BarrierMonitor; import rr.error.ErrorMessage; import rr.error.ErrorMessages; import rr.event.*; import rr.event.AccessEvent.Kind; import rr.instrument.classes.ArrayAllocSiteTracker; import rr.meta.*; import rr.state.ShadowLock; import rr.state.ShadowThread; import rr.state.ShadowVar; import rr.state.ShadowVolatile; import rr.tool.RR; import rr.tool.Tool; import tools.util.Epoch; import tools.util.VectorClock; import java.io.File; import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import static java.lang.Integer.min; /* * A revised FastTrack Tool. This makes several improvements over the original: - Simpler * synchronization scheme for VarStates. (The old optimistic scheme no longer has a performance * benefit and was hard to get right.) - Rephrased rules to: - include a Read-Shared-Same-Epoch * test. - eliminate an unnecessary update on joins (this was just for the proof). - remove the * Read-Shared to Exclusive transition. The last change makes the correctness argument easier and * that transition had little to no performance impact in practice. - Properly replays events when * the fast paths detect an error in all cases. - Supports long epochs for larger clock values. - * Handles tid reuse more precisely. The performance over the JavaGrande and DaCapo benchmarks is * more or less identical to the old implementation (within ~1% overall in our tests). */ @Abbrev("FT2SS") public class FastTrackToolWithPerturbation extends Tool implements BarrierListener<FTBarrierState> { private enum racepairType { A, B } private static CommandLineOption<String> racepairsFilePath = CommandLine.makeString("racepair", "../../racepairs.txt", CommandLineOption.Kind.STABLE, "specify path to input file"); // sourceLoc = 1|2 // A<->B => A=1, B=2 Map<String,racepairType> racepairs = new HashMap<>(); @Override public void init() { super.init(); parseFile(); } @Override public void fini() { super.fini(); System.out.println("\n\n"+racepairs+"\n\n"); } private static final boolean COUNT_OPERATIONS = RRMain.slowMode(); private static final int INIT_VECTOR_CLOCK_SIZE = 4; public final ErrorMessage<FieldInfo> fieldErrors = ErrorMessages .makeFieldErrorMessage("FastTrack"); public final ErrorMessage<ArrayAccessInfo> arrayErrors = ErrorMessages .makeArrayErrorMessage("FastTrack"); private final VectorClock maxEpochPerTid = new VectorClock(INIT_VECTOR_CLOCK_SIZE); // CS636: Every class object would have a vector clock. classInitTime is the Decoration which // stores ClassInfo (as a key) and corresponding vector clock for that class (as a value). // guarded by classInitTime public static final Decoration<ClassInfo, VectorClock> classInitTime = MetaDataInfoMaps .getClasses().makeDecoration("FastTrack:ClassInitTime", Type.MULTIPLE, new DefaultValue<ClassInfo, VectorClock>() { public VectorClock get(ClassInfo st) { return new VectorClock(INIT_VECTOR_CLOCK_SIZE); } }); public static VectorClock getClassInitTime(ClassInfo ci) { synchronized (classInitTime) { return classInitTime.get(ci); } } public FastTrackToolWithPerturbation(final String name, final Tool next, CommandLine commandLine) { super(name, next, commandLine); commandLine.add(racepairsFilePath); new BarrierMonitor<FTBarrierState>(this, new DefaultValue<Object, FTBarrierState>() { public FTBarrierState get(Object k) { return new FTBarrierState(k, INIT_VECTOR_CLOCK_SIZE); } }); } /* * Shadow State: St.E -- epoch decoration on ShadowThread - Thread-local. Never access from a * different thread St.V -- VectorClock decoration on ShadowThread - Thread-local while thread * is running. - The thread starting t may access st.V before the start. - Any thread joining on * t may read st.V after the join. Sm.V -- FTLockState decoration on ShadowLock - See * FTLockState for synchronization rules. Sx.R,Sx.W,Sx.V -- FTVarState objects - See FTVarState * for synchronization rules. Svx.V -- FTVolatileState decoration on ShadowVolatile (serves same * purpose as L for volatiles) - See FTVolatileState for synchronization rules. Sb.V -- * FTBarrierState decoration on Barriers - See FTBarrierState for synchronization rules. */ // invariant: st.E == st.V(st.tid) protected static int/* epoch */ ts_get_E(ShadowThread st) { Assert.panic("Bad"); return -1; } protected static void ts_set_E(ShadowThread st, int/* epoch */ e) { Assert.panic("Bad"); } protected static VectorClock ts_get_V(ShadowThread st) { Assert.panic("Bad"); return null; } protected static void ts_set_V(ShadowThread st, VectorClock V) { Assert.panic("Bad"); } protected void maxAndIncEpochAndCV(ShadowThread st, VectorClock other, OperationInfo info) { final int tid = st.getTid(); final VectorClock tV = ts_get_V(st); tV.max(other); tV.tick(tid); ts_set_E(st, tV.get(tid)); } protected void maxEpochAndCV(ShadowThread st, VectorClock other, OperationInfo info) { final int tid = st.getTid(); final VectorClock tV = ts_get_V(st); tV.max(other); ts_set_E(st, tV.get(tid)); } protected void incEpochAndCV(ShadowThread st, OperationInfo info) { final int tid = st.getTid(); final VectorClock tV = ts_get_V(st); tV.tick(tid); ts_set_E(st, tV.get(tid)); } static final Decoration<ShadowLock, FTLockState> lockVs = ShadowLock.makeDecoration( "FastTrack:ShadowLock", Type.MULTIPLE, new DefaultValue<ShadowLock, FTLockState>() { public FTLockState get(final ShadowLock lock) { return new FTLockState(lock, INIT_VECTOR_CLOCK_SIZE); } }); // only call when ld.peer() is held static final FTLockState getV(final ShadowLock ld) { return lockVs.get(ld); } static final Decoration<ShadowVolatile, FTVolatileState> volatileVs = ShadowVolatile .makeDecoration("FastTrack:shadowVolatile", Type.MULTIPLE, new DefaultValue<ShadowVolatile, FTVolatileState>() { public FTVolatileState get(final ShadowVolatile vol) { return new FTVolatileState(vol, INIT_VECTOR_CLOCK_SIZE); } }); // only call when we are in an event handler for the volatile field. protected static final FTVolatileState getV(final ShadowVolatile ld) { return volatileVs.get(ld); } @Override public ShadowVar makeShadowVar(final AccessEvent event) { if (event.getKind() == Kind.VOLATILE) { final ShadowThread st = event.getThread(); final VectorClock volV = getV(((VolatileAccessEvent) event).getShadowVolatile()); volV.max(ts_get_V(st)); return super.makeShadowVar(event); } else { return new FTVarState(event.isWrite(), ts_get_E(event.getThread())); } } @Override public void create(NewThreadEvent event) { final ShadowThread st = event.getThread(); if (ts_get_V(st) == null) { final int tid = st.getTid(); final VectorClock tV = new VectorClock(INIT_VECTOR_CLOCK_SIZE); ts_set_V(st, tV); synchronized (maxEpochPerTid) { final int/* epoch */ epoch = maxEpochPerTid.get(tid) + 1; tV.set(tid, epoch); ts_set_E(st, epoch); } incEpochAndCV(st, null); Util.log("Initial E for " + tid + ": " + Epoch.toString(ts_get_E(st))); } super.create(event); } @Override public void acquire(final AcquireEvent event) { final ShadowThread st = event.getThread(); final FTLockState lockV = getV(event.getLock()); maxEpochAndCV(st, lockV, event.getInfo()); super.acquire(event); if (COUNT_OPERATIONS) acquire.inc(st.getTid()); } @Override public void release(final ReleaseEvent event) { final ShadowThread st = event.getThread(); final VectorClock tV = ts_get_V(st); final VectorClock lockV = getV(event.getLock()); lockV.max(tV); incEpochAndCV(st, event.getInfo()); super.release(event); if (COUNT_OPERATIONS) release.inc(st.getTid()); } static FTVarState ts_get_badVarState(ShadowThread st) { Assert.panic("Bad"); return null; } static void ts_set_badVarState(ShadowThread st, FTVarState v) { Assert.panic("Bad"); } protected static ShadowVar getOriginalOrBad(ShadowVar original, ShadowThread st) { final FTVarState savedState = ts_get_badVarState(st); if (savedState != null) { ts_set_badVarState(st, null); return savedState; } else { return original; } } @Override public void access(final AccessEvent event) { SourceLocation sl = event.getAccessInfo().getLoc(); String key = sl.getKey(); int line = sl.getLine(); int offset = sl.getOffset(); MethodInfo methInfo = sl.getMethod(); String methName = methInfo.getName(); ClassInfo className = methInfo.getOwner(); String desc = methInfo.getDescriptor(); if(!racepairs.containsKey(key)) { super.access(event); return; } racepairType type = racepairs.get(key); final ShadowThread st = event.getThread(); final ShadowVar shadow = getOriginalOrBad(event.getOriginalShadow(), st); if (shadow instanceof FTVarState) { FTVarState sx = (FTVarState) shadow; if(type== racepairType.A) { sx.incAccessesByA(); boolean bailOut=false; int delay = sx.delayForA_lowerbound; while(!sx.accessedByB) { if(delay<=sx.delayForA_upperbound) { Assert.assertTrue(delay<=sx.delayForA_upperbound); try { Thread.sleep(1<<delay); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } else { bailOut=true; break; } delay++; } if(!bailOut) sx.accessedByB=false; // reset for new instance for A<->B } else { // racepairType.B Assert.assertTrue(type== racepairType.B); sx.accessedByB=true; } Object target = event.getTarget(); if (target == null) { ClassInfo owner = ((FieldAccessEvent) event).getInfo().getField().getOwner(); final VectorClock tV = ts_get_V(st); synchronized (classInitTime) { VectorClock initTime = classInitTime.get(owner); maxEpochAndCV(st, initTime, event.getAccessInfo()); // won't change current // epoch } } if (event.isWrite()) { write(event, st, sx); } else { read(event, st, sx); } } else { super.access(event); } } // Counters for relative frequencies of each rule private static final ThreadLocalCounter readSameEpoch = new ThreadLocalCounter("FT", "Read Same Epoch", RR.maxTidOption.get()); private static final ThreadLocalCounter readSharedSameEpoch = new ThreadLocalCounter("FT", "ReadShared Same Epoch", RR.maxTidOption.get()); private static final ThreadLocalCounter readExclusive = new ThreadLocalCounter("FT", "Read Exclusive", RR.maxTidOption.get()); private static final ThreadLocalCounter readShare = new ThreadLocalCounter("FT", "Read Share", RR.maxTidOption.get()); private static final ThreadLocalCounter readShared = new ThreadLocalCounter("FT", "Read Shared", RR.maxTidOption.get()); private static final ThreadLocalCounter writeReadError = new ThreadLocalCounter("FT", "Write-Read Error", RR.maxTidOption.get()); private static final ThreadLocalCounter writeSameEpoch = new ThreadLocalCounter("FT", "Write Same Epoch", RR.maxTidOption.get()); private static final ThreadLocalCounter writeExclusive = new ThreadLocalCounter("FT", "Write Exclusive", RR.maxTidOption.get()); private static final ThreadLocalCounter writeShared = new ThreadLocalCounter("FT", "Write Shared", RR.maxTidOption.get()); private static final ThreadLocalCounter writeWriteError = new ThreadLocalCounter("FT", "Write-Write Error", RR.maxTidOption.get()); private static final ThreadLocalCounter readWriteError = new ThreadLocalCounter("FT", "Read-Write Error", RR.maxTidOption.get()); private static final ThreadLocalCounter sharedWriteError = new ThreadLocalCounter("FT", "Shared-Write Error", RR.maxTidOption.get()); private static final ThreadLocalCounter acquire = new ThreadLocalCounter("FT", "Acquire", RR.maxTidOption.get()); private static final ThreadLocalCounter release = new ThreadLocalCounter("FT", "Release", RR.maxTidOption.get()); private static final ThreadLocalCounter fork = new ThreadLocalCounter("FT", "Fork", RR.maxTidOption.get()); private static final ThreadLocalCounter join = new ThreadLocalCounter("FT", "Join", RR.maxTidOption.get()); private static final ThreadLocalCounter barrier = new ThreadLocalCounter("FT", "Barrier", RR.maxTidOption.get()); private static final ThreadLocalCounter wait = new ThreadLocalCounter("FT", "Wait", RR.maxTidOption.get()); private static final ThreadLocalCounter vol = new ThreadLocalCounter("FT", "Volatile", RR.maxTidOption.get()); private static final ThreadLocalCounter other = new ThreadLocalCounter("FT", "Other", RR.maxTidOption.get()); static { AggregateCounter reads = new AggregateCounter("FT", "Total Reads", readSameEpoch, readSharedSameEpoch, readExclusive, readShare, readShared, writeReadError); AggregateCounter writes = new AggregateCounter("FT", "Total Writes", writeSameEpoch, writeExclusive, writeShared, writeWriteError, readWriteError, sharedWriteError); AggregateCounter accesses = new AggregateCounter("FT", "Total Access Ops", reads, writes); new AggregateCounter("FT", "Total Ops", accesses, acquire, release, fork, join, barrier, wait, vol, other); } protected void read(final AccessEvent event, final ShadowThread st, final FTVarState sx) { final int/* epoch */ e = ts_get_E(st); /* optional */ { final int/* epoch */ r = sx.R; if (r == e) { if (COUNT_OPERATIONS) readSameEpoch.inc(st.getTid()); sx.rSourceLocKey=event.getAccessInfo().getLoc().getKey(); return; } else if (r == Epoch.READ_SHARED && sx.get(st.getTid()) == e) { if (COUNT_OPERATIONS) readSharedSameEpoch.inc(st.getTid()); sx.rSourceLocKey=event.getAccessInfo().getLoc().getKey(); return; } } synchronized (sx) { final VectorClock tV = ts_get_V(st); final int/* epoch */ r = sx.R; final int/* epoch */ w = sx.W; final int wTid = Epoch.tid(w); final int tid = st.getTid(); if (wTid != tid && !Epoch.leq(w, tV.get(wTid))) { if (COUNT_OPERATIONS) writeReadError.inc(tid); error(event, sx, "Write-Read Race", "Write by ", wTid, "Read by ", tid); // best effort recovery: sx.rSourceLocKey=event.getAccessInfo().getLoc().getKey(); return; } if (r != Epoch.READ_SHARED) { final int rTid = Epoch.tid(r); if (rTid == tid || Epoch.leq(r, tV.get(rTid))) { if (COUNT_OPERATIONS) readExclusive.inc(tid); sx.R = e; } else { if (COUNT_OPERATIONS) readShare.inc(tid); int initSize = Math.max(Math.max(rTid, tid), INIT_VECTOR_CLOCK_SIZE); sx.makeCV(initSize); sx.set(rTid, r); sx.set(tid, e); sx.R = Epoch.READ_SHARED; } } else { if (COUNT_OPERATIONS) readShared.inc(tid); sx.set(tid, e); } sx.rSourceLocKey=event.getAccessInfo().getLoc().getKey(); } } // CS636: Commented the method to prevent inlining of the read barrier // public static boolean readFastPath(final ShadowVar shadow, final ShadowThread st) { // if (shadow instanceof FTVarState) { // final FTVarState sx = ((FTVarState) shadow); // final int/* epoch */ e = ts_get_E(st); // /* optional */ { // final int/* epoch */ r = sx.R; // if (r == e) { // if (COUNT_OPERATIONS) // readSameEpoch.inc(st.getTid()); // return true; // } else if (r == Epoch.READ_SHARED && sx.get(st.getTid()) == e) { // if (COUNT_OPERATIONS) // readSharedSameEpoch.inc(st.getTid()); // return true; // } // } // synchronized (sx) { // final int tid = st.getTid(); // final VectorClock tV = ts_get_V(st); // final int/* epoch */ r = sx.R; // final int/* epoch */ w = sx.W; // final int wTid = Epoch.tid(w); // if (wTid != tid && !Epoch.leq(w, tV.get(wTid))) { // ts_set_badVarState(st, sx); // return false; // } // if (r != Epoch.READ_SHARED) { // final int rTid = Epoch.tid(r); // if (rTid == tid || Epoch.leq(r, tV.get(rTid))) { // if (COUNT_OPERATIONS) // readExclusive.inc(tid); // sx.R = e; // } else { // if (COUNT_OPERATIONS) // readShare.inc(tid); // int initSize = Math.max(Math.max(rTid, tid), INIT_VECTOR_CLOCK_SIZE); // sx.makeCV(initSize); // sx.set(rTid, r); // sx.set(tid, e); // sx.R = Epoch.READ_SHARED; // } // } else { // if (COUNT_OPERATIONS) // readShared.inc(tid); // sx.set(tid, e); // } // return true; // } // } else { // return false; // } // } /***/ protected void write(final AccessEvent event, final ShadowThread st, final FTVarState sx) { final int/* epoch */ e = ts_get_E(st); /* optional */ { final int/* epoch */ w = sx.W; if (w == e) { if (COUNT_OPERATIONS) writeSameEpoch.inc(st.getTid()); sx.wSourceLocKey=event.getAccessInfo().getLoc().getKey(); return; } } synchronized (sx) { final int/* epoch */ w = sx.W; final int wTid = Epoch.tid(w); final int tid = st.getTid(); final VectorClock tV = ts_get_V(st); if (wTid != tid /* optimization */ && !Epoch.leq(w, tV.get(wTid))) { if (COUNT_OPERATIONS) writeWriteError.inc(tid); error(event, sx, "Write-Write Race", "Write by ", wTid, "Write by ", tid); } final int/* epoch */ r = sx.R; if (r != Epoch.READ_SHARED) { final int rTid = Epoch.tid(r); if (rTid != tid /* optimization */ && !Epoch.leq(r, tV.get(rTid))) { if (COUNT_OPERATIONS) readWriteError.inc(tid); error(event, sx, "Read-Write Race", "Read by ", rTid, "Write by ", tid); } else { if (COUNT_OPERATIONS) writeExclusive.inc(tid); } } else { if (sx.anyGt(tV)) { for (int prevReader = sx.nextGt(tV, 0); prevReader > -1; prevReader = sx .nextGt(tV, prevReader + 1)) { error(event, sx, "Read(Shared)-Write Race", "Read by ", prevReader, "Write by ", tid); } if (COUNT_OPERATIONS) sharedWriteError.inc(tid); } else { if (COUNT_OPERATIONS) writeShared.inc(tid); } } sx.W = e; sx.wSourceLocKey=event.getAccessInfo().getLoc().getKey(); } } // CS636: Commented the method to prevent inlining of the read barrier // only count events when returning true; // public static boolean writeFastPath(final ShadowVar shadow, final ShadowThread st) { // if (shadow instanceof FTVarState) { // final FTVarState sx = ((FTVarState) shadow); // final int/* epoch */ E = ts_get_E(st); // /* optional */ { // final int/* epoch */ w = sx.W; // if (w == E) { // if (COUNT_OPERATIONS) // writeSameEpoch.inc(st.getTid()); // return true; // } // } // synchronized (sx) { // final int tid = st.getTid(); // final int/* epoch */ w = sx.W; // final int wTid = Epoch.tid(w); // final VectorClock tV = ts_get_V(st); // if (wTid != tid && !Epoch.leq(w, tV.get(wTid))) { // ts_set_badVarState(st, sx); // return false; // } // final int/* epoch */ r = sx.R; // if (r != Epoch.READ_SHARED) { // final int rTid = Epoch.tid(r); // if (rTid != tid && !Epoch.leq(r, tV.get(rTid))) { // ts_set_badVarState(st, sx); // return false; // } // if (COUNT_OPERATIONS) // writeExclusive.inc(tid); // } else { // if (sx.anyGt(tV)) { // ts_set_badVarState(st, sx); // return false; // } // if (COUNT_OPERATIONS) // writeShared.inc(tid); // } // sx.W = E; // return true; // } // } else { // return false; // } // } /*****/ @Override public void volatileAccess(final VolatileAccessEvent event) { final ShadowThread st = event.getThread(); final VectorClock volV = getV((event).getShadowVolatile()); if (event.isWrite()) { final VectorClock tV = ts_get_V(st); volV.max(tV); incEpochAndCV(st, event.getAccessInfo()); } else { maxEpochAndCV(st, volV, event.getAccessInfo()); } super.volatileAccess(event); if (COUNT_OPERATIONS) vol.inc(st.getTid()); } // st forked su @Override public void preStart(final StartEvent event) { final ShadowThread st = event.getThread(); final ShadowThread su = event.getNewThread(); final VectorClock tV = ts_get_V(st); /* * Safe to access su.V, because u has not started yet. This will give us exclusive access to * it. There may be a race if two or more threads race are starting u, but of course, a * second attempt to start u will crash... RR guarantees that the forked thread will * synchronize with thread t before it does anything else. */ maxAndIncEpochAndCV(su, tV, event.getInfo()); incEpochAndCV(st, event.getInfo()); super.preStart(event); if (COUNT_OPERATIONS) fork.inc(st.getTid()); } @Override public void stop(ShadowThread st) { synchronized (maxEpochPerTid) { maxEpochPerTid.set(st.getTid(), ts_get_E(st)); } super.stop(st); if (COUNT_OPERATIONS) other.inc(st.getTid()); } // t joined on u @Override public void postJoin(final JoinEvent event) { final ShadowThread st = event.getThread(); final ShadowThread su = event.getJoiningThread(); // move our clock ahead. Safe to access su.V, as above, when // lock is held and u is not running. Also, RR guarantees // this thread has sync'd with u. maxEpochAndCV(st, ts_get_V(su), event.getInfo()); // no need to inc su's clock here -- that was just for // the proof in the original FastTrack rules. super.postJoin(event); if (COUNT_OPERATIONS) join.inc(st.getTid()); } @Override public void preWait(WaitEvent event) { final ShadowThread st = event.getThread(); final VectorClock lockV = getV(event.getLock()); lockV.max(ts_get_V(st)); // we hold lock, so no need to sync here... incEpochAndCV(st, event.getInfo()); super.preWait(event); if (COUNT_OPERATIONS) wait.inc(st.getTid()); } @Override public void postWait(WaitEvent event) { final ShadowThread st = event.getThread(); final VectorClock lockV = getV(event.getLock()); maxEpochAndCV(st, lockV, event.getInfo()); // we hold lock here super.postWait(event); if (COUNT_OPERATIONS) wait.inc(st.getTid()); } public static String toString(final ShadowThread td) { return String.format("[tid=%-2d C=%s E=%s]", td.getTid(), ts_get_V(td), Epoch.toString(ts_get_E(td))); } private final Decoration<ShadowThread, VectorClock> vectorClockForBarrierEntry = ShadowThread .makeDecoration("FT:barrier", Type.MULTIPLE, new NullDefault<ShadowThread, VectorClock>()); public void preDoBarrier(BarrierEvent<FTBarrierState> event) { final ShadowThread st = event.getThread(); final FTBarrierState barrierObj = event.getBarrier(); synchronized (barrierObj) { final VectorClock barrierV = barrierObj.enterBarrier(); barrierV.max(ts_get_V(st)); vectorClockForBarrierEntry.set(st, barrierV); } if (COUNT_OPERATIONS) barrier.inc(st.getTid()); } public void postDoBarrier(BarrierEvent<FTBarrierState> event) { final ShadowThread st = event.getThread(); final FTBarrierState barrierObj = event.getBarrier(); synchronized (barrierObj) { final VectorClock barrierV = vectorClockForBarrierEntry.get(st); barrierObj.stopUsingOldVectorClock(barrierV); maxAndIncEpochAndCV(st, barrierV, null); } if (COUNT_OPERATIONS) barrier.inc(st.getTid()); } /// @Override public void classInitialized(ClassInitializedEvent event) { final ShadowThread st = event.getThread(); final VectorClock tV = ts_get_V(st); synchronized (classInitTime) { VectorClock initTime = classInitTime.get(event.getRRClass()); initTime.copy(tV); } incEpochAndCV(st, null); super.classInitialized(event); if (COUNT_OPERATIONS) other.inc(st.getTid()); } @Override public void classAccessed(ClassAccessedEvent event) { final ShadowThread st = event.getThread(); synchronized (classInitTime) { final VectorClock initTime = classInitTime.get(event.getRRClass()); maxEpochAndCV(st, initTime, null); } if (COUNT_OPERATIONS) other.inc(st.getTid()); } @Override public void printXML(XMLWriter xml) { for (ShadowThread td : ShadowThread.getThreads()) { xml.print("thread", toString(td)); } } protected void error(final AccessEvent ae, final FTVarState x, final String description, final String prevOp, final int prevTid, final String curOp, final int curTid) { if (ae instanceof FieldAccessEvent) { fieldError((FieldAccessEvent) ae, x, description, prevOp, prevTid, curOp, curTid); } else { arrayError((ArrayAccessEvent) ae, x, description, prevOp, prevTid, curOp, curTid); } } protected void arrayError(final ArrayAccessEvent aae, final FTVarState sx, final String description, final String prevOp, final int prevTid, final String curOp, final int curTid) { final ShadowThread st = aae.getThread(); final Object target = aae.getTarget(); if (arrayErrors.stillLooking(aae.getInfo())) { arrayErrors.error(st, aae.getInfo(), "Alloc Site", ArrayAllocSiteTracker.get(target), "Shadow State", sx, "Current Thread", toString(st), "Array", Util.objectToIdentityString(target) + "[" + aae.getIndex() + "]", "Message", description, "Previous Op", prevOp + " " + ShadowThread.get(prevTid), "Currrent Op", curOp + " " + ShadowThread.get(curTid), "Stack", ShadowThread.stackDumpForErrorMessage(st)); } Assert.assertTrue(prevTid != curTid); aae.getArrayState().specialize(); if (!arrayErrors.stillLooking(aae.getInfo())) { advance(aae); } } protected void fieldError(final FieldAccessEvent fae, final FTVarState sx, final String description, final String prevOp, final int prevTid, final String curOp, final int curTid) { final FieldInfo fd = fae.getInfo().getField(); final ShadowThread st = fae.getThread(); final Object target = fae.getTarget(); Boolean is_AB_or_BA; String prevOpSourceLocKey,currOpSourceLocKey=fae.getAccessInfo().getLoc().getKey(); if(prevOp.contains("Read")) { prevOpSourceLocKey = sx.rSourceLocKey; is_AB_or_BA = !prevOpSourceLocKey.equals(currOpSourceLocKey); } else { Assert.assertTrue(prevOp.contains("Write")); prevOpSourceLocKey = sx.wSourceLocKey; is_AB_or_BA = !prevOpSourceLocKey.equals(currOpSourceLocKey); } if(is_AB_or_BA) sx.setDataRaceDetected(); if (fieldErrors.stillLooking(fd)) { if(is_AB_or_BA) { fieldErrors.error(st, fd, "Shadow State", sx, "Current Thread", toString(st), "Class", (target == null ? fd.getOwner() : target.getClass()), "Field", Util.objectToIdentityString(target) + "." + fd, "Message", description, "Previous Op", prevOp + " " + ShadowThread.get(prevTid), "prevOpSourceLocKey", prevOpSourceLocKey,"Currrent Op", curOp + " " + ShadowThread.get(curTid),"currOpSourceLocKey", currOpSourceLocKey, "Stack", ShadowThread.stackDumpForErrorMessage(st)); } } Assert.assertTrue(prevTid != curTid); if (!fieldErrors.stillLooking(fd)) { advance(fae); } } // --- PARSING INPUT FILE // void parseFile() { try { File myObj = new File(racepairsFilePath.get()); Scanner myReader = new Scanner(myObj); int pairNum=0; while (myReader.hasNextLine()) { String data = myReader.nextLine(); parseLine(data,++pairNum); } myReader.close(); } catch (FileNotFoundException e) { System.out.println("Error in reading file"); e.printStackTrace(); } } public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_RESET = "\u001B[0m"; void parseLine(String data,int pairNum) { String marker = "Pair"+pairNum+":"; if(data.length()<marker.length()) return; int a_s = data.indexOf(marker) + marker.length(); int b_s = data.indexOf(marker,a_s+1) + marker.length(); String a = data.substring(a_s,data.indexOf("?")); String b = data.substring(b_s); int a_e = getEndOfFileName(a); int b_e = getEndOfFileName(b); String A = a.substring(0,a_e)+".java"; String B = b.substring(0,b_e)+".java"; marker = ".java)"; a_s = a.indexOf(marker); b_s = b.indexOf(marker); A += a.substring(a_s+marker.length()); B += b.substring(b_s+marker.length()); A = A.trim(); B = B.trim(); if(A.equals(B)) { System.out.println(ANSI_RED + "[File Parser] ---> Ignoring Pair"+pairNum+" as it is of type A<->A. ONLY A<->B type pairs are supported"+ANSI_RESET); } else { racepairs.put(A, racepairType.A); racepairs.put(B, racepairType.B); } } int getEndOfFileName(String s) { int dot = s.indexOf("."); int $ = s.indexOf("$"); if(dot==-1) return $; if($==-1) return dot; return min(dot,$); } }
6ef93a09771eb32d574d26b4eb70a3e091f0fbab
ffc580697255600051a818ebe7c7f75855828444
/mall-mbg/src/main/java/cn/lzl/model/UmsRole.java
64e963eb3d5ccda70b6cf89274ba356309e5323a
[]
no_license
lzl-mall/mall
17f7ad7d274fd992257f592d5b5d512cf2cc3c37
af1722d88af118515dad2e47896f1ce435ad6edd
refs/heads/develop
2023-03-21T01:42:48.728919
2021-03-05T01:33:20
2021-03-05T01:33:20
307,944,547
0
0
null
2021-03-04T08:42:57
2020-10-28T07:58:30
Java
UTF-8
Java
false
false
2,376
java
package cn.lzl.model; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Date; public class UmsRole implements Serializable { private Long id; @ApiModelProperty(value = "名称") private String name; @ApiModelProperty(value = "描述") private String description; @ApiModelProperty(value = "后台用户数量") private Integer adminCount; @ApiModelProperty(value = "创建时间") private Date createTime; @ApiModelProperty(value = "启用状态:0->禁用;1->启用") private Integer status; private Integer sort; private static final long serialVersionUID = 1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Integer getAdminCount() { return adminCount; } public void setAdminCount(Integer adminCount) { this.adminCount = adminCount; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getSort() { return sort; } public void setSort(Integer sort) { this.sort = sort; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", name=").append(name); sb.append(", description=").append(description); sb.append(", adminCount=").append(adminCount); sb.append(", createTime=").append(createTime); sb.append(", status=").append(status); sb.append(", sort=").append(sort); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
9577e66d369ed2bf14d3bf737d2f4b26ed37021c
bc5327b256a7d538f76fa31196e6a4dc16b08f44
/src/com/repack/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java
a144e4de6b88ee690d26951a304cf02b44555aab
[]
no_license
w4lle/yikego
3123109abeaed2cc849afbf463684f2352664daf
11b5ac4e0aca94d2e86a4d7b6e91428e17b3c702
refs/heads/master
2020-12-25T20:08:28.683167
2014-11-14T08:40:08
2014-11-14T08:40:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,499
java
/* * Copyright (C) 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.repack.google.gson.internal.bind; import com.repack.google.gson.JsonSyntaxException; import com.repack.google.gson.internal.$Gson$Types; import com.repack.google.gson.internal.ConstructorConstructor; import com.repack.google.gson.internal.ObjectConstructor; import com.repack.google.gson.internal.Primitives; import com.repack.google.gson.reflect.TypeToken; import com.repack.google.gson.stream.JsonReader; import com.repack.google.gson.stream.JsonToken; import com.repack.google.gson.stream.JsonWriter; import java.io.IOException; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; /** * Type adapter that reflects over the fields and methods of a class. */ public class ReflectiveTypeAdapterFactory implements TypeAdapter.Factory { private final ConstructorConstructor constructorConstructor; public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor) { this.constructorConstructor = constructorConstructor; } protected boolean serializeField(Class<?> declaringClazz, Field f, Type declaredType) { return !f.isSynthetic(); } protected boolean deserializeField(Class<?> declaringClazz, Field f, Type declaredType) { return !f.isSynthetic(); } protected String getFieldName(Class<?> declaringClazz, Field f, Type declaredType) { return f.getName(); } public <T> TypeAdapter<T> create(MiniGson context, final TypeToken<T> type) { Class<? super T> raw = type.getRawType(); if (!Object.class.isAssignableFrom(raw)) { return null; // it's a primitive! } ObjectConstructor<T> constructor = constructorConstructor.getConstructor(type); return new Adapter<T>(constructor, getBoundFields(context, type, raw)); } private ReflectiveTypeAdapterFactory.BoundField createBoundField( final MiniGson context, final Field field, final String name, final TypeToken<?> fieldType, boolean serialize, boolean deserialize) { final boolean isPrimitive = Primitives.isPrimitive(fieldType.getRawType()); // special casing primitives here saves ~5% on Android... return new ReflectiveTypeAdapterFactory.BoundField(name, serialize, deserialize) { final TypeAdapter<?> typeAdapter = context.getAdapter(fieldType); @SuppressWarnings({"unchecked", "rawtypes"}) // the type adapter and field type always agree @Override void write(JsonWriter writer, Object value) throws IOException, IllegalAccessException { Object fieldValue = field.get(value); TypeAdapter t = new TypeAdapterRuntimeTypeWrapper(context, this.typeAdapter, fieldType.getType()); t.write(writer, fieldValue); } @Override void read(JsonReader reader, Object value) throws IOException, IllegalAccessException { Object fieldValue = typeAdapter.read(reader); if (fieldValue != null || !isPrimitive) { field.set(value, fieldValue); } } }; } private Map<String, BoundField> getBoundFields( MiniGson context, TypeToken<?> type, Class<?> raw) { Map<String, BoundField> result = new LinkedHashMap<String, BoundField>(); if (raw.isInterface()) { return result; } Type declaredType = type.getType(); while (raw != Object.class) { Field[] fields = raw.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (Field field : fields) { boolean serialize = serializeField(raw, field, declaredType); boolean deserialize = deserializeField(raw, field, declaredType); if (!serialize && !deserialize) { continue; } Type fieldType = $Gson$Types.resolve(type.getType(), raw, field.getGenericType()); BoundField boundField = createBoundField(context, field, getFieldName(raw, field, declaredType), TypeToken.get(fieldType), serialize, deserialize); BoundField previous = result.put(boundField.name, boundField); if (previous != null) { throw new IllegalArgumentException(declaredType + " declares multiple JSON fields named " + previous.name); } } type = TypeToken.get($Gson$Types.resolve(type.getType(), raw, raw.getGenericSuperclass())); raw = type.getRawType(); } return result; } static abstract class BoundField { final String name; final boolean serialized; final boolean deserialized; protected BoundField(String name, boolean serialized, boolean deserialized) { this.name = name; this.serialized = serialized; this.deserialized = deserialized; } abstract void write(JsonWriter writer, Object value) throws IOException, IllegalAccessException; abstract void read(JsonReader reader, Object value) throws IOException, IllegalAccessException; } public final class Adapter<T> extends TypeAdapter<T> { private final ObjectConstructor<T> constructor; private final Map<String, BoundField> boundFields; private Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) { this.constructor = constructor; this.boundFields = boundFields; } @Override public T read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { reader.nextNull(); return null; } T instance = constructor.construct(); // TODO: null out the other fields? try { reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); BoundField field = boundFields.get(name); if (field == null || !field.deserialized) { // TODO: define a better policy reader.skipValue(); } else { field.read(reader, instance); } } } catch (IllegalStateException e) { throw new JsonSyntaxException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } reader.endObject(); return instance; } @Override public void write(JsonWriter writer, T value) throws IOException { if (value == null) { writer.nullValue(); // TODO: better policy here? return; } writer.beginObject(); try { for (BoundField boundField : boundFields.values()) { if (boundField.serialized) { writer.name(boundField.name); boundField.write(writer, value); } } } catch (IllegalAccessException e) { throw new AssertionError(); } writer.endObject(); } } }
b2322809e725c01cd40462d56ffab82c52188495
19efc3e839aa2b83a10d932c4beaff57145393d9
/src/com/stas/JavsStart/home3_4/HomeworkTasksLoops/Task4FactorialCalculator.java
cc939406b2f2c131861ef8fc0727757e39e1027f
[]
no_license
stanislavzhe/Java-OOP
cd54cd2e616c4a7539cecaddef4b4dfb43bb11a7
0bb297d6f0ceafefca2e31ce3c7c713431692a6b
refs/heads/master
2020-12-03T06:30:34.957302
2017-08-05T09:35:22
2017-08-05T09:35:22
95,688,984
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.stas.JavsStart.home3_4.HomeworkTasksLoops; import java.util.Scanner; /** * Created by stanislavz on 10-Mar-17. */ public class Task4FactorialCalculator { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter value: "); int n = scanner.nextInt(); long factorial = 1; if (n >= 1 && n <= 20) { for (int i = 1; i <= n; i++) { factorial = factorial * i; } } if (n < 1 || n > 20) { throw new IllegalArgumentException("N must be in the range [1..20], but actually is " + n); } System.out.println("Factorial for " + n + " = " + factorial); } }
bf91cfcc86a5a5a69083d4531c52817e0d88c2cb
d2300995570ab5b90d9fa94adb58d06ee5ac0056
/cloud-eureka-server7001/src/main/java/org/lemon/springcloud/EurekaMain7001.java
71acac35f1766acbe4e822900d6c05f9a72d86cf
[]
no_license
lemon2014/mss
104fb4a9ad662d269a4d801d0dc10f026221b65c
7e0215d35b3d418d54958f2ee0b1f5817e087166
refs/heads/master
2022-12-30T08:39:06.121356
2020-10-17T11:43:24
2020-10-17T11:43:24
304,858,879
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package org.lemon.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class EurekaMain7001 { public static void main(String[] args) { SpringApplication.run(EurekaMain7001.class, args); } }
cb93ea010afcdb763c16a1a7303786bfa073c7e3
c1d82df68087fadb02772b008091337cd63ced8e
/app/src/main/java/com/technolab/galaxy/arcanoid/WinActivity.java
38d5bf3e3cc03d618fd7acc20ec98b5558a061f6
[]
no_license
Elikur/Arcanoid
f023915457579302731706142aa36f50f9274cd3
1d296f137713627224ad26f069d902f25a1c7a57
refs/heads/master
2021-01-25T00:37:28.930428
2017-06-18T11:03:07
2017-06-18T11:03:07
94,681,107
2
0
null
null
null
null
UTF-8
Java
false
false
1,333
java
package com.technolab.galaxy.arcanoid; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.TextView; public class WinActivity extends Activity implements View.OnClickListener { long score, bonus; @Override public void onCreate(Bundle instance) { super.onCreate(instance); getWindow().requestFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.win); score = getIntent().getLongExtra(Globals.KEY_SCORE, 0); bonus = getIntent().getLongExtra(Globals.KEY_BONUS, 0); ((TextView) findViewById(R.id.tvScore)).setText("Score: "+score); ((TextView) findViewById(R.id.tvBonus)).setText("Time Bonus: "+bonus); ((TextView) findViewById(R.id.tvTotalScore)).setText("Total Score: "+(score+bonus)); findViewById(R.id.bWNext).setOnClickListener(this); findViewById(R.id.bWReturn).setOnClickListener(this); } public void onClick(View v) { switch(v.getId()) { case R.id.bWNext: setResult(Globals.RESULT_NEXT); finish(); break; case R.id.bWReturn: setResult(Globals.RESULT_RETURN); finish(); break; } } }
1ad843f008e2ce809bd802bfa59ee52599a2d7b8
10a67debc497b389a0fc7812df3c6d6757057b14
/src/Question/leetcode/Q472.java
647ec5c5b3a5e839eeefa380b6e89bbb04f1d1e1
[]
no_license
JavaLearner576/JavaInterview
63558213ad5dbbf20f3d16edb765c9b1cf68da01
097363767f120cabd317953617a086f7faacedad
refs/heads/master
2021-01-19T22:44:08.490909
2018-03-21T06:01:31
2018-03-21T06:01:31
88,855,818
1
0
null
null
null
null
UTF-8
Java
false
false
1,474
java
package Question.leetcode; import java.util.*; /** * Created by gump on 2017/6/15. */ public class Q472 { public static void main(String argc[]){ Q472 q = new Q472(); String word[] = {"cat","cats","catsdogcats","dog","dogcatsdog","hippopotamuses","rat","ratcatdogcat"}; q.findAllConcatenatedWordsInADict(word); } public List<String> findAllConcatenatedWordsInADict(String[] words) { Arrays.sort(words, new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.length() - o2.length(); } }); Set<String> preWords = new HashSet<>(); List<String> result = new LinkedList<>(); for (int i = 0; i < words.length; i++) { if (canForm(words[i],preWords)){ result.add(words[i]); } preWords.add(words[i]); } return result; } private boolean canForm(String word, Set<String> preWords) { if (preWords.isEmpty()) return false; boolean dp[] = new boolean[word.length()+1]; dp[0] = true; for (int i = 1; i < dp.length; i++) { for (int j = 0; j < i; j++) { if (!dp[j]) continue; if (preWords.contains(word.substring(j,i))){ dp[i] = true; break; } } } return dp[word.length()]; } }