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
2c6c4666207be31899bc6160385d1f43baa6df46
faeb9a179e5ba61754704234930c05f8e0f57e6e
/test/pl/konieczki/sudokufinder/strategies/FindOnlyOneOccurrenceOfValueInSquareStrategyTest.java
c2c6897075f66b7bab38668486b6934d2bb01cd2
[]
no_license
pawel-konieczka/sudoku_finder
292f76890873bc9828cb60c03b989a28e168a574
ac6b937a4bd04b7ab6958007a2b125742ef5f561
refs/heads/master
2023-06-09T11:00:26.168311
2021-06-21T17:02:08
2021-06-21T17:02:08
378,991,195
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
package pl.konieczki.sudokufinder.strategies; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import pl.konieczki.sudokufinder.model.SudokuFieldSquareId; import pl.konieczki.sudokufinder.model.SudokuPossibilitiesHolder; import pl.konieczki.sudokufinder.strategies.deterministic.AbstractDeterministicStrategy; import pl.konieczki.sudokufinder.strategies.deterministic.FindOnlyOneOccurrenceOfValueInSquareStrategy; public class FindOnlyOneOccurrenceOfValueInSquareStrategyTest { private final AbstractDeterministicStrategy strategy = new FindOnlyOneOccurrenceOfValueInSquareStrategy(SudokuFieldSquareId.SQUARE_I); @Before public void setup() { strategy.resetNothingToWorkFlag(); } @Test public void when_no_singles_exist_then_nothing_changed() { final SudokuPossibilitiesHolder testedValue = new SudokuPossibilitiesHolder(); final SudokuPossibilitiesHolder expectedValue = testedValue.duplicate(); final boolean result = strategy.apply(testedValue); Assert.assertFalse(result); Assert.assertEquals(expectedValue.toString(), testedValue.toString()); } @Test public void when_value_3_exists_then_nothing_changed() { final SudokuPossibilitiesHolder testedValue = new SudokuPossibilitiesHolder(); testedValue.setValue(2, 2, (byte) 3); final SudokuPossibilitiesHolder expectedValue = testedValue.duplicate(); final boolean result = strategy.apply(testedValue); Assert.assertFalse(result); Assert.assertEquals(expectedValue.toString(), testedValue.toString()); } @Test public void when_possible_3_exists_in_one_possibles_then_3_is_set_as_value() { final SudokuPossibilitiesHolder testedValue = new SudokuPossibilitiesHolder(); final byte TREE = (byte) 3; testedValue.removePossible(1, 1, TREE); testedValue.removePossible(1, 2, TREE); testedValue.removePossible(1, 3, TREE); testedValue.removePossible(2, 2, TREE); testedValue.removePossible(2, 3, TREE); testedValue.removePossible(3, 1, TREE); testedValue.removePossible(3, 2, TREE); testedValue.removePossible(3, 3, TREE); final SudokuPossibilitiesHolder expectedValue = testedValue.duplicate(); expectedValue.setValue(2, 1, TREE); final boolean result = strategy.apply(testedValue); Assert.assertTrue(result); Assert.assertEquals(expectedValue.toString(), testedValue.toString()); } }
[ "pawel.konieczka@wp.pl" ]
pawel.konieczka@wp.pl
9f195d28a178a5743a4da2ab90e83d1dc586cba8
c5e1415576d5cf882d7d2aaa9cf092a7b4e9ce24
/src/test/java/CalendarTest.java
1dffc128df739b482b3d04961aa93940ac8dced7
[ "Apache-2.0" ]
permissive
june2/spring-xml-api
f78db67af063a60ce4059fb550b53ae572775656
9d6544f7dd5fc9ad6a430167e705c7f5577744c2
refs/heads/master
2020-03-29T18:45:54.745491
2018-09-25T08:18:32
2018-09-25T08:18:32
150,230,415
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
//import java.text.DecimalFormat; //import java.text.ParseException; //import java.text.SimpleDateFormat; //import java.util.Calendar; //import java.util.Locale; // //public class CalendarTest { // public static void main(String[] args) throws ParseException { //// Calendar cal = Calendar.getInstance(); //// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //// cal.setTime(sdf.parse("2017-12-01 00:00:00.0"));// all done //// //// //// System.out.println(cal); // DecimalFormat format = new DecimalFormat(".##"); // // System.out.println(format.format(Double.parseDouble("34.23422".toString()))); // } //}
[ "kimjy4536@hotmail.com" ]
kimjy4536@hotmail.com
9bc3a5960728867c473c86806102e0eb78249c53
59f4afebfff5f4d1b186f81e747db16d547d7b3d
/src/test/java/com/rbkmoney/branchchanges/BranchChangesApplicationTest.java
191f9f6f390fd3fd40a1d8c976138c91a17ae738
[]
no_license
D-Baykov/branch_changes
d5d71f0093e38b4445ad584b8ef1c0a09d6f2c37
912b162f62b55707a39344b9bc8abee34738fef9
refs/heads/master
2022-04-16T16:58:34.351066
2020-04-14T13:13:54
2020-04-14T13:13:54
255,588,021
0
0
null
2020-04-14T13:38:12
2020-04-14T11:15:59
Java
UTF-8
Java
false
false
400
java
package com.rbkmoney.branchchanges; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = BranchChangesApplication.class) public class BranchChangesApplicationTest { @Test public void contextLoads() { } }
[ "d.baykov@rbkmoney.com" ]
d.baykov@rbkmoney.com
4dade4beb8489dc61abadcc20c68195d0432bf65
9e771b0c7b7214adc617ff075d75fa1a7edbff91
/app/src/main/java/com/example/danieltovesson/hellosensor/helpers/Functions.java
c86983c78ef7885e9336f3fb980da5c266e335a3
[]
no_license
danieltovesson/MAMN01---Individuell-uppgift
171fb2e58a66c19441c3b450b1eda52e05b942f5
6c7773fcb99787b051aeba0ad859b942efb01f7f
refs/heads/master
2020-04-17T17:09:08.764477
2018-04-18T09:40:44
2018-04-18T09:40:44
166,771,154
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.example.danieltovesson.hellosensor.helpers; import java.math.BigDecimal; /** * Created by danieltovesson on 2018-03-22. */ public class Functions { // Variables static final float ALPHA = 0.07f; /** * Uses a low pass filter on the input * * @param input the input * @param output the output * @return the low pass filtered output */ public static float[] lowPassFilter(float[] input, float[] output) { if (output == null) { return input; } for (int i = 0; i < input.length; i++) { output[i] = round(output[i] + ALPHA * (input[i] - output[i]), 2); } return output; } /** * Rounds a float value * * @param d the float value * @param decimalPlace the number of decimals * @return the rounded float value */ public static float round(float d, int decimalPlace) { BigDecimal bd = new BigDecimal(Float.toString(d)); bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP); return bd.floatValue(); } }
[ "daniel.tovesson@me.com" ]
daniel.tovesson@me.com
66a4934fe097cec98a9595221e7ece95f234aec3
36838dfcd53c4d2c73b9a6b0b7a8a28e4a331517
/com/amap/api/maps/offlinemap/City.java
fcb4c45bbaefc0e8d1fb281b12f796829bb8b02e
[]
no_license
ShahmanTeh/MiFit-Java
fbb2fd578727131b9ac7150b86c4045791368fe8
93bdf88d39423893b294dec2f5bf54708617b5d0
refs/heads/master
2021-01-20T13:05:10.408158
2016-02-03T21:02:55
2016-02-03T21:02:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,757
java
package com.amap.api.maps.offlinemap; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; public class City implements Parcelable { public static final Creator<City> CREATOR = new a(); private String a; private String b; private String c; private String d; private String e; private String f; public City(Parcel parcel) { this.a = parcel.readString(); this.b = parcel.readString(); this.c = parcel.readString(); this.d = parcel.readString(); this.e = parcel.readString(); this.f = parcel.readString(); } public int describeContents() { return 0; } public String getAdcode() { return this.f; } public String getCity() { return this.a; } public String getCode() { return this.b; } public String getJianpin() { return this.c; } public String getPinyin() { return this.d; } public String getProvince() { return this.e; } public void setAdcode(String str) { this.f = str; } public void setCity(String str) { this.a = str; } public void setCode(String str) { this.b = str; } public void setJianpin(String str) { this.c = str; } public void setPinyin(String str) { this.d = str; } public void setProvince(String str) { this.e = str; } public void writeToParcel(Parcel parcel, int i) { parcel.writeString(this.a); parcel.writeString(this.b); parcel.writeString(this.c); parcel.writeString(this.d); parcel.writeString(this.e); parcel.writeString(this.f); } }
[ "kasha_malaga@hotmail.com" ]
kasha_malaga@hotmail.com
de53468f23938195b38230b4153d4c7001f5ca11
f1bf385fed03eb2a05d65f2f13755becd01d3c17
/BasicAlgos/src/fundModels/Stack/FixedCapacityStackOfStrings.java
4e93251efa95ecb01fff080b5344a3b5952356f1
[]
no_license
MoleImg/Algos
d0c8148e29c068461445a9504dbd64a687df1d94
de483cfbc36198cfdc29d31977f804be5d92bc8f
refs/heads/master
2021-05-12T16:10:52.916369
2018-03-11T16:44:03
2018-03-11T16:44:03
117,004,420
0
0
null
null
null
null
UTF-8
Java
false
false
607
java
/** * FixedCapacityStackOfStrings.java * Todo: Implementation of a string stack by an array of fixed capacity */ package fundModels.Stack; public class FixedCapacityStackOfStrings { private String[] s; private int N = 0; // size of the stack public FixedCapacityStackOfStrings(int capacity) { s = new String[capacity]; } public boolean isEmpty() { return N == 0; } public void push(String item) { s[N++] = item; } public String pop() { String item = s[--N]; s[N] = null; return item; } public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "ACM@CHOUdeMacBook-Pro.local" ]
ACM@CHOUdeMacBook-Pro.local
10c2bc58804fba023b8c2f06980bc18d89441cd6
26b23f2a485d9697fd28e51b9913219500874ea2
/src/com/CarlosMestas/Swaps/BurbujaPanelA.java
194b59b0b3423a9aca15540650e953cf8aff2e6e
[]
no_license
CarlosMestas/SortingSwaps
dc9044743aebeaf2a88a82b4930f536c95f5566a
2a8963133cdb5e950a38287eca743a6c6dc2d649
refs/heads/master
2020-09-12T07:17:17.527519
2019-11-23T09:41:16
2019-11-23T09:41:16
222,352,966
0
0
null
null
null
null
UTF-8
Java
false
false
3,536
java
package com.CarlosMestas.Swaps; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.Rectangle2D; import java.util.Random; import javax.swing.JPanel; import javax.swing.SwingWorker; /** * @author Carlos Alberto Mestas Escarcena */ public class BurbujaPanelA extends JPanel implements Runnable{ Thread thread; private int NUM_BOX = BurbujaFrm.cantNumbers; private Dimension dimension = new Dimension(500,128); private BoxNumber[] bNumber; public BurbujaPanelA(){ setSize(dimension); setVisible(true); } @Override public void paintComponent(Graphics g){ Graphics2D g2 =(Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); g2.setColor( new Color(255,255,255) ); g2.fill(new Rectangle2D.Double(0,0,getWidth(),getHeight())); //pinta numeros y casillas if(bNumber!=null) for(BoxNumber b:bNumber){ b.draw(g2); } } public void generar3(BoxNumber[] array){ bNumber = array; for(int i = 0;i < NUM_BOX;i++){ bNumber[i].x = 10; bNumber[i].y = 10 + bNumber[i].HEIGHT * i ; bNumber[i].setNumber(String.valueOf(bNumber[i].WIDTH )); } repaint(); } public void ordenar(){ if(bNumber!=null) new BurbujaWorker().execute();//inicia worker } public class BurbujaWorker extends SwingWorker<Void, Void> { private int SPEED = 1; @Override protected Void doInBackground() throws Exception { int i, j; BoxNumber aux; for(i=0;i<bNumber.length-1;i++) for(j=0;j<bNumber.length-i-1;j++) if(bNumber[j+1].getValue()<bNumber[j].getValue()){ aux = bNumber[j+1]; //animar movimiento bNumber[j].colorBg = new Color(104,169,213); bNumber[j+1].colorBg = new Color(104,169,213); girar(j,j+1); bNumber[j].colorBg = new Color(80,172,178); bNumber[j+1].colorBg = new Color(80,172,178); bNumber[j+1]=bNumber[j]; bNumber[j]=aux; } BurbujaFrm.jButton1.setEnabled(true); BurbujaFrm.jButton2.setEnabled(true); BurbujaFrm.jButton3.setEnabled(true); BurbujaFrm.jButton4.setEnabled(true); return null; } private void girar(int a , int b){ for(int i=0; i < bNumber[0].HEIGHT;i++){ bNumber[a].y += 1; bNumber[b].y -= 1; try { Thread.sleep(SPEED); } catch (InterruptedException e) {} repaint(); } } } public void start(){ if(thread == null){ thread = new Thread((java.lang.Runnable) this); thread.start(); } } @Override public void run() { ordenar(); } public void stop(){ if(thread!=null){ thread.stop(); thread=null; } } }
[ "cmestas@unsa.edu.pe" ]
cmestas@unsa.edu.pe
f20be4ab276d4cb204d90b7c2677f075bd83001c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_f055e78a1c75707ac45e1c203f50438084fc8070/Activator/4_f055e78a1c75707ac45e1c203f50438084fc8070_Activator_t.java
aa0dd97e32a8dfc4dd18cd5b72e80b6e936bbbbb
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
13,136
java
/******************************************************************************* * Copyright (c) 2008, 2009 Bug Labs, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of Bug Labs, Inc. nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ package com.buglabs.bug.bmi; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; import com.buglabs.bug.bmi.pub.Manager; import com.buglabs.bug.module.pub.IModlet; import com.buglabs.bug.module.pub.IModletFactory; import com.buglabs.util.StringUtil; public class Activator implements BundleActivator, ServiceListener { private static final String DEFAULT_PIPE_FILENAME = "/tmp/eventpipe"; private static Activator ref; public static Activator getRef() { return ref; } private PipeReader pipeReader; private String pipeFilename; private LogService logService; private Map modletFactories; private Map activeModlets; private BundleContext context; private void coldPlug() throws IOException { Manager m = Manager.getManager(); List modules = getSysFSModules(); if (modules != null) { for (Iterator i = modules.iterator(); i.hasNext();) { String bmiMessage = (String) i.next(); logService.log(LogService.LOG_INFO, "Registering existing module with message: " + bmiMessage); m.processMessage(bmiMessage); } } } private void createModlets(IModletFactory factory) throws Exception { IModlet modlet = factory.createModlet(context, 0); modlet.setup(); modlet.start(); } /** * Create a pipe file by executing an external process. Requires that the * host system has the "mkfifo" program. * * @param filename * @throws IOException */ private void createPipe(String filename) throws IOException { File f = new File(filename); // Check to see if file exists. If so delete and recreate to confirm // it's a pipe. if (f.exists()) { logService.log(LogService.LOG_INFO, "Pipe " + f.getAbsolutePath() + " already exists, deleting."); destroyPipe(f); } String cmd = "/usr/bin/mkfifo " + f.getAbsolutePath(); String error = execute(cmd); logService.log(LogService.LOG_INFO, "Execution Completed. Response: " + error); } /** * Deletes a file * * @param file * @throws IOException */ private void destroyPipe(File file) throws IOException { if (!file.delete()) { throw new IOException("Unable to delete file " + file.getAbsolutePath()); } logService.log(LogService.LOG_INFO, "Deleted " + file.getAbsolutePath()); } /** * @param cmd * @return null on success, or String of error message on failure. * @throws IOException */ private String execute(String cmd) throws IOException { String s = null; StringBuffer sb = new StringBuffer(); boolean hasError = false; //logService.log(LogService.LOG_DEBUG, "Executing: " + cmd); Process p = Runtime.getRuntime().exec(cmd); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdError.readLine()) != null) { sb.append(s); hasError = true; } if (hasError) { // temp fix for ADS board. All commands return with this error. if (!sb.toString().equals("Using fallback suid method")) { new IOException("Failed to execute command: " + sb.toString()); } } BufferedReader stdOut = new BufferedReader(new InputStreamReader(p.getInputStream())); sb = new StringBuffer(); while ((s = stdOut.readLine()) != null) { sb.append(s); sb.append('\n'); } return sb.toString(); } protected Map getActiveModlets() { return activeModlets; } protected Map getModletFactories() { return modletFactories; } /** * This will be going away once we can retrieve the PRODUCT_ID from the sys filesystem. * @param driverName * @return */ private String getModuleIdFromDriver(String driverName) { // TODO this is bad: hard coding this module driver to name table. This // needs to be refactored such that each module supplies the // association. logService.log(LogService.LOG_DEBUG, "Driver Name: " + driverName); if (driverName.equals("bmi_lcd_core")) { return "0003"; } if (driverName.equals("bmi_mdacc")) { return "0002"; } if (driverName.equals("bmi_camera")) { return "0004"; } if (driverName.equals("bmi_camera_vs6624")) { return "0004"; } if (driverName.equals("bmi_camera_ov2640")) { return "0005"; } if (driverName.equals("bmi_gps")) { return "0001"; } if (driverName.equals("bmi_vh")) { return "0007"; } if (driverName.equals("bmi_audio")) { return "000A"; } if (driverName.equals("libertas_bmi")){ return "0008"; } if (driverName.equals("bmi_zb")){ return "0009"; } if (driverName.equals("bmi_sensor")){ return "000C"; } logService.log(LogService.LOG_ERROR, "Unable to map " + driverName + " to a module ID."); return null; } /** * @return */ private String getModuleVersion() { // TODO determine appropriate version information. return "0"; } /** * Get a list of BMIMessage strings for existing modules based on entries in * the /sys filesystem. * * @return * @throws IOException */ private List getSysFSModules() throws IOException { List slots = null; for (int i = 1; i < 5; ++i) { String cmd = "/bin/ls -al /sys/devices/conn-m" + i + "/driver/module"; String response = null; try { response = execute(cmd); } catch (IOException e) { logService.log(LogService.LOG_ERROR, "Error occurred while discovering modules.", e); continue; } if (response.trim().length() == 0) { logService.log(LogService.LOG_DEBUG, "No module was found in slot " + i); continue; } logService.log(LogService.LOG_DEBUG, "Response: " + response); String[] elems = StringUtil.split(response, "/"); String driverName = elems[elems.length - 1]; // Lazily create data structure. If no modules then not needed. if (slots == null) { slots = new ArrayList(); } String bmiMessage = new String(getModuleIdFromDriver(driverName.trim()) + " " + getModuleVersion() + " " + (i - 1) + " ADD"); logService.log(LogService.LOG_DEBUG, "Sending BMI ColdPlug message: " + bmiMessage); slots.add(bmiMessage); } return slots; } private boolean isEmpty(String element) { return element == null || element.length() == 0; } private void registerExistingServices(BundleContext context2) throws InvalidSyntaxException { ServiceReference sr[] = context2.getServiceReferences(null, "(" + Constants.OBJECTCLASS + "=" + IModletFactory.class.getName() + ")"); if (sr != null) { for (int i = 0; i < sr.length; ++i) { registerService(sr[i], ServiceEvent.REGISTERED); } } } private void registerService(ServiceReference sr, int eventType) { IModletFactory factory = (IModletFactory) context.getService(sr); validateFactory(factory); switch (eventType) { case ServiceEvent.REGISTERED: if (!modletFactories.containsKey(factory.getModuleId())) { modletFactories.put(factory.getModuleId(), new ArrayList()); } else { logService.log(LogService.LOG_WARNING, "IModletFactory " + factory.getName() + " is already registered, ignoring registration."); } List ml = (List) modletFactories.get(factory.getModuleId()); if (!ml.contains(factory)) { ml.add(factory); } logService.log(LogService.LOG_INFO, "Added modlet factory " + factory.getName() + " (" + factory.getModuleId() + ") to map."); // Discovery Mode needs to know of all services a BUG contains. This // causes all available modlets to be created and started. if (context.getProperty("com.buglabs.bug.discoveryMode") != null && context.getProperty("com.buglabs.bug.discoveryMode").equals("true")) { try { createModlets(factory); } catch (Exception e) { logService.log(LogService.LOG_ERROR, "Unable to start modlet in discovery mode: " + e.getMessage()); } } break; case ServiceEvent.UNREGISTERING: if (modletFactories.containsKey(factory.getModuleId())) { List ml2 = (List) modletFactories.get(factory.getModuleId()); if (ml2.contains(factory)) { ml2.remove(factory); } } logService.log(LogService.LOG_INFO, "Removed modlet factory " + factory.getName() + " to map."); break; } } public void serviceChanged(ServiceEvent event) { ServiceReference sr = event.getServiceReference(); registerService(sr, event.getType()); } public void start(BundleContext context) throws Exception { this.context = context; Activator.ref = this; modletFactories = new Hashtable(); activeModlets = new Hashtable(); ServiceReference sr = context.getServiceReference(LogService.class.getName()); if (sr != null) { logService = (LogService) context.getService(sr); } context.addServiceListener(this, "(" + Constants.OBJECTCLASS + "=" + IModletFactory.class.getName() + ")"); registerExistingServices(context); pipeFilename = context.getProperty("com.buglabs.pipename"); if (pipeFilename == null || pipeFilename.length() == 0) { pipeFilename = DEFAULT_PIPE_FILENAME; } logService.log(LogService.LOG_INFO, "Creating pipe " + pipeFilename); createPipe(pipeFilename); pipeReader = new PipeReader(pipeFilename, Manager.getManager(context, logService, modletFactories, activeModlets), logService); logService.log(LogService.LOG_INFO, "Initializing existing modules"); coldPlug(); logService.log(LogService.LOG_INFO, "Listening to event pipe. " + pipeFilename); pipeReader.start(); } public void stop(BundleContext context) throws Exception { context.removeServiceListener(this); stopModlets(activeModlets); if (pipeReader != null) { pipeReader.cancel(); pipeReader.interrupt(); logService.log(LogService.LOG_INFO, "Deleting pipe " + pipeFilename); destroyPipe(new File(pipeFilename)); } modletFactories.clear(); } /** * Stop all active modlets. * * @param activeModlets */ private void stopModlets(Map modlets) { for (Iterator i = modlets.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); List modl = (List) modlets.get(key); for (Iterator j = modl.iterator(); j.hasNext();) { IModlet m = (IModlet) j.next(); try { m.stop(); } catch (Exception e) { logService.log(LogService.LOG_ERROR, "Error occured while stopping " + m.getModuleId() + ": " + e.getMessage()); } } } } private void validateFactory(IModletFactory factory) { if (isEmpty(factory.getModuleId())) { throw new RuntimeException("IModletFactory has empty Module ID."); } if (isEmpty(factory.getName())) { throw new RuntimeException("IModletFactory has empty Name."); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
33c32a5d40a2cf0c13c0fc9eeb6a4db83fa0ecf5
d29c18e7dc11f960c05dbe4eaa5c9d50c3837c49
/app/src/main/java/com/strongsoft/ui/widget/DummyHeadListView.java
92470881b15e387c2e348d9f87ceb16ab55f4910
[]
no_license
colryzen/UIDemos
b3a41a3ed58ba3daa68fe4cbe2ecaff271ccd9b4
9bfae550ffad788369ca8ef217d00227008ff9e3
refs/heads/master
2021-04-28T20:01:06.103555
2018-09-12T14:24:58
2018-09-12T14:24:58
121,912,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package com.strongsoft.ui.widget; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.View; import android.widget.ListView; public class DummyHeadListView extends ListView { private View mDumyGroupView; private boolean mHeaderVisible = false; public DummyHeadListView(Context context) { super(context); } public DummyHeadListView(Context context, AttributeSet attrs) { super(context, attrs); } public void setDumyGroupView(View view) { this.mDumyGroupView = view; if(this.mDumyGroupView != null) { this.mDumyGroupView.setVisibility(View.GONE); this.setFadingEdgeLength(0); } this.requestLayout(); } protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); } public void setHeaderVisible(boolean mHeaderVisible) { this.mHeaderVisible = mHeaderVisible; if(mHeaderVisible) { if(this.mDumyGroupView != null) { this.mDumyGroupView.setVisibility(View.VISIBLE); } } else if(this.mDumyGroupView != null) { this.mDumyGroupView.setVisibility(View.GONE); } } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }
[ "rkr@strongsoft.net" ]
rkr@strongsoft.net
60efa69cccf5cf6b85c50a15e57a76a2fc5a0015
e4440e1752482fe0571d28b475491ba71954f527
/src/main/java/com/jelastic/model/NodeGroupName.java
160abb4e1d036405676bf98df3e913b8ef68fb82
[ "Zlib", "EPL-1.0", "LZMA-exception", "Apache-2.0", "CPL-1.0", "bzip2-1.0.6" ]
permissive
lindar-open/jelastic-maven-plugin
873e0c7f3794f04d7b99f13211dd5ee76eef000a
c8983c1d38adaebb56c45c90d36f4bda6fd02f42
refs/heads/master
2022-07-19T18:13:17.525687
2022-07-14T16:00:11
2022-07-14T16:00:11
235,531,863
0
0
Apache-2.0
2022-07-14T16:00:12
2020-01-22T08:43:12
Java
UTF-8
Java
false
false
117
java
package com.jelastic.model; import lombok.Data; @Data public class NodeGroupName { private String nodeGroup; }
[ "noreply@github.com" ]
lindar-open.noreply@github.com
fb9669434bc792b5779e87d2964eaa7527cb83ea
e3750a0778bf78f57e37ac6005103e7f7db6ae7a
/src/com/xmpp/push/sns/muc/ParticipantStatusListener.java
7222f5752efd7dcafd1590e09d0590a3466b069c
[]
no_license
TsaoChiyen/-
8c7f65610282201da63f99d012ed8d98d64766fa
d175dd73b9a08df74b68384816b88e14fff3c76c
refs/heads/master
2016-08-12T10:39:10.564753
2015-12-31T02:32:11
2015-12-31T02:32:11
48,829,170
0
2
null
null
null
null
UTF-8
Java
false
false
7,572
java
/** * $RCSfile$ * $Revision$ * $Date$ * * Copyright 2003-2007 Jive Software. * * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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.xmpp.push.sns.muc; /** * A listener that is fired anytime a participant's status in a room is changed, such as the * user being kicked, banned, or granted admin permissions. * * @author Gaston Dombiak */ public interface ParticipantStatusListener { /** * Called when a new room occupant has joined the room. Note: Take in consideration that when * you join a room you will receive the list of current occupants in the room. This message will * be sent for each occupant. * * @param participant the participant that has just joined the room * (e.g. room@conference.jabber.org/nick). */ public abstract void joined(String participant); /** * Called when a room occupant has left the room on its own. This means that the occupant was * neither kicked nor banned from the room. * * @param participant the participant that has left the room on its own. * (e.g. room@conference.jabber.org/nick). */ public abstract void left(String participant); /** * Called when a room participant has been kicked from the room. This means that the kicked * participant is no longer participating in the room. * * @param participant the participant that was kicked from the room * (e.g. room@conference.jabber.org/nick). * @param actor the moderator that kicked the occupant from the room (e.g. user@host.org). * @param reason the reason provided by the actor to kick the occupant from the room. */ public abstract void kicked(String participant, String actor, String reason); /** * Called when a moderator grants voice to a visitor. This means that the visitor * can now participate in the moderated room sending messages to all occupants. * * @param participant the participant that was granted voice in the room * (e.g. room@conference.jabber.org/nick). */ public abstract void voiceGranted(String participant); /** * Called when a moderator revokes voice from a participant. This means that the participant * in the room was able to speak and now is a visitor that can't send messages to the room * occupants. * * @param participant the participant that was revoked voice from the room * (e.g. room@conference.jabber.org/nick). */ public abstract void voiceRevoked(String participant); /** * Called when an administrator or owner banned a participant from the room. This means that * banned participant will no longer be able to join the room unless the ban has been removed. * * @param participant the participant that was banned from the room * (e.g. room@conference.jabber.org/nick). * @param actor the administrator that banned the occupant (e.g. user@host.org). * @param reason the reason provided by the administrator to ban the occupant. */ public abstract void banned(String participant, String actor, String reason); /** * Called when an administrator grants a user membership to the room. This means that the user * will be able to join the members-only room. * * @param participant the participant that was granted membership in the room * (e.g. room@conference.jabber.org/nick). */ public abstract void membershipGranted(String participant); /** * Called when an administrator revokes a user membership to the room. This means that the * user will not be able to join the members-only room. * * @param participant the participant that was revoked membership from the room * (e.g. room@conference.jabber.org/nick). */ public abstract void membershipRevoked(String participant); /** * Called when an administrator grants moderator privileges to a user. This means that the user * will be able to kick users, grant and revoke voice, invite other users, modify room's * subject plus all the partcipants privileges. * * @param participant the participant that was granted moderator privileges in the room * (e.g. room@conference.jabber.org/nick). */ public abstract void moderatorGranted(String participant); /** * Called when an administrator revokes moderator privileges from a user. This means that the * user will no longer be able to kick users, grant and revoke voice, invite other users, * modify room's subject plus all the partcipants privileges. * * @param participant the participant that was revoked moderator privileges in the room * (e.g. room@conference.jabber.org/nick). */ public abstract void moderatorRevoked(String participant); /** * Called when an owner grants a user ownership on the room. This means that the user * will be able to change defining room features as well as perform all administrative * functions. * * @param participant the participant that was granted ownership on the room * (e.g. room@conference.jabber.org/nick). */ public abstract void ownershipGranted(String participant); /** * Called when an owner revokes a user ownership on the room. This means that the user * will no longer be able to change defining room features as well as perform all * administrative functions. * * @param participant the participant that was revoked ownership on the room * (e.g. room@conference.jabber.org/nick). */ public abstract void ownershipRevoked(String participant); /** * Called when an owner grants administrator privileges to a user. This means that the user * will be able to perform administrative functions such as banning users and edit moderator * list. * * @param participant the participant that was granted administrator privileges * (e.g. room@conference.jabber.org/nick). */ public abstract void adminGranted(String participant); /** * Called when an owner revokes administrator privileges from a user. This means that the user * will no longer be able to perform administrative functions such as banning users and edit * moderator list. * * @param participant the participant that was revoked administrator privileges * (e.g. room@conference.jabber.org/nick). */ public abstract void adminRevoked(String participant); /** * Called when a participant changed his/her nickname in the room. The new participant's * nickname will be informed with the next available presence. * * @param participant the participant that was revoked administrator privileges * (e.g. room@conference.jabber.org/nick). * @param newNickname the new nickname that the participant decided to use. */ public abstract void nicknameChanged(String participant, String newNickname); }
[ "tcy.net@gmail.com" ]
tcy.net@gmail.com
550a72fbfc8dff9349b4289e00fca19acf37e8fa
e9e34d3058620a214a27ea823925da8a91294a65
/src/main/java/com/xiaoyu/pt/HtmlDetailCreator.java
41173bbcda393d9b2941658bb498252f65b09bdc
[]
no_license
zhangxiaoyu185/mybatis-gen
082e474c28aa64fa66132d17ffdebe1585e75758
19a798dec5c5a768377b71335717a860c8d51c81
refs/heads/master
2021-09-10T22:30:15.053568
2018-04-03T13:12:45
2018-04-03T13:12:45
105,353,592
2
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.xiaoyu.pt; public class HtmlDetailCreator extends PTAbstractCreator { @Override public JavaBeanParam configBeanParam() { JavaBeanParam param = new JavaBeanParam(); param.setTemplateName("html_detail.vm"); param.setFileNameSuffix("_detail"); param.setPackageSuffix(""); param.setSuffix(".html"); return param; } }
[ "noreply@github.com" ]
zhangxiaoyu185.noreply@github.com
4a00c65181fbd01c203820bf548894bf281dcda8
493d1454f6833d3de103bf2951aa4746a0d499a7
/app/src/main/java/com/example/chess/minimax/MinimaxAlphaBeta.java
5742b4cd509e302398de14f9fed810de3043d582
[]
no_license
dinhchien265/Chess-game
7399bb85b2bc81ac07d6212da0ec2336a2a53320
ad3fa6e48a4c1905d6849865f87202182ec507fd
refs/heads/master
2021-03-18T19:37:46.959066
2020-03-13T15:23:40
2020-03-13T15:23:40
247,094,972
0
0
null
null
null
null
UTF-8
Java
false
false
4,845
java
package com.example.chess.minimax; import java.util.ArrayList; import java.util.Random; import com.example.chess.game.Board; import com.example.chess.game.Move; import com.example.chess.game.Tile; import com.example.chess.pieces.Piece; public class MinimaxAlphaBeta { boolean color; int maxDepth; Random rand; int count=0; // dem so nhanh cay public MinimaxAlphaBeta(boolean color, int maxDepth) { this.color = color; this.maxDepth = maxDepth; rand = new Random(); } public int getCount() { return count; } public int getMaxDepth() { return maxDepth; } public void setMaxDepth(int maxDepth) { this.maxDepth = maxDepth; } /** * * @param b * @param state * @param alpha * @param beta * @param depth * @return alpha, tra ve truong hop gia tri ban co lon nhat */ private int maxValue(Board b, ArrayList<Move> state, int alpha, int beta, int depth) { if(depth > maxDepth) // dieu kien dung 1 return eval(b, state, color); ArrayList<Move> moves = b.getMovesAfter(color, state); if(moves.size() == 0) // dieu kien dung 2 return eval(b,moves,color); for(int i = 0; i < moves.size(); i++) { state.add(moves.get(i)); int tmp = minValue(b, state, alpha, beta, depth + 1); state.remove(state.lastIndexOf(moves.get(i))); if(tmp > alpha) { alpha = tmp; } if(beta <= alpha) break; //cat tia } return alpha; } /** * * @param b ban co ban dau * @param state danh sach cac nuoc da di * @param alpha gia tri cua ban co * @param beta gia tri cua ban co * @param depth do sau tim kiem * @return beta, tra ve truong hop co gia tri ban co nho nhat */ private int minValue(Board b, ArrayList<Move> state, int alpha, int beta, int depth) { if(depth > maxDepth) //dieu kien dung 1 return eval(b, state, !color); //tra ve diem cua !color - diem cua color ArrayList<Move> moves = b.getMovesAfter(!color, state); if(moves.size() == 0) // dieu kien dung 2 return eval(b,state,!color); for(int i = 0; i < moves.size(); i++) { state.add(moves.get(i)); int tmp = maxValue(b, state, alpha, beta, depth + 1); state.remove(state.lastIndexOf(moves.get(i))); if(tmp < beta) { beta = tmp; } if(beta <= alpha) break; //cat tia } return beta; } public Move Decision(Board b) { count=0; ArrayList<Move> moves = b.getMoves(color); ArrayList<Move> state = new ArrayList<Move>(); int[] costs = new int[moves.size()]; for(int i = 0; i < moves.size(); i++) { state.add(moves.get(i)); int tmp = minValue(b, state, Integer.MIN_VALUE, Integer.MAX_VALUE, 1); costs[i] = tmp; state.remove(state.lastIndexOf(moves.get(i))); } int maxi = -1; int max = Integer.MIN_VALUE; for(int i = 0; i < moves.size(); i++) { if(costs[i] >= max) { max = costs[i]; } } ArrayList<Move> maxList=new ArrayList<Move>(); for (int i = 0; i < moves.size(); i++) { if(costs[i]==max){ maxList.add(moves.get(i)); } } if(maxList.size()>0){ maxi=rand.nextInt(maxList.size()); } System.out.println("color = "+color); System.out.println("moves.size() = "+moves.size()); System.out.println("maxlist.size() = "+maxList.size()); System.out.println("max = "+max); System.out.println("count = "+count); System.out.println("maxDepth = "+maxDepth); if(maxi == -1) return null; else return maxList.get(maxi); } /** * ham tra ve so diem cua ban co sau khi di cac nuoc moves * @param b ban co ban dau * @param moves danh sach cac nuoc di * @param currentColor mau cua quan dang den luot di * @return neu la quan trang se tra ve tong diem quan trang tru tong diem quan den * neu la quan den se tra ve tong diem quan den tru tong diem quan trang */ //danh gia private int eval(Board b, ArrayList<Move> moves, boolean currentColor) { count++; Tile[][] tiles = b.getTilesAfter(moves); if(b.getMovesAfter(currentColor,moves).size() == 0) { // kiem tra xem quan currentColor co con nuoc di khong if(b.isCheckAfter(currentColor, moves)) // kiem tra xem quan CurrentColor co dang bi chieu tuong khong return (currentColor == this.color) ? Integer.MIN_VALUE : Integer.MAX_VALUE; // quan currentColor dang bi chieu tuong thi tra ve am vo cung neu currenColor la White, tra ve duong vo cung neu currentColor la Black else return 0; //tra ve 0 neu roi vao the co hoa. } Board board=new Board(tiles); int whiteScore = 0; int blackScore = 0; for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++) { if(tiles[i][j].isOccupied()) if(tiles[i][j].getPiece().getColor() == Piece.WHITE) whiteScore += tiles[i][j].getPiece().getValue(); else blackScore += tiles[i][j].getPiece().getValue(); } if(color == Piece.WHITE) return whiteScore - blackScore; else return blackScore - whiteScore; } }
[ "dinhchien26599@gmail.com" ]
dinhchien26599@gmail.com
9278c16acd43c23e795b03bb18d746b3659ad63a
d71c88f6eac33f0e981ca4fcaf8e56f42befac47
/chapter06/spring-jdbc-annotations/src/main/java/com/isaac/ch6/DeleteSinger.java
ac69b4468381e20b756cfe357be14e03e0f89655
[ "Apache-2.0" ]
permissive
baocaixue/spring-dk
0bb2cd204b16121e1f5c58d63cb7b18f6e655848
9fc5ac437751f81ae1c4c4065e12c51be77c831f
refs/heads/master
2020-06-03T13:08:00.679047
2019-09-07T09:01:56
2019-09-07T09:01:56
191,578,454
5
1
Apache-2.0
2019-07-26T08:48:10
2019-06-12T13:39:48
Java
UTF-8
Java
false
false
503
java
package com.isaac.ch6; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.object.SqlUpdate; import javax.sql.DataSource; import java.sql.Types; public class DeleteSinger extends SqlUpdate { private static final String SQL_DELETE_SINGERS = "delete from singer where id = :id"; public DeleteSinger(DataSource dataSource) { super(dataSource, SQL_DELETE_SINGERS); super.declareParameter(new SqlParameter("id", Types.INTEGER)); } }
[ "535080691@qq.com" ]
535080691@qq.com
0896fe68eb9d3aec7df75b50443258205337497b
d07de20e38e394f4fb3cf0bb20b274adbbc8b84b
/src/main/java/com/reddoor/tradesystem/shiro/CustomRealm.java
f1890c98f4f3afdeb1f0a06e9a0e6782ccbd9473
[ "MIT" ]
permissive
JefferyTien/TradeSystem
8b9303be61178299fd28ae275d57519fe56d7124
602e0e4221870547b572de760a09474dc7656614
refs/heads/master
2022-12-24T23:14:53.624893
2020-03-19T10:57:27
2020-03-19T10:57:27
226,647,897
0
0
MIT
2022-12-16T07:47:10
2019-12-08T10:09:39
Java
UTF-8
Java
false
false
3,784
java
package com.reddoor.tradesystem.shiro; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.credential.SimpleCredentialsMatcher; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.reddoor.tradesystem.domain.authority.SysPermission; import com.reddoor.tradesystem.domain.authority.SysUser; import com.reddoor.tradesystem.domain.customize.ActiveUser; import com.reddoor.tradesystem.domain.vo.RoleVO; import com.reddoor.tradesystem.service.SysRoleService; import com.reddoor.tradesystem.service.SysService; @Service("customRealm") public class CustomRealm extends AuthorizingRealm{ @Autowired private SysService sysService; @Autowired private SysRoleService sysRoleService; @Override public void setName(String name) { super.setName("customRealm"); } @Override protected AuthenticationInfo doGetAuthenticationInfo( AuthenticationToken token) throws AuthenticationException { String username = (String)token.getPrincipal(); SysUser sysUser = null; try{ sysUser = sysService.getSysUserByName(username); } catch(Exception e){ System.out.println(e); } if(null == sysUser){ return null; } String password = sysUser.getPassword(); ActiveUser activeUser = new ActiveUser(); activeUser.setUserId(sysUser.getId()); activeUser.setUserName(sysUser.getUsername()); activeUser.setUserStatus(sysUser.getLocked()); RoleVO sysRole = null; try{ sysRole = sysRoleService.findRoleByUserId(sysUser.getId()); } catch (Exception e){ } activeUser.setRoleName(sysRole.getRoleName()); activeUser.setRoleStatus(sysRole.getAvailable()); List<SysPermission> menus = null; try{ menus = sysService.findMenuListByUserId(sysUser.getId()); } catch (Exception e){ } activeUser.setMenus(menus); SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(activeUser, password, this.getName()); return simpleAuthenticationInfo; } @Override protected AuthorizationInfo doGetAuthorizationInfo( PrincipalCollection principals) { //从 principals获取主身份信息 //将getPrimaryPrincipal方法返回值转为真实身份类型(在上边的doGetAuthenticationInfo认证通过填充到SimpleAuthenticationInfo中身份类型) ActiveUser activeUser = (ActiveUser)principals.getPrimaryPrincipal(); List<SysPermission> permissionList = null; try { permissionList = sysService.findPermissionListByUserId(activeUser.getUserId()); } catch (Exception e){ } List<String> permissions = new ArrayList<String>(); if(null != permissionList){ for(SysPermission sysPermission:permissionList){ permissions.add(sysPermission.getPercode()); } } SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); simpleAuthorizationInfo.addStringPermissions(permissions); return simpleAuthorizationInfo; } public void clearCached(){ PrincipalCollection principals = SecurityUtils.getSubject().getPrincipals(); super.clearCache(principals); } @PostConstruct public void initCredentialsMatcher(){ SimpleCredentialsMatcher matcher = new SimpleCredentialsMatcher(); setCredentialsMatcher(matcher); } }
[ "JefferyTien@hotmail.com" ]
JefferyTien@hotmail.com
6077aa1e4a18e1c1ee75cfbaa9b95e710954585f
d10c5fb4e60671cef8a0530e4706f03ee34e9cec
/src/main/java/AggregateBolt.java
bbd0b83b3557d18d72ba00a3e0d25c6d4367ae7b
[]
no_license
dwkielman/cs535-PA2-Detecting-the-Most-Popular-Topics-from-Live-Twitter-Message
0fb1696965e2e8366fb37e8839bc160955e2f0a2
4fb4a1bdf4361b9e590f3c076391f31bd4edf9a7
refs/heads/master
2021-02-04T12:04:33.474971
2020-03-10T14:27:01
2020-03-10T14:27:01
243,664,506
0
0
null
null
null
null
UTF-8
Java
false
false
3,909
java
import org.apache.storm.task.OutputCollector; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseRichBolt; import org.apache.storm.tuple.Fields; import org.apache.storm.tuple.Tuple; import org.apache.storm.tuple.Values; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; public class AggregateBolt extends BaseRichBolt { private OutputCollector outputCollector; private static final long TIME_INTERVAL = 10000; private ConcurrentHashMap<Integer, HashMap<String, Integer>> topTags = new ConcurrentHashMap<Integer, HashMap<String, Integer>>(); private static long currentStartTime; private static final String recordDelimiter = "##"; private static final String valueDelimiter = ":"; public AggregateBolt() { } @Override public void prepare(Map<String, Object> map, TopologyContext topologyContext, OutputCollector outputCollector) { this.outputCollector = outputCollector; currentStartTime = System.currentTimeMillis(); } @Override public void execute(Tuple tuple) { String tags = tuple.getStringByField("tags"); HashMap<String, Integer> receivedTags = formatTags(tags); topTags.put(tuple.getSourceTask(), receivedTags); // at each 10 seconds, need to submit to the Log long currentTime = System.currentTimeMillis(); if (currentTime >= currentStartTime + TIME_INTERVAL) { if (!topTags.isEmpty()) { HashMap<String, Integer> topHundredMap = combineAndSortTopTags(topTags.values()); if (!topHundredMap.isEmpty()) { List<String> output = new LinkedList<String>(); for (String s : topHundredMap.keySet()) { output.add("<" + s + " frequency: " + topHundredMap.get(s) + ">"); } outputCollector.emit(tuple, new Values(output.toString(), currentTime)); outputCollector.ack(tuple); } } currentStartTime = currentTime; } } private synchronized HashMap<String, Integer> combineAndSortTopTags(Collection<HashMap<String, Integer>> tagsList) { HashMap<String, Integer> combinedTagsMap = new HashMap<String, Integer>(); for (HashMap<String, Integer> maps : tagsList) { for (String s : maps.keySet()) { if (!combinedTagsMap.containsKey(s)) { combinedTagsMap.put(s, maps.get(s)); } else { int tempFreq = combinedTagsMap.get(s); tempFreq = tempFreq + maps.get(s); combinedTagsMap.put(s, tempFreq); } } } HashMap<String, Integer> topHundred = combinedTagsMap.entrySet().stream() .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) .limit(100) .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); return topHundred; } private HashMap<String, Integer> formatTags(String tags) { HashMap<String, Integer> returnMap = new HashMap<String, Integer>(); List<String> flatTags = Arrays.asList(tags.split(recordDelimiter)); for (String s : flatTags) { String[] split = s.split(valueDelimiter); if (split.length == 2) { returnMap.put(split[0], Integer.parseInt(split[1])); } } return returnMap; } @Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields("tags", "time")); } }
[ "dwkielman@gmail.com" ]
dwkielman@gmail.com
db1627b1ff93e6c6227fea9e453988cff3c9dad8
45df4f0050ed105d8fa955bb8d866af23a0f6ef8
/heron/packing/src/java/com/twitter/heron/packing/PackingUtils.java
027cb1bd260f401b606dfd3d59505766aa68dc5f
[ "Apache-2.0" ]
permissive
cychenyin/heron
b85184a7096f50b2e56f081309a2761dd33d0d0a
12425366a9ade8501675c1e29c2ea34cb36044cb
refs/heads/master
2021-01-23T01:40:29.624807
2016-09-19T20:28:02
2016-09-19T20:28:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,126
java
// Copyright 2016 Twitter. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // 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.twitter.heron.packing; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Logger; import com.twitter.heron.spi.common.Constants; import com.twitter.heron.spi.packing.InstanceId; import com.twitter.heron.spi.packing.PackingPlan; import com.twitter.heron.spi.packing.Resource; /** * Shared utilities for packing algorithms */ public final class PackingUtils { private static final Logger LOG = Logger.getLogger(PackingUtils.class.getName()); private PackingUtils() { } /** * Check whether the Instance has enough RAM and whether it can fit within the container limits. * * @param instanceResources The resources allocated to the instance * @return true if the instance is valid, false otherwise */ public static boolean isValidInstance(Resource instanceResources, long minInstanceRam, Resource maxContainerResources) { if (instanceResources.getRam() < minInstanceRam) { LOG.severe(String.format( "Instance requires %d MB ram which is less than the minimum %d MB ram per instance", instanceResources.getRam(), minInstanceRam / Constants.MB)); return false; } if (instanceResources.getRam() > maxContainerResources.getRam()) { LOG.severe(String.format( "This instance requires containers of at least %d MB ram. The current max container" + "size is %d MB", instanceResources.getRam(), maxContainerResources.getRam())); return false; } if (instanceResources.getCpu() > maxContainerResources.getCpu()) { LOG.severe(String.format( "This instance requires containers with at least %s cpu cores. The current max container" + "size is %s cores", instanceResources.getCpu(), maxContainerResources.getCpu())); return false; } if (instanceResources.getDisk() > maxContainerResources.getDisk()) { LOG.severe(String.format( "This instance requires containers of at least %d MB disk. The current max container" + "size is %d MB", instanceResources.getDisk(), maxContainerResources.getDisk())); return false; } return true; } /** * Estimate the per instance and topology resources for the packing plan based on the ramMap, * instance defaults and paddingPercentage. * * @return container plans */ public static Set<PackingPlan.ContainerPlan> buildContainerPlans( Map<Integer, List<InstanceId>> containerInstances, Map<String, Long> ramMap, Resource instanceDefaults, double paddingPercentage) { Set<PackingPlan.ContainerPlan> containerPlans = new HashSet<>(); for (Integer containerId : containerInstances.keySet()) { List<InstanceId> instanceList = containerInstances.get(containerId); long containerRam = 0; long containerDiskInBytes = 0; double containerCpu = 0; // Calculate the resource required for single instance Set<PackingPlan.InstancePlan> instancePlans = new HashSet<>(); for (InstanceId instanceId : instanceList) { long instanceRam = 0; if (ramMap.containsKey(instanceId.getComponentName())) { instanceRam = ramMap.get(instanceId.getComponentName()); } else { instanceRam = instanceDefaults.getRam(); } containerRam += instanceRam; // Currently not yet support disk or cpu config for different components, // so just use the default value. long instanceDisk = instanceDefaults.getDisk(); containerDiskInBytes += instanceDisk; double instanceCpu = instanceDefaults.getCpu(); containerCpu += instanceCpu; // Insert it into the map instancePlans.add(new PackingPlan.InstancePlan(instanceId, new Resource(instanceCpu, instanceRam, instanceDisk))); } containerCpu += (paddingPercentage * containerCpu) / 100; containerRam += (paddingPercentage * containerRam) / 100; containerDiskInBytes += (paddingPercentage * containerDiskInBytes) / 100; Resource resource = new Resource(Math.round(containerCpu), containerRam, containerDiskInBytes); PackingPlan.ContainerPlan containerPlan = new PackingPlan.ContainerPlan(containerId, instancePlans, resource); containerPlans.add(containerPlan); } return containerPlans; } }
[ "noreply@github.com" ]
cychenyin.noreply@github.com
8871264e023d2c4e6168b6203ad5509fcf9185b2
67938e67c8499b41aa5229719f20fecebdf579a0
/src/test/resources/shiro-example/11/clubassembly-6c40ff4af3f5b774051e70ec0c6aca52c8b7e58b/src/main/java/cn/edu/hebtu/www/clubassembly/web/model/OrganizationEvents.java
0036ab829c0f3dee246a3941d9eba567a40c45b2
[ "Apache-2.0" ]
permissive
Sunxy88/SecurityCFG-IMTA
b6b411a1055cd449ccd056e79185f48e461e766a
f65079733617c248c7ffb490f507cc25276ccb80
refs/heads/master
2022-12-08T01:25:19.753375
2020-08-28T11:44:39
2020-08-28T11:44:39
276,413,132
0
0
null
null
null
null
UTF-8
Java
false
false
3,275
java
package cn.edu.hebtu.www.clubassembly.web.model; import javax.persistence.*; import java.util.Date; /** * Created by Administrator on 15-4-9. */ @Entity @Table(name = "organizationevents") public class OrganizationEvents { private int id; private Organization organization; private String title; private String category; private Date releaseTime; private String sponsor; private String content; private String location; private Date beginDate; private Date endDate; private String scale; // 海报 private String poster; // 活动状态:0 正在进行;1 已经结束 ,3已经上传活动总结, private int status; @Id @GeneratedValue(strategy = GenerationType.AUTO) public int getId() { return id; } public void setId(int id) { this.id = id; } @ManyToOne @JoinColumn(name = "organization_id") public Organization getOrganization() { return organization; } public void setOrganization(Organization organization) { this.organization = organization; } @Column(name = "title", length = 50) public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Column(name = "category", length = 20) public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } @Column(name = "sponsor", length = 30) public String getSponsor() { return sponsor; } public void setSponsor(String sponsor) { this.sponsor = sponsor; } @Column(name = "content", length = 4000) public String getContent() { return content; } public void setContent(String content) { this.content = content; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "releaseTime") public Date getReleaseTime() { return releaseTime; } public void setReleaseTime(Date releaseTime) { this.releaseTime = releaseTime; } @Column(name = "location", length = 50) public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "beginDate") public Date getBeginDate() { return beginDate; } public void setBeginDate(Date beginDate) { this.beginDate = beginDate; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "endDate") public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Column(name = "scale", length = 20) public String getScale() { return scale; } public void setScale(String scale) { this.scale = scale; } @Column(name = "poster", length = 100) public String getPoster() { return poster; } public void setPoster(String poster) { this.poster = poster; } @Column(name = "status") public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } }
[ "sungxisx@icloud.com" ]
sungxisx@icloud.com
8d8b55444a705307f35587e9f9edeeeb09a7c1c0
b9493d3eef52959d62e7ea25c8d544ddfe18f705
/src/main/java/Q0001_0099/Q0079/Solution.java
05ea68615c9c310d4362e534d8abd468968e17a5
[]
no_license
Chris1125/LeetCodeSolution-Java
7449e403fe0fcdb96127d2873b8c66417021aaa2
b903c3abecdd69c24ac6011a6c84fc7af3b8850d
refs/heads/main
2023-02-09T08:55:45.330725
2021-01-06T10:20:23
2021-01-06T10:20:23
310,184,857
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package Q0001_0099.Q0079; /** * @author Chris * @description <a href="https://leetcode-cn.com/problems/word-search/">单词搜索</a> * Difficulty: Medium * Status: TODO * Daily: 2020-09-13 * @since 2020-09-13 */ public class Solution { public static void main(String[] args) { // char[][] board = new char[][]{{'A', 'B', 'C', 'E'}, {'S', 'F', 'C', 'S'}, {'A', 'D', 'E', 'E'}}; // String word = "ABCB"; // char[][] board = new char[][]{{'A'}}; // String word = "AB"; char[][] board = new char[][]{{'A', 'B'}, {'C', 'D'}}; String word = "CDBA"; System.out.println(exist(board, word)); } public static boolean exist(char[][] board, String word) { return false; } }
[ "wangyang9125@163.com" ]
wangyang9125@163.com
f76e19197e0c4e42f3c60e5c9afad2e80efebaff
072d298cb77e62f70569b342c83aa1159636b14f
/ProjetoBiblioteca/src/model/Usuario.java
cfc9885f0918e29b5917afeb63326451d216f9a3
[]
no_license
MarcosLucas/ProjetoBiblioteca
8174f23b81a3329c7c2f306b7d2700f504442b84
6b52500849c7f41eec7ea9fe14ca5fdf3c8a3ba3
refs/heads/master
2021-01-01T19:42:37.856774
2014-02-17T23:57:25
2014-02-17T23:57:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package model; import java.util.ArrayList; public class Usuario { public static ArrayList<Funcionario> lstFuncionario; public static ArrayList<Aluno> lstAluno; public Usuario() { this.lstFuncionario = new ArrayList<Funcionario>(); this.lstAluno = new ArrayList<Aluno>(); } public static ArrayList<Funcionario> getFuncionario() { return lstFuncionario; } public void adicionaFuncionario(Funcionario funcionario){ this.lstFuncionario.add(funcionario); } public static ArrayList<Aluno> getAluno() { return lstAluno; } public void adicionaAluno(Aluno aluno){ this.lstAluno.add(aluno); } }
[ "marcoslucas08@gmail.com" ]
marcoslucas08@gmail.com
336268e83702c3724ca96222f8632b20291138cf
904c4da977f79e37639a015a9ce0d000cc16c062
/src/main/java/de/hsrm/mi/web/bratenbank/benutzer/BenutzerService.java
1a5ddd36f81269e13d5c4908729e884ca32f013e
[]
no_license
niklasschloegel/bratenbank-backend
978205087b39cfa56cad63308c301dabbc196f6f
7a558bc4d708727d5cca90911fbcd7c6037e4d5b
refs/heads/master
2023-01-09T19:31:47.933376
2020-11-15T17:39:35
2020-11-15T17:39:35
313,026,793
1
1
null
null
null
null
UTF-8
Java
false
false
323
java
package de.hsrm.mi.web.bratenbank.benutzer; public interface BenutzerService { boolean pruefeLogin(String loginname, String passwort); String ermittlePasswort(String loginname); Benutzer registriereBenutzer(Benutzer neubenutzer) throws BenutzernameSchonVergeben; Benutzer findeBenutzer(String loginname); }
[ "niklas.schloegel@student.hs-rm.de" ]
niklas.schloegel@student.hs-rm.de
c2ecdda8ae51112c9f3e7a297722654feb4eb854
59d6828c41e4fffcd37b1164b10639d807499e7d
/app/src/main/java/com/zeidex/eldalel/ContactUsActivity.java
ad81b8c9f78fbf38b0aa30ab9d2c5a79a7e173cc
[]
no_license
mohammedmbdelmonaim/ElDalel
79374865e5b2080cc7c4a8da71fa83a156327f0c
fec565a102f055722346813bd13d0475992f98d6
refs/heads/master
2020-07-28T04:24:31.650258
2019-09-18T12:27:06
2019-09-18T12:27:06
209,301,156
0
0
null
null
null
null
UTF-8
Java
false
false
2,584
java
package com.zeidex.eldalel; import androidx.core.app.ActivityCompat; import android.Manifest; import android.content.pm.PackageManager; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class ContactUsActivity extends BaseActivity implements OnMapReadyCallback { @BindView(R.id.mapView_contactus) MapView mapView; private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_us); ButterKnife.bind(this); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); } @OnClick(R.id.item_contact_back) public void onBack(){ onBackPressed(); } @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Needs to call MapsInitializer before doing any CameraUpdateFactory calls MapsInitializer.initialize(this); // Updates the location and zoom of the MapView CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(24.0233598, 40.5805386), 6); mMap.animateCamera(cameraUpdate); MarkerOptions markerOptions = new MarkerOptions() .position(new LatLng(24.0233598, 40.5805386)) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)) .title(getString(R.string.we_here)); mMap.addMarker(markerOptions); } @Override protected void onResume() { super.onResume(); mapView.onResume(); } @Override protected void onPause() { super.onPause(); mapView.onPause(); } @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); } @Override protected void onStop() { super.onStop(); mapView.onStop(); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } }
[ "sara_talaat91@yahoo.com" ]
sara_talaat91@yahoo.com
093b24afde781f5b965714d2d439cad7f6439bc9
334246323c7a7d556f04fc3d06b3836c8f6cdaa0
/BreakItDown.java
6222a2cb03c0cdffd7c96d5a6a682a1e90e646fb
[]
no_license
simransrivastava01/hackerRank-30DaysOfCode
c8353e2226eb3df4439a15de25eacf0c8eb5a680
662650b32eacc7eb2a6b5053f6ec4a4ced39a3bf
refs/heads/master
2022-11-15T02:05:47.973944
2020-07-11T09:17:38
2020-07-11T09:17:38
270,634,460
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the factorial function below. static int factorial(int n) { if(n==0) return 1; return n*factorial(n-1); } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); int n = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); int result = factorial(n); bufferedWriter.write(String.valueOf(result)); bufferedWriter.newLine(); bufferedWriter.close(); scanner.close(); } }
[ "noreply@github.com" ]
simransrivastava01.noreply@github.com
2362750a767b4c88ecac85970d91dc56b9b3fc4c
e9278cdd7709225c56767f93a72260c0975be622
/DataStructures/src/impl/LLStackSet.java
682c3186f57a4f6270b2ac1a525a3743bf94b0e9
[]
no_license
746ideas/n17r
4a2dd9f00a4e640a4d363dfa29d0021ad3a29e04
6e93da65901accf79327d9afdae889e28de288b4
refs/heads/master
2021-01-21T19:50:48.124341
2017-05-23T11:15:44
2017-05-23T11:15:44
92,161,007
0
0
null
null
null
null
UTF-8
Java
false
false
4,210
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 impl; import adt.Set; /** * * @author Мадияр * @param <T> */ public class LLStackSet<T> implements Set<T> { private LinkedListStack<T> hold; private int size; public LLStackSet(){ hold=new LinkedListStack(); size=0; } @Override public void add(T value) { LinkedListStack<T> temp=new LinkedListStack(); int counter=0; for(int i=0; i<size; i++){ T temp2; try { temp2=hold.pop(); if(temp2.equals(value)){ counter++; } temp.push(temp2); } catch (Exception ex) { System.out.println(ex.getMessage()); } } if(counter==0){ temp.push(value); size++; } while(temp.getSize()!=0){ T temp2 = null; try { temp2= temp.pop(); } catch (Exception ex) { System.out.println(ex.getMessage()); } hold.push(temp2); } } @Override public boolean contains(T value) { LinkedListStack<T> temp=new LinkedListStack(); int counter=0; for(int i=0; i<size; i++){ T temp2; try { temp2=hold.pop(); if(temp2.equals(value)){ counter++; } temp.push(temp2); } catch (Exception ex) { System.out.println(ex.getMessage()); } } while(temp.getSize()!=0){ T temp2 = null; try { temp2= temp.pop(); } catch (Exception ex) { System.out.println(ex.getMessage()); } hold.push(temp2); } if(counter==0){ return false; } return true; } @Override public boolean remove(T value) { LinkedListStack<T> temp=new LinkedListStack(); int counter=0; for(int i=0; i<size; i++){ T temp2; try { temp2=hold.pop(); if(temp2.equals(value)){ counter++; continue; } temp.push(temp2); } catch (Exception ex) { System.out.println(ex.getMessage()); } } while(temp.getSize()!=0){ T temp2 = null; try { temp2= temp.pop(); } catch (Exception ex) { System.out.println(ex.getMessage()); } hold.push(temp2); } if(counter==0){ return false; } size--; return true; } @Override public T removeAny() throws Exception { if(size==0){ throw new Exception("Set is empty"); } T temp = null; try{ temp = hold.pop(); }catch (Exception ex){ System.out.println(ex.getMessage()); } size--; return temp; } @Override public int getSize() { return size; } @Override public void clear() { hold=new LinkedListStack(); size=0; } @Override public String toString(){ String result="{"; LinkedListStack<T> temp=new LinkedListStack(); for(int i=0; i<size; i++){ T temp2 = null; try{ temp2 = hold.pop(); }catch (Exception ex){ System.out.println(ex.getMessage()); } result+=temp2+" "; temp.push(temp2); } result+="}"; while(temp.getSize()!=0){ T temp2 = null; try { temp2= temp.pop(); } catch (Exception ex) { System.out.println(ex.getMessage()); } hold.push(temp2); } return result; } }
[ "madiyar.orazaly@gmail.com" ]
madiyar.orazaly@gmail.com
2944f0874d82767c11e10dff99f155b8171bd4ad
10bf209450164a192ba5951f1eaf788ebf9c3a57
/Temporal-Entity-Example/src/test/java/tests/editionsets/FullPersonWithEditionsMove.java
18f7165b580b1935e80d22a5906d73e69cd56b8f
[]
no_license
andyglick/eclipselink-temporal-2012
ca159617153ae0ad21227ac5673f0465274b051b
63c2809b88985c6c30f4f9461e5f621125c9ce0f
refs/heads/master
2023-07-08T11:47:54.992815
2017-01-02T22:15:10
2017-01-02T22:15:10
77,858,576
1
0
null
null
null
null
UTF-8
Java
false
false
5,714
java
/******************************************************************************* * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the * accompanying materials are made available under the terms of the Eclipse * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies * this distribution. The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution * License is available at http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: dclarke - Bug 361016: Future Versions Examples ******************************************************************************/ package tests.editionsets; import org.junit.Test; import junit.framework.Assert; import model.Person; import temporal.EditionSetHelper; import temporal.Effectivity; import temporal.TemporalEntityManager; import tests.FullPersonWithEditions; import static example.PersonModelExample.T1; import static example.PersonModelExample.T2; import static example.PersonModelExample.T3; import static example.PersonModelExample.T4; import static example.PersonModelExample.T5; /** * Tests change propagation through future editions. * * @author dclarke * @since EclipseLink 2.3.1 */ public class FullPersonWithEditionsMove extends FullPersonWithEditions { @Test public void moveT2toT3() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); EditionSetHelper.move(em, T3); em.getTransaction().rollback(); em.close(); } @Test public void moveT2toT1() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); EditionSetHelper.move(em, T1); em.getTransaction().rollback(); em.close(); } @Test public void moveT2toBOT() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); try { EditionSetHelper.move(em, Effectivity.BOT); } catch (IllegalArgumentException e) { return; } finally { em.getTransaction().rollback(); em.close(); } Assert.fail("Expected IllegalArgumentException"); } @Test public void moveT2toT4() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); EditionSetHelper.move(em, T4); em.getTransaction().rollback(); em.close(); } @Test public void moveT2toT5() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); EditionSetHelper.move(em, T5); em.getTransaction().rollback(); em.close(); } @Test public void moveT4toT3() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T4); em.getTransaction().begin(); EditionSetHelper.move(em, T3); em.getTransaction().rollback(); em.close(); } @Test public void moveT4toT5() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T4); em.getTransaction().begin(); EditionSetHelper.move(em, T5); em.getTransaction().rollback(); em.close(); } @Test public void moveT4toT2() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T4); em.getTransaction().begin(); EditionSetHelper.move(em, T2); em.getTransaction().rollback(); em.close(); } @Test public void moveT4toT1() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T4); em.getTransaction().begin(); EditionSetHelper.move(em, T1); em.getTransaction().rollback(); em.close(); } @Test public void moveT4toBOT() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T4); em.getTransaction().begin(); try { EditionSetHelper.move(em, Effectivity.BOT); } catch (IllegalArgumentException e) { return; } Assert.fail("Expected IllegalArgumentException"); } @Test public void moveT2WithPersonChangestoT3() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); Person person = em.find(Person.class, getSample().getContinuityId()); person.setEmail("newemail@b.c"); try { EditionSetHelper.move(em, T3); } catch (IllegalStateException e) { return; } finally { em.getTransaction().rollback(); em.close(); } Assert.fail("IllegalStateException expected"); } @Test public void moveT2WithAddressChangestoT3() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); Person person = em.find(Person.class, getSample().getContinuityId()); person.getAddress().setCity("NEW CITY"); try { EditionSetHelper.move(em, T3); } catch (IllegalStateException e) { return; } finally { em.getTransaction().rollback(); em.close(); } Assert.fail("IllegalStateException expected"); } @Test public void moveT2WithPhoneChangestoT3() { TemporalEntityManager em = getEntityManager(); em.setEffectiveTime(T2); em.getTransaction().begin(); Person person = em.find(Person.class, getSample().getContinuityId()); person.getPhone("Home").setNumber("NEW NUMBER"); try { EditionSetHelper.move(em, T3); } catch (IllegalStateException e) { return; } finally { em.getTransaction().rollback(); em.close(); } Assert.fail("IllegalStateException expected"); } }
[ "andyglick@gmail.com" ]
andyglick@gmail.com
55ae1e675daf87450e8a548e450c94c2bfcbd6a7
643a328c370293f93a0b2875f2b734e0d02feb1b
/HelpDesk/src/main/java/com/psgv/helpdesk/api/entity/ChangeStatus.java
30d6739898154d730b7179e682063514301243bd
[]
no_license
GustaTorres/HelpDesk
21dd361e5aa375008c67d8688780e58d60946607
9d708e04362ddc59d648fb12ecca4b369faedad5
refs/heads/master
2020-03-08T17:58:22.683019
2018-07-10T14:53:03
2018-07-10T14:53:03
128,283,074
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package com.psgv.helpdesk.api.entity; import java.util.Calendar; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; import com.psgv.helpdesk.api.enums.StatusEnum; @Document public class ChangeStatus { @Id private String id; @DBRef private Ticket ticket; @DBRef private User user; private Calendar dateChangeStatus; private StatusEnum status; public String getId() { return id; } public void setId(String id) { this.id = id; } public Ticket getTicket() { return ticket; } public void setTicket(Ticket ticket) { this.ticket = ticket; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Calendar getDateChangeStatus() { return dateChangeStatus; } public void setDateChangeStatus(Calendar dateChangeStatus) { this.dateChangeStatus = dateChangeStatus; } public StatusEnum getStatus() { return status; } public void setStatus(StatusEnum status) { this.status = status; } }
[ "gustavo.s.torres@hotmail.com" ]
gustavo.s.torres@hotmail.com
4e80f976545f4784e52a2f17d5bb7abb9197bfdf
0fd0a74fe77f3c0d6eef6a946f008523d0d81eee
/app/src/main/java/com/example/kulozubeste/FavouriteActivity.java
6d572deaa6be425b76c6d40ccf0baebe1fbc710d
[]
no_license
bkkulozu/yoga_v1
ced4de183e4764b0f1bb8de45dcd7da30a3e24a2
7893aed558a0366c134035f4a703778025dcf761
refs/heads/master
2023-05-01T09:40:26.352987
2021-05-16T21:07:48
2021-05-16T21:07:48
367,984,771
0
0
null
null
null
null
UTF-8
Java
false
false
2,734
java
package com.example.kulozubeste; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageButton; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; /** * Beste Kulozu 214 00 474 */ public class FavouriteActivity extends AppCompatActivity { private static final String TAG = "FavouriteActivity"; DatabaseHelper mDatabaseHelper; //private Button btnAdd, btnViewData; private EditText editText; private ImageButton btnAdd, btnViewData; Intent intent; Bundle b; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_favourite); editText = (EditText) findViewById(R.id.editText); btnAdd = (ImageButton) findViewById(R.id.btnAdd); btnViewData = (ImageButton) findViewById(R.id.btnView); mDatabaseHelper = new DatabaseHelper(this); btnAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String newEntry = editText.getText().toString(); if (editText.length() != 0) { AddData(newEntry); editText.setText(""); } else { toastMessage("You must put something in the text field!"); } } }); btnViewData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(FavouriteActivity.this, ListDataActivity.class); startActivity(intent); } }); // Hiding title bar using code getSupportActionBar().hide(); // Hiding the status bar getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Locking the orientation to Portrait setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); intent = getIntent(); Bundle b = intent.getExtras(); } public void AddData(String newEntry) { boolean insertData = mDatabaseHelper.addData(newEntry); if (insertData) { toastMessage("Data Successfully Inserted!"); } else { toastMessage("Something went wrong"); } } /** * customizable toast * @param message */ private void toastMessage(String message){ Toast.makeText(this,message, Toast.LENGTH_SHORT).show(); } }
[ "bkklz@outlook.com" ]
bkklz@outlook.com
a1a55fdfcf43e760426ea800255dbe7c5205e898
11c421cb03d93dfd5cdc228243180fcf50869f29
/app/src/main/java/com/example/tetris/Constant.java
1ed1148407228a6b92011b61811ac184254f24b8
[]
no_license
WengLi/Tetris
ea6a8e9f634e9f378ade61207aa81b21d89fe59a
6f4646a55573503e636e17da8689a70a62751b58
refs/heads/master
2020-04-22T10:19:08.975118
2019-02-12T10:46:19
2019-02-12T10:46:19
170,300,314
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package com.example.tetris; import android.graphics.Color; public class Constant { public static int ForeColor=Color.LTGRAY; public static int PIXEL=100; }
[ "wengli350@qq.com" ]
wengli350@qq.com
816c8b8aa92e11c0c3c32c4abd045f2f321b5120
2aa0ef5541922d11cb6fccc7b49b36c1ccd3601e
/src/main/java/bot/Bot.java
5878300b0c27a26fcbecc67f8f6c851f108abadd
[]
no_license
YoungPotato/TelegramBot
0ed01b4fcb9cad5eb9ae78176bb778ace7ff0a96
6d6e459932cfeace5dfc92d46b962a7b5f59bcee
refs/heads/master
2021-07-12T22:34:34.935263
2020-06-08T08:05:12
2020-06-08T08:05:12
213,446,731
1
1
null
2020-10-13T16:53:23
2019-10-07T17:35:33
Java
UTF-8
Java
false
false
1,478
java
package bot; import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Update; import PublisherSubscriber.Subscriber; public class Bot extends TelegramLongPollingBot { private String userName; private String token; private Subscriber subscriber; public Bot(String userName, String token) { this.userName = userName; this.token = token; } public void setSubscriber(Subscriber subscriber) { this.subscriber = subscriber; } @Override public void onUpdateReceived(Update update) { if (update.hasMessage()) { Message message = update.getMessage(); try { subscriber.sendMessage(message.getText(), new ChatId(message.getChatId())); } catch (Exception e) { e.printStackTrace(); } } else if (update.hasCallbackQuery()) { ChatId chatId = new ChatId(update.getCallbackQuery().getMessage().getChatId()); String text = update.getCallbackQuery().getData(); try { subscriber.sendMessage(text, chatId); } catch (Exception e) { e.printStackTrace(); } } } @Override public String getBotUsername() { return userName; } @Override public String getBotToken() { return token; } }
[ "danilov.grischa2015@yandex.ru" ]
danilov.grischa2015@yandex.ru
fedebaa6365bdf773f0c4720ec3ee354bdc95bbc
bf9af3760980bd5407b8d4003ca0a036769ee631
/SpringBoot-Middleware/SpringBoot-ShardingJDBC/src/main/java/cn/com/dxk/springboot/shardingsphere/jdbc/dao/ProvWorkOrderDao.java
ecb69dc4af609adb2e66a430b74abef10f4e86d8
[]
no_license
dxkIdea/Autonomous-Learning
2c30013e4423ec67bb71e32286595cc1c2a5345e
8038f521beed6558cde931bad597da1921e22b50
refs/heads/master
2023-06-07T09:27:10.906276
2021-06-29T08:56:39
2021-06-29T08:56:39
355,969,277
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package cn.com.dxk.springboot.shardingsphere.jdbc.dao; import cn.com.dxk.springboot.shardingsphere.jdbc.domain.ProvWorkOrder; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * @Date: 2021/6/28 16:44 * @Author: DingXingKai * @Description: */ @Mapper public interface ProvWorkOrderDao extends BaseMapper<ProvWorkOrder> { }
[ "dingxingkai@tomosoft.com" ]
dingxingkai@tomosoft.com
f001db9b15b297d7f32169cb12ee17e855cc2a2d
0037fda59dbe6744ed6d6ffd9d97dd3ad6406e23
/src/main/java/com/senti/model/codeComment/CaltopHigh.java
ffa11bc3a38d1e8b6c68f1ac391f10d2b54e3b1d
[]
no_license
whiteCQC/Senti810
07044ee79003f0aa75ae86eaaa1c6cbc2829a08d
e3a4bc78b2e6dc656f88cf1c3bafa3c9271cad1a
refs/heads/master
2022-10-06T04:51:47.594163
2019-06-04T09:53:55
2019-06-04T09:53:55
182,043,503
0
2
null
2022-09-01T23:05:37
2019-04-18T08:00:43
JavaScript
UTF-8
Java
false
false
1,089
java
package com.senti.model.codeComment; /** * 代码模块 * 用于计算正面情绪平均值最高的类 */ public class CaltopHigh implements Comparable<CaltopHigh>{ private int countHigh;//总数 private int totalHigh;//总值 private String name;//类的文件路径 public CaltopHigh(String name,int high){ this.name=name; countHigh=1; totalHigh=high; } public void add(int high){//用于在初始化之后继续添加 countHigh++; totalHigh+=high; } public double getScoreHigh() {//获得对应总数和总值的平均值,将会取两位小数 if(this.countHigh!=0) return f(this.totalHigh/(double)this.countHigh); else return 0; } private double f(double i) { return Double.parseDouble(String.format("%.2f", i)); } public String getName() { return name; } @Override public int compareTo(CaltopHigh o) {//正面情绪,从大到小排序 return Double.compare(o.getScoreHigh(),this.getScoreHigh()); } }
[ "530660508@qq.com" ]
530660508@qq.com
29e7b9053ecd00fa3c4cfabc4073c9bc9ea5cfd2
2d4c20c5bf755ec46756189c9909807b0041d11b
/src/main/java/codes/pedromanoel/learning/cleancode/literatePrimes/refactored/PrimePrinter.java
37adcaf469c4a558a013ac18d02055ac47495ef5
[]
no_license
pedromanoel/learning-cleancode
425c38956dd696d2c15820d043e5de7294e9942d
56e6a9e7beec8637a78b265749e2276101f6bcf1
refs/heads/master
2020-05-20T19:16:11.361637
2020-04-18T15:35:35
2020-04-19T16:32:57
185,722,577
1
0
null
null
null
null
UTF-8
Java
false
false
623
java
package codes.pedromanoel.learning.cleancode.literatePrimes.refactored; public class PrimePrinter { public static void main(String[] args) { final int NUMBER_OF_PRIMES = 1000; int[] primes = PrimeGenerator.generate(NUMBER_OF_PRIMES); final int ROWS_PER_PAGE = 50; final int COLUMNS_PER_PAGE = 4; RowColumnPagePrinter tablePrinter = new RowColumnPagePrinter( ROWS_PER_PAGE, COLUMNS_PER_PAGE, "The First " + NUMBER_OF_PRIMES + " Prime Numbers"); tablePrinter.print(primes); } }
[ "pevange@thoughtworks.com" ]
pevange@thoughtworks.com
c2e4143390b456acfe5cb1c2c66b7c44f0a5091c
f0cee0f6e1c6e53c4145555d212f55a65cd0b580
/src/main/java/org/ednovo/gooru/client/mvp/play/collection/preview/home/PreviewHomeView.java
2648f762b85873dd5ddaedacf20d11636a92cf0b
[ "MIT" ]
permissive
nutan-gooru/Gooru-Web
2c21b7d0f051d39b4a81e830b267f6475affa635
230d05e12bd3f5960b05bbe9687ecb5823f9c874
refs/heads/master
2021-01-18T02:03:36.584959
2014-04-28T04:59:39
2014-04-28T04:59:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,766
java
/******************************************************************************* * Copyright 2013 Ednovo d/b/a Gooru. All rights reserved. * * http://www.goorulearning.org/ * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ package org.ednovo.gooru.client.mvp.play.collection.preview.home; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.ednovo.gooru.client.PlaceTokens; import org.ednovo.gooru.client.gin.AppClientFactory; import org.ednovo.gooru.client.gin.BaseViewWithHandlers; import org.ednovo.gooru.client.mvp.play.collection.event.UpdateCollectionViewCountEvent; import org.ednovo.gooru.client.mvp.play.collection.event.UpdatePreviewViewCountEvent; import org.ednovo.gooru.client.mvp.play.collection.preview.PreviewPlayerPresenter; import org.ednovo.gooru.client.mvp.play.collection.preview.home.assign.AssignPopupPlayerVc; import org.ednovo.gooru.client.mvp.play.collection.preview.home.customize.RenameCustomizePopUp; import org.ednovo.gooru.client.mvp.play.collection.preview.home.share.SharePlayerVc; import org.ednovo.gooru.client.uc.PlayerBundle; import org.ednovo.gooru.client.uc.PreviewResourceView; import org.ednovo.gooru.client.uc.tooltip.GlobalToolTip; import org.ednovo.gooru.client.util.MixpanelUtil; import org.ednovo.gooru.shared.model.content.CollectionDo; import org.ednovo.gooru.shared.model.content.CollectionItemDo; import org.ednovo.gooru.shared.util.MessageProperties; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ErrorEvent; import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.event.dom.client.MouseOutHandler; import com.google.gwt.event.dom.client.MouseOverEvent; import com.google.gwt.event.dom.client.MouseOverHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.InlineHTML; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import com.gwtplatform.mvp.client.proxy.PlaceRequest; public class PreviewHomeView extends BaseViewWithHandlers<PreviewHomeUiHandlers> implements IsPreviewHomeView,MessageProperties{ @UiField Image collectionImage,collectionThumbnail; @UiField HTML collectionGoal; @UiField Button previewButton,viewCollectionSummaryBtn,backToClasspageButton; @UiField Label previousButton,nextButton,resourceCountTitle,learningobjectiveText; @UiField FlowPanel resourceCurosalContainer,collectionImageContainer,collectionEndImageContainer,thumbnailContainer; @UiField Button assignCollectionBtn,customizeCollectionBtn,shareCollectionBtn; @UiField FlowPanel previewButtonConatainer; @UiField InlineHTML separationLine; @UiField HTMLPanel endTextContainer,endText; private boolean isAssignPopup = false; private boolean isCustomizePopup = false; private boolean isSharePopup = false; private static PreviewHomeViewUiBinder uiBinder = GWT.create(PreviewHomeViewUiBinder.class); private PopupPanel toolTipPopupPanel=new PopupPanel(); private HandlerRegistration previewClickHandler; interface PreviewHomeViewUiBinder extends UiBinder<Widget, PreviewHomeView> { } @Inject public PreviewHomeView(){ setWidget(uiBinder.createAndBindUi(this)); previewButton.setText(GL0633); assignCollectionBtn.setText(GL0104); customizeCollectionBtn.setText(GL0631); shareCollectionBtn.setText(GL0526); learningobjectiveText.setText(GL0618); backToClasspageButton.setText(GL1631); assignCollectionBtn.addMouseOverHandler(new OnassignCollectionBtnMouseOver()); assignCollectionBtn.addMouseOutHandler(new OnassignCollectionBtnMouseOut()); customizeCollectionBtn.addMouseOverHandler(new OncustomizeCollectionBtnMouseOver()); customizeCollectionBtn.addMouseOutHandler(new OncustomizeCollectionBtnMouseOut()); shareCollectionBtn.addMouseOverHandler(new OnshareCollectionBtnMouseOver()); shareCollectionBtn.addMouseOutHandler(new OnshareCollectionBtnMouseOut()); collectionEndImageContainer.setVisible(false); endTextContainer.setVisible(false); viewCollectionSummaryBtn.setVisible(false); } @UiHandler("collectionImage") public void thumbnailErrorImage(ErrorEvent event){ collectionImage.setUrl("images/collection-default-thubnail.png"); } @Override public void setCollectionMetadata(final CollectionDo collectionDo){ setCollectionImage(collectionDo.getThumbnails().getUrl()); setCollectionEndImage(collectionDo.getThumbnails().getUrl()); setCollectionGoal(collectionDo.getGoals()); assignCollectionBtn.getElement().setAttribute("collectionId", collectionDo.getGooruOid()); customizeCollectionBtn.getElement().setAttribute("collectionId", collectionDo.getGooruOid()); shareCollectionBtn.getElement().setAttribute("collectionId", collectionDo.getGooruOid()); if(previewClickHandler!=null) { previewClickHandler.removeHandler(); } previewClickHandler=previewButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Map<String,String> params = new LinkedHashMap<String,String>(); params.put("id", collectionDo.getGooruOid()); params = PreviewPlayerPresenter.setConceptPlayerParameters(params); MixpanelUtil.Preview_Player_Click_Preview(); List<CollectionItemDo> collectionItems=collectionDo.getCollectionItems(); if(AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken().equals(PlaceTokens.PREVIEW_PLAY)){ AppClientFactory.fireEvent(new UpdatePreviewViewCountEvent()); }else{ AppClientFactory.fireEvent(new UpdateCollectionViewCountEvent()); } if(collectionItems.size()>0){ CollectionItemDo collectionItemDo=collectionItems.get(0); if(collectionItemDo.getCollectionItemId() != null) { if(collectionItemDo.getNarration()!=null&&!collectionItemDo.getNarration().trim().equals("")){ params.put("rid", collectionItemDo.getCollectionItemId()); params.put("tab", "narration"); PlaceRequest placeRequest=AppClientFactory.getPlaceManager().preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params); AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true); }else{ params.put("rid", collectionItemDo.getCollectionItemId()); PlaceRequest placeRequest=AppClientFactory.getPlaceManager().preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params); AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true); } } } else{ params.put("view", "end"); PlaceRequest placeRequest=AppClientFactory.getPlaceManager().preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params); AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true); } } }); setReplyLink(); } public void setCollectionImage(String thumbnailUrl){ collectionImage.setUrl(thumbnailUrl); } public void setCollectionGoal(String collectionGoal){ this.collectionGoal.setHTML(""); if(collectionGoal!=null &&!collectionGoal.isEmpty()){ if(collectionGoal.length()>415){ collectionGoal =(collectionGoal.substring(0, 415))+"..."; this.collectionGoal.setHTML(collectionGoal); } else{ this.collectionGoal.setHTML(collectionGoal); } }else{ this.collectionGoal.setHTML(GL1374); } } @Override public void setCollectionResources(CollectionDo collectionDo) { resourceCurosalContainer.clear(); int resourceCount=0; int questionCount=0; FlowPanel curosalPanel=new FlowPanel(); int resourcesSize=collectionDo.getCollectionItems()!=null?collectionDo.getCollectionItems().size():0; if(resourcesSize>0){ previousButton.setVisible(true); nextButton.setVisible(true); for(int itemIndex=0;itemIndex<resourcesSize;itemIndex++){ if(collectionDo.getCollectionItems().get(itemIndex).getResource().getResourceFormat()!=null){ if(collectionDo.getCollectionItems().get(itemIndex).getResource().getResourceFormat().getDisplayName().equalsIgnoreCase("Question")){ questionCount++; }else{ resourceCount++; } } PreviewResourceView previewResourceView=new PreviewResourceView(collectionDo.getCollectionItems().get(itemIndex), itemIndex); previewResourceView.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { MixpanelUtil.Preview_Click_Resource(); } }); curosalPanel.add(previewResourceView); } if(resourcesSize>4){ new ResourceCurosal(nextButton, previousButton, curosalPanel, resourcesSize, 145); } String resourceString = resourceCount == 1? resourceCount + " " + GL1110.toLowerCase() : resourceCount + " " + GL0174.toLowerCase(); String questionString = questionCount == 1? questionCount + " " + GL0308.toLowerCase() : questionCount + " " + GL1042.toLowerCase(); String finalMessage = ""; if (resourceCount >0 && questionCount > 0){ finalMessage = resourceString + " " + GL_GRR_AND + " " + questionString + " " + GL0578 + GL_SPL_SEMICOLON; }else if (resourceCount >0){ finalMessage = resourceString + " " + GL0578 + GL_SPL_SEMICOLON; }else if (questionCount >0){ finalMessage = questionString + " " + GL0578 + GL_SPL_SEMICOLON; }else{ } resourceCountTitle.setText(finalMessage); resourceCurosalContainer.add(curosalPanel); } else { resourceCountTitle.setText(GL0684); Image resourceThumbnail = new Image(); resourceThumbnail.setUrl("images/resource_trans.png"); resourceThumbnail.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().noResourceDefault()); previousButton.setVisible(false); nextButton.setVisible(false); resourceCurosalContainer.add(resourceThumbnail); } //http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997#collection-play&id=f9b1b4ca-c784-46bc-9f49-f7d7c5e1d5c1 } /** * * @function onassignCollectionBtnClicked * * @created_date : 11-Dec-2013 * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * * */ @UiHandler("assignCollectionBtn") public void onassignCollectionBtnClicked(ClickEvent clickEvent) { MixpanelUtil.Preview_Click_Assign(); String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId"); if(!isAssignPopup){ isAssignPopup=true; AssignPopupPlayerVc successPopupVc = new AssignPopupPlayerVc(collectionId) { @Override public void closePoup() { Window.enableScrolling(true); this.hide(); isAssignPopup=false; } }; Window.scrollTo(0, 0); successPopupVc.setWidth("500px"); successPopupVc.setHeight("auto"); successPopupVc.show(); successPopupVc.center(); if (AppClientFactory.isAnonymous()){ successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 30); } else { successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 30); } } } /** * * @function oncustomizeCollectionBtnClicked * * @created_date : 11-Dec-2013 * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * */ @UiHandler("customizeCollectionBtn") public void oncustomizeCollectionBtnClicked(ClickEvent clickEvent) { MixpanelUtil.Preview_Click_Customize(); String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId"); if(!isCustomizePopup){ isCustomizePopup=true; Boolean loginFlag = false; if (AppClientFactory.isAnonymous()){ loginFlag = true; } else { loginFlag = false; } RenameCustomizePopUp successPopupVc = new RenameCustomizePopUp(collectionId, loginFlag) { @Override public void closePoup() { Window.enableScrolling(true); this.hide(); isCustomizePopup = false; } }; Window.scrollTo(0, 0); successPopupVc.setWidth("500px"); successPopupVc.setHeight("350px"); successPopupVc.show(); successPopupVc.center(); } } /** * * @function oncustomizeCollectionBtnClicked * * @created_date : 11-Dec-2013 * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * */ @UiHandler("shareCollectionBtn") public void onshareCollectionBtnClicked(ClickEvent clickEvent) { MixpanelUtil.Preview_Click_Share(); String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId"); if(!isSharePopup){ isSharePopup=true; SharePlayerVc successPopupVc = new SharePlayerVc(collectionId) { @Override public void closePoup() { Window.enableScrolling(true); this.hide(); isSharePopup = false; } }; Window.scrollTo(0, 0); successPopupVc.setWidth("500px"); successPopupVc.setHeight("350px"); successPopupVc.show(); successPopupVc.center(); } } public class OnassignCollectionBtnMouseOver implements MouseOverHandler{ @Override public void onMouseOver(MouseOverEvent event) { toolTipPopupPanel.clear(); toolTipPopupPanel.setWidget(new GlobalToolTip(GL0676)); toolTipPopupPanel.setStyleName(""); toolTipPopupPanel.setPopupPosition(assignCollectionBtn.getElement().getAbsoluteLeft()+8, assignCollectionBtn.getElement().getAbsoluteTop()+10); toolTipPopupPanel.getElement().getStyle().setZIndex(999999); toolTipPopupPanel.show(); } } public class OnassignCollectionBtnMouseOut implements MouseOutHandler{ @Override public void onMouseOut(MouseOutEvent event) { toolTipPopupPanel.hide(); } } public class OncustomizeCollectionBtnMouseOver implements MouseOverHandler{ @Override public void onMouseOver(MouseOverEvent event) { toolTipPopupPanel.clear(); toolTipPopupPanel.setWidget(new GlobalToolTip(GL0677)); toolTipPopupPanel.setStyleName(""); toolTipPopupPanel.setPopupPosition(customizeCollectionBtn.getElement().getAbsoluteLeft()+18, customizeCollectionBtn.getElement().getAbsoluteTop()+10); toolTipPopupPanel.getElement().getStyle().setZIndex(999999); toolTipPopupPanel.show(); } } public class OncustomizeCollectionBtnMouseOut implements MouseOutHandler{ @Override public void onMouseOut(MouseOutEvent event) { toolTipPopupPanel.hide(); } } public class OnshareCollectionBtnMouseOver implements MouseOverHandler{ @Override public void onMouseOver(MouseOverEvent event) { toolTipPopupPanel.clear(); toolTipPopupPanel.setWidget(new GlobalToolTip(GL0678)); toolTipPopupPanel.setStyleName(""); toolTipPopupPanel.setPopupPosition(shareCollectionBtn.getElement().getAbsoluteLeft()+5, shareCollectionBtn.getElement().getAbsoluteTop()+10); toolTipPopupPanel.getElement().getStyle().setZIndex(999999); toolTipPopupPanel.show(); } } public class OnshareCollectionBtnMouseOut implements MouseOutHandler{ @Override public void onMouseOut(MouseOutEvent event) { toolTipPopupPanel.hide(); } } public void removeAssignmentButtons(){ collectionImageContainer.setVisible(true); previewButton.setVisible(true); collectionEndImageContainer.setVisible(false); endTextContainer.setVisible(false); viewCollectionSummaryBtn.setVisible(false); assignCollectionBtn.removeFromParent(); customizeCollectionBtn.removeFromParent(); shareCollectionBtn.removeFromParent(); separationLine.removeFromParent(); previewButton.setText(GL0594); //addHrTag(); } public void removeAssignmentImageButtons(){ collectionEndImageContainer.setVisible(true); endTextContainer.setVisible(true); String page=AppClientFactory.getPlaceManager().getRequestParameter("page", null); if(page!=null&&page.equals("teach")){ viewCollectionSummaryBtn.setVisible(false); }else{ viewCollectionSummaryBtn.setVisible(true); } endText.getElement().setInnerHTML(GL0596); viewCollectionSummaryBtn.setText("View your Collection Summary"); collectionImageContainer.setVisible(false); previewButton.setVisible(false); assignCollectionBtn.removeFromParent(); customizeCollectionBtn.removeFromParent(); shareCollectionBtn.removeFromParent(); separationLine.removeFromParent(); //addHrTag(); } @UiHandler("collectionThumbnail") public void thumbnailEndPageErrorImage(ErrorEvent event){ collectionThumbnail.setUrl("images/default-collection-image-160x120.png"); } public void setCollectionEndImage(String thumbnailUrl){ collectionThumbnail.setUrl(thumbnailUrl); } public void setReplyLink(){ Anchor resourceAnchor=new Anchor(); resourceAnchor.setHref(getReplayLink()); resourceAnchor.setStyleName(""); resourceAnchor.addClickHandler(new ReplayCollectionEvent()); HTMLPanel collectionHTMLPanel = new HTMLPanel(""); collectionHTMLPanel.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplay()); Label collectionReplayButton=new Label(GL0632); collectionReplayButton.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().collectionreplayText()); collectionHTMLPanel.add(collectionReplayButton); resourceAnchor.getElement().appendChild(collectionHTMLPanel.getElement()); thumbnailContainer.clear(); thumbnailContainer.add(resourceAnchor); } public String getReplayLink(){ String collectionId=AppClientFactory.getPlaceManager().getRequestParameter("id", null); String viewToken=AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken(); String resourceLink="#"+viewToken+"&id="+collectionId; resourceLink += PreviewPlayerPresenter.setConceptPlayerParameters(); return resourceLink; } @UiHandler("viewCollectionSummaryBtn") public void onviewCollectionSummaryBtnClicked(ClickEvent clickEvent) { getUiHandlers().scrollStudyPageEndPage(); } public Button getBackToClassButton(){ return backToClasspageButton; } private class ReplayCollectionEvent implements ClickHandler{ @Override public void onClick(ClickEvent event) { getUiHandlers().resetCollectionActivityEventId(); } } }
[ "anil@goorulearning.org" ]
anil@goorulearning.org
a0ebcd1ec0049d19c5b04c1f86451880275f5882
09ca06cb939e93589fffb238422b8a7010902482
/common-parent/common-api/src/main/java/com/cupdata/sip/common/api/order/request/CreateContentOrderVo.java
994c3ae4863564342f2d8fc57a6cb96f71f1f8cf
[]
no_license
liuiu27/jubilant-octo-memory
e1f9d68a08aec0dc20d9c2c9a518e16e768081e6
6955e92d16f194efe78278c0841f54db6c3c1280
refs/heads/master
2020-03-18T06:51:11.319004
2018-04-26T02:51:37
2018-04-26T02:51:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,017
java
package com.cupdata.sip.common.api.order.request; import lombok.Data; /** * @author 作者: liwei * @createDate 创建时间:2018年4月19日 下午3:27:24 */ @Data public class CreateContentOrderVo { /** * 手机号 */ private String mobileNo; /** * 用户ID */ private String userId; /** * 用户名 */ private String userName; /** * 机构编号 */ private String orgNo; /** * 供应商编号 */ private String supNo; /** * 产品编号 */ private String productNo; /** * 订单金额 */ private Integer orderAmt; /** * 供应商订单号 */ private String supOrderNo; /** * 供应商订单时间 */ private String supOrderTime; /** * 订单标题 */ private String orderTitle; /** * 订单信息 */ private String orderInfo; /** * 产品数量 */ private Integer productNum; /** * 订单页面需展示信息 */ private String orderShow; /** * 异步通知地址 */ private String notifyUrl; }
[ "sh_liwei@macrosky.com.cn" ]
sh_liwei@macrosky.com.cn
658ada5d50b68ff863afdce47f67bbb0f723d163
a2cebaad3baaa63de8aef632915ecdd50af9d0b0
/app/src/main/java/com/example/trackbus/DriverContactActivity.java
8b06dd8d0a7ad6d7d03297d2d81e337892fc1f3d
[]
no_license
surazzmaharjan/trackingBusAppication_Final_Year
9d63385c40d500ec1f796a0bf5003d8de48352f2
4979f076356e0672ee3e09dcc4a18e5012f831bd
refs/heads/master
2022-12-21T02:56:28.166320
2020-09-27T14:03:46
2020-09-27T14:03:46
276,953,192
0
0
null
null
null
null
UTF-8
Java
false
false
5,051
java
package com.example.trackbus; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; public class DriverContactActivity extends AppCompatActivity implements OnMapReadyCallback { private GoogleMap gmap; private LatLng ownlocation = new LatLng(27.628379,85.302189); private Marker LocationMarker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_contact); Toolbar stoolbar =(Toolbar)findViewById(R.id.drivercontacttoolbar); stoolbar.setBackgroundColor(Color.TRANSPARENT); stoolbar.setTitle("Contact Us"); setSupportActionBar(stoolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); stoolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent mainIntent = new Intent(DriverContactActivity.this, DriverActivity.class); startActivity(mainIntent); finish(); } }); ImageButton fbButton = findViewById(R.id.facebookButtton); ImageButton instaButton = findViewById(R.id.instagramButton); ImageButton twitButton = findViewById(R.id.twitterButton); fbButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(getOpenFacebookIntent(DriverContactActivity.this, "100003881591172","tsurajmaharjan")); } }); instaButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(getOpenInstagramIntent(DriverContactActivity.this, "tsurajmaharjan")); } }); twitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(getOpenTwitterIntent(DriverContactActivity.this, "tsuraj123")); } }); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.googlemaps); mapFragment.getMapAsync(this); } @Override public void onMapReady(GoogleMap googleMap) { gmap = googleMap; drawMarker(); } private void drawMarker() { if (gmap == null) return; if (LocationMarker == null) { LocationMarker = gmap.addMarker(new MarkerOptions().position(ownlocation).title("My Office of Bus Track App")); }else{ LocationMarker.setPosition(ownlocation); } CameraUpdate center = CameraUpdateFactory.newLatLng(ownlocation); CameraUpdate zoom = CameraUpdateFactory.zoomTo(16); gmap.moveCamera(center); gmap.animateCamera(zoom); } public Intent getOpenInstagramIntent(Context context, String userName) { try { context.getPackageManager().getPackageInfo("com.instagram.android", 0); return new Intent(Intent.ACTION_VIEW, Uri.parse("http://instagram.com/_u/" + userName)); } catch (Exception e) { return new Intent(Intent.ACTION_VIEW, Uri.parse("http://instagram.com/" + userName)); } } public static Intent getOpenFacebookIntent(Context context, String profileId, String userName) { try { context.getPackageManager().getPackageInfo("com.facebook.katana", 0); return new Intent(Intent.ACTION_VIEW, Uri.parse("fb.com/" + profileId)); } catch (Exception e) { return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + userName)); } } public static Intent getOpenTwitterIntent(Context context, String twitter_user_name) { try { context.getPackageManager().getPackageInfo("com.twitter.android", 0); return new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + twitter_user_name)); } catch (Exception e) { return new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + twitter_user_name)); } } }
[ "surajmzn75@gmail.com" ]
surajmzn75@gmail.com
e8c2123fa17bf3f9f2334df3a45a13530c12144f
a4b88840d3d30b07aa00e69259a7b1c035441a85
/espd-edm/src/main/java/oasis/names/specification/ubl/schema/xsd/commonaggregatecomponents_2/EventType.java
824e8737893aa5278c7ab3d108d54d932d8f052d
[]
no_license
AgID/espd-builder
e342712abc87824d402a90ad87f312a243165970
3614d526d574ad979aafa6da429e409debc73dd8
refs/heads/master
2022-12-23T20:36:03.500212
2020-01-30T16:48:37
2020-01-30T16:48:37
225,416,148
3
0
null
2022-12-16T09:49:58
2019-12-02T16:08:38
Java
UTF-8
Java
false
false
23,718
java
// // Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.11 // Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. // Generato il: 2019.02.25 alle 12:32:23 PM CET // package oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_2; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.CompletionIndicatorType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.DescriptionType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.IdentificationIDType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.OccurrenceDateType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.OccurrenceTimeType; import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TypeCodeType; import org.jvnet.jaxb2_commons.lang.Equals2; import org.jvnet.jaxb2_commons.lang.EqualsStrategy2; import org.jvnet.jaxb2_commons.lang.HashCode2; import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2; import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; import org.jvnet.jaxb2_commons.lang.ToString2; import org.jvnet.jaxb2_commons.lang.ToStringStrategy2; import org.jvnet.jaxb2_commons.locator.ObjectLocator; import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; /** * <p>Classe Java per EventType complex type. * * <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. * * <pre> * &lt;complexType name="EventType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}IdentificationID" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}OccurrenceDate" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}OccurrenceTime" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TypeCode" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}Description" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}CompletionIndicator" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}CurrentStatus" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}Contact" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}OccurenceLocation" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EventType", propOrder = { "identificationID", "occurrenceDate", "occurrenceTime", "typeCode", "description", "completionIndicator", "currentStatus", "contact", "occurenceLocation" }) public class EventType implements Serializable, Equals2, HashCode2, ToString2 { private final static long serialVersionUID = 100L; @XmlElement(name = "IdentificationID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected IdentificationIDType identificationID; @XmlElement(name = "OccurrenceDate", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected OccurrenceDateType occurrenceDate; @XmlElement(name = "OccurrenceTime", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected OccurrenceTimeType occurrenceTime; @XmlElement(name = "TypeCode", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected TypeCodeType typeCode; @XmlElement(name = "Description", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected List<DescriptionType> description; @XmlElement(name = "CompletionIndicator", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected CompletionIndicatorType completionIndicator; @XmlElement(name = "CurrentStatus") protected List<StatusType> currentStatus; @XmlElement(name = "Contact") protected List<ContactType> contact; @XmlElement(name = "OccurenceLocation") protected LocationType occurenceLocation; /** * Recupera il valore della proprietà identificationID. * * @return * possible object is * {@link IdentificationIDType } * */ public IdentificationIDType getIdentificationID() { return identificationID; } /** * Imposta il valore della proprietà identificationID. * * @param value * allowed object is * {@link IdentificationIDType } * */ public void setIdentificationID(IdentificationIDType value) { this.identificationID = value; } /** * Recupera il valore della proprietà occurrenceDate. * * @return * possible object is * {@link OccurrenceDateType } * */ public OccurrenceDateType getOccurrenceDate() { return occurrenceDate; } /** * Imposta il valore della proprietà occurrenceDate. * * @param value * allowed object is * {@link OccurrenceDateType } * */ public void setOccurrenceDate(OccurrenceDateType value) { this.occurrenceDate = value; } /** * Recupera il valore della proprietà occurrenceTime. * * @return * possible object is * {@link OccurrenceTimeType } * */ public OccurrenceTimeType getOccurrenceTime() { return occurrenceTime; } /** * Imposta il valore della proprietà occurrenceTime. * * @param value * allowed object is * {@link OccurrenceTimeType } * */ public void setOccurrenceTime(OccurrenceTimeType value) { this.occurrenceTime = value; } /** * Recupera il valore della proprietà typeCode. * * @return * possible object is * {@link TypeCodeType } * */ public TypeCodeType getTypeCode() { return typeCode; } /** * Imposta il valore della proprietà typeCode. * * @param value * allowed object is * {@link TypeCodeType } * */ public void setTypeCode(TypeCodeType value) { this.typeCode = value; } /** * Gets the value of the description property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the description property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDescription().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DescriptionType } * * */ public List<DescriptionType> getDescription() { if (description == null) { description = new ArrayList<DescriptionType>(); } return this.description; } /** * Recupera il valore della proprietà completionIndicator. * * @return * possible object is * {@link CompletionIndicatorType } * */ public CompletionIndicatorType getCompletionIndicator() { return completionIndicator; } /** * Imposta il valore della proprietà completionIndicator. * * @param value * allowed object is * {@link CompletionIndicatorType } * */ public void setCompletionIndicator(CompletionIndicatorType value) { this.completionIndicator = value; } /** * Gets the value of the currentStatus property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the currentStatus property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCurrentStatus().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link StatusType } * * */ public List<StatusType> getCurrentStatus() { if (currentStatus == null) { currentStatus = new ArrayList<StatusType>(); } return this.currentStatus; } /** * Gets the value of the contact property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the contact property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContact().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ContactType } * * */ public List<ContactType> getContact() { if (contact == null) { contact = new ArrayList<ContactType>(); } return this.contact; } /** * Recupera il valore della proprietà occurenceLocation. * * @return * possible object is * {@link LocationType } * */ public LocationType getOccurenceLocation() { return occurenceLocation; } /** * Imposta il valore della proprietà occurenceLocation. * * @param value * allowed object is * {@link LocationType } * */ public void setOccurenceLocation(LocationType value) { this.occurenceLocation = value; } public String toString() { final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { IdentificationIDType theIdentificationID; theIdentificationID = this.getIdentificationID(); strategy.appendField(locator, this, "identificationID", buffer, theIdentificationID, (this.identificationID!= null)); } { OccurrenceDateType theOccurrenceDate; theOccurrenceDate = this.getOccurrenceDate(); strategy.appendField(locator, this, "occurrenceDate", buffer, theOccurrenceDate, (this.occurrenceDate!= null)); } { OccurrenceTimeType theOccurrenceTime; theOccurrenceTime = this.getOccurrenceTime(); strategy.appendField(locator, this, "occurrenceTime", buffer, theOccurrenceTime, (this.occurrenceTime!= null)); } { TypeCodeType theTypeCode; theTypeCode = this.getTypeCode(); strategy.appendField(locator, this, "typeCode", buffer, theTypeCode, (this.typeCode!= null)); } { List<DescriptionType> theDescription; theDescription = (((this.description!= null)&&(!this.description.isEmpty()))?this.getDescription():null); strategy.appendField(locator, this, "description", buffer, theDescription, ((this.description!= null)&&(!this.description.isEmpty()))); } { CompletionIndicatorType theCompletionIndicator; theCompletionIndicator = this.getCompletionIndicator(); strategy.appendField(locator, this, "completionIndicator", buffer, theCompletionIndicator, (this.completionIndicator!= null)); } { List<StatusType> theCurrentStatus; theCurrentStatus = (((this.currentStatus!= null)&&(!this.currentStatus.isEmpty()))?this.getCurrentStatus():null); strategy.appendField(locator, this, "currentStatus", buffer, theCurrentStatus, ((this.currentStatus!= null)&&(!this.currentStatus.isEmpty()))); } { List<ContactType> theContact; theContact = (((this.contact!= null)&&(!this.contact.isEmpty()))?this.getContact():null); strategy.appendField(locator, this, "contact", buffer, theContact, ((this.contact!= null)&&(!this.contact.isEmpty()))); } { LocationType theOccurenceLocation; theOccurenceLocation = this.getOccurenceLocation(); strategy.appendField(locator, this, "occurenceLocation", buffer, theOccurenceLocation, (this.occurenceLocation!= null)); } return buffer; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) { if ((object == null)||(this.getClass()!= object.getClass())) { return false; } if (this == object) { return true; } final EventType that = ((EventType) object); { IdentificationIDType lhsIdentificationID; lhsIdentificationID = this.getIdentificationID(); IdentificationIDType rhsIdentificationID; rhsIdentificationID = that.getIdentificationID(); if (!strategy.equals(LocatorUtils.property(thisLocator, "identificationID", lhsIdentificationID), LocatorUtils.property(thatLocator, "identificationID", rhsIdentificationID), lhsIdentificationID, rhsIdentificationID, (this.identificationID!= null), (that.identificationID!= null))) { return false; } } { OccurrenceDateType lhsOccurrenceDate; lhsOccurrenceDate = this.getOccurrenceDate(); OccurrenceDateType rhsOccurrenceDate; rhsOccurrenceDate = that.getOccurrenceDate(); if (!strategy.equals(LocatorUtils.property(thisLocator, "occurrenceDate", lhsOccurrenceDate), LocatorUtils.property(thatLocator, "occurrenceDate", rhsOccurrenceDate), lhsOccurrenceDate, rhsOccurrenceDate, (this.occurrenceDate!= null), (that.occurrenceDate!= null))) { return false; } } { OccurrenceTimeType lhsOccurrenceTime; lhsOccurrenceTime = this.getOccurrenceTime(); OccurrenceTimeType rhsOccurrenceTime; rhsOccurrenceTime = that.getOccurrenceTime(); if (!strategy.equals(LocatorUtils.property(thisLocator, "occurrenceTime", lhsOccurrenceTime), LocatorUtils.property(thatLocator, "occurrenceTime", rhsOccurrenceTime), lhsOccurrenceTime, rhsOccurrenceTime, (this.occurrenceTime!= null), (that.occurrenceTime!= null))) { return false; } } { TypeCodeType lhsTypeCode; lhsTypeCode = this.getTypeCode(); TypeCodeType rhsTypeCode; rhsTypeCode = that.getTypeCode(); if (!strategy.equals(LocatorUtils.property(thisLocator, "typeCode", lhsTypeCode), LocatorUtils.property(thatLocator, "typeCode", rhsTypeCode), lhsTypeCode, rhsTypeCode, (this.typeCode!= null), (that.typeCode!= null))) { return false; } } { List<DescriptionType> lhsDescription; lhsDescription = (((this.description!= null)&&(!this.description.isEmpty()))?this.getDescription():null); List<DescriptionType> rhsDescription; rhsDescription = (((that.description!= null)&&(!that.description.isEmpty()))?that.getDescription():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "description", lhsDescription), LocatorUtils.property(thatLocator, "description", rhsDescription), lhsDescription, rhsDescription, ((this.description!= null)&&(!this.description.isEmpty())), ((that.description!= null)&&(!that.description.isEmpty())))) { return false; } } { CompletionIndicatorType lhsCompletionIndicator; lhsCompletionIndicator = this.getCompletionIndicator(); CompletionIndicatorType rhsCompletionIndicator; rhsCompletionIndicator = that.getCompletionIndicator(); if (!strategy.equals(LocatorUtils.property(thisLocator, "completionIndicator", lhsCompletionIndicator), LocatorUtils.property(thatLocator, "completionIndicator", rhsCompletionIndicator), lhsCompletionIndicator, rhsCompletionIndicator, (this.completionIndicator!= null), (that.completionIndicator!= null))) { return false; } } { List<StatusType> lhsCurrentStatus; lhsCurrentStatus = (((this.currentStatus!= null)&&(!this.currentStatus.isEmpty()))?this.getCurrentStatus():null); List<StatusType> rhsCurrentStatus; rhsCurrentStatus = (((that.currentStatus!= null)&&(!that.currentStatus.isEmpty()))?that.getCurrentStatus():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "currentStatus", lhsCurrentStatus), LocatorUtils.property(thatLocator, "currentStatus", rhsCurrentStatus), lhsCurrentStatus, rhsCurrentStatus, ((this.currentStatus!= null)&&(!this.currentStatus.isEmpty())), ((that.currentStatus!= null)&&(!that.currentStatus.isEmpty())))) { return false; } } { List<ContactType> lhsContact; lhsContact = (((this.contact!= null)&&(!this.contact.isEmpty()))?this.getContact():null); List<ContactType> rhsContact; rhsContact = (((that.contact!= null)&&(!that.contact.isEmpty()))?that.getContact():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "contact", lhsContact), LocatorUtils.property(thatLocator, "contact", rhsContact), lhsContact, rhsContact, ((this.contact!= null)&&(!this.contact.isEmpty())), ((that.contact!= null)&&(!that.contact.isEmpty())))) { return false; } } { LocationType lhsOccurenceLocation; lhsOccurenceLocation = this.getOccurenceLocation(); LocationType rhsOccurenceLocation; rhsOccurenceLocation = that.getOccurenceLocation(); if (!strategy.equals(LocatorUtils.property(thisLocator, "occurenceLocation", lhsOccurenceLocation), LocatorUtils.property(thatLocator, "occurenceLocation", rhsOccurenceLocation), lhsOccurenceLocation, rhsOccurenceLocation, (this.occurenceLocation!= null), (that.occurenceLocation!= null))) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { IdentificationIDType theIdentificationID; theIdentificationID = this.getIdentificationID(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "identificationID", theIdentificationID), currentHashCode, theIdentificationID, (this.identificationID!= null)); } { OccurrenceDateType theOccurrenceDate; theOccurrenceDate = this.getOccurrenceDate(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "occurrenceDate", theOccurrenceDate), currentHashCode, theOccurrenceDate, (this.occurrenceDate!= null)); } { OccurrenceTimeType theOccurrenceTime; theOccurrenceTime = this.getOccurrenceTime(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "occurrenceTime", theOccurrenceTime), currentHashCode, theOccurrenceTime, (this.occurrenceTime!= null)); } { TypeCodeType theTypeCode; theTypeCode = this.getTypeCode(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "typeCode", theTypeCode), currentHashCode, theTypeCode, (this.typeCode!= null)); } { List<DescriptionType> theDescription; theDescription = (((this.description!= null)&&(!this.description.isEmpty()))?this.getDescription():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "description", theDescription), currentHashCode, theDescription, ((this.description!= null)&&(!this.description.isEmpty()))); } { CompletionIndicatorType theCompletionIndicator; theCompletionIndicator = this.getCompletionIndicator(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "completionIndicator", theCompletionIndicator), currentHashCode, theCompletionIndicator, (this.completionIndicator!= null)); } { List<StatusType> theCurrentStatus; theCurrentStatus = (((this.currentStatus!= null)&&(!this.currentStatus.isEmpty()))?this.getCurrentStatus():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "currentStatus", theCurrentStatus), currentHashCode, theCurrentStatus, ((this.currentStatus!= null)&&(!this.currentStatus.isEmpty()))); } { List<ContactType> theContact; theContact = (((this.contact!= null)&&(!this.contact.isEmpty()))?this.getContact():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "contact", theContact), currentHashCode, theContact, ((this.contact!= null)&&(!this.contact.isEmpty()))); } { LocationType theOccurenceLocation; theOccurenceLocation = this.getOccurenceLocation(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "occurenceLocation", theOccurenceLocation), currentHashCode, theOccurenceLocation, (this.occurenceLocation!= null)); } return currentHashCode; } public int hashCode() { final HashCodeStrategy2 strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } }
[ "mpetruzzi@pccube.com" ]
mpetruzzi@pccube.com
04ceac061c9046214a7c2db461e11e7ec58e867c
c4eeb8a08544d27a58c15b92b6a338763cffdda7
/Object Oriented Programming/Fun with JavaFX/cards/MovingBall.java
a4e9d5e6c96312acf70e5a859908501c6b30adbc
[]
no_license
giodude074/Academic-Work
d5fff285143a68559eef941177eae218cd504047
06b5aa2ee17e48dd278c397fa12fd5fee12496ba
refs/heads/master
2021-08-31T23:01:31.599389
2017-12-23T08:59:38
2017-12-23T08:59:38
113,622,436
0
0
null
null
null
null
UTF-8
Java
false
false
2,350
java
package cards; import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.stage.Stage; public class MovingBall extends Application { @Override public void start(Stage stage) throws Exception { CirclePane circlePane = new CirclePane(200, 200, Math.min(200, 200) / 4); // Create buttons Button btLeft = new Button("Left"); Button btRight = new Button("Right"); Button btUp = new Button("Up"); Button btDown = new Button("Down"); // Create and register the handler btLeft.setOnAction(e -> circlePane.moveLeft()); btRight.setOnAction(e -> circlePane.moveRight()); btUp.setOnAction(e -> circlePane.moveUp()); btDown.setOnAction(e -> circlePane.moveDown()); // Hold buttons in an HBox HBox buttons = new HBox(btLeft, btRight, btUp, btDown); buttons.setAlignment(Pos.BOTTOM_CENTER); buttons.setSpacing(10); buttons.setPadding(new Insets(10, 10, 10, 10)); BorderPane pane = new BorderPane(); pane.setCenter(circlePane); pane.setBottom(buttons); Scene scene = new Scene(pane, 400, 400); stage.setScene(scene); stage.setTitle("Move Ball"); stage.show(); } private class CirclePane extends Pane { // creating circle private Circle circle; public CirclePane(double centerX, double centerY, double radius) { circle = new Circle(centerX, centerY, radius); getChildren().add(circle); // circle.setStroke(Color.BLACK); it looks ugly with the stroke circle.setFill(new Color(0, 1, 0.5, 0.5)); } // Movement Methods public void moveLeft() { circle.setCenterX(circle.getCenterX() - 5); } public void moveRight() { circle.setCenterX(circle.getCenterX() + 5); } public void moveUp() { //if (circle.getCenterY() - circle.getRadius() - 5 < 0) return; //restriction so it doesnt pass circle.setCenterY(circle.getCenterY() - 5); } public void moveDown() { circle.setCenterY(circle.getCenterY() + 5); } } public static void main(String[] args) { Application.launch(args); } }
[ "Gio G" ]
Gio G
1b7ecfabbc770f7dffa20235eec2fffc180e20ac
6f56d94dc2bd19e8aef75ba0b049cba1bae76fdf
/java/CompSci_Functions/src/Challenges1.java
e38f84867a6e2703c0b6497f3a69a47f07c7b134
[ "MIT" ]
permissive
71xn/IBCSCodeLog
9da02d913e8c3c29329da9960060e447f43786cf
1322dc974caa9d480c5c45f4b70d95c64ba5cb79
refs/heads/master
2023-04-29T07:03:39.553030
2021-05-12T09:51:39
2021-05-12T09:51:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
// Finn Lestrange - 30/09/2020 // Functions Challenges 1 import java.util.Scanner; public class Challenges1 { public static boolean atmCode(int n1) { int sum = 0; sum = n1 % 10; sum = sum + (((n1 % 100) - (n1 % 10)) / 10); sum = sum + (((n1 % 1000) - (n1 % 10) - (((n1 % 100) - (n1 % 10)) / 10)) / 100); if (sum % 2 == 0) { return false; } else { return true; } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Please enter a 4 digit code: "); int pin = scanner.nextInt(); if (atmCode(pin) == false) { System.out.println("F"); } else { System.out.println("T"); } } }
[ "f1nnl3strange@protonmail.ch" ]
f1nnl3strange@protonmail.ch
862a5550824fb34953bfa2563d1b3672446944db
497ea52c43e36ccae13fb8bd4c350c6278bbc5a6
/chopee-service/src/main/java/com/example/chopeeservice/CommonService.java
4bc6e0190509587ba27f6a1f5bd6ebd91c4c5413
[]
no_license
UJSZWP/test
cb6d4240b94796f839ea43873e23362defc82092
43416b9c2ebfd102741ef6d5a2cd1338949cc109
refs/heads/master
2023-03-30T06:38:56.849738
2021-03-26T02:36:43
2021-03-26T02:36:43
351,639,534
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package com.example.chopeeservice; import com.example.chopeebiz.dto.LoginDto; import com.example.chopeebiz.dto.LoginReqDto; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.Cookie; public interface CommonService { /** * 登陆 */ Cookie doLogin(LoginReqDto loginReqDto); /** * 上传文件 */ String uploadFile(MultipartFile file) throws Exception; }
[ "zhaiwenpeng@meituan.com" ]
zhaiwenpeng@meituan.com
14f65115e64e2bd080f41e4faa833cd47ffc20c6
98d50c9a4348e6d604cd4651d8af7e68575cff2c
/src/main/java/net/kxmischesdomi/customitems/utils/bukkit/customitems/CustomItemUtils.java
6abba38bbcad3f544faa7d36f3211d5fab91bc5c
[ "Apache-2.0" ]
permissive
KxmischesDomi/CustomItemsAPI
1fb45c250363622014c7d9b279bc334d0416c8e0
c3e6cc26dbd3cd87829e486740e0db55460b63b5
refs/heads/master
2023-06-28T03:08:32.306083
2021-07-23T19:37:02
2021-07-23T19:37:02
387,605,533
0
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package net.kxmischesdomi.customitems.utils.bukkit.customitems; import de.tr7zw.nbtapi.NBTItem; import net.kxmischesdomi.customitems.CustomItemConstants; import net.kxmischesdomi.customitems.CustomItems; import net.kxmischesdomi.customitems.item.ICustomItem; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * @author KxmischesDomi | https://github.com/kxmischesdomi * @since 1.0 */ public class CustomItemUtils { @Nullable public static ICustomItem getCustomItemFromItemStack(@Nonnull ItemStack itemStack) { if (itemStack.getType() == Material.AIR) return null; String key = getKeyFromItemStack(itemStack); if (key == null) return null; return CustomItems.getInstance().getCustomItemsManagement().getCustomItem(key); } @Nullable public static String getKeyFromItemStack(@Nonnull ItemStack itemStack) { if (itemStack.getType() == Material.AIR) return null; NBTItem nbtItem = new NBTItem(itemStack); return nbtItem.getString(CustomItemConstants.KEY); } public static boolean itemEquals(@Nullable ItemStack itemStack1, @Nullable ItemStack itemStack2) { if (itemStack1 == itemStack2) return false; if (itemStack1 == null || itemStack2 == null) return false; String keyFromItemStack1 = getKeyFromItemStack(itemStack1); String keyFromItemStack2 = getKeyFromItemStack(itemStack2); if (keyFromItemStack1 == null && keyFromItemStack2 == null && itemStack1.isSimilar(itemStack2)) return true; return keyFromItemStack1 != null && keyFromItemStack1.equals(keyFromItemStack2); } }
[ "kxmischesdomi@gmail.com" ]
kxmischesdomi@gmail.com
f3abd06ce1ba40689484f3c243a01c88eddb4f8a
3d31f75a573613ba2a2ae178d73e40c7de7dee73
/src/main/java/com/stayhome/demo/data/ArticlesPorPack.java
e477224ebbc97e6ee97b802cabdd86bb8be52bb8
[]
no_license
L4mb0/stay-home-backend
3aa3854f8c76e1669a1a3eb54d7cbbe4d9c39f0b
e1220975168907d31cf71d1cc44746b42b591df3
refs/heads/master
2022-11-22T20:16:14.843310
2020-07-20T04:55:11
2020-07-20T04:55:11
280,573,580
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package com.stayhome.demo.data; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name="app_articlesbypack", schema="public") public class ArticlesPorPack implements Serializable{ @EmbeddedId private Doublei doublei; public ArticlesPorPack(){ } public ArticlesPorPack(Doublei id) { this.doublei = id; } public Doublei getDoublei() { return doublei; } public void setDoublei(Doublei doublei) { this.doublei = doublei; } }
[ "juan.navarro@utec.edu.pe" ]
juan.navarro@utec.edu.pe
09cd273dbd03246f24ddb81f66c8aeeb1c40364f
1fc3714a66f549ed5ab14652bed9de1bfab828e1
/app/src/androidTest/java/com/example/k4170/slideritem/ExampleInstrumentedTest.java
c789681cbe60891dc16b3e1fa879c028ab8b5852
[]
no_license
woworkerHu/SliderItem
03667083cabed0971ab5bafaa4e0fee651824a98
d30c01c0d93cce9047b9217c8ef3360944237c00
refs/heads/master
2021-05-12T09:49:08.889460
2018-01-13T10:37:25
2018-01-13T10:37:25
117,335,028
1
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.example.k4170.slideritem; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.k4170.slideritem", appContext.getPackageName()); } }
[ "huguanhu@yonyou.com" ]
huguanhu@yonyou.com
594574b957476fb89dbca46cf6eda45f5f557296
cc092ff46b0fc0350d740c6df0b940e80432527e
/src/main/java/com/java/patterns/java_patterns/observerpattern/impl/OctalObserver.java
538ceaf50af9fbff82b95845418f8ffa5d63e175
[]
no_license
fernandooliveirapimenta/java_patterns
cdfedd6c6d96eda4c21273e7583aab707516b15e
6b5039b72096a34044e598fcce1d4e9eb316416d
refs/heads/master
2021-06-23T16:26:58.747857
2021-02-16T15:41:31
2021-02-16T15:41:31
193,502,352
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.java.patterns.java_patterns.observerpattern.impl; public class OctalObserver extends Observer { public OctalObserver(Subject subject) { this.subject = subject; this.subject.attach(this); } @Override public void update() { System.out.printf("Octal String: %s \n",Integer.toOctalString(subject.getState())); } }
[ "fernando.pimenta107@gmail.com" ]
fernando.pimenta107@gmail.com
f20a06163abb434f945f8f898b2f820cc35c03e7
69a0e4c1271f097d2255ef21d2587094326da2c8
/src/com/dsd/mobilesafe/AntiVirusActivity.java
f7c52906fe1fcfac78054b36e37bedba13f1bc26
[]
no_license
dsd13502/MobileSafe
86a0f8f36dec7fcb829e21ebcc8977d251c3da33
90b037456712cef1583f671673980388d68de052
refs/heads/master
2021-01-21T14:04:17.023281
2016-05-28T05:21:06
2016-05-28T05:21:06
55,274,457
0
0
null
null
null
null
UTF-8
Java
false
false
4,418
java
package com.dsd.mobilesafe; import java.util.List; import java.util.Random; import android.app.Activity; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.view.View; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import com.dsd.mobilesafe.db.dao.AntiVriusDao; import com.dsd.mobilesafe.db.daomain.VriusBean; import com.dsd.mobilesafe.utils.Md5Util; public class AntiVirusActivity extends Activity { protected static final int SCANNING = 100; protected static final int SCANNING_FINISH = -100; private TextView tv_status; private ImageView iv_scanning; private ProgressBar pb_anti_virus; private List<VriusBean> mVriusList; private LinearLayout ll_container; private Handler mHandler = new Handler() { public void handleMessage(android.os.Message msg) { TextView view = new TextView(getApplicationContext()); switch (msg.what) { case SCANNING: VriusBean vriusBean = (VriusBean)msg.obj; tv_status.setText("正在扫描"+ vriusBean.getName()); //判读是否为病毒 if(vriusBean.isVrius()) { //是病毒 view.setTextColor(Color.RED); view.setText("发现病毒:"+vriusBean.getName()+":"+vriusBean.getDesc()); } else { //不是病毒 view.setTextColor(Color.BLACK); view.setText("扫描安全:"+vriusBean.getName()); } ll_container.addView(view,0); break; case SCANNING_FINISH: //清除动画 iv_scanning.clearAnimation(); tv_status.setText("扫描完成"); break; } }; }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anti_virus); initUI(); initRotateAnimation(); initData(); } /** * 初始化数据 */ private void initData() { new Thread() { public void run() { super.run(); //获取手机中安装了的,或者已经卸载的软件签名 PackageManager pm =getPackageManager(); // List<PackageInfo> installedPackages = pm.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES + PackageManager.GET_SIGNATURES); //设置进度条的最大值 pb_anti_virus.setMax(installedPackages.size()); //设置当前进度 int progress = 0; //开始遍历 for (PackageInfo packageInfo : installedPackages) { VriusBean virus = new VriusBean(); Signature s = packageInfo.signatures[0]; String name = (String) packageInfo.applicationInfo.loadLabel(pm); String md5 = Md5Util.encoder(s.toCharsString()); //获取描述信息 String decs= AntiVriusDao.isVrius(md5); if(decs != null) { //发现病毒 virus.setVrius(true); } else { virus.setVrius(false); } virus.setDesc(decs); virus.setName(name); Message msg = Message.obtain(); progress ++; //设置当前进度 pb_anti_virus.setProgress(progress); msg.obj = virus; msg.what = SCANNING; mHandler.sendMessage(msg); SystemClock.sleep(50+new Random().nextInt(100)); } //扫描完成,发送最后一个消息 Message msg = Message.obtain(); msg.what = SCANNING_FINISH; mHandler.sendMessage(msg); }; }.start(); } /** * 初始化View控件 */ private void initUI() { iv_scanning = (ImageView) findViewById(R.id.iv_scanning); tv_status = (TextView) findViewById(R.id.tv_status); pb_anti_virus = (ProgressBar) findViewById(R.id.pb_anti_virus); ll_container = (LinearLayout) findViewById(R.id.ll_container); } /** * 圆形旋转动画 */ private void initRotateAnimation() { RotateAnimation rotateAnimation = new RotateAnimation( 0, 360, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF,0.5f); //两秒执行完成 rotateAnimation.setDuration(2000); //这是重复次数,一直循环 rotateAnimation.setRepeatCount(Animation.INFINITE); iv_scanning.setAnimation(rotateAnimation); } }
[ "im_dsd@126.com" ]
im_dsd@126.com
219dad3bdd89055ac1a324e2bc672551aec5abc6
26a27b87956bf8aed4b02f0ac86ccd006573fd18
/device-admin/src/main/java/com/example/device/admin/dao/entity/bo/DevicePropertyPost.java
2691b71d4f0c4ecf312994670a37ec158305ab85
[]
no_license
meng-wenlong/SmartHomePro
e6c2c0ac337d72bb4642327b6be0c0bd348c2d88
e608401ecfdb01bf6c303b4ca5dba024a1d60522
refs/heads/main
2023-01-09T23:15:57.213886
2020-11-12T03:33:50
2020-11-12T03:33:50
312,135,950
0
0
null
null
null
null
UTF-8
Java
false
false
4,783
java
package com.example.device.admin.dao.entity.bo; import java.awt.peer.LightweightPeer; import java.util.Date; public class DevicePropertyPost { private String deviceType; private String iotId; private String productKey; private Date gmtCreate; private String deviceName; private Data items; public String getDeviceType() { return deviceType; } public String getIotId() { return iotId; } public String getProductKey() { return productKey; } public Date getGmtCreate() { return gmtCreate; } public String getDeviceName() { return deviceName; } public Data getItems() { return items; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public void setIotId(String iotId) { this.iotId = iotId; } public void setProductKey(String productKey) { this.productKey = productKey; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public void setDeviceName(String deviceName) { this.deviceName = deviceName; } public void setItems(Data items) { this.items = items; } public static class Data { private CurrentHumidityPropertyInfo CurrentHumidity; private CurrentTemperaturePropertyInfo CurrentTemperature; private CurrentLightPropertyInfo CurrentLight; /*修改*/ private TempThresholdPropertyInfo TempThreshold; private LightThresholdPropertyInfo LightThreshold; /*修改*/ public CurrentHumidityPropertyInfo getCurrentHumidity() { return CurrentHumidity; } public CurrentTemperaturePropertyInfo getCurrentTemperature() { return CurrentTemperature; } public CurrentLightPropertyInfo getCurrentLight() { return CurrentLight; } /*修改*/ public TempThresholdPropertyInfo getTempThreshold() { return TempThreshold; } public LightThresholdPropertyInfo getLightThreshold() { return LightThreshold; } /*修改*/ public void setCurrentHumidity(CurrentHumidityPropertyInfo currentHumidity) { CurrentHumidity = currentHumidity; } public void setCurrentLight(CurrentLightPropertyInfo currentLight) { /*修改*/ CurrentLight = currentLight; } public void setCurrentTemperature(CurrentTemperaturePropertyInfo currentTemperature) { CurrentTemperature = currentTemperature; } public void setTempThreshold(TempThresholdPropertyInfo tempThreshold) { TempThreshold = tempThreshold; } public void setLightThreshold(LightThresholdPropertyInfo lightThreshold) { LightThreshold = lightThreshold; } /*修改*/ } public static class CurrentLightPropertyInfo{ /*修改*/ private Float value; private Date time; public Float getValue() { return value; } public Date getTime() { return time; } public void setValue(Float value) { this.value = value; } public void setTime(Date time) { this.time = time; } } public static class CurrentHumidityPropertyInfo{ private Float value; private Date time; public Float getValue() { return value; } public Date getTime() { return time; } public void setValue(Float value) { this.value = value; } public void setTime(Date time) { this.time = time; } } public static class CurrentTemperaturePropertyInfo{ private Float value; private Date time; public Float getValue() { return value; } public Date getTime() { return time; } public void setValue(Float value) { this.value = value; } public void setTime(Date time) { this.time = time; } } public static class TempThresholdPropertyInfo{ private Float value; private Date time; public Float getValue() { return value; } public Date getTime() { return time; } public void setValue(Float value) { this.value = value; } public void setTime(Date time) { this.time = time; } } public static class LightThresholdPropertyInfo{ private Float value; private Date time; public Float getValue() { return value; } public Date getTime() { return time; } public void setValue(Float value) { this.value = value; } public void setTime(Date time) { this.time = time; } } }
[ "2352095323@qq.com" ]
2352095323@qq.com
2021439ec4a628e25f81cf3017cbd0caacdda537
986127b2757a92d187252d979252c360304564de
/app/src/main/java/br/com/etecia/menuappetecia/MainActivity.java
d35a4ab575f332833afb67706d017a91bfbb484c
[]
no_license
GuilhermaoAndrade/Menu_Android
b8f4d1bb4b61e28c52789c6263743569d9310a9d
dcae47347754907eb2be5051175b8de1aa632285
refs/heads/master
2020-05-20T18:12:10.499138
2019-05-09T01:16:23
2019-05-09T01:16:23
185,702,251
0
0
null
null
null
null
UTF-8
Java
false
false
2,531
java
package br.com.etecia.menuappetecia; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.Toast; public class MainActivity extends AppCompatActivity { Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.idToolBar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Título"); getSupportActionBar().setIcon(R.drawable.arrow_back); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_principal, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.mCompartilhar: Toast.makeText(getApplicationContext(), "Compartilhar", Toast.LENGTH_SHORT).show(); Intent compartilhar = new Intent(MainActivity.this,Compartilhar_Activity.class); startActivity(compartilhar); break; case R.id.mFavoritos: Toast.makeText(getApplicationContext(), "Favoritos", Toast.LENGTH_SHORT).show(); Intent favoritos = new Intent(MainActivity.this,Favoritos_Activity.class); startActivity(favoritos); break; case R.id.mConfiguracoes: Toast.makeText(getApplicationContext(), "Configurações", Toast.LENGTH_SHORT).show(); Intent configuracoes = new Intent(MainActivity.this,Compartilhar_Activity.class); startActivity(configuracoes); break; case R.id.mPesquisar: Toast.makeText(getApplicationContext(), "Pesquisar", Toast.LENGTH_SHORT).show(); break; case R.id.mSobre: Toast.makeText(getApplicationContext(), "Sobre", Toast.LENGTH_SHORT).show(); break; case R.id.mSalvos: Toast.makeText(getApplicationContext(), "Salvos", Toast.LENGTH_SHORT).show(); break; } return super.onOptionsItemSelected(item); } }
[ "guilherme.souza366@etec.sp.gov.br" ]
guilherme.souza366@etec.sp.gov.br
511de06b57ffc1ed51a82deed6e5c1dc798f2283
2b7750ef03fd432729a53418bb8adc43ae553c63
/SkillTest/src/main/java/com/testyourskills/dao/common/impl/GenericDAO.java
8c166606b972bee2c68076567aed7716f3a80fb1
[]
no_license
Arpan1985/SkillTest
2d9b30de4644e4f5bc666e7e9dff1d28868775b4
f4a0067c67b538660630f361142f78306dff04a7
refs/heads/master
2020-06-17T15:57:51.384672
2017-01-02T12:42:52
2017-01-02T12:42:52
74,972,056
0
0
null
null
null
null
UTF-8
Java
false
false
2,285
java
package com.testyourskills.dao.common.impl; import java.io.Serializable; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import com.testyourskills.dao.common.IGenericDAO; /** *This class contains the DAO methods used in the application *for communicating with the Database. * @param <T> * @param <PK> */ public abstract class GenericDAO<T,PK extends Serializable> implements IGenericDAO<T,PK> { /** *This variable holds the SessionFactory instance */ @Autowired private SessionFactory sessionFactory; /** * This variable holds the generic Class types(entity bean types) * passed to the DAO constructor. */ private Class<T> clazz; /** * Parameterized constructor of the class. * @param obj */ public GenericDAO(final Class<T> obj){ this.clazz=obj; } /** * This method inserts the given object in the database and returns the primary key * @param T obj * @return PK */ @Override public T insert(final T obj) { getSession().save(obj); return obj; } /** * @param obj * @return */ @Override public void update(T obj){ getSession().update(obj); } @Override public void saveOrUpdate(T obj){ getSession().saveOrUpdate(obj); } /** * @param id * @return */ @Override public T get(PK id){ return (T)getSession().get(clazz, id); } /** * @param sessionFactory */ public void setSessionFactory(final SessionFactory sRessionFactory) { this.sessionFactory = sRessionFactory; } /** * Getter method for the session object * @return Session */ public Session getSession(){ Session currentSession = sessionFactory.getCurrentSession(); if(currentSession==null){ currentSession = sessionFactory.openSession(); } return currentSession; } /** * Getter method for the SessionFactory object * @return SessionFactory */ public SessionFactory getSessionFactory() { return sessionFactory; } /** * @return the clazz */ public Class<T> getClazz() { return clazz; } /** * @param clazz the clazz to set */ public void setClazz(Class<T> clazz) { this.clazz = clazz; } }
[ "chattopadhyay.arpan@gmail.com" ]
chattopadhyay.arpan@gmail.com
a2b65febd5c28049b8995e0d40cac01a0e7108ed
8166f21ed348113eba6ae38945f5426b3db230d7
/src/main/java/com/dpd/test/DemoApplication.java
56ceba5acaac60e34554925d5ef00009393ccf43
[]
no_license
TC49501/SpringBoot2
deb69c3b0945efe65ea36788986394a15ab29917
7ce9893696edb522f940b813dbfb4215b69e6db5
refs/heads/master
2023-01-28T19:27:22.180898
2017-04-18T15:01:41
2017-04-18T15:01:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
package com.dpd.test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import javax.annotation.PostConstruct; @SpringBootApplication public class DemoApplication { @Autowired EmployeeRepository repository; public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } @PostConstruct private void init() { Employee emp = new Employee(); emp.setFirstName("Thiru"); emp.setLastName("Chinna"); emp.setTitle("Architect"); repository.save(emp); } }
[ "thiruvengadam.chinnamani@equifax.com" ]
thiruvengadam.chinnamani@equifax.com
a217bf54c3e3a8a8f995f95ba7ecf1304dc482fa
adafae36852a05fa68cfd9ccb359a5781d0cbc79
/user-provider-config-center/src/test/java/com/yiming/userproviderconfigcenter/UserProviderConfigCenterApplicationTests.java
8be5457e0bad31ce9c5c93cdbdfefd70d257d73a
[]
no_license
Yi-GODAN/springcloud_all_two
1384a75283d625d5bf721fddd70f0081c897bda2
48d4c07e1b0258469e3e27748e3b1efc593f95fd
refs/heads/master
2023-02-20T23:56:38.088902
2021-01-23T08:52:25
2021-01-23T08:52:25
332,163,708
0
0
null
null
null
null
UTF-8
Java
false
false
254
java
package com.yiming.userproviderconfigcenter; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class UserProviderConfigCenterApplicationTests { @Test void contextLoads() { } }
[ "onegodan@qq.com" ]
onegodan@qq.com
81141bd45697fa5ef53c3b7f74dade104fa088c0
28359b62c3a81eeab91217f69fbd02affbc12ce8
/java_01/src/day06/Test03.java
1f0d9f0f4d3420ac145d1e6e8eb9750b6c962e22
[]
no_license
hsok0070/bit_java
617dd532d498ac1f655c01edde4276a25f3602bc
9b33847b4c28bb62d25544ae18324efcd92eb3e5
refs/heads/master
2020-07-03T09:50:31.800447
2019-08-29T09:44:01
2019-08-29T09:44:01
201,861,796
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package day06; import java.util.Arrays; public class Test03 { public static void main(String[] args) { int num; String name; new Tv(); Employee emp1 = new Employee(); emp1.display(); Employee emp2 = new Employee(); //emp2.age = 201901; emp2.setAge(-201901); emp2.setName("홍길동"); emp2.setDept("인사부"); //emp2.name = "홍길동"; //emp2.dept = "인사부"; emp2.display(); Employee emp3 = new Employee(); //emp3.age = 201907; emp3.setAge(201907); emp3.setName("김민우"); emp3.setDept("개발부"); emp3.setSingle(true); //emp3.name = "김민우"; //emp3.dept = "개발부"; emp3.display(); } }
[ "user@DESKTOP-V882PTR" ]
user@DESKTOP-V882PTR
c79476057e69fbaa70f655babad6d82b464d7e56
4d16db60146aa17bfdf95bf585b1dbb625cf9eeb
/src/main/java/me/b3n3dkt/commands/Heal.java
495dc5b30118f51aee0b0b9c572a8867c9a20a83
[]
no_license
b3n3dkt/JailedMCCitybuild
0be68fd2c8da73a2eb30c2b442a2990b67972669
ad21e77c552fc2a15e46949e3c4f59924a3a82f1
refs/heads/master
2023-04-13T19:06:43.556489
2021-05-01T10:45:04
2021-05-01T10:45:04
354,971,083
0
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
package me.b3n3dkt.commands; import me.b3n3dkt.Citybuild; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class Heal implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender instanceof Player) { Player p = (Player)sender; if (p.hasPermission("jailedmc.command.heal")) { if (args.length == 0) { p.setHealth(20.0D); p.setFoodLevel(20); p.sendMessage(Citybuild.getPrefix() + "§7Du hast dich geheilt!"); } else if (args.length == 1) { Player t = Bukkit.getPlayer(args[0]); if (t != null) { t.setHealth(20.0D); t.setFoodLevel(20); p.sendMessage(Citybuild.getPrefix() + "§7Du hast §8'§3" + t.getName() + "§8' §7geheilt!"); t.sendMessage(Citybuild.getPrefix() + "§7Du wurdest von §8'§3" + p.getName() + "§8' §7geheilt!"); } else { p.sendMessage(Citybuild.getPrefix() + "§cDer angegebene Spieler ist nicht online!"); } } else { p.sendMessage(Citybuild.getPrefix() + "§cNutze /heal <Spieler>!"); } } else { p.sendMessage(Citybuild.getNoperm()); } } return false; } }
[ "itzslimehdn@gmail.com" ]
itzslimehdn@gmail.com
e4305092a5ecbf4af9bd96516ef422dc6c129550
fee9705ccbe80563b70c52d5f75437d2307ce8e6
/JDBC/src/JdbcDemo1.java
c98bb02dbc40d9e131cb32fc326998abafc094d4
[]
no_license
GaryXiongxiong/JavaLearning
b70e608230ce423bee2d8d5471efd19508a70da6
a8cd663149f509009b468a0755fde8c2e4e19cb3
refs/heads/master
2020-05-05T01:18:48.754192
2019-11-30T17:40:54
2019-11-30T17:40:54
179,598,942
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
import java.sql.*; /** * JavaLearning * JdbcDemo1 * * @author Yixiong J * @version 2019/11/18 9:55 */ public class JdbcDemo1 { public static void main(String[] args) throws Exception { // Class.forName("com.mysql.jdbc.Driver"); // In the new version connector, driver has been automatically registered. Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?serverTimezone=UTC", "root", "di1tiancai"); String sql = "SELECT * FROM new_table WHERE user_name = ?"; PreparedStatement preparedStatement = connection.prepareStatement(sql); preparedStatement.setString(1,"gary"); ResultSet resultSet = preparedStatement.executeQuery(); if(resultSet.next()){ System.out.println(resultSet.getString(1)); System.out.println(resultSet.getString(2)); System.out.println(resultSet.getString(3)); } preparedStatement.close(); connection.close(); } }
[ "i@jiangyixiong.top" ]
i@jiangyixiong.top
ad64128fbeb77ee08484a19fc8bf98611c054518
89ec26aa743a73a7196e108f6f0a85f276c5c007
/sinnori_framework/core_build/src/kr/pe/sinnori/server/threadpool/executor/ExecutorProcessorPool.java
ec325dc8f7b3fd70b4e3ccbcae1e6aa336f2068d
[ "Apache-2.0" ]
permissive
mait/gitsinnori
10f11f999d92422c6df547e5df931c0908a20129
e206ed997645e6a3919a639080ff4496252d22a3
refs/heads/master
2020-12-26T01:13:07.419409
2013-12-13T07:31:31
2013-12-13T07:31:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,216
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kr.pe.sinnori.server.threadpool.executor; import java.util.concurrent.LinkedBlockingQueue; import kr.pe.sinnori.common.lib.CommonProjectInfo; import kr.pe.sinnori.common.lib.MessageMangerIF; import kr.pe.sinnori.common.threadpool.AbstractThreadPool; import kr.pe.sinnori.server.ClientResourceManagerIF; import kr.pe.sinnori.server.executor.SererExecutorClassLoaderManagerIF; import kr.pe.sinnori.server.io.LetterFromClient; import kr.pe.sinnori.server.io.LetterToClient; import kr.pe.sinnori.server.threadpool.executor.handler.ExecutorProcessor; /** * 서버 비지니스 로직 수행자 쓰레드 폴 * * @author Jonghoon Won */ public class ExecutorProcessorPool extends AbstractThreadPool { // execuate_processor_pool_max_size private int maxHandler; private CommonProjectInfo commonProjectInfo; private MessageMangerIF messageManger; private SererExecutorClassLoaderManagerIF sererExecutorClassLoaderManager; private ClientResourceManagerIF clientResourceManager; private LinkedBlockingQueue<LetterFromClient> inputMessageQueue; private LinkedBlockingQueue<LetterToClient> ouputMessageQueue; /** * 생성자 * @param size 서버 비지니스 로직 수행자 쓰레드 갯수 * @param max 서버 비지니스 로직 수행자 쓰레드 최대 갯수 * @param commonProjectInfo 연결 공통 데이터 * @param inputMessageQueue 입력 메시지 큐 * @param ouputMessageQueue 출력 메시지 큐 * @param messageManger 메시지 관리자 * @param sererExecutorClassLoaderManager 서버 비지니스 로직 클래스 로더 관리자 * @param clientResourceManager 클라이언트 자원 관리자 */ public ExecutorProcessorPool(int size, int max, CommonProjectInfo commonProjectInfo, LinkedBlockingQueue<LetterFromClient> inputMessageQueue, LinkedBlockingQueue<LetterToClient> ouputMessageQueue, MessageMangerIF messageManger, SererExecutorClassLoaderManagerIF sererExecutorClassLoaderManager, ClientResourceManagerIF clientResourceManager) { if (size <= 0) { throw new IllegalArgumentException("파라미터 초기 핸들러 갯수는 0보다 커야 합니다."); } if (max <= 0) { throw new IllegalArgumentException("파라미터 최대 핸들러 갯수는 0보다 커야 합니다."); } if (size > max) { throw new IllegalArgumentException(String.format( "파라미터 초기 핸들러 갯수[%d]는 최대 핸들러 갯수[%d]보다 작거나 같아야 합니다.", size, max)); } this.maxHandler = max; this.commonProjectInfo = commonProjectInfo; this.inputMessageQueue = inputMessageQueue; this.ouputMessageQueue = ouputMessageQueue; this.messageManger = messageManger; this.sererExecutorClassLoaderManager = sererExecutorClassLoaderManager; // this.dataPacketBufferQueueManager = dataPacketBufferQueueManager; this.clientResourceManager = clientResourceManager; for (int i = 0; i < size; i++) { addHandler(); } } @Override public void addHandler() { synchronized (monitor) { int size = pool.size(); if (size < maxHandler) { try { Thread handler = new ExecutorProcessor(size, commonProjectInfo, inputMessageQueue, ouputMessageQueue, messageManger, sererExecutorClassLoaderManager, clientResourceManager); pool.add(handler); } catch (Exception e) { log.warn("MesgProcessor handler 등록 실패", e); } } } } }
[ "k9200544@hanmail.net" ]
k9200544@hanmail.net
abd24175e769640380f4ae3f804ff9f0f22111af
0bd576df8106f409206dd9c90b74c50f836e52ce
/src/test/java/SpringMvcTest.java
5180c39e5bc7b5b5449a0556fddb1e016fa8a9fd
[]
no_license
a857314548/ssm-crud
c5ecfdd4675f17c933427a25a224fd4af447c2c8
62a6a476faa9fc932a82e6446a4c187b5aabe835
refs/heads/master
2022-12-29T10:36:14.652405
2020-10-18T11:43:50
2020-10-18T11:43:50
305,081,341
1
0
null
null
null
null
UTF-8
Java
false
false
2,140
java
import com.github.pagehelper.PageInfo; import com.zhangzhen.bean.Employee; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import java.util.Arrays; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = {"classpath:applicationContext.xml","file:src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml"}) public class SpringMvcTest { @Autowired WebApplicationContext context; MockMvc mockMvc; @Before public void initMockMvc() { mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); } @Test public void testSpringMvc() throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get("/emps").param("pn", "11")).andReturn(); MockHttpServletRequest request = result.getRequest(); PageInfo pageInfo = (PageInfo) request.getAttribute("pageInfo"); System.out.println("当前页码值:"+pageInfo.getPageNum()); System.out.println("总条数:"+pageInfo.getTotal()); System.out.println("总页面数:"+pageInfo.getPages()); System.out.println("每页条数:"+pageInfo.getPageSize()); int[] navigatepageNums = pageInfo.getNavigatepageNums(); System.out.println("页面显示的条数:"+ Arrays.toString(navigatepageNums)); List<Employee> list = pageInfo.getList(); for (Employee employee : list) { System.out.println(employee); } } }
[ "857314548@qq.com" ]
857314548@qq.com
afe695f295a8e1ce0e853c0fe3c2acda5e37c2f7
f9a3abd4b71facea746549f8054cf80c8b6e6471
/software/SIW/src/java/gov/nih/nci/ncicb/cadsr/loader/parser/RoundtripWriter2.java
dbf8201b13652ca0972c506b377c2f7f0ba64759
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
CBIIT/cadsr-semantic-tools
40d2c6bed7ac1abe39ebdd0b77350f700821ad91
e65bd3cdb9608724c7cc0bf208e09678f4d63c97
refs/heads/master
2022-01-23T22:51:46.365456
2018-03-01T03:31:18
2018-03-01T03:31:18
19,790,963
0
0
null
null
null
null
UTF-8
Java
false
false
13,461
java
/* * Copyright 2000-2005 Oracle, Inc. This software was developed in conjunction with the National Cancer Institute, and so to the extent government employees are co-authors, any rights in such works shall be subject to Title 17 of the United States Code, section 105. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer of Article 3, below. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * 2. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: * * "This product includes software developed by Oracle, Inc. and the National Cancer Institute." * * If no such end-user documentation is to be included, this acknowledgment shall appear in the software itself, wherever such third-party acknowledgments normally appear. * * 3. The names "The National Cancer Institute", "NCI" and "Oracle" must not be used to endorse or promote products derived from this software. * * 4. This license does not authorize the incorporation of this software into any proprietary programs. This license does not authorize the recipient to use any trademarks owned by either NCI or Oracle, Inc. * * 5. THIS SOFTWARE IS PROVIDED "AS IS," AND ANY EXPRESSED OR IMPLIED WARRANTIES, (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. IN NO EVENT SHALL THE NATIONAL CANCER INSTITUTE, ORACLE, OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE */ package gov.nih.nci.ncicb.cadsr.loader.parser; import gov.nih.nci.ncicb.cadsr.domain.*; import gov.nih.nci.ncicb.cadsr.loader.*; import gov.nih.nci.ncicb.cadsr.loader.util.*; import gov.nih.nci.ncicb.cadsr.loader.event.NewConceptEvent; import gov.nih.nci.ncicb.cadsr.loader.event.ProgressListener; import gov.nih.nci.ncicb.cadsr.loader.event.ProgressEvent; import java.io.*; import java.util.*; import org.apache.log4j.Logger; import gov.nih.nci.ncicb.xmiinout.handler.*; import gov.nih.nci.ncicb.xmiinout.domain.*; import gov.nih.nci.ncicb.xmiinout.util.*; /** * A writer for XMI files * * @author <a href="mailto:chris.ludet@oracle.com">Christophe Ludet</a> */ public class RoundtripWriter2 implements ElementWriter { private String output = null; private String input = null; private ElementsLists elementsList = null; private ReviewTracker ownerReviewTracker = ReviewTracker.getInstance(ReviewTrackerType.Owner), curatorReviewTracker = ReviewTracker.getInstance(ReviewTrackerType.Curator); private ChangeTracker changeTracker = ChangeTracker.getInstance(); private ProgressListener progressListener = null; private static Logger logger = Logger.getLogger(RoundtripWriter.class.getName()); private HashMap<String, UMLClass> classMap = new HashMap<String, UMLClass>(); private HashMap<String, UMLAttribute> attributeMap = new HashMap<String, UMLAttribute>(); private HashMap<String, UMLAssociation> assocMap = new HashMap<String, UMLAssociation>(); private HashMap<String, UMLPackage> packageMap = new HashMap<String, UMLPackage>(); private UMLModel model = null; public RoundtripWriter2(String inputFile) { this.input = inputFile; try { ProgressEvent pEvt = new ProgressEvent(); pEvt.setGoal(-1); pEvt.setMessage("Opening File"); if(progressListener != null) progressListener.newProgressEvent(pEvt); // SAXBuilder builder = new SAXBuilder(); // Document doc = builder.build(input); // modelElement = doc.getRootElement(); } catch (Exception ex) { throw new RuntimeException("Error initializing model", ex); } } public void write(ElementsLists elements) { try { XmiInOutHandler handler = (XmiInOutHandler)(UserSelections.getInstance().getProperty("XMI_HANDLER")); model = handler.getModel(); this.elementsList = elements; readModel(); updateElements(); handler.save(output); } catch (Exception ex) { throw new RuntimeException("Error initializing model", ex); } } public void setProgressListener(ProgressListener l) { progressListener = l; } public void setOutput(String url) { this.output = url; } public void setInput(String url) { this.input = url; } private void readModel(){ for(UMLPackage pkg : model.getPackages()) { doPackage(pkg); } int i = 0; for(UMLAssociation assoc : model.getAssociations()) { assocMap.put(String.valueOf(i), assoc); i++; } } private void updateElements() { List<DataElement> des = elementsList.getElements(DomainObjectFactory.newDataElement()); List<ObjectClass> ocs = elementsList.getElements(DomainObjectFactory.newObjectClass()); List<ObjectClassRelationship> ocrs = elementsList.getElements(DomainObjectFactory.newObjectClassRelationship()); List<ClassificationSchemeItem> csis = elementsList.getElements(DomainObjectFactory.newClassificationSchemeItem()); ProgressEvent pEvt = new ProgressEvent(); pEvt.setGoal(des.size() + ocs.size() + ocrs.size() + csis.size()); pEvt.setMessage("Injecting CaDSR Public IDs"); pEvt.setStatus(0); if(progressListener != null) progressListener.newProgressEvent(pEvt); InheritedAttributeList inheritedList = InheritedAttributeList.getInstance(); for(DataElement de : des) { pEvt.setStatus(pEvt.getStatus() + 1); if(progressListener != null) progressListener.newProgressEvent(pEvt); DataElementConcept dec = de.getDataElementConcept(); String fullPropName = null; for(AlternateName an : de.getAlternateNames()) { if(an.getType().equals(AlternateName.TYPE_FULL_NAME)) fullPropName = an.getName(); } if(!inheritedList.isInherited(de)) { UMLAttribute att = attributeMap.get(fullPropName); if(att == null) { logger.info("Parser Can't find attribute: " + fullPropName + "\n Probably inherited. That should be ok."); continue; } // remove all TVs for DE_ID and Version Collection<UMLTaggedValue> allTvs = att.getTaggedValues(); for(UMLTaggedValue tv : allTvs) { if(tv.getName().startsWith("CADSR_DE")) att.removeTaggedValue(tv.getName()); } if(!StringUtil.isEmpty(de.getPublicId())) { att.addTaggedValue(XMIParser2.TV_DE_ID, de.getPublicId()); att.addTaggedValue(XMIParser2.TV_DE_VERSION, de.getVersion().toString()); } String gmeTag = LookupUtil.lookupXMLLocRef(de); if(gmeTag != null) { UMLTaggedValue gmeTv = att.getTaggedValue(XMIParser2.TV_GME_XML_LOC_REFERENCE); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { att.addTaggedValue(XMIParser2.TV_GME_XML_LOC_REFERENCE, gmeTag); } } } else { // in case of inherited attribute ObjectClass oc = de.getDataElementConcept().getObjectClass(); String fullClassName = LookupUtil.lookupFullName(oc); UMLClass clazz = classMap.get(fullClassName); String attributeName = LookupUtil.lookupFullName(de); attributeName = attributeName.substring(attributeName.lastIndexOf(".") + 1); if(!StringUtil.isEmpty(de.getPublicId())) { clazz.removeTaggedValue(XMIParser2.TV_INHERITED_DE_ID.replace("{1}", attributeName)); clazz.removeTaggedValue(XMIParser2.TV_INHERITED_DE_VERSION.replace("{1}", attributeName)); clazz.removeTaggedValue(XMIParser2.TV_INHERITED_VD_ID.replace("{1}", attributeName)); clazz.removeTaggedValue(XMIParser2.TV_INHERITED_VD_VERSION.replace("{1}", attributeName)); clazz.addTaggedValue(XMIParser2.TV_INHERITED_DE_ID.replace("{1}", attributeName), de.getPublicId()); clazz.addTaggedValue(XMIParser2.TV_INHERITED_DE_VERSION.replace("{1}", attributeName), de.getVersion().toString()); } } } for(ObjectClass oc : ocs) { pEvt.setStatus(pEvt.getStatus() + 1); if(progressListener != null) progressListener.newProgressEvent(pEvt); String className = LookupUtil.lookupFullName(oc); UMLClass clazz = classMap.get(className); if(clazz == null) { logger.info("Parser Can't find clazz: " + className + "\n This is odd, look into it."); continue; } String gmeTag = LookupUtil.lookupXMLNamespace(oc); if(gmeTag != null) { UMLTaggedValue gmeTv = clazz.getTaggedValue(XMIParser2.TV_GME_NAMESPACE); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { clazz.addTaggedValue(XMIParser2.TV_GME_NAMESPACE, gmeTag); } } gmeTag = LookupUtil.lookupXMLElementName(oc); if(gmeTag != null) { UMLTaggedValue gmeTv = clazz.getTaggedValue(XMIParser2.TV_GME_XML_ELEMENT); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { clazz.addTaggedValue(XMIParser2.TV_GME_XML_ELEMENT, gmeTag); } } } for(int i = 0; i < ocrs.size(); i++) { pEvt.setStatus(pEvt.getStatus() + 1); if(progressListener != null) progressListener.newProgressEvent(pEvt); ObjectClassRelationship ocr = ocrs.get(i); UMLAssociation assoc = assocMap.get(String.valueOf(i)); String gmeTag = LookupUtil.lookupXMLSrcLocRef(ocr); if(gmeTag != null) { UMLTaggedValue gmeTv = assoc.getTaggedValue(XMIParser2.TV_GME_SOURCE_XML_LOC_REFERENCE); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { assoc.addTaggedValue(XMIParser2.TV_GME_SOURCE_XML_LOC_REFERENCE, gmeTag); } } gmeTag = LookupUtil.lookupXMLTargetLocRef(ocr); if(gmeTag != null) { UMLTaggedValue gmeTv = assoc.getTaggedValue(XMIParser2.TV_GME_TARGET_XML_LOC_REFERENCE); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { assoc.addTaggedValue(XMIParser2.TV_GME_TARGET_XML_LOC_REFERENCE, gmeTag); } } } for(ClassificationSchemeItem csi : csis) { pEvt.setStatus(pEvt.getStatus() + 1); if(progressListener != null) progressListener.newProgressEvent(pEvt); UMLPackage pkg = packageMap.get(csi.getLongName()); if(pkg == null) { logger.info("Parser Can't find Package: " + csi.getLongName() + "\n This shouldn't happend"); continue; } String gmeTag = LookupUtil.lookupXMLNamespace(csi); if(gmeTag != null) { UMLTaggedValue gmeTv = pkg.getTaggedValue(XMIParser2.TV_GME_NAMESPACE); // only add a tagged value if one is not already there. // in other words, don't replace if(gmeTv == null) { pkg.addTaggedValue(XMIParser2.TV_GME_NAMESPACE, gmeTag); } } } } private void doPackage(UMLPackage pkg) { packageMap.put(getPackageName(pkg), pkg); for(UMLClass clazz : pkg.getClasses()) { String className = null; String st = clazz.getStereotype(); boolean foundVd = false; if(st != null) for(int i=0; i < XMIParser2.validVdStereotypes.length; i++) { if(st.equalsIgnoreCase(XMIParser2.validVdStereotypes[i])) foundVd = true; } if(foundVd) { className = "ValueDomains." + clazz.getName(); } else { className = getPackageName(pkg) + "." + clazz.getName(); } classMap.put(className, clazz); for(UMLAttribute att : clazz.getAttributes()) { attributeMap.put(className + "." + att.getName(), att); } } for(UMLPackage subPkg : pkg.getPackages()) { doPackage(subPkg); } } private String getPackageName(UMLPackage pkg) { StringBuffer pack = new StringBuffer(); String s = null; do { s = null; if(pkg != null) { s = pkg.getName(); if(s.indexOf(" ") == -1) { if(pack.length() > 0) pack.insert(0, '.'); pack.insert(0, s); } pkg = pkg.getParent(); } } while (s != null); return pack.toString(); } }
[ "davet" ]
davet
dbb492be48a71e11e1addb4e24e10d049adf8cea
e3150b7608863962da2162b049f2ef9d82e8ce70
/homeworkLesson6Tasck5/Cat.java
6ee66f68208ee527206d05be73f52f51356baca4
[]
no_license
AndreyPinchuk/Java-OOP.-HW.-Lesson-6
990e20348457b4f896e73ba00e1b84343463ae10
faa3856386f22d4355ed9061200cf85779159fcd
refs/heads/master
2020-04-09T05:58:45.291067
2018-12-12T07:03:01
2018-12-12T07:03:01
160,089,627
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package homeworkLesson6Tasck5; public class Cat { private int year; private int higth; private String name; public Cat(int year, int higth, String name) { this.year = year; this.higth = higth; this.name = name; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getHigth() { return higth; } public void setHigth(int higth) { this.higth = higth; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Cat{" + "year=" + year + ", higth=" + higth + ", name='" + name + '\'' + '}'; } }
[ "noreply@github.com" ]
AndreyPinchuk.noreply@github.com
fb5a946e9024eb64b0c1eb2074f282ec3012e7ec
cbb8749f42238b355f998e75922dbf6220aa3977
/SNPoo/SNPoo/Coche4Driver.java
4982bc19d8818bc75896c6d18b503efe955e3e9b
[]
no_license
Ast2435/Programacion-orientada-a-objetos
cb04fb4e7b6dec473dfed93574c02b10a62df3c9
77648797a04559b16e3f8da8554decd989c2e892
refs/heads/master
2021-07-19T13:34:55.447631
2021-02-06T21:58:52
2021-02-06T21:58:52
237,365,343
0
0
null
null
null
null
UTF-8
Java
false
false
1,110
java
class Coche4 { private String hacer; // hacer coche private int anio; // anio de manufactura del coche private String color; // color primario coche public Coche4(String h, int a, String c) { hacer = h; anio = a; color = c; } // fin constructor public Coche4(int a) { anio = a; color = "Son de color amarillo"; } // fin constructor public String getHacer() { return hacer; } // fin getHacer public int getAnio() { return anio; } // fin getAnio public String getColor() { return color; } // fin getColor } // fin clase Coche4 public class Coche4Driver { public static void main(String[] args) { Coche4 allexCar = new Coche4("Porsche", 2006, "beige"); Coche4 ramirezCar = new Coche4("Saturn", 2002, "rojo"); System.out.println(allexCar.getHacer() + " " + allexCar.getAnio() + " " + allexCar.getColor()); System.out.println(ramirezCar.getHacer() + " " + ramirezCar.getAnio() + " " + ramirezCar.getColor()); Coche4 carroCar = new Coche4(2006); System.out.println(carroCar.getColor()); } // end main } // end class Car4Driver
[ "arturitodelamancha@hotmail.com" ]
arturitodelamancha@hotmail.com
30a062c01169c302f2c57565e09b59f847560593
ccc58e75fe147909ace8158acc61f06b10f80197
/database/src/main/java/com/example/database/model/Pokemon.java
85f387e23fc7029c8e6aeeace38733a36c0a8f5e
[]
no_license
lRafaelH/h2-database-ooprogl
709fa23d9dc868fc153c1401c85aca6b6dc4eb3b
3eeb321356e398df17705ff2dbdba7df73d3306e
refs/heads/master
2020-08-01T22:13:26.765273
2019-09-26T16:32:37
2019-09-26T16:32:37
211,134,717
0
0
null
null
null
null
UTF-8
Java
false
false
1,894
java
package com.example.database.model; import javax.persistence.*; import java.util.Set; @Entity public class Pokemon { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private int level; private String name; private String type; private boolean evolve; private String color; private Integer size; private String gender; private String attribute; public Trainer getTrainer() { return trainer; } public void setTrainer(Trainer trainer) { this.trainer = trainer; } @ManyToOne(fetch = FetchType.LAZY) @JoinTable(name = "Pokemons_Trainer") private Trainer trainer; public String getColor() { return color; } public void setColor(String color) { this.color = color; } public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getAttribute() { return attribute; } public void setAttribute(String attribute) { this.attribute = attribute; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public boolean isEvolve() { return evolve; } public void setEvolve(boolean evolve) { this.evolve = evolve; } }
[ "noreply@github.com" ]
lRafaelH.noreply@github.com
1870039f9a57ee87f6a8b79ab6ec7fd11ac2f53c
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE190_Integer_Overflow/s02/CWE190_Integer_Overflow__int_Environment_multiply_52c.java
67ac393d911a58b323fca8233842ab129153c01a
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
2,174
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_Environment_multiply_52c.java Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-52c.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: multiply * GoodSink: Ensure there will not be an overflow before multiplying data by 2 * BadSink : If data is positive, multiply by 2, which can cause an overflow * Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package * * */ package testcases.CWE190_Integer_Overflow.s02; import testcasesupport.*; import javax.servlet.http.*; public class CWE190_Integer_Overflow__int_Environment_multiply_52c { public void badSink(int data ) throws Throwable { if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(int data ) throws Throwable { if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(int data ) throws Throwable { if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Integer.MAX_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } } }
[ "you@example.com" ]
you@example.com
7772f27fcd6f3173b286ac9705c000856152e12c
54b8d7a73007e7b39d86f6962f094dc4a678cf82
/goods_consumer/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/list_jsp.java
b498100d1b8c0fbe2e33478977793ea1e29ec319
[]
no_license
niuxiaofei961012/dubbo_goods
3a8d01d91cdfabbc440a458392db5380c851385a
8e341b69bf4acfd59d87f85faf24cbf83c103220
refs/heads/master
2022-11-20T08:11:43.791373
2019-09-06T05:52:41
2019-09-06T05:52:41
206,705,199
0
0
null
2022-11-16T06:29:47
2019-09-06T03:28:08
JavaScript
UTF-8
Java
false
false
9,268
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2019-09-06 03:26:39 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.WEB_002dINF.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class list_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1); _jspx_dependants.put("/WEB-INF/tld/c.tld", Long.valueOf(1567733823719L)); } private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("<!DOCTYPE html>\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta charset=\"utf-8\">\r\n"); out.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n"); out.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n"); out.write("<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->\r\n"); out.write("<title></title>\r\n"); out.write("<link rel=\"stylesheet\" href=\"/resource/css/bootstrap.min.css\">\r\n"); out.write("<link rel=\"stylesheet\" type=\"text/css\"\r\n"); out.write("\thref=\"/resource/css/cms.css?v=1.1\" />\r\n"); out.write("<style type=\"text/css\">\r\n"); out.write("</style>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\t<table class=\"table table-hover table-dark\">\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t\t<td>编号</td>\r\n"); out.write("\t\t\t<td>名称</td>\r\n"); out.write("\t\t\t<td>类型</td>\r\n"); out.write("\t\t\t<td>地址</td>\r\n"); out.write("\t\t\t<td>日期</td>\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t\t"); if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context)) return; out.write("\r\n"); out.write("\t</table>\r\n"); out.write("</body>\r\n"); out.write("<script type=\"text/javascript\" src=\"/resource/js/jquery-3.2.1.js\"></script>\r\n"); out.write("<script type=\"text/javascript\" src=\"/resource/js/bootstrap.min.js\"></script>\r\n"); out.write("<script type=\"text/javascript\">\r\n"); out.write("\t\r\n"); out.write("</script>\r\n"); out.write("</html>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:forEach org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class); _jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005fforEach_005f0.setParent(null); // /WEB-INF/jsp/list.jsp(27,2) name = items type = java.lang.Object reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fforEach_005f0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageInfo.list}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); // /WEB-INF/jsp/list.jsp(27,2) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fforEach_005f0.setVar("l"); int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 }; try { int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag(); if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n"); out.write("\t\t\t<tr>\r\n"); out.write("\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${l.id}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</td>\r\n"); out.write("\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${l.name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</td>\r\n"); out.write("\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${l.category}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</td>\r\n"); out.write("\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${l.address}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</td>\r\n"); out.write("\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${l.createDate}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</td>\r\n"); out.write("\t\t\t</tr>\r\n"); out.write("\t\t"); int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception); } finally { _jspx_th_c_005fforEach_005f0.doFinally(); _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0); } return false; } }
[ "1017346477@qq.com" ]
1017346477@qq.com
67084321be8334a1fc4f271bdac14d169d90a733
ea68dffaf01651b81e440e4c0a04254a6235f454
/app/src/main/java/com/laioffer/eventreporter/CommentAdapter.java
fa0e45021739b1bd6e343393a5d83ad76dc137fd
[]
no_license
niklaus0105/EventReporter
ab9c2351bf3ff4e0f8ee05994a3bbe72bbe5fa69
3f8cdee9d5f6bcf8ae172c8c9c81eb0d5bf18708
refs/heads/master
2020-03-22T22:09:51.493909
2018-07-12T16:10:52
2018-07-12T16:10:52
140,736,870
0
0
null
null
null
null
UTF-8
Java
false
false
8,221
java
package com.laioffer.eventreporter; import android.content.Context; import android.graphics.Bitmap; import android.os.AsyncTask; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; // Recycler view can support multiple view holders, supports vertical/horizontal/and more list views public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private Context context; // flag, differentiate event or comment private final static int TYPE_EVENT = 0; private final static int TYPE_COMMENT = 1; private List<Comment> commentList; private Event event; private DatabaseReference databaseReference; private LayoutInflater inflater; public CommentAdapter(Context context) { this.context = context; commentList = new ArrayList<>(); databaseReference = FirebaseDatabase.getInstance().getReference(); inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); } public void setEvent(final Event event) { this.event = event; } public void setComments(final List<Comment> comments) { this.commentList = comments; } // position == 0 means event // position after 0 means comment @Override public int getItemViewType(int position) { return position == 0 ? TYPE_EVENT : TYPE_COMMENT; } // has to override, let render know how many comments will be fetched @Override public int getItemCount() { return commentList.size() + 1; } public class CommentViewHolder extends RecyclerView.ViewHolder { public TextView commentUser; public TextView commentDescription; public TextView commentTime; public View layout; public CommentViewHolder(View v) { super(v); layout = v; commentUser = (TextView) v.findViewById(R.id.comment_item_user); commentDescription = (TextView)v.findViewById(R.id.comment_item_description); commentTime = (TextView)v.findViewById(R.id.comment_item_time); } } public class EventViewHolder extends RecyclerView.ViewHolder { public TextView eventUser; public TextView eventTitle; public TextView eventLocation; public TextView eventDescription; public TextView eventTime; public ImageView eventImgView; public ImageView eventImgViewGood; public ImageView eventImgViewComment; public TextView eventLikeNumber; public TextView eventCommentNumber; public View layout; public EventViewHolder(View v) { super(v); layout = v; eventUser = (TextView) v.findViewById(R.id.comment_main_user); eventTitle = (TextView) v.findViewById(R.id.comment_main_title); eventLocation = (TextView) v.findViewById(R.id.comment_main_location); eventDescription = (TextView) v.findViewById(R.id.comment_main_description); eventTime = (TextView) v.findViewById(R.id.comment_main_time); eventImgView = (ImageView) v.findViewById(R.id.comment_main_image); eventImgViewGood = (ImageView) v.findViewById(R.id.comment_main_like_img); eventImgViewComment = (ImageView) v.findViewById(R.id.comment_main_comment_img); eventLikeNumber = (TextView) v.findViewById(R.id.comment_main_like_number); eventCommentNumber = (TextView) v.findViewById(R.id.comment_main_comment_number); } } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder viewHolder = null; LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View v; switch (viewType) { case TYPE_EVENT: v = inflater.inflate(R.layout.comment_main, parent, false); viewHolder = new EventViewHolder(v); break; case TYPE_COMMENT: v = inflater.inflate(R.layout.comment_item, parent, false); viewHolder = new CommentViewHolder(v); break; } return viewHolder; } // Replace the contents of a view (invoked by the layout manager) @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { switch (holder.getItemViewType()) { case TYPE_EVENT: EventViewHolder viewHolderEvent = (EventViewHolder) holder; configureEventView(viewHolderEvent); break; case TYPE_COMMENT: CommentViewHolder viewHolderAds = (CommentViewHolder) holder; configureCommentView(viewHolderAds, position); break; } } private void configureCommentView(final CommentViewHolder commentHolder, final int position) { //Why is position - 1? final Comment comment = commentList.get(position - 1); commentHolder.commentUser.setText(comment.getCommenter()); commentHolder.commentDescription.setText(comment.getDescription()); commentHolder.commentTime.setText(Utils.timeTransformer(comment.getTime())); } private void configureEventView(final EventViewHolder holder) { holder.eventUser.setText(event.getUsername()); holder.eventTitle.setText(event.getTitle()); String[] locations = event.getAddress().split(","); holder.eventLocation.setText(locations[1] + "," + locations[2]); holder.eventDescription.setText(event.getDescription()); holder.eventTime.setText(Utils.timeTransformer(event.getTime())); holder.eventCommentNumber.setText(String.valueOf(event.getCommentNumber())); holder.eventLikeNumber.setText(String.valueOf(event.getLike())); if (event.getImgUri() != null) { final String url = event.getImgUri(); holder.eventImgView.setVisibility(View.VISIBLE); new AsyncTask<Void, Void, Bitmap>(){ @Override protected Bitmap doInBackground(Void... params) { return Utils.getBitmapFromURL(url); } @Override protected void onPostExecute(Bitmap bitmap) { holder.eventImgView.setImageBitmap(bitmap); } }.execute(); } else { holder.eventImgView.setVisibility(View.GONE); } holder.eventImgViewGood.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { databaseReference.child("events").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot snapshot : dataSnapshot.getChildren()) { Event recordedevent = snapshot.getValue(Event.class); if (recordedevent.getId().equals(event.getId())) { int number = recordedevent.getLike(); holder.eventLikeNumber.setText(String.valueOf(number + 1)); snapshot.getRef().child("like").setValue(number + 1); break; } } } @Override public void onCancelled(DatabaseError databaseError) { } }); } }); } }
[ "niklaus0105@gmail.com" ]
niklaus0105@gmail.com
fb1d6c0ab82c3cc761833bcac82d58d51e369af6
ecb5229ddf69556f14d0b7b4fa98853a02bd0339
/src/TestPane.java
6a1b8c0808f6b01529e8d7312ca61ad9c8714598
[]
no_license
CodeCody/Java-TilesBouncingBalls
5523569a3d3d86b1d1762bfa9efb982ca8ada35e
b9fb84dceb4f947b781567a23b57f168fbee084d
refs/heads/master
2021-01-09T20:43:10.628299
2016-08-11T21:55:17
2016-08-11T21:55:17
65,504,069
0
0
null
null
null
null
UTF-8
Java
false
false
6,445
java
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Arrays; /** * Created by codyhammond on 8/11/16. */ public class TestPane extends JPanel { //two dimensional array to represent grid private final int row=8,col=8; private int[][] virtualTiles=new int [row][col]; //variables to keep track of the grid dimensions private int startX,startY,endX,endY; //final variable to hold length and height of square private final int squareside=25; //reset button private JButton reset; //Pane contructor public TestPane() { //set layout setLayout(new BorderLayout()); //initialize button reset=new JButton(); //set text reset.setText("Reset"); //add action listener reset.addActionListener(new ActionListener() { //Function sets all elements in 2D array to zero @Override public void actionPerformed(ActionEvent e) { for(int i=0;i<row;i++) Arrays.fill(virtualTiles[i],0); repaint(); } }); //add button to pane JPanel panel= new JPanel(); add(panel,BorderLayout.SOUTH); panel.add(reset); //mouse Handler interface MouseAdapter mouseHandler; mouseHandler = new MouseAdapter() { //Function determining which cell to draw image in. @Override public void mouseClicked(MouseEvent e) { Point point = e.getPoint(); //get x and y coordinates of mouse click int areaX=e.getX(); int areaY=e.getY(); //if the mouse click lies somewhere on the grid if((areaX>=startX && areaX <= endX) && (areaY >= startY && areaY <= endY)) { //search through columns for(int i=0;i<col;i++) { //find where x coordinate lies on grid if((startX+(i*squareside)) <= areaX && (startX+((i+1)*squareside)) >= areaX) { areaX=i;//assign areaX the value of i break; } } //search through rows for(int j=0;j<row; j++) { //find where y coordinate lies on grid if((startY+(j*squareside)) <= areaY && (startY+((j+1)*squareside)) >= areaY) { areaY=j;//assign areaY the value of i break; } } //set 2D array with the value of the selected button virtualTiles[areaY][areaX]=TileDesigner.selected; } //call repaint to update grid repaint(); } }; addMouseListener(mouseHandler);//add mouse handler } //Overrided function to customize size @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } //Paint component functino is called every time panel is repainted @Override protected void paintComponent(Graphics g) { super.paintComponent(g); //get grid width and grid height int gridWidth=row*squareside; int gridHeight=col*squareside; //get starting point of grid startX=(getWidth()-gridWidth)/2; startY=(getHeight()-gridHeight)/2; //get ending point of grid endX=startX+(row*squareside); endY=startY+(col*squareside); //nested loop for drawing grid for(int i=0; i < row;i++) { for(int j=0; j< col;j++) { int image=virtualTiles[i][j];//get value from 2D array //switch statement for value of image switch(image) { //paint empty tile case -1: g.drawRect(startX+(squareside*j),startY+(squareside*i),squareside,squareside); break; //paint empty tile case 0: g.drawRect(startX+(squareside*j),startY+(squareside*i),squareside,squareside); break; //paint image 1 case 1: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; //paint image 2 case 2: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; //paint image 3 case 3: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; //paint image 4 case 4: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside, squareside, this); break; //paint image 5 case 5: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; case 6: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; case 7: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside,squareside, this); break; case 8: g.drawImage(TileDesigner.images[image-1],startX+(squareside*j),startY+(squareside*i), squareside, squareside, this); break; } } } } }
[ "chammond23@rocketmail.com" ]
chammond23@rocketmail.com
70d4f634f7f7cad6a080418da0a450efdaf655e0
379bd0f468fe2dd5fc2cd8ecfadee082252a9acb
/FlazrAndroid/flazrandroidlib/src/main/java/com/aravind/flazr/android/rtmp/client/ClientPipelineFactory.java
ee43fbb52cf20afd21e58678017a70a087de71cc
[]
no_license
aravindsg/Flazr-Android
47cff9e5ec4f21bf93e607df009c318aae81748f
3150d4ff115d8717597caf92f904f5c53b631307
refs/heads/master
2021-01-20T19:57:35.711449
2016-10-26T03:25:53
2016-10-26T03:25:53
62,311,152
2
1
null
null
null
null
UTF-8
Java
false
false
1,877
java
/* * Flazr <http://flazr.com> Copyright (C) 2009 Peter Thomas. * * This file is part of Flazr. * * Flazr is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Flazr is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Flazr. If not, see <http://www.gnu.org/licenses/>. */ package com.aravind.flazr.android.rtmp.client; import com.aravind.flazr.android.rtmp.RtmpDecoder; import com.aravind.flazr.android.rtmp.RtmpEncoder; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; import org.jboss.netty.channel.Channels; public class ClientPipelineFactory implements ChannelPipelineFactory { private final ClientOptions options; public ClientPipelineFactory(final ClientOptions options) { this.options = options; } @Override public ChannelPipeline getPipeline() { final ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("handshaker", new ClientHandshakeHandler(options)); pipeline.addLast("decoder", new RtmpDecoder()); pipeline.addLast("encoder", new RtmpEncoder()); // if(options.getLoad() == 1) { // pipeline.addLast("executor", new ExecutionHandler( // new OrderedMemoryAwareThreadPoolExecutor(16, 1048576, 1048576))); // } pipeline.addLast("handler", new ClientHandler(options)); return pipeline; } }
[ "aravind.sundar@razerzone.com" ]
aravind.sundar@razerzone.com
82cb191d9dcc837c4001617476752758ebb8e487
d66f883940ea01d519d8165043f81ffec45d4dcc
/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebPropertiesResourcesBindingTests.java
ce8d79428537ab2a7fd4f8a74ec658f0e76fe04c
[ "Apache-2.0" ]
permissive
wilkinsona/spring-boot
489f6bcf09dc935bcd5adca6773034a719b50200
0510ad88eaff7f72d86e75277917155baa830936
refs/heads/main
2023-08-03T21:23:21.515098
2022-11-10T14:20:25
2022-11-10T14:20:25
13,243,425
16
16
Apache-2.0
2023-07-10T17:14:32
2013-10-01T12:42:28
Java
UTF-8
Java
false
false
2,667
java
/* * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.autoconfigure.web; import java.util.function.Consumer; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.web.WebProperties.Resources; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; /** * Binding tests for {@link WebProperties.Resources}. * * @author Stephane Nicoll */ class WebPropertiesResourcesBindingTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(TestConfiguration.class); @Test void staticLocationsExpandArray() { this.contextRunner .withPropertyValues("spring.web.resources.static-locations[0]=classpath:/one/", "spring.web.resources.static-locations[1]=classpath:/two", "spring.web.resources.static-locations[2]=classpath:/three/", "spring.web.resources.static-locations[3]=classpath:/four", "spring.web.resources.static-locations[4]=classpath:/five/", "spring.web.resources.static-locations[5]=classpath:/six") .run(assertResourceProperties((properties) -> assertThat(properties.getStaticLocations()).contains( "classpath:/one/", "classpath:/two/", "classpath:/three/", "classpath:/four/", "classpath:/five/", "classpath:/six/"))); } private ContextConsumer<AssertableApplicationContext> assertResourceProperties(Consumer<Resources> consumer) { return (context) -> { assertThat(context).hasSingleBean(WebProperties.class); consumer.accept(context.getBean(WebProperties.class).getResources()); }; } @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(WebProperties.class) static class TestConfiguration { } }
[ "wilkinsona@vmware.com" ]
wilkinsona@vmware.com
8bb710c2782478ba9d6fd390edab539075e5faaa
6bb3adc83e26f907636bd535f70e376b2e810ee9
/src/main/java/com/business/kalande/entity/Users.java
5cfd20f60938ddacb24937887b27885b8fa28137
[]
no_license
htykbz/kalande
a33b922371747f0abb95b452585405afd0a01fe0
6eaa4f3a96b43e6c00ac08034b62eb548beb5128
refs/heads/master
2021-08-22T13:29:12.172174
2017-11-30T09:12:45
2017-11-30T09:12:45
112,587,655
0
0
null
null
null
null
UTF-8
Java
false
false
1,539
java
package com.business.kalande.entity; import java.util.Date; public class Users { private Integer userId; private String userName; private String nickName; private String password; private boolean isDeleted; private Date createTime; public Users() { } public Users(Integer userId, String userName, String nickName, String password, boolean isDeleted, Date createTime) { this.userId = userId; this.userName = userName; this.nickName = nickName; this.password = password; this.isDeleted = isDeleted; this.createTime = createTime; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isDeleted() { return isDeleted; } public void setDeleted(boolean deleted) { isDeleted = deleted; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } }
[ "htykbz@163.com" ]
htykbz@163.com
6ea95d6b13af9be77d2939990e90e1c3c7e1f80f
947edc58e161933b70d595242d4663a6d0e68623
/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/CtcdDecsumperiodsController.java
2c7214d43d6bd7c6731100776ac12a52af03475f
[]
no_license
jieke360/pig6
5a5de28b0e4785ff8872e7259fc46d1f5286d4d9
8413feed8339fab804b11af8d3fbab406eb80b68
refs/heads/master
2023-02-04T12:39:34.279157
2020-12-31T03:57:43
2020-12-31T03:57:43
325,705,631
0
0
null
null
null
null
UTF-8
Java
false
false
5,502
java
/* * Copyright (c) 2018-2025, lengleng All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the pig4cloud.com developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pigx.admin.controller; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pigx.admin.entity.CtcdCostcenter; import com.pig4cloud.pigx.common.core.util.R; import com.pig4cloud.pigx.common.log.annotation.SysLog; import com.pig4cloud.pigx.admin.entity.CtcdDecsumperiods; import com.pig4cloud.pigx.admin.service.CtcdDecsumperiodsService; import com.pig4cloud.pigx.common.security.service.PigxUser; import com.pig4cloud.pigx.common.security.util.SecurityUtils; import org.springframework.security.access.prepost.PreAuthorize; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; /** * 累计扣税期间 * * @author gaoxiao * @date 2020-06-10 18:22:31 */ @RestController @AllArgsConstructor @RequestMapping("/ctcddecsumperiods" ) @Api(value = "ctcddecsumperiods", tags = "累计扣税期间管理") public class CtcdDecsumperiodsController { private final CtcdDecsumperiodsService ctcdDecsumperiodsService; /** * 分页查询 * @param page 分页对象 * @param ctcdDecsumperiods 累计扣税期间 * @return */ @ApiOperation(value = "分页查询", notes = "分页查询") @GetMapping("/page" ) public R getCtcdDecsumperiodsPage(Page page, CtcdDecsumperiods ctcdDecsumperiods) { return R.ok(ctcdDecsumperiodsService.page(page, Wrappers.query(ctcdDecsumperiods))); } /** * 累计扣税期间查询所有 * @param ctcdDecsumperiods 累计扣税期间 * @return */ @ApiOperation(value = "累计扣税区间", notes = "成本中心查询所有") @PostMapping("/getAllCtcdDecsumperiods" ) public R getAllCtcdDecsumperiods(@RequestBody(required = false) CtcdDecsumperiods ctcdDecsumperiods) { PigxUser pigxUser = SecurityUtils.getUser(); String corpcode = pigxUser.getCorpcode(); ctcdDecsumperiods.setCorpcode(corpcode); if(StringUtils.isEmpty(ctcdDecsumperiods)){ ctcdDecsumperiods = new CtcdDecsumperiods(); } return R.ok(ctcdDecsumperiodsService.list(Wrappers.query(ctcdDecsumperiods))); } /** * 通过id查询累计扣税期间 * @param id id * @return R */ @ApiOperation(value = "通过id查询", notes = "通过id查询") @GetMapping("/{id}" ) public R getById(@PathVariable("id" ) Integer id) { return R.ok(ctcdDecsumperiodsService.getById(id)); } /** * 新增累计扣税期间 @PreAuthorize("@pms.hasPermission('admin_ctcddecsumperiods_add')" ) * @param ctcdDecsumperiods 累计扣税期间 * @return R */ @ApiOperation(value = "新增累计扣税期间", notes = "新增累计扣税期间") @SysLog("新增累计扣税期间" ) @PostMapping("/save") public R save(@RequestBody CtcdDecsumperiods ctcdDecsumperiods) { PigxUser pigxUser = SecurityUtils.getUser(); Integer corpid = pigxUser.getCorpid(); String corpcode = pigxUser.getCorpcode(); ctcdDecsumperiods.setCorpcode(corpcode); ctcdDecsumperiods.setCorpid(corpid); return R.ok(ctcdDecsumperiodsService.save(ctcdDecsumperiods)); } /** @PreAuthorize("@pms.hasPermission('admin_ctcddecsumperiods_edit')" ) * 修改累计扣税期间 * @param ctcdDecsumperiods 累计扣税期间 * @return R */ @ApiOperation(value = "修改累计扣税期间", notes = "修改累计扣税期间") @SysLog("修改累计扣税期间" ) @PostMapping("/updateById") public R updateById(@RequestBody CtcdDecsumperiods ctcdDecsumperiods) { PigxUser pigxUser = SecurityUtils.getUser(); Integer corpid = pigxUser.getCorpid(); String corpcode = pigxUser.getCorpcode(); UpdateWrapper<CtcdDecsumperiods> updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("corpcode",corpcode); updateWrapper.eq("gid",ctcdDecsumperiods.getGid()); updateWrapper.eq("term",ctcdDecsumperiods.getTerm()); return R.ok(ctcdDecsumperiodsService.update(ctcdDecsumperiods,updateWrapper)); } /** * 通过id删除累计扣税期间 * @param id id * @return R */ @ApiOperation(value = "通过id删除累计扣税期间", notes = "通过id删除累计扣税期间") @SysLog("通过id删除累计扣税期间" ) @DeleteMapping("/{id}" ) @PreAuthorize("@pms.hasPermission('admin_ctcddecsumperiods_del')" ) public R removeById(@PathVariable Integer id) { return R.ok(ctcdDecsumperiodsService.removeById(id)); } }
[ "qdgaoxiao@163.com" ]
qdgaoxiao@163.com
9eed11a13e124f1c3ea26a78b26e0926e7221831
8d80e860bcf6b1c02c62104f22a79729c864e5ec
/src/twentyseventeen/Day5Part1.java
da3552168742d9d146c67a2f09f2641542879608
[]
no_license
mwharris/AdventOfCode
300d10957c9c3af306bfc36ce46fa8cd891a8fe8
a47af23c443d427730e467acb68c90026b5bde85
refs/heads/master
2021-09-07T19:42:14.525032
2018-02-28T02:29:05
2018-02-28T02:29:05
112,783,685
1
0
null
null
null
null
UTF-8
Java
false
false
1,231
java
package twentyseventeen; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Day5Part1 { public static void main(String[] args) { //Find our maze to process List<Integer> maze = readInput(); //Process the maze until we escape int steps = 0; int i = 0; while (i < maze.size()) { //Get the current instruction Integer currInstruct = maze.get(i); //Apply any offsets needed i += currInstruct.intValue(); //Update the index of the current instruction int newVal = currInstruct.intValue(); if (newVal >= 3) { newVal -= 1; } else { newVal += 1; } maze.set(i - currInstruct.intValue(), newVal); //Keep a running count of all steps steps++; } System.out.println(steps); } private static List<Integer> readInput() { String filename = "resources/day5input.txt"; List<Integer> inputs = new ArrayList<Integer>(); try { Scanner scanner = new Scanner(new File(filename)); while(scanner.hasNextInt()) { inputs.add(scanner.nextInt()); } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } return inputs; } }
[ "mharris@lbisoftware.com" ]
mharris@lbisoftware.com
67b32c17765f766757fd61f19127e51b156b059f
57f61370e70058f201457a935fdee34f6f9f7339
/app/src/main/java/com/example/gchtestproject/activity/selectphoto/DaTuActivity.java
d5a86eddde149fa352a25f73459329602dfb8268
[]
no_license
FLY-U/GchTestProject
f75f8ab8d0c3e8c050872b62eb533ace568d11a4
32f49531cbd1aa50137288f08f200d6738a3fe5b
refs/heads/master
2020-03-17T16:08:38.431925
2018-05-18T13:24:04
2018-05-18T13:24:04
133,737,844
0
0
null
null
null
null
UTF-8
Java
false
false
7,018
java
package com.example.gchtestproject.activity.selectphoto; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.text.TextUtils; import android.view.View; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.blankj.utilcode.util.LogUtils; import com.example.gchtestproject.R; import com.example.gchtestproject.base.BaseActivity; import com.example.gchtestproject.common.Word; import org.xutils.common.util.LogUtil; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; public class DaTuActivity extends BaseActivity implements View.OnClickListener/*实现View 的OnClickListener方法,方便实现按钮点击事件*/ { @BindView(R.id.head_title)//@BindView() TextView headTitle; @BindView(R.id.fanhui) LinearLayout fanhui; @BindView(R.id.tuikuan) LinearLayout tuikuan; @BindView(R.id.tv_login) TextView tvLogin; @BindView(R.id.ib_more) ImageButton ibMore; @BindView(R.id.title) RelativeLayout title; @BindView(R.id.v_pic) ViewPager vPic; private ArrayList<String> JieGuoUrlsss = new ArrayList<>(); private ArrayList<String> JieGuoUrlsss2 = new ArrayList<>(); public MyFragmentPagerAdapter pagerAdapter; private int position; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_da_tu); ButterKnife.bind(this); initView(); } private void initView() { ibMore.setOnClickListener(this); fanhui.setOnClickListener(this); Intent intent = getIntent(); //传过来的图片地址的集合 JieGuoUrlsss = intent.getStringArrayListExtra("JieGuoUrlsss"); position = intent.getIntExtra("position", 0); LogUtils.i("传递过来的:"+JieGuoUrlsss.size()); String fromWhere = intent.getStringExtra("fromWhere"); //判断是否显示删除按钮 if (!TextUtils.isEmpty(fromWhere) && fromWhere.equals("datu")) { ibMore.setVisibility(View.VISIBLE); } if (JieGuoUrlsss != null && JieGuoUrlsss.size() > 0) { // headTitle.setText(1 + "/" + JieGuoUrlsss.size()); for (int i = 0; i < JieGuoUrlsss.size(); i++) { String s = JieGuoUrlsss.get(i); String a = s.replace("_mid", ""); JieGuoUrlsss2.add(a); } } JieGuoUrlsss.clear(); JieGuoUrlsss.addAll(JieGuoUrlsss2); LogUtils.i("换成大图后的:"+JieGuoUrlsss.size()); // Log.i("test111", "JieGuoUrlsss:" + JieGuoUrlsss.toString()); String flag = intent.getStringExtra("flag"); if (flag != null && flag.equals("jieguo")) { ibMore.setVisibility(View.GONE); } pagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager()); vPic.setAdapter(pagerAdapter); //给ViewPager设置Adapter vPic.setCurrentItem(position); //设置显示点击进来的那个图片 headTitle.setText((position + 1) + "/" + JieGuoUrlsss.size()); //设置标题 vPic.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { headTitle.setText((position + 1) + "/" + JieGuoUrlsss.size()); } @Override public void onPageScrollStateChanged(int state) { } }); } public class MyFragmentPagerAdapter extends FragmentStatePagerAdapter { public MyFragmentPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { PicFragment picFragment = new PicFragment(); Bundle bundle = new Bundle(); bundle.putString("pisUrl", JieGuoUrlsss.get(position).trim()); //注意:集合的每个条目之间的逗号后面会有一个空格 picFragment.setArguments(bundle); return picFragment; } @Override public int getCount() { if (JieGuoUrlsss == null || JieGuoUrlsss.size() == 0) { return 0; } else { return JieGuoUrlsss.size(); } } @Override public int getItemPosition(Object object) { return PagerAdapter.POSITION_NONE; } } @Override public void onClick(final View view) { switch (view.getId()) { case R.id.fanhui: Intent mIntent = new Intent(); LogUtils.i("点击返回按钮时的集合:"+JieGuoUrlsss.size()); mIntent.putStringArrayListExtra("jieGuoUrl", JieGuoUrlsss); // 设置结果,并进行传送 this.setResult(Word.REQUEST_CODE2, mIntent); finish(); break; case R.id.ib_more: final DeleteDialog dialog = new DeleteDialog(DaTuActivity.this,"确定要删除这张照片吗?"); dialog.show(); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { if (dialog.hasDelete == true) { int aItem = vPic.getCurrentItem(); JieGuoUrlsss.remove(vPic.getCurrentItem()); if (JieGuoUrlsss.size() == 0) { Intent mIntent = new Intent(); mIntent.putStringArrayListExtra("jieGuoUrl", JieGuoUrlsss); // 设置结果,并进行传送 DaTuActivity.this.setResult(Word.REQUEST_CODE2, mIntent); finish(); } if (aItem == 0 && JieGuoUrlsss.size() > 0) //如果删除的是第一张 { headTitle.setText(1 + "/" + JieGuoUrlsss.size()); } else { headTitle.setText((vPic.getCurrentItem() + 1) + "/" + JieGuoUrlsss.size()); } pagerAdapter.notifyDataSetChanged(); } } }); break; } } }
[ "zhanghao97hao@163.com" ]
zhanghao97hao@163.com
9a63d4037595a2b1efe010ed26a3b908c466725b
dcde5eb91e98bec37dab440bd8d8d5135054f592
/library-manage-system/src/test/java/org/zerock/service/MemberServiceTests.java
7135131c89ccecfef93cfb58b0943f9edf00488b
[]
no_license
BRG-code/spring-project-archive
a56d7fa2b8e829f7268845f62da35f00a9abade3
19ef5f8546291152389ea0be06cb805094db256d
refs/heads/master
2023-07-16T16:17:32.569428
2021-08-31T13:11:45
2021-08-31T13:11:45
401,683,838
0
0
null
null
null
null
UTF-8
Java
false
false
2,210
java
package org.zerock.service; import lombok.extern.log4j.Log4j; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import org.zerock.domain.Member; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("file:src/main/webapp/WEB-INF/spring/*-context.xml") @Log4j public class MemberServiceTests { @Autowired private MemberService memberService; @Autowired private PasswordEncoder passwordEncoder; @Test public void checkNotValidEmailTest() { /* DB에 이미 존재하는 이메일을 요청하여, 중복여부가 제대로 나오는지 확인 */ assertFalse(memberService.checkEmail("asdf1234@test.com")); } @Test public void checkValidEmailTest() { /* DB에 존재하지 않는 이메일을 요청하여, 중복여부가 제대로 나오는지 확인 */ assertTrue(memberService.checkEmail(generateNotRegisteredId())); } @Test @Transactional public void addValidMemberTest() { Member member = new Member(); member.setEmail(generateNotRegisteredId()); member.setName("테스트"); member.setPassword("test1234"); member.setPassword(passwordEncoder.encode(member.getPassword())); assertTrue(memberService.addMember(member, false)); } // 없는 아이디를 생성하여, 테스트가 예외 없이 성공적으로 될 수 있도록 함. private String generateNotRegisteredId() { String generatedString = RandomStringUtils.randomAlphanumeric(10) + "@test.com"; if(!memberService.checkEmail(generatedString)) { generatedString = generateNotRegisteredId(); } return generatedString; } }
[ "cocoblue@kakao.com" ]
cocoblue@kakao.com
1e776e5f2bc64f08fcf3998aee2a49cbb8d38627
59203853755d33c6862159a22c7bc6781b22b151
/spring-integration-azure/spring-integration-eventhub/src/main/java/com/microsoft/azure/spring/integration/eventhub/factory/EventHubConnectionStringProvider.java
bfc62745d89b4186dccf61c3fd0e488101c1d7e6
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
lekkalraja/spring-cloud-azure
2095a061aa3b7814c51f9edfe15dd10e5b3a7e46
e95f5d090d51599b2f352906f0529890f6c7ba22
refs/heads/master
2020-04-09T16:23:05.456394
2018-12-04T05:51:21
2018-12-04T05:51:21
160,452,062
1
0
NOASSERTION
2018-12-05T03:00:45
2018-12-05T03:00:45
null
UTF-8
Java
false
false
1,794
java
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for * license information. */ package com.microsoft.azure.spring.integration.eventhub.factory; import com.microsoft.azure.eventhubs.ConnectionStringBuilder; import com.microsoft.azure.management.eventhub.AuthorizationRule; import com.microsoft.azure.management.eventhub.EventHubAuthorizationKey; import com.microsoft.azure.management.eventhub.EventHubNamespace; import com.microsoft.azure.spring.cloud.context.core.util.Memoizer; import com.microsoft.azure.spring.integration.eventhub.impl.EventHubRuntimeException; import org.springframework.lang.NonNull; import java.util.function.Function; public class EventHubConnectionStringProvider { private EventHubNamespace eventHubNamespace; private final Function<String, String> connectionStringProvider = Memoizer.memoize(this::buildConnectionString); public EventHubConnectionStringProvider(@NonNull EventHubNamespace eventHubNamespace) { this.eventHubNamespace = eventHubNamespace; } private String buildConnectionString(String eventHub) { return eventHubNamespace.listAuthorizationRules().stream().findFirst().map(AuthorizationRule::getKeys) .map(EventHubAuthorizationKey::primaryConnectionString) .map(s -> new ConnectionStringBuilder(s).setEventHubName(eventHub).toString()) .orElseThrow(() -> new EventHubRuntimeException( String.format("Failed to fetch connection string of '%s'", eventHub), null)); } public String getConnectionString(String eventHub) { return connectionStringProvider.apply(eventHub); } }
[ "zhonzh@microsoft.com" ]
zhonzh@microsoft.com
54365cab53114ec6f2d2e09f9a8287501f46aa8a
78991fbbe463c1601a5d91fcd7ea05a5e493d2c9
/panasonic-image-app_1.10.14/source/com/panasonic/avc/cng/core/p040a/p041a/C1420d.java
f399cc2919916675d544475a079416daf3d658ad
[]
no_license
maiermic/panasonic-image-app
480dc4f0500a2e14bd7d4138f6fb9c7dc7871b61
ef9bd7c2a8390204894c53b49d1e01a230141e2d
refs/heads/master
2020-07-10T06:02:42.687761
2019-08-22T12:07:42
2019-08-22T12:07:42
204,177,648
0
0
null
null
null
null
UTF-8
Java
false
false
9,031
java
package com.panasonic.avc.cng.core.p040a.p041a; import com.panasonic.avc.cng.core.p040a.C1528l; import com.panasonic.avc.cng.core.p040a.p041a.C1413a.C1414a; import com.panasonic.avc.cng.core.p040a.p041a.C1415b.C1416a; import com.panasonic.avc.cng.model.service.p055b.C2003c; import com.panasonic.avc.cng.util.C2264j; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; /* renamed from: com.panasonic.avc.cng.core.a.a.d */ public class C1420d extends C1423e<Void> { /* renamed from: a */ private C1528l f3875a; /* renamed from: b */ private C2003c f3876b; /* renamed from: c */ private File f3877c; /* renamed from: d */ private long f3878d; /* renamed from: e */ private int f3879e; public C1420d(C2003c cVar, long j, C1528l lVar) { this(cVar, j, 0, lVar); } public C1420d(C2003c cVar, long j, int i, C1528l lVar) { super(cVar.f6189a, C1414a.Get); this.f3876b = cVar; this.f3878d = j; this.f3877c = new File(cVar.f6191c); this.f3875a = lVar; this.f3879e = i; } /* renamed from: e */ public boolean mo3426e() { if (this.f3876b == null || this.f3877c.exists()) { m5569a("error", (C2003c) null); return false; } new Thread() { public void run() { C1420d.super.mo3426e(); } }.start(); return true; } /* access modifiers changed from: protected */ /* renamed from: f */ public HttpURLConnection mo3427f() { HttpURLConnection f = super.mo3427f(); switch (this.f3879e) { case 1: f.setRequestProperty("X-CONVERT", "MediumSize"); break; case 2: f.setRequestProperty("X-CONVERT", "SmallSize"); break; } return f; } /* access modifiers changed from: protected */ /* renamed from: b */ public void mo3422b(HttpURLConnection httpURLConnection) { super.mo3422b(httpURLConnection); String headerField = httpURLConnection.getHeaderField("X-FILE_SIZE"); if (headerField != null) { this.f3878d = (headerField.equalsIgnoreCase("18446744073709551615") || headerField.equalsIgnoreCase("4294967295")) ? 4294967295L : Long.parseLong(headerField); } if (this.f3878d == 4294967295L || (C2264j.m9776a() / 1024) / 1024 >= (this.f3878d / 1024) / 1024) { String headerField2 = httpURLConnection.getHeaderField("X-ROTATE_INFO"); if (headerField2 != null) { this.f3876b.f6192d = Byte.parseByte(headerField2); return; } return; } m5569a("notRemain", this.f3876b); throw new C1415b(C1416a.LargeDataError); } /* access modifiers changed from: protected */ /* renamed from: c */ public void mo3423c(HttpURLConnection httpURLConnection) { if (!this.f3877c.getParentFile().exists()) { this.f3877c.getParentFile().mkdirs(); } super.mo3423c(httpURLConnection); } /* access modifiers changed from: protected */ /* renamed from: h */ public OutputStream mo3435h() { try { return new BufferedOutputStream(new FileOutputStream(this.f3877c)); } catch (IOException e) { throw new C1415b(C1416a.IOError, (Throwable) e); } } /* access modifiers changed from: protected */ /* renamed from: a */ public Void mo3434b(OutputStream outputStream) { return null; } /* access modifiers changed from: protected */ /* renamed from: a */ public void mo3433a(int i, long j) { long j2 = 0; if (this.f3878d > 0) { j2 = (100 * j) / this.f3878d; } m5568a((int) j2); } /* access modifiers changed from: protected */ /* JADX WARNING: Removed duplicated region for block: B:20:0x0056 A[SYNTHETIC, Splitter:B:20:0x0056] */ /* JADX WARNING: Removed duplicated region for block: B:25:0x005f A[SYNTHETIC, Splitter:B:25:0x005f] */ /* JADX WARNING: Removed duplicated region for block: B:36:? A[RETURN, SYNTHETIC] */ /* renamed from: g */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void mo3428g() { /* r6 = this; r1 = 0 com.panasonic.avc.cng.model.service.b.c r0 = r6.f3876b // Catch:{ IOException -> 0x0046, all -> 0x005c } boolean r0 = r0.mo5235a() // Catch:{ IOException -> 0x0046, all -> 0x005c } if (r0 != 0) goto L_0x006e com.panasonic.avc.cng.model.service.b.c r0 = r6.f3876b // Catch:{ IOException -> 0x0046, all -> 0x005c } boolean r0 = r0.mo5236b() // Catch:{ IOException -> 0x0046, all -> 0x005c } if (r0 == 0) goto L_0x006e java.io.FileOutputStream r0 = new java.io.FileOutputStream // Catch:{ IOException -> 0x0046, all -> 0x005c } java.io.File r2 = r6.f3877c // Catch:{ IOException -> 0x0046, all -> 0x005c } r0.<init>(r2) // Catch:{ IOException -> 0x0046, all -> 0x005c } com.panasonic.avc.cng.model.service.b.c r1 = r6.f3876b // Catch:{ IOException -> 0x006c } java.lang.String r1 = r1.f6191c // Catch:{ IOException -> 0x006c } com.panasonic.avc.cng.model.service.b.c r2 = r6.f3876b // Catch:{ IOException -> 0x006c } int r2 = r2.f6192d // Catch:{ IOException -> 0x006c } r3 = 1920(0x780, float:2.69E-42) r4 = 1080(0x438, float:1.513E-42) android.graphics.Bitmap r1 = com.panasonic.avc.cng.util.C2257c.m9739a(r1, r2, r3, r4) // Catch:{ IOException -> 0x006c } if (r1 == 0) goto L_0x0034 android.graphics.Bitmap$CompressFormat r2 = android.graphics.Bitmap.CompressFormat.JPEG // Catch:{ IOException -> 0x006c } r3 = 100 r1.compress(r2, r3, r0) // Catch:{ IOException -> 0x006c } r1.recycle() // Catch:{ IOException -> 0x006c } L_0x0034: r1 = 100 r6.m5568a(r1) // Catch:{ IOException -> 0x006c } java.lang.String r1 = "finish" com.panasonic.avc.cng.model.service.b.c r2 = r6.f3876b // Catch:{ IOException -> 0x006c } r6.m5569a(r1, r2) // Catch:{ IOException -> 0x006c } if (r0 == 0) goto L_0x0045 r0.close() // Catch:{ IOException -> 0x0063 } L_0x0045: return L_0x0046: r0 = move-exception r0 = r1 L_0x0048: java.io.File r1 = r6.f3877c // Catch:{ all -> 0x0067 } com.panasonic.avc.cng.util.C2264j.m9777a(r1) // Catch:{ all -> 0x0067 } java.lang.String r1 = "error" com.panasonic.avc.cng.model.service.b.c r2 = r6.f3876b // Catch:{ all -> 0x0067 } r6.m5569a(r1, r2) // Catch:{ all -> 0x0067 } if (r0 == 0) goto L_0x0045 r0.close() // Catch:{ IOException -> 0x005a } goto L_0x0045 L_0x005a: r0 = move-exception goto L_0x0045 L_0x005c: r0 = move-exception L_0x005d: if (r1 == 0) goto L_0x0062 r1.close() // Catch:{ IOException -> 0x0065 } L_0x0062: throw r0 L_0x0063: r0 = move-exception goto L_0x0045 L_0x0065: r1 = move-exception goto L_0x0062 L_0x0067: r1 = move-exception r5 = r1 r1 = r0 r0 = r5 goto L_0x005d L_0x006c: r1 = move-exception goto L_0x0048 L_0x006e: r0 = r1 goto L_0x0034 */ throw new UnsupportedOperationException("Method not decompiled: com.panasonic.avc.cng.core.p040a.p041a.C1420d.mo3428g():void"); } /* access modifiers changed from: protected */ /* renamed from: a */ public void mo3417a(C1415b bVar) { switch (bVar.mo3431c()) { case IOError: m5569a("error", this.f3876b); return; case HttpResponse: m5569a("error", this.f3876b); return; case Cancel: C2264j.m9777a(this.f3877c); m5569a("cancel", this.f3876b); return; default: return; } } /* renamed from: a */ private void m5569a(String str, C2003c cVar) { if (this.f3875a != null) { this.f3875a.mo3766a(str, cVar); } } /* renamed from: a */ private void m5568a(int i) { if (this.f3875a != null) { this.f3875a.mo3765a(i); } } }
[ "maier1michael@gmail.com" ]
maier1michael@gmail.com
630fa424f7c7ae7800236a2f22fb38716442223d
b3d0b0f1c5fc0833edd6dbeb00ab56f986459b4c
/app/src/androidTest/java/msr/msrutils/ExampleInstrumentationTest.java
601210938bf2563c8fc3d81c590126eb0bfe03d8
[]
no_license
JohnName/MSRUtils
4a7bfc95c66cf3d221d88356dcd79b1ee15bbc94
cf85dcc21be95ab3e78af764148a7a92396af3f6
refs/heads/master
2021-04-09T10:18:12.847551
2016-07-04T09:58:58
2016-07-04T09:58:58
61,184,711
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package msr.msrutils; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @MediumTest @RunWith(AndroidJUnit4.class) public class ExampleInstrumentationTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("msr.msrutils", appContext.getPackageName()); } }
[ "475934874@qq.com" ]
475934874@qq.com
d49303bc2f85f132a92d65a8a3cb4aa52256b437
614c2dc5ae027283f37ec15c12e9acdf60ead011
/voltTable2/procedures/SelectNewOrders_47.java
fb3660378f6e6db3b5735d7b7d6b0387bf35f8c8
[]
no_license
junshiguo/hybrid
d5f04e97706ff702773ecc589569af68aff27df7
7574e2243e77e5f912576157b2dddf74750abdba
refs/heads/master
2021-03-19T11:13:13.843164
2015-07-26T16:09:17
2015-07-26T16:09:17
21,557,559
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
import org.voltdb.*; public class SelectNewOrders_47 extends VoltProcedure { public final SQLStmt sql = new SQLStmt("SELECT * FROM new_orders47 WHERE tenant_id = ? AND is_insert = ? AND is_update = ?"); public VoltTable[] run(int tenant_id, int is_insert, int is_update) throws VoltAbortException { voltQueueSQL(sql, tenant_id, is_insert, is_update); return voltExecuteSQL(); } }
[ "junshiguo@126.com" ]
junshiguo@126.com
c5f657afb4cd758da54e9f28a4c7e59f28760845
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/transform/ServiceQuotaExceededExceptionUnmarshaller.java
57d69742bdc67a4b61fd12f0b34ca69f6651717a
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
2,966
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.costexplorer.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.costexplorer.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ServiceQuotaExceededException JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ServiceQuotaExceededExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller { private ServiceQuotaExceededExceptionUnmarshaller() { super(com.amazonaws.services.costexplorer.model.ServiceQuotaExceededException.class, "ServiceQuotaExceededException"); } @Override public com.amazonaws.services.costexplorer.model.ServiceQuotaExceededException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception { com.amazonaws.services.costexplorer.model.ServiceQuotaExceededException serviceQuotaExceededException = new com.amazonaws.services.costexplorer.model.ServiceQuotaExceededException( null); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return serviceQuotaExceededException; } private static ServiceQuotaExceededExceptionUnmarshaller instance; public static ServiceQuotaExceededExceptionUnmarshaller getInstance() { if (instance == null) instance = new ServiceQuotaExceededExceptionUnmarshaller(); return instance; } }
[ "" ]
0be0da7e54677e9e46fbb98ef217a5b61a22a98f
7c44afab8a5eef8a87647272a11f22b8609b9149
/SpringMVCloginExample/src/com/bosch/selenium/LoginTest.java
b9fb8e60e29d5fc57d70f663c65646e1671788a3
[]
no_license
imsam23/SPringMVC_Test
fc71693c2fda300fc59e8dc41c89f55cd10fb5fe
63d0ba48e942bd6885335e9610491a0552765b14
refs/heads/master
2021-04-09T17:24:54.545226
2018-03-19T05:48:48
2018-03-19T05:48:48
125,806,094
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package com.bosch.selenium; import static org.junit.Assert.*; import org.junit.Test; public class LoginTest { @Test public void test() { } }
[ "noreply@github.com" ]
imsam23.noreply@github.com
91c1a520b7d8522bd1b949dc354b11092893c559
4e30cb1346ca84fbcdf961f2f8eabc84ac4fc864
/common.moplaf.job/com.misc.common.moplaf.job.emf/src/com/misc/common/moplaf/job/RunParams.java
283ad76979ec2b0e1f48ad42360329e1546d2a60
[]
no_license
MichelSc/common.moplaf
14fda486dac18f66ce0ec5de8f2818be18f23c5a
58e9b0b20d643d521388a93b609b68dc71f5e7d7
refs/heads/master
2022-11-05T05:39:51.935466
2022-10-27T06:24:25
2022-10-27T06:24:25
32,098,602
3
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
/******************************************************************************* * Copyright (c) 2017, 2018 Michel Schaffers and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Michel Schaffers - initial API and implementation *******************************************************************************/ /** */ package com.misc.common.moplaf.job; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Run Params</b></em>'. * <!-- end-user-doc --> * * * @see com.misc.common.moplaf.job.JobPackage#getRunParams() * @model * @generated */ public interface RunParams extends EObject { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @model * @generated */ void copyParams(RunParams other); } // RunParams
[ "michelschaffers@gmail.com" ]
michelschaffers@gmail.com
2ff3bf145abca375d292926d0ffb3d3936de9a8b
8da3d3f0b7ddc189e1676881238da095427be1b9
/src/main/java/com/ayang818/honor/datacollection/model/GraduationExample.java
97478b515f3826a2233fbcc91ecfede46f6688b3
[]
no_license
ayang818/DataCollectionSystem
b95b56e3108ff4794cb395ee0061628308134042
cc6bd20a6cb4e32674845e5f0a31756289a19b40
refs/heads/master
2022-06-22T11:16:36.095726
2019-11-20T12:09:10
2019-11-20T12:09:10
217,048,684
1
0
null
2022-06-21T02:06:10
2019-10-23T12:12:40
Java
UTF-8
Java
false
false
28,852
java
package com.ayang818.honor.datacollection.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class GraduationExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public GraduationExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andStudentNameIsNull() { addCriterion("student_name is null"); return (Criteria) this; } public Criteria andStudentNameIsNotNull() { addCriterion("student_name is not null"); return (Criteria) this; } public Criteria andStudentNameEqualTo(String value) { addCriterion("student_name =", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameNotEqualTo(String value) { addCriterion("student_name <>", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameGreaterThan(String value) { addCriterion("student_name >", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameGreaterThanOrEqualTo(String value) { addCriterion("student_name >=", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameLessThan(String value) { addCriterion("student_name <", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameLessThanOrEqualTo(String value) { addCriterion("student_name <=", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameLike(String value) { addCriterion("student_name like", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameNotLike(String value) { addCriterion("student_name not like", value, "studentName"); return (Criteria) this; } public Criteria andStudentNameIn(List<String> values) { addCriterion("student_name in", values, "studentName"); return (Criteria) this; } public Criteria andStudentNameNotIn(List<String> values) { addCriterion("student_name not in", values, "studentName"); return (Criteria) this; } public Criteria andStudentNameBetween(String value1, String value2) { addCriterion("student_name between", value1, value2, "studentName"); return (Criteria) this; } public Criteria andStudentNameNotBetween(String value1, String value2) { addCriterion("student_name not between", value1, value2, "studentName"); return (Criteria) this; } public Criteria andSchoolNumberIsNull() { addCriterion("school_number is null"); return (Criteria) this; } public Criteria andSchoolNumberIsNotNull() { addCriterion("school_number is not null"); return (Criteria) this; } public Criteria andSchoolNumberEqualTo(Integer value) { addCriterion("school_number =", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberNotEqualTo(Integer value) { addCriterion("school_number <>", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberGreaterThan(Integer value) { addCriterion("school_number >", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberGreaterThanOrEqualTo(Integer value) { addCriterion("school_number >=", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberLessThan(Integer value) { addCriterion("school_number <", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberLessThanOrEqualTo(Integer value) { addCriterion("school_number <=", value, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberIn(List<Integer> values) { addCriterion("school_number in", values, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberNotIn(List<Integer> values) { addCriterion("school_number not in", values, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberBetween(Integer value1, Integer value2) { addCriterion("school_number between", value1, value2, "schoolNumber"); return (Criteria) this; } public Criteria andSchoolNumberNotBetween(Integer value1, Integer value2) { addCriterion("school_number not between", value1, value2, "schoolNumber"); return (Criteria) this; } public Criteria andTeacherIdIsNull() { addCriterion("teacher_id is null"); return (Criteria) this; } public Criteria andTeacherIdIsNotNull() { addCriterion("teacher_id is not null"); return (Criteria) this; } public Criteria andTeacherIdEqualTo(Integer value) { addCriterion("teacher_id =", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdNotEqualTo(Integer value) { addCriterion("teacher_id <>", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdGreaterThan(Integer value) { addCriterion("teacher_id >", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdGreaterThanOrEqualTo(Integer value) { addCriterion("teacher_id >=", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdLessThan(Integer value) { addCriterion("teacher_id <", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdLessThanOrEqualTo(Integer value) { addCriterion("teacher_id <=", value, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdIn(List<Integer> values) { addCriterion("teacher_id in", values, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdNotIn(List<Integer> values) { addCriterion("teacher_id not in", values, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdBetween(Integer value1, Integer value2) { addCriterion("teacher_id between", value1, value2, "teacherId"); return (Criteria) this; } public Criteria andTeacherIdNotBetween(Integer value1, Integer value2) { addCriterion("teacher_id not between", value1, value2, "teacherId"); return (Criteria) this; } public Criteria andTeacherNameIsNull() { addCriterion("teacher_name is null"); return (Criteria) this; } public Criteria andTeacherNameIsNotNull() { addCriterion("teacher_name is not null"); return (Criteria) this; } public Criteria andTeacherNameEqualTo(String value) { addCriterion("teacher_name =", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameNotEqualTo(String value) { addCriterion("teacher_name <>", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameGreaterThan(String value) { addCriterion("teacher_name >", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameGreaterThanOrEqualTo(String value) { addCriterion("teacher_name >=", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameLessThan(String value) { addCriterion("teacher_name <", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameLessThanOrEqualTo(String value) { addCriterion("teacher_name <=", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameLike(String value) { addCriterion("teacher_name like", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameNotLike(String value) { addCriterion("teacher_name not like", value, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameIn(List<String> values) { addCriterion("teacher_name in", values, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameNotIn(List<String> values) { addCriterion("teacher_name not in", values, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameBetween(String value1, String value2) { addCriterion("teacher_name between", value1, value2, "teacherName"); return (Criteria) this; } public Criteria andTeacherNameNotBetween(String value1, String value2) { addCriterion("teacher_name not between", value1, value2, "teacherName"); return (Criteria) this; } public Criteria andWhereaboutsIsNull() { addCriterion("whereabouts is null"); return (Criteria) this; } public Criteria andWhereaboutsIsNotNull() { addCriterion("whereabouts is not null"); return (Criteria) this; } public Criteria andWhereaboutsEqualTo(String value) { addCriterion("whereabouts =", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsNotEqualTo(String value) { addCriterion("whereabouts <>", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsGreaterThan(String value) { addCriterion("whereabouts >", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsGreaterThanOrEqualTo(String value) { addCriterion("whereabouts >=", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsLessThan(String value) { addCriterion("whereabouts <", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsLessThanOrEqualTo(String value) { addCriterion("whereabouts <=", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsLike(String value) { addCriterion("whereabouts like", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsNotLike(String value) { addCriterion("whereabouts not like", value, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsIn(List<String> values) { addCriterion("whereabouts in", values, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsNotIn(List<String> values) { addCriterion("whereabouts not in", values, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsBetween(String value1, String value2) { addCriterion("whereabouts between", value1, value2, "whereabouts"); return (Criteria) this; } public Criteria andWhereaboutsNotBetween(String value1, String value2) { addCriterion("whereabouts not between", value1, value2, "whereabouts"); return (Criteria) this; } public Criteria andGmtCreateIsNull() { addCriterion("gmt_create is null"); return (Criteria) this; } public Criteria andGmtCreateIsNotNull() { addCriterion("gmt_create is not null"); return (Criteria) this; } public Criteria andGmtCreateEqualTo(Date value) { addCriterion("gmt_create =", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotEqualTo(Date value) { addCriterion("gmt_create <>", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateGreaterThan(Date value) { addCriterion("gmt_create >", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateGreaterThanOrEqualTo(Date value) { addCriterion("gmt_create >=", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateLessThan(Date value) { addCriterion("gmt_create <", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateLessThanOrEqualTo(Date value) { addCriterion("gmt_create <=", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateIn(List<Date> values) { addCriterion("gmt_create in", values, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotIn(List<Date> values) { addCriterion("gmt_create not in", values, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateBetween(Date value1, Date value2) { addCriterion("gmt_create between", value1, value2, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotBetween(Date value1, Date value2) { addCriterion("gmt_create not between", value1, value2, "gmtCreate"); return (Criteria) this; } public Criteria andGmtModifiedIsNull() { addCriterion("gmt_modified is null"); return (Criteria) this; } public Criteria andGmtModifiedIsNotNull() { addCriterion("gmt_modified is not null"); return (Criteria) this; } public Criteria andGmtModifiedEqualTo(Date value) { addCriterion("gmt_modified =", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedNotEqualTo(Date value) { addCriterion("gmt_modified <>", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedGreaterThan(Date value) { addCriterion("gmt_modified >", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedGreaterThanOrEqualTo(Date value) { addCriterion("gmt_modified >=", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedLessThan(Date value) { addCriterion("gmt_modified <", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedLessThanOrEqualTo(Date value) { addCriterion("gmt_modified <=", value, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedIn(List<Date> values) { addCriterion("gmt_modified in", values, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedNotIn(List<Date> values) { addCriterion("gmt_modified not in", values, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedBetween(Date value1, Date value2) { addCriterion("gmt_modified between", value1, value2, "gmtModified"); return (Criteria) this; } public Criteria andGmtModifiedNotBetween(Date value1, Date value2) { addCriterion("gmt_modified not between", value1, value2, "gmtModified"); return (Criteria) this; } public Criteria andGonetypeIsNull() { addCriterion("goneType is null"); return (Criteria) this; } public Criteria andGonetypeIsNotNull() { addCriterion("goneType is not null"); return (Criteria) this; } public Criteria andGonetypeEqualTo(String value) { addCriterion("goneType =", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeNotEqualTo(String value) { addCriterion("goneType <>", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeGreaterThan(String value) { addCriterion("goneType >", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeGreaterThanOrEqualTo(String value) { addCriterion("goneType >=", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeLessThan(String value) { addCriterion("goneType <", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeLessThanOrEqualTo(String value) { addCriterion("goneType <=", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeLike(String value) { addCriterion("goneType like", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeNotLike(String value) { addCriterion("goneType not like", value, "gonetype"); return (Criteria) this; } public Criteria andGonetypeIn(List<String> values) { addCriterion("goneType in", values, "gonetype"); return (Criteria) this; } public Criteria andGonetypeNotIn(List<String> values) { addCriterion("goneType not in", values, "gonetype"); return (Criteria) this; } public Criteria andGonetypeBetween(String value1, String value2) { addCriterion("goneType between", value1, value2, "gonetype"); return (Criteria) this; } public Criteria andGonetypeNotBetween(String value1, String value2) { addCriterion("goneType not between", value1, value2, "gonetype"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table graduation * * @mbg.generated do_not_delete_during_merge Sun Nov 03 15:07:40 GMT+08:00 2019 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table graduation * * @mbg.generated Sun Nov 03 15:07:40 GMT+08:00 2019 */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "ayang818@qq.com" ]
ayang818@qq.com
0ff7ec372bcc645abff7fadaabd4ff62ba82a19f
415e15d1a21709498e96647e51e357903d7676a5
/dazuoye1/app/src/main/java/com/example/group/adapter/CartAdapter.java
a620341f50beea29d668375e69d99e162984dd48
[]
no_license
111zhangyue/-
a608b8d5332a2b913d8c61440724d72662bcb8cb
a4542392dc040987ab20260201b750d711041c5c
refs/heads/master
2023-02-03T04:13:39.248813
2020-12-18T16:09:08
2020-12-18T16:09:08
304,999,012
0
0
null
null
null
null
UTF-8
Java
false
false
3,697
java
package com.example.group.adapter; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.example.group.MyApplication; import com.example.group.R; import com.example.group.bean.CartInfo; import java.util.ArrayList; public class CartAdapter extends BaseAdapter { private static final String TAG = "CartAdapter"; private Context mContext; // 声明一个上下文对象 private ArrayList<CartInfo> mCartArray; // 声明一个购物车信息队列 // 购物车适配器的构造函数,传入上下文、购物车里的商品队列 public CartAdapter(Context context, ArrayList<CartInfo> cart_list) { mContext = context; mCartArray = cart_list; } // 获取列表项的个数 public int getCount() { return mCartArray.size(); } // 获取列表项的数据 public Object getItem(int arg0) { return mCartArray.get(arg0); } // 获取列表项的编号 public long getItemId(int arg0) { return arg0; } // 获取指定位置的列表项视图 public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { // 转换视图为空 Log.d(TAG, "转换视图为空"); holder = new ViewHolder(); // 创建一个新的视图持有者 // 根据布局文件item_cart.xml生成转换视图对象 convertView = LayoutInflater.from(mContext).inflate(R.layout.item_cart, null); holder.iv_thumb = convertView.findViewById(R.id.iv_thumb); holder.tv_name = convertView.findViewById(R.id.tv_name); holder.tv_desc = convertView.findViewById(R.id.tv_desc); holder.tv_count = convertView.findViewById(R.id.tv_count); holder.tv_price = convertView.findViewById(R.id.tv_price); holder.tv_sum = convertView.findViewById(R.id.tv_sum); // 将视图持有者保存到转换视图当中 convertView.setTag(holder); } else { // 转换视图非空 Log.d(TAG, "转换视图非空"); // 从转换视图中获取之前保存的视图持有者 holder = (ViewHolder) convertView.getTag(); } CartInfo info = mCartArray.get(position); Log.d(TAG, "info.goods.name:"+info.goods.name); holder.iv_thumb.setImageBitmap(MyApplication.getInstance().mIconMap.get(info.goods_id)); // 显示商品的图片 holder.tv_name.setText(info.goods.name); // 显示商品的名称 holder.tv_desc.setText(info.goods.desc); // 显示商品的描述 holder.tv_count.setText("" + info.count); // 显示商品的数量 holder.tv_price.setText("" + (int) info.goods.price); // 显示商品的单价 holder.tv_sum.setText("" + (int) (info.count * info.goods.price)); // 显示商品的总价 return convertView; } // 定义一个视图持有者,以便重用列表项的视图资源 public final class ViewHolder { public ImageView iv_thumb; // 声明商品图片的图像视图对象 public TextView tv_name; // 声明商品名称的文本视图对象 public TextView tv_desc; // 声明商品描述的文本视图对象 public TextView tv_count; // 声明商品数量的文本视图对象 public TextView tv_price; // 声明商品单价的文本视图对象 public TextView tv_sum; // 声明商品总价的文本视图对象 } }
[ "18745400402@163.com" ]
18745400402@163.com
8017d262b7f0d360ad11fbced49658262086447b
c5666cd31eb0678c49657d9b98ac7a42d8f34836
/Interview/src/com/datastructures/Maps/MyHashMap.java
d55c4485c0995c02eca405cb7c43baaa2d8554c5
[]
no_license
sowmya9029/Interviews
d1f08ba8ede7ef75fddec49e17efed228d44653c
610d07a7d52fce3a195ff13080f5a870ae355499
refs/heads/master
2022-04-21T09:53:38.888921
2020-04-11T00:38:19
2020-04-11T00:38:19
104,698,374
0
0
null
null
null
null
UTF-8
Java
false
false
4,277
java
package com.datastructures.Maps; public class MyHashMap { // for better re-sizing is taken as 2^4 private static final int SIZE = 16; private Entry table[] = new Entry[SIZE]; /** * To store the Map data in key and value pair. * Used linked list approach to avoid the collisions */ class Entry { final String key; String value; Entry next; Entry(String k, String v) { key = k; value = v; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getKey() { return key; } } /** * Returns the entry mapped to key in the HashMap. */ public Entry get(String k) { int hash = k.hashCode() % SIZE; Entry e = table[hash]; // Bucket is identified by hashCode and traversed the bucket // till element is not found. while(e != null) { if(e.key.equals(k)) { return e; } e = e.next; } return null; } /** * If the map previously contained a mapping for the key, the old * value is replaced. */ public void put(String k, String v) { int hash = k.hashCode() % SIZE; Entry e = table[hash]; if(e != null) { // If we will insert duplicate key-value pair, // Old value will be replaced by new one. if(e.key.equals(k)) { e.value = v; } else { // Collision: insert new element at the end of list // in the same bucket while(e.next != null) { e = e.next; } Entry entryInOldBucket = new Entry(k, v); e.next = entryInOldBucket; } } else { // create new bucket for new element in the map. Entry entryInNewBucket = new Entry(k, v); table[hash] = entryInNewBucket; } } public static void main(String[] args) { MyHashMap myHashMap = new MyHashMap(); myHashMap.put("Awadh", "SSE"); myHashMap.put("Rahul", "SSE"); myHashMap.put("Sattu", "SE"); myHashMap.put("Gaurav", "SE"); Entry e = myHashMap.get("Awadh"); System.out.println(""+e.getValue()); } //using entry set /* Map<K,V> m=new LinkedHashMap<K,V>(); for(Map.Entry<K,V> entry: m.entrySet()) System.out.println(entry.getKey() + ": " + entry.getValue());*/ } // public void solveSudoku(char[][] board) { helper(board); } private boolean helper(char[][] board){ for(int i=0; i<9; i++){ for(int j=0; j<9; j++){ if(board[i][j]!='.'){ continue; } for(char k='1'; k<='9'; k++){ board[i][j]=k; if(isValid(board, i, j) && helper(board)){ return true; } board[i][j]='.'; } return false; } } return true; //return true if all cells are checked } private boolean isValid(char[][] board, int i, int j){ HashSet<Character> set = new HashSet<>(); for(int k=0; k<9; k++){ if(set.contains(board[i][k])){ return false; } if(board[i][k]!='.'){ set.add(board[i][k]); } } set.clear(); for(int k=0; k<9; k++){ if(set.contains(board[k][j])){ return false; } if(board[k][j]!='.'){ set.add(board[k][j]); } } set.clear(); int x=i/3 * 3; int y=j/3 * 3; for(int m=x; m<x+3; m++){ for(int n=y; n<y+3; n++){ if(set.contains(board[m][n])){ return false; } if(board[m][n]!='.'){ set.add(board[m][n]); } } } set.clear(); return true; }
[ "sowmya9029@gmail.com" ]
sowmya9029@gmail.com
4ede2315e3adacb3fc253a6c31919afa75b9b4a0
5f6a4bd29c91fac9d861ccc65f78bfdb976c5085
/src/jasacs/Testing.java
365894087897946c743bb2436cebce11a89faf2e
[]
no_license
LordRollex112/JASACS
0ae0bb332f751c1ca6a76d6c4686f0ea80e89c05
8b96106309494252d79ed713427a903d21a4e352
refs/heads/master
2021-01-22T12:35:25.668758
2017-09-04T11:11:22
2017-09-04T11:11:22
96,903,870
0
0
null
null
null
null
UTF-8
Java
false
false
312
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 jasacs; /** * * @author daniel */ public abstract class Testing extends Main implements item{ }
[ "daniel@RG-N425-T440-01.rgu.ac.uk" ]
daniel@RG-N425-T440-01.rgu.ac.uk
66c913f2520eed70082ba054e4e1965d721c3aef
9ad0eb06454a24544fd136df328abb5d5c70cef5
/Android-demo/MaterialDrawer-demo/app/src/test/java/com/dm/materialdrawerdemo/ExampleUnitTest.java
ebe577c0298b06bd04826837bca5ff4a6c026f5e
[ "MIT" ]
permissive
absentm/Demo
656aa69df6409b09822a85bd2ccac59a7df7627a
0612299c7b629af549bd74dc07b957b27fc52495
refs/heads/master
2023-03-03T15:04:37.186286
2022-06-17T03:11:25
2022-06-29T06:15:00
67,702,373
6
2
MIT
2023-02-22T07:05:22
2016-09-08T12:45:40
Java
UTF-8
Java
false
false
403
java
package com.dm.materialdrawerdemo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "absentm@163.com" ]
absentm@163.com
254f02f0c68a7235b0f9d9bbe2e34aeaa42d9ef3
ca72883dc9b693970180e5caaf42528d457f3963
/app/src/androidTest/java/com/vgrec/espressoexamples/test18/test2/DialogTests.java
c33a2156a56a776d7e6968538a9f6669d8aa44b0
[]
no_license
hiyangyue/TestExpresso
19a28c58924f34a71265c560ef00d459d7a76585
39e3ae55cd435b77068944523b5cc81fd5eea460
refs/heads/master
2022-09-22T05:30:00.612781
2020-05-28T12:30:51
2020-05-28T12:30:51
267,547,557
1
0
null
null
null
null
UTF-8
Java
false
false
1,909
java
package com.vgrec.espressoexamples.test18.test2; import android.test.ActivityInstrumentationTestCase2; import com.vgrec.espressoexamples.R; import com.vgrec.espressoexamples.activities.DialogExampleActivity; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; /** * @author vgrec, created on 3/24/15. */ public class DialogTests extends ActivityInstrumentationTestCase2<DialogExampleActivity> { public DialogTests() { super(DialogExampleActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); getActivity(); } public void testCheckDialogDisplayed() { // Click on the button that shows the dialog onView(withId(R.id.confirm_dialog_button)).perform(click()); // Check the dialog title text is displayed onView(withText(R.string.dialog_title)).check(matches(isDisplayed())); } public void testClickOkButton() { onView(withId(R.id.confirm_dialog_button)).perform(click()); // android.R.id.button1 = positive button onView(withId(android.R.id.button1)).perform(click()); onView(withId(R.id.status_text)).check(matches(withText(R.string.ok))); } public void testClickCancelButton() { onView(withId(R.id.confirm_dialog_button)).perform(click()); // android.R.id.button2 = negative button onView(withId(android.R.id.button2)).perform(click()); onView(withId(R.id.status_text)).check(matches(withText(R.string.cancel))); } }
[ "hi.yangyue1993@gmail.com" ]
hi.yangyue1993@gmail.com
27e947075a444e49479e09a25305e70c2a1a2802
94243e15cfe9cccdf3638d53527fa58327efac29
/habeascorpus_tokens/lucene-3.6.2/core/src/java/org/apache/lucene/LucenePackage.java
c7ae8471747dcf117aeecdc082d358fbfb5b1fce
[]
no_license
habeascorpus/habeascorpus-data-withComments
4e0193450273f2d46ea9ef497746aaf93b5fc491
3a516954b42b24c93a8d1e292ff0a0907bed97ad
refs/heads/master
2021-01-20T21:53:35.264690
2015-05-22T14:59:36
2015-05-22T14:59:36
18,139,450
3
1
null
2023-03-20T11:51:26
2014-03-26T13:45:05
Java
UTF-8
Java
false
false
2,808
java
package TokenNamepackage org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT lucene TokenNameIdentifier lucene ; TokenNameSEMICOLON /** * 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. */ TokenNameCOMMENT_JAVADOC 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. /** Lucene's package information, including version. **/ TokenNameCOMMENT_JAVADOC Lucene's package information, including version. * public TokenNamepublic final TokenNamefinal class TokenNameclass LucenePackage TokenNameIdentifier Lucene Package { TokenNameLBRACE private TokenNameprivate LucenePackage TokenNameIdentifier Lucene Package ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE } TokenNameRBRACE // can't construct TokenNameCOMMENT_LINE can't construct /** Return Lucene's package, including version information. */ TokenNameCOMMENT_JAVADOC Return Lucene's package, including version information. public TokenNamepublic static TokenNamestatic Package TokenNameIdentifier Package get TokenNameIdentifier get ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn LucenePackage TokenNameIdentifier Lucene Package . TokenNameDOT class TokenNameclass . TokenNameDOT getPackage TokenNameIdentifier get Package ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE
[ "dma@cs.cmu.edu" ]
dma@cs.cmu.edu
b956d5d7231eaf09fee4f6167ea894099820d4f5
635ba9df74200dbcb704832556fb81c3b659bfa4
/banner/src/main/java/com/base/banner/transformer/RotateUpTransformer.java
a380fee59dc3c0308dd299c3a0d04d3dafdb3a05
[]
no_license
skill20/banner
0ada0d1636258f6c98fb916704c40d811c71ec81
2e173192bcab9fb1d6a78be96dcdbfbbc25bc2f2
refs/heads/master
2020-04-26T08:48:31.411247
2019-05-17T09:51:27
2019-05-17T09:51:27
173,434,099
0
0
null
null
null
null
UTF-8
Java
false
false
1,111
java
/* * Copyright 2014 Toxic Bakery * * 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.base.banner.transformer; import android.view.View; public class RotateUpTransformer extends ABaseTransformer { private static final float ROT_MOD = -15f; @Override protected void onTransform(View view, float position) { final float width = view.getWidth(); final float rotation = ROT_MOD * position; view.setPivotX(width * 0.5f); view.setPivotY(0f); view.setTranslationX(0f); view.setRotation(rotation); } @Override protected boolean isPagingEnabled() { return true; } }
[ "qingqing.wang@jpush.cn" ]
qingqing.wang@jpush.cn
2dd8d0b000e534549a2999c0fb294781ab8b9598
81e29340cef5d391b15ae4d315f7f0860cf54de6
/src/ua/org/slovo/securesms/contacts/ContactsCursorLoader.java
c5144e7942f21a49f3a1d04185b6ac96c822cd31
[ "Apache-2.0" ]
permissive
varkon/MilChat
c1ffbfbd794d6c470a2e1290d86b714de636bd53
c68b8046f8767ffc7aea48e3801188bfde2501e6
refs/heads/master
2021-01-01T05:46:20.868691
2016-05-28T08:03:19
2016-05-28T08:03:19
58,546,315
1
0
null
null
null
null
UTF-8
Java
false
false
5,637
java
/** * Copyright (C) 2013 Open Whisper Systems * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package ua.org.slovo.securesms.contacts; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; import android.database.MergeCursor; import android.provider.ContactsContract; import android.support.annotation.NonNull; import android.support.v4.content.CursorLoader; import android.text.TextUtils; import android.util.Log; import ua.org.slovo.securesms.R; import ua.org.slovo.securesms.database.DatabaseFactory; import ua.org.slovo.securesms.recipients.RecipientFactory; import ua.org.slovo.securesms.recipients.Recipients; import ua.org.slovo.securesms.util.DirectoryHelper; import ua.org.slovo.securesms.util.DirectoryHelper.UserCapabilities.Capability; import ua.org.slovo.securesms.util.NumberUtil; import java.util.ArrayList; /** * CursorLoader that initializes a ContactsDatabase instance * * @author Jake McGinty */ public class ContactsCursorLoader extends CursorLoader { private static final String TAG = ContactsCursorLoader.class.getSimpleName(); public final static int MODE_ALL = 0; public final static int MODE_PUSH_ONLY = 1; public final static int MODE_OTHER_ONLY = 2; private final String filter; private final int mode; public ContactsCursorLoader(Context context, int mode, String filter) { super(context); this.filter = filter; this.mode = mode; } @Override public Cursor loadInBackground() { ContactsDatabase contactsDatabase = DatabaseFactory.getContactsDatabase(getContext()); ArrayList<Cursor> cursorList = new ArrayList<>(3); if (mode != MODE_OTHER_ONLY) { cursorList.add(contactsDatabase.queryTextSecureContacts(filter)); } if (mode == MODE_ALL) { cursorList.add(contactsDatabase.querySystemContacts(filter)); } else if (mode == MODE_OTHER_ONLY) { cursorList.add(filterNonPushContacts(contactsDatabase.querySystemContacts(filter))); } if (!TextUtils.isEmpty(filter) && NumberUtil.isValidSmsOrEmail(filter)) { MatrixCursor newNumberCursor = new MatrixCursor(new String[] {ContactsDatabase.ID_COLUMN, ContactsDatabase.NAME_COLUMN, ContactsDatabase.NUMBER_COLUMN, ContactsDatabase.NUMBER_TYPE_COLUMN, ContactsDatabase.LABEL_COLUMN, ContactsDatabase.CONTACT_TYPE_COLUMN}, 1); newNumberCursor.addRow(new Object[] {-1L, getContext().getString(R.string.contact_selection_list__unknown_contact), filter, ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM, "\u21e2", ContactsDatabase.NEW_TYPE}); cursorList.add(newNumberCursor); } return new MergeCursor(cursorList.toArray(new Cursor[0])); } private @NonNull Cursor filterNonPushContacts(@NonNull Cursor cursor) { try { final long startMillis = System.currentTimeMillis(); final MatrixCursor matrix = new MatrixCursor(new String[]{ContactsDatabase.ID_COLUMN, ContactsDatabase.NAME_COLUMN, ContactsDatabase.NUMBER_COLUMN, ContactsDatabase.NUMBER_TYPE_COLUMN, ContactsDatabase.LABEL_COLUMN, ContactsDatabase.CONTACT_TYPE_COLUMN}); while (cursor.moveToNext()) { final String number = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_COLUMN)); final Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true); if (DirectoryHelper.getUserCapabilities(getContext(), recipients) .getTextCapability() != Capability.SUPPORTED) { matrix.addRow(new Object[]{cursor.getLong(cursor.getColumnIndexOrThrow(ContactsDatabase.ID_COLUMN)), cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NAME_COLUMN)), number, cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_TYPE_COLUMN)), cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.LABEL_COLUMN)), ContactsDatabase.NORMAL_TYPE}); } } Log.w(TAG, "filterNonPushContacts() -> " + (System.currentTimeMillis() - startMillis) + "ms"); return matrix; } finally { cursor.close(); } } }
[ "info@varkon.biz" ]
info@varkon.biz
077e4bac149bc865e134550e2f49e59746f7af0a
b8d28009d08ae9c1e213432b7578f334c7b0cfde
/New1vs1/src/de/OnevsOne/main.java
2665304806e85a5d66d3b61a2406a20070b4820e
[]
no_license
JHammer17/1vs1
5df302402945736fcf5d23962bb719de5be13b5c
3038866c74b3133527fcc69c8b27bd4780fe1fbc
refs/heads/master
2021-08-29T15:38:28.395400
2017-12-14T05:25:58
2017-12-14T05:25:58
106,918,881
0
0
null
null
null
null
UTF-8
Java
false
false
59,571
java
package de.OnevsOne; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.WorldCreator; import org.bukkit.WorldType; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.inventory.EnchantingInventory; import org.bukkit.inventory.Inventory; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import com.google.common.io.Files; import de.OnevsOne.Arena.Manager.ArenaEvents; import de.OnevsOne.Arena.Manager.ArenaJoin; import de.OnevsOne.Arena.Manager.ArenaState; import de.OnevsOne.Arena.Manager.ManageRAMData; import de.OnevsOne.Arena.Manager.RemoveEntitys; import de.OnevsOne.Arena.Manager.ACS.Manager; import de.OnevsOne.Arena.Reseter.ResetMethoden; import de.OnevsOne.Arena.Reseter.Builder.BlockMapReset; import de.OnevsOne.Arena.Reseter.Builder.CopyArena; import de.OnevsOne.Arena.Reseter.Builder.DeleteArena; import de.OnevsOne.Arena.SpectatorManager.ArenaMenu; import de.OnevsOne.Arena.SpectatorManager.SpectateArena; import de.OnevsOne.Arena.SpectatorManager.SpectateArenaItemManager; import de.OnevsOne.Arena.SpectatorManager.Spectator_Events; import de.OnevsOne.Commands.MainCommand; import de.OnevsOne.Commands.VariableCommands.Endmatch; import de.OnevsOne.Commands.VariableCommands.Kit; import de.OnevsOne.Commands.VariableCommands.KitStats; import de.OnevsOne.Commands.VariableCommands.Leave; import de.OnevsOne.Commands.VariableCommands.Spec; import de.OnevsOne.Commands.VariableCommands.Stats; import de.OnevsOne.Commands.VariableCommands.Surrender; import de.OnevsOne.Commands.VariableCommands.Team; import de.OnevsOne.Commands.VariableCommands.Win; import de.OnevsOne.Commands.VariableCommands.Manager.Command_Manager; import de.OnevsOne.Commands.VariableCommands.Tournament.Create; import de.OnevsOne.Commands.VariableCommands.Tournament.Join; import de.OnevsOne.Commands.VariableCommands.Tournament.Start; import de.OnevsOne.Commands.VariableCommands.Tournament.TLeave; import de.OnevsOne.Commands.VariableCommands.Tournament.Tournament; import de.OnevsOne.DataBases.DBMainManager; import de.OnevsOne.DataBases.MySQL.MySQLManager; import de.OnevsOne.DataBases.SQLite.Database; import de.OnevsOne.DataBases.SQLite.SQLite; import de.OnevsOne.Guide.ArenaInv; import de.OnevsOne.Guide.BaseInv; import de.OnevsOne.Guide.Inv_Opener; import de.OnevsOne.Guide.LayoutInv; import de.OnevsOne.Guide.Other.OtherInv; import de.OnevsOne.Guide.Other.OtherSignInv; import de.OnevsOne.Guide.Other.OtherSkullInv; import de.OnevsOne.Kit_Methods.KitMessages; import de.OnevsOne.Kit_Methods.Kit_Editor_Move; import de.OnevsOne.Kit_Methods.Multi_Kit_Manager; import de.OnevsOne.Kit_Methods.loadKitEdit; import de.OnevsOne.Listener.Blocked_Events; import de.OnevsOne.Listener.KillEvent; import de.OnevsOne.Listener.PlayerQueqeChangeSettings; import de.OnevsOne.Listener.Region_Edit; import de.OnevsOne.Listener.Manager.BlackDealerInvManager; import de.OnevsOne.Listener.Manager.ChallangeManager; import de.OnevsOne.Listener.Manager.DisableMapsManager; import de.OnevsOne.Listener.Manager.KitStandsInvManger; import de.OnevsOne.Listener.Manager.Preferences_Manager; import de.OnevsOne.Listener.Manager.SignManager; import de.OnevsOne.Listener.Manager.TeamManager; import de.OnevsOne.Listener.Manager.Warteschlange_Manager; import de.OnevsOne.Listener.Manager.Tournament.LobbyTournamentItemManager; import de.OnevsOne.Listener.Manager.Tournament.Tournament_Creator_InvManager; import de.OnevsOne.Listener.Manager.Tournament.Tournament_Events; import de.OnevsOne.MessageManager.MessageReplacer; import de.OnevsOne.MessageManager.NewMsgLoader; import de.OnevsOne.Methods.BlackDealerInvCreator; import de.OnevsOne.Methods.PositionManager; import de.OnevsOne.Methods.KitStands; import de.OnevsOne.Methods.ScoreBoardManager; import de.OnevsOne.Methods.ScoreboardAPI; import de.OnevsOne.Methods.SignMethods; import de.OnevsOne.Methods.Teleport; import de.OnevsOne.Methods.configMgr; import de.OnevsOne.Methods.getItems; import de.OnevsOne.Methods.openArenaCheckInv; import de.OnevsOne.Methods.saveErrorMethod; import de.OnevsOne.Methods.Core.MainScheduler; import de.OnevsOne.Methods.FightEnder.FightEnd; import de.OnevsOne.Methods.FightEnder.FightEndTeam; import de.OnevsOne.Methods.Mobs.spawnBlackDealer; import de.OnevsOne.Methods.Mobs.spawnPrefVillager; import de.OnevsOne.Methods.Mobs.spawnQueque; import de.OnevsOne.Methods.Queue.QuequePrefsMethods; import de.OnevsOne.Methods.Queue.QueueManager; import de.OnevsOne.Methods.Tournament.TournamentManager; import de.OnevsOne.Metrics.Metrics; import de.OnevsOne.States.AllErrors; import de.OnevsOne.States.ArenaTeamPlayer; import de.OnevsOne.States.OneVsOnePlayer; import de.OnevsOne.States.PlayerPrefs; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; /** * Der Code ist von JHammer17 * * 05.05.2016 um 20:45:09 Uhr */ public class main extends JavaPlugin implements Listener { //Stuff public ScoreboardAPI scoreAPI = new ScoreboardAPI(); public Permission permissionmgr; HashMap<UUID, OneVsOnePlayer> OneVSOnePlayers = new HashMap<>(); public HashMap<UUID, TournamentManager> tournaments = new HashMap<>(); public HashMap<UUID, Inventory> InfoInv = new HashMap<>(); public NewMsgLoader msgs; public int topPlaces = 10; public String oldNameQueque = ""; public String oldNamePrefse = ""; public SQLite sql = null; private static main ins; public HashMap<UUID, String[]> BestOfSystem = new HashMap<UUID, String[]>(); PositionManager getPos; ManageRAMData ramMgr; DBMainManager DBMgr; ArenaState aState; Teleport teleport; //--- //ACS: public HashMap<String, ArrayList<String>> ACSArenas = new HashMap<>(); public int ACSNextX = 0; public int ACSDistX = 0; public int ACSDistZ = 0; public HashMap<String, Integer> ACSZ = new HashMap<>(); public HashMap<String, Integer> ACSX = new HashMap<>(); public boolean ACSEnabled = true; public int ACSMin = 1; public int ACSMax = 10; public String ACSWorld = "1vs1-ACS"; //---- // Important Messages public String prefix = "§7"; public String tournamentPrefix = "§bTurnier> §7"; public String noPerms = "§cDu hast nicht die benötigten Berechtigungen diesen Command zu nutzen!"; public String noPermsUseThisKit = "§cDieses Kit darfst du nicht benutzen!"; public String scoreBoardName = "1vs1"; public static String Version; // ---------------------------------- // --------- // Locations and Stuff public Location KitEditor1; public Location KitEditor2; public int minX, minY, minZ; public int maxX, maxY, maxZ; // ---------- // Config Daten // Other: public Economy economy = null; // ------ // BungeMode: public boolean BungeeMode = false; public String fallBackServer = "Lobby"; // --------- // MySQL public int MySQLPort = 3306; public String MySQLDomain = "localhost"; public String MySQLDataBase = "1vs1"; public String MySQLUserName = "root"; public String MySQLPassword = ""; // ---------------------------- // Booleans public boolean twoStepArenaReset = true; public boolean useMySQL = false; public boolean resetAllArenasOnStart = false; public boolean saveStats = true; public boolean loadChunks = false; public boolean showArenaNamesSpectatorGUI = true; public boolean cfgEconomy = true; public boolean playAllBestOfGames = false; public boolean saveInvs = true; public boolean checkDatabaseConnection = true; public boolean asyncMapReset = false; public boolean useScoreboard = true; public boolean updateNoti = true; public boolean updateNotiJoin = true; public boolean voidTeleport = false; public boolean overrideJoinLeaveMsg = false; public boolean saveOldScoreboard = true; public boolean useBlockyMapReset = true; public boolean silentQueue = true; public boolean silentPrefVillager = true; public boolean silentBlackDealer = true; public boolean reduceStartDebugInfo = true; // ------------------ //Ints and doubles public int maxArenaEntitys = 16; public int ArenaStartTimer = 3; public int ArenaCheckTimer = 10; public int NoFreeArenaMessageTimer = 5; public int ArenaDestroy = 5; public int ArenaBuild = 5; public double Soupheal = 3.5; public double ArenaRegionLeaveDamage = 1.5; public int toggleCoolDown = 0; public int minArenaBuildDistanceBottom = 1; public int minArenaBuildDistanceTop = 2; public int minArenaBuildDistanceWalls = 2; public int autoEndmatch = 300; public int ChallangerItemSlot = 1; public int SpectatorItemSlot = 2; public int BookItemSlot = 3; public int TournamentItemSlot = 5; public int RankItemSlot = 7; public int SettingsItemSlot = 8; public int LeaveItemSlot = 9; public int ChallangerItemID = 276; public int SpectatorItemID = 370; public int TournamentItemID = 399; public int SettingsItemID = 404; public int LeaveItemID = 347; public int maxBlocksPerTick = 500; public int maxTeamSizeUser = 2; public int maxTeamSizePremium = 4; public int maxTeamSizeSpecial = 17; public int economyNormalWinUser = 1; public int economyNormalWinPremium = 2; public int economyNormalWinSpecial = 4; public int economyNormalWinAdmin = 8; public int economyTournamnetWinUser = 15; public int economyTournamnetWinPremium = 30; public int economyTournamnetWinSpecial = 60; public int economyTournamnetWinAdmin = 100; public int economyTournamnetKillUser = 2; public int economyTournamnetKillPremium = 4; public int economyTournamnetKillSpecial = 8; public int economyTournamnetKillAdmin = 16; public int maxTNTArenaGame = 64; public long lastTimedStatReset = 0; public long lastTimedStatReset24h = 0; public long timedStatResetTime = 2592000000L; //---------------- // MySQL Daten public static String host = "localhost"; public static String port = "3306"; public static String database = "1vs1"; public static String username = "root"; public static String password = ""; public static Connection con; // ----------- // Book public HashMap<Integer, String> book = new HashMap<>(); // ---- // ArrayLists: // Stuff public int defaultKitPrefs = 16;// 16 public String defaultPlayerQueuePrefs = "2 1"; public boolean spigot = true; public boolean connected = false; public boolean useEconomy = false; public boolean msgMeWhenIStupid = true; public boolean useAsWhitelist = false; public int rank9 = 20; public int rank8 = 50; public int rank7 = 120; public int rank6 = 150; public int rank5 = 380; public int rank4 = 450; public int rank3 = 500; public int rank2 = 750; public int rank1 = 1000; public int rankPointsWins = 1; public int rankPointsLose = -1; public ArrayList<EnchantingInventory> inventories = new ArrayList<EnchantingInventory>(); public ArrayList<Location> joinSigns = new ArrayList<Location>(); public ArrayList<String> blockedCommands = new ArrayList<>(); // ----- // Arena Stuff public ArrayList<String> FreeArenas = new ArrayList<String>(); public ArrayList<String> ResetingArenas = new ArrayList<String>(); public ArrayList<String> protectedWordls = new ArrayList<String>(); // ----------- public HashMap<String, ArrayList<ArenaTeamPlayer>> arenaTeams = new HashMap<>(); // ----------- // Entity Stuff public HashMap<String, ArrayList<Entity>> Entitys = new HashMap<String, ArrayList<Entity>>(); public HashMap<String, Integer> EntityCount = new HashMap<String, Integer>(); public HashMap<UUID, ArmorStand> kitStands = new HashMap<>(); public HashMap<UUID, ArmorStand> topKitStands = new HashMap<>(); public HashMap<UUID, ArmorStand> kitStandsInfo = new HashMap<>(); public HashMap<UUID, UUID> kitStandsCon = new HashMap<>(); public HashMap<UUID, String> kitStandsKit = new HashMap<>(); public HashMap<UUID, String> kitStandsName = new HashMap<>(); // ------------ // Arena Stuff public HashMap<String, String> ArenaKit = new HashMap<String, String>(); public HashMap<String, ArrayList<Player>> ArenaPlayersP1 = new HashMap<String, ArrayList<Player>>(); public HashMap<String, ArrayList<Player>> ArenaPlayersP2 = new HashMap<String, ArrayList<Player>>(); public HashMap<String, Location> ArenaPos1 = new HashMap<String, Location>(); public HashMap<String, Location> ArenaPos2 = new HashMap<String, Location>(); public HashMap<String, Location> ArenaCorner1 = new HashMap<String, Location>(); public HashMap<String, Location> ArenaCorner2 = new HashMap<String, Location>(); public HashMap<String, Integer> tntArena = new HashMap<>(); public HashMap<String, BlockMapReset> resetMgrArena = new HashMap<>(); public HashMap<String, ArrayList<UUID>> allPlayersArenaP1 = new HashMap<>(); public HashMap<String, ArrayList<UUID>> allPlayersArenaP2 = new HashMap<>(); // ----------- // @EventHandler//TODO Muss noch richtig eingebaut werden! // public void onClick(PlayerInteractEvent e) { // if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() // == Material.SKULL) { // GameProfile gpf = ((CraftPlayer)Bukkit.getPlayer("JHammer17")).getProfile(); // Bukkit.broadcastMessage("" + gpf.getProperties()); // Iterator<Property> iterator = gpf.getProperties().get( "textures" // ).iterator(); // // if( iterator.hasNext() ) { // Property prop = iterator.next(); // //String uuid = gpf.getId().toString(); // //String name = gpf.getName(); // String signature = prop.getSignature(); // String value = prop.getValue(); // // Bukkit.broadcastMessage("" + signature + " §a" + value); // // //Bukkit.getPlayer("JHammer17").getLocation().getBlock().setType(Material.SKULL); // //Bukkit.getPlayer("JHammer17").getLocation().getBlock().setData((byte) 3); // // ItemStack skull = // SkullXX.getSkull("eyJ0aW1lc3RhbXAiOjE0OTc3ODU3NjY0NTMsInByb2ZpbGVJZCI6IjE4M2IzYzY1NzZhMjQ5ZmFiMWE4NzE3OTY1NjVhOWQzIiwicHJvZmlsZU5hbWUiOiJ4anVsaWFueSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzU3ZTQxYjY3NjcyYWIzMDZhYmI3NjYyNWQ2M2JiMWZkOGMxZTUyNTY2ZDQ0ZTQ2NGJmNDFiYTgyYjYxNThkZCJ9fX0="); // Bukkit.getPlayer("JHammer17").getInventory().addItem(skull); // SkullPlacer.setBlock(e.getClickedBlock().getLocation(), // "eyJ0aW1lc3RhbXAiOjE0OTc4MTg4ODAwMDEsInByb2ZpbGVJZCI6IjA2OWE3OWY0NDRlOTQ3MjZhNWJlZmNhOTBlMzhhYWY1IiwicHJvZmlsZU5hbWUiOiJOb3RjaCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTExNmU2OWE4NDVlMjI3ZjdjYTFmZGRlOGMzNTdjOGM4MjFlYmQ0YmE2MTkzODJlYTRhMWY4N2Q0YWU5NCJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWVjM2NhYmZhZWVkNWRhZmU2MWM2NTQ2Mjk3ZTg1M2E1NDdjMzllYzIzOGQ3YzQ0YmY0ZWI0YTQ5ZGMxZjJjMCJ9fX0="); // // } // } // // } @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); ins = this; Bukkit.getScheduler().runTaskLater(this, new Runnable() { @Override public void run() { System.out.println(" __ __"); System.out.println("/_ | /_ |"); System.out.println(" | |_ _____| |"); System.out.println(" | \\ \\ / / __| |"); System.out.println(" | |\\ V /\\__ \\ |"); System.out.println(" |_| \\_/ |___/_|"); System.out.println("----------[1vs1]----------"); System.out.println("Lade Systeme..."); System.out.println("Pruefe Version..."); if (!isRightVersion()) { System.out.println("Fail! Diese Version ist nicht kompatibel!"); System.out.println("Plugin wird abgeschaltet!"); Bukkit.getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin(getName())); return; } if (!isSpigot()) { System.out.println("Fail! Dieser Server verwendet kein Spigot!"); System.out.println("Installiere bitte Spigot!"); System.out.println("Plugin wird abgeschaltet!"); Bukkit.getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin(getName())); return; } System.out.println("Ok! Pruefe Config..."); defaultFile();//TODO new configMgr(ins).reloadData(false); if(!reduceStartDebugInfo) System.out.println("Ok! Regestriere Listener..."); regListener(); if(!reduceStartDebugInfo) System.out.println("Ok! Regestriere Commands..."); regCommands(); if(!reduceStartDebugInfo) System.out.println("Ok! Regestriere Methoden..."); regMethoden();// OK if(!reduceStartDebugInfo) System.out.println("Ok! Regestriere Guide..."); regGuide(); if(!reduceStartDebugInfo) System.out.println("Ok! Regestriere Arenen..."); regArena(); if(!reduceStartDebugInfo) System.out.println("Ok! Lade Nachrichten..."); if (!getPluginFile("language").exists()) createLanguage(false); if (!getPluginFile("book").exists()) createBook(false); if (!getPluginFile("scoreboard").exists()) createScoreboardFile(false); reloadBook(); reloadScoreboardFile(); if(!reduceStartDebugInfo) System.out.println("Ok! Pruefe, ob eine neue Version vefuegbar ist..."); getNewVersion(); if(!reduceStartDebugInfo) System.out.println("Ok! Alle Dateien geladen!"); if(!reduceStartDebugInfo) System.out.println("Lösche alte ACS-Arenen"); new Manager(ins).deleteACSArenas(); if (resetAllArenasOnStart) { if(!reduceStartDebugInfo) System.out.println("Ok! Resete alle Arenen..."); getRAMMgr().deleteRAMAll(); new ResetMethoden(ins).resetAllArenas(); } else { if(!reduceStartDebugInfo) System.out.println("Ok! Resete alle gebrauchten Arenen..."); Bukkit.getScheduler().runTaskAsynchronously(ins, new Runnable() { @Override public void run() { int resetet = new ResetMethoden(ins).resetAllArenasUsed(); if (resetet == 1) if(!reduceStartDebugInfo) System.out.println("Eine Arena wird zurückgesetzt!"); else if(!reduceStartDebugInfo) System.out.println(resetet + " Arenen werden zurueckgesetzt!"); } }); } if(!reduceStartDebugInfo) System.out.println("Ok! Lade Kiteditor..."); loadKitEdit.loadKitEditRegion(); if(!reduceStartDebugInfo) System.out.println("Ok! Lade Warteschlange und Kit-Einstellungen..."); spawnQueque.respawner(); spawnQueque.despawnQuequeZombie(); spawnQueque.spawnQuequeZombie(); spawnPrefVillager.respawner(); spawnPrefVillager.despawnPrefVillager(); spawnPrefVillager.spawnNewPrefVillager(); spawnBlackDealer.respawner(); spawnBlackDealer.despawnBlackDealer(); spawnBlackDealer.spawnBlackDealerE(); if(!reduceStartDebugInfo) System.out.println("Ok! Pruefe auf Vault..."); if(!reduceStartDebugInfo) System.out.println(" - Vault ist installiert!"); if (getServer().getPluginManager().getPlugin("Vault") != null) { if (cfgEconomy) { if (checkEconomyPlugin()) { if(!reduceStartDebugInfo) System.out.println(" - Ein Economy Plugin ist installiert!"); setupEconomy(); useEconomy = true; } else { if(!reduceStartDebugInfo) System.out.println(" - Es ist kein Economy Plugin installiert!"); } } else { useEconomy = false; } if (checkPermPlugin()) { if(!reduceStartDebugInfo) System.out.println(" - Ein Permissions Plugin ist installiert!"); setupPermission(); } else { if(!reduceStartDebugInfo) System.out.println(" - Es ist kein Permissions Plugin installiert!"); } } else { if(!reduceStartDebugInfo) System.out.println("Vault ist nicht installiert!"); } if(!reduceStartDebugInfo) System.out.println("Ok! Checke und lade Arenen..."); getAState().checkAllArenas(); if(!reduceStartDebugInfo) System.out.println("Ok! Starte Core..."); MainScheduler.startMainSchedule(); if (useMySQL) { if(!reduceStartDebugInfo) System.out.println("Ok! Versuche eine Verbindung zur MySQL Datenbank aufzubauen..."); new MySQLManager(ins); MySQLManager.connect(); MySQLManager.checkConnect(); checkData(); } else { if(!reduceStartDebugInfo) System.out.println("Ok! Verbinde mit SQL Datenbank..."); startSQLLite(); checkData(); } new BukkitRunnable() { @Override public void run() { addSQLRows(); for (Player players : Bukkit.getOnlinePlayers()) { addUser(players); updatePrefs(players.getUniqueId()); } } }.runTaskAsynchronously(ins); new SignMethods(ins).reloadJoinSigns(); new SignMethods(ins).refreshJoinSigns(); Version = getServerVersion(); updateDefaultPref(); if(!reduceStartDebugInfo) System.out.println("Ok! Starte Metrics..."); startMetrics(); if(!reduceStartDebugInfo) System.out.println("Ok! Spawne KitStands..."); new KitStands(ins).spawnStands(); if (BungeeMode) { if(!reduceStartDebugInfo) System.out.println("Ok! Teleportiere alle Spieler in die 1vs1 Lobby..."); for (Player p : Bukkit.getOnlinePlayers()) MainCommand.toggle1vs1(p, true, false); } if (ACSEnabled) { if(!reduceStartDebugInfo) System.out.println("Ok! Prüfe auf ACS-Welt"); if (Bukkit.getWorld(ACSWorld) == null) { if(!reduceStartDebugInfo) System.out.println("Keine Welt gefunden... Erstelle neue!"); Bukkit.createWorld(new WorldCreator(ACSWorld).type(WorldType.FLAT).generateStructures(false)); Bukkit.getWorld(ACSWorld).setGameRuleValue("doMobSpawning", "false"); Bukkit.getWorld(ACSWorld).setGameRuleValue("doDaylightCycle", "false"); Bukkit.getWorld(ACSWorld).setTime(6000); for (Entity en : Bukkit.getWorld(ACSWorld).getEntities()) if (!(en instanceof Player)) en.remove(); if(!reduceStartDebugInfo) System.out.println("ACS-Welt erstellt!"); } if(!reduceStartDebugInfo) System.out.println("Ok! ACS-Welt gefunden!"); if(!reduceStartDebugInfo) System.out.println("Generiere ACS-Arenen"); Manager mgr = new Manager(ins); mgr.generateBase(ACSMin, ACSMax); } if(!reduceStartDebugInfo) System.out.println("Ok! Checke, ob die zeitlichen Statistiken zurueckgesetzt werden muessen!"); long current = System.currentTimeMillis(); long saved24h = lastTimedStatReset24h; long saved30d = lastTimedStatReset; long dayLength = (long)86400000*(long)30; long toCheck = saved30d+dayLength; if(current>toCheck) { if(!reduceStartDebugInfo) System.out.println("30 Tage Statistiken werden Resetet..."); YamlConfiguration cfg = defaultYML(); cfg.set("config.lastTimedStatReset", (long)System.currentTimeMillis()); try { timedStatResetTime = (long)System.currentTimeMillis(); cfg.save(defaultFile()); Bukkit.getScheduler().runTaskAsynchronously(ins, new Runnable() { @Override public void run() { getDBMgr().reset30DayStats(); } }); } catch (Exception e) {} } dayLength = (long)86400000; toCheck = saved24h+dayLength; if(current>toCheck) { if(!reduceStartDebugInfo) System.out.println("24h Statistiken werden Resetet..."); YamlConfiguration cfg = defaultYML(); cfg.set("config.lastTimedStatReset24h", (long)System.currentTimeMillis()); try { timedStatResetTime = (long)System.currentTimeMillis(); cfg.save(defaultFile()); Bukkit.getScheduler().runTaskAsynchronously(ins, new Runnable() { @Override public void run() { getDBMgr().reset24hStats(); } }); } catch (Exception e) {} } System.out.println("Ok!"); System.out.println("Alle Systeme wurden erfolgreich geladen!"); System.out.println("----------[1vs1]----------"); } }, 1); } public static main instance() { return ins; } private void addSQLRows() { if(!getDBMgr().checkAllRowsExists()) { if(useMySQL) { PreparedStatement ps = null; try { if(getDBMgr().getNotExistingRows().toLowerCase().contains("disabledmaps")) { ps = MySQLManager.getConnection().prepareStatement("ALTER TABLE `1vs1Kits` ADD `DisabledMaps` LONGTEXT NOT NULL AFTER `DefaultKit`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("rankpoints")) { ps = MySQLManager.getConnection().prepareStatement("ALTER TABLE `1vs1Kits` ADD `RankPoints` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("fights30")) { ps = MySQLManager.getConnection().prepareStatement("ALTER TABLE `1vs1Kits` ADD `Fights30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("fightswon30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `FightsWon30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if(getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit1Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit1Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit2Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit2Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit3Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit3Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit4Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit4Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit5Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays30")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit5Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays24h")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit1Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays24h")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit2Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays24h")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit3Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays24h")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit4Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays24h")) { ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1Kits` ADD `Kit5Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} if(ps != null) { try { ps.close(); } catch (SQLException e) {} } } else { PreparedStatement ps = null; try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("disabledmaps")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `DisabledMaps` LONGTEXT NOT NULL AFTER `DefaultKit`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("rankpoints")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `RankPoints` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("fights30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Fights30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("fightswon30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `FightsWon30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if(getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit1Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit1Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit2Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit2Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit3Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit3Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit4Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit4Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit5Plays` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays30")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit5Plays30` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit1plays24h")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit1Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit2plays24h")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit2Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit3plays24h")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit3Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit4plays24h")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit4Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} try { if (getDBMgr().getNotExistingRows().toLowerCase().contains("kit5plays24h")) { ps = Database.getCon().prepareStatement( "ALTER TABLE `KitDatabase` ADD `Kit5Plays24h` LONGTEXT NOT NULL AFTER `DisabledMaps`"); ps.executeUpdate(); } } catch (SQLException e) {} if(ps != null) { try { ps.close(); } catch (SQLException e) {} } } } } public void startMetrics() { Metrics metrics = new Metrics(this); metrics.addCustomChart(new Metrics.SingleLineChart("fights") { @Override public int getValue() { File file = new File("plugins/bStats/1vs1-Stats.yml"); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); return cfg.getInt("Stats.Fights"); } }); } public void updateDefaultPref() { getDBMgr().updatePrefDefault(); } public void updatePrefs(UUID uuid) { getDBMgr().updatePref(uuid, ""); getDBMgr().updatePref(uuid, "2"); getDBMgr().updatePref(uuid, "3"); getDBMgr().updatePref(uuid, "4"); getDBMgr().updatePref(uuid, "5"); } private void startSQLLite() { sql = new SQLite(this); sql.load(); } private void checkData() { if (useMySQL) { Bukkit.getScheduler().runTaskLaterAsynchronously(this, new Runnable() { @Override public void run() { try { PreparedStatement ps = MySQLManager.getConnection() .prepareStatement("CREATE TABLE IF NOT EXISTS 1vs1Kits " + "(PlayerName VARCHAR(100)" + ",UUID VARCHAR(100)" + ",KitInv LONGTEXT" + ",KitArmor LONGTEXT" + ",Settings VARCHAR(150)" + ",QuequePrefs VARCHAR(150)" + ",KitInv2 LONGTEXT" + ",KitArmor2 LONGTEXT" + ",KitSettings2 LONGTEXT" + ",KitInv3 LONGTEXT" + ",KitArmor3 LONGTEXT" + ",KitSettings3 LONGTEXT" + ",KitInv4 LONGTEXT" + ",KitArmor4 LONGTEXT" + ",KitSettings4 LONGTEXT" + ",KitInv5 LONGTEXT" + ",KitArmor5 LONGTEXT" + ",KitSettings5 LONGTEXT" + ",Fights LONGTEXT" + ",FightsWon LONGTEXT" + ",DefaultKit LONGTEXT" + ",DisabledMaps LONGTEXT" + "`RankPoints` longtext," + "`Fights30` longtext," + "`FightsWon30` longtext," + "`Kit1Plays` longtext," + "`Kit1Plays30` longtext," + "`Kit2Plays` longtext," + "`Kit2Plays30` longtext," + "`Kit3Plays` longtext," + "`Kit3Plays30` longtext," + "`Kit4Plays` longtext," + "`Kit4Plays30` longtext," + "`Kit5Plays` longtext," + "`Kit5Plays30` longtext," + "`Kit1Plays24h` longtext," + "`Kit2Plays24h` longtext," + "`Kit3Plays24h` longtext," + "`Kit4Plays24h` longtext," + "`Kit5Plays24h` longtext)"); ps.executeUpdate(); // ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE 1vs1Kits ENGINE=MyISAM ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8"); ps.executeUpdate(); ps = MySQLManager.getConnection().prepareStatement( "ALTER TABLE `1vs1kits` ADD `DisabledMaps` LONGTEXT NOT NULL AFTER `DefaultKit`"); ps.executeUpdate(); } catch (SQLException e) { } try { PreparedStatement ps = MySQLManager.getConnection() .prepareStatement("ALTER TABLE `1vs1kits` ADD `RankPoints` LONGTEXT NOT NULL"); ps.executeUpdate(); } catch (Exception e) { } } }, 0); } else { Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() { @Override public void run() { try { PreparedStatement ps = sql.getSQLConnection().prepareStatement("ALTER TABLE " + Database.table + " ADD `DisabledMaps` LONGTEXT NOT NULL AFTER `DefaultKit`"); ps.executeUpdate(); } catch (Exception e) { } try { PreparedStatement ps = sql.getSQLConnection() .prepareStatement("ALTER TABLE " + Database.table + " ADD `RankPoints` NOT NULL LONGTEXT"); ps.executeUpdate(); } catch (Exception e) { } } }); } } @Override public void onDisable() { System.out.println("----------[1vs1]----------"); System.out.println("Telepotiere Spieler aus Arenen und co..."); for (Player players : Bukkit.getOnlinePlayers()) { if (OneVSOnePlayers.containsKey(players.getUniqueId()) && OneVSOnePlayers.get(players.getUniqueId()).getSpecator() != null) { players.setAllowFlight(false); players.setFlying(false); } if (this.OneVSOnePlayers.containsKey(players.getUniqueId())) { MainCommand.toggle1vs1(players, false, true); } } System.out.println("Ok! Schliesse Verbindung mit (My)SQL-Datebank..."); if (useMySQL) { try { MySQLManager.getConnection().close(); } catch (SQLException e) { System.out.println("Error while closing MySQL Connection"); } MySQLManager.disconnect(); } else { if (sql != null && sql.getSQLConnection() != null) { try { sql.getSQLConnection().close(); sql = null; } catch (SQLException e) { } } } System.out.println("Ok! Loesche Enchant Inventare..."); for (EnchantingInventory ei : this.inventories) ei.setItem(1, null); this.inventories = null; System.out.println("Ok! Spieler werden zurückgesetzt"); for(OneVsOnePlayer players : OneVSOnePlayers.values()) { players.getPlayer().closeInventory(); players.getPlayer().spigot().setCollidesWithEntities(true); } System.out.println("Ok! Despawne QuequeZombie und Settings-Villager..."); spawnPrefVillager.despawnPrefVillager(); spawnQueque.despawnQuequeZombie(); spawnBlackDealer.despawnBlackDealer(); System.out.println("Ok! Despawne KitStands..."); new KitStands(this).removeCurrent(); System.out.println("Ok! Letzter Cleanup..."); System.out.println("Ok!"); System.out.println("Alles erledigt fahre Plugin herunter... zZZZZ"); System.out.println("----------[1vs1]----------"); } private void regCommands() { new Command_Manager(this); new MainCommand(this); getCommand("1vs1").setExecutor(new MainCommand(this)); new Endmatch(this); new Kit(this); new Surrender(this); new Spec(this); new Stats(this); new Tournament(this); new Join(this); new Create(this); new Leave(this); new Win(this); new Team(this); new TLeave(this); new Start(this); new KitStats(this); } private void regListener() { new Region_Edit(this); new Kit_Editor_Move(this); new Blocked_Events(this); new Warteschlange_Manager(this); new KillEvent(this); new SpectateArenaItemManager(this); new SignManager(this); new PlayerQueqeChangeSettings(this); new Multi_Kit_Manager(this); new ChallangeManager(this); new Tournament_Creator_InvManager(this); new Tournament_Events(this); new DisableMapsManager(this); new TeamManager(this); new KitStandsInvManger(this); new LobbyTournamentItemManager(this); msgs = new NewMsgLoader(this); msgs.reloadAllMessages(); } public void regGuide() { new Inv_Opener(this); new BaseInv(this); new LayoutInv(this); new ArenaInv(this); new OtherInv(this); new OtherSignInv(this); new OtherSkullInv(this); } private void regArena() { new CopyArena(this); new DeleteArena(this); new ArenaJoin(this); new ArenaEvents(this); new RemoveEntitys(this); new Preferences_Manager(this); new openArenaCheckInv(this); new Spectator_Events(this); new ArenaMenu(this); new BlackDealerInvCreator(this); new BlackDealerInvManager(this); } private void regMethoden() { new loadKitEdit(this); new spawnQueque(this); new MainScheduler(this); new FightEnd(this); new FightEndTeam(this); new spawnPrefVillager(this); new SpectateArena(this); new SignMethods(this); new QuequePrefsMethods(this); new MessageReplacer(this); new KitMessages(this); new getItems(this); new ScoreBoardManager(this); new QueueManager(this); new spawnBlackDealer(this); } public YamlConfiguration defaultYML() { if (defaultFile() != null) { YamlConfiguration cfg = YamlConfiguration.loadConfiguration(defaultFile()); return cfg; } else return null; } public File defaultFile() { File file = new File("plugins/1vs1/config.yml"); if (!file.exists()) { try { file.createNewFile(); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); file = new File("plugins/1vs1/config.yml"); cfg = YamlConfiguration.loadConfiguration(file); generateDefaultFileConfig(false); cfg.save(file); } catch (Exception e) { e.printStackTrace(); } } return file; } public void generateDefaultFileConfig(boolean reset) { if (!reset) { File file = new File("plugins/1vs1/config.yml"); if (!file.exists()) saveResource("config.yml", reset); } else saveResource("config.yml", reset); } public File getPluginFile(String Pfad) { File file = new File("plugins/1vs1/" + Pfad + ".yml"); if (!file.exists() || file == null) { try { YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); cfg.save(file); } catch (IOException e) { saveErrorMethod.saveError(AllErrors.FileFail, getClass().getName(), "File: " + Pfad); e.printStackTrace(); return null; } } return file; } public boolean existFile(String Pfad) { File file = new File("plugins/1vs1/" + Pfad + ".yml"); try { if (!file.exists() || file == null) return false; } catch (Exception e) { return false; } return true; } public YamlConfiguration getYaml(String Pfad) { if (getPluginFile(Pfad) != null) { YamlConfiguration cfg = YamlConfiguration.loadConfiguration(getPluginFile(Pfad)); return cfg; } return null; } private boolean isRightVersion() { if (getVersion().equalsIgnoreCase("1.7"))return false; return true; } public static String getVersion() { String Version = Bukkit.getVersion(); if (Version.contains("1.7")) return "1.7"; if (Version.contains("1.8") || Version.contains("1.8.1") || Version.contains("1.8.2") || Version.contains("1.8.3") || Version.contains("1.8.4") || Version.contains("1.8.5") || Version.contains("1.8.6") || Version.contains("1.8.7") || Version.contains("1.8.8") || Version.contains("1.8.9")) return "1.8"; else return "Weder 1.7 noch 1.8"; } private boolean isSpigot() { String Version = Bukkit.getVersion(); String[] splitVersion1 = Version.split("-"); if (splitVersion1.length >= 2) if (splitVersion1[1].toLowerCase().contains("spigot") || splitVersion1[1].toLowerCase().contains("paperspigot")) return true; return false; } public void createLanguage(boolean overWrite) { if (overWrite) { try { InputStream is = null; OutputStream os = null; try { is = new FileInputStream(getPluginFile("language")); os = new FileOutputStream(getPluginFile("old_language")); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) os.write(buffer, 0, length); } finally { is.close(); os.close(); } } catch (IOException e1) { e1.printStackTrace(); } saveResource("language.yml", true); } else { saveResource("language.yml", false); } } public void createBook(boolean overWrite) { if (overWrite) { try { InputStream is = null; OutputStream os = null; try { is = new FileInputStream(getPluginFile("book")); os = new FileOutputStream(getPluginFile("old_book")); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) os.write(buffer, 0, length); } finally { is.close(); os.close(); } } catch (IOException e1) { e1.printStackTrace(); } saveResource("book.yml", true); } else { saveResource("book.yml", false); } } public void createScoreboardFile(boolean overWrite) { if (overWrite) { try { InputStream is = null; OutputStream os = null; try { is = new FileInputStream(getPluginFile("scoreboard")); os = new FileOutputStream(getPluginFile("old_scoreboard")); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) os.write(buffer, 0, length); } finally { is.close(); os.close(); } } catch (IOException e1) { e1.printStackTrace(); } saveResource("scoreboard.yml", true); } else { saveResource("scoreboard.yml", false); } } @SuppressWarnings("static-access") public void reloadBook() { File file = getPluginFile("book"); YamlConfiguration cfg = new YamlConfiguration().loadConfiguration(file); if (file.exists()) { try { cfg.loadFromString(Files.toString(file, Charset.forName("UTF-8"))); } catch (InvalidConfigurationException e) { getLogger().log(Level.WARNING, "A error eccourd while loading language file!", e); return; } catch (Exception e) { getLogger().log(Level.WARNING, "A error eccourd while loading language file!", e); return; } } if (cfg.getConfigurationSection("Book") != null) { int pageN = 1; for (String page : cfg.getConfigurationSection("Book").getKeys(false)) { String p = cfg.getString("Book." + page); if (p == null || p.equalsIgnoreCase("")) p = null; book.put(pageN, p); pageN++; } } else { createBook(true); reloadBook(); } } @SuppressWarnings("static-access") public void reloadScoreboardFile() { File file = getPluginFile("scoreboard"); YamlConfiguration cfg = new YamlConfiguration().loadConfiguration(file); if (file.exists()) { try { cfg.loadFromString(Files.toString(file, Charset.forName("UTF-8"))); } catch (InvalidConfigurationException e) { getLogger().log(Level.WARNING, "A error eccourd while loading language file!", e); return; } catch (Exception e) { getLogger().log(Level.WARNING, "A error eccourd while loading language file!", e); return; } } if (cfg.getConfigurationSection("Groups") == null) { cfg.set("Groups.exmp.prefix", "&f"); cfg.set("Groups.exmp.suffix", "&f"); cfg.set("Groups.exmp.permission", "1vs1.sb.exmp"); cfg.set("Groups.exmp.group", "exmpgroup"); cfg.set("Groups.exmp.default", true); try { cfg.save(file); } catch (IOException e) {} } } public void sendNoPermsMessage(Player p) { p.sendMessage(noPerms); } public String getServerVersion() { String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; return version; } public void addUser(final Player p) { Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() { @Override public void run() { if (useMySQL) { if (!MySQLManager.isUserExists(p.getUniqueId())) { MySQLManager.addUser(p.getUniqueId(), p.getName()); MySQLManager.updatePref(p.getUniqueId(), ""); MySQLManager.updatePref(p.getUniqueId(), "2"); MySQLManager.updatePref(p.getUniqueId(), "3"); MySQLManager.updatePref(p.getUniqueId(), "4"); MySQLManager.updatePref(p.getUniqueId(), "5"); MySQLManager.setKit(p.getUniqueId(), MySQLManager.getDefault(false), false, ""); MySQLManager.setKit(p.getUniqueId(), MySQLManager.getDefault(true), true, ""); for (PlayerPrefs pref : PlayerPrefs.values()) { String prefs = "" + MySQLManager.getPrefDefault(Preferences_Manager.getPrefID(pref)); boolean state = false; if (prefs.equalsIgnoreCase("true") || prefs.equalsIgnoreCase("t")) { state = true; } MySQLManager.setPref(p.getUniqueId(), Preferences_Manager.getPrefID(pref), state, ""); } } } else { if (!Database.isUserExists(p.getUniqueId())) { Database.addUser(p.getUniqueId(), p.getName()); Database.updatePref(p.getUniqueId(), ""); Database.updatePref(p.getUniqueId(), "2"); Database.updatePref(p.getUniqueId(), "3"); Database.updatePref(p.getUniqueId(), "4"); Database.updatePref(p.getUniqueId(), "5"); } } } }); } public void getNewVersion() { new BukkitRunnable() { @Override public void run() { String resource = "30355"; String spigotVersion = ""; try { HttpURLConnection con = (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php") .openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.getOutputStream() .write(("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + resource) .getBytes("UTF-8")); String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine(); if (version.length() <= 20) spigotVersion = version; } catch (Exception ex) { getLogger().info("Failed to get Version String..."); return; } if (updateNoti) { if (!getDescription().getVersion().contains(spigotVersion)) { for (Player players : Bukkit.getOnlinePlayers()) { if (players.hasPermission("1vs1.*") || players.hasPermission("1vs1.seeUpdate") || players.hasPermission("1vs1.Admin")) { players.sendMessage("§7§m§l============================================="); players.sendMessage(""); players.sendMessage("§7Eine neue Version des §6§l1vs1-Plugins §r§7von JHammer17"); players.sendMessage("§7steht nun zum §6§lDownload §r§7bereit!"); players.sendMessage(""); players.sendMessage(""); players.sendMessage("§7Download:"); players.sendMessage("§6https://www.spigotmc.org/resources/30355"); players.sendMessage(""); players.sendMessage("§7Neue Version: §6§l" + spigotVersion); players.sendMessage(""); players.sendMessage("§7§m§l============================================="); } } } } if (!getDescription().getVersion().contains(spigotVersion)) { Bukkit.getScheduler().runTaskLater(ins, new Runnable() { @Override public void run() { getLogger().info("Eine neue Version des Timolia-1vs1 Plugins ist verfuegbar!"); } }, 20); } } }.runTaskAsynchronously(this); } private boolean checkEconomyPlugin() { RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager() .getRegistration(net.milkbowl.vault.economy.Economy.class); return economyProvider != null ? true : false; } private boolean checkPermPlugin() { RegisteredServiceProvider<Permission> permProvider = getServer().getServicesManager() .getRegistration(net.milkbowl.vault.permission.Permission.class); return permProvider != null ? true : false; } private boolean setupEconomy() { RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager() .getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) economy = economyProvider.getProvider(); return (economy != null); } private boolean setupPermission() { RegisteredServiceProvider<Permission> permProvider = getServer().getServicesManager() .getRegistration(net.milkbowl.vault.permission.Permission.class); if (permProvider != null) permissionmgr = permProvider.getProvider();//TODO return (permissionmgr != null); } public PositionManager getPositions() { if (getPos == null) getPos = new PositionManager(this); return this.getPos; } public ManageRAMData getRAMMgr() { if (ramMgr == null) ramMgr = new ManageRAMData(this); return this.ramMgr; } public DBMainManager getDBMgr() { if (DBMgr == null) DBMgr = new DBMainManager(this); return this.DBMgr; } public ArenaState getAState() { if (aState == null) aState = new ArenaState(this); return this.aState; } public Teleport getTeleporter() { if (teleport == null) teleport = new Teleport(this); return this.teleport; } public int calcPerc(int a, int max) { double perc = ((double) a / (double) max) * 100; return (int) perc; } public YamlConfiguration getScoreboardData() { return getYaml("scoreboard"); } public String colorByPercent(int a, int max, final String msg, String defaultColor, String colorColor) { if(a == max) return new String(colorColor + msg); int ln = new String(msg).length(); String[] split = new String(msg).split(""); double percent = (((double)a/(double)max)*100.0); double toColor = ((double)ln/(double)100)*percent; if(toColor >= split.length) return new String(colorColor + msg); split[(int) toColor] = defaultColor + split[(int) toColor]; boolean first = true; StringBuilder builder = new StringBuilder(); for(String str : split) { if(first) { builder.append(colorColor); first = false; } builder.append(str); } return builder.toString(); } public OneVsOnePlayer getOneVsOnePlayer(Player p) { if(p == null) return new OneVsOnePlayer(p); if(OneVSOnePlayers.containsKey(p.getUniqueId())) { return OneVSOnePlayers.get(p.getUniqueId()); } return new OneVsOnePlayer(p); } public OneVsOnePlayer getOneVsOnePlayer(UUID uuid) { if(Bukkit.getPlayer(uuid) == null) return new OneVsOnePlayer(Bukkit.getPlayer(uuid)); if(OneVSOnePlayers.containsKey(Bukkit.getPlayer(uuid).getUniqueId())) return OneVSOnePlayers.get(Bukkit.getPlayer(uuid).getUniqueId()); return new OneVsOnePlayer(Bukkit.getPlayer(uuid)); } public int getOneVsOnePlayerSize() { return OneVSOnePlayers.size(); } public void removePlayer(UUID uuid) { while(OneVSOnePlayers.containsKey(uuid)) OneVSOnePlayers.remove(uuid); } public boolean isInOneVsOnePlayers(UUID uuid) { return OneVSOnePlayers.containsKey(uuid); } public void addPlayer(UUID uuid) { if(Bukkit.getPlayer(uuid) != null) { OneVsOnePlayer player = new OneVsOnePlayer(Bukkit.getPlayer(uuid)); player.init(); OneVSOnePlayers.put(uuid, player); } } @SuppressWarnings("unchecked") public HashMap<UUID, OneVsOnePlayer> getOneVsOnePlayersCopy() { return (HashMap<UUID, OneVsOnePlayer>) OneVSOnePlayers.clone(); } }
[ "infojhammer@web.de" ]
infojhammer@web.de
a821a3fe71c41ac878e69538929de594a22d8948
40093e55e30af87b6f77135a2a07552a166df1a1
/102.java
da5671a78eed33e2dd3ffaddc71f6230426e07d2
[]
no_license
WendingLin/LC_ZERO
36cc9bb53ca60b3a34bc90cd934c835ae65c3d35
8f6365383a1c44aa2e9562a0cfca205f67baaa10
refs/heads/master
2020-05-02T02:31:23.572298
2019-10-07T21:44:43
2019-10-07T21:44:43
177,706,224
0
0
null
null
null
null
UTF-8
Java
false
false
880
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { List<List<Integer>> res = new ArrayList<List<Integer>>(); public List<List<Integer>> levelOrder(TreeNode root) { if (root == null) return res; Queue<TreeNode> queue = new LinkedList<TreeNode>(); queue.offer(root); // ini while (queue.isEmpty() == false) { // each level Queue<TreeNode> temp = new LinkedList<TreeNode>(); List<Integer> partres = new ArrayList<Integer>(); for (TreeNode node : queue) { if (node.left != null) temp.offer(node.left); if (node.right != null) temp.offer(node.right); partres.add(node.val); } res.add(partres); queue = temp; } return res; } }
[ "lycoris000@126.com" ]
lycoris000@126.com
9b373d64f1d5d256af5b0c2e8f219e02576fb22d
7ce853deebc84e5eb572f72bc26de688033324c7
/src/main/java/com/chozoi/convertdata/processors/product/ShopStreams/ShopProductStreams.java
a2cebf2fe21f9c39c67da4ec81a2053468c82ab9
[]
no_license
nguyenkhanhgithub/convert-data
0d26f167f4d1e9e56544737ddadad56a9346cf69
c50a810749af24994ab01e9b201955cdea96df0b
refs/heads/master
2022-12-14T05:59:51.121302
2020-09-10T02:33:02
2020-09-10T02:33:02
294,281,887
0
0
null
null
null
null
UTF-8
Java
false
false
5,331
java
package com.chozoi.convertdata.processors.product.ShopStreams; import chozoi.products.domain_event.Key; import chozoi.products.domain_event.Value; import chozoi.products.stats.ShopProductStats; import com.chozoi.convertdata.processors.product.TopicConfig; import com.chozoi.convertdata.processors.product.values.ProductEventContent; import com.chozoi.convertdata.processors.product.values.ProductState; import com.chozoi.convertdata.processors.product.values.ProductState.*; import com.chozoi.convertdata.utils.CustomSerdes; import com.chozoi.convertdata.utils.EventContentUtils; import com.chozoi.convertdata.utils.MessagePack; import lombok.extern.log4j.Log4j2; import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.common.utils.Bytes; import org.apache.kafka.streams.kstream.*; import org.apache.kafka.streams.state.KeyValueStore; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.nio.ByteBuffer; import java.util.Map; import java.util.Objects; @Log4j2 @Configuration public class ShopProductStreams extends BaseStreams{ public static final String SHOP_PRODUCT_STATS_STORE = "shop.products.stats.store"; @Bean public KStream<Integer, ProductEventContent> shopProductStateStream( @Qualifier("productStateEventStream") KStream<Key, Value> productStateEventStream) { return productStateEventStream .mapValues(this::eventContentToObject) .filter( (key, shopProductContent) -> { Map<String, Object> map = objectToMap(shopProductContent); if (map!=null && map.get("auction") == null) { log.info("chay vao null auction"); log.info(map.get("productId") + "==============>" + map.toString()); return true; } else { log.info("chay vao auction"); log.info(map.get("productId") + "==============>" + map.toString()); return false; } }) .selectKey((key, value) -> value.getShopId()); } @Bean public KStream<Integer, ProductEventContent> shopProductStatsStream( @Qualifier("shopProductStateStream") KStream<Integer, ProductEventContent> shopProductStateStream) { KTable<Integer, ShopProductStats> longTermStats = shopProductStateStream .groupByKey( Serialized.with(Serdes.Integer(), CustomSerdes.json(ProductEventContent.class))) .aggregate( this::emptyStats, this::aggregateShopProduct, Materialized.<Integer, ShopProductStats, KeyValueStore<Bytes, byte[]>>as( SHOP_PRODUCT_STATS_STORE) .withKeySerde(Serdes.Integer())); longTermStats .toStream() .peek( (key, value) -> { log.debug( "SHOP_PRODUCT_STATS_TOPIC:" + key + " -------> " + value); }) .selectKey((key, value) -> key.toString()) .to(TopicConfig.SHOP_PRODUCT_STATS_TOPIC, Produced.keySerde(Serdes.String())); return shopProductStateStream; } private ShopProductStats emptyStats() { return ShopProductStats.newBuilder().build(); } private ShopProductStats aggregateShopProduct( Integer shopId, ProductEventContent newProductEvent, ShopProductStats currentStats) { ShopProductStats.Builder statsBuilder = ShopProductStats.newBuilder(currentStats); statsBuilder.setShopId(shopId); Map<String, Object> map = objectToMap(newProductEvent); String state = map.get("state") != null ? String.valueOf(map.get("state")) : null; if (!state.equals(String.valueOf(ProductState.DELETED))) { statsBuilder.setCountProduct(currentStats.getCountProduct() + 1); } addCountByState(statsBuilder, state, currentStats); return statsBuilder.build(); } private void addCountByState(ShopProductStats.Builder statsBuilder, String state, ShopProductStats currentStats) { switch (state) { case "DRAFT": statsBuilder.setCountDraftProduct(currentStats.getCountDraftProduct() + 1); break; case "PENDING": statsBuilder.setCountPendingProduct(currentStats.getCountPendingProduct() + 1); break; case "READY": statsBuilder.setCountReadyProduct(currentStats.getCountReadyProduct() + 1); break; case "PUBLIC": statsBuilder.setCountPublicProduct(currentStats.getCountPublicProduct() + 1); break; case "REJECT": statsBuilder.setCountRejectProduct(currentStats.getCountRejectProduct() + 1); break; case "REPORT": statsBuilder.setCountReportProduct(currentStats.getCountReportProduct() + 1); break; case "DELETED": statsBuilder.setCountDeletedProduct(currentStats.getCountDeletedProduct() + 1); break; } } private ProductEventContent eventContentToObject(Value event) { ByteBuffer buf = event.getContent(); byte[] arr = buf.array(); ProductEventContent productEventContent = MessagePack.byteaToObject(arr, ProductEventContent.class); productEventContent.setEventType(event.getType()); return productEventContent; } }
[ "khanhn@midas-creative.com" ]
khanhn@midas-creative.com
e4c7407e1d6d4b2e49f4d928e1b1d96fe599f643
0c8389794cf320edbdae29e31c84fb9b8d779878
/DesignPattern_Practice_6_Adapter/src/KoreaWildTurkey.java
03c5ea483bc020549add09cd44710c54df76110d
[]
no_license
KangYoungkil/DesignPattern_Java
1cd9eee0e4ad9806becf9f55c1fdc46e61c8bae7
94187e5d32382e7058c744c4fe1a4dfb9dbff003
refs/heads/master
2016-09-05T22:56:24.750469
2014-11-17T00:15:28
2014-11-17T00:15:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
public class KoreaWildTurkey extends WildTurkey implements KoreaTurkey{ public void gobble() { System.out.println("꿱꿱"); } public void fly() { System.out.println("조금 더 날아"); } public void gobble(int n) { for(int i=0;i<n;i++) System.out.println("꿱꿱"); } public void fly(int n) { for(int i=0;i<n;i++) System.out.println("조금 더 날아"); } }
[ "Bross@192.168.10.103" ]
Bross@192.168.10.103
1db32e7aebcce2938962172c417c174619ce6562
07deb33bc5718b04e1d7f7c71748dcbac6384008
/src/main/java/org/smart4j/customer/model/Customer.java
7641d5a1f1fc4f1b3218d87d3443a6deb749ba0e
[]
no_license
sydml/servlet-demo
4f51b74976ab2a79904bc4b42d43a61ca62c8d8a
650ab26fe7c07305a6db9f0883cdf6d13075159d
refs/heads/master
2020-03-24T21:32:06.651775
2018-08-04T02:49:35
2018-08-04T02:49:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package org.smart4j.customer.model; /** * Created by Yuming-Liu * 日期: 2018-07-30 * 时间: 21:43 */ public class Customer { private Long id; private String name; private String contact; private String telephone; private String email; private String remark; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
[ "lymlzjtu@163.com" ]
lymlzjtu@163.com
46e1c544939e06b16622884452e789aca3b96568
548dca70082f15103ce9cfd67991830229196cbd
/PheonixApp/src/edu/saintjoe/cs/zacha/pheonixapp/PheonixActivity.java
7aaf1cfe5c1aeb0882ae91cdae2644e7f8feb38c
[]
no_license
zacharing/ZJAPhoenixApp
411133a68b8bd0612881f8f7351f8ebde7df2f00
1f17598ecd7acf7f78c8336175b3e30a68e1c7d1
refs/heads/master
2020-05-18T06:35:32.116700
2015-03-25T19:46:29
2015-03-25T19:46:29
32,885,641
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package edu.saintjoe.cs.zacha.pheonixapp; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class PheonixActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pheonix); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.pheonix, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "zaw9998@saintjoe.edu" ]
zaw9998@saintjoe.edu
45ded304e4da5a2cbb3a33a6d2b0b55cb39bc7f5
147fa24bc83a2f6952ce4ae2861f6d8973bbf528
/src/vnmrj/src/vnmr/ui/ParamArrayTable.java
88243835fa0bc2a9ecf35cf98e202d6c2b62ecc8
[]
no_license
rodrigobmg/ovj3
6860c19f0469b8ddc51bee208b3c3a00e36af27d
ab92686b5d8f1eec98021acdd08688cfee651e7f
refs/heads/master
2021-01-23T13:37:06.107967
2016-02-29T01:13:25
2016-02-29T01:13:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,692
java
/* * Copyright (C) 2015 University of Oregon * * You may distribute under the terms of either the GNU General Public * License or the Apache License, as specified in the README file. * * For more information, see the README file. */ package vnmr.ui; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import javax.swing.table.*; import java.awt.*; import java.awt.event.*; import java.util.*; import vnmr.util.*; /********************************************************** <pre> * Summary: * * </pre> **********************************************************/ public class ParamArrayTable extends JTable implements VTooltipIF { protected static Vector arrayedParams; private static String curParam; private static int curParamRow=-1; public static final int PARAMCOL=0; public static final int DESCCOL=1; public static final int SIZECOL=2; public static final int ORDERCOL=3; public static final int ONOFFCOL=4; public ParamArrayTable(Vector values, Vector header) { super(values, header); JTableHeader tableHeader = getTableHeader(); // set cell renderers TableColumnModel colModel = tableHeader.getColumnModel(); int numCols = colModel.getColumnCount(); for (int i = 0; i < numCols; i++) { TableColumn col = colModel.getColumn(i); col.setCellRenderer(new MyTableCellRenderer()); col.setHeaderRenderer(new MyTableHeaderRenderer()); if(i == 1) col.setPreferredWidth(260); else col.setPreferredWidth(80); } DefaultCellEditor editor = (DefaultCellEditor)getDefaultEditor(TableColumn.class); if(editor != null) { // when editing a table cell, stopCellEditing and removeEditor are // invoked when clicking on other cell or hitting return key. // the change is saved, editor object is discarded, and the cell // is rendered once again. Without clicking other cell or hitting // return, the last value is not saved. // the whole purpose here is to capture the last change in the table // without hitting return. To do that, I need to know who got the focus // while the cell is being editing, then have that object (intuitively // it should be the cell editor) listen to focus and call stopCellEditing // and removeEditor methods to save the last change when it lost the focus. ((JTextField)editor.getComponent()).addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { TableCellEditor celleditor = getCellEditor(); if(celleditor != null) { celleditor.stopCellEditing(); removeEditor(); //this method calls requestFocus(). } } }); } setSelectionBackground(Global.HIGHLIGHTCOLOR); setSelectionForeground(Color.black); setShowGrid(false); setColumnSelectionAllowed(false); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Force the order of rows by assending 'order' sortByOrder(values); resizeAndRepaint(); // Save this for future use. It is kept up to date by // super.setValueAt() arrayedParams = values; if (Util.isNativeGraphics()) { ToolTipManager.sharedInstance().unregisterComponent(this); VTipManager.sharedInstance().registerComponent(this); } addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { Point p = new Point(evt.getX(), evt.getY()); int colIndex = columnAtPoint(p); int rowIndex = rowAtPoint(p); ParamArrayPanel pap; pap = ParamArrayPanel.getParamArrayPanel(); if(pap != null && pap.paramScrollpane != null) { Dimension dim = pap.paramScrollpane.getSize(); pap.paramScrollpane.setPreferredSize(dim); } if(rowIndex != -1 && colIndex != -1) { // Single Click, Update values table for this param // No matter which column they click in, get param // name from column PARAMCOL. curParamRow = rowIndex; setRowSelectionInterval(curParamRow, curParamRow); if(isCellEditable(rowIndex, colIndex)) { editCellAt(rowIndex, colIndex); } String param = (String)getValueAt(rowAtPoint(p), PARAMCOL); // Is this a new param name? if(param.length() > 0) { // Save the new param curParam = param; // Request that the values table be updated. //pap.requestUpdateValueTable(param); if(pap != null) pap.updateCenterPane(param); } int clicks = evt.getClickCount(); if(clicks == 2 && colIndex == ONOFFCOL) { String val = (String)getValueAt(rowIndex, colIndex); if(val.equals("On")) setValueAt("Off", rowIndex, colIndex); else setValueAt("On", rowIndex, colIndex); if(curParamRow == -1) curParamRow = rowIndex; } } } public void mousePressed(MouseEvent evt) { // Find out where the mouse is right now. Point p = new Point(evt.getX(), evt.getY()); int row = rowAtPoint(p); int col = columnAtPoint(p); // Do not allow clicking in col ONOFFCOL to change the // selection. if(row != -1) curParamRow = row; if(curParamRow > getRowCount()) curParamRow = 0; if(curParamRow >= 0) { setRowSelectionInterval(curParamRow, curParamRow); } } }); } public void setTooltip(String str) { } public String getTooltip(MouseEvent evt) { Point p = new Point(evt.getX(), evt.getY()); int colIndex = columnAtPoint(p); int rowIndex = rowAtPoint(p); if(colIndex < 0 || colIndex >= getColumnCount()) return(""); if(rowIndex < 0 || rowIndex >= getRowCount()) return(""); return (String)getValueAt(rowIndex, colIndex); } /************************************************** * Summary: Defines which table cell is to be editable. * **************************************************/ public boolean isCellEditable(int row, int column) { if(column == SIZECOL || column == ONOFFCOL || column == DESCCOL) return false; /* else if(column == ORDERCOL && ((String)getValueAt(row, column)).equals("0")) return false; */ else return true; } public boolean IsImplicitArray(String paramName) { if(paramName.equals("ni") || paramName.equals("ni2") || paramName.equals("ni3")) return true; return false; } /************************************************** * Summary: Called when editing is complete to set a new value. * **************************************************/ public void setValueAt(Object value, int row, int col) { if(value == null) return; //Vector rowVector = new Vector(); String str = (String) value; if(str.length() == 0) return; String name = (String)(((Vector)arrayedParams.elementAt(row)).elementAt(PARAMCOL)); // Has this value changed? if(!str.equals(((Vector)arrayedParams.elementAt(row)).elementAt(col))){ if(col != ORDERCOL || (IsImplicitArray(name) && str.equals("0"))) super.setValueAt(value, row, col); else if(!str.equals("0") && isOrderValid(arrayedParams,value,row)) super.setValueAt(value, row, col); else if(!str.equals("0") && isSwabValid(arrayedParams,value,row)) { swabOrder(arrayedParams,value,row); super.setValueAt(value, row, col); } if(col == PARAMCOL) curParam = str; // After calling super.setValueAt(), the Vector arrayedParams // will be up to date for all values. } } /************************************************** * Summary: Remove the specified row from the table. * **************************************************/ public void removeOneRow(int row) { // Trap for out of bounds if(row >= 0 && row < arrayedParams.size()) { arrayedParams.remove(row); resizeAndRepaint(); } } /************************************************** * Summary: Add a blank row to the table. * **************************************************/ public void addBlankRow() { Vector newRow = new Vector(5); newRow.add(""); newRow.add(""); newRow.add(""); newRow.add(""); newRow.add("On"); arrayedParams.add(0, newRow); // Select the new row. setRowSelectionInterval(0,0); resizeAndRepaint(); } /************************************************** * Summary: Sort the rows by the 'order' entry. * * Since values is a Vector of Vectors, I have to do this * myself instead of using some existing sort routine. **************************************************/ public static void sortByOrder(Vector values) { for (int i=0; i < values.size(); i++) { for (int j=i; j > 0 && getOrder(values, j-1) > getOrder(values, j); j--) { // Swap rows j and j-1 Vector a = (Vector)values.elementAt(j); values.remove(j); values.add(j, values.elementAt(j-1)); values.remove(j-1); values.add(j-1, a); } } } /************************************************** * Summary: Get the order of the given row. * * **************************************************/ public static int getOrder(Vector values, int row) { Vector rowVector = (Vector)values.elementAt(row); String orderString = (String)rowVector.elementAt(ORDERCOL); int order = values.size(); if(ParamArrayPanel.isDigits(orderString)) order = Integer.valueOf(orderString).intValue(); return order; } public void resizeAndRepaint() { super.resizeAndRepaint(); } private boolean isOrderValid(Vector values, Object newOrder, int row) { //test the newOrder for a given row. //the newOrder is not applied to values yet. //valid only if all arrayed parameters of the same order //has the same size. String onoff = (String)(((Vector) values.elementAt(row)).elementAt(ONOFFCOL)); if(onoff.equals("Off")) return false; ParamArrayPanel pap = ParamArrayPanel.getParamArrayPanel(); int thisSize = pap.getActualArraySize(row); for(int i=0; i<values.size(); i++) { int size = pap.getActualArraySize(i); Object order = ((Vector) values.elementAt(i)).elementAt(ORDERCOL); onoff = (String)(((Vector) values.elementAt(i)).elementAt(ONOFFCOL)); if(onoff.equals("On") && order.equals(newOrder) && size != thisSize) return false; } return true; } private boolean isSwabValid(Vector values, Object newOrder, int row) { //make a copy of values and call swabOrder method, i.e., //set the given row to newOrder, swab all parameters that has this //order but has different size to the order the given row had (prevOrder). //test the swabbed Vector. //valid only if after swabbing all arrayed parameters of the same order //has the same size . String onoff = (String)(((Vector) values.elementAt(row)).elementAt(ONOFFCOL)); if(onoff.equals("Off")) return false; Object prevOrder = ((Vector) values.elementAt(row)).elementAt(ORDERCOL); if(((String) prevOrder).length() == 0) return false; Vector swabbed = values; //the swabbed rows indices will be returned as a Vector. Vector swabbedRows = swabOrder(swabbed, newOrder, row); //empty means either swab is not needed (true for isOrderValid), //or swab is not valid. if(swabbedRows == null || swabbedRows.size() == 0) return false; // nothing is swabbed. int newRow = ((Integer) swabbedRows.elementAt(0)).intValue(); return isOrderValid(swabbed, prevOrder, newRow); } private Vector swabOrder(Vector values, Object newOrder, int row) { //save prevOrder and set newOrder for the row. Object prevOrder = ((Vector) values.elementAt(row)).elementAt(ORDERCOL); if(((String) prevOrder).length() == 0) return null; if(prevOrder.equals("0")) { Integer ord = new Integer(values.size()); prevOrder = ord.toString(); } Vector v = (Vector) values.elementAt(row); v.setElementAt(newOrder, ORDERCOL); values.setElementAt(v, row); ParamArrayPanel pap = ParamArrayPanel.getParamArrayPanel(); int thisSize = pap.getActualArraySize(row); Vector swabbedRows = new Vector(); for(int i=0; i<values.size(); i++) { int size = pap.getActualArraySize(i); Object order = ((Vector) values.elementAt(i)).elementAt(ORDERCOL); String onoff = (String)(((Vector) values.elementAt(i)).elementAt(ONOFFCOL)); if(onoff.equals("On") && order.equals(newOrder) && size != thisSize) { swabbedRows.add(new Integer(i)); Vector r = (Vector) values.elementAt(i); r.setElementAt(prevOrder, ORDERCOL); values.setElementAt(r, i); } } return swabbedRows; } class MyTableCellRenderer extends DefaultTableCellRenderer { /** * constructor */ public MyTableCellRenderer() { super(); } // MyTableCellRenderer() public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (table != null) { setForeground(table.getForeground()); if(isSelected) setBackground(Global.HIGHLIGHTCOLOR); else setBackground(table.getBackground()); setFont(table.getFont()); } if (hasFocus) { setBorder( UIManager.getBorder("Table.focusCellHighlightBorder") ); if (table.isCellEditable(row, column)) { super.setForeground( UIManager.getColor("Table.focusCellForeground") ); super.setBackground( table.getBackground() ); } } else { setBorder(noFocusBorder); } setValue(value); setHorizontalAlignment(JTextField.CENTER); return this; } // getTableCellRendererComponent() } // class MyTableCellRenderer class MyTableHeaderRenderer extends DefaultTableCellRenderer { /** * constructor */ public MyTableHeaderRenderer() { super(); } // MyTableHeaderRenderer() public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (table != null) { JTableHeader header = table.getTableHeader(); if (header != null) { setForeground(header.getForeground()); setBackground(header.getBackground()); setFont(header.getFont()); } } setValue(value); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, Color.black)); setHorizontalAlignment(JTextField.CENTER); return this; } // getTableCellRendererComponent() } // class MyTableHeaderRenderer }
[ "timburrow@me.com" ]
timburrow@me.com
d73c0c4c3d1757006648f824e1227870855731ce
8e2b0356fbf46795ea76242570616393764afbec
/TIJ4Example/src/thinking/_11_holding/PriorityQueueDemo/PriorityQueueDemo.java
c94973a6f463ad010724ee60db7fb8c15531d99b
[]
no_license
royalwang/TIJ4Example
491134983499b1ba1186975ed45ad5373b9e4a6d
3bbc3a819ba3792c9d51857dad9ff5d1e316d2f0
refs/heads/master
2021-12-03T06:29:49.351584
2014-04-23T08:18:06
2014-04-23T08:18:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package thinking._11_holding.PriorityQueueDemo; import java.util.*; import thinking._11_holding.QueueDemo.QueueDemo; //: holding/PriorityQueueDemo.java public class PriorityQueueDemo { public PriorityQueueDemo() { PriorityQueue<Integer> priorityQueue = new PriorityQueue<Integer>(); Random rand = new Random(47); for (int i = 0; i < 10; i++) priorityQueue.offer(rand.nextInt(i + 10)); QueueDemo.printQ(priorityQueue); List<Integer> ints = Arrays.asList(25, 22, 20, 18, 14, 9, 3, 1, 1, 2, 3, 9, 14, 18, 21, 23, 25); priorityQueue = new PriorityQueue<Integer>(ints); QueueDemo.printQ(priorityQueue); priorityQueue = new PriorityQueue<Integer>(ints.size(),Collections.reverseOrder()); priorityQueue.addAll(ints); QueueDemo.printQ(priorityQueue); String fact = "EDUCATION SHOULD ESCHEW OBFUSCATION"; List<String> strings = Arrays.asList(fact.split("")); PriorityQueue<String> stringPQ = new PriorityQueue<String>(strings); QueueDemo.printQ(stringPQ); stringPQ = new PriorityQueue<String>(strings.size(),Collections.reverseOrder()); stringPQ.addAll(strings); QueueDemo.printQ(stringPQ); Set<Character> charSet = new HashSet<Character>(); for (char c : fact.toCharArray()) charSet.add(c); // Autoboxing PriorityQueue<Character> characterPQ = new PriorityQueue<Character>(charSet); QueueDemo.printQ(characterPQ); } } /* Output 0 1 1 1 1 1 3 5 8 14 1 1 2 3 3 9 9 14 14 18 18 20 21 22 23 25 25 25 25 23 22 21 20 18 18 14 14 9 9 3 3 2 1 1 A A B C C C D D E E E F H H I I L N N O O O O S S S T T U U U W W U U U T T S S S O O O O N N L I I H H F E E E D D C C C B A A A B C D E F H I L N O S T U W *///:~
[ "776488705@qq.com" ]
776488705@qq.com
075abc046e3ac029f8674c1cb11e8d2c4d9e7806
4a7dba07098f12ebf695199db434a06180a298d8
/CustomInputFormatSol/src/main/java/com/pravritti/CustomInputRecordReader.java
9a882b2ce7fdbf9f32f5c01ae204c9fa6d95706c
[]
no_license
xzanadu/Dezyre
e098d241569456fbf6ca777b53b35b763df5ad77
85e8526d521ab1dcd92bb8424036865dbfa2c19a
refs/heads/master
2021-01-10T01:20:14.692620
2016-03-30T18:02:26
2016-03-30T18:02:26
53,093,136
1
0
null
null
null
null
UTF-8
Java
false
false
2,643
java
package com.pravritti; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.InputSplit; import org.apache.hadoop.mapreduce.RecordReader; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.mapreduce.lib.input.FileSplit; import org.apache.hadoop.util.LineReader; import java.io.IOException; /** * Created by Srinivas Bhagavathula on 3/16/16. */ public class CustomInputRecordReader extends RecordReader<CustomKey, CustomValue>{ private FileSplit fileSplit; private Configuration conf; private boolean processed = false; private CustomKey customKey = new CustomKey(); private CustomValue customValue = new CustomValue(); private LineReader reader; private FSDataInputStream fsdIn; @Override public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException { fileSplit = (FileSplit) inputSplit; conf = taskAttemptContext.getConfiguration(); Path p = fileSplit.getPath(); FileSystem fs = p.getFileSystem(conf); fsdIn = fs.open(p); reader = new LineReader(fsdIn, conf); } @Override public boolean nextKeyValue() throws IOException, InterruptedException { Text value = new Text(); System.out.println("Thi is before" + value.toString() + ">>>>"); reader.readLine(value); String line = value.toString(); if (line != null && !line.equalsIgnoreCase("")) { System.out.println("Thi is after" + line + ">>>>"); String[] values = line.split(";"); customKey.setCdrID(new Text(values[0])); customKey.setCdrType(new IntWritable(Integer.parseInt(values[1]))); customValue.setPhone1(new Text(values[2])); customValue.setPhone2(new Text(values[3])); customValue.setSMSStatusCode(new Text(values[4])); return true; } return false; } @Override public CustomKey getCurrentKey() throws IOException, InterruptedException { return this.customKey; } @Override public CustomValue getCurrentValue() throws IOException, InterruptedException { return this.customValue; } @Override public float getProgress() throws IOException, InterruptedException { return 0; } @Override public void close() throws IOException { } }
[ "xzanadu@gmail.com" ]
xzanadu@gmail.com
3a7c0587d560fe8663897bc901b5cf28835f5e2a
0b1c4b61747b4cfe392327c24c4e1c153c5e1c10
/homework2120/tests/Player.java
bc8623895d1f91842acfbe5f26a7390c9e38d8e9
[]
no_license
steventardojr/schoolProjects
a8c139e9fe03a68f2fbdb30eb244f3d5e4e26b35
a4c1c5ed25858dfdb7ce6923631a395575ecc913
refs/heads/master
2016-09-06T15:59:37.670354
2015-05-09T20:01:05
2015-05-09T20:01:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,152
java
import java.util.ArrayList; /** * CSCI 2120 Fall 2014 * Risk Game Class Player * Authors: Steven Tardo * Date: 10/21/14 **/ public class Player { private String name; private int numberOfArmies; private int unplacedArmies; private ArrayList<Territory> territories; private ArrayList<Continent> continents; public Player() { this.name = null; this.numberOfArmies = 0; this.unplacedArmies = 0; this.territories = null; this.continents = null; } public String getName() { return this.name; } public int getNumberOfArmies() { return this.numberOfArmies; } public int getUnplacedArmies() { return this.unplacedArmies; } public ArrayList<Territory> getTerritories() { return this.territories; } public ArrayList<Continent> getContinents() { return this.continents; } public void addTerritory( Territory newTerritory ) { } public void addContinent( Continent newContinent ) { } public void addArmies( int newArmies ) { } public void addRiskCard( RiskCard newCard ) { } public void Attack( Territory attacker, Territory defender, int numAttackingArmies ) { } }
[ "stardo@uno.edu" ]
stardo@uno.edu
5e2b0e41c557b53692cf3730fb9a9b7445f3efb1
e2fd15975ad0f14672fe29d375d7d23b3e4cc2a8
/HomeJobMarketplace-master/src/org/care/presentation/seeker/EditJobServlet.java
7a950d563815568068b7509bfafb4b4a35ede0fc
[]
no_license
kil23/JspServletProjectDemo
5ee868fa93cc534bd8c48ced40a18c33498f5ba9
6e2ea53f5284a7c2e7e00f701badd317ad5a02b2
refs/heads/master
2020-04-10T05:33:46.649047
2019-01-17T15:20:49
2019-01-17T15:20:49
160,831,318
0
0
null
null
null
null
UTF-8
Java
false
false
2,638
java
package org.care.presentation.seeker; import org.care.context.MyApplicationContext; import org.care.dto.SeekerJobDTO; import org.care.service.SeekerService; import org.care.utils.CommonUtil; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class EditJobServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int userId = MyApplicationContext.get().getMember().getId(); String jobIdRaw = req.getParameter("JobId"); if (jobIdRaw != null && !jobIdRaw.isEmpty() && jobIdRaw.matches("^[0-9]+$")) { int jobId = Integer.parseInt(jobIdRaw); if (userId == SeekerService.getUserIdforJobId(jobId)) { SeekerJobDTO seekerJobDTO = SeekerService.getJob(jobId); req.setAttribute("Job", seekerJobDTO); RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/jsp/seeker/editjob.jsp"); dispatcher.forward(req, resp); } else { resp.sendRedirect(CommonUtil.getRedirectURL("/seeker/list-job?success=false")); } } else { resp.sendRedirect(CommonUtil.getRedirectURL("/seeker/list-job?success=false")); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int userId = MyApplicationContext.get().getMember().getId(); String jobId = req.getParameter("jobid"); String title = req.getParameter("title"); String startDate = req.getParameter("startdate"); String endDate = req.getParameter("enddate"); String payPerHour = req.getParameter("payperhour"); SeekerJobDTO jobDTO = new SeekerJobDTO(jobId, title, startDate, endDate, payPerHour); if (jobDTO.validate()) { boolean isUpdated = SeekerService.updateJob(userId, jobDTO); if (isUpdated) { resp.sendRedirect(CommonUtil.getRedirectURL("/seeker/list-job?success=true")); } else { resp.sendRedirect(CommonUtil.getRedirectURL("/seeker/list-job?success=false")); } } else { req.setAttribute("Job", jobDTO); RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/jsp/seeker/editjob.jsp"); dispatcher.forward(req, resp); } } }
[ "abayes@apostek.local" ]
abayes@apostek.local
ce4f68e8f2826f70063143e459155e1e6648ee2c
a73a13af5ee9c33d06a3cadd2f82ee0795be9acc
/src/main/java/com/LearnToCrypt/EmailService/IEmailService.java
560f650fd47636582918cd17d306fbe079857b8d
[]
no_license
harsh-pamnani/LearnToCrypt
b083e1bc89d1604b198d1504c27d7c4e87fdbb15
e0a5846503103d2ddaf7940408596d18b36e4f6f
refs/heads/master
2022-07-24T05:29:10.506852
2019-08-02T21:55:41
2019-08-02T21:55:41
203,405,258
1
0
null
2022-07-11T21:05:22
2019-08-20T15:36:53
Java
UTF-8
Java
false
false
126
java
package com.LearnToCrypt.EmailService; public interface IEmailService { void sendPassResetMail(String email, String url); }
[ "aman.arya@dal.ca" ]
aman.arya@dal.ca
78ddf0dfe18cb5d8ab3ab04682e3fd07ae73f605
7e9afed50aab2bec455b0f94b6edca8c4c19f4ce
/_Connors examples/GuessNumberAndGuessLetter/31_GuessANumberBetween1and10withLivesAndPlayRetrySeeNumsUsedBeforeCheckInput/App.java
769574902e5760519ddcacf0ceb9c9e7fee1f914
[]
no_license
Seosamhoc/JavaCodeBreaker
bf0aac40ce89ccddadf69c17af1384b8cc72c30c
50b942f2188a9c0069b31924fa98212e295de2ab
refs/heads/master
2016-09-06T04:45:44.471476
2013-11-20T15:16:23
2013-11-20T15:16:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,724
java
/***************************************************************** * * Date: 01 Oct 2011 * @author Conor O Reilly * * Version 1 - get a number between 1 - 10 and just allow one guess, * *****************************************************************/ import java.util.Scanner; class App { public static void main(String args[]) { App anApp = new App(); } // DATA //............................................................ private int integerEntered; private boolean invalidInput; private boolean guessed; private boolean tryAgain; private int numberToGuess; private int numberOfLives; private int numbersEnteredArray[]; //to store previous guess numbers entered private int livesLeft; private char theLetterIn; //declare objects private Scanner someInput; private String theUsersInput; private NumberGenerator theNumberGenerator; // CONSTRUCTORS //............................................................ public App() { //initialise variables this.numberOfLives = 3; this.numbersEnteredArray = new int[this.numberOfLives]; //array = max number of lives this.livesLeft = 0; this.tryAgain = false; //create objects this.theNumberGenerator = new NumberGenerator(); this.someInput = new Scanner(System.in); //playGame playBoard(); //pause before exit System.out.println(" \n Press enter to exit the program"); this.someInput.nextLine(); //close the program without error System.exit(0); } // METHODS //............................................................ /*================================================ * ask if want to play again once played once * *================================================*/ private void playBoard() { do { playGame(); this.tryAgain = false; System.out.print("\n Play again (Y/N): "); this.theUsersInput = this.someInput.nextLine(); // we get a String in, we only want the first character // a String is like an array, the first position starts at 0 // theLetterIn is of type char this.theLetterIn = this.theUsersInput.charAt(0); //now comparing two characters if( (this.theLetterIn == 'Y') || ( this.theLetterIn == 'y') ) { this.tryAgain = true; } } while(this.tryAgain); }//EOM-playBoard() /*================================================ * Play the game * *================================================*/ private void playGame() { this.guessed = false; this.integerEntered = 0; this.invalidInput = true; int count = 0; //get a random number for the user to guess this.numberToGuess = this.theNumberGenerator.getNumber(); //input: game intro System.out.println("\n-----------------------------------"); System.out.println("This is a number guessing game."); System.out.println("Guess a number between 1 and 10."); //set number of lives this.livesLeft = this.numberOfLives; //clear out input history array for (int i = 0; i < this.numberOfLives; i=i+1) { this.numbersEnteredArray[i] = 0; } //loop the number of lives for (int i = 0; i < this.numberOfLives; i=i+1) { //input: enter a guess number do { System.out.print("\n Please enter a guess : "); this.theUsersInput = this.someInput.nextLine(); try { //validate the input, convert from String to int this.integerEntered = Integer.parseInt(this.theUsersInput); this.invalidInput = false; } catch (Exception e) { System.out.println(" You entered " + this.theUsersInput + ", this is not a valid entry, retry. \n"); this.invalidInput = true; } //check if number entered is within the allowed range if( (this.integerEntered < 1) || ( this.integerEntered > 10) ) { System.out.println(" You entered " + this.theUsersInput + ", only 1 to 10 is allowed, please reenter. \n"); this.invalidInput = true; } //check if entered that number before for (int k = 0; k < this.numberOfLives; k=k+1) { if ( this.numbersEnteredArray[k] == this.integerEntered ) { System.out.println(" You entered the number : " + this.theUsersInput + " before, please pick a different number. \n"); this.invalidInput = true; } } } while(this.invalidInput); //processing : compare numbers if( this.numberToGuess == this.integerEntered ) { this.guessed = true; break; } else { this.livesLeft = this.livesLeft - 1; //put number entered into history array this.numbersEnteredArray[count] = this.integerEntered; count = count + 1; //show history of numbers entered System.out.print("\n Entered so far: "); //use j variable as within a loop that is using i for (int j = 0; j < count; j=j+1) { System.out.print(this.numbersEnteredArray[j] + " "); } System.out.println("\n\n Try again, guesses left: " + this.livesLeft); this.guessed = false; } } //check if guessed or not if( this.guessed ) { System.out.println("\n YOU WIN - Good Guess !! the number was : " + this.numberToGuess); } else { System.out.println("\n YOU LOOSE, the number was : " + this.numberToGuess); } }//EOM-play() }//EOC
[ "seosamh.ocinneide@gmail.com" ]
seosamh.ocinneide@gmail.com
aca5b34d14d4baf0b7747afe0323fb53c4ca13c4
70b6c7de42518873eaa57f4fec5e4caed361887a
/src/main/java/io/github/crawlerbot/repository/search/ChannelOuterLinkSearchRepository.java
563f0fb310c5c9de283a83ae3806f60c641900b0
[]
no_license
crawlerbot/crawler-configuration
49793fcb0bd1c02f1a0b2e6b4ff1b38cd20845fc
c5e4e3007ff6f76b9a920582352e9b9bdb316e52
refs/heads/master
2020-03-22T21:34:54.692243
2019-05-17T12:06:38
2019-05-17T12:06:38
140,697,793
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package io.github.crawlerbot.repository.search; import io.github.crawlerbot.domain.ChannelOuterLink; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; /** * Spring Data Elasticsearch repository for the ChannelOuterLink entity. */ public interface ChannelOuterLinkSearchRepository extends ElasticsearchRepository<ChannelOuterLink, String> { }
[ "hungnguyendang@Hungs-MacBook-Pro.local" ]
hungnguyendang@Hungs-MacBook-Pro.local
2508b769865197edfc3663bcd0d1c05d6800ef74
19bf77b29d0324fdd1c537d2d0cc397c0b57ddc4
/server/src/main/java/server/CentralizedConfigServer.java
cd05d4abeddb8da42b9e9bf6dbf8124ee7509a5e
[]
no_license
mladensavic94/centralized_config_reforged
061b890a5fe2fd9946650241f0d321d5c2fe43f8
bc290e1aad3d6bd3d99ded33a78d58a67aa28654
refs/heads/master
2022-12-09T20:00:32.264703
2020-09-11T15:47:12
2020-09-11T15:47:12
294,363,419
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @SpringBootApplication @EnableConfigServer public class CentralizedConfigServer { public static void main(String[] args) { SpringApplication.run(CentralizedConfigServer.class, args); } }
[ "mladensavic94@gmail.com" ]
mladensavic94@gmail.com