blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
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
listlengths
1
1
author_id
stringlengths
0
313
2fbe0604dbfaa5c629a16f61828e1aefb74812da
afca9576bab2f8f94d7d29ea791bca3d38f719f6
/goor-domain/src/main/java/cn/mrobot/bean/state/StateCollectorResponse.java
24878630d9c72bbe562cdf5f9618a6790992872a
[]
no_license
jtfeng/Goor-mrobot
581f9cb18b3ffde52e299cd95cf2ce2740bb31ab
ea92ad314edce35ed64b02eb05d1552b7e0a70e7
refs/heads/master
2020-03-07T13:53:57.262637
2017-09-25T10:35:09
2017-09-25T10:40:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
java
package cn.mrobot.bean.state; import java.util.Date; /** * Created by Jelynn on 2017/7/17. */ public class StateCollectorResponse { private String state; private int type; private String description; private String module; private Date time; private String senderId;//发送ID或机器序列号 public String getState() { return state; } public void setState(String state) { this.state = state; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getModule() { return module; } public void setModule(String module) { this.module = module; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public String getSenderId() { return senderId; } public void setSenderId(String senderId) { this.senderId = senderId; } }
[ "jelynn.tang@mrobot.cn" ]
jelynn.tang@mrobot.cn
713d8906972c15ac9cde255ce503cd73926b1c24
cb278cf79ecea691f5338bb044a657f158e9fe00
/src/main/java/com/aquafina/spring/dao/PersonDAOImpl.java
4333ebf1acff828864ab212f5bfdb65067b7b329
[]
no_license
sanjeeevp/Aquafina-SpringMvcHibernate
3d4ba02d641b60950a98f778db7e118b5be89918
15098a49f5ebec13aaf7f1daec853557f1b3506b
refs/heads/master
2020-02-26T15:40:44.627295
2016-10-16T14:28:48
2016-10-16T14:28:48
70,664,719
0
0
null
null
null
null
UTF-8
Java
false
false
1,803
java
package com.aquafina.spring.dao; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Repository; import com.aquafina.spring.model.Person; @Repository public class PersonDAOImpl implements PersonDAO { private static final Logger logger = LoggerFactory.getLogger(PersonDAOImpl.class); private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sf){ this.sessionFactory = sf; } @Override public void addPerson(Person p) { Session session = this.sessionFactory.getCurrentSession(); session.persist(p); logger.info("Person saved successfully, Person Details="+p); } @Override public void updatePerson(Person p) { Session session = this.sessionFactory.getCurrentSession(); session.update(p); logger.info("Person updated successfully, Person Details="+p); } @SuppressWarnings("unchecked") @Override public List<Person> listPersons() { Session session = this.sessionFactory.getCurrentSession(); List<Person> personsList = session.createQuery("from Person").list(); for(Person p : personsList){ logger.info("Person List::"+p); } return personsList; } @Override public Person getPersonById(int id) { Session session = this.sessionFactory.getCurrentSession(); Person p = (Person) session.load(Person.class, new Integer(id)); logger.info("Person loaded successfully, Person details="+p); return p; } @Override public void removePerson(int id) { Session session = this.sessionFactory.getCurrentSession(); Person p = (Person) session.load(Person.class, new Integer(id)); if(null != p){ session.delete(p); } logger.info("Person deleted successfully, person details="+p); } }
[ "poudelsanjeev@hotmail.com" ]
poudelsanjeev@hotmail.com
23ebb3a601f6639b849a937891d6c73ccfc83db2
1beb692fb6b35073b54d3bf16bb2ae8595147853
/src/rx/tx/RxTx.java
35bcfea93afcd73668cfe103609fc33d53529e3c
[]
no_license
bhanukarandeniya/GSR_value_reader
e55c60a0d963808ec82a2350d3c75d232894bb24
fc7a29cf83324f5b0503e0ae3e67ebbb99b26643
refs/heads/master
2021-01-10T22:53:06.756703
2016-10-08T16:26:26
2016-10-08T16:26:26
70,341,852
1
0
null
null
null
null
UTF-8
Java
false
false
6,081
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. */ //RxTx package rx.tx; /** * * @author Hasith */ import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; import gnu.io.SerialPortEvent; import gnu.io.SerialPortEventListener; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JLabel; public class RxTx implements SerialPortEventListener { PrintWriter writer; JLabel test; SerialPort serialPort; CommPortIdentifier portId; /** The port we're normally going to use. */ private static final String PORT_NAMES[] = new String[4]; /** * A BufferedReader which will be fed by a InputStreamReader * converting the bytes into characters * making the displayed results code page independent */ private BufferedReader input; private BufferedReader file_input; /** The output stream to the port */ private OutputStream output; private OutputStream file_output; /** Milliseconds to block while waiting for port open */ private static final int TIME_OUT = 2000; /** Default bits per second for COM port. */ private static final int DATA_RATE = 9600; public void initialize(JLabel ststus, String comport) { PORT_NAMES[0] = "/dev/tty.usbserial-A9007UX1"; PORT_NAMES[0] = "/dev/ttyACM0"; PORT_NAMES[0] = "/dev/ttyUSB0"; PORT_NAMES[0] = comport; // the next line is for Raspberry Pi and // gets us into the while loop and was suggested here was suggested http://www.raspberrypi.org/phpBB3/viewtopic.php?f=81&t=32186 //System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/ttyACM0"); this.portId = null; Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); //First, Find an instance of serial port as set in PORT_NAMES. while (portEnum.hasMoreElements()) { CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement(); for (String portName : PORT_NAMES) { if (currPortId.getName().equals(portName)) { portId = currPortId; break; } } } if (portId == null) { System.out.println("Could not find COM port."); ststus.setText("Could not find COM port."); return; } else { ststus.setText("Successfully connected to COM port."); } } public void start (JLabel myj){ try { // open serial port, and use class name for the appName. serialPort = (SerialPort) portId.open(this.getClass().getName(), TIME_OUT); // set port parameters serialPort.setSerialPortParams(DATA_RATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); // open the streams input = new BufferedReader(new InputStreamReader(serialPort.getInputStream())); output = serialPort.getOutputStream(); // add event listeners serialPort.addEventListener(this); serialPort.notifyOnDataAvailable(true); } catch (Exception e) { System.err.println(e.toString()); } test=myj; Thread t=new Thread() { public void run() { //the following line will keep this app alive for 1000 seconds, //waiting for events to occur and responding to them (printing incoming messages to console). try {Thread.sleep(1000000);} catch (InterruptedException ie) {} } }; t.start(); } /** * This should be called when you stop using the port. * This will prevent port locking on platforms like Linux. */ public synchronized void close(JLabel status) { if (serialPort != null) { serialPort.removeEventListener(); serialPort.close(); status.setText("COM port connection closed."); } } /** * Handle an event on the serial port. Read the data and print it. */ public synchronized void serialEvent(SerialPortEvent oEvent) { if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { String inputLine = this.input.readLine(); System.out.println(inputLine); this.writer.println(inputLine); this.test.setText(inputLine); } catch (Exception e) { System.err.println(e.toString()); } } // Ignore all the other eventTypes, but you should consider the other ones. } public void create_file(String f_name, String year, String status) throws FileNotFoundException { try { this.writer = new PrintWriter(f_name + "_" + year + "_" + status + ".csv", "UTF-8"); this.writer.println("GSR_Value"); } catch (UnsupportedEncodingException ex) { Logger.getLogger(RxTx.class.getName()).log(Level.SEVERE, null, ex); } } public void close_file() { this.writer.close(); } /* public static void main(String[] args) throws Exception { RxTx main = new RxTx(); main.initialize(); Thread t=new Thread() { public void run() { //the following line will keep this app alive for 1000 seconds, //waiting for events to occur and responding to them (printing incoming messages to console). try {Thread.sleep(1000000);} catch (InterruptedException ie) {} } }; t.start(); System.out.println("Started"); } */ }
[ "bhanukarandeniya@gmail.com" ]
bhanukarandeniya@gmail.com
797d068f6ed619049aed172138bfc2d6481187bd
51b846e3bc3d202ddbfcbe6400ae6d4103c25640
/authorization-server/ejb/src/main/java/io/hops/oauth2/authorization/server/ejb/ClientDetailsFacade.java
709307cf304443ca75052f28c4af6be9273fed11
[]
no_license
ErmiasG/OAuth2
d9b405e9dfe6a2e187e40c61f2c98d4efb89d94d
7aa8c188e10c2a11c4307abb725000504e076a85
refs/heads/master
2020-04-23T16:41:02.723229
2019-02-18T18:08:52
2019-02-18T18:08:52
171,305,975
0
0
null
null
null
null
UTF-8
Java
false
false
756
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 io.hops.oauth2.authorization.server.ejb; import io.hops.oauth2.authorization.server.entities.ClientDetails; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author ermias */ @Stateless public class ClientDetailsFacade extends AbstractFacade<ClientDetails> { @PersistenceContext(unitName = "oauth2_PU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public ClientDetailsFacade() { super(ClientDetails.class); } }
[ "ermiasg@kth.se" ]
ermiasg@kth.se
92f876645aa4f2f039ac65d0a08f58d330400c96
e72badcba279751a817191841b7f7ba5f83ebfab
/src/main/java/uk/co/mahfuz/springboot/api/PersonController.java
08ff9948df889dbd54115a7ccea9ea4ce63a15f9
[ "Apache-2.0" ]
permissive
mahfuzali/alicart-delivery
2baaf073259bc6ce2f27e5b105606d9850f0c33b
19b431d1854f156a051441e25ce11374545ec4f6
refs/heads/main
2023-01-09T10:04:44.778388
2020-11-14T17:43:18
2020-11-14T17:43:18
312,857,439
0
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
package uk.co.mahfuz.springboot.api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import uk.co.mahfuz.springboot.model.Person; import uk.co.mahfuz.springboot.service.PersonService; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.sql.ClientInfoStatus; import java.util.List; import java.util.UUID; @RequestMapping("api/v1/person") @RestController public class PersonController { private final PersonService personService; @Autowired public PersonController(PersonService personService) { this.personService = personService; } @PostMapping public void addPerson(@Valid @NotNull @RequestBody Person person) { personService.addPerson(person); } @GetMapping public List<Person> getAllPeople() { return personService.getAllPeople(); } @GetMapping(path = "{id}") public Person getPersonById(@PathVariable("id") UUID id) { return personService.getPersonId(id) .orElse(null); } @DeleteMapping(path = "{id}") public void deletePersonById(@PathVariable("id") UUID id) { personService.deletePerson(id); } @PutMapping(path = "{id}") public void updatePerson(@PathVariable("id") UUID id, @Valid @NotNull @RequestBody Person personToUpdate) { personService.updatePerson(id, personToUpdate); } }
[ "mahfuz.ali@hotmail.co.uk" ]
mahfuz.ali@hotmail.co.uk
75be13e7720fa9ba8d310884b959581b7b2bc5b3
6e776f6e18dd3fcc35e998bb5a52d8ce531ed0b4
/src/main/java/com/triplepi/projectile/repositories/UserRepository.java
3342a71f86309aed46c2106b1f16009333d9c321
[]
no_license
TriplePi/projectile_back
f94b03217492898b2e2134ab21f48bbfd34aeccd
64d02da51d1a9f895f3e860ea7c7b57fb129348b
refs/heads/master
2022-09-25T03:25:06.943262
2019-07-02T18:03:54
2019-07-02T18:03:54
194,614,916
0
0
null
2022-09-08T01:01:22
2019-07-01T06:42:58
Java
UTF-8
Java
false
false
237
java
package com.triplepi.projectile.repositories; import com.triplepi.projectile.models.domain.MesUser; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<MesUser, Long> { }
[ "ppopov@baccasoft.ru" ]
ppopov@baccasoft.ru
369d3ade73c498e2ec12ccb2127683cd713825ad
1bae40fd1fda289af318ac57804328411fdc3307
/Fractions/PizzaManager.java
f020f92cee2a6c5f73d8b23aa7fcde582a0e4ae3
[]
no_license
eek9/CSS-143
dd0533d3df72bc1713886523b502870f673e9a81
3efc4accb561eaf11205c8940f7dc064b93296d2
refs/heads/main
2023-02-18T22:04:18.334401
2021-01-20T00:54:43
2021-01-20T00:54:43
331,141,145
0
0
null
null
null
null
UTF-8
Java
false
false
9,739
java
import java.util.Scanner; /** * PizzaManager Skeleton File * CSS 162, Final Project * <p> * This class is a starting point for your final project and is incomplete. * Note that if there are any inconsistencies between this skeleton and * the assignment description, the assignment description controls. * <p> * Author: Rob Nash with edits by Johnny Lin */ public class PizzaManager { /* * TODO: Data definitions here. */ ArrayList<Pizza> pizzas = new ArrayList<>(); /** * The console interface is defined in the start method * You can exit or extend the code below to accomplish all of * the outcomes defined in the homework document */ public void start() { char selection = 'q'; Scanner foo = new Scanner(System.in); while (true) { displayAllPizzas(); displayInstructions(); selection = foo.next().charAt(0); //foo.nextChar() doesn't exist, so now what? switch (selection) { case 'A': case 'a': System.out.println("Adding a random pizza to the ArrayList<Pizza>."); //todo: addRandomPizza(); break; case 'H': case 'h': System.out.println("Adding one hundred random pizzas to the ArrayList<Pizza>."); //todo: for (int i = 0; i < 100; i++) { pizzas.insert(new Pizza(), pizzas.size() - 1); } break; case 'E': case 'e': System.out.println("Eating a fraction of a pizza. How much? (a/b)"); //todo:pizza eating code here eatSomePizza(foo); break; case 'P': case 'p': System.out.println("Sorting pizzas by (P)rice"); //todo: sortByPrice(); break; case 'S': case 's': System.out.println("Sorting pizzas by (S)ize"); //todo: sortBySize(); break; case 'C': case 'c': System.out.println("Sorting pizzas by (C)alories"); //todo sortByCalories(); break; case 'B': case 'b': System.out.println("(B)inary search over pizzas by calories(int). Sorting first. What calorie count are you looking for?"); //todo: int target = foo.nextInt(); System.out.println("Found calorie count at index: " + binarySearchByCalories(target)); break; case 'Q': case 'q': System.out.println("(Q)uitting!"); //todo: break; default: System.out.println("Unrecognized input - try again"); } } } /**this method will have the user to give an input in fraction form to subtract * from the initial amount of pizza in whatever index the user has directed * to * * @param keys the scanner where the user will give inputs */ private void eatSomePizza(Scanner keys) { //todo: boolean redo = false; while(!redo) { try { if (pizzas.isEmpty()) { throw new PizzaException("Pizza array is empty"); } else { System.out.println("What fraction of the pizza would you like to eat"); String fraction = keys.next(); System.out.println("From what index would you like to eat your pizza from"); int index = keys.nextInt(); Pizza p = pizzas.get(index); String[] eat = fraction.split("/"); int num = Integer.parseInt(eat[0]); int den = Integer.parseInt(eat[1]); p.eatSomePizza(new Fraction(num, den)); if (p.getRemainingArea() == 0) { pizzas.remove(index); } if(num<0 || den<=0) { throw new PizzaException(); } redo = true; } } catch(Exception e) { System.out.println("Invalid input - please try again"); } } } /**this method will add another pizza object into the arraylist * of objects * * @return nothing */ private void addRandomPizza() { //todo: pizzas.insert(new Pizza(), pizzas.size()); } /**this method will print out all the pizzas in the arraylist * * @return nothing */ private void displayAllPizzas() { //todo: for (int i = 0; i <= pizzas.size() - 1; i++) { System.out.println(pizzas.get(i).toString()); } } /**this method will use an insertion sort to organize the pizza arraylist * by price in increasing order * * @return nothing */ private void sortByPrice() { //todo: for (int i = 1; i < pizzas.size(); i++) { Pizza currMin = (Pizza) pizzas.get(i); int minIndex = i - 1; Pizza p = (Pizza) pizzas.get(minIndex); while (minIndex >= 0 && currMin.getTotalCost().compareTo(p.getTotalCost()) == -1) { pizzas.set(minIndex + 1, p); minIndex = minIndex - 1; try { p = (Pizza) pizzas.get(minIndex); } catch (Exception e) { //does nothing } } pizzas.set(minIndex + 1, currMin); } } /**this method will use a selection sort to organize the pizza arraylist * by size in increasing order of remaining area * * @return nothing */ private void sortBySize() { //todo: for (int i = 0; i < pizzas.size() - 1; i++) { int minIndex = i; for (int j = i + 1; j < pizzas.size(); j++) { Pizza currMin = (Pizza) pizzas.get(minIndex); if (currMin.compareToBySize(pizzas.get(j)) == 1) { minIndex = j; } } pizzas.swap(i, minIndex); } } /**this method will use a selection sort to organize the pizza arraylist by * the amount of calories in increasing order * * @return nothing */ private void sortByCalories() { //todo: for (int i = 0; i < pizzas.size() - 1; i++) { int minIndex = i; for (int j = i + 1; j < pizzas.size(); j++) { Pizza currMin = (Pizza) pizzas.get(minIndex); if (currMin.compareToByCalories(pizzas.get(j)) == 1) { minIndex = j; } } pizzas.swap(i, minIndex); } } /**this method will use a binary search to find the target calories in * the pizza arraylist and returns the index of where it is found * * @param cals the integer of amount of calories to find * @return int of the index where the amount of calories are found */ private int binarySearchByCalories(int cals) { //todo: sortByCalories(); Pizza search = new Pizza(); search.setCalories(cals); int searchIndex = 0; int lowIndex = 0; int highIndex = pizzas.size() - 1; //as long as the lowIndex is less than the highIndex value while (lowIndex <= highIndex) { //the midIndex is found by splitting the list into half from adding //the lowIndex and highIndex, then dividing by 2 int midIndex = (lowIndex + highIndex) / 2; //if the array of midIndex element is equal to the target, then it will return the //value of the midIndex Pizza temp = (Pizza) pizzas.get(midIndex); if (temp.getCalories() == cals) { searchIndex++; return midIndex; //if the target is greater than the array of the midIndex, //then the highIndex will shift down one } else if (temp.compareToByCalories(search) > 0) { searchIndex++; highIndex = midIndex - 1; //if the target is less than the array of the midIndex, //then the lowIndex will shift up one } else if (temp.compareToByCalories(search) < 0) { searchIndex++; lowIndex = midIndex + 1; } } return searchIndex; } /** * No need to edit functions below this line, unless extending the menu or * changing the instructions */ private static final String instructions = "-----------------------\nWelcome to PizzaManager\n-----------------------\n(A)dd a random pizza\nAdd a (H)undred random pizzas\n(E)at a fraction of a pizza\nSort pizzas by (P)rice\nSort pizzas by (S)ize\nSort pizzas by (C)alories\n(B)inary Search pizzas by calories\n(Q)uit\n"; /** * */ private void displayInstructions() { System.out.println(instructions); } /** * Notice the one-line main function. */ public static void main(String[] args) { new PizzaManager().start(); } }
[ "noreply@github.com" ]
eek9.noreply@github.com
3cb0b3935a822a568b3ee6c21fb29d97ff72093d
d99ca083a5ada7ff92e98b9a6a033551e08bb0fa
/src/main/java/common/RandomDataGenerator.java
e7743073329e846b2a714ecc087c4979b6d7225d
[]
no_license
appuaztec/Assignment01
0297b0b67750a56bfb28e841b5ff0f83ee9cc450
dcd4105d009c733b1da23238c766ebb91059b15e
refs/heads/master
2022-11-23T23:16:48.744371
2020-08-02T05:39:49
2020-08-02T05:39:49
282,663,496
0
1
null
null
null
null
UTF-8
Java
false
false
761
java
package common; import java.util.Random; public class RandomDataGenerator { public static int getRandomNum(int min, int max) { String res = null; Random random = new Random(); int ranNum = random.nextInt(max - min + 1) + min; return ranNum; } public static String getRandomWord(int length) { String alpha = "abcdefghijklmnopqrstuvwxyz"; String res = ""; Random random = new Random(); for (int i = 0; i < length; i++) { int ranNum = random.nextInt(alpha.length() - 1 + 1) + 1; res = res + alpha.charAt(ranNum); } return res; } public static void main(String[] args) { System.out.println(getRandomNum(11111, 99999)); } }
[ "appu.aztec@gmail.com" ]
appu.aztec@gmail.com
d45044317f3acf9d24151b517f087caea99824cd
f2cb4871f83dffe1a8b836c54c7eb98253acfd99
/proyectoUniversidad/src/modelo/Materia.java
b8eae8c6fddac5b630647760565a2487538487b3
[]
no_license
csaez30/fecha
f423d72a5be05729d544c7cc1f552ab4e7fc6e10
955dee9c97287a2cb7d9a51adfc7a325c9eda609
refs/heads/master
2023-08-16T18:26:53.147161
2023-07-26T21:12:41
2023-07-26T21:12:41
148,942,973
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
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 modelo; /** * * @author cris */ public class Materia { private int id; private String nombre; private String responsable; private String periodo; public Materia() { } public Materia(String nombre, String responsable, String periodo) { this.nombre = nombre; this.responsable = responsable; this.periodo = periodo; } public int getId() { return id; } public String getNombre() { return nombre; } public String getResponsable() { return responsable; } public String getPeriodo() { return periodo; } public void setId(int id) { this.id = id; } public void setNombre(String nombre) { this.nombre = nombre; } public void setResponsable(String responsable) { this.responsable = responsable; } public void setPeriodo(String periodo) { this.periodo = periodo; } @Override public String toString(){ return id+"-"+nombre; } }
[ "43256308+csaez30@users.noreply.github.com" ]
43256308+csaez30@users.noreply.github.com
6ff0a2d8bfe080747e9ecdc56e2b852e785c0ecf
8e187db79be1e6b5a5d6133c7fed9996445a89ca
/src/main/java/org/hathitrust/extractedfeatures/io/WebSocketResponse.java
02b062088daf2462cb9754fa87c489514f4d8543
[]
no_license
htrc/HTRC-Access-EF
99c1d4d327a94f04429037add36d75c5d42c1c26
cc15b3395fc342932f9177d8e6cd4e1c19b43f94
refs/heads/develop
2023-06-02T14:24:04.661850
2023-05-10T17:19:18
2023-05-10T17:19:18
88,185,729
1
0
null
2023-09-14T16:53:26
2017-04-13T16:37:53
Java
UTF-8
Java
false
false
9,178
java
package org.hathitrust.extractedfeatures.io; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.websocket.api.RemoteEndpoint; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeResponse; import org.json.JSONObject; public class WebSocketResponse implements FlexiResponse { protected Session ws_session_; protected RemoteEndpoint ws_endpoint_; protected String output_filename_ = null; protected File output_file_ = null; protected File generated_for_download_file_ = null; protected OutputStream os_ = null; protected OutputStreamWriter osw_ = null; protected static RsyncEFFileManager rsyncef_file_manager_ = null; public static void setJSONFileManager(RsyncEFFileManager rsyncef_file_manager) { rsyncef_file_manager_ = rsyncef_file_manager; } public WebSocketResponse(Session websocket_session) { ws_session_ = websocket_session; ws_endpoint_ = websocket_session.getRemote(); } public boolean isAsync() { return true; } public JSONObject generateOKMessageTemplate(String action) { JSONObject response_json = new JSONObject(); response_json.put("status",HttpServletResponse.SC_OK); response_json.put("action",action); return response_json; } protected JSONObject generateErrorMessageTemplate(int http_status_code, String message) { JSONObject response_json = new JSONObject(); response_json.put("status",http_status_code); response_json.put("action","error"); response_json.put("message",message); return response_json; } public void sendMessage(JSONObject response_json) { String response_json_str = response_json.toString(); try { ws_endpoint_.sendString(response_json_str); // java.io.IOException: Connection output is closed } catch (IOException e) { e.printStackTrace(); } } public void setContentType(String content_type) { JSONObject response_json = generateOKMessageTemplate("content-type"); response_json.put("content-type",content_type); sendMessage(response_json); } public void setCharacterEncoding(String encoding) { if (!encoding.toLowerCase().equals("utf-8")) { String mess ="Warning cannot set socket resonse stream to '"+encoding+"' => assuming UTF-8"; System.err.println("WebSocketReponse.setCharacterEncoding(): " + mess); } // But if we did want to find a way to support different char encodings, it might // go something like the following and/or rely on something like encodeURIComponent //JSONObject response_json = generateOKMessageTemplate("header"); //response_json.put("header-name","character-encoding"); //response_json.put("header-value",encoding); } public void setContentLength(int len) { JSONObject response_json = generateOKMessageTemplate("content-length"); response_json.put("length",len); sendMessage(response_json); } public void setHeader(String header_name, String header_value) { JSONObject response_json = generateOKMessageTemplate("header"); response_json.put("header-name",header_name); response_json.put("header-value",header_value); sendMessage(response_json); } public void setContentDispositionAttachment(String filename) { if (output_filename_ != null) { String mess = "Error: WebSocketResponse.setContentDispositionAttachment()"; if (os_ == null) { mess += " pre-existing file attachment already exists: " + output_filename_; } else { mess += " already streaming to output file: " + output_filename_; } System.err.println(mess); // pseudo sendError() JSONObject response_json = generateErrorMessageTemplate(HttpServletResponse.SC_BAD_REQUEST,mess); sendMessage(response_json); } else { output_filename_ = filename; setHeader("Content-Disposition","attachment; filename=\""+filename+"\""); } } public void sendProgress(int numer, int denom) { double percentage = 100 * numer / (double)denom; String percentage_formatted; if (denom<150) { // when number of items around 100, nicer to show integer rounded percentages percentage_formatted = String.format("%d", Math.round(percentage)); } else { percentage_formatted = String.format("%.2f", percentage); } String mess = "Thread: " + Thread.currentThread().getName() + ", progress " + percentage_formatted + "%"; JSONObject response_json = generateOKMessageTemplate("progress"); response_json.put("percentage",percentage); response_json.put("percentage-formatted",percentage_formatted); response_json.put("message",mess); sendMessage(response_json); } public void sendError(int http_status_code, String message) throws IOException { JSONObject response_json = generateErrorMessageTemplate(http_status_code,message); sendMessage(response_json); } public void sendRedirect(String location) throws IOException { String mess ="Redirect to location '" + location +" not currently implemented on the JS side"; System.err.println("WebSocketReponse.snedRedirect(): " + mess); JSONObject response_json = generateOKMessageTemplate("redirect"); response_json.put("location",location); sendMessage(response_json); } public void append(String text) { try { OutputStreamWriter osw = getOutputStreamWriter(); osw.append(text); } catch (IOException e) { e.printStackTrace(); } } /* Currently used in CollectionToWorksetAction, but not clear if flush() actually needed now */ public void flush() { if (osw_ != null) { try { // os_ is wrapped up inside osw_ System.err.println("WebSocketResponse.flush(): Flushing internal file OS stream writer"); osw_.flush(); } catch (IOException e) { e.printStackTrace(); } } else if (os_ != null) { try { System.err.println("WebSocketResponse.flush(): Flushing internal file OS stream"); os_.flush(); } catch (IOException e) { e.printStackTrace(); } } System.err.println("WebSocketResponse.flush(): Is it possible to flush socket stream? (not currently implemented)"); } public OutputStream getOutputStream() throws IOException { // **** As a result of this requirement, the file_manager is no longer // just about JSON files. Also, concerning the WebSocketResponse, this // doesn't even need to be about Zip files, so even the name of the // method isn't the best // => candidate for refactoring! if (os_ == null) { output_file_ = rsyncef_file_manager_.getForDownloadFile(output_filename_); os_ = new FileOutputStream(output_file_); } return os_; } protected OutputStreamWriter getOutputStreamWriter() throws IOException { if (osw_ == null) { OutputStream os = getOutputStream(); osw_ = new OutputStreamWriter(os,StandardCharsets.UTF_8); } return osw_; } synchronized public boolean isClosed() { return ws_session_ == null; } synchronized public void close() { if (osw_ != null) { // os_ is wrapped up inside osw_ try { System.err.println("WebSocketResponse.close(): closing internal file OS stream writer"); osw_.close(); } catch (IOException e) { e.printStackTrace(); } } else if (os_ != null) { try { System.err.println("WebSocketResponse.close(): closing internal file OS stream"); os_.close(); } catch (IOException e) { e.printStackTrace(); } } os_ = null; osw_ = null; // store the name of the file prepared for download for later use, // such as if it needs to delete it, if the preparation was exited early // by the user browsing to a different page generated_for_download_file_ = output_file_; output_filename_ = null; output_file_ = null; System.err.println("WebSocketResponse.close(): Closing WebSocket session"); ws_session_.close(); ws_session_ = null; } synchronized public void cleanupPartialForDownloadFile() { if (generated_for_download_file_ != null) { String full_output_filename_ = generated_for_download_file_.getAbsolutePath(); if (generated_for_download_file_.exists()) { boolean removed_file = generated_for_download_file_.delete(); if (!removed_file) { System.err.println("Error: failed to remove for-download file " + full_output_filename_ + " in WebSocketResponse::cleanupPartialForDownloadFile()"); } } generated_for_download_file_ = null; } else { System.err.println("Warning: specified file to delete in WebSocketResponse::cleanupPartialForDownloadFile() is null"); } } }
[ "davidb@waikato.ac.nz" ]
davidb@waikato.ac.nz
0266438299116a366af427b34cc130d93ce1e2e8
78371486f3136f75fb0e7fe2ebbef4c926cc2e14
/MaxOccurences/src/MaxOccurences.java
e92d2f12d1d18164394425ffaf9463f77a5283d4
[]
no_license
ananth08/codes
3e1d7f0f104a22a0c2dbf8d03122eeb83a279323
345ea89ca99a0c54cb7a629f717cda86b63a87f8
refs/heads/master
2021-01-12T04:00:13.601244
2017-01-14T17:24:26
2017-01-14T17:24:26
77,460,339
0
0
null
null
null
null
UTF-8
Java
false
false
1,553
java
import java.io.File; import java.util.*; /** * Created by ananthrkn on 12/27/16. */ public class MaxOccurences { Scanner input; HashMap<String,Integer> map; int max; Map.Entry pair; public MaxOccurences() { //constructor try { input = new Scanner(new File("/Users/ananthrkn/IdeaProjects/MaxOccurences/src/ananth.txt")); map = new HashMap<>(); max = 0; } catch (Exception e){ e.printStackTrace(); } } public void operation(){ while (input.hasNext()){ String content = input.next(); if(map.containsKey(content)){ int count = map.get(content); map.put(content, count + 1); } else{ map.put(content, 1); } } maximum(); } public void maximum() { Iterator i = map.entrySet().iterator(); while (i.hasNext()) { pair = (Map.Entry) i.next(); int count = (int) pair.getValue(); if (count > max) { max = count; } } Iterator j = map.entrySet().iterator(); while (j.hasNext()) { Map.Entry ele = (Map.Entry) j.next(); if(ele.getValue().equals(max)){ System.out.println(ele.getKey()+" "+ele.getValue()); } } } public static void main(String[] args){ MaxOccurences m = new MaxOccurences(); m.operation(); } }
[ "ananth@iastate.edu" ]
ananth@iastate.edu
086c6d0c7000c5e563308904d2be8929ba1bca72
7e3b21ad2cc887fe3af113431616c905fda97156
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/asynclayoutinflater/R.java
85b06dc6e8b6f779cbd996dad90c075de8f78931
[]
no_license
edmundphoon/CP3406-Assignment-2-Chemistry-Element-Hangman
6a661797dd5fabd8e27708d87b344c65ebc60abb
a4d41301c2a508df727b4c74a39cb009f0e37a7c
refs/heads/master
2022-12-26T00:08:29.979196
2020-09-29T12:27:15
2020-09-29T12:27:15
299,200,770
0
0
null
null
null
null
UTF-8
Java
false
false
10,466
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.asynclayoutinflater; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f02007a; public static final int fontProviderAuthority = 0x7f02007c; public static final int fontProviderCerts = 0x7f02007d; public static final int fontProviderFetchStrategy = 0x7f02007e; public static final int fontProviderFetchTimeout = 0x7f02007f; public static final int fontProviderPackage = 0x7f020080; public static final int fontProviderQuery = 0x7f020081; public static final int fontStyle = 0x7f020082; public static final int fontVariationSettings = 0x7f020083; public static final int fontWeight = 0x7f020084; public static final int ttcIndex = 0x7f02013c; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04003f; public static final int notification_icon_bg_color = 0x7f040040; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f060073; public static final int notification_bg = 0x7f060074; public static final int notification_bg_low = 0x7f060075; public static final int notification_bg_low_normal = 0x7f060076; public static final int notification_bg_low_pressed = 0x7f060077; public static final int notification_bg_normal = 0x7f060078; public static final int notification_bg_normal_pressed = 0x7f060079; public static final int notification_icon_background = 0x7f06007a; public static final int notification_template_icon_bg = 0x7f06007b; public static final int notification_template_icon_low_bg = 0x7f06007c; public static final int notification_tile_bg = 0x7f06007d; public static final int notify_panel_notification_icon_bg = 0x7f06007e; } public static final class id { private id() {} public static final int action_container = 0x7f07000d; public static final int action_divider = 0x7f07000f; public static final int action_image = 0x7f070010; public static final int action_text = 0x7f070016; public static final int actions = 0x7f070017; public static final int async = 0x7f07001e; public static final int blocking = 0x7f070021; public static final int chronometer = 0x7f070029; public static final int forever = 0x7f07003d; public static final int icon = 0x7f070045; public static final int icon_group = 0x7f070046; public static final int info = 0x7f07004a; public static final int italic = 0x7f07004f; public static final int line1 = 0x7f070051; public static final int line3 = 0x7f070052; public static final int normal = 0x7f07005b; public static final int notification_background = 0x7f07005c; public static final int notification_main_column = 0x7f07005d; public static final int notification_main_column_container = 0x7f07005e; public static final int right_icon = 0x7f070069; public static final int right_side = 0x7f07006a; public static final int tag_transition_group = 0x7f07008b; public static final int tag_unhandled_key_event_manager = 0x7f07008c; public static final int tag_unhandled_key_listeners = 0x7f07008d; public static final int text = 0x7f07008e; public static final int text2 = 0x7f07008f; public static final int time = 0x7f070093; public static final int title = 0x7f070094; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { private layout() {} public static final int notification_action = 0x7f090020; public static final int notification_action_tombstone = 0x7f090021; public static final int notification_template_custom_big = 0x7f090022; public static final int notification_template_icon_group = 0x7f090023; public static final int notification_template_part_chronometer = 0x7f090024; public static final int notification_template_part_time = 0x7f090025; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0d002e; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0e00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e0158; public static final int Widget_Compat_NotificationActionText = 0x7f0e0159; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "noreply@github.com" ]
edmundphoon.noreply@github.com
309034577b9c33f606a6074a66dd3cb69eb36668
3106834e30c398fa99c2dd37e1d3949a46720585
/src/main/java/ps2/p1/dao/TimesDao.java
a8dfd05beb867d258361e15d8f7c4a12ae8aa2c0
[]
no_license
julianogomess/codigocrudsimples
16b06e3af29b7bb0fe3cc38cf3c425c161b25c7f
f6f682eb373c7d92ef9b5c0fef8399e0b859e1b4
refs/heads/main
2023-05-06T19:35:06.188430
2021-06-03T18:36:12
2021-06-03T18:36:12
373,606,327
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package ps2.p1.dao; import java.util.List; import org.jdbi.v3.sqlobject.config.RegisterBeanMapper; import org.jdbi.v3.sqlobject.customizer.BindBean; import org.jdbi.v3.sqlobject.statement.GetGeneratedKeys; import org.jdbi.v3.sqlobject.statement.SqlQuery; import org.jdbi.v3.sqlobject.statement.SqlUpdate; public interface TimesDao { @SqlUpdate("CREATE TABLE times(" + " id BIGINT NOT NULL" + " GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1),"+ " nome VARCHAR(255) NOT NULL,"+ " mascote VARCHAR(255) NOT NULL,"+ " treinador VARCHAR(100) NOT NULL,"+ " qtd BIGINT NOT NULL,"+ " PRIMARY KEY(id)"+ ")") void createTable(); @SqlUpdate("DROP TABLE times") void dropTable(); @SqlUpdate("INSERT INTO times(nome, mascote, treinador, qtd) VALUES (?, ?, ?, ?)") @GetGeneratedKeys("id") long create(String nome,String mascote, String treinador, long qtd); @SqlQuery("SELECT * FROM times") @RegisterBeanMapper(Time.class) List<Time> read(); @SqlQuery("SELECT * FROM times WHERE id=?") @RegisterBeanMapper(Time.class) Time readById(long id); @SqlUpdate("UPDATE times SET nome=:nome, mascote=:mascote, treinador=:treinador, qtd=:qtd WHERE id=:id") void update(@BindBean Time t); @SqlUpdate("DELETE FROM times WHERE id =?") void delete(long id); }
[ "Juhgomes_sousa@hotmail.com" ]
Juhgomes_sousa@hotmail.com
f6cdfc118e5c3ef116a859f35077a26f0cf9f0b0
91590139b3575e542e64d2b06d9f7d82439ad327
/WebServiceOperacionesClient/src/com/webservice/client/package-info.java
972d217b245cbc2e8064d542b6b239ced7722984
[]
no_license
jambrocio/JbossWSClient
dbb91c2ddc28d96739ff150c415251ddcd79dd6d
cc30d28364b856a462f131b49896eab6ecec639c
refs/heads/master
2020-06-07T18:14:42.632681
2014-04-20T23:26:37
2014-04-20T23:26:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://webservice.com/") package com.webservice.client;
[ "jc.ambrocio.sernaque@gmail.com" ]
jc.ambrocio.sernaque@gmail.com
e70dad399e02f0374a3802e411ff6c884f2d0870
dba8d16700640055c7dc06021dd02972f9807e62
/src/com/app/model/DiffHad.java
4ad72d88a809bb71f722c352ee026541949a2701
[]
no_license
chlam54/Hplus
14430b320fc26f69e452e368540372d18f4e2402
6d964b9df63f3444d0990aaa44235122c5be6072
refs/heads/master
2020-03-27T05:50:30.933303
2019-01-01T08:38:14
2019-01-01T08:38:14
144,443,907
0
0
null
null
null
null
UTF-8
Java
false
false
1,899
java
package com.app.model; import java.sql.Timestamp; import com.app.util.MathUtil; public class DiffHad { private String id; private String bookmaker; private Timestamp oddsTime; private Float oddsHome, oddsAway, oddsDraw; public DiffHad() {} public DiffHad(String id, String bookmaker, Timestamp oddsTime, Float oddsHome, Float oddsAway, Float oddsDraw) { super(); this.id = id; this.bookmaker = bookmaker; this.oddsTime = oddsTime; this.oddsHome = oddsHome; this.oddsAway = oddsAway; this.oddsDraw = oddsDraw; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getBookmaker() { return bookmaker; } public void setBookmaker(String bookmaker) { this.bookmaker = bookmaker; } public Timestamp getOddsTime() { return oddsTime; } public void setOddsTime(Timestamp oddsTime) { this.oddsTime = oddsTime; } public Float getOddsHome() { return oddsHome; } public void setOddsHome(Float oddsHome) { this.oddsHome = oddsHome; } public Float getOddsAway() { return oddsAway; } public void setOddsAway(Float oddsAway) { this.oddsAway = oddsAway; } public Float getOddsDraw() { return oddsDraw; } public void setOddsDraw(Float oddsDraw) { this.oddsDraw = oddsDraw; } @Override public String toString() { return "DiffHad [id=" + id + ", bookmaker=" + bookmaker + ", oddsTime=" + oddsTime + ", oddsHome=" + oddsHome + ", oddsAway=" + oddsAway + ", oddsDraw=" + oddsDraw + "]"; } @Override public boolean equals(Object obj) { DiffHad od = (DiffHad)obj; boolean isSame = od.getId().equals(this.id) && od.getBookmaker().equals(this.bookmaker) && MathUtil.compareFloat(od.getOddsAway(), this.oddsAway)==0 && MathUtil.compareFloat(od.getOddsHome(), this.oddsHome)==0 && MathUtil.compareFloat(od.getOddsDraw(), this.oddsDraw)==0; return isSame; } }
[ "lamchiho2012@icloud.com" ]
lamchiho2012@icloud.com
ffe1b9a567d20dc65aeabea0b5599b3d5f8d2eb4
580bb9001ffb2add38e7ce9ada54875ac8eeb3fd
/src/com/company/Main.java
3f3315e4947cdd4ff434c02d61bd1e3507ebe965
[]
no_license
apontej22/Operators
e06d4ac29ae13a88b929f3b078c061ce6f93f443
a59953e56119aba9d4a956836242808f58056c27
refs/heads/master
2021-06-24T23:48:46.162862
2017-09-10T17:49:26
2017-09-10T17:49:26
103,049,481
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package com.company; public class Main { public static void main(String[] args) { // write your code int a = 23; int b = 5; float result1 = a/b ; float remainder = a % b; System.out.println("Assignment Operators" ); System.out.println("a = 23" ); System.out.println("b = 5" ); System.out.println("\nAddition: a + b = " + (a + b) ); System.out.println("Subtraction: a - b = " + (a - b) ); System.out.println("Multiplication: a * b = " + (a * b) ); System.out.println("Division: a / b = " + result1 ); System.out.println("Remainder: a % b = " + remainder); } }
[ "japonte@students.mchenry.edu" ]
japonte@students.mchenry.edu
3de131b9602a019795f279fbe59d215d83e092b8
f89f802831b81c16a7076427d5779a1efbf6f1c4
/app/src/main/java/file/project/diagnosaanak/penyakit/p53.java
177f648941d9e473fd4e777721c1bd39ace7ede3
[]
no_license
ztd-creator/DiagnosaAnak
b9a3a78e15d20c1275efc9438dae52834e07c55b
b1a3635a1bb1ae80346072859b625c0cd90db002
refs/heads/master
2020-06-04T05:39:42.567987
2019-06-25T17:00:31
2019-06-25T17:00:31
191,735,574
0
0
null
null
null
null
UTF-8
Java
false
false
8,072
java
package file.project.diagnosaanak.penyakit; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Html; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.TextView; import com.example.diagnosaanak.R; public class p53 extends AppCompatActivity { Animation animShow, animHide,animFadeOut; Button mulai,ya,tdk; String posisi; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_p53); posisi=null; animFadeOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.textout); animShow = AnimationUtils.loadAnimation( this, R.anim.show); animHide = AnimationUtils.loadAnimation( this, R.anim.hide); final TextView p53 = findViewById(R.id.diagnosaMulai); ya = findViewById(R.id.btn_yaa); tdk = findViewById(R.id.btn_tidakk); mulai = findViewById(R.id.btn_mulai); mulai.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mulai.startAnimation( animFadeOut ); findViewById(R.id.cardviewDiagnosa).startAnimation(animShow); mulai.setVisibility(View.GONE); findViewById(R.id.cardviewDiagnosa).setVisibility(View.VISIBLE); p53.setText("Adakah salah satu gejala pubertas berikut:" + "1. pembesaran penis dan testis" + "2. tumbuhnya bulu kemaluan" + "3. suara memberat" + "4. sering ereksi"); } }); ya.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (posisi == null) { p53.setText("Apakah usianya dibawah 9 tahun?"); posisi = "dl1"; } else if(posisi.equals("dl1")){ String sourceString = "<b>" + "Kemungkinan Penyebab" + "</b> " + "Pubertas bisa mulai terlalu dini pada anak-anak. Seringkali hal ini tanpa penyebab jelas, namun pada beberapa kasus ini bisa disebabkan oleh masalah di pusat kendali produksi hormone di otak. Konsultasikan ke dokter." + "<b>" + "Tindakan "+ "</b>"+ "Dokter akan memeriksa si anak dan mungkin meminta si anak menjalani tes darah untuk memeriksa tingkat hormonnya. Bila perlu dokter juga akan merujuk si anak ke seorang spesialis. Bila pubertas sudah dimulai, bisa diresepkan beberapa obat hormon untuk "; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} else if(posisi.equals("dll1")){ String sourceString = "<b>" + "KEMUNGKINAN PENYEBAB DAN TINDAKAN Si anak sudah menunjukkan gejala awal pubertas. Walau lebih lambat dari normal, hal ini tidak perlu dicemaskan. Ia akan terus tumbuh, dan pubertas baru akan selesai dalam 5 tahun berikutnya. Selamat si anak tampak sehat dan terus tumbuh, agaknya tidak perlu memeriksakannya ke dokter."; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} else if(posisi.equals("d2")) { p53.setText("Apakah si anak mengidap sakit menahun seperti sistik fibrosis atau arthritis?"); posisi = "dl2"; } else if(posisi.equals("dl2")){ String sourceString = "<b>" + "KEMUNGKINAN PENYEBAB DAN TINDAKAN Beberapa sakit menahun bisa menunda sementara mulainya pubertas. Tanyakan kecemasan anda ini pada dokter yang biasa menangani si anak."; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} else if(posisi.equals("dll2")){ String sourceString = "<b>" + "Kemungkinan Penyebab" + "</b> " + "Kerusakan di testis karena penyakit atau pengobatan di masa lalu bisa mengurangi produksi hormone pria yang diperlukan agar pubertas berlangsung. Periksakanlah ke dokter." + "<b>" + "Tindakan "+ "</b>"+ "Dokter akan memeriksa si anak dan mungkin meminta hasil tes darah untuk mengukur tingkat hormone. Bila perlu, dokter akan merujuknya ke spesialis."; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} } }); tdk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(posisi==null||posisi.equals("d1")){ p53.setText("apakah usianya 15 tahun atau lebih?"); posisi="d2"; } else if(posisi.equals("d2")){ String sourceString = "<b>" + "Periksalah Ke Dokter"; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} else if(posisi.equals("dl1")) { p53.setText("Apakah usianya 15 tahun atau lebih?"); posisi = "dll1"; } else if(posisi.equals("dll1")){ String sourceString = "<b>" + "KEMUNGKINAN PENYEBAB DAN TINDAKAN Pada anak lelaki, ini wajar karena gejala pertama pubertas akan terjadi di antara usia 9-15 tahun. Bila si anak mencemaskan tubuhnya lebih pendek daripada teman-temannya, yakinkan dia bahwa tubuhnya akan segera meninggi. Lonjakan laju pertumbuhan remajanya biasanya mulai di pertengahan sampai akhir pubertas."; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} else if(posisi.equals("dl2")) { p53.setText("Pernahkah si anak menjalani khemoterapi atau radioterapi, atau pernahkah ia menjalani pembedahan di testis?"); posisi = "dll2"; } else if(posisi.equals("dll2")){ String sourceString = "<b>" + "Kemungkinan Penyebab" + "</b> " + "Timbulnya pubertas anak anda tertunda. Walau biasanya tanpa sebab jelas, hal ini biasanya diturunkan dan lebih umum dialami anak yang bertubuh pendek. Kebanyakan pubertas dimulai di usia 16 tahun tanpa perawatan. Konsultasikan ke dokter." + "<b>" + "Tindakan "+ "</b>"+ "Dokter akan memeriksa si anak dan mungkin meminta hasil tes darah untuk mengukur tingkat hormon. Bila perlu, dokter akan merujuk si anak ke spesialis untuk menjalani penanganan hormone."; p53.setText(Html.fromHtml(sourceString)); ya.startAnimation( animFadeOut ); tdk.startAnimation( animFadeOut ); ya.setVisibility(View.GONE); tdk.setVisibility(View.GONE);} } }); } }
[ "fadhlanmuhh@gmail.com" ]
fadhlanmuhh@gmail.com
d5ae4e4f9c1262b4c036e7c13d21c58e9a5902e5
fd2aa6ef1ce68b42b357d5380ca26d7c636dbb78
/src/com/digiarea/closure/model/zippy/ZippyClosureSerializer.java
4502289493ffbe3c2da7a8e0ff88040d619d97de
[ "Apache-2.0", "CC-BY-3.0" ]
permissive
DigiArea/closurefx-builder
d718b4a2371e0df7f7ae743ff8005cae66cbc291
33c26671f2deb3fdcc6833338a8b1019489448cf
refs/heads/master
2021-01-20T04:29:59.726134
2015-02-15T17:06:33
2015-02-15T17:06:33
15,201,897
3
0
null
null
null
null
UTF-8
Java
false
false
1,414
java
package com.digiarea.closure.model.zippy; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import com.digiarea.closure.model.Closure; import com.digiarea.closurefx.IClosureSerializer; import com.digiarea.zippy.ZippyBuffer; import com.google.common.io.ByteStreams; import com.google.common.io.Files; public class ZippyClosureSerializer implements IClosureSerializer { public Closure read(String path) throws Exception { if (path != null) { File file = new File(path); if (file.exists()) { byte[] buffer = Files.toByteArray(file); ZippyBuffer reader = new ZippyBuffer(buffer); Closure closure = Closure.readClosure(reader); return closure; } } return null; } public Closure read(InputStream stream) throws Exception { byte[] buffer = ByteStreams.toByteArray(stream); ZippyBuffer reader = new ZippyBuffer(buffer); Closure closure = Closure.readClosure(reader); return closure; } public void write(Closure closure, String path) throws Exception { File file = new File(path); if (!file.exists()) { file.createNewFile(); } int size = closure.sizeOfClosure(false); byte[] buffer = new byte[size]; ZippyBuffer reader = new ZippyBuffer(buffer); closure.writeClosure(reader, false); FileOutputStream os = new FileOutputStream(file); os.write(buffer); os.close(); } }
[ "sandra@digi-area.com" ]
sandra@digi-area.com
4a5f6db660c2f092bd47aa1e0cf8f4f64814e43f
8a375787be6de9326a1564f7a453e554a0031245
/Carga de Datos Dinamica/src/com/julian/controlador/ServletController.java
82faf2c331e25b3ff841d7992768ed62b283e575
[]
no_license
Juliku-git/Carga-de-datos-dinamica
683b6f58c5951a54bb3bd77c1e0ac8019ad73f49
5ee67297607ab207ca7e5451d902e7f399a57536
refs/heads/master
2022-06-05T04:22:39.904497
2018-10-25T15:09:14
2018-10-25T15:09:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,304
java
package com.julian.controlador; import java.io.IOException; import javax.servlet.RequestDispatcher; 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 com.julian.modelo.Persona; /** * Servlet implementation class ServletController */ @WebServlet("/ServletController") public class ServletController extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public ServletController() { } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher rd = request.getRequestDispatcher("Resultado.jsp"); Persona people = new Persona(); String dni = request.getParameter("dni"); String nombre = request.getParameter("nombre"); String apellido = request.getParameter("apellido"); people.setDni(dni); people.setNombre(nombre); people.setApellido(apellido); request.setAttribute("people", people); rd.forward(request, response); } }
[ "noreply@github.com" ]
Juliku-git.noreply@github.com
14f6c66adc3e8085f826c889e10a3ce05a35cc5b
71508e4876b3622725de0d265eb2741f9ac4d7da
/src/main/java/com/calculator/rpn/operations/CalculatorOperation.java
567de54839cd4ab064f46d07a635abd3895806e0
[]
no_license
jverma719/rpncalculator
cce73bc9c449613b1335738bc923b60ea4f2ea25
fcb7d7db4b3cc1ab8dcf517f53368b96a0fc67b1
refs/heads/master
2020-04-17T00:03:54.986392
2019-01-16T12:38:58
2019-01-16T12:38:58
166,036,007
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.calculator.rpn.operations; import com.calculator.rpn.RPNCalculator; import com.calculator.rpn.exceptions.InsufficientParametersException; public interface CalculatorOperation { void performOperation(RPNCalculator calculator) throws InsufficientParametersException; }
[ "jyoti.verma7@gmail.com" ]
jyoti.verma7@gmail.com
9f0b5f12f88548c4f78837b3c6a3a51269503739
a4c77936792a7a858f3d2efe72c181d132b50d25
/wpattern-frameworks-resteasy/src/main/java/br/com/wpattern/frameworks/resteasy/utils/beans/ResponseBean.java
41f348b05191bbef73f7e4416fbd8106ecb5b880
[]
no_license
nubiofs/wpattern-frameworks-resteasy-angularjs
017e2bc66d2a4f4db0c6cfaefbe01a667828e932
54a127092143d5003a3c8fadb84ec9e09fe4a310
refs/heads/master
2020-12-24T14:44:54.272840
2015-11-09T15:02:59
2015-11-09T15:02:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package br.com.wpattern.frameworks.resteasy.utils.beans; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class ResponseBean extends BaseBean { private static final long serialVersionUID = 1L; private int result; public ResponseBean() { } public ResponseBean(int result) { this.result = result; } public int getResult() { return this.result; } public void setResult(int result) { this.result = result; } }
[ "augustobranquinho@gmail.com" ]
augustobranquinho@gmail.com
9bd5c8d29b1d9dee5074fc32d0736315ceeead42
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/globalNamespace/namespaces/Hamcrest/namespaces/Arrays/classes/SeriesMatchingOnce.java
1b152083535fdd1bdc30c4dfcfed9e7f2458d45e
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
7,561
java
package com.project.convertedCode.globalNamespace.namespaces.Hamcrest.namespaces.Arrays.classes; import com.runtimeconverter.runtime.passByReference.PassByReferenceArgs; import com.runtimeconverter.runtime.classes.StaticBaseClass; import com.runtimeconverter.runtime.nativeFunctions.array.function_array_shift; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.runtimeconverter.runtime.ZVal; import com.runtimeconverter.runtime.reflection.ReflectionClassData; import com.runtimeconverter.runtime.annotations.ConvertedParameter; import com.runtimeconverter.runtime.arrays.ZPair; import java.lang.invoke.MethodHandles; import com.runtimeconverter.runtime.nativeFunctions.array.function_array_keys; import com.runtimeconverter.runtime.classes.NoConstructor; import com.runtimeconverter.runtime.nativeFunctions.array.function_current; import com.runtimeconverter.runtime.annotations.ConvertedMethod; import static com.runtimeconverter.runtime.ZVal.toStringR; import static com.runtimeconverter.runtime.ZVal.assignParameter; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php */ public class SeriesMatchingOnce extends RuntimeClassBase { public Object _elementMatchers = null; public Object _keys = null; public Object _mismatchDescription = null; public Object _nextMatchKey = null; public SeriesMatchingOnce(RuntimeEnv env, Object... args) { super(env); if (this.getClass() == SeriesMatchingOnce.class) { this.__construct(env, args); } } public SeriesMatchingOnce(NoConstructor n) { super(n); } @ConvertedMethod @ConvertedParameter(index = 0, name = "elementMatchers", typeHint = "array") @ConvertedParameter(index = 1, name = "mismatchDescription", typeHint = "Hamcrest\\Description") public Object __construct(RuntimeEnv env, Object... args) { Object elementMatchers = assignParameter(args, 0, false); Object mismatchDescription = assignParameter(args, 1, false); this._elementMatchers = elementMatchers; this._keys = function_array_keys.f.env(env).call(elementMatchers).value(); this._mismatchDescription = mismatchDescription; return null; } @ConvertedMethod @ConvertedParameter(index = 0, name = "item") public Object matches(RuntimeEnv env, Object... args) { Object item = assignParameter(args, 0, false); return ZVal.assign( ZVal.toBool(this._isNotSurplus(env, item)) && ZVal.toBool(this._isMatched(env, item))); } @ConvertedMethod public Object isFinished(RuntimeEnv env, Object... args) { Object nextMatcher = null; if (!ZVal.isEmpty(this._elementMatchers)) { nextMatcher = function_current.f.env(env).call(this._elementMatchers).value(); env.callMethod( env.callMethod( this._mismatchDescription, "appendText", SeriesMatchingOnce.class, "No item matched: "), "appendDescriptionOf", SeriesMatchingOnce.class, nextMatcher); return ZVal.assign(false); } return ZVal.assign(true); } @ConvertedMethod @ConvertedParameter(index = 0, name = "item") private Object _isNotSurplus(RuntimeEnv env, Object... args) { Object item = assignParameter(args, 0, false); if (ZVal.isEmpty(this._elementMatchers)) { env.callMethod( env.callMethod( this._mismatchDescription, "appendText", SeriesMatchingOnce.class, "Not matched: "), "appendValue", SeriesMatchingOnce.class, item); return ZVal.assign(false); } return ZVal.assign(true); } @ConvertedMethod @ConvertedParameter(index = 0, name = "item") private Object _isMatched(RuntimeEnv env, Object... args) { Object item = assignParameter(args, 0, false); Object nextMatcher = null; this._nextMatchKey = function_array_shift.f.env(env).call(this._keys).value(); nextMatcher = function_array_shift.f.env(env).call(this._elementMatchers).value(); if (!ZVal.isTrue(env.callMethod(nextMatcher, "matches", SeriesMatchingOnce.class, item))) { this._describeMismatch(env, nextMatcher, item); return ZVal.assign(false); } return ZVal.assign(true); } @ConvertedMethod @ConvertedParameter(index = 0, name = "matcher", typeHint = "Hamcrest\\Matcher") @ConvertedParameter(index = 1, name = "item") private Object _describeMismatch(RuntimeEnv env, Object... args) { Object matcher = assignParameter(args, 0, false); Object item = assignParameter(args, 1, false); env.callMethod( this._mismatchDescription, "appendText", SeriesMatchingOnce.class, "item with key " + toStringR(this._nextMatchKey, env) + ": "); env.callMethod( matcher, "describeMismatch", SeriesMatchingOnce.class, item, this._mismatchDescription); return null; } public static final Object CONST_class = "Hamcrest\\Arrays\\SeriesMatchingOnce"; // Runtime Converter Internals // RuntimeStaticCompanion contains static methods // RequestStaticProperties contains static (per-request) properties // ReflectionClassData contains php reflection data used by the runtime library public static class RuntimeStaticCompanion extends StaticBaseClass { private static final MethodHandles.Lookup staticCompanionLookup = MethodHandles.lookup(); } public static final RuntimeStaticCompanion runtimeStaticObject = new RuntimeStaticCompanion(); private static final ReflectionClassData runtimeConverterReflectionData = ReflectionClassData.builder() .setName("Hamcrest\\Arrays\\SeriesMatchingOnce") .setLookup( SeriesMatchingOnce.class, MethodHandles.lookup(), RuntimeStaticCompanion.staticCompanionLookup) .setLocalProperties( "_elementMatchers", "_keys", "_mismatchDescription", "_nextMatchKey") .setFilename( "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php") .get(); @Override public ReflectionClassData getRuntimeConverterReflectionData() { return runtimeConverterReflectionData; } @Override public Object converterRuntimeCallExtended( RuntimeEnv env, String method, Class<?> caller, PassByReferenceArgs passByReferenceArgs, Object... args) { return RuntimeClassBase.converterRuntimeCallExtendedWithDataStatic( this, runtimeConverterReflectionData, env, method, caller, passByReferenceArgs, args); } }
[ "git@runtimeconverter.com" ]
git@runtimeconverter.com
d2f794cef36f686e61ac385da4a227611ad1b0d4
a8f6bef6a69a94cfea06d972b887c791158896cd
/app/src/main/java/com/example/martin/ptbt/SpeedTestActivity.java
59d80e915c021045ce2024991a18bd8d1b696ef2
[]
no_license
Martinsbl/ptbt
3dcc2de8d4943afc20b442f48224bd4c5dc29bea
1a8751f761bbaf96bb87a2aded5e8243f88eac78
refs/heads/master
2021-01-20T18:02:45.846786
2017-06-19T18:13:41
2017-06-19T18:13:41
90,898,982
0
0
null
null
null
null
UTF-8
Java
false
false
14,615
java
package com.example.martin.ptbt; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.os.SystemClock; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.RadioButton; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import java.util.Locale; /** * Created by Martin on 10.05.2017. */ public class SpeedTestActivity extends AppCompatActivity { private static final String TAG = "SpeedTestActivity"; public static final String EXTRA_DEVICE_ADDRESS = "com.example.mabo.myapplication.EXTRA_DEVICE_ADDRESS"; private TextView txtDeviceFw, txtDeviceHw, txtThroughput, txtToolbarBtnRight, txtToolbarBtnLeft; Intent intentGattClientService; private GattClientService mGattClientService; private String bleDeviceAddress; boolean mGattClientServiceIsBound = false; private boolean testInProgress = false; private long testProgressTime; private long testStartTime; private long lastNotificationTime; private long testTimeSinceLastNotification; private int receivedBytes = 0; public static Intent createLaunchIntent(Context context, String deviceAddress) { Intent intentSpeedTestActivity = new Intent(context, SpeedTestActivity.class); intentSpeedTestActivity.putExtra(EXTRA_DEVICE_ADDRESS, deviceAddress); return intentSpeedTestActivity; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_speed_test); startGattClientService(); createGui(); } private void startGattClientService() { LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, makeGattUpdateIntentFilter()); Log.i(TAG, "startGattClientService: START CLIENT SERVICE"); Intent i = getIntent(); bleDeviceAddress = i.getStringExtra(EXTRA_DEVICE_ADDRESS); intentGattClientService = new Intent(this, GattClientService.class); intentGattClientService.putExtra(EXTRA_DEVICE_ADDRESS, bleDeviceAddress); if (!bindService(intentGattClientService, serviceConnectionCallback, Context.BIND_AUTO_CREATE)) { Log.i(TAG, "startGattClientService: BINDING UNSUCCESSFUL"); } } private IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(GattClientService.ACTION_GATT_CONNECTED); intentFilter.addAction(GattClientService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(GattClientService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(GattClientService.ACTION_NOT_SUPPORTED); intentFilter.addAction(GattClientService.ACTION_GATT_ON_CHARACTERISTIC_READ); intentFilter.addAction(GattClientService.ACTION_GATT_DIS_CHAR_FW_READ); intentFilter.addAction(GattClientService.ACTION_GATT_DIS_CHAR_HW_READ); intentFilter.addAction(GattClientService.ACTION_GATT_DIS_CHAR_MANUF_NAME_READ); intentFilter.addAction(GattClientService.ACTION_GATT_DIS_CHAR_MODEL_NUMBER_READ); intentFilter.addAction(GattClientService.ACTION_GATT_DIS_CHAR_SYSTEM_ID_READ); intentFilter.addAction(GattClientService.ACTION_GATT_SPAM_CHAR_NOTIFY); intentFilter.addAction(GattClientService.ACTION_GATT_SPAM_CHAR_START_TEST); intentFilter.addAction(GattClientService.ACTION_GATT_SPAM_CHAR_END_TEST); return intentFilter; } private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); final byte[] rawBytes = intent.getByteArrayExtra(GattClientService.EXTRA_DATA); switch (action) { case GattClientService.ACTION_GATT_CONNECTED: Toast.makeText(context, "Connected", Toast.LENGTH_SHORT).show(); break; case GattClientService.ACTION_GATT_DISCONNECTED: stopGattClientService(); finish(); break; case GattClientService.ACTION_GATT_SERVICES_DISCOVERED: mGattClientService.readDeviceInformation(); mGattClientService.enableNotification(NrfSpeedUUIDs.SPEED_SERVICE_UUID, NrfSpeedUUIDs.UUID_CHAR_SPAM); break; case GattClientService.ACTION_GATT_ON_CHARACTERISTIC_READ: break; case GattClientService.ACTION_GATT_DIS_CHAR_MODEL_NUMBER_READ: // FW ID characteristic not yet implemented in Fw ACTION_GATT_DIS_CHAR_FW_READ: final String firmware = "Firmware: " + byteArrayToString(rawBytes); runOnUiThread(new Runnable() { @Override public void run() { txtDeviceFw.setText(firmware); } }); break; case GattClientService.ACTION_GATT_DIS_CHAR_SYSTEM_ID_READ: // HW ID characteristic not yet implemented in Fw ACTION_GATT_DIS_CHAR_HW_READ: final String hardware = "Sys ID: " + byteArrayToString(rawBytes); runOnUiThread(new Runnable() { @Override public void run() { txtDeviceHw.setText(hardware); } }); break; case GattClientService.ACTION_GATT_SPAM_CHAR_START_TEST: // TODO Start timer testInProgress = true; testStartTime = SystemClock.uptimeMillis(); lastNotificationTime = SystemClock.uptimeMillis(); testTimeSinceLastNotification = 0; receivedBytes += rawBytes.length; runOnUiThread(new Runnable() { @Override public void run() { String string = String.format(Locale.ENGLISH, "%d Bytes", receivedBytes); txtThroughput.setText(string); } }); break; case GattClientService.ACTION_GATT_SPAM_CHAR_NOTIFY: // Test in progress testProgressTime += SystemClock.uptimeMillis() - testStartTime; testTimeSinceLastNotification = SystemClock.uptimeMillis() - lastNotificationTime; receivedBytes += rawBytes.length; final float intermittent_kbps = 8 * (float) rawBytes.length / (float) testTimeSinceLastNotification; runOnUiThread(new Runnable() { @Override public void run() { String string = String.format(Locale.ENGLISH, "%d Bytes Time: %s, TP: %.01f kbps", receivedBytes, testProgressTime, intermittent_kbps); txtThroughput.setText(string); } }); lastNotificationTime = SystemClock.uptimeMillis(); break; case GattClientService.ACTION_GATT_SPAM_CHAR_END_TEST: // TODO Stop timer testProgressTime = SystemClock.uptimeMillis() - testStartTime; receivedBytes += rawBytes.length; final float kbps = 8 * (float) receivedBytes / (float) testProgressTime; runOnUiThread(new Runnable() { @Override public void run() { String string = String.format(Locale.ENGLISH, "%d Bytes, Time: %s ms, TP: %.01f kbps", receivedBytes, testProgressTime, kbps); txtThroughput.setText(string); } }); // Reset and prepare for next test testInProgress = false; receivedBytes = 0; testProgressTime = 0; testTimeSinceLastNotification = 0; testStartTime = 0; break; default: break; } } }; private String byteArrayToString(byte[] byteArray) { try { return new String(byteArray, "UTF-8"); } catch (Exception e) { Log.e(TAG, "broadcastReceiver: " + e.toString()); return "Failed to convert string"; } } private ServiceConnection serviceConnectionCallback = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { GattClientService.LocalBinder binder = (GattClientService.LocalBinder) service; mGattClientService = binder.getService(); mGattClientServiceIsBound = true; Log.i(TAG, "onServiceConnected: Component name: " + name.toString()); } @Override public void onServiceDisconnected(ComponentName name) { // Not called on unbinds. Log.i(TAG, "onServiceDisconnected: Component name: " + name.toString()); mGattClientServiceIsBound = false; } }; private void createGui() { txtToolbarBtnRight = (TextView) findViewById(R.id.txtControlButtonRight); txtToolbarBtnRight.setText(getResources().getString(R.string.start_test)); txtToolbarBtnLeft = (TextView) findViewById(R.id.txtControlButtonLeft); txtToolbarBtnLeft.setText(getResources().getString(R.string.disconnect)); txtDeviceFw = (TextView) findViewById(R.id.txtSpeedDeviceFw); txtDeviceHw = (TextView) findViewById(R.id.txtSpeedDeviceHw); txtThroughput = (TextView) findViewById(R.id.txtThroughput); } public void onToolbarBtnClick(View view) { switch (view.getId()) { case R.id.txtControlButtonRight: if (!testInProgress) { mGattClientService.startSpeedTest(true); txtToolbarBtnRight.setText(getResources().getString(R.string.stop_test)); } else { // TODO Implement stop test function } break; case R.id.txtControlButtonLeft: stopGattClientService(); finish(); break; } } public void onRadioMtuClick(View view) { boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()) { case R.id.radioMtu23: if (checked) { mGattClientService.updateMtu(23); } break; case R.id.radioMtu128: if (checked) { mGattClientService.updateMtu(128); } break; case R.id.radioMtu247: if (checked) { mGattClientService.updateMtu(247); } break; default: break; } } public void onRadioCiClick(View view) { boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()) { case R.id.radioCiHigh: if (checked) { mGattClientService.updateConnInterval(8); } break; case R.id.radioCiMedium: if (checked) { mGattClientService.updateConnInterval(24); // 24 = 30ms } break; case R.id.radioCi400: if (checked) { mGattClientService.updateConnInterval(320); } break; default: break; } } public void onRadioPhyClick(View view) { boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()) { case R.id.radioPhy1Mbps: if (checked) { mGattClientService.updatePhy(NrfSpeedDevice.BLE_GAP_PHY_1MBPS); } break; case R.id.radioPhy2Mbps: if (checked) { mGattClientService.updatePhy(NrfSpeedDevice.BLE_GAP_PHY_2MBPS); } break; default: break; } } public void onSwitchCleClick(View view) { boolean checked = ((Switch) view).isChecked(); if (checked) { mGattClientService.enableConnEvtLengthExtension(true); } else { mGattClientService.enableConnEvtLengthExtension(false); } } public void onSwitchDleClick(View view) { boolean checked = ((Switch) view).isChecked(); if (checked) { mGattClientService.enableDataLengthExtension(true); } else { mGattClientService.enableDataLengthExtension(false); } } /** * This will unbind and close the Gatt Client Service. BLE will be * closed on service's onDestroy(). */ private void stopGattClientService() { // Disconnect BLE and close service if service is active. if (mGattClientServiceIsBound) { if (mGattClientService.isConnected()) { mGattClientService.getGatt().disconnect(); } unbindService(serviceConnectionCallback); mGattClientServiceIsBound = false; stopService(intentGattClientService); } // Close Broadcast Receiver try { LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver); } catch (Exception ignore) { Log.e(TAG, ignore.toString()); } mGattClientService = null; } @Override protected void onDestroy() { super.onDestroy(); } @Override protected void onStop() { stopGattClientService(); super.onStop(); } }
[ "martinsbl@gmail.com" ]
martinsbl@gmail.com
44720c1de27ae717a577a23b70b5a808c329a91e
1f38d9ab457be196d54be359bca1af38b4bdbec1
/task-service/src/main/java/com/github/shaart/elk/task/dto/v1/TaskDto.java
5fb2a9273d8763f3e8b6008b589d900065f95308
[]
no_license
shaart/elk-demo
744753d706c2f0ead2c38b1b1c34e0a6cc42e886
54223a50498aead9826de60207250e615ef38389
refs/heads/master
2022-12-17T23:15:34.816703
2020-09-14T18:53:04
2020-09-14T18:53:04
297,755,494
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package com.github.shaart.elk.task.dto.v1; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @Data @Builder @AllArgsConstructor public class TaskDto { @JsonProperty("message") private String message; }
[ "imshaart@gmail.com" ]
imshaart@gmail.com
c03f52ca0887f7c988e99601e4449e204013214b
d0c5d6628f73c8fe98c5944a184e6f80976b40f8
/clienta/src/main/java/com/example/clienta/controller/RedirectController.java
efd71946990a76349f392974a52af79c595a90e7
[]
no_license
chenbu-nj/cloud
25012898c2774bdeb9756e7d9a892cc6fc8ecfb5
a2ef16ae5cf97d24bb693ee8ee0e7471591d10c9
refs/heads/master
2023-04-14T20:50:28.131495
2021-04-26T09:29:09
2021-04-26T09:29:09
359,366,133
0
0
null
null
null
null
UTF-8
Java
false
false
2,719
java
package com.example.clienta.controller; import com.example.clienta.Vo.ApiResult; import com.example.clienta.service.GetTransIdService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import java.util.UUID; @RefreshScope @RestController @Api(tags = "测试业务")//controller在swagger中的中文名称 public class RedirectController { @Autowired private GetTransIdService getTransIdService; @Value("${server.port}") String port; @Value("${test.flag}") String flag; @ApiOperation(value = "直接获取业务流水号", httpMethod = "GET")//方法中文名称 // @ApiImplicitParam(name = "name", value = "姓名", dataType = "string")//参数(值-中文名称-数据类型) @GetMapping(value = "straightGetTransId") @ResponseBody public String straightGetTransId(){ return "服务A:" + port + "接口:" + UUID.randomUUID().toString() + ",标识:" + flag; } @ApiOperation(value = "间接获取业务流水号", httpMethod = "GET")//方法中文名称 @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "姓名", dataType = "string"), @ApiImplicitParam(name = "msg", value = "要传递的信息", dataType = "string") })//参数(值-中文名称-数据类型) @GetMapping(value = "redirectGetTransId") @ResponseBody public String redirectGetTransId( @RequestParam(value = "name",required = false) String name, @RequestParam(value = "msg",required = false) String msg){ String serialno = ""; ApiResult apiResult = getTransIdService.getTransId(name); if(apiResult != null && apiResult.getStatus() == HttpStatus.SC_OK){ serialno = String.valueOf(apiResult.getData()); } return "服务A调用:" + serialno + ",传递的信息是:" + msg; } @ApiOperation(value = "CLIENTSERVICE测试方法", httpMethod = "GET")//方法中文名称 @GetMapping(value = "getClientAService") @ResponseBody public String getClientAService(){ return "端口为" + port + ",返回的结果"; } }
[ "xueshize_nj@163.com" ]
xueshize_nj@163.com
2f52311d0e1e966e8a0b68ee6da19bee6bc20d69
07379bd9955490b474ca17d8c7a8e6f1b0b01fde
/faceye-kindle-manager/src/main/java/com/faceye/component/book/repository/mongo/gen/BookTagGenRepository.java
a32eedb9eb270465e1090183371918a5688c6661
[]
no_license
haipenge/faceye-kindle
a0251ce56255f895e40acba38fb3317357b076df
8a3f011ab4e4b18478968c9a85741a7a863a8247
refs/heads/master
2020-04-06T04:54:02.296989
2018-09-13T03:17:43
2018-09-13T03:17:43
73,881,563
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.faceye.component.book.repository.mongo.gen; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.querydsl.QuerydslPredicateExecutor; import com.faceye.component.book.entity.BookTag; import com.faceye.feature.repository.mongo.BaseMongoRepository; /** * 模块:电子书->com.faceye.compoent.book.repository.mongo<br> * 说明:<br> * 实体:标签->com.faceye.component.book.entity.entity.BookTag 实体DAO<br> * @author haipenge <br> * 联系:haipenge@gmail.com<br> * 创建日期:2016-8-2 11:06:39<br> */ public interface BookTagGenRepository extends BaseMongoRepository<BookTag,Long> { }/**@generate-repository-source@**/
[ "haipenge@gmail.com" ]
haipenge@gmail.com
d53475539e600a4e10c82d690a969dba93cd1e18
10c333ff623781257e93c0f284cbad382761c2ea
/wechat-manage/wechat-manage-pojo/src/main/java/com/wechat/manage/pojo/wechat/entity/MemberCard.java
5c2e37cbeabb869ac35ec19731c9e214c47e9c94
[]
no_license
wangzhiwen12/baseProject
592a279e44de82a76a57631669b3ba6d43165479
5dcb48b8f3208abb6fbd1e6ebf8ebce2c2172f5f
refs/heads/master
2021-05-03T11:41:46.832436
2018-02-07T02:12:19
2018-02-07T02:12:19
120,551,040
0
0
null
null
null
null
UTF-8
Java
false
false
2,487
java
package com.wechat.manage.pojo.wechat.entity; import java.util.Date; public class MemberCard { private Long sid; private String storeCode; private String cardCode; private String memberCode; private Integer cardType; private Integer cardLevel; private Integer status; private Integer delFlag; private Date updateTime; private Date createTime; public Long getSid() { return sid; } public void setSid(Long sid) { this.sid = sid; } public String getStoreCode() { return storeCode; } public void setStoreCode(String storeCode) { this.storeCode = storeCode; } public String getCardCode() { return cardCode; } public void setCardCode(String cardCode) { this.cardCode = cardCode; } public String getMemberCode() { return memberCode; } public void setMemberCode(String memberCode) { this.memberCode = memberCode; } public Integer getCardType() { return cardType; } public void setCardType(Integer cardType) { this.cardType = cardType; } public Integer getCardLevel() { return cardLevel; } public void setCardLevel(Integer cardLevel) { this.cardLevel = cardLevel; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getDelFlag() { return delFlag; } public void setDelFlag(Integer delFlag) { this.delFlag = delFlag; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @Override public String toString() { return "MemberCard{" + "sid=" + sid + ", storeCode='" + storeCode + '\'' + ", cardCode='" + cardCode + '\'' + ", memberCode='" + memberCode + '\'' + ", cardType=" + cardType + ", cardLevel=" + cardLevel + ", status=" + status + ", delFlag=" + delFlag + ", updateTime=" + updateTime + ", createTime=" + createTime + '}'; } }
[ "kongqingfu@wangfujing.com" ]
kongqingfu@wangfujing.com
e5835c80b2fe4f788fd703faa4ae1aa2c597a6be
183357f25707e70fe0b3286a39935d7881f605b1
/app/src/main/java/com/gmail/tarekmabdallah91/bakingapp/adapters/step_descriptons_adapter/StepsViewHolder.java
9f9ba144c8a2b29d458b7550f7abba7b856e65ba
[ "Apache-2.0" ]
permissive
tarekmabdallah91/BakingApp
328a729852910aab3a63a44e58413c3eb08dccfe
4216bf4b4115cbf84abd77dfadfbfde07430fde9
refs/heads/master
2020-08-14T07:25:52.177341
2018-10-12T16:47:07
2018-10-12T16:47:07
149,869,451
0
0
null
null
null
null
UTF-8
Java
false
false
3,015
java
/* Copyright 2018 tarekmabdallah91@gmail.com 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.gmail.tarekmabdallah91.bakingapp.adapters.step_descriptons_adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.Gravity; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.gmail.tarekmabdallah91.bakingapp.R; import com.gmail.tarekmabdallah91.bakingapp.models.ParentInExpendableRecyclerView; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import static android.view.View.GONE; import static com.gmail.tarekmabdallah91.bakingapp.utils.BakingConstants.ZERO; public class StepsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @BindView(R.id.child_items_layout) LinearLayout childItemsLayout; @BindView(R.id.parent_name_tv) TextView parentName; StepsViewHolder(View itemView, List<ParentInExpendableRecyclerView> data, Context context) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); childItemsLayout.setVisibility(GONE); int paddingValue = (int) context.getResources().getDimension(R.dimen.padding2); // calculate the maximum number of child items int maxNoOfChild = ZERO; for (int index = ZERO; index < data.size(); index++) { int maxSizeTemp = data.get(index).getChildes().size(); if (maxSizeTemp > maxNoOfChild) maxNoOfChild = maxSizeTemp; } for (int indexView = ZERO; indexView < maxNoOfChild; indexView++) { TextView textView = new TextView(context); textView.setId(indexView); textView.setPadding(paddingValue, paddingValue, paddingValue, paddingValue); textView.setGravity(Gravity.CENTER); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); childItemsLayout.addView(textView, layoutParams); } parentName.setOnClickListener(this); } @Override public void onClick(View view) { if (view.getId() == R.id.parent_name_tv) { if (childItemsLayout.getVisibility() == View.VISIBLE) { childItemsLayout.setVisibility(View.GONE); } else { childItemsLayout.setVisibility(View.VISIBLE); } } } }
[ "tarek.ma91@yahoo.com" ]
tarek.ma91@yahoo.com
ab60d4b7c53641f4df037eb154ab828e77aad056
a4f61c58b817ecd797a51b4a8c2cfffe2c7f8a2c
/src/main/java/DataStructure/Graph/MaxWeightGraphTest.java
6a7e6dced17b24d37a292b93cfa4cbeec19308ea
[]
no_license
surfer1225/LearningJava
ffaa5f227b84855476602ceab09883b19e5e919e
710f0fe47c929da2cf25b27a20bb8a61b241a37d
refs/heads/master
2021-06-10T20:35:05.951360
2021-05-30T14:19:23
2021-05-30T14:19:23
87,419,386
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package main.java.DataStructure.Graph; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class MaxWeightGraphTest { public static void main(String[] args) { MaxWeightGraph m = new MaxWeightGraph(); Node A = new Node("A", 8); Node B = new Node("B", 1); Node C = new Node("C", 4); Node E = new Node("E", 3); Node F = new Node("F", 5); Node G = new Node("G", 2); Set<Node> nodes = new HashSet<>(Arrays.asList(A, B, C, E, F, G)); Set<Edge> edges = new HashSet<>(Arrays.asList( new Edge(A, B), new Edge(B, C), new Edge(A, E), new Edge(B, E), new Edge(C, F), new Edge(E, F), new Edge(E, G), new Edge(G, F) )); try { System.out.println(m.maxWeightPath(nodes, edges, B)); } catch (Exception e) { e.printStackTrace(); } } }
[ "xxxx@yahoo.com" ]
xxxx@yahoo.com
b7f58452edfa9dc4e1cdc893d3fcbf128fe24cd4
a8e53f8d85c8a78f95c6d8264d537c754ab102a6
/Layered Architecture(20-05-2019)/Employee Medical Insurance scheme/src/com/ibm/eis/dao/DaoInterface.java
8c75628b3630458e7eb24ac86b337ddb96a2dcd2
[]
no_license
vyshnavi-gadiparthi/FSD-assignments
2269324abf5d212c4a94fa17b14bc8d9fc42977e
a01799e20a90b51718ee020026153509ee99fd7e
refs/heads/master
2020-05-17T11:30:39.696431
2019-07-01T03:31:08
2019-07-01T03:31:08
183,686,585
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package com.ibm.eis.dao; import java.util.HashMap; import java.util.Map; import com.ibm.eis.bean.Employe; //import com.ibm.eis.bean.Employe; public interface DaoInterface { public int validating(int salary, String designation); // Map<Integer,String> display(); HashMap<Employe,String> getFromMap(Employe employe, String designation); }
[ "noreply@github.com" ]
vyshnavi-gadiparthi.noreply@github.com
47f831801913e75d79c5fc65f416346489c7fa9e
667616d5a251ac5bb17ce438aae38926188463d3
/old/src/main/java/com/nv/platform/ynwagentframework/event/process/UpdateScheduleEventProcessor.java
d1383509c679af1e18919fa6e54bf8dc8448b2f9
[]
no_license
netvarth/nvagentframework
793bd53708e1cbd292873b2fef67114accede7d3
8f6ca2447b4e9943c6cfd41a6bf3b48e310f5f7c
refs/heads/master
2023-05-25T09:40:18.670978
2017-04-24T09:14:57
2017-04-24T09:14:57
56,765,773
0
0
null
null
null
null
UTF-8
Java
false
false
1,003
java
package com.nv.platform.ynwagentframework.event.process; import com.nv.platform.log.api.NVLogFormatter; import com.nv.platform.log.api.NVLogger; import com.nv.platform.log.impl.NVLoggerAPIFactory; import com.nv.platform.ynwagentframework.dao.AgentFWEventDB; import com.nv.platform.ynwagentframework.event.AgentEvent; import com.nv.platform.ynwagentframework.event.AgentFWAbstractEventProcessor; public class UpdateScheduleEventProcessor extends AgentFWAbstractEventProcessor { private static NVLogger logger = NVLoggerAPIFactory.getLogger(UpdateScheduleEventProcessor.class); private AgentEvent event; public UpdateScheduleEventProcessor(final AgentEvent event) { this.event = event; } public void process() { logger.info("received event"); event = AgentFWEventDB.dbSelect(event.getEventId(), event.getEventType().name()); logger.info(new NVLogFormatter("event retrieved from DB", "event", event)); // Process the event logger.info("Succesfully processed event"); } }
[ "netvarth9@192.168.2.117" ]
netvarth9@192.168.2.117
39b36cf404043c53d8dc8208a0b90297f503e9dc
1b6c9f6d9f78e9de5d01a4ad16c41dd4b017d656
/workspace/dev_project/src/composition/meta/.svn/text-base/Instrument.java.svn-base
c8cd7834edfa92e5bfe3a8b94598efdf6e3da974
[]
no_license
mcdougal/notable
71246dc5d04301fd70eaa4219857e5076f2b461e
2da115461d8bcff6b4ad28839ded342d409b892c
refs/heads/master
2021-01-02T06:32:00.773388
2012-04-19T00:35:51
2012-04-19T00:35:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,595
package composition.meta; import composition.LilyPondObject; import composition.music.node.Note; import composition.music.node.Note.NOTE_VALUES; import composition.music.node.Note.OCTAVE_VALUES; /** * Represents an instrument within the sheet music generation project. */ public class Instrument implements LilyPondObject { /** * Supported clefs */ public static enum Clef { TREBLE, BASS, GRAND_STAFF } ///////////////////////////////// // // VARIABLES // ///////////////////////////////// /** Used to identify the instrument in the LilyPond output */ private String name; /** Represents the lowest note and octave playable by this Instrument */ private int lowestPitch; /** Represents the highest note and octave playable by this Instrument */ private int highestPitch; /** * The size of this instrument's playable range, in terms of half-steps. * For example, a range of 2 octaves would 24 half-steps. */ private int range; /** True if this instrument can play more than one note at a time */ private boolean canPlayChords; /** The clef on which this instrument's sheet music is written */ private Clef clef; ///////////////////////////////// // // CONSTRUCTOR // ///////////////////////////////// /** * Constructs a new Instrument with the given values. */ public Instrument(String name, int lowestNote, int lowestOctave, int rangeInOctaves, boolean canPlayChords, Clef clef) { this.name = name; this.lowestPitch = Note.getPitch(lowestNote, lowestOctave); this.range = rangeInOctaves * Note.NUM_NOTES; this.canPlayChords = canPlayChords; this.clef = clef; this.highestPitch = this.lowestPitch + this.range; } ///////////////////////////////// // // METHODS // ///////////////////////////////// /** * Returns true if the given pitch is out of the playable range of this * Instrument. */ public boolean pitchIsOutOfRange(int pitch) { return this.getLowestPitch() > pitch || pitch > this.getHighestPitch(); } /** * Returns the lowest possible pitch on which this Instrument can play * the given note. */ public int getLowestPitchForNote(int note) { int pitch = this.getLowestPitch(); while (Note.getNoteFromPitch(pitch) != note) { pitch++; } return pitch; } /** * Returns the highest possible pitch on which this Instrument can play * the given note. */ public int getHighestPitchForNote(int note) { int pitch = this.getHighestPitch(); while (Note.getNoteFromPitch(pitch) != note) { pitch--; } return pitch; } /** * Returns a LilyPond formatted String representing this Instrument's clef. */ public String toLilyPondString() { if (clef.equals(Clef.GRAND_STAFF)) // bass staff is added individually return clefToLilyPondString(Clef.TREBLE); return clefToLilyPondString(this.getClef()); } /** * Returns a LilyPond formatted String representing the given clef. */ public static String clefToLilyPondString(Clef clef) { if (clef.equals(Instrument.Clef.TREBLE)) return "\\clef treble"; else return "\\clef bass"; } ///////////////////////////////// // // GETTERS / SETTERS // ///////////////////////////////// /** * Returns the name of this instrument. */ public String getName() { return name; } /** * Returns an integer representing the lowest note and octave playable by * this Instrument. */ public int getLowestPitch() { return lowestPitch; } /** * Returns an integer representing the highest note and octave playable by * this Instrument. */ public int getHighestPitch() { return this.highestPitch; } /** * Returns the size of this instrument's playable range, in terms of * half-steps. For example, a range of 2 octaves would 24 half-steps. */ public int getRange() { return range; } /** * Returns the size of this instrument's playable range in octaves. */ public int getRangeInOctaves() { return range / Note.NUM_NOTES; } /** * Returns true if this instrument can play more than one note at a time. */ public boolean canPlayChords() { return canPlayChords; } /** * Returns the clef on which this instrument's sheet music is written. */ public Clef getClef() { return clef; } ///////////////////////////////// // // INSTANCES // ///////////////////////////////// /** * Instance of a soprano recorder instrument. */ public static final Instrument SOPRANO_RECORDER = new Instrument( "Soprano Recorder", NOTE_VALUES.C, OCTAVE_VALUES.OCTAVE_4, // lowest written note and octave 2, // range in octaves false, // can play chords Clef.TREBLE ); /** * Instance of an alto recorder instrument. */ public static final Instrument ALTO_RECORDER = new Instrument( "Alto Recorder", NOTE_VALUES.F, OCTAVE_VALUES.OCTAVE_3, // lowest written note and octave 2, // range in octaves false, // can play chords Clef.TREBLE ); /** * Instance of a concert flute instrument. */ public static final Instrument CONCERT_FLUTE = new Instrument( "Concert Flute", NOTE_VALUES.B, OCTAVE_VALUES.OCTAVE_3, // lowest written note and octave 3, // range in octaves false, // can play chords Clef.TREBLE ); /** * Instance of an oboe instrument. */ public static final Instrument OBOE = new Instrument( "Oboe", NOTE_VALUES.A_SHARP, OCTAVE_VALUES.OCTAVE_3, // lowest written note and octave 2, // range in octaves false, // can play chords Clef.TREBLE ); /** * Instance of a bassoon instrument. */ public static final Instrument BASSOON = new Instrument( "Bassoon", NOTE_VALUES.A_SHARP, OCTAVE_VALUES.OCTAVE_1, // lowest written note and octave 3, // range in octaves false, // can play chords Clef.BASS ); /** * Instance of a violin instrument. */ public static final Instrument VIOLIN = new Instrument( "Violin", NOTE_VALUES.G, OCTAVE_VALUES.OCTAVE_3, // lowest written note and octave 2, // range in octaves false, // can play chords Clef.TREBLE ); /** * Instance of a cello instrument. */ public static final Instrument CELLO = new Instrument( "Cello", NOTE_VALUES.C, OCTAVE_VALUES.OCTAVE_2, // lowest written note and octave 3, // range in octaves false, // can play chords Clef.BASS ); /** * Instance of a guitar instrument. */ public static final Instrument GUITAR = new Instrument( "Guitar", NOTE_VALUES.E, OCTAVE_VALUES.OCTAVE_3, // lowest written note and octave 3, // range in octaves true, // can play chords Clef.TREBLE ); /** * Instance of a piano instrument. */ public static final Instrument PIANO = new Instrument( "Piano", NOTE_VALUES.C, OCTAVE_VALUES.OCTAVE_1, // lowest written note and octave 6, // range in octaves true, // can play chords Clef.GRAND_STAFF ); }
[ "mcdougal.ce@gmail.com" ]
mcdougal.ce@gmail.com
c1323b78331fe818b1c84ab3650b1f85f8a9241e
3afd15db609794e0f44ebdb039a4663f5d192d90
/src/main/java/tallestegg/guardvillagers/entities/ai/goals/AttackEntityDaytimeGoal.java
c3de06d51bc502d66c6f7b3e86445672d7720ef0
[]
no_license
blackknight36/guardvillagers
05948cd3a9ae1fc567af98d387888013e66a8ad1
d025e962d93feb3bef03497b71383b39aac95a63
refs/heads/main
2023-06-03T14:00:42.059247
2021-06-25T19:41:34
2021-06-25T19:41:34
380,338,315
0
0
null
2021-06-25T19:40:39
2021-06-25T19:40:39
null
UTF-8
Java
false
false
669
java
package tallestegg.guardvillagers.entities.ai.goals; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal; import net.minecraft.entity.monster.SpiderEntity; //The spiders goal was private, so this needed to be done. public class AttackEntityDaytimeGoal<T extends LivingEntity> extends NearestAttackableTargetGoal<T> { public AttackEntityDaytimeGoal(SpiderEntity spider, Class<T> classTarget) { super(spider, classTarget, true); } @Override public boolean shouldExecute() { float f = this.goalOwner.getBrightness(); return f >= 0.5F ? false : super.shouldExecute(); } }
[ "55965249+seymourimadeit@users.noreply.github.com" ]
55965249+seymourimadeit@users.noreply.github.com
471a31bb5c716ce5cf72b13025e9ed5d35b0a242
f2b5b73e4a35da7753f1648248306cec4b6eb5c3
/src/homework3/test/Test.java
22be2d313e8cab3f8cc3062607fa771997ff8a32
[]
no_license
GrayGraySmall/homework3
28ecc22de4c6589ddf03e58b7d0abc6cc44cc143
ce9ebb9261afdb21fcf6543909bb826eaac106e7
refs/heads/master
2020-03-22T09:46:12.705877
2018-07-05T14:10:29
2018-07-05T14:10:29
139,859,434
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package homework3.test; import org.springframework.beans.factory.BeanFactory; import homework3.bean.BookInfoBean; import homework3.dao.BookInfoDao; import homework3.utils.SpringUtils; public class Test { public static void main(String[] args) { BeanFactory factory = SpringUtils.getBeanFactory(); BookInfoDao dao = factory.getBean("bookInfoDao", BookInfoDao.class); System.out.println(dao.findBookById("1").getBookName()); BookInfoBean[] books = dao.findByIndex(2, "康粤婷"); for(BookInfoBean book:books){ System.out.println(book.getBookName() + book.getBookPrice() + book.getPublishDate()); } } }
[ "1428027441@qq.com" ]
1428027441@qq.com
26361f8ac9f1d5cb91cd4a13f8c6d2e5de7ad352
d437881d0168f5834364103c0df6c3050de2970e
/android/app/src/main/java/com/fasttrack/app/MainActivity.java
42b961d8648dad078c1a339c636ab72112562ad5
[]
no_license
piotrzuzak/ionic-firebase-capacitor-test
e7804c9f4d1b526d881156239bc14a597a49227d
ca812872f8085bb0cdd64f7077d53586baacd531
refs/heads/master
2023-01-08T00:34:10.958448
2020-06-27T19:15:26
2020-06-27T19:15:26
215,386,068
0
0
null
2023-01-07T10:44:02
2019-10-15T20:01:37
TypeScript
UTF-8
Java
false
false
644
java
package com.fasttrack.app; import android.os.Bundle; import com.getcapacitor.BridgeActivity; import com.getcapacitor.Plugin; import java.util.ArrayList; import com.baumblatt.capacitor.firebase.auth.CapacitorFirebaseAuth; public class MainActivity extends BridgeActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initializes the Bridge this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{ // Additional plugins you've installed go here // Ex: add(TotallyAwesomePlugin.class); add(CapacitorFirebaseAuth.class); }}); } }
[ "piotr.zuzak@hotmail.com" ]
piotr.zuzak@hotmail.com
b773a2f7cef98cbafa7ade35b8ecf89f428a2cda
43ab3c7bd358edfa69f3efdb0e21dfccea0316a3
/src/project/Main.java
3ca38ad3ca1db91896f6111917486113dc24b198
[]
no_license
innodisgithub/LottoGenerator
3c93203fbbaf980d8fc6a2e44be3f45dc3dfb25f
8f173826d6fbc1df861394510b1183380f630d77
refs/heads/master
2020-03-20T16:44:07.398753
2018-06-16T05:37:57
2018-06-16T05:37:57
137,544,879
0
1
null
2018-06-16T05:37:58
2018-06-16T01:31:17
Java
UTF-8
Java
false
false
515
java
package project; import java.util.Random; import java.util.Arrays; public class Main { private Random random = new Random(System.nanoTime()); public int[] generate() { int[] result = new int[6]; for(int i=0; i < 6; i++) { result[i] = random.nextInt(45) + 1; } return result; } public static void main(String[] args) { int[] result = new Main().generate(); System.out.println(Arrays.toString(result)); } }
[ "innodis.github@gmail.com" ]
innodis.github@gmail.com
c198e3f7e3bf5b68517259e1bcd11bfaaaa4959a
acf8d83baf37e3b6463e6d177ec4ed9e44b72d0c
/src/main/java/interviewBit/dp/DistinctSubsequences.java
13c3df8714f9bc9c546b43dcd75a3abb31c20073
[]
no_license
athimanshu/Practice
b42c220c8734f29210265ab8d78fbb09385e5eb0
688a22d7d3133e75c16907065a2b99a1be6cd35d
refs/heads/master
2023-08-04T04:09:47.211032
2021-09-19T04:56:39
2021-09-19T04:56:39
408,034,782
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package interviewBit.dp; /** * Given two strings s and t, return the number of distinct subsequences of s which equals t. * Input: s = "rabbbit", t = "rabbit" * Output: 3 * Explanation: * As shown below, there are 3 ways you can generate "rabbit" from S. * rabbbit * rabbbit * rabbbit * Ref: https://www.youtube.com/watch?v=NR9lLQnFjWc + https://leetcode.com/problems/distinct-subsequences/ */ public class DistinctSubsequences { public int numDistinct(String s, String t) { int s1 = s.length(); int t1 = t.length(); int[][] dp = new int[t1+1][s1+1]; for(int i=0;i<=s1;++i){ dp[0][i] = 1; } for(int i=1;i<=t1;++i){ for(int j=1;j<=s1;++j){ if(s.charAt(j-1) == t.charAt(i-1)) dp[i][j] = dp[i-1][j-1] + dp[i][j-1]; else dp[i][j] = dp[i][j-1]; } } return dp[t1][s1]; } }
[ "himanshu.singh@ihsmarkit.com" ]
himanshu.singh@ihsmarkit.com
073b327598729ecc5620eb7ebdd7e03c1b9460fa
5ed84dc14cd18dda4333e7778de1f6d7569c4d1f
/Decision/src/commande/CommandeManualMode.java
e91cb942ae8d6cfe2ffb42134ed403e948cb7756
[]
no_license
MathiasBsrt/robot-mapper-lazarus
b3f898341c46bea79e8af857399492bd28f480eb
38095609feb5a07ca7c7cc4dad74258fcf11214f
refs/heads/main
2023-06-03T01:16:09.551352
2021-06-22T19:39:42
2021-06-22T19:39:42
373,106,426
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package commande; import decision.Instructions; public class CommandeManualMode extends Commande { public CommandeManualMode() { super(Instructions.MANUAL); } }
[ "mathias.bossaerts9581@gmail.com" ]
mathias.bossaerts9581@gmail.com
09931912b0f93ebaba771e9787beb2120048b964
891aacf0761cafa4ebddeafb846b6b9abb8d66d7
/Algorithms/Sorting/Luck Balance/Solution.java
f317c1ff7d2b594fd472d8546f0577d860145ffa
[ "MIT" ]
permissive
farman0712/HackerRank_solutions
345548e50393fd432f5e7f3caeaa97963134e03b
c810824509c5a0b80ce62c284f245325d9e9dd62
refs/heads/master
2020-08-23T04:13:34.687752
2019-10-10T20:39:49
2019-10-10T20:39:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,654
java
// Github: github.com/RodneyShag import java.util.Scanner; import java.util.ArrayList; // Algorithm: Lose every non-important contest to save luck. For important contests, lose the // K contests with the most luck, and win the rest. This greedy algorithm maximizes saved luck. // Time Complexity: O(n) average-case runtime using Quickselect // Space Complexity: O(n) public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); ArrayList<Integer> contest = new ArrayList<>(N); int savedLuck = 0; for (int i = 0; i < N; i++) { int luck = scan.nextInt(); int importance = scan.nextInt(); if (importance == 0) { savedLuck += luck; // lose every non-important contest } else { contest.add(luck); } } scan.close(); /* Compete in "important" contests */ quickselect(contest, contest.size() - K); for (int i = 0; i < contest.size(); i++) { if (i < contest.size() - K) { savedLuck -= contest.get(i); // win contest } else { savedLuck += contest.get(i); // lose contest } } System.out.println(savedLuck); } /* Quickselect * - Finds "nth" smallest element in a list. Returns its value (Code from Wikipedia) * - Also partially sorts the data. If the value of the nth smallest element is x, all values to the * left of it are smaller than x, and all values to the right of it are greater than x * - O(n) average run-time is since we recurse only on 1 side (n + n/2 + n/4 + ...) = n (1 + 1/2 + 1/4 + ...) = O(n) * Our formula above is a geometric series with "r = 1/2", which would converge to 1/(1-r) for infinite geometric series * - O(n^2) worst-case run-time is if we consistently pick a bad pivot */ private static Integer quickselect(ArrayList<Integer> list, int n) { int start = 0; int end = list.size() - 1; while (start <= end) { int pivotIndex = partition(list, start, end); if (pivotIndex == n) { return list.get(n); } else if (pivotIndex < n) { start = pivotIndex + 1; } else { end = pivotIndex - 1; } } return null; } /* Partitions list into 2 parts. * 1) Left side has values smaller than pivotValue * 2) Right side has values larger than pivotValue * Returns pivotIndex */ public static int partition(ArrayList<Integer> list, int start, int end) { int pivotIndex = (start + end) / 2; // there are many ways to choose a pivot int pivotValue = list.get(pivotIndex); swap(list, pivotIndex, end); // puts pivot at end for now. /* Linear search, comparing all elements to pivotValue and swapping as necessary */ int indexToReturn = start; // Notice we set it to "start", not to "0". for (int i = start; i < end; i++) { if (list.get(i) < pivotValue) { swap(list, i, indexToReturn); indexToReturn++; } } swap(list, indexToReturn, end); // puts pivot where it belongs return indexToReturn; } private static void swap(ArrayList<Integer> list, int i, int j) { int temp = list.get(i); list.set(i, list.get(j)); list.set(j, temp); } }
[ "9rodney@gmail.com" ]
9rodney@gmail.com
9692da1e6ea12520cfe671e2526a8ed62560a230
02d5b1b39ebc17992641e3bbd29a59c3ce2cf2ce
/1_day/SwaggerConfig.java
fb570689eab2356c12b9b798e3735f9af097a58b
[]
no_license
demorier/msa_ssg
ca018663e2f210a6d36d0b1d65615f8ad8103a8e
1475221363205e29aa2295345e0a606ce6f462f6
refs/heads/main
2023-08-03T22:32:17.279322
2021-09-29T13:33:27
2021-09-29T13:33:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.msa.Hello_World; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("com.msa.Hello_World")) .paths(PathSelectors.any()) .build(); } }
[ "noreply@github.com" ]
demorier.noreply@github.com
940c92af669fb5c6ebeedaf37e6e87f6e3a306c1
a1417723a42902339456142b8990df3c6ba52f38
/quantity/src/etc/unit/BitUnit.java
ca2300c1c4bc662800e9786f0d7e7387c88e982f
[ "BSD-3-Clause" ]
permissive
michaelsexton/uom-systems
104d11f0a1cb4a27fc79d3a02086d74b5e5360ed
9c37979eeb04fb02df15fd4c56593a00f6fb1956
refs/heads/master
2021-08-22T15:11:06.959490
2017-11-30T14:03:41
2017-11-30T14:03:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
823
java
/** * Unit-API - Units of Measurement API for Java * Copyright (c) 2014 Jean-Marie Dautelle, Werner Keil, V2COM * All rights reserved. * * See LICENSE.txt for details. */ package systems.uom.test.unit; import javax.measure.Unit; import systems.uom.quantity.Information; import javax.measure.test.TestUnit; /** * @author Werner Keil * @version 1.1 */ public class BitUnit extends TestUnit<Information> { public static final BitUnit bit = new BitUnit("bit", 1.0); // reference Unit public static final BitUnit REF_UNIT = bit; // reference Unit public static final BitUnit kb = new BitUnit("kb", 1.0e3); public BitUnit(String name2, double convF) { super(name2); multFactor = convF; } @Override public Unit<Information> getSystemUnit() { return REF_UNIT; } }
[ "werner.keil@gmx.net" ]
werner.keil@gmx.net
1b3740dcc806a80eaca73c5012c7c52833545a05
3473aedf364363c8d80b67abd29d2ce9fecb3ca6
/shoes/src/main/java/com/shoestore/shoes/domain/Photo.java
5bd98a4e56e5bd0fdbaeaadc68608d7c377ef72b
[]
no_license
francochiapello/StoreWithShoes
9d6639bf69ca56897a1a7e360781f63f1e1acd1c
e8943d3b5b64a571e5344052b770426a09e2a274
refs/heads/main
2023-05-07T17:11:47.167316
2021-06-02T18:00:25
2021-06-02T18:00:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
886
java
package com.shoestore.shoes.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Photo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String p1; private String p2; private String p3; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getP1() { return p1; } public void setP1(String p1) { this.p1 = p1; } public String getP2() { return p2; } public void setP2(String p2) { this.p2 = p2; } public String getP3() { return p3; } public void setP3(String p3) { this.p3 = p3; } }
[ "noreply@github.com" ]
francochiapello.noreply@github.com
d18369fc79f10c2593e672e822600e758f3f5eb7
1301271a7e776c5121e56a78b1f71f903314d216
/src/las28creencias/Las28creencias.java
37dfebd9f17d5c80e74c647d247d1a753dbbe222
[]
no_license
FrankBustamante/las28creenciasAdventistas
0dd582b6d6b5088c621f66f33d5111bfcbe8a102
ef54c1ec40afb8826e43029a8091d6635daf946b
refs/heads/master
2021-01-10T17:16:14.910436
2015-10-30T20:58:36
2015-10-30T20:58:36
44,270,638
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
package las28creencias; public class Las28creencias { public static void main(String[] args) { // TODO code application logic here Ventana ver = new Ventana(); ver.setVisible(true); ver.setLocationRelativeTo(null); } }
[ "kristhiamrd@outllok.com" ]
kristhiamrd@outllok.com
9345c0bad8fdd9da3ad082a2cf3fa7652b160da5
b19ccd317586c7bb1d21efb9a92ad1784a480d31
/src/main/java/Main.java
80a0b6dd8f88a5f6504a01054b8b9325c19a9a34
[]
no_license
aidamo/JunitMaven_HM
4c7a34e7d8ff5f7af8dfdf86b2da82f77e475ad2
fe19e0a1e76810468fc9decae16f84a13dc5e0dd
refs/heads/master
2020-03-31T21:05:33.441383
2018-10-11T09:43:44
2018-10-11T09:43:44
152,567,192
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
public class Main { public static void main (String[] args){ // System.out.println(new BasicCalculator().add(5,8,3)); // System.out.println(new BasicCalculator().substract(3,4,7)); // System.out.println(new BasicCalculator().multiply(3,2,5)); // System.out.println(new ExpertCalculator()); System.out.println(new BasicCalculator ().divide(10,5)); // System.out.println(Math.pow(2,3)); } }
[ "aidamodiga@gmail.com" ]
aidamodiga@gmail.com
ce6526e55c37136dde537c5d809775291b99ce9b
598582ad6fa8441c6561de25a21cec481cae0bcf
/app/src/main/java/com/dicoding/picodiploma/vedoalfarizi/consumervemovie/model/Movie.java
766914661a5d4149dbb7c17161bf5597946ec359
[]
no_license
vedoalfarizi/MADE-ConsumerVeMovie
b63b367b157ae8d2ecebf51ac5384c1a3eb540a6
c78e93f4d9440d350ff22fb624560e78c421327f
refs/heads/master
2020-07-31T19:27:05.162567
2019-09-25T02:16:22
2019-09-25T02:16:22
210,728,146
0
0
null
null
null
null
UTF-8
Java
false
false
2,667
java
package com.dicoding.picodiploma.vedoalfarizi.consumervemovie.model; import android.database.Cursor; import android.os.Parcel; import android.os.Parcelable; public class Movie implements Parcelable { private int id; private String title; private String overview; private String release_date; private float rating; private String poster; public Movie(Cursor m) { this.id = m.getInt(m.getColumnIndex("id")); this.title = m.getString(m.getColumnIndex("title")); this.overview = m.getString(m.getColumnIndex("overview")); this.release_date = m.getString(m.getColumnIndex("release_date")); this.rating = m.getFloat(m.getColumnIndex("vote_average")); this.poster = m.getString(m.getColumnIndex("poster_path")); m.moveToNext(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getOverview() { return overview; } public void setOverview(String overview) { this.overview = overview; } public String getRelease_date() { return release_date; } public void setRelease_date(String release_date) { this.release_date = release_date; } public float getRating() { return rating; } public void setRating(float rating) { this.rating = rating; } public String getPoster() { return poster; } public void setPoster(String poster) { this.poster = poster; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.id); dest.writeString(this.title); dest.writeString(this.overview); dest.writeString(this.release_date); dest.writeFloat(this.rating); dest.writeString(this.poster); } private Movie(Parcel in) { this.id = in.readInt(); this.title = in.readString(); this.overview = in.readString(); this.release_date = in.readString(); this.rating = in.readFloat(); this.poster = in.readString(); } public static final Parcelable.Creator<Movie> CREATOR = new Parcelable.Creator<Movie>() { @Override public Movie createFromParcel(Parcel source) { return new Movie(source); } @Override public Movie[] newArray(int size) { return new Movie[size]; } }; }
[ "vedoalfarizi@gmail.com" ]
vedoalfarizi@gmail.com
b6d336c8b77c5afd2503b9038c32765510c2aa77
de7fa00078bd8f64a03f61d15bc89a8063a4477f
/outbound/src/main/java/com/sun/mdm/index/webservice/GetMergedEUIDs.java
936e9c5720b32aa50088e57ff265a262eb40cc03
[]
no_license
ameleito/Assignment_Lab
1bf5bc9a02a668b652ff49e6b01920e5c9a19043
d75d12a11985a9d0458d2415de81f4cfce28a000
refs/heads/master
2020-05-24T22:39:08.252830
2019-05-24T16:26:19
2019-05-24T16:26:19
187,499,905
0
0
null
null
null
null
UTF-8
Java
false
false
2,020
java
package com.sun.mdm.index.webservice; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for getMergedEUIDs complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="getMergedEUIDs"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="callerInfo" type="{http://webservice.index.mdm.sun.com/}callerInfo" minOccurs="0"/&gt; * &lt;element name="euid" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getMergedEUIDs", propOrder = { "callerInfo", "euid" }) public class GetMergedEUIDs { protected CallerInfo callerInfo; protected String euid; /** * Gets the value of the callerInfo property. * * @return * possible object is * {@link CallerInfo } * */ public CallerInfo getCallerInfo() { return callerInfo; } /** * Sets the value of the callerInfo property. * * @param value * allowed object is * {@link CallerInfo } * */ public void setCallerInfo(CallerInfo value) { this.callerInfo = value; } /** * Gets the value of the euid property. * * @return * possible object is * {@link String } * */ public String getEuid() { return euid; } /** * Sets the value of the euid property. * * @param value * allowed object is * {@link String } * */ public void setEuid(String value) { this.euid = value; } }
[ "jamezqui@redhat.com" ]
jamezqui@redhat.com
38113fab7c72004517b035fc97000bfc7c17f5e2
93e94f6fb183023c56e357c95d9632e5ac7e1ccc
/app/src/main/java/com/example/administrator/coolweather/activity/WeatherActivity.java
775bd11ed2b7795992e61bb75754b88104c2f169
[ "Apache-2.0" ]
permissive
JPYfree/coolweather
fa33e2846c6778ac5431635774784ed0d5283140
d6889e9feaf6c1fdc212cca5606b0ff6e752d2e1
refs/heads/master
2020-04-05T23:38:47.161844
2015-07-21T03:00:15
2015-07-21T03:00:15
39,228,701
0
0
null
null
null
null
UTF-8
Java
false
false
6,566
java
package com.example.administrator.coolweather.activity; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.example.administrator.coolweather.R; import com.example.administrator.coolweather.service.AutoUpdateService; import com.example.administrator.coolweather.util.HttpCallbackListener; import com.example.administrator.coolweather.util.HttpUtil; import com.example.administrator.coolweather.util.Utility; /** * Created by Administrator on 2015/7/21. */ public class WeatherActivity extends Activity implements View.OnClickListener { private LinearLayout weatherInfoLayout; /*用于显示城市名*/ private TextView cityNameText; /*用于显示发布时间*/ private TextView publishText; /*用于显示天气描述信息*/ private TextView weatherDespText; /*用于显示气温1*/ private TextView temp1Text; /*用于显示气温2*/ private TextView temp2Text; /*用于显示当前日期*/ private TextView currentDateText; /*切换城市按钮*/ private Button switchCity; /*更新天气按钮*/ private Button refreshWeather; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.weather_layout); //初始化各控件 weatherInfoLayout = (LinearLayout) findViewById(R.id.weather_info_layout); cityNameText = (TextView) findViewById(R.id.city_name); publishText = (TextView) findViewById(R.id.publish_text); weatherDespText = (TextView) findViewById(R.id.weather_desp); temp1Text = (TextView) findViewById(R.id.temp1); temp2Text = (TextView) findViewById(R.id.temp2); currentDateText = (TextView) findViewById(R.id.current_date); switchCity = (Button) findViewById(R.id.switch_city); refreshWeather = (Button) findViewById(R.id.refresh_weather); String countyCode = getIntent().getStringExtra("county_code"); if (!TextUtils.isEmpty(countyCode)) { //有县级代号时就去查询天气 publishText.setText("同步中..."); weatherInfoLayout.setVisibility(View.INVISIBLE); cityNameText.setVisibility(View.INVISIBLE); queryWeatherCode(countyCode); }else { //没有县级代号时就直接显示本地天气 showWeather(); } switchCity.setOnClickListener(this); refreshWeather.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.switch_city: Intent intent = new Intent(this, ChooseAreaActivity.class); intent.putExtra("from_weather_activity", true); startActivity(intent); finish(); break; case R.id.refresh_weather: publishText.setText("同步中..."); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String weatherCode = prefs.getString("weather_code", ""); if (!TextUtils.isEmpty(weatherCode)) { queryWeatherInfo(weatherCode); } break; default: break; } } /*查询县级代号对应的天气代号*/ private void queryWeatherCode(String countyCode) { String address = "http://www.weather.com.cn/data/list3/city" + countyCode + ".xml"; queryFromServer(address, "countyCode"); } /*查询天气代号对应的天气*/ private void queryWeatherInfo(String weatherCode) { String address = "http://www.weather.com.cn/data/cityInfo" + weatherCode + ".html"; queryFromServer(address, "weatherCode"); } /*根据传入的地址和类型去向服务器查询天气代号或天气信息*/ private void queryFromServer(final String address, final String type) { HttpUtil.sendHttpRequest(address, new HttpCallbackListener() { @Override public void onFinish(String response) { if ("countyCode".equals(type)) { if (!TextUtils.isEmpty(response)) { //从服务器返回的数据中解析出天气代号 String[] array = response.split("\\|"); if (array != null && array.length == 2) { String weatherCode = array[1]; queryWeatherInfo(weatherCode); } } }else if ("weatherCode".equals(type)) { //处理服务器返回的天气信息 Utility.handleWeatherResponse(WeatherActivity.this, response); runOnUiThread(new Runnable() { @Override public void run() { showWeather(); } }); } } @Override public void onError(Exception e) { runOnUiThread(new Runnable() { @Override public void run() { publishText.setText("同步失败"); } }); } }); } /*从SharedPreferences文件中读取存储的天气信息,并显示在界面上*/ private void showWeather() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); cityNameText.setText(prefs.getString("city_name", "")); temp1Text.setText(prefs.getString("temp1", "")); temp2Text.setText(prefs.getString("temp2", "")); weatherDespText.setText(prefs.getString("weather_desp", "")); publishText.setText("今天" + prefs.getString("publish_time", "") + "发布"); currentDateText.setText(prefs.getString("current_date", "")); weatherInfoLayout.setVisibility(View.VISIBLE); cityNameText.setVisibility(View.VISIBLE); Intent intent = new Intent(this, AutoUpdateService.class); startService(intent); } }
[ "jpyfreeprogram@163.com" ]
jpyfreeprogram@163.com
276a82740723daef4eb20259ef1ab0d1c76b3f07
c666c1d1f09dd8abbac51c6a91f190eba60374a0
/src/druid/ConnectionPoolManager.java
1da0f2f603d540cea1816fffe86dfe026d4e0183
[]
no_license
db17525/my_Test
c51ae03296733f08cd7b0b26326160676f9ba0e7
2e819eb96621fc21a702de71fcd42d71fcdd5577
refs/heads/master
2021-05-10T16:14:13.743914
2018-01-23T07:56:33
2018-01-23T07:56:33
118,573,145
0
0
null
null
null
null
UTF-8
Java
false
false
2,239
java
package druid; import java.sql.Connection; import java.sql.SQLException; import java.util.Hashtable; /** * Created by Administrator on 2016/12/7. */ public class ConnectionPoolManager { // 连接池存放 public Hashtable<String,IConnectionPool> pools = new Hashtable<String, IConnectionPool>(); // 初始化 private ConnectionPoolManager(){ init(); } // 单例实现 public static ConnectionPoolManager getInstance(){ return Singtonle.instance; } private static class Singtonle { private static ConnectionPoolManager instance = new ConnectionPoolManager(); } // 初始化所有的连接池 public void init(){ for(int i =0;i<DBInitInfo.beans.size();i++){ DBbean bean = DBInitInfo.beans.get(i); ConnectionPool pool = new ConnectionPool(bean); if(pool != null){ pools.put(bean.getPoolName(), pool); System.out.println("Info:Init connection successed ->" +bean.getPoolName()); } } } // 获得连接,根据连接池名字 获得连接 public Connection getConnection(String poolName){ Connection conn = null; if(pools.size()>0 && pools.containsKey(poolName)){ conn = getPool(poolName).getConnection(); }else{ System.out.println("Error:Can't find this connecion pool ->"+poolName); } return conn; } // 关闭,回收连接 public void close(String poolName,Connection conn){ IConnectionPool pool = getPool(poolName); try { if(pool != null){ pool.releaseConn(conn); } } catch (SQLException e) { System.out.println("连接池已经销毁"); e.printStackTrace(); } } // 清空连接池 public void destroy(String poolName){ IConnectionPool pool = getPool(poolName); if(pool != null){ pool.destroy(); } } // 获得连接池 public IConnectionPool getPool(String poolName){ IConnectionPool pool = null; if(pools.size() > 0){ pool = pools.get(poolName); } return pool; } }
[ "157922137@qq.com" ]
157922137@qq.com
40574d14e5a89f781aebad08fa886e915a31cec6
f14a573e683fc96bd48a7c9246c9eaf82c9def3d
/mylibrary/src/androidTest/java/com/zj/tools/mylibrary/ZJReflectUtilsTest.java
713c2a2306205448d78d0906ea600312569f2c17
[]
no_license
summer-zhoujie/ZJUtils
7614b6e0572e1bbd109795d71951391e13450359
8ca472bcf0fa0388226a6a65465f24fa98d8b7ad
refs/heads/master
2023-07-02T01:22:01.868829
2021-07-13T12:09:06
2021-07-13T12:09:06
233,839,741
0
1
null
null
null
null
UTF-8
Java
false
false
19,738
java
package com.zj.tools.mylibrary; import com.zj.tools.mylibrary.reflect.PrivateConstructors; import com.zj.tools.mylibrary.reflect.Test1; import com.zj.tools.mylibrary.reflect.Test10; import com.zj.tools.mylibrary.reflect.Test2; import com.zj.tools.mylibrary.reflect.Test3; import com.zj.tools.mylibrary.reflect.Test4; import com.zj.tools.mylibrary.reflect.Test5; import com.zj.tools.mylibrary.reflect.Test6; import com.zj.tools.mylibrary.reflect.Test7; import com.zj.tools.mylibrary.reflect.Test8; import com.zj.tools.mylibrary.reflect.Test9; import com.zj.tools.mylibrary.reflect.TestHierarchicalMethodsBase; import com.zj.tools.mylibrary.reflect.TestHierarchicalMethodsSubclass; import com.zj.tools.mylibrary.reflect.TestPrivateStaticFinal; import static org.junit.Assert.*; import org.hamcrest.Matchers; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2017/12/15 * desc : ZJReflectUtils 单元测试 * </pre> */ public class ZJReflectUtilsTest { @Rule public final ExpectedException expectedException = ExpectedException.none(); @Test public void reflect() { Assert.assertEquals( ZJReflectUtils.reflect(Object.class), ZJReflectUtils.reflect("java.lang.Object", ClassLoader.getSystemClassLoader()) ); assertEquals( ZJReflectUtils.reflect(Object.class), ZJReflectUtils.reflect("java.lang.Object") ); assertEquals( ZJReflectUtils.reflect(String.class).get(), ZJReflectUtils.reflect("java.lang.String").get() ); assertEquals( Object.class, ZJReflectUtils.reflect(Object.class).get() ); assertEquals( "abc", ZJReflectUtils.reflect((Object) "abc").get() ); assertEquals( 1, ZJReflectUtils.reflect(1).get() ); } @Test public void newInstance() { assertEquals( "", ZJReflectUtils.reflect(String.class).newInstance().get() ); assertEquals( "abc", ZJReflectUtils.reflect(String.class).newInstance("abc").get() ); assertEquals( "abc", ZJReflectUtils.reflect(String.class).newInstance("abc".getBytes()).get() ); assertEquals( "abc", ZJReflectUtils.reflect(String.class).newInstance("abc".toCharArray()).get() ); assertEquals( "b", ZJReflectUtils.reflect(String.class).newInstance("abc".toCharArray(), 1, 1).get() ); } @Test public void newInstancePrivate() { assertNull(ZJReflectUtils.reflect(PrivateConstructors.class).newInstance().field("string").get()); assertEquals( "abc", ZJReflectUtils.reflect(PrivateConstructors.class).newInstance("abc").field("string").get() ); } @Test public void newInstanceNull() { Test2 test2 = ZJReflectUtils.reflect(Test2.class).newInstance((Object) null).get(); assertNull(test2.n); } @Test public void newInstanceWithPrivate() { Test7 t1 = ZJReflectUtils.reflect(Test7.class).newInstance(1).get(); assertEquals(1, (int) t1.i); assertNull(t1.s); Test7 t2 = ZJReflectUtils.reflect(Test7.class).newInstance("a").get(); assertNull(t2.i); assertEquals("a", t2.s); Test7 t3 = ZJReflectUtils.reflect(Test7.class).newInstance("a", 1).get(); assertEquals(1, (int) t3.i); assertEquals("a", t3.s); } @Test public void newInstanceAmbiguity() { Test2 test; test = ZJReflectUtils.reflect(Test2.class).newInstance().get(); assertEquals(null, test.n); assertEquals(Test2.ConstructorType.NO_ARGS, test.constructorType); test = ZJReflectUtils.reflect(Test2.class).newInstance("abc").get(); assertEquals("abc", test.n); assertEquals(Test2.ConstructorType.OBJECT, test.constructorType); test = ZJReflectUtils.reflect(Test2.class).newInstance(new Long("1")).get(); assertEquals(1L, test.n); assertEquals(Test2.ConstructorType.NUMBER, test.constructorType); test = ZJReflectUtils.reflect(Test2.class).newInstance(1).get(); assertEquals(1, test.n); assertEquals(Test2.ConstructorType.INTEGER, test.constructorType); test = ZJReflectUtils.reflect(Test2.class).newInstance('a').get(); assertEquals('a', test.n); assertEquals(Test2.ConstructorType.OBJECT, test.constructorType); } @Test public void method() { // instance methods assertEquals( "", ZJReflectUtils.reflect((Object) " ").method("trim").get() ); assertEquals( "12", ZJReflectUtils.reflect((Object) " 12 ").method("trim").get() ); assertEquals( "34", ZJReflectUtils.reflect((Object) "1234").method("substring", 2).get() ); assertEquals( "12", ZJReflectUtils.reflect((Object) "1234").method("substring", 0, 2).get() ); assertEquals( "1234", ZJReflectUtils.reflect((Object) "12").method("concat", "34").get() ); assertEquals( "123456", ZJReflectUtils.reflect((Object) "12").method("concat", "34").method("concat", "56").get() ); assertEquals( 2, ZJReflectUtils.reflect((Object) "1234").method("indexOf", "3").get() ); assertEquals( 2.0f, (float) ZJReflectUtils.reflect((Object) "1234").method("indexOf", "3").method("floatValue").get(), 0.0f ); assertEquals( "2", ZJReflectUtils.reflect((Object) "1234").method("indexOf", "3").method("toString").get() ); // static methods assertEquals( "true", ZJReflectUtils.reflect(String.class).method("valueOf", true).get() ); assertEquals( "1", ZJReflectUtils.reflect(String.class).method("valueOf", 1).get() ); assertEquals( "abc", ZJReflectUtils.reflect(String.class).method("valueOf", "abc".toCharArray()).get() ); assertEquals( "abc", ZJReflectUtils.reflect(String.class).method("copyValueOf", "abc".toCharArray()).get() ); assertEquals( "b", ZJReflectUtils.reflect(String.class).method("copyValueOf", "abc".toCharArray(), 1, 1).get() ); } @Test public void methodVoid() { // instance methods Test4 test4 = new Test4(); assertEquals( test4, ZJReflectUtils.reflect(test4).method("i_method").get() ); // static methods assertEquals( Test4.class, ZJReflectUtils.reflect(Test4.class).method("s_method").get() ); } @Test public void methodPrivate() { // instance methods Test5 test8 = new Test5(); assertEquals( test8, ZJReflectUtils.reflect(test8).method("i_method").get() ); // static methods assertEquals( Test5.class, ZJReflectUtils.reflect(Test5.class).method("s_method").get() ); } @Test public void methodNullArguments() { Test6 test9 = new Test6(); ZJReflectUtils.reflect(test9).method("put", "key", "value"); assertTrue(test9.map.containsKey("key")); assertEquals("value", test9.map.get("key")); ZJReflectUtils.reflect(test9).method("put", "key", null); assertTrue(test9.map.containsKey("key")); assertNull(test9.map.get("key")); } @Test public void methodSuper() { TestHierarchicalMethodsSubclass subclass = new TestHierarchicalMethodsSubclass(); assertEquals( TestHierarchicalMethodsBase.PUBLIC_RESULT, ZJReflectUtils.reflect(subclass).method("pub_base_method", 1).get() ); assertEquals( TestHierarchicalMethodsBase.PRIVATE_RESULT, ZJReflectUtils.reflect(subclass).method("very_priv_method").get() ); } @Test public void methodDeclaring() { TestHierarchicalMethodsSubclass subclass = new TestHierarchicalMethodsSubclass(); assertEquals( TestHierarchicalMethodsSubclass.PRIVATE_RESULT, ZJReflectUtils.reflect(subclass).method("priv_method", 1).get() ); TestHierarchicalMethodsBase baseClass = new TestHierarchicalMethodsBase(); assertEquals( TestHierarchicalMethodsBase.PRIVATE_RESULT, ZJReflectUtils.reflect(baseClass).method("priv_method", 1).get() ); } @Test public void methodAmbiguity() { Test3 test; test = ZJReflectUtils.reflect(Test3.class).newInstance().method("method").get(); assertEquals(null, test.n); assertEquals(Test3.MethodType.NO_ARGS, test.methodType); test = ZJReflectUtils.reflect(Test3.class).newInstance().method("method", "abc").get(); assertEquals("abc", test.n); assertEquals(Test3.MethodType.OBJECT, test.methodType); test = ZJReflectUtils.reflect(Test3.class).newInstance().method("method", new Long("1")).get(); assertEquals(1L, test.n); assertEquals(Test3.MethodType.NUMBER, test.methodType); test = ZJReflectUtils.reflect(Test3.class).newInstance().method("method", 1).get(); assertEquals(1, test.n); assertEquals(Test3.MethodType.INTEGER, test.methodType); test = ZJReflectUtils.reflect(Test3.class).newInstance().method("method", 'a').get(); assertEquals('a', test.n); assertEquals(Test3.MethodType.OBJECT, test.methodType); } @Test public void field() { // instance field Test1 test1 = new Test1(); ZJReflectUtils.reflect(test1).field("I_INT1", 1); assertEquals(1, ZJReflectUtils.reflect(test1).field("I_INT1").get()); ZJReflectUtils.reflect(test1).field("I_INT2", 1); assertEquals(1, ZJReflectUtils.reflect(test1).field("I_INT2").get()); ZJReflectUtils.reflect(test1).field("I_INT2", null); assertNull(ZJReflectUtils.reflect(test1).field("I_INT2").get()); // static field ZJReflectUtils.reflect(Test1.class).field("S_INT1", 1); assertEquals(1, ZJReflectUtils.reflect(Test1.class).field("S_INT1").get()); ZJReflectUtils.reflect(Test1.class).field("S_INT2", 1); assertEquals(1, ZJReflectUtils.reflect(Test1.class).field("S_INT2").get()); ZJReflectUtils.reflect(Test1.class).field("S_INT2", null); assertNull(ZJReflectUtils.reflect(Test1.class).field("S_INT2").get()); // hierarchies field TestHierarchicalMethodsSubclass test2 = new TestHierarchicalMethodsSubclass(); ZJReflectUtils.reflect(test2).field("invisibleField1", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("invisibleField1").get()); ZJReflectUtils.reflect(test2).field("invisibleField2", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("invisibleField2").get()); ZJReflectUtils.reflect(test2).field("invisibleField3", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("invisibleField3").get()); ZJReflectUtils.reflect(test2).field("visibleField1", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("visibleField1").get()); ZJReflectUtils.reflect(test2).field("visibleField2", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("visibleField2").get()); ZJReflectUtils.reflect(test2).field("visibleField3", 1); assertEquals(1, ZJReflectUtils.reflect(test2).field("visibleField3").get()); } @Test public void fieldPrivate() { class Foo { private String bar; } Foo foo = new Foo(); ZJReflectUtils.reflect(foo).field("bar", "FooBar"); assertThat(foo.bar, Matchers.is("FooBar")); assertEquals("FooBar", ZJReflectUtils.reflect(foo).field("bar").get()); ZJReflectUtils.reflect(foo).field("bar", null); assertNull(foo.bar); assertNull(ZJReflectUtils.reflect(foo).field("bar").get()); } @Test public void fieldFinal() { // instance field Test8 test11 = new Test8(); ZJReflectUtils.reflect(test11).field("F_INT1", 1); assertEquals(1, ZJReflectUtils.reflect(test11).field("F_INT1").get()); ZJReflectUtils.reflect(test11).field("F_INT2", 1); assertEquals(1, ZJReflectUtils.reflect(test11).field("F_INT2").get()); ZJReflectUtils.reflect(test11).field("F_INT2", null); assertNull(ZJReflectUtils.reflect(test11).field("F_INT2").get()); // static field ZJReflectUtils.reflect(Test8.class).field("SF_INT1", 1); assertEquals(1, ZJReflectUtils.reflect(Test8.class).field("SF_INT1").get()); ZJReflectUtils.reflect(Test8.class).field("SF_INT2", 1); assertEquals(1, ZJReflectUtils.reflect(Test8.class).field("SF_INT2").get()); ZJReflectUtils.reflect(Test8.class).field("SF_INT2", null); assertNull(ZJReflectUtils.reflect(Test8.class).field("SF_INT2").get()); } @Test public void fieldPrivateStaticFinal() { assertEquals(1, ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I1").get()); assertEquals(1, ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I2").get()); ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I1", 2); ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I2", 2); assertEquals(2, ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I1").get()); assertEquals(2, ZJReflectUtils.reflect(TestPrivateStaticFinal.class).field("I2").get()); } @Test public void fieldAdvanced() { ZJReflectUtils.reflect(Test1.class) .field("S_DATA", ZJReflectUtils.reflect(Test1.class).newInstance()) .field("S_DATA") .field("I_DATA", ZJReflectUtils.reflect(Test1.class).newInstance()) .field("I_DATA") .field("I_INT1", 1) .field("S_INT1", 2); assertEquals(2, Test1.S_INT1); assertEquals(null, Test1.S_INT2); assertEquals(0, Test1.S_DATA.I_INT1); assertEquals(null, Test1.S_DATA.I_INT2); assertEquals(1, Test1.S_DATA.I_DATA.I_INT1); assertEquals(null, Test1.S_DATA.I_DATA.I_INT2); } @Test public void fieldFinalAdvanced() { ZJReflectUtils.reflect(Test8.class) .field("S_DATA", ZJReflectUtils.reflect(Test8.class).newInstance()) .field("S_DATA") .field("I_DATA", ZJReflectUtils.reflect(Test8.class).newInstance()) .field("I_DATA") .field("F_INT1", 1) .field("F_INT2", 1) .field("SF_INT1", 2) .field("SF_INT2", 2); assertEquals(2, Test8.SF_INT1); assertEquals(new Integer(2), Test8.SF_INT2); assertEquals(0, Test8.S_DATA.F_INT1); assertEquals(new Integer(0), Test8.S_DATA.F_INT2); assertEquals(1, Test8.S_DATA.I_DATA.F_INT1); assertEquals(new Integer(1), Test8.S_DATA.I_DATA.F_INT2); } @Test public void _hashCode() { Object object = new Object(); assertEquals(ZJReflectUtils.reflect(object).hashCode(), object.hashCode()); } @Test public void _toString() { Object object = new Object() { @Override public String toString() { return "test"; } }; assertEquals(ZJReflectUtils.reflect(object).toString(), object.toString()); } @Test public void _equals() { Object object = new Object(); ZJReflectUtils a = ZJReflectUtils.reflect(object); ZJReflectUtils b = ZJReflectUtils.reflect(object); ZJReflectUtils c = ZJReflectUtils.reflect(object); assertTrue(b.equals(a)); assertTrue(a.equals(b)); assertTrue(b.equals(c)); assertTrue(a.equals(c)); //noinspection ObjectEqualsNull assertFalse(a.equals(null)); } @Test public void testProxy() { assertEquals("abc", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(0)); assertEquals("bc", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(1)); assertEquals("c", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(2)); assertEquals("a", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(0, 1)); assertEquals("b", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(1, 2)); assertEquals("c", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(2, 3)); assertEquals("abc", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(0)); assertEquals("bc", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(1)); assertEquals("c", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(2)); assertEquals("a", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(0, 1)); assertEquals("b", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(1, 2)); assertEquals("c", ZJReflectUtils.reflect((Object) "abc").proxy(Test9.class).substring(2, 3)); } @Test public void testMapProxy() { class MyMap extends HashMap<String, Object> { private String baz; public void setBaz(String baz) { this.baz = "MyMap: " + baz; } public String getBaz() { return baz; } } Map<String, Object> map = new MyMap(); ZJReflectUtils.reflect(map).proxy(Test10.class).setFoo("abc"); assertEquals(1, map.size()); assertEquals("abc", map.get("foo")); assertEquals("abc", ZJReflectUtils.reflect(map).proxy(Test10.class).getFoo()); ZJReflectUtils.reflect(map).proxy(Test10.class).setBar(true); assertEquals(2, map.size()); assertEquals(true, map.get("bar")); assertEquals(true, ZJReflectUtils.reflect(map).proxy(Test10.class).isBar()); ZJReflectUtils.reflect(map).proxy(Test10.class).setBaz("baz"); assertEquals(2, map.size()); assertEquals(null, map.get("baz")); assertEquals("MyMap: baz", ZJReflectUtils.reflect(map).proxy(Test10.class).getBaz()); try { ZJReflectUtils.reflect(map).proxy(Test10.class).testIgnore(); fail(); } catch (ZJReflectUtils.ReflectException ignored) { } } }
[ "summer.zhou@webeye.com" ]
summer.zhou@webeye.com
ee98960220b1e1002cd6a3b5a2775ead28f39185
6878cae2bd26878cadf84b388d4bd69bcc0fc6e5
/src/test/java/TestCombineAlgoReadETL.java
8176b2b230e40fbd0f22e8e8c54ae08403e822cc
[]
no_license
shankhadeep-ghoshal/text-search-engine
1847d33f0909fb5eb1de959546458f0d6f169d36
f59f12b14a1d3d84a7a5275913faab265314e324
refs/heads/master
2020-12-01T01:46:53.388576
2019-12-31T03:02:27
2019-12-31T03:02:27
230,534,245
0
0
null
2019-12-31T03:02:28
2019-12-27T23:51:15
Java
UTF-8
Java
false
false
1,257
java
import algo.MatchTextPercentage; import etl.ETL; import file.io.FileDataReader; import org.junit.jupiter.api.Test; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.Locale; import java.util.Map; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; class TestCombineAlgoReadETL { @Test void testWordMatchInTextFile() { Map<String, Set<Integer>> obtainedResult = new ETL(new FileDataReader("src\\test\\resources\\test2.txt") .readDataFromSource()) .removeSpecialCharacters() .removeExtraWhitespace() .toLowerCase(Locale.getDefault()) .createWordMap() .getWordMap(); String[] pattern = "there is nothing wrong with your television set".split("\\s+"); double percentage = new MatchTextPercentage(obtainedResult, pattern) .calculatePercentageWordMatchInText(); DecimalFormat decimalFormat = new DecimalFormat("#.##"); decimalFormat.setRoundingMode(RoundingMode.CEILING); String result = decimalFormat.format(percentage); assertEquals("100", result); } }
[ "shankhadeepghoshal1996@gmail.com" ]
shankhadeepghoshal1996@gmail.com
b910b9270bd69836a5a1ed0dd840ea06d8d3ace9
e00b5c724b6a7fd518441d060478196ed4e04bb6
/SourceCode/src/fusion/comerger/general/gui/SelectCHWindows.java
d5c1e8cfe4f24f1dfefa7f763723861e638432af
[ "Apache-2.0" ]
permissive
fusion-jena/CoMerger
e6d05e68a08f8040a5f34b45ba4edf6c71baf1c5
1755e377afaaaaac852930b9e2a76328c8c74f07
refs/heads/master
2022-09-18T14:23:11.378545
2022-08-11T10:26:48
2022-08-11T10:26:48
196,254,234
2
0
Apache-2.0
2021-09-20T20:33:56
2019-07-10T18:13:23
Java
UTF-8
Java
false
false
14,546
java
package fusion.comerger.general.gui; /* * Please refer to https://github.com/fusion-jena/OAPT * Algergawy, Alsayed, Samira Babalou, Mohammad J. Kargar, and S. Hashem Davarpanah. "SeeCOnt: A new seeding-based clustering approach for ontology matching." In East European Conference on Advances in Databases and Information Systems, pp. 245-258. Springer, Cham, 2015. * 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. */ import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.GridBagLayout; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Label; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; import javax.swing.border.TitledBorder; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; import com.hp.hpl.jena.assembler.assemblers.AssemblerGroup.Frame; import fusion.comerger.algorithm.partitioner.SeeCOnt.CClustering; import fusion.comerger.algorithm.partitioner.SeeCOnt.EvaluationSeeCOnt; import fusion.comerger.algorithm.partitioner.SeeCOnt.Findk.ShowTree; import fusion.comerger.general.visualization.Visualization; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JTextArea; import javax.swing.JTree; import javax.swing.ListSelectionModel; import javax.swing.JScrollPane; import java.awt.event.ActionListener; public class SelectCHWindows { public static JFrame frmSelectIntractiveCh; public static JScrollPane CurrentCHScrollPane ; public static JScrollPane TreeScrollPane; public static JScrollPane ListScrollPane; public static JTextArea NumCHLabel; public static JTextArea CHLabel; public static JLabel StatusLabel; private JList<String> ItemList ; public static DefaultListModel<String> ListArrayCH = new DefaultListModel<>(); public static List<String> selectedValuesList; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SelectCHWindows window = new SelectCHWindows(); window.frmSelectIntractiveCh.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public SelectCHWindows() { initialize(); } public static void Show(){ frmSelectIntractiveCh.setVisible(true); } /** * Initialize the contents of the frame. */ private void initialize() { frmSelectIntractiveCh = new JFrame(); frmSelectIntractiveCh.setTitle("Select Intractive CH"); frmSelectIntractiveCh.setBounds(100, 100, 615, 726); frmSelectIntractiveCh.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); JPanel panel = new JPanel(); frmSelectIntractiveCh.getContentPane().add(panel, BorderLayout.CENTER); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0, 0, 0}; gbl_panel.rowHeights = new int[]{0, 85, 0, 0, 0}; gbl_panel.columnWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblNewLabel = new JLabel(""); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 1; gbc_lblNewLabel.gridy = 0; panel.add(lblNewLabel, gbc_lblNewLabel); JPanel panel_1 = new JPanel(); panel_1.setBorder(new TitledBorder(null, "Info", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.insets = new Insets(0, 0, 5, 5); gbc_panel_1.fill = GridBagConstraints.HORIZONTAL; gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 1; panel.add(panel_1, gbc_panel_1); GridBagLayout gbl_panel_1 = new GridBagLayout(); gbl_panel_1.columnWidths = new int[]{0, 0, 0}; gbl_panel_1.rowHeights = new int[]{0, 0, 0}; gbl_panel_1.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE}; gbl_panel_1.rowWeights = new double[]{1.0, 1.0, Double.MIN_VALUE}; panel_1.setLayout(gbl_panel_1); JLabel lblCurrentCh = new JLabel("Current Numbr of CH :"); GridBagConstraints gbc_lblCurrentCh = new GridBagConstraints(); gbc_lblCurrentCh.insets = new Insets(0, 0, 5, 5); gbc_lblCurrentCh.gridx = 0; gbc_lblCurrentCh.gridy = 0; panel_1.add(lblCurrentCh, gbc_lblCurrentCh); NumCHLabel = new JTextArea(); GridBagConstraints gbc_NumCHLabel = new GridBagConstraints(); gbc_NumCHLabel.insets = new Insets(0, 0, 5, 0); gbc_NumCHLabel.fill = GridBagConstraints.BOTH; gbc_NumCHLabel.gridx = 1; gbc_NumCHLabel.gridy = 0; panel_1.add(NumCHLabel, gbc_NumCHLabel); JLabel lblCurrentChs = new JLabel("Current CHs :"); GridBagConstraints gbc_lblCurrentChs = new GridBagConstraints(); gbc_lblCurrentChs.insets = new Insets(0, 0, 0, 5); gbc_lblCurrentChs.gridx = 0; gbc_lblCurrentChs.gridy = 1; panel_1.add(lblCurrentChs, gbc_lblCurrentChs); CurrentCHScrollPane = new JScrollPane(); GridBagConstraints gbc_CurrentCHScrollPane = new GridBagConstraints(); gbc_CurrentCHScrollPane.fill = GridBagConstraints.BOTH; gbc_CurrentCHScrollPane.gridx = 1; gbc_CurrentCHScrollPane.gridy = 1; panel_1.add(CurrentCHScrollPane, gbc_CurrentCHScrollPane); CHLabel = new JTextArea(); CurrentCHScrollPane.setViewportView(CHLabel); JPanel panel_2 = new JPanel(); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.insets = new Insets(0, 0, 5, 5); gbc_panel_2.fill = GridBagConstraints.BOTH; gbc_panel_2.gridx = 1; gbc_panel_2.gridy = 2; panel.add(panel_2, gbc_panel_2); GridBagLayout gbl_panel_2 = new GridBagLayout(); gbl_panel_2.columnWidths = new int[]{0, 0, 0}; gbl_panel_2.rowHeights = new int[]{0, 0, 0, 0}; gbl_panel_2.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE}; gbl_panel_2.rowWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE}; panel_2.setLayout(gbl_panel_2); JLabel lblH = new JLabel("Hierarchy View"); GridBagConstraints gbc_lblH = new GridBagConstraints(); gbc_lblH.insets = new Insets(0, 0, 5, 5); gbc_lblH.gridx = 0; gbc_lblH.gridy = 0; panel_2.add(lblH, gbc_lblH); JLabel lblNewLabel_2 = new JLabel("Order of Classes"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 0); gbc_lblNewLabel_2.gridx = 1; gbc_lblNewLabel_2.gridy = 0; panel_2.add(lblNewLabel_2, gbc_lblNewLabel_2); TreeScrollPane = new JScrollPane(); GridBagConstraints gbc_TreeScrollPane = new GridBagConstraints(); gbc_TreeScrollPane.fill = GridBagConstraints.BOTH; gbc_TreeScrollPane.insets = new Insets(0, 0, 5, 5); gbc_TreeScrollPane.gridx = 0; gbc_TreeScrollPane.gridy = 1; panel_2.add(TreeScrollPane, gbc_TreeScrollPane); // JTextArea TreeTextArea = new JTextArea(); JTree TreeTextArea= new JTree(); TreeScrollPane.setViewportView(TreeTextArea); ListScrollPane = new JScrollPane(); GridBagConstraints gbc_ListScrollPane = new GridBagConstraints(); gbc_ListScrollPane.fill = GridBagConstraints.BOTH; gbc_ListScrollPane.insets = new Insets(0, 0, 5, 0); gbc_ListScrollPane.gridx = 1; gbc_ListScrollPane.gridy = 1; panel_2.add(ListScrollPane, gbc_ListScrollPane); // ListScrollPane = new javax.swing.JScrollPane(ItemList); ItemList = new JList<>(ListArrayCH); ItemList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JTextArea ListTextArea = new JTextArea(); // ListScrollPane.setViewportView(ListTextArea);//? ListScrollPane.setViewportView(ItemList); JButton ApplyTreeButton = new JButton("Apply Selected CHs from Hierarchy"); GridBagConstraints gbc_ApplyTreeButton = new GridBagConstraints(); gbc_ApplyTreeButton.insets = new Insets(0, 0, 0, 5); gbc_ApplyTreeButton.gridx = 0; gbc_ApplyTreeButton.gridy = 2; panel_2.add(ApplyTreeButton, gbc_ApplyTreeButton); ApplyTreeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ApplyTreeButtonActionPerformed(evt); } }); JButton ApplyListButton = new JButton("Apply Seletcted CHs from List"); GridBagConstraints gbc_ApplyListButton = new GridBagConstraints(); gbc_ApplyListButton.gridx = 1; gbc_ApplyListButton.gridy = 2; panel_2.add(ApplyListButton, gbc_ApplyListButton); ApplyListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ApplyListButtonActionPerformed(evt); } }); JPanel panel_3 = new JPanel(); panel_3.setBorder(new TitledBorder(null, "Status", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel_3 = new GridBagConstraints(); gbc_panel_3.insets = new Insets(0, 0, 0, 5); gbc_panel_3.fill = GridBagConstraints.HORIZONTAL; gbc_panel_3.gridx = 1; gbc_panel_3.gridy = 3; panel.add(panel_3, gbc_panel_3); GridBagLayout gbl_panel_3 = new GridBagLayout(); gbl_panel_3.columnWidths = new int[]{0, 0, 0}; gbl_panel_3.rowHeights = new int[]{0, 0, 0}; gbl_panel_3.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE}; gbl_panel_3.rowWeights = new double[]{1.0, 0.0, Double.MIN_VALUE}; panel_3.setLayout(gbl_panel_3); StatusLabel = new JLabel("Click on Apply button to partition the ontology by new selected CH"); GridBagConstraints gbc_StatusLabel = new GridBagConstraints(); gbc_StatusLabel.gridwidth = 2; gbc_StatusLabel.insets = new Insets(0, 0, 5, 5); gbc_StatusLabel.gridx = 0; gbc_StatusLabel.gridy = 0; panel_3.add(StatusLabel, gbc_StatusLabel); JButton GraphButton = new JButton("View Ontology Graph"); GridBagConstraints gbc_GraphButton = new GridBagConstraints(); gbc_GraphButton.insets = new Insets(0, 0, 0, 5); gbc_GraphButton.gridx = 0; gbc_GraphButton.gridy = 1; panel_3.add(GraphButton, gbc_GraphButton); GraphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GraphButtonActionPerformed(evt); } }); JButton btnNewButton_3 = new JButton("Close"); btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frmSelectIntractiveCh.setVisible(false); } }); GridBagConstraints gbc_btnNewButton_3 = new GridBagConstraints(); gbc_btnNewButton_3.gridx = 1; gbc_btnNewButton_3.gridy = 1; panel_3.add(btnNewButton_3, gbc_btnNewButton_3); } private void ApplyTreeButtonActionPerformed(ActionEvent evt) { selectedValuesList = new ArrayList<String>(); String n = null; TreePath[] nodes = ShowTree.tree.getSelectionPaths (); if (nodes == null){ JOptionPane.showMessageDialog(null, "Please Select your CH", "Error", JOptionPane.ERROR_MESSAGE); }else{ n = nodes.length + " "; NumCHLabel.setText(n); CHLabel.setText(null); String allCH=null; for (int i = 0; i < nodes.length; i ++) { TreePath treePath = nodes[i]; DefaultMutableTreeNode node =(DefaultMutableTreeNode)treePath.getLastPathComponent (); String aw = node.getUserObject ().toString(); selectedValuesList.add(aw); if (allCH != null ) { allCH = allCH + " , " + aw; } else{ allCH = aw; } } CHLabel.setText(allCH); CClustering cc= new CClustering (); cc.StepsCClustering(1); //call from Apply button of adding CH (as an interactive process) //write finish successfully // StatusLabel.setText("Partitioning has been done by your "+ Coordinator.KNumCH + " cluster heads successfully."); //do evaluation for these new clustering EvaluationSeeCOnt.Evaluation_SeeCont(); OPATgui.NumCHTextField.setText(n); } } private void ApplyListButtonActionPerformed(ActionEvent evt) { selectedValuesList = ItemList.getSelectedValuesList(); if (selectedValuesList.size() > 0) { //Show info String n = selectedValuesList.size() + " "; NumCHLabel.setText(n); CHLabel.setText(null); String allCH=null; for (int i=0; i<selectedValuesList.size();i++){ if (allCH != null ) { allCH = allCH + " , " + selectedValuesList.get(i); } else{ allCH = selectedValuesList.get(i); } } CHLabel.setText(allCH); //Run SeeCONT with these new CHs //CentralClustering SeeCOntObj= new CentralClustering (); //SeeCOntObj.SeeCOntAlogorithm(1); //call from Apply button of adding CH (as an interactive process) //LinkedHashMap<Integer, Cluster> Clusters; //Clusters = SeeCOntObj.SeeCOntAlogorithm(1); //call from Apply button of adding CH (as an interactive process) CClustering cc= new CClustering (); cc.StepsCClustering(1); //call from Apply button of adding CH (as an interactive process) //write finish successfully StatusLabel.setText("Partitioning has been done by your "+ Coordinator.KNumCH + " cluster heads successfully."); //do evaluation for these new clustering EvaluationSeeCOnt.Evaluation_SeeCont(); OPATgui.NumCHTextField.setText(n); } else{ JOptionPane.showMessageDialog(null, "Please Select your CH", "Error", JOptionPane.ERROR_MESSAGE); } } private void GraphButtonActionPerformed(ActionEvent evt) { Coordinator.argVisulization = 2; Visualization.Run(Coordinator.argVisulization); //2 means call from CH selection panel } }
[ "samira_babalou@yahoo.com" ]
samira_babalou@yahoo.com
e5c192c5cf68f217d8a3ba5767d374a45c14dedd
2c1725c4165b612cbce64f4d26b3ecaea7323904
/eurekaclient/src/main/java/com/b19g3r/EurekaClientApplication.java
2e31a9ecbad1032fe52e045fdfb14e177b47588c
[]
no_license
b19g3r/springcloud-demo
58d7d45c419f5047082ef39fdeb42ff23044b478
f384935d5ce7fc8ddfb0700f72f69827aca71ce8
refs/heads/master
2022-04-30T22:08:38.710393
2019-09-11T16:14:27
2019-09-11T16:14:27
208,240,547
0
0
null
2022-03-31T18:54:26
2019-09-13T10:11:34
Java
UTF-8
Java
false
false
411
java
package com.b19g3r; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * provider * @author b19g3r * @version v0.1 * @date 2019-09-08 10:55 PM */ @SpringBootApplication public class EurekaClientApplication { public static void main(String[] args) { SpringApplication.run(EurekaClientApplication.class, args); } }
[ "b19g3r@gmail.com" ]
b19g3r@gmail.com
5007a7e08d15559edb79aa019a184ff0357aae83
34b4759afb01c21c023da4a0f2008e21ba888003
/app/src/main/java/com/nihon/aki2/mydb/dbqaid.java
a538e208427e2580504cba739787174f4a249f0b
[]
no_license
cool3690/nihogo
821ed316f21efe0564407bb53403625e6171c808
86af556973f21a6e5f1468f256311618d082f8a2
refs/heads/master
2023-08-30T01:02:02.004200
2021-11-12T02:10:46
2021-11-12T02:10:46
212,526,234
0
0
null
2021-11-12T02:10:48
2019-10-03T08:02:29
Java
UTF-8
Java
false
false
1,839
java
package com.nihon.aki2.mydb; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; public class dbqaid { public static String executeQuery(String mych) { String result = ""; try { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("https://kei-sei.com/cram/qaid.php"); ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("mych", mych)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse httpResponse = httpClient.execute(httpPost); //view_account.setText(httpResponse.getStatusLine().toString()); HttpEntity httpEntity = httpResponse.getEntity(); InputStream inputStream = httpEntity.getContent(); BufferedReader bufReader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"), 8); StringBuilder builder = new StringBuilder(); String line = null; while((line = bufReader.readLine()) != null) { builder.append(line + "\n"); } inputStream.close(); result = builder.toString(); } catch(Exception e) { // Log.e("log_tag", e.toString()); } return result; } }
[ "cool3690@yahoo.com.tw" ]
cool3690@yahoo.com.tw
6a7bb238de661a4ecfa1800c6242dbc00926ef73
b2ecf5f0902b188eedfd633fdef7ccdfcb638325
/wikicorpus-web/src/main/java/org/cloudgraph/examples/wikicorpus/web/util/WebConstants.java
0543e16985c99d8daa62d931eac6d8fba7dad742
[]
no_license
cloudgraph/wikicorpus
1e1469084996fd16f0c6d14c775c0e191042beac
44d900cbfd1e045490a99e075da8bc5e962b564a
refs/heads/master
2021-01-10T21:04:41.131378
2014-04-11T14:25:44
2014-04-11T14:25:44
18,268,507
1
0
null
null
null
null
UTF-8
Java
false
false
806
java
package org.cloudgraph.examples.wikicorpus.web.util; /** */ public interface WebConstants { public static final String BUNDLE_BASENAME = "bundles.AppResources"; public static final int RECORDS_TO_FETCH = 25; public static boolean LOCAL = false; public static final String DEFAULT_SELECTION = "--not selected--"; public static final String ANY_SELECTION = "--any--"; public static String RESOURCE_DASHBOARD_SATUS = "aplsDashboardStatus"; public static final String URL_ERROR_FORWARD = "/apls/ErrorHandler.faces"; public static final String URL_DASHBOARD = "Dashboard.faces"; public static String DATE_FORMAT_CHART = "MM/dd/yyyy"; public static String RESOURCE_DASHBOARD_SATUS_PREFIX = "appDashboardStatus_"; }
[ "scinnamond@gmail.com" ]
scinnamond@gmail.com
2066532c1b027f23d9f71dc775a0a2e8c83e912f
fa5ced6f5a5c5bff19e87414e0277de1a5436f4d
/src/main/java/com/rcx/materialis/modules/ModuleAvaritia.java
f2af2ab8d8221d9309901040c5ffe97c745bb545
[]
no_license
maverag/Materialis
be3431876479255036c3e74f6b6f7367a3aa322c
110aac345b62be410785fb73ca0a8f954cdc8af6
refs/heads/master
2023-06-17T12:57:04.429121
2021-04-18T10:54:32
2021-04-18T10:54:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,720
java
package com.rcx.materialis.modules; import com.rcx.materialis.MaterialisConfig; import com.rcx.materialis.Util; import com.rcx.materialis.modifiers.ModInfinity; import com.rcx.materialis.traits.MaterialisTraits; import com.rcx.materialis.traits.TraitCosmic; import com.rcx.materialis.traits.armor.MaterialisArmorTraits; import c4.conarm.lib.materials.ArmorMaterialType; import c4.conarm.lib.materials.CoreMaterialStats; import c4.conarm.lib.materials.PlatesMaterialStats; import c4.conarm.lib.materials.TrimMaterialStats; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.event.RegistryEvent.Register; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.materials.BowMaterialStats; import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.HandleMaterialStats; import slimeknights.tconstruct.library.materials.HeadMaterialStats; import slimeknights.tconstruct.library.materials.Material; import slimeknights.tconstruct.library.modifiers.Modifier; public class ModuleAvaritia implements IModule { public static Material crystalMatrix = new Material("crystal_matrix", 0x97F1EB); public static Material neutronium = new Material("cosmic_neutronium", 0x6B6B6B); public static Material infinity = new Material("infinity", 0xFF5555); public static Modifier modInfinity; @Override public Boolean shouldLoad() { return Loader.isModLoaded(this.getName()) && !MaterialisConfig.blacklist.isModuleBlacklisted(this.getName()); } @Override public String getName() { return "avaritia"; } @Override public void earlyPreInit(FMLPreInitializationEvent preEvent) {} @Override public void preInit(FMLPreInitializationEvent preEvent) { if (TinkerRegistry.getTrait(TraitCosmic.id) == null) MaterialisTraits.cosmic = new TraitCosmic(); if (!MaterialisConfig.blacklist.isMaterialBlacklisted("crystal_matrix")) { crystalMatrix.addTrait(MaterialisTraits.crystalline); TinkerRegistry.addMaterial(crystalMatrix); TinkerRegistry.addMaterialStats(crystalMatrix, new ExtraMaterialStats(600)); if (ModuleConarm.loadArmor()) { TinkerRegistry.addMaterialStats(crystalMatrix, new TrimMaterialStats(40)); crystalMatrix.addTrait(MaterialisArmorTraits.crystalline, ArmorMaterialType.TRIM); } } if (!MaterialisConfig.blacklist.isMaterialBlacklisted("cosmic_neutronium")) { neutronium.addTrait(MaterialisTraits.supermassive); TinkerRegistry.addMaterial(neutronium); TinkerRegistry.addMaterialStats(neutronium, new HeadMaterialStats(765, 10.98F, 1.0F, 4), new HandleMaterialStats(2.5F, 100), new ExtraMaterialStats(400), new BowMaterialStats(0.5F, 1.3F, 5.0F)); if (ModuleConarm.loadArmor()) { ModuleConarm.generateArmorStats(neutronium, 3.0F); neutronium.addTrait(MaterialisArmorTraits.supermassive, ArmorMaterialType.CORE); neutronium.addTrait(MaterialisArmorTraits.supermassive, ArmorMaterialType.PLATES); neutronium.addTrait(MaterialisArmorTraits.supermassive, ArmorMaterialType.TRIM); } } if (!MaterialisConfig.blacklist.isMaterialBlacklisted("infinity")) { infinity.addTrait(MaterialisTraits.cosmic); infinity.addTrait(MaterialisTraits.unbreakable); TinkerRegistry.addMaterial(infinity); TinkerRegistry.addMaterialStats(infinity, new HeadMaterialStats(9999, 99999.99F, 99.9F, 99), new HandleMaterialStats(10.0F, 999), new ExtraMaterialStats(999), new BowMaterialStats(9999.9F, 999.91F, 99.9F)); if (ModuleConarm.loadArmor()) { TinkerRegistry.addMaterialStats(infinity, new CoreMaterialStats(9999, 999.9F), new PlatesMaterialStats(10.0F, 999, 99.9F), new TrimMaterialStats(999)); infinity.addTrait(MaterialisArmorTraits.cosmic, ArmorMaterialType.CORE); infinity.addTrait(MaterialisArmorTraits.cosmic, ArmorMaterialType.PLATES); infinity.addTrait(MaterialisArmorTraits.cosmic, ArmorMaterialType.TRIM); infinity.addTrait(MaterialisArmorTraits.unbreakable, ArmorMaterialType.CORE); infinity.addTrait(MaterialisArmorTraits.unbreakable, ArmorMaterialType.PLATES); infinity.addTrait(MaterialisArmorTraits.unbreakable, ArmorMaterialType.TRIM); } } modInfinity = new ModInfinity(); } @Override public void registerItems(Register<Item> event) {} @Override public void init(FMLInitializationEvent event) { if (!MaterialisConfig.blacklist.isMaterialBlacklisted("crystal_matrix")) { crystalMatrix.addCommonItems("CrystalMatrix"); crystalMatrix.setRepresentativeItem(new ItemStack(Util.getItem("avaritia", "resource"), 1, 1)); crystalMatrix.setCraftable(true); } if (!MaterialisConfig.blacklist.isMaterialBlacklisted("cosmic_neutronium")) { neutronium.addCommonItems("CosmicNeutronium"); neutronium.setRepresentativeItem(new ItemStack(Util.getItem("avaritia", "resource"), 1, 4)); neutronium.setCraftable(true); } if (!MaterialisConfig.blacklist.isMaterialBlacklisted("infinity")) { infinity.addItem("ingotInfinity", 1, Material.VALUE_Nugget * 2); infinity.addItem("blockInfinity", 1, Material.VALUE_Ingot * 2); infinity.setRepresentativeItem(new ItemStack(Util.getItem("avaritia", "resource"), 1, 6)); infinity.setCraftable(true); } modInfinity.addItem(new ItemStack(Util.getItem("avaritia", "resource"), 1, 5), 1, 1); } @Override public void postInit(FMLPostInitializationEvent postEvent) {} }
[ "rcxcrafter@gmail.com" ]
rcxcrafter@gmail.com
c7c21df48fc2e215ca9d45b0a18df83729a85616
1dedd17742c71415048b9307859a65beeb58ae1c
/src/com/ideamoment/ideadata/annotation/Ref.java
091c78a2a720653766fd67a1d87a31fbe07f3ea5
[]
no_license
chinakite/ideajdbc
a2b57520620606a741b73579b8b2322322f7b3dc
c107eebe1f8840187bfb3bcd6ab2227b3d28b6bc
refs/heads/master
2021-01-17T07:19:04.143896
2016-05-29T23:39:27
2016-05-29T23:39:27
25,961,130
0
3
null
2015-03-05T14:46:23
2014-10-30T08:19:14
Java
UTF-8
Java
false
false
644
java
/* * IdeaJdbc is a JDBC Data Access Framework. It depends on IdeaData Framework. * * copyright © www.ideamoment.com */ package com.ideamoment.ideadata.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author Chinakite * */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Ref { public Class entityClass() default UNSPEC_CLASS.class; public String refProp() default ""; public String dataItem() default ""; }
[ "chinakite.zhang@gmail.com" ]
chinakite.zhang@gmail.com
bf6cbf674268ba82ff15269fb92aaf81f20aeceb
cd3e2c0dcd5c4eddc65930bdc4e76820b2dc64d5
/gulimall-product/src/main/java/com/gulimall/product/service/impl/SkuInfoServiceImpl.java
6d2496ee337de096907897df74bf8d7acbe18691
[ "Apache-2.0" ]
permissive
li-jiafang/gulimall
9280d5fa16f001ac61102f219b4b8d001ecb1115
09dd62f947bb5c3ed159fc84ca000fafbda8bf21
refs/heads/master
2023-07-31T08:48:40.343031
2021-09-06T06:30:12
2021-09-06T06:30:12
384,025,848
0
0
null
null
null
null
UTF-8
Java
false
false
2,630
java
package com.gulimall.product.service.impl; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gulimall.common.utils.PageUtils; import com.gulimall.common.utils.Query; import com.gulimall.product.dao.SkuInfoDao; import com.gulimall.product.entity.SkuInfoEntity; import com.gulimall.product.service.SkuInfoService; import org.springframework.util.StringUtils; @Service("skuInfoService") public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoDao, SkuInfoEntity> implements SkuInfoService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<SkuInfoEntity> page = this.page( new Query<SkuInfoEntity>().getPage(params), new QueryWrapper<SkuInfoEntity>() ); return new PageUtils(page); } @Override public void saveSkuInfo(SkuInfoEntity skuInfoEntity) { this.baseMapper.insert(skuInfoEntity); } @Override public PageUtils queryPageByCondition(Map<String, Object> params) { QueryWrapper<SkuInfoEntity> queryWrapper = new QueryWrapper<>(); String key = (String) params.get("key"); if (!StringUtils.isEmpty(key)) { queryWrapper.and(wrpper->{ wrpper.eq("sku_id", key).or().like("sku_name", key); }); } String catelogId = (String) params.get("catelogId"); if (!StringUtils.isEmpty(catelogId) && !"0".equals(catelogId)) { queryWrapper.eq("catalog_id", catelogId); } String brandId = (String) params.get("brandId"); if (!StringUtils.isEmpty(brandId) && !"0".equals(brandId)) { queryWrapper.eq("brand_id", brandId); } String min = (String) params.get("min"); if (!StringUtils.isEmpty(min)) { BigDecimal minDecimal = new BigDecimal(min); if (minDecimal.compareTo(new BigDecimal(0))==1) queryWrapper.ge("price", min); } String max = (String) params.get("max"); if (!StringUtils.isEmpty(max)) { BigDecimal maxDecimal = new BigDecimal(max); if (maxDecimal.compareTo(new BigDecimal(0))==1) { queryWrapper.le("price", maxDecimal); } } IPage<SkuInfoEntity> page = this.page(new Query<SkuInfoEntity>().getPage(params), queryWrapper); return new PageUtils(page); } }
[ "ljfsunlight@gmail.com" ]
ljfsunlight@gmail.com
420d8c42466586c1332dc87f22e79d028775dd29
bfae652e6244596f8e219106231fdc01ce088274
/MorseTranslatorAndroidApp/app/src/test/java/lab6/jakobczyk/michal/java/polsl/pl/morseapp/LatinSignsTest.java
5cd0adee0eecd74012cc1968ca938b0398a52350
[]
no_license
mjakobczyk/MorseTranslator
4ae9d2a3befe60ae31eee92dc0c3e5cfa6b5b171
450a52399016be7031f90c8d72d1dc2d7a8110ff
refs/heads/master
2021-04-15T09:47:53.776811
2018-04-02T13:59:03
2018-04-02T13:59:03
126,876,341
0
0
null
null
null
null
UTF-8
Java
false
false
2,367
java
package lab6.jakobczyk.michal.java.polsl.pl.morseapp; import org.junit.*; import lab6.jakobczyk.michal.java.polsl.pl.morseapp.model.LatinSigns; import static org.junit.Assert.*; /** * Test for class LatinSigns * @author Michał Jakóbczyk * @version 2.0 */ public class LatinSignsTest { /** * Instance of the MorseSigns class */ private LatinSigns instance; /** * Initialization of the instance before testing */ @Before public void init() { instance = new LatinSigns(); } /** * Test of searchValue method of the class LatinSigns. * Tests whether the given sign exists in the sign system. * */ @Test public void testSearchValue() { assertTrue(instance.searchValue("a")); assertFalse(instance.searchValue("aa")); assertTrue(instance.searchValue("b")); assertTrue(instance.searchValue("3")); assertTrue(instance.searchValue("/")); assertFalse(instance.searchValue("ab")); assertFalse(instance.searchValue(" /")); assertFalse(instance.searchValue("ą")); assertFalse(instance.searchValue(" .")); assertFalse(instance.searchValue("***")); } /** * Test of getIndexOfValue method of the class LatinsSigns. * Tests whether the index of the given value is as it should * be in the original system. */ @Test public void testGetIndexOfValue() { assertEquals(0, instance.getIndexOfValue("a")); assertEquals(1, instance.getIndexOfValue("b")); assertEquals(51, instance.getIndexOfValue("@")); assertNotEquals(-1, instance.getIndexOfValue("a")); assertNotEquals(52, instance.getIndexOfValue(".--.-.")); assertNotEquals(100, instance.getIndexOfValue("(")); } /** * Test of getValue method of the class LatinSigns. Tests * whether the returning value from the given index is the * same as the value in the original system. */ @Test public void testGetValue() { assertEquals("a", instance.getValue(0)); assertEquals("b", instance.getValue(1)); assertEquals("@", instance.getValue(51)); assertNotEquals("a", instance.getValue(51)); assertNotEquals("@", instance.getValue(0)); assertNotEquals(" ", instance.getValue(44)); } }
[ "m.jakob@wp.pl" ]
m.jakob@wp.pl
1407fa59d520b00d6c21620bb72c037541b28ef7
05cb658138cc988654e1c22a20b3919e64d2c464
/src/main/java/com/js/cluster/nginx/backserver/controllerex/CurrencyInfoControllerEx.java
b048371b2b497549e71cf29a73cff6954fc5f19f
[]
no_license
xiexlp/jfinal_demo_for_maven_backserver
85fdc55112a3644a04c7c7664dfb780dea85a0c1
c0c0b137665f3fd1cdeb6224f1c70daffc1fbb75
refs/heads/master
2022-10-08T07:58:59.125793
2019-07-24T09:00:33
2019-07-24T09:00:33
198,597,524
0
0
null
2022-10-06T06:10:47
2019-07-24T08:59:39
Lex
UTF-8
Java
false
false
14,441
java
package com.js.cluster.nginx.backserver.controllerex; import com.js.common.util.ControllerAdaper; import com.js.common.util.PageList; import com.js.isearch.orm.CurrencyInfo; import com.js.isearch.serv.CurrencyInfoServ; import com.js.isearch.servread.CurrencyInfoServRead; import java.util.List; import java.sql.Timestamp; import java.sql.Date; public class CurrencyInfoControllerEx extends ControllerAdaper { public void currencyInfonew(){ String method = getRequest().getMethod(); if(method.equalsIgnoreCase("GET")) { //List<Group> groups = GroupServ.n().findAll(); // setAttr("groups",groups); //List<Manufacturer> manus = ManufacturerServ.n().findAll(); //System.out.println("manus size:"+manus.size()); //setAttr("manus",manus); //render("currencyInfonew.html"); }else if(method.equalsIgnoreCase("POST")){ //User user = getUserFromRequest(); CurrencyInfo currencyInfo= getCurrencyInfoFromRequest(); //int r = UserServ.n().saveAutoId(user); int r=CurrencyInfoServ.n().saveAutoId(currencyInfo); if(r>0){ redirect("/boot/currencyInfo/currencyInfos"); }else { System.out.println("新增失败"); } } } public void currencyInfoPartAdd(){ String method = getRequest().getMethod(); if(method.equalsIgnoreCase("GET")) { //List<Group> groups = GroupServ.n().findAll(); // setAttr("groups",groups); //List<Manufacturer> manus = ManufacturerServ.n().findAll(); //System.out.println("manus size:"+manus.size()); //setAttr("manus",manus); //render("currencyInfonew.html"); }else if(method.equalsIgnoreCase("POST")){ //User user = getUserFromRequest(); CurrencyInfo currencyInfo= getCurrencyInfoFromRequest(); //int r = UserServ.n().saveAutoId(user); int r=CurrencyInfoServ.n().saveAutoId(currencyInfo); if(r>0){ redirect("/boot/currencyInfo/currencyInfos"); }else { System.out.println("新增失败"); } } } public void currencyInfoedit(){ String method = getRequest().getMethod(); if(method.equalsIgnoreCase("GET")) { //List<Manufacturer> manus = ManufacturerServ.n().findAll(); //System.out.println("manus size:"+users.size()); //List<Group> groups = GroupServ.n().findAll(); //System.out.println("group size:"+groups.size()); //int userID= getIntPara("userID", 1); int currencyId = getIntPara("currencyId",1); if(currencyId==0) { System.out.println("出错"); return; } CurrencyInfo currencyInfo = CurrencyInfoServ.n().get(currencyId); //setAttr("groups",groups); setAttr("currencyInfo",currencyInfo); //render("currencyInfoedit.html"); }else if(method.equalsIgnoreCase("POST")){ CurrencyInfo currencyInfo = getCurrencyInfoFromRequestEdit(); if(currencyInfo==null) { System.out.println("id不存在"); return; } CurrencyInfoServ currencyInfoServ = CurrencyInfoServ.n(); int r=0; r=currencyInfoServ.update(currencyInfo); if(r>0) redirect("/boot/currencyInfo/currencyInfos"); else { System.out.println("出错"); } } } public void currencyInfoPartUpdate(){ String method = getRequest().getMethod(); if(method.equalsIgnoreCase("GET")) { int currencyId = getIntPara("currencyId",1); if(currencyId==0) { System.out.println("出错"); return; } CurrencyInfo currencyInfo = CurrencyInfoServ.n().get(currencyId); setAttr("currencyInfo",currencyInfo); }else if(method.equalsIgnoreCase("POST")){ CurrencyInfo currencyInfo = getCurrencyInfoFromRequestEdit(); if(currencyInfo==null) { System.out.println("id不存在"); return; } CurrencyInfoServ currencyInfoServ = CurrencyInfoServ.n(); int r=0; r=currencyInfoServ.update(currencyInfo); if(r>0) redirect("/boot/currencyInfo/currencyInfos"); else { System.out.println("出错"); } } } //controller list方法,放在controller里面 public void currencyInfolist(){ int pageNo = getIntPara("pageNo",1); PageList<CurrencyInfo> currencyInfolist = CurrencyInfoServ.n().findByPage(pageNo,21); setAttr("currencyInfolist", currencyInfolist); System.out.println("list size:" + currencyInfolist.size()); String actionUrl = "currencyInfolist?1=1"; setPageInfo(currencyInfolist, actionUrl); //render("currencyInfolist.html"); } //controller list方法,放在controller里面 public void currencyInfoPartPage() { int pageNo = getIntPara("pageNo", 1); String sortBy = getStrPara("sortBy",""); int sort = getIntPara("sort",0); int pageSize = getIntPara("pageSize",100); //PageList<CurrencyInfo> currencyInfolist = CurrencyInfoServ.n().findByPage(pageNo, 21); // CurrencyStatus currencyStatus = CurrencyStatusServ.n().get(1); // long priceBatchTime = currencyStatus.getPriceLastBatchTime(); // int panelNum = currencyStatus.getPricePanelNum(); long total= 201; PageList<CurrencyInfo> currencyInfolist = CurrencyInfoServRead.n().findByPage(pageNo,(int)total); // String priceBatchTimeFormat = TimeUtil.getTimeFormat(priceBatchTime,TimeUtil.DATE_FORMAT); //setAttr("priceBatchTimeFormat", priceBatchTimeFormat); setAttr("total", total); setAttr("sortBy",sortBy); setAttr("sort",sort); setAttr("currencyInfolist", currencyInfolist); System.out.println("list size:" + currencyInfolist.size()); String actionUrl = "currencyInfoPartPage?1=1"; setPageInfo(currencyInfolist, actionUrl); //render("currencyPrices.html"); } //放在controller delete方法 public void currencyInfodel(){ //int departID = getIntPara("departID",0); int currencyId = getIntPara("currencyId",1); if(currencyId==0) { System.out.println("出错"); return; } int r = CurrencyInfoServ.n().delete(currencyId); if(r>0) redirect("/boot/currencyInfo/currencyInfolist"); } public CurrencyInfo getCurrencyInfoFromRequest(){ CurrencyInfo currencyInfo = new CurrencyInfo(); String name = getStrPara("name",""); currencyInfo.setName(name); String symbol = getStrPara("symbol",""); currencyInfo.setSymbol(symbol); long volume=getLongPara("volume",0); currencyInfo.setVolume(volume); long circulatingVolume=getLongPara("circulatingVolume",0); currencyInfo.setCirculatingVolume(circulatingVolume); double initPrice = getDoublePara("initPrice",0); currencyInfo.setInitPrice(initPrice); long initDate=getLongPara("initDate",0); currencyInfo.setInitDate(initDate); String url = getStrPara("url",""); currencyInfo.setUrl(url); String currencyDesc = getStrPara("currencyDesc",""); currencyInfo.setCurrencyDesc(currencyDesc); int srcWebId=getIntPara("srcWebId",0); currencyInfo.setSrcWebId(srcWebId); String currencyIdName = getStrPara("currencyIdName",""); currencyInfo.setCurrencyIdName(currencyIdName); String detailLink = getStrPara("detailLink",""); currencyInfo.setDetailLink(detailLink); String masterLink = getStrPara("masterLink",""); currencyInfo.setMasterLink(masterLink); return currencyInfo; } public CurrencyInfo getCurrencyInfoFromRequestEdit(){ CurrencyInfo currencyInfo = new CurrencyInfo(); int currencyId=getIntPara("currencyId",0); currencyInfo.setCurrencyId(currencyId); String name = getStrPara("name",""); currencyInfo.setName(name); String symbol = getStrPara("symbol",""); currencyInfo.setSymbol(symbol); long volume=getLongPara("volume",0); currencyInfo.setVolume(volume); long circulatingVolume=getLongPara("circulatingVolume",0); currencyInfo.setCirculatingVolume(circulatingVolume); double initPrice = getDoublePara("initPrice",0); currencyInfo.setInitPrice(initPrice); long initDate=getLongPara("initDate",0); currencyInfo.setInitDate(initDate); String url = getStrPara("url",""); currencyInfo.setUrl(url); String currencyDesc = getStrPara("currencyDesc",""); currencyInfo.setCurrencyDesc(currencyDesc); int srcWebId=getIntPara("srcWebId",0); currencyInfo.setSrcWebId(srcWebId); String currencyIdName = getStrPara("currencyIdName",""); currencyInfo.setCurrencyIdName(currencyIdName); String detailLink = getStrPara("detailLink",""); currencyInfo.setDetailLink(detailLink); String masterLink = getStrPara("masterLink",""); currencyInfo.setMasterLink(masterLink); return currencyInfo; } }
[ "pkuping@foxmail.com" ]
pkuping@foxmail.com
148e75afebbecd7359581e66bcee3f309fa42271
09a86ad8475605468c3a4ed7c7faef4715f454cb
/day01_eesy_05DI/src/main/java/com/itzjx/service/impl/AccountServiceImpl3.java
fe3b09d6d837b1ec1eeaf94163cc065caba4cdbb
[]
no_license
zjx1015288314/spring-study0407
ad1d4642f1719f5bc1906b05599ae9263ef3b0cd
a5361c45dc0deafbc5f1cc2d9fd6acfe4837e8e8
refs/heads/master
2022-06-28T07:09:48.545958
2020-04-06T18:05:42
2020-04-06T18:05:42
253,575,948
0
0
null
2022-06-21T03:09:17
2020-04-06T17:58:31
Java
UTF-8
Java
false
false
1,027
java
package com.itzjx.service.impl; import com.itzjx.service.IAccountService; import java.util.*; /** * 账户的业务层实现类 */ public class AccountServiceImpl3 implements IAccountService { private String[] myStrs; private List<String> myList; private Set<String> mySet; private Map<String,String> myMap; private Properties myProps; public void setMyStrs(String[] myStrs) { this.myStrs = myStrs; } public void setMyList(List<String> myList) { this.myList = myList; } public void setMySet(Set<String> mySet) { this.mySet = mySet; } public void setMyMap(Map<String, String> myMap) { this.myMap = myMap; } public void setMyProps(Properties myProps) { this.myProps = myProps; } public void saveAccount() { System.out.println(Arrays.toString(myStrs)); System.out.println(myList); System.out.println(mySet); System.out.println(myMap); System.out.println(myProps); } }
[ "1015288314@qq.com" ]
1015288314@qq.com
4fd9d72d21e62ea97c8c65093d828f64b909327f
56682430d842d5032c13818c5c1015f4423f3d29
/src/com/example/TestAndroid/AvatarDialog.java
2756bcca333f4c01ff1f81fc54d015a3bad5501d
[]
no_license
HubUser/TestAndroid
cb209c73d0869a9a3dd79cf36c1bf8b6fcb5f132
38aa2602aa18091641093d365327b083b8637a8c
refs/heads/master
2016-09-03T07:29:05.320854
2013-04-14T14:37:41
2013-04-14T14:37:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,944
java
package com.example.TestAndroid; import android.app.Dialog; import android.content.Context; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import com.nostra13.universalimageloader.imageloader.DisplayImageOptions; import com.nostra13.universalimageloader.imageloader.ImageLoader; import java.util.ArrayList; /** * Created with IntelliJ IDEA. * User: veal * Date: 4/14/13 * Time: 3:44 PM * To change this template use File | Settings | File Templates. */ public class AvatarDialog extends Dialog { private Context _context; private DisplayImageOptions options; ArrayList<String> urls; public AvatarDialog(Context context) { super(context); this._context = context; setContentView(R.layout.avatardialog); ListView avatarList = (ListView) findViewById(R.id.avatarlist); urls = new ArrayList<String>(); for (int i = 1; i < 13; i++) { if (i < 9) urls.add("http://onoapps.com/Dev/" + "avatars/a0" + i + ".png"); else urls.add("http://onoapps.com/Dev/" + "avatars/a" + i + ".png"); } options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.stub_image) .cacheInMemory() .cacheOnDisc() .build(); avatarList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { ImageLoader.getInstance().displayImage(urls.get(i), ((MyActivity) _context).getAvatarView(), options, null); ((MyActivity) _context).onAvatarSelected(urls.get(i)); dismiss(); } }); avatarList.setAdapter(new AvatarAdapter(context, urls, ImageLoader.getInstance())); } }
[ "veal@veal-K56CM" ]
veal@veal-K56CM
25fbd5e3dac9c2a78158db2ac9c80fceeec85a97
2b6af69fc4ee77342bda04abf886d1bf8cca9300
/src/main/java/com/ag/framework/utilities/Common.java
894647756ae7ec3335d51711459ede9afc0847d2
[]
no_license
agnasser56/JavaFW
cf70beb875d15e3ed875c09a5ec7aebf4728f151
cbf31fb2ae81e3451afc1b25361dcd4fbca36b4b
refs/heads/master
2020-04-19T17:27:16.658978
2019-01-30T11:58:56
2019-01-30T11:58:56
168,335,538
0
0
null
null
null
null
UTF-8
Java
false
false
5,468
java
package com.ag.framework.utilities; import com.ag.framework.core.DataManager; import com.ag.framework.core.Global; import com.relevantcodes.extentreports.LogStatus; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.testng.asserts.Assertion; import org.testng.asserts.SoftAssert; import java.io.File; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Hashtable; import java.util.List; public class Common { private static SoftAssert softAssert = new SoftAssert(); private Assertion hardAssert = new Assertion(); private static void SwapArgs(String min, String max) { String temp; temp = min; min = max; max = temp; } public static List<String> GetIterations(String sIterations, String Separator) { List<String> arrIterations = new ArrayList<String>(); try { String min, max; String[] swap; int i, j; String[] arrRange; String[] arrTmp = sIterations.split(Separator); for (i = 0; i < arrTmp.length; i++) { arrRange = arrTmp[i].split("-"); if (arrRange.length > 1) { min = arrRange[0]; max = arrRange[1]; if (Integer.parseInt(min) > Integer.parseInt(max)) { String temp; temp = min; min = max; max = temp; // SwapArgs(min, max); } for (j = Integer.parseInt(min); j <= Integer.parseInt(max); j++) { arrIterations.add(String.valueOf(j)); } } else arrIterations.add(arrTmp[i]); } return arrIterations; } catch (Exception ex) { return arrIterations; } } public static boolean IsExist(List<WebElement> webElement) { if (webElement.size() != 0) return true; else return false; } public static void VerifyCheckPoint(Boolean IsPositiveScenario, List<WebElement> successMsg, List<WebElement> errorMessage) { String newLine = System.getProperty("line.separator"); if (IsPositiveScenario == true) { if (successMsg.size() != 0) { Global.reporter.log(LogStatus.INFO, newLine+"Expected Result: Success Message Found" + newLine + "Actual Result: Success Message Found: "+successMsg.get(1) + "\n"); softAssert.assertTrue(true, newLine+"Expected Result: Success Message Found" + "\n" + "Actual Result: Success Message Found" + newLine); softAssert.assertAll(); } else { softAssert.assertTrue(false, newLine+"Expected Result: Success Message Found" + newLine + "Actual Result: Success Message not Found" + newLine); softAssert.assertAll(); } //softAssert.assertEquals(successMsg,displayMessage); } else { if (errorMessage.size() != 0) { Global.reporter.log(LogStatus.INFO, newLine+"Expected Result: Error Message Found" + "\n" + "Actual Result: Error Message Found: "+errorMessage.get(1) + newLine); softAssert.assertTrue(true, newLine+"Expected Result: Error Message Found" + "\n" + "Actual Result: Error Message Found" + newLine); softAssert.assertAll(); } else { softAssert.assertTrue(false, newLine+"Expected Result: Error Message Found" + "\n" + "Actual Result: Error Message not Found" + newLine); softAssert.assertAll(); } //softAssert.assertEquals(errorMessage,displayMessage); } } public static String GetTestEnvironment(String Name) throws SQLException { String GetName = null; String GetValue = null; try { Hashtable<Integer, Hashtable<String, String>> data = null; data = DataManager.GetExcelDataTable("Select * from Environment"); for (int i = 1; i < data.size(); i++) { GetName = data.get(i).get("Name".toUpperCase()); GetValue = data.get(i).get("Value".toUpperCase()); if (GetName.toUpperCase().equals(Name.toUpperCase())) { return GetValue; } } } catch (Exception e) { System.out.println(e.getMessage()); } return GetValue + new IllegalArgumentException("Invalid record: " + Name); } public static String getScreenhot(WebDriver driver, String screenshotName) throws Exception { String dateName = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()); TakesScreenshot ts = (TakesScreenshot) driver; File source = ts.getScreenshotAs(OutputType.FILE); //after execution, you could see a folder "FailedTestsScreenshots" under src folder String destination = System.getProperty("user.dir") + "/ScreenShots/" + screenshotName + dateName + ".png"; File finalDestination = new File(destination); FileUtils.copyFile(source, finalDestination); return destination; } }
[ "aotman@elm.sa" ]
aotman@elm.sa
9a43d5ff455ee66637c6297edef0c55ba7385890
f16157cd79a20dde9eb169fb257d043a3a11a53d
/src/test/java/com/vitanum/diary/controller/DiaryControllerTest.java
c819caa27069831547216aef31cd1f715eb3e758
[]
no_license
cdinescu/diary-service
a83dba5143a1a4b1aab7574ea3d24777d7210098
668c349b29cc6fe28f19231f9c2713eb8daf2607
refs/heads/master
2021-04-05T11:20:26.573925
2021-01-27T14:53:38
2021-01-27T14:53:38
248,551,191
0
1
null
2021-01-27T14:53:39
2020-03-19T16:25:51
Java
UTF-8
Java
false
false
3,223
java
package com.vitanum.diary.controller; import com.vitanum.diary.entitities.DiaryEntry; import com.vitanum.diary.repository.DiaryEntryRepository; import com.vitanum.diary.utils.TestUtils; import com.vitanum.diary.webtestclient.utils.WebTestClientUtils; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpStatus; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import static com.vitanum.diary.webtestclient.utils.WebTestClientUtils.USERNAME; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; /** * Test class for DiaryController. */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = RANDOM_PORT) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class DiaryControllerTest { @Autowired private WebTestClient client; @Autowired private DiaryEntryRepository diaryEntryRepository; @Test public void createDiaryEntry() { // Arrange DiaryEntry diaryEntry = TestUtils.createDiaryEntryForTest(); // Act & Arrange WebTestClientUtils.postAndVerifyDiaryEntry(client, HttpStatus.CREATED, diaryEntry); } @Test public void readDiaryEntry() { // Arrange DiaryEntry diaryEntry = TestUtils.createDiaryEntryForTest(); diaryEntry = diaryEntryRepository.save(diaryEntry); // Act & Assert WebTestClientUtils.getAndVerifyDiaryEntry(client, diaryEntry.getId(), HttpStatus.OK); } @Test public void searchDiaryEntryByDate() { // Arrange DiaryEntry diaryEntry1 = TestUtils.createDiaryEntryForTest(); diaryEntry1.setDate(TestUtils.DIARY_DATE); diaryEntry1 = diaryEntryRepository.save(diaryEntry1); diaryEntry1.setUsername(USERNAME); DiaryEntry diaryEntry2 = TestUtils.createDiaryEntryForTest(); diaryEntry2 = diaryEntryRepository.save(diaryEntry1); diaryEntry2.setDate(TestUtils.DIARY_DATE.plusDays(20)); diaryEntry2.setUsername(USERNAME); // Act & Assert WebTestClientUtils.getByDateAndVerifyDiaryEntry(client, HttpStatus.OK, TestUtils.DIARY_DATE, 1); } @Test public void updateDiaryEntry() throws CloneNotSupportedException { // Arrange DiaryEntry diaryEntry = TestUtils.createDiaryEntryForTest(); diaryEntry = diaryEntryRepository.save(diaryEntry); DiaryEntry updatedDiary = (DiaryEntry) diaryEntry.clone(); // Act & Assert WebTestClientUtils.putAndVerifyDiaryEntry(client, diaryEntry.getId(), updatedDiary, HttpStatus.OK); } @Test public void deleteDiaryEntry() { // Arrange DiaryEntry diaryEntry = TestUtils.createDiaryEntryForTest(); diaryEntry = diaryEntryRepository.save(diaryEntry); // Act & Assert WebTestClientUtils.deleteDiaryEntry(client, diaryEntry.getId(), HttpStatus.NO_CONTENT); } }
[ "crina91@gmail.com" ]
crina91@gmail.com
86303db44270505c6c118a433121a290e6309c04
4696dd014eaaba355b3219461d475b091765b71a
/commonlib/ijkplayer/ijkplayer-view/src/main/java/com/zonekey/ijkplayer_view/widget/IMediaController.java
35495e77704a83eb52e91633af63126316eeb036
[]
no_license
guojianwen/TestIjkPlayerForRTSP
1142de5b550fc0961a49aa7c840fe95e704a9949
808df2b476fba13c417725d597c0b0c0bf8c7ecc
refs/heads/master
2020-03-27T08:40:15.342338
2018-08-27T09:32:52
2018-08-27T09:32:52
146,275,775
1
0
null
null
null
null
UTF-8
Java
false
false
1,113
java
/* * Copyright (C) 2015 Bilibili * Copyright (C) 2015 Zhang Rui <bbcallen@gmail.com> * * 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.zonekey.ijkplayer_view.widget; import android.view.View; import android.widget.MediaController; public interface IMediaController { void hide(); boolean isShowing(); void setAnchorView(View view); void setEnabled(boolean enabled); void setMediaPlayer(MediaController.MediaPlayerControl player); void show(int timeout); void show(); //---------- // Extends //---------- void showOnce(View view); }
[ "guojw@zonekey.com.cn" ]
guojw@zonekey.com.cn
3d5b329e400e8ea904b287ab27c0a42b8b9e9e5f
d5f09c7b0e954cd20dd613af600afd91b039c48a
/sources/androidx/core/graphics/drawable/WrappedDrawableApi14.java
0997a7baf51e490d0dda41a6f19df590ad15cdb2
[]
no_license
t0HiiBwn/CoolapkRelease
af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3
a6a2b03e32cde0e5163016e0078391271a8d33ab
refs/heads/main
2022-07-29T23:28:35.867734
2021-03-26T11:41:18
2021-03-26T11:41:18
345,290,891
5
2
null
null
null
null
UTF-8
Java
false
false
9,785
java
package androidx.core.graphics.drawable; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.Region; import android.graphics.drawable.Drawable; class WrappedDrawableApi14 extends Drawable implements Drawable.Callback, WrappedDrawable, TintAwareDrawable { static final PorterDuff.Mode DEFAULT_TINT_MODE = PorterDuff.Mode.SRC_IN; private boolean mColorFilterSet; private int mCurrentColor; private PorterDuff.Mode mCurrentMode; Drawable mDrawable; private boolean mMutated; WrappedDrawableState mState; protected boolean isCompatTintEnabled() { return true; } WrappedDrawableApi14(WrappedDrawableState wrappedDrawableState, Resources resources) { this.mState = wrappedDrawableState; updateLocalState(resources); } WrappedDrawableApi14(Drawable drawable) { this.mState = mutateConstantState(); setWrappedDrawable(drawable); } private void updateLocalState(Resources resources) { WrappedDrawableState wrappedDrawableState = this.mState; if (wrappedDrawableState != null && wrappedDrawableState.mDrawableState != null) { setWrappedDrawable(this.mState.mDrawableState.newDrawable(resources)); } } @Override // android.graphics.drawable.Drawable public void jumpToCurrentState() { this.mDrawable.jumpToCurrentState(); } @Override // android.graphics.drawable.Drawable public void draw(Canvas canvas) { this.mDrawable.draw(canvas); } @Override // android.graphics.drawable.Drawable protected void onBoundsChange(Rect rect) { Drawable drawable = this.mDrawable; if (drawable != null) { drawable.setBounds(rect); } } @Override // android.graphics.drawable.Drawable public void setChangingConfigurations(int i) { this.mDrawable.setChangingConfigurations(i); } @Override // android.graphics.drawable.Drawable public int getChangingConfigurations() { int changingConfigurations = super.getChangingConfigurations(); WrappedDrawableState wrappedDrawableState = this.mState; return changingConfigurations | (wrappedDrawableState != null ? wrappedDrawableState.getChangingConfigurations() : 0) | this.mDrawable.getChangingConfigurations(); } @Override // android.graphics.drawable.Drawable public void setDither(boolean z) { this.mDrawable.setDither(z); } @Override // android.graphics.drawable.Drawable public void setFilterBitmap(boolean z) { this.mDrawable.setFilterBitmap(z); } @Override // android.graphics.drawable.Drawable public void setAlpha(int i) { this.mDrawable.setAlpha(i); } @Override // android.graphics.drawable.Drawable public void setColorFilter(ColorFilter colorFilter) { this.mDrawable.setColorFilter(colorFilter); } @Override // android.graphics.drawable.Drawable public boolean isStateful() { WrappedDrawableState wrappedDrawableState; ColorStateList colorStateList = (!isCompatTintEnabled() || (wrappedDrawableState = this.mState) == null) ? null : wrappedDrawableState.mTint; return (colorStateList != null && colorStateList.isStateful()) || this.mDrawable.isStateful(); } @Override // android.graphics.drawable.Drawable public boolean setState(int[] iArr) { return updateTint(iArr) || this.mDrawable.setState(iArr); } @Override // android.graphics.drawable.Drawable public int[] getState() { return this.mDrawable.getState(); } @Override // android.graphics.drawable.Drawable public Drawable getCurrent() { return this.mDrawable.getCurrent(); } @Override // android.graphics.drawable.Drawable public boolean setVisible(boolean z, boolean z2) { return super.setVisible(z, z2) || this.mDrawable.setVisible(z, z2); } @Override // android.graphics.drawable.Drawable public int getOpacity() { return this.mDrawable.getOpacity(); } @Override // android.graphics.drawable.Drawable public Region getTransparentRegion() { return this.mDrawable.getTransparentRegion(); } @Override // android.graphics.drawable.Drawable public int getIntrinsicWidth() { return this.mDrawable.getIntrinsicWidth(); } @Override // android.graphics.drawable.Drawable public int getIntrinsicHeight() { return this.mDrawable.getIntrinsicHeight(); } @Override // android.graphics.drawable.Drawable public int getMinimumWidth() { return this.mDrawable.getMinimumWidth(); } @Override // android.graphics.drawable.Drawable public int getMinimumHeight() { return this.mDrawable.getMinimumHeight(); } @Override // android.graphics.drawable.Drawable public boolean getPadding(Rect rect) { return this.mDrawable.getPadding(rect); } @Override // android.graphics.drawable.Drawable public void setAutoMirrored(boolean z) { this.mDrawable.setAutoMirrored(z); } @Override // android.graphics.drawable.Drawable public boolean isAutoMirrored() { return this.mDrawable.isAutoMirrored(); } @Override // android.graphics.drawable.Drawable public Drawable.ConstantState getConstantState() { WrappedDrawableState wrappedDrawableState = this.mState; if (wrappedDrawableState == null || !wrappedDrawableState.canConstantState()) { return null; } this.mState.mChangingConfigurations = getChangingConfigurations(); return this.mState; } @Override // android.graphics.drawable.Drawable public Drawable mutate() { if (!this.mMutated && super.mutate() == this) { this.mState = mutateConstantState(); Drawable drawable = this.mDrawable; if (drawable != null) { drawable.mutate(); } WrappedDrawableState wrappedDrawableState = this.mState; if (wrappedDrawableState != null) { Drawable drawable2 = this.mDrawable; wrappedDrawableState.mDrawableState = drawable2 != null ? drawable2.getConstantState() : null; } this.mMutated = true; } return this; } private WrappedDrawableState mutateConstantState() { return new WrappedDrawableState(this.mState); } @Override // android.graphics.drawable.Drawable.Callback public void invalidateDrawable(Drawable drawable) { invalidateSelf(); } @Override // android.graphics.drawable.Drawable.Callback public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) { scheduleSelf(runnable, j); } @Override // android.graphics.drawable.Drawable.Callback public void unscheduleDrawable(Drawable drawable, Runnable runnable) { unscheduleSelf(runnable); } @Override // android.graphics.drawable.Drawable protected boolean onLevelChange(int i) { return this.mDrawable.setLevel(i); } @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable public void setTint(int i) { setTintList(ColorStateList.valueOf(i)); } @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable public void setTintList(ColorStateList colorStateList) { this.mState.mTint = colorStateList; updateTint(getState()); } @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable public void setTintMode(PorterDuff.Mode mode) { this.mState.mTintMode = mode; updateTint(getState()); } private boolean updateTint(int[] iArr) { if (!isCompatTintEnabled()) { return false; } ColorStateList colorStateList = this.mState.mTint; PorterDuff.Mode mode = this.mState.mTintMode; if (colorStateList == null || mode == null) { this.mColorFilterSet = false; clearColorFilter(); } else { int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor()); if (!(this.mColorFilterSet && colorForState == this.mCurrentColor && mode == this.mCurrentMode)) { setColorFilter(colorForState, mode); this.mCurrentColor = colorForState; this.mCurrentMode = mode; this.mColorFilterSet = true; return true; } } return false; } @Override // androidx.core.graphics.drawable.WrappedDrawable public final Drawable getWrappedDrawable() { return this.mDrawable; } @Override // androidx.core.graphics.drawable.WrappedDrawable public final void setWrappedDrawable(Drawable drawable) { Drawable drawable2 = this.mDrawable; if (drawable2 != null) { drawable2.setCallback(null); } this.mDrawable = drawable; if (drawable != null) { drawable.setCallback(this); setVisible(drawable.isVisible(), true); setState(drawable.getState()); setLevel(drawable.getLevel()); setBounds(drawable.getBounds()); WrappedDrawableState wrappedDrawableState = this.mState; if (wrappedDrawableState != null) { wrappedDrawableState.mDrawableState = drawable.getConstantState(); } } invalidateSelf(); } }
[ "test@gmail.com" ]
test@gmail.com
e8defbd3c60e808c68c966e841d789950d810a65
14744096ade1238a877cb5291b5f20dbf0e9b9ce
/message-pipe-server/src/main/java/org/minbox/framework/message/pipe/server/service/GRpcServerApplicationService.java
853ab283ef0f2148672794547b8750d76853854b
[ "Apache-2.0" ]
permissive
hengboy/message-pipe
9194b6140e672b2c664ed6c4be76e6ab8a63988d
e3abde4638556b442d33c0c488f03f3249dba53e
refs/heads/master
2022-12-31T12:51:14.235130
2020-10-21T03:02:44
2020-10-21T03:02:44
288,656,301
1
0
Apache-2.0
2020-08-19T06:50:10
2020-08-19T06:50:10
null
UTF-8
Java
false
false
8,409
java
package org.minbox.framework.message.pipe.server.service; import io.grpc.Server; import io.grpc.ServerBuilder; import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; import org.minbox.framework.message.pipe.core.ClientStatus; import org.minbox.framework.message.pipe.core.exception.MessagePipeException; import org.minbox.framework.message.pipe.core.grpc.ClientServiceGrpc; import org.minbox.framework.message.pipe.core.grpc.proto.ClientHeartBeatRequest; import org.minbox.framework.message.pipe.core.grpc.proto.ClientRegisterRequest; import org.minbox.framework.message.pipe.core.grpc.proto.ClientResponse; import org.minbox.framework.message.pipe.core.information.ClientInformation; import org.minbox.framework.message.pipe.core.transport.ClientHeartBeatResponseBody; import org.minbox.framework.message.pipe.core.transport.ClientRegisterResponseBody; import org.minbox.framework.message.pipe.core.transport.MessageResponseStatus; import org.minbox.framework.message.pipe.core.untis.JsonUtils; import org.minbox.framework.message.pipe.core.untis.StringUtils; import org.minbox.framework.message.pipe.server.MessagePipe; import org.minbox.framework.message.pipe.server.config.ServerConfiguration; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationEventPublisher; import java.util.Arrays; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * The {@link MessagePipe} server application * <p> * Start some services required by the server * * @author 恒宇少年 */ @Slf4j public class GRpcServerApplicationService extends ClientServiceGrpc.ClientServiceImplBase implements InitializingBean, DisposableBean { private ScheduledExecutorService expiredScheduledExecutor; private Server rpcServer; private ServerConfiguration configuration; private ApplicationEventPublisher applicationEventPublisher; public GRpcServerApplicationService(ServerConfiguration configuration, ApplicationEventPublisher applicationEventPublisher) { if (configuration.getServerPort() <= 0 || configuration.getServerPort() > 65535) { throw new MessagePipeException("MessageServer port must be greater than 0 and less than 65535"); } this.configuration = configuration; this.applicationEventPublisher = applicationEventPublisher; this.rpcServer = ServerBuilder.forPort(this.configuration.getServerPort()).addService(this).build(); this.expiredScheduledExecutor = Executors.newScheduledThreadPool(configuration.getExpiredPoolSize()); } /** * Register client * * @param request client register request {@link ClientRegisterRequest} * @param responseObserver stream responseThreadPoolTaskExecutor */ @Override public void register(ClientRegisterRequest request, StreamObserver<ClientResponse> responseObserver) { ClientRegisterResponseBody responseBody = new ClientRegisterResponseBody(); try { if (StringUtils.isEmpty(request.getAddress()) || StringUtils.isEmpty(request.getMessagePipeName()) || (request.getPort() <= 0 || request.getPort() > 65535)) { throw new MessagePipeException("The client information verification fails and the registration cannot be completed."); } log.info("Registering client, IP: {}, Port: {}, pipeNames: {}", request.getAddress(), request.getPort(), request.getMessagePipeName()); ClientInformation client = ClientInformation.valueOf(request.getAddress(), request.getPort(), request.getMessagePipeName()); String clientId = client.getClientId(); responseBody.setClientId(clientId); // Publish ServiceEvent ServiceEvent serviceEvent = new ServiceEvent(this, ServiceEventType.REGISTER, Arrays.asList(client)); applicationEventPublisher.publishEvent(serviceEvent); } catch (Exception e) { responseBody.setStatus(MessageResponseStatus.ERROR); log.error("Register client failed.", e); } String responseBodyJson = JsonUtils.objectToJson(responseBody); ClientResponse response = ClientResponse.newBuilder().setBody(responseBodyJson).build(); responseObserver.onNext(response); responseObserver.onCompleted(); } /** * Heartbeat check * * @param request client heartbeat check request {@link ClientHeartBeatRequest} * @param responseObserver stream response */ @Override public void heartbeat(ClientHeartBeatRequest request, StreamObserver<ClientResponse> responseObserver) { ClientHeartBeatResponseBody responseBody = new ClientHeartBeatResponseBody(); try { if (StringUtils.isEmpty(request.getAddress()) || (request.getPort() <= 0 || request.getPort() > 65535)) { throw new MessagePipeException("The client information that sent the heartbeat is incomplete, " + "and the heartbeat check is ignored this time."); } ClientInformation client = ClientInformation.valueOf(request.getAddress(), request.getPort(), null); Long currentTime = System.currentTimeMillis(); client.setLastReportTime(currentTime); client.setOnlineTime(currentTime); client.setStatus(ClientStatus.ON_LINE); // Publish heart beat event ServiceEvent serviceEvent = new ServiceEvent(this, ServiceEventType.HEART_BEAT, Arrays.asList(client)); applicationEventPublisher.publishEvent(serviceEvent); } catch (Exception e) { responseBody.setStatus(MessageResponseStatus.ERROR); log.error("Heartbeat check failed.", e); } String responseBodyJson = JsonUtils.objectToJson(responseBody); ClientResponse response = ClientResponse.newBuilder().setBody(responseBodyJson).build(); responseObserver.onNext(response); responseObserver.onCompleted(); } /** * Startup grpc {@link Server} */ public void startup() { new Thread(() -> { try { this.rpcServer.start(); log.info("MessagePipe Server bind port : {}, startup successfully.", this.configuration.getServerPort()); this.rpcServer.awaitTermination(); } catch (Exception e) { log.error("MessagePipe Server startup failed.", e); } }).start(); } /** * Start eliminate expired client * <p> * If the client's last heartbeat time is greater than the timeout threshold, * the update status is performed */ private void startEliminateExpiredClient() { this.expiredScheduledExecutor.scheduleAtFixedRate(() -> { // Publish expired event ServiceEvent serviceEvent = new ServiceEvent(this, ServiceEventType.EXPIRE); applicationEventPublisher.publishEvent(serviceEvent); }, 5, configuration.getCheckClientExpiredIntervalSeconds(), TimeUnit.SECONDS); } /** * Shutdown Grpc {@link Server} */ private void shutdownServerApplication() { try { log.info("MessagePipe Server shutting down."); this.rpcServer.shutdown(); long waitTime = 100; long timeConsuming = 0; while (!this.rpcServer.isShutdown()) { log.info("MessagePipe Server stopping...,total time consuming:{}", timeConsuming); timeConsuming += waitTime; Thread.sleep(waitTime); } log.info("MessagePipe Server stop successfully."); } catch (Exception e) { log.error("MessagePipe Server shutdown failed.", e); } } @Override public void destroy() throws Exception { this.shutdownServerApplication(); this.expiredScheduledExecutor.shutdown(); } @Override public void afterPropertiesSet() throws Exception { this.startup(); this.startEliminateExpiredClient(); log.info("MessagePipe ClientExpiredExecutor successfully started."); } }
[ "jnyuqy@gmail.com" ]
jnyuqy@gmail.com
941f4f7474e10d4130c6cd1d9ca8268a5118b1ee
8a8a7b31c77bd22bc8efbb36a2778cbe37931a14
/Week_07/dynamic-datasource-HW/src/test/java/com/study/dynamic/datasource/DynamicDatasourceApplicationTests.java
43ca590d711d29f034f1a7cf6dc8a88a6f5f3d2a
[]
no_license
ryvengray/JAVA-000
3d7b9ba30d1f8833b63d4aa9b7c524a601e9af30
85f1a5607d13399208e03eaa8aa557621cabadb6
refs/heads/main
2023-01-22T06:23:23.894723
2020-12-02T16:11:50
2020-12-02T16:11:50
303,266,637
0
0
null
2020-10-12T03:23:14
2020-10-12T03:23:13
null
UTF-8
Java
false
false
240
java
package com.study.dynamic.datasource; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DynamicDatasourceApplicationTests { @Test void contextLoads() { } }
[ "gray.lei@ximalaya.com" ]
gray.lei@ximalaya.com
a2a47f2ab87a9c154e211dd3f95f98ad3bdb31f4
2949e292590d972c6d7f182f489f8f86a969cd69
/Module4/review/btUngDungMuonSach-master/src/main/java/service/BookService.java
6cf689ee479de7aef12ad74b336c706e1565d178
[]
no_license
hoangphamdong/C0221G1-hoangphamdon
13e519ae4c127909c3c1784ab6351f2ae23c0be0
7e238ca6ce80f5cce712544714d6fce5e3ffb848
refs/heads/master
2023-06-23T07:50:07.790174
2021-07-21T10:22:20
2021-07-21T10:22:20
342,122,557
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package service; import model.BookEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; public interface BookService { public Page<BookEntity> findAll(Pageable pageable); public BookEntity findById(Integer id); public void save(BookEntity bookEntity); public void delete(Integer id); }
[ "hpdongbmt@gmail.com" ]
hpdongbmt@gmail.com
738065babc7c7c24090a3c026c4d230d2e40540b
7bb948b146a0c83c16b37b04bbf316b6125eb8c4
/src/main/java/com/shiro/entity/User.java
ad79ef5e1d80b855ae859d67add221e0cd5dd3ee
[]
no_license
rongle/shiro-demo
223872d87b3ddd9a54477ba5e7e35cae813eb137
80bb6a0172c3ae9470247860ffc1573bcdb619f9
refs/heads/master
2023-08-10T14:17:48.918300
2019-05-23T09:01:20
2019-05-23T09:01:20
188,198,549
0
0
null
2023-07-25T14:10:14
2019-05-23T09:01:01
Java
UTF-8
Java
false
false
1,078
java
package com.shiro.entity; import java.io.Serializable; /** * (User)实体类 * * @author makejava * @since 2019-05-14 00:11:02 */ public class User implements Serializable { private static final long serialVersionUID = -61863973066216093L; private Integer id; private String name; private String password; private String salt; private String email; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getSalt() { return salt; } public void setSalt(String salt) { this.salt = salt; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
[ "hanrongle@126.com" ]
hanrongle@126.com
a754889a3d96f6f8b3f77304754d66d8877959df
f5964fb44e2015b4d824ce1cedc02b84a80db35a
/iris-coco/src/test/java/com/leibangzhu/coco/ext2/ConfigHolder.java
8dd92382e82dac9e13b4b717a0b3eedaebef630b
[]
no_license
LiWenGu/iris
77a5f80b032aa27fca484464b6e93f8ccb5f3bf7
51824b56c1a93e0a4ca2a39c1d15cac576916012
refs/heads/dev
2022-04-27T16:39:02.824752
2019-11-07T17:08:47
2019-11-07T17:08:47
217,238,565
3
1
null
2020-10-13T16:57:20
2019-10-24T07:30:25
Java
UTF-8
Java
false
false
1,395
java
/* * Copyright 2012-2013 coco Team. * * 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.leibangzhu.coco.ext2; import java.util.Map; /** * @author Jerry Lee(oldratlee AT gmail DOT com) */ public class ConfigHolder { private Double Num; private Map<String, String> config; private String name; private int age; public Double getNum() { return Num; } public void setNum(Double num) { Num = num; } public Map<String, String> getConfig() { return config; } public void setConfig(Map<String, String> config) { this.config = config; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
[ "liwenguang_dev@163.com" ]
liwenguang_dev@163.com
446be569a723f1a2715d5554fb60667bc9c15bd5
4f5fca1ed597cf298cfda2322c78269858764273
/Day6/src/com/jong/day6/Demo12.java
f4bb2a9752f4148c0a645f127ea577c01796aef9
[]
no_license
kjon1/JavastackPractice
75270cd549b015007c466faa87f8f950f2a7556e
747648042250e47e2302cb7a86555c503b960244
refs/heads/master
2023-07-14T04:00:32.511544
2021-08-20T04:59:31
2021-08-20T04:59:31
390,135,020
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.jong.day6; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; class Customer{ public int id; public String name; public int age; public Customer(int id, String name, int age) { this.id = id; this.name = name; this.age = age; } @Override public String toString() { return "Customer{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + '}'; } } public class Demo12 { public static void main(String[] args) { ArrayList<Customer> customers = new ArrayList<>(); customers.add(new Customer(2, "maluk", 2)); customers.add(new Customer(1, "MAMALUK", 40)); System.out.println("before sorting"); for (Customer customer: customers){ System.out.println(customer); } Collections.sort(customers, (c1, c2) -> { return c1.name.compareTo(c2.name); }); System.out.println("after sort.." ); for (Customer customer: customers){ System.out.println(customer); } } }
[ "john.kim@revature.net" ]
john.kim@revature.net
8819c1db8d0397b1a63ef1cb8da687d0b0d26363
0aea651570faa42de5214c1216fc79605133b19c
/benchmarks-jmh/src/test/java/jetbrains/exodus/benchmark/env/JMHEnvWithPrefixingTokyoCabinetWriteBenchmark.java
f73e1f055fd284b0794211fe89d39e1ebd71c554
[ "Apache-2.0" ]
permissive
morj/xodus
5ce36c983806bf74cca8d9917dfa2bccd5ad2323
b7268bd1f1f95c7955d19ff5531a5464fa7706e2
refs/heads/master
2020-12-24T14:10:44.700740
2015-10-15T08:46:13
2015-10-15T08:46:13
42,998,284
1
0
null
2015-09-23T12:02:49
2015-09-23T12:02:49
null
UTF-8
Java
false
false
914
java
/** * Copyright 2010 - 2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jetbrains.exodus.benchmark.env; import jetbrains.exodus.env.StoreConfig; public class JMHEnvWithPrefixingTokyoCabinetWriteBenchmark extends JMHEnvTokyoCabinetWriteBenchmark { @Override protected StoreConfig getConfig() { return StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING; } }
[ "lvo@intellij.net" ]
lvo@intellij.net
5d475146714ced311587cfdf6c0cb26677054382
534be3fdd7348e064678511824c6f323309ff92d
/BasicApplication/src/br/ufla/dcc/PingPong/Phy/WucPhyTxTimer.java
af1a8971c9d482d47624dc10efba73fbfbf2dbef
[]
no_license
PhilipOfMacedon/Grubix
5b854c83fc2ee4388f3be817eb7df3481981e7c4
076120c7d71c6de80bed88c1a649ff609601dffa
refs/heads/master
2022-11-29T20:09:41.215391
2020-08-14T10:51:54
2020-08-14T10:51:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
981
java
package br.ufla.dcc.PingPong.Phy; import br.ufla.dcc.grubix.simulator.Address; import br.ufla.dcc.grubix.simulator.event.Packet; import br.ufla.dcc.grubix.simulator.event.WakeUpCall; /** * * WakeUpCall para envio de pacotes pelo Rádio. * * O trabalho de marcar tempo de ocupação do canal de comunicação é da AIR. * Este trabalho será feito na PHY até que aprendamos a usar a AIR. * * * @author João Giacomin * @version 07/12/2016 * */ public class WucPhyTxTimer extends WakeUpCall { /** The packet that is first in the queue (i.e. to be sent when the wake up call fires). */ private Packet packet; /** * Default constructor of the class PhyTimerWUC with no packet. * * @param sender Sender of the WakeUpCall. * @param delay Wanted delay until callback. */ public WucPhyTxTimer(Address sender, Double delay, Packet packet) { super(sender, delay); this.packet = packet; } public Packet getPacket() { return this.packet; } }
[ "filiperodrigues97@gmail.com" ]
filiperodrigues97@gmail.com
8513fd9d417430d4621f1a2eb8ecd44c597d8dda
fdaad08a02365582534701ea7133f7b71a23dbb5
/Lucene_Part1/src/main/java/com/itlwq/dao/impl/BookDaoImpl.java
3c84fc78ddde5a59ed925916bfe0a1c2e2a64a6e
[]
no_license
LuWenQian/myRepository
f4b51e5ec967dbd775f08ce27ba14bb3dc9e6965
40185394ba90d13d415d10aa713e42eb80ca80d9
refs/heads/master
2020-03-29T22:30:59.726004
2018-09-26T13:07:14
2018-09-26T13:07:14
150,425,085
0
0
null
null
null
null
UTF-8
Java
false
false
1,363
java
package com.itlwq.dao.impl; import com.itlwq.dao.BookDao; import com.itlwq.domain.Book; import com.itlwq.utils.JDBCUtils; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * Created by 文谦 on 2018/9/23 */ public class BookDaoImpl implements BookDao { public void saveBook(Book book) { } public List<Book> findAllBook() { try { String sql = "SELECT * FROM book"; Connection connection = JDBCUtils.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement.executeQuery(); ArrayList<Book> list = new ArrayList<Book>(); while (resultSet.next()) { Book book = new Book(); book.setId(resultSet.getInt("id")); book.setBookname(resultSet.getString("bookname")); book.setPrice(resultSet.getFloat("price")); book.setPic(resultSet.getString("pic")); book.setBookdesc(resultSet.getString("bookdesc")); list.add(book); } return list; } catch (Exception e) { e.printStackTrace(); return null; } } }
[ "13169835800@163.com" ]
13169835800@163.com
2b08203dd4de8084ecc1a9bb6be9852fd43f8f51
ee4b1521db247e706ff45b3b09d75d974a199d6f
/src/main/java/com/remember/encrypt/starter/annotation/encrypt/DESEncryptBody.java
d4cfbeae30647b679550acc3abb916fdf20f49a6
[]
no_license
remember-5/spring-boot-encrypt-starter
dad167c5bfc28934c6138e5a71b3dcd3c9bbb257
b239a0d2a0531ac5761049606bcca04e798783da
refs/heads/master
2023-04-23T14:46:16.792006
2021-05-15T11:33:03
2021-05-15T11:33:03
258,503,444
0
0
null
2021-05-15T11:33:03
2020-04-24T12:15:47
Java
UTF-8
Java
false
false
338
java
package com.remember.encrypt.starter.annotation.encrypt; import java.lang.annotation.*; /** * @author wangjiahao * @version 2018/9/4 * @see EncryptBody */ @Target(value = {ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface DESEncryptBody { String otherKey() default ""; }
[ "1332661444@qq.com" ]
1332661444@qq.com
0b399fe50ce34ed983d86089659f363ba4059e9a
4d2db54fb1a568b232dc8a2614917ad313abacb6
/src/main/java/com/tourist/index/touristindex/domain/repository/CountryRepository.java
c0cf41c8b8eb1cc9675e248c0727d4de32709f19
[]
no_license
Roman211072478/sw-assignment
8c4dcc3cf9f6ffa153df53904111bfe11e0103a6
9be75ff3963bcb95c668817ae86863ac2f0875e8
refs/heads/master
2020-07-04T09:53:51.458402
2019-08-16T22:12:37
2019-08-16T22:12:37
202,247,788
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package com.tourist.index.touristindex.domain.repository; import com.tourist.index.touristindex.domain.models.Country; import org.springframework.data.repository.CrudRepository; public interface CountryRepository extends CrudRepository<Country,Long>{ }
[ "romanrafiq456@gmail.com" ]
romanrafiq456@gmail.com
4397d3dfe35fa2d54223887dd5bc4b4eb45471b4
82a8f35c86c274cb23279314db60ab687d33a691
/app/src/main/java/com/duokan/reader/domain/micloud/C1066g.java
827030fd6ea1bdf7dfd188bfbd834c8c8004482b
[]
no_license
QMSCount/DReader
42363f6187b907dedde81ab3b9991523cbf2786d
c1537eed7091e32a5e2e52c79360606f622684bc
refs/heads/master
2021-09-14T22:16:45.495176
2018-05-20T14:57:15
2018-05-20T14:57:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.duokan.reader.domain.micloud; import cn.kuaipan.android.kss.KssMaster.IRemote; /* renamed from: com.duokan.reader.domain.micloud.g */ class C1066g implements IRemote { /* renamed from: a */ final /* synthetic */ C1063d f5270a; private C1066g(C1063d c1063d) { this.f5270a = c1063d; } public String getIdentity() { return "CreateFileTask_" + ((C1068i) this.f5270a.mo734b()).m8140N() + "_" + ((C1068i) this.f5270a.mo734b()).m8141O() + "_" + ((C1068i) this.f5270a.mo734b()).m8228w(); } }
[ "lixiaohong@p2peye.com" ]
lixiaohong@p2peye.com
ac34123a09c33aa2062b864f2595bd0c3928b351
5ac7be3d700790543362936a86c46d9510aead7f
/src/lv/rcs/prebootcamp/lesson12/exercise3/Exercise3.java
7319917c4bcc8baf39a742f0d0f035a310c368a4
[]
no_license
my-code-hub/rcs-java-pre-bootcamp
8cad13b4443287ded717307bae37e9b22e30b8ff
ce3fb62144598812a127d48827af77f67298d281
refs/heads/master
2022-04-10T11:01:28.007201
2020-03-09T19:36:38
2020-03-09T19:36:38
224,221,883
1
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package lv.rcs.prebootcamp.lesson12.exercise3; //3. create class "Rectangle" with properties "width" and "height" (whole numbers). // * create default constructor which sets "height" to 5 and "width" to 10 // * create a constructor with parameters "width" and "height" which sets the corresponding property values // * create methods "getHeight" and "getWidth" which return the corresponding properties // * create a method "getPerimeter" (sum all sides) which calculates and returns the perimeter of the rectangle // * create a method "getArea" (multiply with with height) which calculates and returns the area of rectangle // * create a method "incrementHeight" with no parameters, which increments height by one // * create a method "incrementWidth" with no parameters, which increments width by one public class Exercise3 { public static void main(String[] args) { Rectangle figure1 = new Rectangle(1, 2); Rectangle figure2; // is not defined Rectangle figure3 = null; //points to null address Rectangle figure4 = new Rectangle(); int figure1Height = figure1.getHeight(); System.out.println(figure1Height); new Rectangle(1, 2); } }
[ "ritvars.dortans@neotech.lv" ]
ritvars.dortans@neotech.lv
0c699a8908497d37dd02212930b41a24affd87e8
8679e7954414e964e094aaba0f0204f543a446ab
/src/test/java/com/complexible/common/csv/CSV2RDFTest.java
eb04a60fdc98cd951cf9b6bda86ad8a859cbb145
[ "Apache-2.0" ]
permissive
LevChickie/iet-sonarcloud-check
cfa8bef3d37ede3cdb09da345d55f932182f0a80
eab146ec78d5e45a85e02febbd38624d295eb88c
refs/heads/master
2022-12-27T09:26:57.836205
2020-05-03T20:01:18
2020-05-03T20:01:18
261,010,207
0
0
Apache-2.0
2020-10-13T21:42:35
2020-05-03T19:58:40
Java
UTF-8
Java
false
false
152
java
package com.complexible.common.csv; /** * This class contains the unit tests created for the CSV2RDF class. */ public class CSV2RDFTest { }
[ "noreply@github.com" ]
LevChickie.noreply@github.com
11aca1e6b0e853de21756efd84a26296b2defd9f
802ceebc602f4d23bef2b2dffd65cc51d51cce5a
/app/src/androidTest/java/com/ps/app/ApplicationTest.java
26d0336ec98790ff70c5bd58ce99b6d07f0a7083
[]
no_license
xiaoqi05/App
c36799430a3df349376bf1d35289578c9c4fc8a9
bcd5488522688e7aed518b0f717121497d723598
refs/heads/master
2021-01-01T04:51:34.385804
2016-06-03T16:03:19
2016-06-03T16:03:19
57,014,005
1
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.ps.app; 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); } }
[ "772508341@qq.com" ]
772508341@qq.com
9e08b0010d532a9fa4a5e50af24712c1110609af
bb52fceb40d7a54a7ba13fb560a54b0e48836b95
/service-feign/src/main/java/com/example/servicefeign/SchedualServiceHiHystric.java
229d5d918d540cefbec733d3e36b89d359d0505b
[]
no_license
Felix414/mySpringCloudDemo
9281fd2a9eb7b125724a9fde05d13f5c0a47164a
1fdb206cd750fadc431bc899c44d9b8dcdca1e11
refs/heads/master
2023-01-20T03:35:16.790921
2020-12-03T07:13:17
2020-12-03T07:13:17
318,104,596
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package com.example.servicefeign; import org.springframework.stereotype.Component; @Component public class SchedualServiceHiHystric implements SchedualServiceHi { @Override public String sayHiFromClientOne(String name) { return "sorry "+name; } }
[ "ygplpr@126.com" ]
ygplpr@126.com
e5d7bd73dde6166f86aeb811fed81d5cdebb6ab9
f192663fbb28c8fe071e9e85bebcc59dafa08db5
/src/main/java/aop/service/ShapeService.java
b3b1ead44035666a76403a75e00867276287ea42
[]
no_license
naman15/spring
f84035ac9abca9da5176dfe52dcde66312365aaa
fe9e6d1093fd5cf6ba6adfbca1c824a8065accce
refs/heads/master
2021-04-12T12:22:05.920782
2018-04-03T07:58:18
2018-04-03T07:58:18
126,204,025
0
0
null
null
null
null
UTF-8
Java
false
false
657
java
package aop.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import aop.model.CircleModel; import aop.model.TriangleModel; public class ShapeService { @Autowired @Qualifier("circleModel") private CircleModel circle; @Autowired @Qualifier("triangleModel") private TriangleModel triangle; public CircleModel getCircle() { return circle; } public void setCircle(CircleModel circle) { this.circle = circle; } public TriangleModel getTriangle() { return triangle; } public void setTriangle(TriangleModel triangle) { this.triangle = triangle; } }
[ "naman_goyal_94@yahoo.com" ]
naman_goyal_94@yahoo.com
2314c96400a45e6cb78523eb313af10e85798514
8e2e5050cf7201471a45379e76baa40684f84c50
/app/src/main/java/com/ste9206/beerapplication/fragment/description/DescriptionFragment.java
3849711970c88c58c29407496465840a8996fc0b
[]
no_license
ste9206/BeerApplication
655307549cbc8dda701407f511865db0ff703a0a
93c719cbe9d26d104fd74b9dcb7b1eae64e5e901
refs/heads/master
2021-01-22T12:25:46.567184
2017-05-31T09:17:17
2017-05-31T09:17:17
92,724,928
0
0
null
null
null
null
UTF-8
Java
false
false
4,199
java
package com.ste9206.beerapplication.fragment.description; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.ste9206.beerapplication.R; import com.ste9206.beerapplication.activity.MainActivity; import com.ste9206.beerapplication.application.BeerApplication; import com.ste9206.beerapplication.fragment.Beer.BeerFragment; import com.ste9206.beerapplication.listener.OnBackPressedListener; import com.ste9206.beerapplication.realm.BeerItems; import com.ste9206.beerapplication.utils.AlertMessage; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * A simple {@link Fragment} subclass. */ public class DescriptionFragment extends Fragment implements OnBackPressedListener,DescriptionContract.View{ @OnClick(R.id.favoriteBorder) public void favoriteBorder(){ presenter.onLikeInserted(); } @OnClick(R.id.favorite) public void favorite(){ presenter.onLikeRemoved(); } @BindView(R.id.description) TextView description; @BindView(R.id.picture) ImageView picture; @Inject Context context; @BindView(R.id.favorite) ImageView favorite; @BindView(R.id.favoriteBorder) ImageView favoriteBorder; @Inject DescriptionPresenter presenter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_description, container, false); ButterKnife.bind(this,rootView); ((BeerApplication)getActivity().getApplication()).createAppComponent().inject(this); ((MainActivity)getActivity()).setOnBackPressListener(this); presenter.loadDescription(getArguments()); return rootView; } @Override public void onAttach(Context context) { super.onAttach(context); } @Override public void onDetach() { super.onDetach(); } @Override public void onResume() { super.onResume(); presenter.setView(this); } @Override public void onBackPress() { presenter.onBackPress(); } @Override public void visibleFavoriteInvisibleBorder() { favorite.setVisibility(View.VISIBLE); favoriteBorder.setVisibility(View.INVISIBLE); } @Override public void visibleBorderInvisibleFavorite() { favorite.setVisibility(View.INVISIBLE); favoriteBorder.setVisibility(View.VISIBLE); } @Override public void setItemInfo(BeerItems beerItems) { Glide.with(context).load(beerItems.getImage()).error(R.drawable.pint).into(picture); favorite.setVisibility(beerItems.isFavourite() ? View.VISIBLE : View.INVISIBLE); favoriteBorder.setVisibility(!beerItems.isFavourite() ? View.VISIBLE : View.INVISIBLE); description.setText(beerItems.getDescription() == null ? "No description available for this beer." : beerItems.getDescription()); } @Override public void likeInserted() { Toast.makeText(context,"Beer added to favourites",Toast.LENGTH_SHORT).show(); } @Override public void likeRemoved() { Toast.makeText(context,"Beer removed to favourites",Toast.LENGTH_SHORT).show(); } @Override public void goBack() { FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); transaction.replace(R.id.contentMain,new BeerFragment()).commit(); } @Override public void showError(String message) { AlertMessage.newAlertErrorMessage(message,context).show(); } }
[ "stefano.gardano@gmail.com" ]
stefano.gardano@gmail.com
96a8a0ad2b54131e7936460f9d2f0ad31cd31762
05232ee7886b0dcf857fad41bcb04b0eaa5c638b
/app/src/main/java/com/kindleassistant/entity/PreViewRsp.java
ff2c9cf128afd9ccc6b4d43c4850c4077b0e2219
[]
no_license
wudizhuo/kindleassistant
f3fda1900bc2b209cad846503166456643373919
ef8e0729ec5cb297715a1067a5bb071e556963ae
refs/heads/master
2020-05-27T01:19:05.042640
2017-12-30T08:42:23
2017-12-30T08:42:23
82,519,923
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package com.kindleassistant.entity; import com.kindleassistant.common.BaseResponse; public class PreViewRsp extends BaseResponse { private String content; public String getContent() { return content; } }
[ "sunzhuo1228@126.com" ]
sunzhuo1228@126.com
1591f7a045ff3ff323a80d804feddcfdb9b93dce
993cae9edae998529d4ef06fc67e319d34ee83ef
/src/cn/edu/sau/cms/plugin/AttachmentFieldPlugin.java
65d51eb365b3747195bafbae690e411c7c1f0d4a
[]
no_license
zhangyuanqiao93/MySAUShop
77dfe4d46d8ac2a9de675a9df9ae29ca3cae1ef7
cc72727b2bc1148939666b0f1830ba522042b779
refs/heads/master
2021-01-25T05:02:20.602636
2017-08-03T01:06:43
2017-08-03T01:06:43
93,504,556
0
0
null
null
null
null
UTF-8
Java
false
false
3,478
java
package cn.edu.sau.cms.plugin; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import cn.edu.sau.eop.sdk.context.EopContext; import cn.edu.sau.cms.core.model.DataField; import cn.edu.sau.cms.core.plugin.AbstractFieldPlugin; import cn.edu.sau.eop.sdk.context.EopSetting; import cn.edu.sau.eop.sdk.utils.UploadUtil; import cn.edu.sau.framework.context.webcontext.ThreadContextHolder; import com.sun.xml.messaging.saaj.util.ByteOutputStream; import freemarker.template.Configuration; import freemarker.template.DefaultObjectWrapper; import freemarker.template.Template; /** * 附件上传控件 * * @author zyq */ public class AttachmentFieldPlugin extends AbstractFieldPlugin { public int getHaveSelectValue() { return 0; } /** * 控件html输出 */ public String onDisplay(DataField field, Object value) { try { Map data = new HashMap(); data.put("fieldname", field.getEnglish_name()); if (value != null) { value = UploadUtil.replacePath(value.toString()); } if(value!=null){ String[] values = value.toString().split(","); if(values.length!=2){ data.put("name", "error"); data.put("path", "error"); } data.put("name", values[0]); data.put("path", values[1]); } data.put("ctx", ThreadContextHolder.getHttpRequest() .getContextPath()); data.put("ext", EopSetting.EXTENSION); Configuration cfg = new Configuration(); cfg.setObjectWrapper(new DefaultObjectWrapper()); cfg.setDefaultEncoding("UTF-8"); cfg.setLocale(java.util.Locale.CHINA); cfg.setEncoding(java.util.Locale.CHINA, "UTF-8"); cfg.setClassForTemplateLoading(this.getClass(), ""); Template temp = cfg.getTemplate("AttachmentFieldPlugin.html"); ByteOutputStream stream = new ByteOutputStream(); Writer out = new OutputStreamWriter(stream); temp.process(data, out); out.flush(); String html = stream.toString(); return html; } catch (Exception e) { return "挂件解析出错" + e.getMessage(); } } /** * 覆盖默认的字段值显示,将本地存储的图片路径转换为静态资源服务器路径 */ public Object onShow(DataField field, Object value) { Map<String,String> attr = new HashMap<String, String>(2); if(value!=null){ value =UploadUtil.replacePath( value.toString()); String[] values = value.toString().split(","); if(values.length!=2){ attr.put("name", "error"); attr.put("path", "error"); }else{ attr.put("name", values[0]); attr.put("path", values[1]); } } return attr; } /** * 保存字段值<br> * 格式为name+","+path */ public void onSave(Map article, DataField field) { HttpServletRequest request = ThreadContextHolder.getHttpRequest(); String path = request.getParameter(field.getEnglish_name()+"_path"); String name = request.getParameter(field.getEnglish_name()+"_name"); if(path!=null) path = path.replaceAll( EopSetting.IMG_SERVER_DOMAIN + EopContext.getContext().getContextPath(), EopSetting.FILE_STORE_PREFIX ); article.put(field.getEnglish_name(),name+","+path); } public String getAuthor() { return "kingapex"; } public String getId() { return "attachment"; } public String getName() { return "附件"; } public String getType() { return "field"; } public String getVersion() { return "1.0"; } }
[ "zhangyuanqiao0912@163.com" ]
zhangyuanqiao0912@163.com
c7dd27dde5a3bad47ca43eeec220da979dba7725
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/includes/vendor/hamcrest/hamcrest_php/hamcrest/Hamcrest/Xml/file_HasXPath_php.java
1dc5d01da48202679fb1082834cdbc70abde5194
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
2,130
java
package com.project.convertedCode.includes.vendor.hamcrest.hamcrest_php.hamcrest.Hamcrest.Xml; import com.runtimeconverter.runtime.RuntimeStack; import com.runtimeconverter.runtime.interfaces.ContextConstants; import com.runtimeconverter.runtime.includes.RuntimeIncludable; import com.runtimeconverter.runtime.includes.IncludeEventException; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.runtimeconverter.runtime.interfaces.UpdateRuntimeScopeInterface; import com.runtimeconverter.runtime.arrays.ZPair; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php */ public class file_HasXPath_php implements RuntimeIncludable { public static final file_HasXPath_php instance = new file_HasXPath_php(); public final void include(RuntimeEnv env, RuntimeStack stack) throws IncludeEventException { Scope865 scope = new Scope865(); stack.pushScope(scope); this.include(env, stack, scope); stack.popScope(); } public final void include(RuntimeEnv env, RuntimeStack stack, Scope865 scope) throws IncludeEventException { // Namespace import was here // Namespace import was here // Namespace import was here // Namespace import was here // Conversion Note: class named HasXPath was here in the source code env.addManualClassLoad("Hamcrest\\Xml\\HasXPath"); } private static final ContextConstants runtimeConverterContextContantsInstance = new ContextConstants() .setDir("/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml") .setFile("/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php"); public ContextConstants getContextConstants() { return runtimeConverterContextContantsInstance; } private static class Scope865 implements UpdateRuntimeScopeInterface { public void updateStack(RuntimeStack stack) {} public void updateScope(RuntimeStack stack) {} } }
[ "git@runtimeconverter.com" ]
git@runtimeconverter.com
86fed1da3dfe4fe2ad19144240a8e443d59458fe
a77144fb2a2433a7ad59da8e3d34489309d8cf06
/algproject/src/algproject/NewFrame.java
4fcc1d000d30a56337d483b87b3ce7207aaa6291
[]
no_license
eslam-saleh/Maximum-Flow-and-Dijkstra-Algorithms
f5e7507e159ef9e821f3c6993d3ba389bdc1e072
fe0a2f943fce851b03ddf9d2f65bb555331f5710
refs/heads/master
2022-09-22T22:36:05.500135
2020-06-06T23:12:27
2020-06-06T23:12:27
270,129,059
0
0
null
null
null
null
UTF-8
Java
false
false
9,132
java
package algproject; /* * 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. */ import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; import javax.swing.JOptionPane; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * * @author cw */ public class NewFrame extends javax.swing.JFrame { Image img; Graphics2D gfx; int current,q,w; ArrayList<edge>e; Iterator<node> itr; ArrayList<node>location1,location2; node src, Dist; ArrayList<node>n; int maximumFlow ; node parent[] ; int minDistance(int dist[], Boolean sptSet[]) { // Initialize min value int min = Integer.MAX_VALUE, min_index = -1; for (int i = 0; i < dist.length; i++) if (sptSet[i] == false && dist[i] <= min) { min = dist[i]; min_index = i; } return min_index; } /** * Creates new form NewJFrame */ public NewFrame(ArrayList<node>n,ArrayList<edge>e,node src,node Dist,boolean check) { initComponents(); location1 = new ArrayList<>(); location2 = new ArrayList<>(); this.src=src; this.Dist=Dist; this.n=n; this.e=e; parent = new node[n.size()]; maximumFlow = 0; this.w=1; if(!check) { while(bfs(n,src, Dist, parent)) { if(src==Dist) { for (int i = 0; i < src.nebours.size(); i++) { if(src==src.nebours.get(i)) { maximumFlow+=src.edges.get(i).weight; break; } } break; } int path_flow = Integer.MAX_VALUE; int i; for (node v=Dist; v!=src; v=parent[v.id]) { node u = parent[v.id]; for (i = 0; i < u.nebours.size(); i++) { if(u.nebours.get(i).id==v.id) { break; } } path_flow = Math.min(path_flow, u.edges.get(i).weight); } for (node v=Dist; v!=src; v=parent[v.id]) { node u = parent[v.id]; for (i = 0; i < u.nebours.size(); i++) { if(u.nebours.get(i).id==v.id) { break; } } u.edges.get(i).weight-=path_flow; } maximumFlow += path_flow; } JOptionPane.showMessageDialog(null, "the maximum flow is "+maximumFlow); } itr = location2.iterator(); if(itr.hasNext()){ location1.add(itr.next()); } img= panel.createImage(panel.getWidth(),panel.getHeight()); gfx = (Graphics2D) img.getGraphics(); } public void draw() { gfx.setColor(Color.white); gfx.fillRect(0, 0, panel.getWidth(), panel.getHeight()); for (int j = 0; j < e.size() ; j++) { if(e.get(j).weight<=0) { gfx.setColor(Color.RED); gfx.drawLine(e.get(j).n1.p.x, e.get(j).n1.p.y, e.get(j).n2.p.x, e.get(j).n2.p.y); e.get(j).drawWeight(gfx, Color.RED, ""+e.get(j).tempWeight+"/"+(e.get(j).weight-e.get(j).tempWeight)); } else { gfx.setColor(Color.BLACK); gfx.drawLine(e.get(j).n1.p.x, e.get(j).n1.p.y, e.get(j).n2.p.x, e.get(j).n2.p.y); e.get(j).drawWeight(gfx, Color.BLACK, ""+e.get(j).tempWeight+"/"+(e.get(j).weight-e.get(j).tempWeight)); } } for (int i = 0; i < location1.size()-1; i++) { node n1=location1.get(i),n2=location1.get(i+1); for (int j = 0; j < n2.nebours.size(); j++) { if(n2.nebours.get(j)==n1) { n2.edges.get(j).drawWeight(gfx, Color.BLUE, n2.edges.get(j).tempWeight+"/"+(n2.edges.get(j).weight-n2.edges.get(j).tempWeight)); } } } for(int i=0; i < this.n.size(); i++){ node n= (node) this.n.get(i); Point p= (Point) n.p; if(location1.contains(n)) { gfx.setColor(Color.BLUE); } else { gfx.setColor(Color.GREEN); } gfx.fillOval(n.b.x , n.b.y ,n.b.width/2,n.b.height/2); gfx.setColor(Color.BLACK); gfx.setFont(new Font("Arial", Font.BOLD, 15)); gfx.drawString(n.name,p.x ,p.y ); } panel.getGraphics().drawImage(img, 0, 0, this); } boolean bfs(ArrayList<node>n,node s, node e, node parent[]) { Queue<node> qn=new LinkedList<>(); boolean visited[] = new boolean[n.size()]; for (int i = 0; i < visited.length; i++) { visited[i]=false; } visited[s.id]=true; parent[s.id]=null; qn.add(s); while(!qn.isEmpty()) { node v=qn.poll(); for (int i = 0; i < v.nebours.size(); i++) { if(!visited[v.nebours.get(i).id]&&v.edges.get(i).weight>0) { qn.add(v.nebours.get(i)); parent[v.nebours.get(i).id]=v; visited[v.nebours.get(i).id]=true; } } } return(visited[e.id]); } @Override public void paint(Graphics g) { super.paint(g); draw(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { panel = new javax.swing.JPanel(); panel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { boolean a; ArrayList<node>path=new ArrayList<node>(); if((a=bfs(n,src, Dist, parent))) { if(src==Dist) { for (int i = 0; i < src.nebours.size(); i++) { if(src==src.nebours.get(i)) { maximumFlow+=src.edges.get(i).weight; break; } } return; } int path_flow = Integer.MAX_VALUE; int i; for (node v=Dist; v!=src; v=parent[v.id]) { node u = parent[v.id]; path.add(v); for (i = 0; i < u.nebours.size(); i++) { if(u.nebours.get(i).id==v.id) { break; } } path_flow = Math.min(path_flow, u.edges.get(i).weight); } for (node v=Dist; v!=src; v=parent[v.id]) { node u = parent[v.id]; for (i = 0; i < u.nebours.size(); i++) { if(u.nebours.get(i).id==v.id) { break; } } u.edges.get(i).weight-=path_flow; } maximumFlow += path_flow; } if(a) path.add(src); location1=path; draw(); if(!a) { JOptionPane.showMessageDialog(null, "the maximum flow is "+maximumFlow); } } }); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel); panel.setLayout(panelLayout); panelLayout.setHorizontalGroup( panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 800, Short.MAX_VALUE) ); panelLayout.setVerticalGroup( panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 500, Short.MAX_VALUE) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ private javax.swing.JPanel panel; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
eslam-saleh.noreply@github.com
54f02da328ec91c959702481b17bf51a7ed241ce
d6e25ecba7bb58976802621248ffed64b76a166b
/src/linkedlists/IdenticalList.java
2aa88315e8bda16895d9bdbca4961cebceb1880a
[]
no_license
rishabhdaim/geeksforgeeks
d11a0d8ce614ab48750060138abafc1836062cc5
a549c107e0c607717773266a659452ad55376573
refs/heads/master
2021-01-16T17:54:54.326890
2017-09-07T06:58:35
2017-09-07T06:58:35
100,021,686
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
/** * */ package linkedlists; /** * @author aa49442 * */ public class IdenticalList { /** * @param args */ public static void main(String[] args) { SingleLinkedList<Integer> linkedList = new SingleLinkedList<Integer>(); for (int i = 0; i < 20; i++) linkedList.add((int) (Math.random() * 20)); System.out.println(linkedList); SingleLinkedList<Integer> linkedList2 = new SingleLinkedList<Integer>(); for (int i = 0; i < 20; i++) linkedList2.add(i); boolean t = linkedList.areIdentical(linkedList.getFirst(), linkedList2.getFirst()); System.out.println(t); SingleLinkedList<Integer> list = linkedList.splitAlt(); System.out.println(linkedList); System.out.println(list); linkedList2.deleteAlt(linkedList2.getFirst()); System.out.println(linkedList2); linkedList2.addFirst(234); linkedList2.pairWiseSwap(linkedList2.getFirst()); System.out.println(linkedList2); linkedList2.setLastLink(); System.out.println(linkedList2); linkedList2.moveLastToFirst(); System.out.println(linkedList2); linkedList2.printReverse(linkedList2.getFirst()); System.out.println(); } }
[ "Rishabh.Daim@iontrading.com" ]
Rishabh.Daim@iontrading.com
51cdf4ed9b83110cd2eb488aba7dece2f92dfa24
0be5f268ada9a0d561bb0b602192160e25a5f317
/thread/communication/XiaoFeiTrag.java
04aae5ad76a29965b01eefa4d60629933aecd24e
[]
no_license
vision735/TEST
d5eb8238016c620d4537ad48062aa0b7b1fab26d
2b1922513eaf8f134d244160bf379135732e25bf
refs/heads/master
2022-12-25T03:07:56.965587
2020-09-18T09:33:56
2020-09-18T09:33:56
296,561,504
0
0
null
null
null
null
UTF-8
Java
false
false
235
java
package thread.communication; public class XiaoFeiTrag implements Runnable { private Tianmao t; public XiaoFeiTrag(Tianmao t) { super(); this.t = t; } @Override public void run() { while (true) { t.xiaoFei(); } } }
[ "735396636@qq.com" ]
735396636@qq.com
886a8ac4f1cbe2208794d9cae0377b320757719f
2041b34bddfebbed094171bb0b57b7ac38f4561b
/ProductDao.java
1049a505d4f0f272889d38fd33f0d0b7d678fcde
[]
no_license
DSPNADAR/project
dba0ab20cfe21801962bc9267365f122f83289f1
2ddc86f4ee2610216c73ee29cf8686fe8daa9d0d
refs/heads/master
2021-01-11T20:27:09.402645
2017-04-02T12:19:41
2017-04-02T12:19:41
79,118,379
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.shopping.dao; import java.util.List; import com.shopping.model.Product; public interface ProductDao { public void addProduct(Product product); public void updateProduct(Product product); public List<Product> listProduct(); public void deleteProduct(int id); public Product getbyid(int id); }
[ "noreply@github.com" ]
DSPNADAR.noreply@github.com
8dba4b5d631beb1a4a56a698998b4126fbca2107
fa6765f6a13626e6d1abf1b6cd191614a76ca1e8
/xml-rpc/src/main/java/com/xidian/mti/rpc/servlet/XmlRpcServicesServlet.java
7deb958e4c1f3d2354225e9d6c87f7db61bc8103
[ "MIT" ]
permissive
XiDian-ChenMiao/rpc-practice
c3cfb74503f6fd62cf7c86952bdf6481ffecc641
63cc8a816767937a8d0e7c8c6543628245fdefd3
refs/heads/master
2021-08-27T17:23:12.234147
2017-06-04T12:17:55
2017-06-04T12:17:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,750
java
package com.xidian.mti.rpc.servlet; import com.xidian.mti.rpc.service.impl.EchoServiceImpl; import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.server.PropertyHandlerMapping; import org.apache.xmlrpc.server.XmlRpcServerConfigImpl; import org.apache.xmlrpc.webserver.XmlRpcServletServer; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * 文件描述:XML-RPC的服务Servlet * 创建作者:陈苗 * 创建时间:2017/5/25 21:36 */ public class XmlRpcServicesServlet extends HttpServlet { private XmlRpcServletServer server; @Override public void init(ServletConfig config) throws ServletException { super.init(config); try { server = new XmlRpcServletServer(); PropertyHandlerMapping mapping = new PropertyHandlerMapping(); mapping.addHandler("EchoService", EchoServiceImpl.class); server.setHandlerMapping(mapping); XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig(); serverConfig.setEnabledForExceptions(true); serverConfig.setContentLengthOptional(false); } catch (XmlRpcException e) { e.printStackTrace(); } } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { server.execute(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { server.execute(req, resp); } }
[ "786078509@qq.com" ]
786078509@qq.com
9be5b575328a9f86177499648b8424db60245971
59ac30a7f3e6927a67f03466148503f9f9a55daa
/src/main/java/com/whiuk/philip/worldquest/NPC.java
be566c20c16a80ddd7890ef19f6a0c4eed0b2d38
[]
no_license
philipwhiuk/worldquest
982b92df11271b908a1e420dd28fdab8ddc172a3
c7e2ffcc55b30e4f682daa6bd4caf645510a18af
refs/heads/master
2021-06-27T20:01:43.777525
2020-10-15T11:26:56
2020-10-15T11:26:56
157,082,573
0
0
null
2020-10-15T11:26:57
2018-11-11T13:32:29
Java
UTF-8
Java
false
false
3,863
java
package com.whiuk.philip.worldquest; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.whiuk.philip.worldquest.JsonUtils.intFromObj; public class NPC extends GameCharacter { final NPCType type; final int experience = 10; ConversationChoice currentConversation = null; Shop shop; MovementStrategy movementStrategy; NPC(NPCType type, int x, int y, MovementStrategy movementStrategy) { super(type.color, x, y, type.health, type.health); this.type = type; this.shop = type.shop; this.movementStrategy = movementStrategy; } boolean canMove() { return type.canMove; } boolean canFight() { return type.canFight; } boolean canTalk() { return type.canTalk; } void startConversation(WorldQuest game) { currentConversation = type.conversation.selector.apply(new QuestState(game)); } @Override void actionOnNpc(WorldQuest game, NPC npc) { } @Override int calculateDamage() { return RandomSource.getRandom().nextInt(type.damage); } @Override boolean isHit() { return RandomSource.getRandom().nextBoolean(); } public GObjects.ItemDrop dropItem() { return type.dropTable[RandomSource.getRandom().nextInt(type.dropTable.length)].spawn(); } public boolean isAggressive() { return type.isAggressive; } public boolean hasBeenAttacked() { return false; } } class Shop { final String name; List<ShopListing> items; Shop(String name, List<ShopListing> items) { this.name = name; this.items = items; } static class Provider { static Map<String, Shop> loadShopsFromJson(ScenarioData data, JSONArray shopsData) { Map<String, Shop> shops = new HashMap<>(); for (Object sO : shopsData) { JSONObject shopData = (JSONObject) sO; String id = (String) shopData.get("id"); String name = (String) shopData.get("name"); List<ShopListing> shopListings = new ArrayList<>(); JSONArray shopListingsData = (JSONArray) shopData.get("items"); for (Object sLO : shopListingsData) { JSONObject shopListingData = (JSONObject) sLO; shopListings.add(new ShopListing( data.itemType((String) shopListingData.get("item")), intFromObj(shopListingData.get("maxQuantity")), intFromObj(shopListingData.get("quantity")), intFromObj(shopListingData.get("basePrice")) )); } shops.put(id, new Shop(name, shopListings)); } return shops; } } public static class Persistor { public static JSONArray saveShopsToJson(Map<String, Shop> shops) { return new JSONArray(); //TOOD: /** buffer.write(Integer.toString(shops.size())); buffer.newLine(); **/ } } } class ShopListing { ItemType item; int maxQuantity; int quantity; int basePrice; public ShopListing(ItemType item, int maxQuantity, int quantity, int basePrice) { this.item = item; this.maxQuantity = maxQuantity; this.quantity = quantity; this.basePrice = basePrice; } public int getPrice() { return basePrice; } } class CraftingOptions { public final String name; public final List<Recipe> recipes; public CraftingOptions(String name, List<Recipe> recipes) { this.name = name; this.recipes = recipes; } }
[ "philip@whiuk.com" ]
philip@whiuk.com
5ff23e82476a919f22217abb380c93e66a31d709
abf82d2b91f7962e1ceda904d4f108e0985c6835
/app/src/main/java/com/snxun/kotlindemo/bean/NewsListBean.java
e5eefd3293d1730b4ac5b9a95f3f0297c4f1acaf
[]
no_license
lcl6/KotlinDemo
1ab34864020554c295b76b3111e3a3a2f6b4222e
aa66fe5d6944b764dc13451706859fcc686ef200
refs/heads/master
2021-06-27T20:00:16.878943
2020-11-09T01:43:35
2020-11-09T01:43:35
170,461,189
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.snxun.kotlindemo.bean; /** * Created by liancl on 2019/3/29. */ public class NewsListBean { public String title; public String id; public String desc; }
[ "chenlin123456" ]
chenlin123456
c1ec97091d907c70b849b6dd5f7086b1208e8c7a
bcb52270a7ed46ac353066570f17376710a8e9c0
/app/src/main/java/com/example/youtube/JSONResult.java
0e209a2fd09bff06ee0d73a1b6e72673aa8f5299
[]
no_license
sungjin-shin/week2
a1975eb71dbfa03492ccec973b1345640ea29405
356d56a2ab937ae2abe90395d92f4d4a36adee76
refs/heads/master
2022-11-22T23:51:46.007947
2020-07-18T07:39:55
2020-07-18T07:39:55
280,607,229
0
0
null
null
null
null
UTF-8
Java
false
false
58
java
package com.example.youtube; public class JSONResult { }
[ "hohi1114@naver.com" ]
hohi1114@naver.com
8637e641e7b80f7b718b63e30ce0359436e8507b
0bdc30382e6a4fd59c5cb46ee499053f7c288b6a
/src/main/java/com/afterpay/frauddetector/handler/impl/SparkContextHandlerImpl.java
a7f093b2383ef347543874b8bd4904d780898238
[]
no_license
arjunduggal/fraud-detector
e3c80432de7bfe5911182df1f0818b517448dca3
6ed332f00500c69b154f28641684d3efe2e49cbb
refs/heads/master
2023-03-01T18:27:59.432256
2021-02-10T00:55:10
2021-02-10T00:55:10
326,852,022
0
0
null
null
null
null
UTF-8
Java
false
false
1,204
java
package com.afterpay.frauddetector.handler.impl; import java.io.Serializable; import com.afterpay.frauddetector.constants.Constants; import com.afterpay.frauddetector.handler.SparkContextHandler; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaSparkContext; import org.springframework.stereotype.Component; /** * Implementation of {@link SparkContextHandler} to read data from local file system * * @author arjunduggal */ @Component public class SparkContextHandlerImpl implements SparkContextHandler, Serializable { private static final long serialVersionUID = 4704575839318844057L; @Override public JavaSparkContext initializeContext(final String appName) { return getJavaSparkContext(appName, true); } @Override public void closeContext(final JavaSparkContext sparkContext) { sparkContext.close(); } private JavaSparkContext getJavaSparkContext(final String appName, final boolean islocal) { final SparkConf sparkConf = new SparkConf().setAppName(appName); if (islocal) { sparkConf.setMaster(Constants.LOCAL_SPARK_MASTER); } return new JavaSparkContext(sparkConf); } }
[ "arjun.duggal@nagarro.com" ]
arjun.duggal@nagarro.com
a5ff882f0888a22db2abcaf61d44e8e9983f6ef6
144c89e34383c239283f8bdfb420e029c56ccaff
/src/main/java/com/cse/network/NaverBlogAPI.java
6744a501349fa631ff9e97074307b0f2b8adc3e2
[]
no_license
dgu-cse-lumidiet/lumidiet-learning
0e451c601c7ae4b0a5528e5c97ab464cf99a89c2
3215d21b8d0d5f98a3aaa5d7728cbedc97f80d87
refs/heads/master
2021-01-11T22:58:36.594671
2017-01-10T12:33:45
2017-01-10T12:33:45
78,529,657
0
0
null
null
null
null
UTF-8
Java
false
false
1,237
java
package com.cse.network; import com.cse.entity.Subject; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.io.Serializable; import java.util.ArrayList; /** * Created by bullet on 16. 10. 4. */ public class NaverBlogAPI extends NaverAPI implements Serializable{ public NaverBlogAPI(){ super(); BASE_URL ="https://openapi.naver.com/v1/search/blog.xml?display=100"; } /** * API의 ITEM 태그로부터 Blog에 대한 Subject 객체 생성하여 반환 * @param body API의 ITEM 태그에 대한 HTML 코드 * @return Subject List * @throws Exception */ public ArrayList<Subject> parseSubjects(String body) throws Exception { ArrayList<Subject> subjects = new ArrayList<Subject>(); NodeList itemList = parseItems(body); int docCnt = itemList.getLength(); for(int i=0; i< docCnt; i++){ Node node = itemList.item(i); if(node.getNodeType() == Node.ELEMENT_NODE){ Element element = (Element) node; String link = getTagValue(TAG_LINK, element); subjects.add(new Subject(link)); } } return subjects; } }
[ "myungjae92@gmail.com" ]
myungjae92@gmail.com
50ec0297fb88ed936fde1c482e93adb95beb3e06
eb6f4e4345cb1a3f4a60898943df2a649509563d
/src/pdfmerge/MainFrame.java
40a782f15891524130e683c184444568c6323b97
[ "Apache-2.0" ]
permissive
pksingh99/PDFMerge
972e29c5bf4560465f279f52524d8b229b99cb48
a837953edade7d63077b69b74141078a5849b17d
refs/heads/master
2020-03-30T16:05:36.719191
2014-08-25T04:55:45
2014-08-25T04:55:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,251
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 pdfmerge; import java.awt.Desktop; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.DefaultListModel; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.util.PDFMergerUtility; /** * * @author Paul */ public class MainFrame extends javax.swing.JFrame { private final DefaultListModel<String> pdfModel; private String sLastLoc; /** * Creates new form MainFrame */ public MainFrame() { pdfModel = new DefaultListModel<>(); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bMerge = new javax.swing.JButton(); bClose = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); bAddPdf = new javax.swing.JButton(); bRemovePdf = new javax.swing.JButton(); lStatus = new javax.swing.JLabel(); bMoveUp = new javax.swing.JButton(); bMoveDown = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); menu_Close = new javax.swing.JMenu(); menClose = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("PDF Merge"); setMinimumSize(new java.awt.Dimension(350, 250)); bMerge.setText("Merge PDFs"); bMerge.setEnabled(false); bMerge.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bMergeActionPerformed(evt); } }); bClose.setText("Close"); bClose.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bCloseActionPerformed(evt); } }); pdfList.setModel(pdfModel); pdfList.setDragEnabled(true); pdfList.setDropMode(javax.swing.DropMode.INSERT); pdfList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { pdfListValueChanged(evt); } }); jScrollPane1.setViewportView(pdfList); bAddPdf.setText("Add PDF"); bAddPdf.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bAddPdfActionPerformed(evt); } }); bRemovePdf.setText("Remove Selected"); bRemovePdf.setEnabled(false); bRemovePdf.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bRemovePdfActionPerformed(evt); } }); lStatus.setText("PDFs will be appended in the order shown above"); bMoveUp.setText("Move Up"); bMoveUp.setEnabled(false); bMoveUp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bMoveUpActionPerformed(evt); } }); bMoveDown.setText("Move Down"); bMoveDown.setEnabled(false); bMoveDown.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bMoveDownActionPerformed(evt); } }); menu_Close.setText("File"); menClose.setText("Close"); menClose.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menCloseActionPerformed(evt); } }); menu_Close.add(menClose); jMenuBar1.add(menu_Close); jMenu2.setText("Edit"); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(bMerge) .addGap(18, 18, 18) .addComponent(lStatus) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE) .addComponent(bClose)) .addGroup(layout.createSequentialGroup() .addComponent(bAddPdf) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(bRemovePdf) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jScrollPane1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(bMoveDown, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(bMoveUp, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(bMoveUp) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(bMoveDown) .addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(bAddPdf) .addComponent(bRemovePdf)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(bMerge) .addComponent(bClose) .addComponent(lStatus)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void menCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menCloseActionPerformed // TODO add your handling code here: System.exit(0); }//GEN-LAST:event_menCloseActionPerformed private void bMergeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMergeActionPerformed // TODO add your handling code here: JFileChooser fc = new JFileChooser(); //fc.setCurrentDirectory(new File(System.getProperty("user.home"))); if (sLastLoc != null) { fc.setCurrentDirectory(new File(sLastLoc)); } fc.setSelectedFile(new File("MyMerge.pdf")); boolean isMerged = false; if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File fOut = fc.getSelectedFile(); if (fOut.getName().endsWith(".pdf")) { isMerged = mergePDFs(fOut.getPath()); } else { isMerged = mergePDFs(fOut.getPath() + ".pdf"); } lStatus.setText("Done!"); try { Desktop.getDesktop().open(fOut); } catch (IOException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); } } }//GEN-LAST:event_bMergeActionPerformed private void bCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCloseActionPerformed // TODO add your handling code here: System.exit(0); }//GEN-LAST:event_bCloseActionPerformed private void bAddPdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddPdfActionPerformed // TODO add your handling code here: JFileChooser fc = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("PDF Files", "pdf"); fc.setFileFilter(filter); fc.setMultiSelectionEnabled(true); if (sLastLoc != null) { fc.setCurrentDirectory(new File(sLastLoc)); } if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { sLastLoc = fc.getSelectedFile().getPath(); for (File f : fc.getSelectedFiles()) { pdfModel.addElement(f.getPath()); } bMerge.setEnabled(true); } }//GEN-LAST:event_bAddPdfActionPerformed private void bRemovePdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bRemovePdfActionPerformed // TODO add your handling code here: while (pdfList.getSelectedIndex() >= 0) { pdfModel.remove(pdfList.getSelectedIndex()); } if(pdfModel.getSize() == 0) bMerge.setEnabled(false); }//GEN-LAST:event_bRemovePdfActionPerformed private void bMoveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMoveUpActionPerformed // TODO add your handling code here: int nIndex = pdfList.getSelectedIndex(); pdfModel.add(nIndex-1, pdfModel.get(nIndex)); pdfModel.remove(nIndex+1); pdfList.setSelectedIndex(nIndex-1); }//GEN-LAST:event_bMoveUpActionPerformed private void pdfListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_pdfListValueChanged // TODO add your handling code here: int index = pdfList.getSelectedIndex(); if(index >= 0) { if(index == pdfModel.size()-1) bMoveDown.setEnabled(false); else bMoveDown.setEnabled(true); if(index == 0) bMoveUp.setEnabled(false); else bMoveUp.setEnabled(true); bRemovePdf.setEnabled((true)); } else bRemovePdf.setEnabled(false); }//GEN-LAST:event_pdfListValueChanged private void bMoveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMoveDownActionPerformed // TODO add your handling code here: int nIndex = pdfList.getSelectedIndex(); pdfModel.add(nIndex+2, pdfModel.get(nIndex)); pdfModel.remove(nIndex); pdfList.setSelectedIndex(nIndex+1); }//GEN-LAST:event_bMoveDownActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton bAddPdf; private javax.swing.JButton bClose; private javax.swing.JButton bMerge; private javax.swing.JButton bMoveDown; private javax.swing.JButton bMoveUp; private javax.swing.JButton bRemovePdf; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lStatus; private javax.swing.JMenuItem menClose; private javax.swing.JMenu menu_Close; private final javax.swing.JList pdfList = new javax.swing.JList(); // End of variables declaration//GEN-END:variables private boolean mergePDFs(String sDest) { PDFMergerUtility ut = new PDFMergerUtility(); for (Object s : pdfModel.toArray()) { System.out.println("Merging " + s); ut.addSource((String) s); } ut.setDestinationFileName(sDest); System.out.println("Output Location: " + sDest); try { ut.mergeDocuments(); } catch (IOException | COSVisitorException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); return false; } return true; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "pfguenette@gmail.com" ]
pfguenette@gmail.com
8f264f8e1e72ce4e65250a7be755d82c30b2cb18
7f94eb61998b2ddedbb6c76990584dd71b0ee788
/TravelAgency/src/UserInterface/SearchFlights/SeatingArrangementJPanel.java
cddbf2cff76c1bdcab19f91d741ae393265189a1
[]
no_license
shivanivats01/Team-28
92e2f42324814e8f4c5841fc940b2c88b936b31b
e0a53458eda0c9aaf725686da4e07853307340e4
refs/heads/master
2023-02-01T11:19:20.063010
2020-12-16T00:18:59
2020-12-16T00:18:59
304,504,541
0
0
null
2020-12-16T00:19:00
2020-10-16T03:01:26
Java
UTF-8
Java
false
false
16,165
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 UserInterface.SearchFlights; import Business.Customer; import Business.Flight; import Business.Seat; import java.awt.CardLayout; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * * @author jshar */ public class SeatingArrangementJPanel extends javax.swing.JPanel { private Seat seat; private JPanel CardSequenceJPanel; private Flight flight; private Customer customer; /** * Creates new form BookingJPanel */ public SeatingArrangementJPanel(JPanel CardSequenceJPanel, Flight flight, Customer customer, Seat seat) { initComponents(); this.CardSequenceJPanel = CardSequenceJPanel; this.flight = flight; this.customer = customer; this.seat = seat; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); boxSeatNumber = new javax.swing.JComboBox<>(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); leftWindowRadioButton = new javax.swing.JRadioButton(); leftMiddleRadioButton = new javax.swing.JRadioButton(); rightAisleRadioButton = new javax.swing.JRadioButton(); leftAisleRadioButton = new javax.swing.JRadioButton(); rightWindowRadioButton = new javax.swing.JRadioButton(); rightMiddleRadioButton = new javax.swing.JRadioButton(); btnNext = new javax.swing.JButton(); btnBack = new javax.swing.JButton(); setBackground(new java.awt.Color(255, 255, 255)); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N jLabel1.setText("Seating Arrangement"); jLabel2.setText("Seat No."); boxSeatNumber.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25" })); jLabel3.setText("Left"); jLabel4.setText("Right"); leftWindowRadioButton.setText("Window"); leftWindowRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { leftWindowRadioButtonActionPerformed(evt); } }); leftMiddleRadioButton.setText("Middle"); leftMiddleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { leftMiddleRadioButtonActionPerformed(evt); } }); rightAisleRadioButton.setText("Aisle"); rightAisleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rightAisleRadioButtonActionPerformed(evt); } }); leftAisleRadioButton.setText("Aisle"); leftAisleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { leftAisleRadioButtonActionPerformed(evt); } }); rightWindowRadioButton.setText("Window"); rightWindowRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rightWindowRadioButtonActionPerformed(evt); } }); rightMiddleRadioButton.setText("Middle"); rightMiddleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rightMiddleRadioButtonActionPerformed(evt); } }); btnNext.setText("Confirm"); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); btnBack.setText("Back"); btnBack.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBackActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(239, 239, 239) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(190, 190, 190) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(leftWindowRadioButton) .addComponent(leftMiddleRadioButton, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(leftAisleRadioButton, javax.swing.GroupLayout.Alignment.LEADING)) .addComponent(jLabel3)) .addGap(269, 269, 269) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rightAisleRadioButton) .addComponent(rightMiddleRadioButton) .addComponent(rightWindowRadioButton) .addComponent(jLabel4))) .addGroup(layout.createSequentialGroup() .addGap(230, 230, 230) .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(boxSeatNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(334, 334, 334) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnNext, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(414, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(50, 50, 50) .addComponent(jLabel1) .addGap(93, 93, 93) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(boxSeatNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(48, 48, 48) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(leftWindowRadioButton) .addComponent(rightWindowRadioButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rightMiddleRadioButton) .addComponent(leftMiddleRadioButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rightAisleRadioButton) .addComponent(leftAisleRadioButton)) .addGap(18, 18, 18) .addComponent(btnNext) .addGap(18, 18, 18) .addComponent(btnBack) .addContainerGap(168, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void leftWindowRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftWindowRadioButtonActionPerformed // TODO add your handling code here: if(leftWindowRadioButton.isSelected()) { leftAisleRadioButton.setSelected(false); leftMiddleRadioButton.setSelected(false); rightAisleRadioButton.setSelected(false); rightMiddleRadioButton.setSelected(false); rightWindowRadioButton.setSelected(false); } }//GEN-LAST:event_leftWindowRadioButtonActionPerformed private void leftMiddleRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftMiddleRadioButtonActionPerformed // TODO add your handling code here: if(leftMiddleRadioButton.isSelected()) { leftAisleRadioButton.setSelected(false); leftWindowRadioButton.setSelected(false); rightAisleRadioButton.setSelected(false); rightMiddleRadioButton.setSelected(false); rightWindowRadioButton.setSelected(false); } }//GEN-LAST:event_leftMiddleRadioButtonActionPerformed private void rightAisleRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rightAisleRadioButtonActionPerformed // TODO add your handling code here: if(rightAisleRadioButton.isSelected()) { leftAisleRadioButton.setSelected(false); leftWindowRadioButton.setSelected(false); leftMiddleRadioButton.setSelected(false); rightMiddleRadioButton.setSelected(false); rightWindowRadioButton.setSelected(false); } }//GEN-LAST:event_rightAisleRadioButtonActionPerformed private void leftAisleRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftAisleRadioButtonActionPerformed // TODO add your handling code here: if(leftAisleRadioButton.isSelected()) { rightAisleRadioButton.setSelected(false); leftWindowRadioButton.setSelected(false); leftMiddleRadioButton.setSelected(false); rightMiddleRadioButton.setSelected(false); rightWindowRadioButton.setSelected(false); } }//GEN-LAST:event_leftAisleRadioButtonActionPerformed private void rightWindowRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rightWindowRadioButtonActionPerformed // TODO add your handling code here: if(rightWindowRadioButton.isSelected()) { leftAisleRadioButton.setSelected(false); leftMiddleRadioButton.setSelected(false); rightAisleRadioButton.setSelected(false); rightMiddleRadioButton.setSelected(false); leftWindowRadioButton.setSelected(false); } }//GEN-LAST:event_rightWindowRadioButtonActionPerformed private void rightMiddleRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rightMiddleRadioButtonActionPerformed // TODO add your handling code here: if(rightMiddleRadioButton.isSelected()) { leftAisleRadioButton.setSelected(false); leftWindowRadioButton.setSelected(false); rightAisleRadioButton.setSelected(false); leftMiddleRadioButton.setSelected(false); rightWindowRadioButton.setSelected(false); } }//GEN-LAST:event_rightMiddleRadioButtonActionPerformed private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBackActionPerformed // TODO add your handling code here: CardSequenceJPanel.remove(this); CardLayout layout = (CardLayout) CardSequenceJPanel.getLayout(); layout.previous(CardSequenceJPanel); }//GEN-LAST:event_btnBackActionPerformed private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed // TODO add your handling code here: if(boxSeatNumber.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(null,"Please select a row"); return; } if(leftAisleRadioButton.isSelected() == false && leftWindowRadioButton.isSelected() == false && leftMiddleRadioButton.isSelected() == false && rightMiddleRadioButton.isSelected() == false && rightAisleRadioButton.isSelected() == false && rightWindowRadioButton.isSelected() == false) { JOptionPane.showMessageDialog(null,"Please select Seat preference"); return; } String str = ""; if(leftWindowRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "A"; } else if(leftMiddleRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "B"; } else if(leftAisleRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "C"; } else if(rightAisleRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "D"; } else if(rightMiddleRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "E"; } else if(rightWindowRadioButton.isSelected()) { str = String.valueOf(boxSeatNumber.getSelectedIndex()) + "F"; } System.out.println(flight.getFlightNumber()); if(seat.getSeats(flight.getFlightNumber()).contains(str)) { JOptionPane.showMessageDialog(null,"Seat Already Selected by another customer"); return; } else { seat.setSeat(flight.getFlightNumber(), str); customer.addFlightInfo(flight, str); JOptionPane.showMessageDialog(null,"Flight Booked"); CardSequenceJPanel.remove(this); CardLayout layout = (CardLayout) CardSequenceJPanel.getLayout(); layout.previous(CardSequenceJPanel); } }//GEN-LAST:event_btnNextActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox<String> boxSeatNumber; private javax.swing.JButton btnBack; private javax.swing.JButton btnNext; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JRadioButton leftAisleRadioButton; private javax.swing.JRadioButton leftMiddleRadioButton; private javax.swing.JRadioButton leftWindowRadioButton; private javax.swing.JRadioButton rightAisleRadioButton; private javax.swing.JRadioButton rightMiddleRadioButton; private javax.swing.JRadioButton rightWindowRadioButton; // End of variables declaration//GEN-END:variables }
[ "sharma.jat@northeastern.edu" ]
sharma.jat@northeastern.edu
64ad4e1f7b8bb296c9bb26a1bfdd04ca6a819b37
49ce8ee5c443c7c13960500fd8a036ce879e35ea
/transport/src/main/java/com/codekutter/zconfig/transport/events/RegisterMessage.java
74884f674bfac9c0f94774f8fe04580a955e76be
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
subhagho/zconfig
a4b66000eb9a32907950a737df8a82bfd0b98381
140337431a5394e8e595c9cc0fd104ccf79e8d7c
refs/heads/master
2020-04-13T23:37:36.375001
2020-01-28T17:12:45
2020-01-28T17:12:45
163,511,442
2
1
Apache-2.0
2020-03-04T22:33:41
2018-12-29T13:02:07
Java
UTF-8
Java
false
false
1,333
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. * * Copyright (c) $year * Date: 4/3/19 9:54 PM * Subho Ghosh (subho dot ghosh at outlook.com) * */ package com.codekutter.zconfig.transport.events; import com.codekutter.zconfig.common.ZConfigInstance; import lombok.Getter; import lombok.Setter; /** * Message Body to be send during instance registration. */ @Getter @Setter public class RegisterMessage { /** * Instance handle. */ private ZConfigInstance instance; /** * Authentication header. */ private AuthHeader authHeader; }
[ "subho.ghosh@outlook.com" ]
subho.ghosh@outlook.com
72b17944fcdb4e873d2613cbe735867da8ea43a4
baf03272774e32a60a3b21817400d57d1347068d
/src/_21/Constructors/Primate.java
51e028c8d93df84a17352a7036693253820062ea
[]
no_license
Arasefe/OCAPREP
8e22c1df09efcdad1d8ab6a09c63d4a5058cf81e
f0a411d508b8ad93a9b8ac2b414f99c79ce8005d
refs/heads/master
2022-10-21T14:51:16.594373
2020-06-08T21:56:24
2020-06-08T21:56:24
270,837,935
0
0
null
null
null
null
UTF-8
Java
false
false
523
java
package _21.Constructors; public class Primate { public Primate(){ System.out.println("Primate"); } } class Ape extends Primate{ public Ape(){ super(); System.out.println("Ape"); } } class Chimpanzee extends Ape{ public Chimpanzee(){ super(); System.out.println("Chimpanzee"); } public static void main(String[] args) { // Be wary of the Object and print method in main method new Chimpanzee(); System.out.println("ch"); } }
[ "arasefe@users.noreply.github.com" ]
arasefe@users.noreply.github.com