blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
c41c5c5903cfff070960cbf19c793618f5152bed
72f91b73855bf5b6e508ed978591e7dac389ffa9
/app/src/main/java/com/plan2/example_rest_api/view/activity/MainLibWorld.java
b68db0054e1f2eca7de0313e13edb42742daf53f
[]
no_license
qk54r71/DREAM_UI
f0bcfa773c6834f4b28abc06bc350a759da54027
40c11df99f57d08f44428a3960c6831193768d3a
refs/heads/master
2021-08-23T14:01:33.874325
2017-12-05T05:15:34
2017-12-05T05:15:34
112,826,250
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.plan2.example_rest_api.view.activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.plan2.example_rest_api.R; public class MainLibWorld extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_lib_world); } }
1894b002d846ece9d61f82fe968c7962d1207ea0
6a36169755d9412435a844aae78d4ba203539308
/Locadora/Locadora/FILMES.java
1ac17a8e7011a9dbfbe03b504f4b93ce171543cb
[]
no_license
michelmorais/locadoralocafacil
caa99fdc9a4369afc24716e7828cff426ebce6e6
b7bbd47f274ef764f833be3cee63be5e84412aeb
refs/heads/master
2021-01-19T17:57:21.699479
2010-11-16T17:04:29
2010-11-16T17:04:29
32,329,089
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package Locadora; public class FILMES { public int id_filmes; public String nome; public int qtde; public int qtde_disponivel; public int id_genero; public int id_categoria; public String sinopse; public String nome_genero; public String nome_categoria; public String observacao; public int id_itens_pd_locacao; public String data_entrega;//usado somente para consulta (inner join) public String preco;//usado somente para consulta (inner join) public String situacao;//usado para devolucao public int id_devolucao;//usado para devolucao }
[ "Michel.braz.morais@163bf44e-5e22-494a-3104-4736a7a0d7f0" ]
Michel.braz.morais@163bf44e-5e22-494a-3104-4736a7a0d7f0
a0bdab4ef3899a6f6c8f02c2565ae48bc7a2a226
8065897e51519697bf281b72007c8addd0b168a8
/src/wattwatt/components/devices/suspendable/fridge/Fridge.java
12b44ff53b1fdb2241c9bc7ae0b9b34a6d984eec
[]
no_license
PascalZheng/WattWatt
bfe4d5520843b15992267632ceaabb661c3962c6
7e6d2737d1ea90a961401629af75c126ecdee4cd
refs/heads/master
2020-08-01T06:08:56.524686
2020-02-03T16:25:04
2020-02-03T16:25:04
210,889,562
0
0
null
null
null
null
UTF-8
Java
false
false
8,853
java
package wattwatt.components.devices.suspendable.fridge; import fr.sorbonne_u.components.annotations.OfferedInterfaces; import fr.sorbonne_u.components.annotations.RequiredInterfaces; import fr.sorbonne_u.components.cyphy.AbstractCyPhyComponent; import fr.sorbonne_u.components.cyphy.interfaces.EmbeddingComponentAccessI; import fr.sorbonne_u.components.exceptions.ComponentShutdownException; import fr.sorbonne_u.components.exceptions.ComponentStartException; import fr.sorbonne_u.devs_simulation.architectures.Architecture; import simulation.models.fridge.FridgeCoupledModel; import simulation.plugins.FridgeSimulatorPlugin; import simulation.tools.fridge.FridgeConsumption; import simulation.tools.fridge.FridgeDoor; import wattwatt.interfaces.controller.IController; import wattwatt.interfaces.devices.suspendable.fridge.IFridge; import wattwatt.ports.devices.suspendable.fridge.FridgeInPort; import wattwatt.tools.fridge.FridgeSetting; //----------------------------------------------------------------------------- /** * The class <code>Fridge</code> * * <p> * <strong>Description</strong> * </p> * * This class implements the fridge component. The fridge * requires the controller interface because he have to be * connected to the controller to receive order from him. * * * <p> * Created on : 2020-01-27 * </p> * * @author * <p> * Bah Thierno, Zheng Pascal * </p> */ //The next annotation requires that the referenced interface is added to //the required interfaces of the component. @OfferedInterfaces(offered = IFridge.class) @RequiredInterfaces(required = IController.class) public class Fridge extends AbstractCyPhyComponent implements EmbeddingComponentAccessI { // ------------------------------------------------------------------------- // Constants and variables // ------------------------------------------------------------------------- /** The inbound port of the fridge */ protected FridgeInPort refrin; /** The mode of the fridge, if he is suspended or not */ protected FridgeConsumption consumptionState; /** The current state of the fridge door */ protected FridgeDoor currentDoorState; protected double intensity; /** The temperature of the fridge used in the simulation */ protected double temperature; /** The temperature of the upper compartment */ protected double tempH; /** The temperature of the lower compartment */ protected double tempB; /** The state of the fridge */ protected boolean isOn; /** The state of the fridge */ protected boolean isWorking; /** The energy consumption of the fridge */ protected double conso; /** the simulation plug-in holding the simulation models. */ protected FridgeSimulatorPlugin asp; // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a washing machine. * * * @param uri URI of the component. * @param refriIn inbound port URI of the fridge. * @throws Exception <i>todo.</i> */ protected Fridge(String uri, String refriIn) throws Exception { super(uri, 2, 1); this.initialise(); this.refrin = new FridgeInPort(refriIn, this); this.refrin.publishPort(); this.tempH = FridgeSetting.TEMP_H_INIT; this.tempB = FridgeSetting.TEMP_L_INIT; this.consumptionState = FridgeConsumption.SUSPENDED; this.currentDoorState = FridgeDoor.CLOSED; this.intensity = 0.0; this.temperature = 2.0; this.on(); this.tracer.setRelativePosition(1, 0); } protected void initialise() throws Exception { // The coupled model has been made able to create the simulation // architecture description. Architecture localArchitecture = this.createLocalArchitecture(null); // Create the appropriate DEVS simulation plug-in. this.asp = new FridgeSimulatorPlugin(); // Set the URI of the plug-in, using the URI of its associated // simulation model. this.asp.setPluginURI(localArchitecture.getRootModelURI()); // Set the simulation architecture. this.asp.setSimulationArchitecture(localArchitecture); // Install the plug-in on the component, starting its own life-cycle. this.installPlugin(this.asp); } // ------------------------------------------------------------------------- // Methods // ------------------------------------------------------------------------- @Override public void start() throws ComponentStartException { super.start(); this.logMessage("Refrigerateur starting"); try { Thread.sleep(10); } catch (Exception e) { e.printStackTrace(); } } @Override public void execute() throws Exception { super.execute(); } @Override public void shutdown() throws ComponentShutdownException { try { this.refrin.unpublishPort(); } catch (Exception e) { e.printStackTrace(); } super.shutdown(); } @Override public void finalise() throws Exception { super.finalise(); } // ------------------------------------------------------------------------- // Methods // ------------------------------------------------------------------------- /** * @see fr.sorbonne_u.components.cyphy.AbstractCyPhyComponent#createLocalArchitecture(java.lang.String) */ @Override protected Architecture createLocalArchitecture(String architectureURI) throws Exception { return FridgeCoupledModel.build(); } /** * @see fr.sorbonne_u.components.cyphy.interfaces.EmbeddingComponentStateAccessI#getEmbeddingComponentStateValue(java.lang.String) */ @Override public Object getEmbeddingComponentStateValue(String name) throws Exception { if (name.equals("door")) { return this.currentDoorState; } else if (name.equals("consumption")) { return new Double(this.conso); } else if (name.equals("temperature")) { return new Double(this.temperature); } else { assert name.equals("state"); return this.consumptionState; } } @Override public void setEmbeddingComponentStateValue(String name, Object value) throws Exception { if (name.equals("close")) { this.currentDoorState = FridgeDoor.CLOSED; } else if (name.equals("open")) { this.currentDoorState = FridgeDoor.OPENED; } else if (name.equals("suspend")) { this.suspend(); } else if (name.equals("temperature")) { this.temperature = (double) value; } else if (name.equals("consumption")) { this.conso = (double) value; } else { assert name.equals("resume"); this.resume(); } } public double getTempHaut() { return this.tempH; } public double getTempBas() { return this.tempB; } public void suspend() { this.consumptionState = FridgeConsumption.SUSPENDED; this.isWorking = false; } public void resume() { this.consumptionState = FridgeConsumption.RESUMED; if (this.isOn) { this.isWorking = true; } else { this.isWorking = false; } } public void on() { this.isOn = true; this.isWorking = true; } public void off() { this.isOn = false; this.isWorking = false; } public boolean isWorking() { return this.isWorking; } public boolean isOn() { return this.isOn; } public double giveConso() { return conso; } public void setDoorState(FridgeDoor door) { this.currentDoorState = door; } public void setConsumptionState(FridgeConsumption consumption) { this.consumptionState = consumption; } public void setIntensity(double intensity) { this.intensity = intensity; } public void setTemperature(double temperature) { this.temperature = temperature; } public void regule() { if (this.isOn) { if (this.isWorking) { if (this.tempH > FridgeSetting.TEMP_H_MIN) { this.tempH--; } if (this.tempB > FridgeSetting.TEMP_L_MIN) { this.tempB--; } this.conso += FridgeSetting.ACTIVE_CONSUMPTION; } else { if (this.tempH < FridgeSetting.TEMP_H_MAX) { this.tempH++; } if (this.tempB < FridgeSetting.TEMP_L_MAX) { this.tempB++; } if (this.conso - FridgeSetting.PASSIVE_CONSUMPTION <= 0) { this.conso = 0; } else { this.conso -= FridgeSetting.PASSIVE_CONSUMPTION; } } } else { if (this.conso - FridgeSetting.PASSIVE_CONSUMPTION <= 0) { this.conso = 0; } else { this.conso -= FridgeSetting.PASSIVE_CONSUMPTION; } } } public void printState() { this.logMessage(">>> isOn : [" + this.isOn + "] Working : [" + this.isWorking + "] Temp Haut : [" + this.getTempHaut() + " ] Temp Bas : [" + this.getTempBas() + " ] \n>>> Conso depuis le debut : [" + this.giveConso() + " ]\n"); } }
511cc8fcb72f8656288bf136e2f40d2bd6f1bde4
324fea83bc8135ab591f222f4cefa19b43d30944
/src/main/java/ru/lanbilling/webservice/wsdl/BlkVgroup.java
f94181198dc48e3a2ae6ad0fd1b055b11fda47f8
[ "MIT" ]
permissive
kanonirov/lanb-client
2c14fac4d583c1c9f524634fa15e0f7279b8542d
bfe333cf41998e806f9c74ad257c6f2d7e013ba1
refs/heads/master
2021-01-10T08:47:46.996645
2015-10-26T07:51:35
2015-10-26T07:51:35
44,953,384
0
0
null
null
null
null
UTF-8
Java
false
false
2,705
java
package ru.lanbilling.webservice.wsdl; import javax.annotation.Generated; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/&gt; * &lt;element name="state" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "id", "state" }) @XmlRootElement(name = "blkVgroup") @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") public class BlkVgroup { @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") protected long id; @XmlElement(defaultValue = "") @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") protected String state; /** * Gets the value of the id property. * */ @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") public long getId() { return id; } /** * Sets the value of the id property. * */ @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") public void setId(long value) { this.id = value; } /** * Gets the value of the state property. * * @return * possible object is * {@link String } * */ @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") public String getState() { return state; } /** * Sets the value of the state property. * * @param value * allowed object is * {@link String } * */ @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11") public void setState(String value) { this.state = value; } }
ff48089c8ea12bd479aaa7a2dab9361473b35ab2
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/23/org/jfree/chart/plot/Plot_getNoDataMessagePaint_396.java
84a43e10a67d7e60d91ee4a2c0eadd3ac671e43e
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,808
java
org jfree chart plot base plot free chart jfreechart link org jfree chart free chart jfreechart deleg draw ax data plot base facil common plot type plot axi chang listen axischangelisten return paint displai 'no data' messag paint code code set data messag paint setnodatamessagepaint paint data messag getnodatamessag paint data messag paint getnodatamessagepaint data messag paint nodatamessagepaint
d84111461f34e8fc242906349b8a16bb20cf1fb9
1ab39ec6dfc6c5d1aa7863ec159684e39668f9aa
/app/src/main/java/com/reidiens/login/personalinfo.java
7a137801bc2fb027d2dd3b725ac76f34fb8bfaf0
[]
no_license
dilipjay/griediens1
1fde38484a03c45611df6a75c5e5586e041b0ee4
9406791c7fc615eaee109efe32243be8d252c72e
refs/heads/master
2021-01-10T12:02:46.225321
2015-10-10T18:50:26
2015-10-10T18:50:26
44,024,932
0
0
null
null
null
null
UTF-8
Java
false
false
5,129
java
package com.reidiens.login; import android.content.Intent; import android.graphics.Typeface; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; public class personalinfo extends AppCompatActivity implements View.OnClickListener { ArrayAdapter<CharSequence> adapter; Spinner country; EditText enName, enEmail, pass1, ph1, ph2, ph3, date, datedd, yer, myadd, zip; //namecc,ccnum, exdt,exdt2, seccd; Button register1; RadioButton male, female; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_personalinfo); replacefnt.replaceDefaultFont(this, "DEFAULT", "Neutra.ttf"); //change of default font enName = (EditText) findViewById(R.id.enName); enEmail = (EditText) findViewById(R.id.enEmail); pass1 = (EditText) findViewById(R.id.pass1); datedd = (EditText) findViewById(R.id.datedd); yer = (EditText) findViewById(R.id.yer); ph1 = (EditText) findViewById(R.id.ph1); ph2 = (EditText) findViewById(R.id.ph2); ph3 = (EditText) findViewById(R.id.ph3); date = (EditText) findViewById(R.id.date); myadd = (EditText) findViewById(R.id.myadd); zip = (EditText) findViewById(R.id.zip); register1 = (Button) findViewById(R.id.register1); male = (RadioButton) findViewById(R.id.male); female = (RadioButton) findViewById(R.id.female); register1.setOnClickListener(this); //list of country spinner country = (Spinner) findViewById(R.id.cntry1); adapter = ArrayAdapter.createFromResource(this, R.array.country_names, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); country.setAdapter(adapter); country.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(getBaseContext(), parent.getItemIdAtPosition(position) + "selected", Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { } } );//complete of country spinner code //change font to Neutra Display Light Typeface myFont = Typeface.createFromAsset(getAssets(), "Neutra.ttf"); enName.setTypeface(myFont); enEmail.setTypeface(myFont); TextView myPersonal = (TextView) findViewById(R.id.personalIn); myPersonal.setTypeface(myFont); TextView myName1 = (TextView) findViewById(R.id.name1); myName1.setTypeface(myFont); TextView myEmailT = (TextView) findViewById(R.id.emailTx); myEmailT.setTypeface(myFont); pass1.setTypeface(myFont); TextView myPassTx = (TextView) findViewById(R.id.passTx); myPassTx.setTypeface(myFont); male.setTypeface(myFont); female.setTypeface(myFont); TextView myS = (TextView) findViewById(R.id.sex); myS.setTypeface(myFont); date.setTypeface(myFont); datedd.setTypeface(myFont); yer.setTypeface(myFont); TextView myDob = (TextView) findViewById(R.id.dob); myDob.setTypeface(myFont); TextView myPh = (TextView) findViewById(R.id.ph); myPh.setTypeface(myFont); ph1.setTypeface(myFont); ph2.setTypeface(myFont); ph3.setTypeface(myFont); myadd.setTypeface(myFont); register1.setTypeface(myFont); TextView myAdd1 = (TextView) findViewById(R.id.myadd1); myAdd1.setTypeface(myFont); zip.setTypeface(myFont); TextView myZip1 = (TextView) findViewById(R.id.zip1); myZip1.setTypeface(myFont); TextView myCntry = (TextView) findViewById(R.id.cntry); myCntry.setTypeface(myFont); register1.setTypeface(myFont); //code complete for change of font } @Override public void onClick(View v) { switch (v.getId()) { case R.id.register1: String email = enEmail.getText().toString(); String password = pass1.getText().toString(); User registerData = new User(email, password); startActivity(new Intent(this,Loginpg.class)); break; } } }
79de291ecf2fdcf702d20a84ed36bea9b008907e
4b1f40eaee40a76b1d32284b2ab8cd0a8d2d7e2e
/Exercise1.java
78a2144880248f6d7ee23986a92db885310ebc0a
[]
no_license
Chloe-Cannon/CCannonAI2
30cf0178c2ae0bfab7ca6c2fd94834be8128bdbc
c247802eafcc676758a79dff0bfdb37e576b158e
refs/heads/master
2020-06-17T09:04:23.383230
2019-07-09T14:04:17
2019-07-09T14:04:17
195,873,477
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
public class Exercise1 { public static void main(String[] args){ System.out.print("Chloe"); System.out.print(" Cannon"); System.out.println(" 9th grade"); } }
93dc9fd1bfb3fe96b216a94a8b613aa6c5494a38
b14482c320fdcc140dd3a8d6884fbe5d71ba0838
/src/threadTest/playDice/Dice.java
e89f8c927fd4ada0b6184bf5965e17d9a0d5088a
[]
no_license
qpzmal/Temp
24769abb5b77e8f4ca98ac8dc55d94faa04037c9
19ccca56fe10166137c6f3748103bbd37626dae4
refs/heads/master
2020-05-19T16:25:12.761154
2015-01-09T05:38:05
2015-01-09T05:38:05
18,844,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package threadTest.playDice; import java.util.Random; /** * 骰子类 * @author weiqz * */ public class Dice { protected int number = 0; protected int count = 0; public synchronized void setNumber() throws Exception { if (count == 3) { Thread.currentThread().interrupt(); return; } Random r = new Random(); this.number = r.nextInt(6) + 1; // System.out.println("线程 "+Thread.currentThread().getName()+" 骰子数:"+this.number); this.notify(); try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } public synchronized void getNumber() { System.out.println("线程 "+Thread.currentThread().getName()+" 骰子数:"+this.number +",六的次数:" + count); if (this.number == 6) { count++; if (count == 3) { Thread.currentThread().interrupt(); this.notify(); return; } } else { count = 0; } this.notify(); try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } // public static void main(String[] args) { // Dice dice = new Dice(); // dice.setNumber(); // System.out.println(dice.getNumber()); // } }
adb6c2f3427b4480dc72c4e20ba991313fb504b7
f21a15b89c1ff9eb9cfac4a6d0cb8b5792509cf1
/src/pattern/creational/factorymethod2/SchedulingStrategyID.java
5b84a12779dfd1cd373e7118d731f44bee1572d8
[]
no_license
kinamJung/patternall
0049a07619987fb904616d682dac3075d4a57b77
e926616079e6ba404a158ab306a99c693fc2ac16
refs/heads/master
2021-01-16T20:31:54.279574
2016-01-25T00:30:17
2016-01-25T00:30:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
122
java
package pattern.creational.factorymethod2; public enum SchedulingStrategyID { RESPONSE_TIME, THROUGHTUP, DYNAMIC }
5b6b0528355b084b92e4d5fbe6cc117a586d64e6
803d8093313a4a10065429527271854144896141
/library-base/src/main/java/com/goldze/base/utils/DateUtil.java
e99c35f8b97890292faa5f7f20fd746b6cf0ca98
[ "Apache-2.0" ]
permissive
tlchun/FutureHome
2a574ed927859320c6addaa77c16bb3b28a7cd2b
f50818bbec09ec3fbb5748cd599cd799fd48e2a8
refs/heads/master
2023-04-24T04:42:57.236198
2021-05-10T02:11:11
2021-05-10T02:11:11
335,849,823
3
2
null
null
null
null
UTF-8
Java
false
false
1,221
java
package com.goldze.base.utils; import android.text.format.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class DateUtil { /** * 时间戳转换成日期格式字符串 * * @param seconds 精确到豪秒的字符串 * @return */ public static String timeStamp2Date(long seconds) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(new Date(Long.valueOf(seconds))); } /** * 日期格式字符串转换成时间戳 * * @param format 如:yyyy-MM-dd HH:mm:ss * @return */ public static String date2TimeStamp(String date_str, String format) { try { SimpleDateFormat sdf = new SimpleDateFormat(format); return String.valueOf(sdf.parse(date_str).getTime() / 1000); } catch (Exception e) { e.printStackTrace(); } return ""; } /** * 取得当前时间戳(精确到秒) * * @return */ public static String timeStamp() { long time = System.currentTimeMillis(); String t = String.valueOf(time / 1000); return t; } }
827505c1845f431a0402359b13d4aaa0bdcc9282
9890f81db5b1a004a2feab10db1b6cde07bc948a
/src/main/java/com/great/springboot/aoplog/LogAspect.java
ac2692d8afbab535a236976f166dc8d079c43a31
[]
no_license
WeJieLi/Demo6
1bcd8498291f434199d2326c5439528a04bb515b
8d1691310ef13fc93e3c142f68fa7a89317de00b
refs/heads/master
2022-06-12T20:23:15.098798
2019-12-14T02:08:15
2019-12-14T02:08:15
227,951,739
0
0
null
2022-05-20T21:19:08
2019-12-14T01:56:40
JavaScript
UTF-8
Java
false
false
3,050
java
package com.great.springboot.aoplog; import com.great.springboot.entity.LogInf; import com.great.springboot.service.UserService; import com.great.springboot.util.GetNowTime; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; @Aspect @Component public class LogAspect { private HttpServletRequest request; @Autowired private LogInf logInf ; @Autowired private UserService userService ; //Controller层切点 @Pointcut("within(com.great.springboot.service.UserService)") public void controllerAspect() { } @After("controllerAspect()") public void after(JoinPoint joinPoint) throws Throwable { System.out.println("进入了after方法"); String targetName = joinPoint.getTarget().getClass().getName(); String methodName = joinPoint.getSignature().getName(); //获取传入目标方法的参数值 Object[] arguments = joinPoint.getArgs(); Class<?> targetClass = Class.forName(targetName); Method[] methods = targetClass.getMethods(); String operationType = ""; String operationName = ""; boolean flag = false; for (Method method : methods) { if (method.getName().equals(methodName)) { Class<?>[] clazzs = method.getParameterTypes(); if (clazzs.length == arguments.length) { if (clazzs.length == 0) { flag = true; } else { for (int i = 0; i < clazzs.length; i++) { System.out.println(clazzs[i]); if (clazzs[i] == arguments[i].getClass()) { flag = true; break; } } } } } if (flag) { operationType = method.getAnnotation(Log.class).operationType(); operationName = method.getAnnotation(Log.class).operationName(); break; } } //*========控制台输出=========*// System.out.println("=====后置通知开始====="); System.out.println("请求方法:" + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()")); System.out.println("方法类型:" + operationType); System.out.println("方法描述:" + operationName); ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); RequestContextHolder.setRequestAttributes(sra, true); request = sra.getRequest(); Object admin=request.getSession().getAttribute("admin"); if(operationType.equals("1")&&null!=admin){ logInf.setDate(GetNowTime.getDate()); logInf.setTime(GetNowTime.getTime()); logInf.setAffair(operationName); logInf.setOperate(admin.toString()); userService.addLog(logInf); System.out.println("日志记录:"+logInf.toString()); } } }
93a50a04fdcea8cf4ad60dc58c1988f74e284296
4dcede1d5b1230079fce24899ef32b398a765e08
/src/main/java/com/my_thread/ExchangeTest.java
78c1883e76aa677a32d8b3a2f204a5896e93e0b2
[]
no_license
xianlongbai/basic_java
fefd995da04d3665abfe80f01504eef991d3c26f
6ba2efb9b1ddc041c00a5a11557e029499b78f3f
refs/heads/master
2022-12-11T00:20:05.146411
2020-06-02T06:03:41
2020-06-02T06:03:41
181,322,937
0
0
null
2022-12-06T00:45:20
2019-04-14T14:41:17
Java
UTF-8
Java
false
false
1,812
java
package com.my_thread; import java.util.concurrent.Exchanger; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ExchangeTest { public static void main(String[] args) { final ExecutorService service = Executors.newCachedThreadPool(); final Exchanger<String> changer = new Exchanger<String>(); service.submit(new Runnable(){ public void run(){ try{ String data1 = "北京老冰棍"; System.out.println("线程 "+Thread.currentThread().getName()+" 正在把 "+data1+" 拿出来"); String data2 = changer.exchange(data1); System.out.println("线程 "+Thread.currentThread().getName()+"用 "+data1+" 换来了"+data2); }catch(Exception e){ e.printStackTrace(); }finally{ service.shutdown(); System.out.println(Thread.currentThread().getName()+"交易完毕,撤!"); } } }); service.submit(new Runnable(){ public void run(){ try{ String data1 = "100元"; System.out.println("线程 "+Thread.currentThread().getName()+" 正在把钱 "+data1+" 拿出来"); String data2 = changer.exchange(data1); System.out.println("线程 "+Thread.currentThread().getName()+"用 "+data1+"换来了"+data2); }catch(Exception e){ e.printStackTrace(); }finally{ service.shutdown(); System.out.println(Thread.currentThread().getName()+"交易完毕,撤!"); } } }); } }
05d2238b84c4483520b04466a1e789b3a1129d06
f5e7dde3ced0e7af1c9fcec1e2a74384c862cb56
/app/src/main/java/dev/nick/music/MainActivity.java
54fb697e7e15a98a61736c6fd4dc2db83289aa6f
[]
no_license
yinheng/Music
6ab8ca5e4d16dcd106681c2a4db5c77e5198d95e
dcf798600e2bee2462d3fd583d5d89737755cc1f
refs/heads/master
2021-01-01T17:45:25.121365
2017-07-24T04:13:19
2017-07-24T04:13:48
98,148,254
0
0
null
null
null
null
UTF-8
Java
false
false
6,611
java
package dev.nick.music; import android.graphics.Color; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ImageButton; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import java.util.Iterator; import java.util.List; import dev.nick.music.loader.Music; import dev.nick.music.loader.MusicLoader; public class MainActivity extends AppCompatActivity { List<Music> musicList; MediaPlayer mediaPlayer = new MediaPlayer(); ListView listView; ImageButton prevBtn, playBtn, nextBtn; BaseAdapter adapter; int index = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.list); SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadAndDisplay(); } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Toast.makeText(getApplicationContext(), "item:" + (i + 1), Toast.LENGTH_SHORT).show(); play(i); } }); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { playNext(); } }); playBtn = (ImageButton) findViewById(R.id.imageButton2); nextBtn = (ImageButton) findViewById(R.id.imageButton3); prevBtn = (ImageButton) findViewById(R.id.imageButton); playBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mediaPlayer.isPlaying()) { mediaPlayer.pause(); playBtn.setImageResource(R.drawable.ic_play_arrow_black_24dp); } else { mediaPlayer.start(); playBtn.setImageResource(R.drawable.ic_pause_black_24dp); } } }); prevBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (index == 0) { index = musicList.size() - 1; } else { index = index - 1; } play(index); } }); nextBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { playNext(); } }); loadAndDisplay(); } private void playNext() { if (index == musicList.size() - 1) { index = 0; } else { index += 1; } play(index); } private void play(int i) { index = i; String path = musicList.get(i).getMusicPath(); try { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } mediaPlayer.reset(); mediaPlayer.setDataSource(path); mediaPlayer.prepare(); mediaPlayer.start(); playBtn.setImageResource(R.drawable.ic_pause_black_24dp); adapter.notifyDataSetChanged(); } catch (IOException e) { e.printStackTrace(); } } private void loadAndDisplay() { new Thread(new Runnable() { @Override public void run() { MusicLoader musicLoader = new MusicLoader(); musicList = musicLoader.loadMusic(Environment.getExternalStorageDirectory().getPath()); Log.i("yinheng", "item:" + musicList.size()); Iterator<Music> iterator = musicList.iterator(); while (iterator.hasNext()) { Music m = iterator.next(); Log.i("yinheng", m.toString()); } runOnUiThread(new Runnable() { @Override public void run() { onLoadComplete(); } }); } }).start(); } private void onLoadComplete() { SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe); swipeRefreshLayout.setRefreshing(false); ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress); progressBar.setVisibility(View.INVISIBLE); adapter = new MusicAdapter(); ListView listView = (ListView) findViewById(R.id.list); listView.setAdapter(adapter); } class MusicAdapter extends BaseAdapter { @Override public int getCount() { return musicList.size(); } @Override public Object getItem(int i) { return musicList.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup viewGroup) { View itemView = LayoutInflater.from(getApplicationContext()) .inflate(R.layout.item, viewGroup, false); TextView line1 = itemView.findViewById(R.id.textView); TextView line2 = itemView.findViewById(R.id.textView2); Music music = musicList.get(position); line1.setText(music.getMusicName()); line2.setText(music.getMusicPath()); if (index == position) { itemView.setBackgroundColor(Color.GREEN); } return itemView; } } }
216ba5fc6928480ae0e748b9256947b6949849d7
d6fab02581491bccf4f91bb308b408dc8cae1f42
/jlmq-with-stomp/src/main/java/ru/itis/jlmqwithstomp/models/JlmqMessage.java
0809258b76b13e1485a6830d22f959fb26c8003d
[]
no_license
almazik77/jlmq-with-stomp
970c379c7f05508bb2613eb24d8f84e8e04457ea
0304370495299dc8dcfcb995c5a1920779304206
refs/heads/master
2022-06-06T04:24:09.965001
2020-05-04T18:10:58
2020-05-04T18:10:58
261,260,178
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package ru.itis.jlmqwithstomp.models; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.*; import javax.persistence.*; @Entity @AllArgsConstructor @NoArgsConstructor @Getter @Setter @Builder @ToString @Table(name = "message") public class JlmqMessage { @JsonIgnore @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @JsonIgnore private String messageId; @JsonIgnore @ManyToOne @JoinColumn(name = "queue_id") private Queue queue; @JsonIgnore @Enumerated(EnumType.STRING) private Status status; private String body; public enum Status { RECEIVED, ACCEPTED, COMPLETED; } }
b62545bd95352899b81dcb329db7f4800a7782d1
45c9aec65591ae8f0b492e17308c7740f49d16c0
/src/com/_10_Arreglos/_01_Explicacion.java
c3e04378e8d2fbf38a9c832c1e6bce3429c46314
[]
no_license
DanielFernandoYepezVelez/Fundamentos-Java
6f4524f2db1b7854e6173650de9352feba9496ac
dca0fe505e30e7f2cbb59c447de71ba95d7461a1
refs/heads/main
2023-05-16T08:12:20.047399
2023-05-11T02:43:37
2023-05-11T02:43:37
328,040,970
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package com._10_Arreglos; public class _01_Explicacion { public static void CreateArrays() { int[] numbers = new int[4]; numbers[0] = 134; numbers[1] = Integer.valueOf("2"); numbers[2] = 34; numbers[3] = 10; int i = numbers[0]; int j = numbers[1]; int k = numbers[2]; //int l = numbers[3]; int l = numbers[numbers.length - 1]; System.out.println("========== EXPLICACIÒN ARREGLOS =========="); System.out.println("i = " + i); System.out.println("j = " + j); System.out.println("k = " + k); System.out.println("l = " + l); } }
322517ea65022af74cdb3eecbc97f2eed61addeb
7ebed4b6dfc2f51e95833af55aa5b9d63c2fde17
/Sources/pushwoosh/src/main/java/com/pushwoosh/thirdpart/com/ironz/binaryprefs/event/EventBridge.java
4a7559f031dbda700745e5719cd4fbc7a3fc89a2
[ "LicenseRef-scancode-other-permissive" ]
permissive
Pushwoosh/pushwoosh-android-sdk
30cac70a5482fb00bbcb25e061085849f3a6d8f3
ccf2c1b19a0ff0108309d617918e69350e1e0b64
refs/heads/master
2023-08-31T04:47:37.768195
2023-08-28T11:15:23
2023-08-28T11:15:23
15,434,764
62
57
NOASSERTION
2019-01-29T08:42:53
2013-12-25T12:22:47
null
UTF-8
Java
false
false
2,506
java
/* * * Copyright (c) 2017. Pushwoosh Inc. (http://www.pushwoosh.com) * * 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: * * (i) the original and/or modified Software should be used exclusively to work with Pushwoosh services, * * (ii) 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 com.pushwoosh.thirdpart.com.ironz.binaryprefs.event; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; /** * Describes contract for preferences change events */ public interface EventBridge { /** * Behaves exactly like in * {@link android.content.SharedPreferences#registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener)} * method. * * @param listener listener */ void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener); /** * Behaves exactly like in * {@link android.content.SharedPreferences#unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener)}} * method. * * @param listener listener */ void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener); /** * Notifies all listeners which has been subscribed on preferences changes about preference update * * @param key target key * @param bytes target bytes */ void notifyListenersUpdate(String key, byte[] bytes); /** * Notifies all listeners which has been subscribed on preferences changes about preference remove * * @param key target key */ void notifyListenersRemove(String key); }
2b8642d92bb6054d8e970207493c5b70834ca4d6
30d08b7a9cbdd336a8d9f802f5ac50eb9700dee5
/src/main/java/minecraftbyexample/mbe40_hud_overlay/StartupCommon.java
50a9b3498ebca208799e7b7f81fed0d52e6463a7
[]
no_license
alvaropp/MinecraftByExample
e0da453ff2a21d049547b40c3f0ebefd5f11dac8
c265da620571d0b53f50d9fdd7159e95d174b96d
refs/heads/master
2021-01-22T13:30:38.075187
2016-08-22T14:37:17
2016-08-22T14:37:17
67,339,071
0
0
null
2016-09-04T10:39:50
2016-09-04T10:39:50
null
UTF-8
Java
false
false
1,075
java
//package minecraftbyexample.mbe40_hud_overlay; // //import net.minecraftforge.fml.common.registry.GameRegistry; // // /** // * @author Nephroid // * // * User: Nephroid // * Date: December 26, 2014 // * The Startup classes for this example are called during startup, in the following order: // * preInitCommon // * preInitClientOnly // * initCommon // * initClientOnly // * postInitCommon // * postInitClientOnly // * See MinecraftByExample class for more information // */ //public class StartupCommon //{ // public static ItemHUDactivator itemHUDactivator; // this holds the unique instance of your item // // public static void preInitCommon() // { // // each instance of your item should have a name that is unique within your mod. use lower case. // itemHUDactivator = (ItemHUDactivator)(new ItemHUDactivator().setUnlocalizedName("mbe40_hud_overlay_item")); // GameRegistry.registerItem(itemHUDactivator, "mbe40_hud_overlay_item"); // } // // public static void initCommon() // { // } // // public static void postInitCommon() // { // } //}
9ff0eb412097f130dd0d7f6cd61f5bf41992b6de
e983bb2f433521dff631e200f82a9787bbefc2dc
/ARCHIVED/CSCE4650/Assignment7/assign7/7/SymbolTable.java
7e57eec92c120d72b9f26262259e0d0f6d5c73ff
[]
no_license
axelyates/unt_csce
051a5242d11d42e249f6f2e67939b72b7cc52453
67b09ae7f3b39d33c5c7c6dadce14748c9a6316d
refs/heads/master
2020-03-19T21:32:44.295888
2018-06-11T15:04:54
2018-06-11T15:04:54
136,942,264
2
0
null
null
null
null
UTF-8
Java
false
false
7,120
java
/* Name: Axel Yates Assignment: Assignment 5 */ import java.util.*; enum Category {CLASS, FUNCTION, VARIABLE} class Type { } class IntegerType extends Type { public String toString () { return "int"; } } class BooleanType extends Type { public String toString () { return "boolean"; } } class VoidType extends Type { public String toString () { return "void"; } } class ArrayType extends Type { private int dimension; private Type baseType; public ArrayType (int dim, Type base) { dimension = dim; baseType = base; } public int dimension () { return dimension; } public String toString () { return "array (" + dimension + ", " + baseType + ")"; } } class ObjectType extends Type { private String className; private SymbolTableEntry objectType; public ObjectType (String className, SymbolTableEntry objectType) { this . className = className; this . objectType = objectType; } public String className () { return className; } public SymbolTableEntry objectType () { return objectType; } public String toString () { return className; } } class Declarator { private String id; private Type type; public Declarator (String id, Type type) { this . id = id; this . type = type; } public String id () { return id; } public Type type () { return type; } } class ArrayDeclarator extends Declarator { private int subscriptNumber; public ArrayDeclarator (String id, Type type, int subscriptNumber) { super (id, type); this . subscriptNumber = subscriptNumber; } public int subscriptNumber () { return subscriptNumber; } } class SymbolTableEntry { private Category category; private LinkedList<Type> argTypes; private SymbolTable localEnv; private String funcCode; private boolean staticFlag; private Type type; public SymbolTableEntry (Category category) { this . category = category; } public SymbolTableEntry (Category category, Type type) { this . category = category; this . type = type; } public SymbolTableEntry (Category category, Type type, boolean staticFlag) { this . category = category; this . type = type; this . staticFlag = staticFlag; } public SymbolTableEntry (Category category, SymbolTable env) { this . category = category; this . localEnv = env; } public SymbolTableEntry (Category category, Type type, boolean staticFlag, LinkedList<Type> argTypes, SymbolTable env) { this . category = category; this . type = type; this . staticFlag = staticFlag; this . argTypes = argTypes; this . localEnv = env; } public Category category () { return category; } public boolean staticFlag () { return staticFlag; } public Type type () { return type; } public SymbolTable localEnv () { return localEnv; } public String funcCode () { return funcCode; } public void setCode (String code) { funcCode = code; } public String toString () { String printString = category . name (); if (category == Category . VARIABLE || category == Category . FUNCTION) { if (staticFlag){ printString = printString + " yes "; } else{ printString = printString + " no "; } if (category == Category . VARIABLE){ printString = printString + " " + type; } else{ printString = printString + " " + argTypes + "->" + type; } } return printString; } } public class SymbolTable { private static int maxlen = 2; public static int maxLen () { return maxlen; } private SymbolTable parent; private TreeMap <String, SymbolTableEntry> table; public SymbolTable (SymbolTable staticParent) { parent = staticParent; table = new TreeMap <String, SymbolTableEntry> (); } public SymbolTable parent () { return parent; } public SymbolTableEntry entry (String id) { SymbolTableEntry idEntry = table . get (id); if (idEntry == null){ if (parent == null){ ErrorMessage . print ("Undeclared identifier: " + id); } } else{ idEntry = parent . entry (id); } return idEntry; } public void enter (String id, SymbolTableEntry entry) { SymbolTableEntry idEntry = table . get (id); if (idEntry != null) ErrorMessage . print ("Identifier " + id + " already declared."); table . put (id, entry); if (id . length () > maxlen){ maxlen = id . length (); } } public void enterVar (String id, Type type) { enter (id, new SymbolTableEntry (Category . VARIABLE, type)); } public void enterClass (String id, SymbolTable env) { enter (id, new SymbolTableEntry (Category . CLASS, env)); } public void enterFunc (String id, Type type, boolean staticFlag, LinkedList<Type> argTypes, SymbolTable env) { enter (id, new SymbolTableEntry (Category . FUNCTION, type, staticFlag, argTypes, env)); } public void enterVar (String id, Type type, boolean staticFlag) { enter (id, new SymbolTableEntry (Category . VARIABLE, type, staticFlag)); } public void enterFuncCode (String id, String code) { SymbolTableEntry idEntry = table . get (id); idEntry . setCode (code); } public void print (String blockName) { System . out . println (); System . out . println ("ID Table for " + blockName); System . out . print ("----------------"); for (int i = 0; i < blockName . length (); i++) System . out . print ("-"); System . out . println (); System . out . println (); System . out . print ("ID"); for (int i = 2; i < maxLen (); i++) System . out . print (" "); System . out . println (" Category Static Type"); System . out . print ("--"); for (int i = 2; i < maxLen (); i++) System . out . print (" "); System . out . println (" -------- ------ ----"); Iterator <Map . Entry <String, SymbolTableEntry>> envIterator = table . entrySet () . iterator (); TreeMap <String, SymbolTableEntry> classAndFunctionList = new TreeMap <String, SymbolTableEntry> (); while (envIterator . hasNext ()) { Map . Entry <String, SymbolTableEntry> entry = envIterator . next (); String id = entry . getKey (); SymbolTableEntry idEntry = entry . getValue (); System . out . print (id); for (int i = id . length (); i < maxLen (); i++) System . out . print (" "); System . out . print (" "); System . out . println (idEntry); if (idEntry . category () == Category . CLASS || idEntry . category () == Category . FUNCTION){ classAndFunctionList . put (id, idEntry); } } Iterator <Map . Entry <String, SymbolTableEntry>> classAndFunctionIterator = classAndFunctionList . entrySet () . iterator (); while (classAndFunctionIterator . hasNext ()) { Map . Entry <String, SymbolTableEntry> entry = classAndFunctionIterator . next (); String classOrFunctionName = entry . getKey (); SymbolTableEntry idEntry = entry . getValue (); idEntry . localEnv () . print (classOrFunctionName); } } }
cecf480da595a3ec0f7ae3d956f1228bb4becbc7
ed6191681cb29117f3240b763d31f5e3e559c3cc
/oo/abstrato/TesteAbstrato.java
8cb7a9056f3af31996d509717ab9319621fefca4
[ "MIT" ]
permissive
heltonricardo/estudo-java
756c85c0869ff4f195dbf24b4039a662e4faeca2
edaa8f968a75c4336e2646eb36c08ceda622cc36
refs/heads/master
2022-12-27T21:05:03.528948
2020-10-14T14:58:32
2020-10-14T14:58:32
284,755,962
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
package oo.abstrato; public class TesteAbstrato { public static void main(String[] args) { Animal a = new Cachorro(); System.out.println(a.respirar()); System.out.println(a.mover()); System.out.println(); Mamifero b = new Cachorro(); System.out.println(b.respirar()); System.out.println(b.mover()); System.out.println(b.mamar()); System.out.println(); Cachorro c = new Cachorro(); System.out.println(c.respirar()); System.out.println(c.mover()); System.out.println(c.mamar()); System.out.println(c.pegarBolinha()); } }
c4ee6cfda836638bbdc617f34b8371f4e3a5e7cf
951a8a1f3a744e80be33a4421370762cbe30e381
/ArrayListview/app/src/main/java/com/example/studentadmin/arraylistview/MainActivity.java
a962228ead13ca23753f441fc3138ecd3a51ace0
[]
no_license
krutiikothari/Android
dcff5a05cbbc492f57b72db710650dab588c4c61
2d53aa44a140ed70b5d0341027267a28b00cd5a3
refs/heads/master
2020-03-25T17:54:19.062359
2018-08-08T11:45:19
2018-08-08T11:45:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,293
java
package com.example.studentadmin.arraylistview; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { ListView l; String[] days = {"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); l = (ListView) findViewById(R.id.lv); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, days); l.setAdapter(adapter); l.setOnItemClickListener(this); } @Override public void onItemClick(AdapterView<?> adapterview, View view, int i, long l) { TextView temp = (TextView) view; Toast.makeText(this, temp.getText() + "" + i, Toast.LENGTH_SHORT).show(); } @Override public void onPointerCaptureChanged(boolean hasCapture) { } }
b7a281109161f8557b1ca1e7639d7e6c2860917d
e1429516f202cffc789e98a3609a6c0fcc06527a
/app/src/main/java/construction/thesquare/shared/utils/DialogBuilder.java
fa4e856747fc78664c5157b7f8df5b24ada3e0d4
[]
no_license
Swapna-Viasat/UK_project_square
793a0affa018def9ac491a721b608b26f84b41b1
fc0c12752f330b22d2dce02ca24acbac38b8e83f
refs/heads/master
2021-01-20T02:01:34.696700
2017-04-25T13:10:28
2017-04-25T13:10:28
89,361,682
1
0
null
null
null
null
UTF-8
Java
false
false
12,325
java
package construction.thesquare.shared.utils; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.support.annotation.StringRes; import android.support.design.widget.TextInputLayout; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import construction.thesquare.R; import construction.thesquare.shared.view.widget.LoadingDialog; import construction.thesquare.worker.onboarding.OnLanguagesSelectedListener; public class DialogBuilder { public interface OnClickStandardDialog { void onOKClickStandardDialog(Context context); } public interface OnClickTwoOptionsStandardDialog { void onClickOptionOneStandardDialog(Context context); void onClickOptionTwoStandardDialog(Context context); } public interface OnTextInputDialogListener { void onInputFinished(String input); } public static Dialog showCustomDialog(Context context) { if (Build.VERSION.SDK_INT > 14) { Dialog dialog = new LoadingDialog(context); dialog.show(); if (dialog.getWindow() != null) { dialog.getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); } return dialog; } else { Dialog dialog = ProgressDialog.show(context, null, null); dialog.setContentView(R.layout.loader); if (dialog.getWindow() != null) { dialog.getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); } return dialog; } } public static void cancelDialog(Dialog dialog) { try { if (dialog != null) { dialog.cancel(); } } catch (Exception e) { CrashLogHelper.logException(e); } } public static void showStandardDialog(Context context, String title, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message).setPositiveButton(context.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); afterShowSetProperties(builder, context); //builder.show(); } public static void showStandardDialog(final Context context, String title, String message, final OnClickStandardDialog listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message).setPositiveButton(context.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { listener.onOKClickStandardDialog(context); } }); afterShowSetProperties(builder, context); //builder.show(); } public static void showStandardDialog(final Context context, String title, String message, final DialogInterface.OnClickListener listener) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message).setPositiveButton(context.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Log.d("tag", String.valueOf(dialog.hashCode())); dialog.dismiss(); listener.onClick(dialog, id); } }); afterShowSetProperties(builder, context); //builder.show(); } public static Dialog showTwoOptionsStandardDialog(final Context context, String title, String message, String btnOneText, String btnTwoText, final OnClickTwoOptionsStandardDialog listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message).setPositiveButton(btnTwoText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { listener.onClickOptionTwoStandardDialog(context); } }); builder.setMessage(message).setNegativeButton(btnOneText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { listener.onClickOptionOneStandardDialog(context); } }); afterShowSetProperties(builder, context); return builder.create(); } public static void showDeleteDraftDialog(final Context context, final View.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); // TODO: move strings out into resources builder.setTitle("Delete Draft"); builder.setMessage("Are you sure you want to delete this draft job?"); builder.setPositiveButton("DELETE", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { listener.onClick(new View(context)); } }).setNegativeButton("CANCEL", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).show(); } public static AlertDialog.Builder getStandardDialog(Context context, String title, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); return builder; } public static void showInputDialog(final Context context, @StringRes int titleResId, @StringRes int hintResId, final OnTextInputDialogListener listener) { if (context == null) return; AlertDialog.Builder builder = new AlertDialog.Builder(context); View viewInflated = LayoutInflater.from(context).inflate(R.layout.dialog_with_input, null, false); final EditText input = (EditText) viewInflated.findViewById(R.id.input); TextInputLayout textInputLayout = (TextInputLayout) viewInflated.findViewById(R.id.inputLayout); builder.setView(viewInflated); if (titleResId > 0) builder.setTitle(titleResId); if (hintResId > 0) textInputLayout.setHint(context.getString(hintResId)); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (listener != null) listener.onInputFinished(input.getText().toString()); dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); afterShowSetProperties(builder, context); } public static void showCancelBookingDialog(Context context, DialogInterface.OnClickListener listener) { if (context == null) return; final AlertDialog.Builder builder = new AlertDialog.Builder(context); View viewInflated = LayoutInflater.from(context).inflate(R.layout.dialog_booking_cancel, null, false); builder.setView(viewInflated); viewInflated.findViewById(R.id.dialog_booking_keep).setVisibility(View.GONE); viewInflated.findViewById(R.id.dialog_booking_cancel).setVisibility(View.GONE); builder.setNegativeButton(R.string.employer_dialog_booking_cancel, listener); builder.setPositiveButton(R.string.job_i_can_make_it, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); afterShowSetProperties(builder, context); } public static void afterShowSetProperties(AlertDialog.Builder builder, Context context) { try { if (context == null) return; Typeface typeFaceSemiBold = Typeface.createFromAsset(context.getAssets(), "fonts/JosefinSans-SemiBold.ttf"); Typeface typeFaceBold = Typeface.createFromAsset(context.getAssets(), "fonts/JosefinSans-Bold.ttf"); AlertDialog alert = builder.create(); alert.show(); TextView tvMessage = (TextView) alert.findViewById(android.R.id.message); if (tvMessage != null) tvMessage.setTypeface(typeFaceSemiBold); TextView tvTitle = (TextView) alert.findViewById(android.R.id.title); if (tvTitle != null) tvTitle.setTypeface(typeFaceBold); Button positiveButton = alert.getButton(DialogInterface.BUTTON_POSITIVE); positiveButton.setTextColor(ContextCompat.getColor(context, R.color.redSquareColor)); positiveButton.setTypeface(typeFaceBold); Button negativeButton = alert.getButton(DialogInterface.BUTTON_NEGATIVE); if (negativeButton != null) { negativeButton.setTextColor(ContextCompat.getColor(context, R.color.redSquareColor)); negativeButton.setTypeface(typeFaceBold); } } catch (Exception e) { CrashLogHelper.logException(e); } } public static void showMultiSelectDialog(Context context, CharSequence[] dialogList, final OnLanguagesSelectedListener listener) { if (context == null) return; final AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTheme); int count = dialogList.length; boolean[] isChecked = new boolean[count]; builder.setMultiChoiceItems(dialogList, isChecked, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { } }); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ListView list = ((AlertDialog) dialog).getListView(); List<String> result = new ArrayList<>(); for (int i = 0; i < list.getCount(); i++) { if (list.isItemChecked(i)) { result.add((String) list.getItemAtPosition(i)); } } if (listener != null) listener.onLanguagesSelected(result); } } ); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } } ); AlertDialog alert = builder.create(); alert.show(); //return selectedLanguages.toString(); } }
c68eb19764238b9ffb8d6a9849f7176d47b7fb45
c2422978578b32ae0d79b3cae88dcf8e3fc8248a
/FactoryPattern/SimpleDoorFactory/DoorFactory.java
bb1d2f7fcb3badc9dfb5b484a42e215dcc8bf1bb
[]
no_license
pranav1698/design_patterns_practise
faa30169eb60a98fa12f57e70f41daa6a15a2308
9b4d56ab027713eb9510fff10945cccdc9fd733c
refs/heads/master
2023-01-11T17:00:41.946247
2020-11-18T18:41:27
2020-11-18T18:41:27
299,711,392
1
0
null
null
null
null
UTF-8
Java
false
false
138
java
public class DoorFactory { public Door makeDoor(double width, double height) { return new WoodenDoor(width, height); } }
43b21c78266a1dcd2b4f1a5e9761bef38d7671f8
6ff8893659c5c160f334a99eba75dc2bad983af3
/src/main/java/com/darlisonalves/cursomc/services/exceptions/DataIntegrityException.java
1e0419e68570c4c1a6448541459477f27623b94f
[]
no_license
darlison-alves/api-pedidos-pagamento
9b71c35bc5ada41eb32e2111ac00c58a02e677c1
627a93fd855bb70243b99e2fbb873ca2e690e1f3
refs/heads/master
2022-09-07T20:14:56.225874
2020-06-02T09:44:43
2020-06-02T09:44:43
255,718,932
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.darlisonalves.cursomc.services.exceptions; public class DataIntegrityException extends RuntimeException { private static final long serialVersionUID = 1L; public DataIntegrityException(String msg) { super(msg); } public DataIntegrityException(String msg, Throwable cause){ super(msg, cause); } }
62058d774fee43f396abb23c328b211c0ad3ba8f
72e666c2073893cbfa244d6ea154382a77824a97
/src/main/java/com/arie/test/inventory/model/BaseVersionEntity.java
ca4a8975c3d8142743b36f5b993a892c32499e41
[]
no_license
morearie/inventory
9ff09ea95ec452b3a747ae5814df14270282854f
9737b4fed3f56980218dcb7656253c06fbf1e292
refs/heads/main
2023-08-21T19:35:48.296981
2021-10-10T14:30:52
2021-10-10T14:30:52
415,224,865
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.arie.test.inventory.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import javax.persistence.Version; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @MappedSuperclass @Getter @Setter @AllArgsConstructor @NoArgsConstructor @EntityListeners(AuditingEntityListener.class) public class BaseVersionEntity implements Serializable { /** * */ private static final long serialVersionUID = 1234614398953255553L; @Version private Integer version; @CreatedBy @JsonIgnore @Column(updatable = false) private String createdBy; /** The created date. */ @CreatedDate @JsonIgnore @Column(updatable = false) private Date createdDate = new Date(); @LastModifiedBy @JsonIgnore private String lastModifiedBy; /** The modified date. */ @LastModifiedDate @JsonIgnore private Date lastModifiedDate = new Date(); }
aafc8e4e79c04f30f28561a590fc358e4eff889a
b43ee67db8c74a1f6efdac9ad833fbdb425eb1a0
/src/main/java/net/atos/spring_webapp/model/Permission.java
7ef3e563e0f3eaf42f6c87438539cc9db7b80fc9
[]
no_license
MikiKru/spring_app
3b71b282a38573473c0397c90dfe41e5009d7fd9
9895e118769cbe18ebb783f523e4c3f2ac0425fe
refs/heads/master
2020-09-13T19:02:00.893377
2019-11-22T13:41:33
2019-11-22T13:41:33
222,876,184
0
0
null
2019-11-22T13:33:56
2019-11-20T07:24:52
JavaScript
UTF-8
Java
false
false
375
java
package net.atos.spring_webapp.model; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; @NoArgsConstructor @Data @Entity public class Permission { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "permission_id") private Byte permissionId; @Column(name = "role_name") private String roleName; }
29d1976b4625900af66085f8a94a7de8866c030f
39654341c4a9528ea9939ecd7825ceb1dab12dc0
/guest-services/src/main/java/com/ihnat/mikhalkovich/guestservices/GuestServicesApplication.java
e59ec65ff3c6ab0f29d100a94657e572850a790e
[]
no_license
ihnat-mikhalkovich/spring-cloud-sample
0dfeaf72847c34fc19ae9148b87078d21fbdaa17
fe756f647db07c84941f24166062ef554e9ac15b
refs/heads/main
2023-03-26T16:41:45.096674
2021-03-19T01:00:46
2021-03-19T01:00:46
349,258,922
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
package com.ihnat.mikhalkovich.guestservices; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class GuestServicesApplication { public static void main(String[] args) { SpringApplication.run(GuestServicesApplication.class, args); } }
38ab35ad45644a653ce2acf1a38be560fcf986ef
c9c842479e6e4ddf3a079f339652961e8b6b957e
/trux/src/main/java/com/trux/dao/ZonesDAOImpl.java
64a938909558de8b9b376ecea850a46453324ee4
[]
no_license
hussainshahzad250/Transpotr
1a509d897c5e4ae11416d3e3bf58d308a88a1756
c9c5ce273c2bcac75a16a322d8a98e0ff31d0d40
refs/heads/master
2021-01-12T06:37:45.634127
2016-12-26T18:12:10
2016-12-26T18:12:10
77,399,509
0
0
null
null
null
null
UTF-8
Java
false
false
2,017
java
package com.trux.dao; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Property; import com.trux.model.Zones; public class ZonesDAOImpl implements ZonesDAO { private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @SuppressWarnings("unchecked") public Zones saveZone(Zones dto) { Session session = this.sessionFactory.openSession(); try{Transaction tx = session.beginTransaction(); session.save(dto); tx.commit(); DetachedCriteria maxID = DetachedCriteria.forClass(Zones.class) .setProjection(Projections.max("zoneId")); List<Zones> zoneList = session.createCriteria(Zones.class) .add(Property.forName("zoneId").eq(maxID)).list(); session.close(); if (zoneList != null && zoneList.size() > 0) { return zoneList.get(0); } }catch(Exception er){ er.printStackTrace(); session.close(); } return null; } @SuppressWarnings("unchecked") public List<Zones> getZones(Integer zonedId) { Session session = this.sessionFactory.openSession(); try{ List<Zones> zoneList = session.createQuery("From Zones where zoneId="+zonedId).list(); session.close(); if(zoneList!=null && zoneList.size()>0){ return zoneList; } }catch(Exception er){ er.printStackTrace(); session.close(); } return null; } @SuppressWarnings("unchecked") public List<Zones> getAllZones() { Session session = this.sessionFactory.openSession(); try{ List<Zones> zoneList = session.createQuery("From Zones").list(); session.close(); if(zoneList!=null && zoneList.size()>0){ return zoneList; } }catch(Exception er){ er.printStackTrace(); session.close(); } return null; } }
3901afb43c1a470004b9fe1a637866334899f6a1
d36cadb95057843dbccf776634e28797364e9ca6
/src/main/java/com/iivanovs/bookshopca/controller/AddressController.java
b94742a340329f871fed624735b28611426cd562
[]
no_license
scanslv/Book_Shop_CA
c199908c99c35b48aef62c4dd68b61b119bb2922
7988bee178bfdc82b00f2f8b90b10d9c7bd2d056
refs/heads/master
2020-03-08T09:33:06.011195
2018-04-13T15:06:49
2018-04-13T15:06:49
128,049,956
1
0
null
2018-04-13T15:06:50
2018-04-04T11:00:54
JavaScript
UTF-8
Java
false
false
2,849
java
package com.iivanovs.bookshopca.controller; import com.iivanovs.bookshopca.entity.Address; import com.iivanovs.bookshopca.entity.User; import com.iivanovs.bookshopca.service.AddressServiceImpl; import com.iivanovs.bookshopca.service.UserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.security.Principal; import java.util.Optional; @RestController @RequestMapping("/address") public class AddressController { public AddressController() { super(); } @Autowired private AddressServiceImpl addressService; @Autowired private UserServiceImpl userService; @RequestMapping(method = RequestMethod.POST) ResponseEntity<?> create(Principal principal, @RequestParam("id") long user_id, @RequestBody Address address) { Optional<User> u = userService.findOne(user_id); if (u.isPresent() && u.get().getEmail().equalsIgnoreCase(principal.getName())) { User user = this.addressService.create(user_id, address); if (user == null) return ResponseEntity.status(404).body("Can't create address"); else { return ResponseEntity.ok(user); } } else return ResponseEntity.status(404).body("Can't create address"); } @RequestMapping(method = RequestMethod.PUT) ResponseEntity<?> update(Principal principal, @RequestParam("id") long user_id, @RequestBody Address address) { Optional<User> u = userService.findOne(user_id); if (u.isPresent() && u.get().getEmail().equalsIgnoreCase(principal.getName())) { User user = this.addressService.update(user_id, address); if (user == null) return ResponseEntity.status(404).body("Can't update address"); else { return ResponseEntity.ok(user); } } else return ResponseEntity.status(404).body("Can't update address"); } @RequestMapping(method = RequestMethod.DELETE) ResponseEntity<?> delete(Principal principal, @RequestParam("id") long user_id) { Optional<User> u = userService.findOne(user_id); if (u.isPresent() && u.get().getEmail().equalsIgnoreCase(principal.getName())) { User user = this.addressService.delete(user_id); if (user == null) return ResponseEntity.status(404).body("Can't delete address"); else { return ResponseEntity.ok(user); } } else return ResponseEntity.status(404).body("Can't delete address"); } }
cbb05fd11964b01c2ffdec64c5dcb1f473a38b68
3afde6b5c4693fdb6a271ef5fd4924d17e1ed84e
/src/main/java/com/udacity/course3/reviews/controller/CommentsController.java
be171786980c3349dc5a7dc0234c6de91d39ca5f
[]
no_license
kalyanitiwari-java-lab/nd035-project04-CustomerReviewsFinal
04b3d1087631f1abaa33ff421ffacbb95c68a970
c814e206ac1996d3253d595701ac3851d64e16f6
refs/heads/master
2022-04-10T17:08:53.797565
2020-03-28T18:25:57
2020-03-28T18:25:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,503
java
package com.udacity.course3.reviews.controller; import com.udacity.course3.reviews.entity.Comment; import com.udacity.course3.reviews.entity.CommentDoc; import com.udacity.course3.reviews.entity.Review; import com.udacity.course3.reviews.entity.ReviewDoc; import com.udacity.course3.reviews.repository.jpa.CommentRepository; import com.udacity.course3.reviews.repository.jpa.ReviewRepository; import com.udacity.course3.reviews.repository.mongodb.ReviewDocRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Optional; /** * Spring REST controller for working with comment entity. */ @RestController @RequestMapping("/comments") public class CommentsController { // TODO: Wire needed JPA repositories here @Autowired private ReviewRepository reviewRepository; @Autowired private CommentRepository commentRepository; @Autowired private ReviewDocRepository reviewDocRepository; public CommentsController(ReviewRepository reviewRepository, CommentRepository commentRepository, ReviewDocRepository reviewDocRepository) { this.reviewRepository = reviewRepository; this.commentRepository = commentRepository; this.reviewDocRepository = reviewDocRepository; } /** * Creates a comment for a review. * * 1. Add argument for comment entity. Use {@link RequestBody} annotation. * 2. Check for existence of review. * 3. If review not found, return NOT_FOUND. * 4. If found, save comment. * * @param reviewId The id of the review. */ @RequestMapping(value = "/reviews/{reviewId}", method = RequestMethod.POST) public ResponseEntity<Comment> createCommentForReview(@PathVariable("reviewId") Integer reviewId, @RequestBody Comment comment) { Optional<Review> optionalReview = reviewRepository.findById(reviewId); if(optionalReview.isPresent()){ Review review = optionalReview.get(); comment.setReview(review); //Persist in MongoDB as well ReviewDoc matchingReviewDoc = reviewDocRepository.findById(review.getReviewDocId()).get(); List<CommentDoc> commentDocs = matchingReviewDoc.getComments(); CommentDoc commentDoc = new CommentDoc(); commentDoc.setTitle(comment.getTitle()); commentDoc.setCommentText(comment.getCommentText()); commentDocs.add(commentDoc); reviewDocRepository.save(matchingReviewDoc); return ResponseEntity.ok(commentRepository.save(comment)); }else{ return ResponseEntity.notFound().build(); } } /** * List comments for a review. * * 2. Check for existence of review. * 3. If review not found, return NOT_FOUND. * 4. If found, return list of comments. * * @param reviewId The id of the review. */ @RequestMapping(value = "/reviews/{reviewId}", method = RequestMethod.GET) public ResponseEntity<List<Comment>> listCommentsForReview(@PathVariable("reviewId") Integer reviewId) { Optional<Review> optionalReview = reviewRepository.findById(reviewId); if(optionalReview.isPresent()){ return ResponseEntity.ok(commentRepository.findAllByReview(new Review(reviewId))); }else{ return ResponseEntity.notFound().build(); } } }
4e60c19d307b7ce00f0f9b92673d2a375931ff02
2fd9d77d529e9b90fd077d0aa5ed2889525129e3
/DecompiledViberSrc/app/src/main/java/com/google/android/gms/internal/ads/zzdqn.java
4423feff1194c532ede0675ff0d070ec4cf0fddf
[]
no_license
cga2351/code
703f5d49dc3be45eafc4521e931f8d9d270e8a92
4e35fb567d359c252c2feca1e21b3a2a386f2bdb
refs/heads/master
2021-07-08T15:11:06.299852
2021-05-06T13:22:21
2021-05-06T13:22:21
60,314,071
1
3
null
null
null
null
UTF-8
Java
false
false
521
java
package com.google.android.gms.internal.ads; final class zzdqn implements zzdph { public final int zzayz() { throw new NoSuchMethodError(); } public final boolean zzaza() { throw new NoSuchMethodError(); } public final zzdpj zzazb() { throw new NoSuchMethodError(); } } /* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_2_dex2jar.jar * Qualified Name: com.google.android.gms.internal.ads.zzdqn * JD-Core Version: 0.6.2 */
0da5ce881224f71cc272e7515e86f14c58d796d8
6062d781a1e500614eb852dff40202dc24a904d0
/week-07/day-01/practice/src/test/java/com/greenfoxacademy/springintro/SpringintroApplicationTests.java
abeb88569b4a426292fc979aa41b9ec473221e28
[]
no_license
green-fox-academy/Lilla
4c50f9b3fee2835685661a904bbd9688c6ffbace
c35b4e2be51ea994a4e03ca534b2d7f2a6392261
refs/heads/master
2021-09-10T10:37:18.868729
2018-03-24T15:25:09
2018-03-24T15:25:09
112,354,547
0
1
null
null
null
null
UTF-8
Java
false
false
353
java
package com.greenfoxacademy.springintro; 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 public class SpringintroApplicationTests { @Test public void contextLoads() { } }
215431c06ae3acd31cf73b25b523bdf05c77bac1
4a46674ecad95ae51cdbebb8a59daf10d097a3b1
/src/main/java/Netty/runtime/ServerHandler.java
6798d09507dd6d79bb1e5c2d06d32aafc24209bf
[]
no_license
pengrenjun/SockeIONettyStudy
a2b941c60ac6dd771e911b7ea15ede05aefb0264
45b376d36be491e44aa92805bd9c5f8f8579798a
refs/heads/master
2021-06-26T06:57:23.548913
2019-10-03T13:24:24
2019-10-03T13:24:24
154,242,406
1
0
null
2020-10-13T16:02:27
2018-10-23T01:33:19
Java
UTF-8
Java
false
false
1,004
java
package Netty.runtime; import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerContext; public class ServerHandler extends ChannelHandlerAdapter{ @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Request request = (Request)msg; System.out.println("Server : " + request.getId() + ", " + request.getName() + ", " + request.getRequestMessage()); Response response = new Response(); response.setId(request.getId()); response.setName("response" + request.getId()); response.setResponseMessage("响应内容" + request.getId()); ctx.writeAndFlush(response);//.addListener(ChannelFutureListener.CLOSE); } @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { ctx.close(); } }
9ae9ddedd2d2d7cd8adca5a823e0d4c077660407
428973e10582c2ad84a6056f9966a475f4d6530b
/kodilla-collections/src/main/java/com/kodilla/collections/interfaces/homework/Opel.java
7a1c7238297d9b08b26bf559738e20028d5a3636
[]
no_license
MagdaRdk/magdalena_rudnik-kodilla_tester
2c3cb076e21259bf84765b586927e7012266fe88
378ecacb91c6baa1cc5bfd5d410f6e0b8ba4e751
refs/heads/master
2022-12-17T10:47:53.519112
2020-09-21T19:07:42
2020-09-21T19:07:42
265,937,740
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package com.kodilla.collections.interfaces.homework; public class Opel implements Car { private double speedO; public Opel (double speedO) { this.speedO = speedO; } @Override public String toString() { return "Opel{" + "speedO=" + speedO + '}'; } @Override public double getSpeed() { return speedO; } public double increaseSpeed() { return speedO + 20; } public double decreaseSpeed() { return speedO - 5; } }
978fe803fe520efebbc94a45b88452ac842e8c28
51ff905cd5becc60248e15d90fcba4b24b953e7a
/TrackMeInside/app/src/main/java/ch/hearc/trackmeinside/Trilateration.java
c329606056e3e8bab0b285d02d5bd46fca33e1c1
[]
no_license
thegazou/track-me-inside
f00f805acec818fa772630a4832807adc4a29997
ff63eb4431f493a0e13f2864f7781a4b865f311f
refs/heads/master
2021-04-29T10:46:05.574165
2017-01-24T22:10:06
2017-01-24T22:10:06
77,832,252
0
0
null
null
null
null
UTF-8
Java
false
false
2,790
java
package ch.hearc.trackmeinside; import java.util.List; /** * Created by Mateli on 18.01.2017. */ public class Trilateration { /** * * @param listCercles (size == 3) * @return */ public static Cercle trilaterer(List<Cercle> listCercles){ double top = 0; double bot = 0; for (int i=0; i<3; i++) { Cercle c = listCercles.get(i); Cercle c2, c3; if (i==0) { c2 = listCercles.get(1); c3 = listCercles.get(2); } else if (i==1) { c2 = listCercles.get(0); c3 = listCercles.get(2); } else { c2 = listCercles.get(0); c3 = listCercles.get(1); } double d = c2.x - c3.x; double v1 = (c.x * c.x + c.y * c.y) - (c.r * c.r); top += d*v1; double v2 = c.y * d; bot += v2; } double y = top / (2*bot); Cercle c1 = listCercles.get(0); Cercle c2 = listCercles.get(1); top = c2.r*c2.r+c1.x*c1.x+c1.y*c1.y-c1.r*c1.r-c2.x*c2.x-c2.y*c2.y-2*(c1.y-c2.y)*y; bot = c1.x-c2.x; double x = top / (2*bot); return new Cercle(x,y,0); } /** * * @param listCercles (min size = 1, pas de maxsize) * @return */ public static Cercle trilaterer2(List<Cercle> listCercles){ double x = 0; double y = 0; double normalizeCoefficient = 0.0; int size = listCercles.size(); //if(listCercles.size() != 3) //return null; //take revert values, because lower distance then bigger weight for (int i = 0; i < size; i++) normalizeCoefficient += 1.0 / (listCercles.get(i).r * listCercles.get(i).r); //System.out.println("Normalized coef : "+normalizeCoefficient); double[] tabWeight = new double[size]; for (int i = 0; i < size; i++) { // calculate probability of being at beacons x,y coordinates tabWeight[i] = 1.0 / (listCercles.get(i).r * listCercles.get(i).r * normalizeCoefficient ); //System.out.println("weight "+ i+" : "+tabWeight[i]); double beaconX = listCercles.get(i).x;//mBeaconMeas[ i ].getBeaconPtr()->getX(); double beaconY = listCercles.get(i).y;//mBeaconMeas[ i ].getBeaconPtr()->getY(); //System.out.println("beaconX "+ i+" : "+beaconX); //System.out.println("beaconY "+ i+" : "+beaconY); //find final coordinates according to probability x += tabWeight[ i ] * beaconX; y += tabWeight[ i ] * beaconY; } return new Cercle(x,y,0); } }
fb0c09d0ba9de59382956a7ad0d3d46d41ba36b3
c5b694e3873cd095208c0f796dff537ba1d82b98
/i_gede_susila_astawa/app/src/androidTest/java/example/com/oticket/ExampleInstrumentedTest.java
29faa9acdff2cbee9e2c7a598aa7650d2f29f7d6
[]
no_license
omrobbie/Final-Project-IAK-Periode-3-Batch-3
7d077e2272d654f30c2be2656e0151c004b28cb1
7f345ac651ba8d554b900f9eb63eeb3e0da0cf89
refs/heads/master
2021-08-28T04:45:19.653919
2017-12-11T07:34:13
2017-12-11T07:35:21
112,972,393
0
10
null
2017-12-10T16:37:11
2017-12-03T23:21:39
Java
UTF-8
Java
false
false
739
java
package example.com.oticket; 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.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("example.com.oticket", appContext.getPackageName()); } }
8834253e998412a6835b3b3a7582429e940ae74e
a3e032a19b88cdfa6fca71f3dc7fbd85fd79f3c6
/exoplayer/src/main/java/com/google/android/exoplayer/DummyTrackRenderer.java
485dd34206cdafd279552be48ae012881ff2c59a
[]
no_license
ihrthk/VideoPlayer
1dd86b7a16c3f6459b6580ff543b0ffbb632c9d4
2aaee57f0a8075d2d3592134ab602eb5e5282ce6
refs/heads/master
2021-01-19T08:25:50.139821
2015-02-03T07:32:19
2015-02-03T07:32:19
28,563,487
0
0
null
null
null
null
UTF-8
Java
false
false
1,943
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer; /** * A {@link TrackRenderer} that does nothing. * <p/> * This renderer returns {@link TrackRenderer#STATE_IGNORE} from {@link #doPrepare()} in order to * request that it should be ignored. {@link IllegalStateException} is thrown from all methods that * are documented to indicate that they should not be invoked unless the renderer is prepared. */ public class DummyTrackRenderer extends TrackRenderer { @Override protected int doPrepare() throws ExoPlaybackException { return STATE_IGNORE; } @Override protected boolean isEnded() { throw new IllegalStateException(); } @Override protected boolean isReady() { throw new IllegalStateException(); } @Override protected void seekTo(long positionUs) { throw new IllegalStateException(); } @Override protected void doSomeWork(long positionUs, long elapsedRealtimeUs) { throw new IllegalStateException(); } @Override protected long getDurationUs() { throw new IllegalStateException(); } @Override protected long getBufferedPositionUs() { throw new IllegalStateException(); } @Override protected long getCurrentPositionUs() { throw new IllegalStateException(); } }
b0b66ac4f555c17d9b95b39765b531b2da81340b
ee082d98892a3add1ed4865303be35d49e091261
/DivRanking/src/org/archive/a1/search/another/jsearchdemo/ThingWithProperties.java
283bd1b4b38a8b9964e1d2433ff387aff24cc274
[]
no_license
laurel2935/DivRanking
a7fea2d71840853bec2277096202fb59a1ce2c02
9e9b7067fcc5c25fa62a4fbc8fcc5f1ce05ebb48
refs/heads/master
2016-09-05T11:00:34.359657
2015-10-20T13:33:45
2015-10-20T13:33:45
42,454,235
0
2
null
null
null
null
UTF-8
Java
false
false
142
java
package org.archive.a1.search.another.jsearchdemo; import java.util.*; interface ThingWithProperties { Vector getProperties(); }
[ "Forest Lion@Winapple" ]
Forest Lion@Winapple
45f93693cb2914fba81357d0d00cb20eb04dfdcc
969d7bf9a10bc944303c2f16095b611c3688642d
/src/main/java/org/lwjglb/engine/GameEngine.java
409947cc7cbaebc622f33b78282a6455b70edd0c
[]
no_license
EasternSauce/GamePrototype
8531915f613211ebf9be216805eab4393588940a
c3ae9755107f935f027707b87bf77b7a61e0d92c
refs/heads/master
2022-03-01T12:04:51.915469
2019-10-29T15:44:54
2019-10-29T15:44:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,781
java
package org.lwjglb.engine; public class GameEngine implements Runnable { public static final int TARGET_FPS = 60; public static final int TARGET_UPS = 60; private final Window window; private final Timer timer; private final IGameLogic gameLogic; private double lastFps; private int fps; private String windowTitle; public GameEngine(String windowTitle, boolean vSync, Window.WindowOptions opts, IGameLogic gameLogic) throws Exception { this(windowTitle, 0, 0, vSync, opts, gameLogic); } public GameEngine(String windowTitle, int width, int height, boolean vSync, Window.WindowOptions opts, IGameLogic gameLogic) throws Exception { this.windowTitle = windowTitle; window = new Window(windowTitle, width, height, vSync, opts); this.gameLogic = gameLogic; timer = new Timer(); } @Override public void run() { try { init(); gameLoop(); } catch (Exception excp) { excp.printStackTrace(); } finally { cleanup(); } } protected void init() throws Exception { window.init(); timer.init(); gameLogic.init(window); lastFps = timer.getTime(); fps = 0; } protected void gameLoop() { float elapsedTime; float accumulator = 0f; float interval = 1f / TARGET_UPS; boolean running = true; while (running && !window.windowShouldClose()) { elapsedTime = timer.getElapsedTime(); accumulator += elapsedTime; input(); while (accumulator >= interval) { update(interval); accumulator -= interval; } render(); if ( !window.isvSync() ) { sync(); } } } protected void cleanup() { gameLogic.cleanup(); } private void sync() { float loopSlot = 1f / TARGET_FPS; double endTime = timer.getLastLoopTime() + loopSlot; while (timer.getTime() < endTime) { try { Thread.sleep(1); } catch (InterruptedException ie) { } } } protected void input() { gameLogic.input(window); } protected void update(float interval) { gameLogic.update(interval, window); } protected void render() { if ( window.getWindowOptions().showFps && timer.getLastLoopTime() - lastFps > 1 ) { lastFps = timer.getLastLoopTime(); window.setWindowTitle(windowTitle + " - " + fps + " FPS"); fps = 0; } fps++; gameLogic.render(window); window.update(); } }
0c0bfa544ac1b511483ef90191ca6787f6d809ff
e5b9397e15a547ccc237c4c9e610ebde89674f19
/app/src/main/java/com/rarcher/Login_Register/LoginActivity.java
18f719f0fba531fbad5b8565c6b24b757ebf2f70
[]
no_license
Rarchers/Spring
e49b8fb29dffbda3c6e6393067638f22bbe578ad
4db696995cd024374d4b0a259fb0c3af47fb9184
refs/heads/master
2020-04-26T09:32:45.613241
2019-03-29T13:23:05
2019-03-29T13:23:05
173,459,253
0
0
null
null
null
null
UTF-8
Java
false
false
15,929
java
package com.rarcher.Login_Register; import android.animation.ValueAnimator; import android.app.ProgressDialog; import android.content.ContentValues; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.graphics.Color; import android.graphics.Rect; import android.os.Build; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.animation.DecelerateInterpolator; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.rarcher.Acticitys.MainActivity; import com.rarcher.DataBase.LocalDB; import com.rarcher.DataBase.Nowusers; import com.rarcher.DataBase.Users; import com.rarcher.R; import java.io.ByteArrayInputStream; public class LoginActivity extends AppCompatActivity implements View.OnClickListener, View.OnFocusChangeListener, ViewTreeObserver.OnGlobalLayoutListener, TextWatcher { /* * 控件 * */ CheckBox markme; private ImageButton mIbNavigationBack; private EditText mEtLoginUsername; private EditText mEtLoginPwd; private LinearLayout mLlLoginUsername; private ImageView mIvLoginUsernameDel; private Button mBtLoginSubmit; private LinearLayout mLlLoginPwd; private ImageView mIvLoginPwdDel; private ImageView mIvLoginLogo; private LinearLayout mLayBackBar; private TextView mTvLoginForgetPwd; private Button mBtLoginRegister; //全局Toast private Toast mToast; private int mLogoHeight; private int mLogoWidth; String RU,RP; String TAG = "Login"; private SharedPreferences preferences; private SharedPreferences.Editor editor; //登陆对话框 ProgressDialog progressDialog; /* * DataBase * */ LocalDB dbhelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); title(); setContentView(R.layout.activity_login); Intent intent = getIntent(); RU = intent.getStringExtra("un"); RP = intent.getStringExtra("pa"); Log.d(TAG, "onCreate: RU"+RU); Log.d(TAG, "onCreate: RP"+RP); //注册dialog progressDialog = new ProgressDialog(LoginActivity.this); markme = findViewById(R.id.markme); preferences = PreferenceManager.getDefaultSharedPreferences(this); initView(); String username = mEtLoginUsername.getText().toString().trim(); String pwd = mEtLoginPwd.getText().toString().trim(); //登录按钮是否可用 if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(username)) { mBtLoginSubmit.setClickable(true); mBtLoginSubmit.setBackgroundResource(R.drawable.bg_login_submit); mBtLoginSubmit.setTextColor(getResources().getColor(R.color.black)); } else { mBtLoginSubmit.setBackgroundResource(R.drawable.bg_login_submit_lock); mBtLoginSubmit.setClickable(false); mBtLoginSubmit.setTextColor(getResources().getColor(R.color.account_lock_font_color)); } //数据库初始化 dbhelper = new LocalDB(LoginActivity.this, "User.db", null, 2); dbhelper.getWritableDatabase(); } //初始化视图 private void initView() { //导航栏+返回按钮 mLayBackBar = findViewById(R.id.ly_retrieve_bar); mIbNavigationBack = findViewById(R.id.ib_navigation_back); //logo mIvLoginLogo = findViewById(R.id.iv_login_logo); //username mLlLoginUsername = findViewById(R.id.ll_login_username); mEtLoginUsername = findViewById(R.id.et_login_username); mIvLoginUsernameDel = findViewById(R.id.iv_login_username_del); //passwd mLlLoginPwd = findViewById(R.id.ll_login_pwd); mEtLoginPwd = findViewById(R.id.et_login_pwd); mIvLoginPwdDel = findViewById(R.id.iv_login_pwd_del); //提交、注册 mBtLoginSubmit = findViewById(R.id.bt_login_submit); mBtLoginRegister = findViewById(R.id.bt_login_register); //忘记密码 mTvLoginForgetPwd = findViewById(R.id.tv_login_forget_pwd); mTvLoginForgetPwd.setOnClickListener(this); boolean isRemember = preferences.getBoolean("remember", false); //检查是否记住密码 if (isRemember&&RU==null&&RP==null) { String account = preferences.getString("account", ""); String pass = preferences.getString("password", ""); mEtLoginUsername.setText(account); mEtLoginPwd.setText(pass); markme.setChecked(true); } else if (RU!=null&&RP!=null) { mEtLoginUsername.setText(RU); mEtLoginPwd.setText(RP); } mIbNavigationBack.setVisibility(View.INVISIBLE); mIbNavigationBack.setClickable(false); //注册点击事件 mIbNavigationBack.setOnClickListener(this); mEtLoginUsername.setOnClickListener(this); mIvLoginUsernameDel.setOnClickListener(this); mBtLoginSubmit.setOnClickListener(this); mBtLoginRegister.setOnClickListener(this); mEtLoginPwd.setOnClickListener(this); mIvLoginPwdDel.setOnClickListener(this); //注册其它事件 mLayBackBar.getViewTreeObserver().addOnGlobalLayoutListener(this); mEtLoginUsername.setOnFocusChangeListener(this); mEtLoginUsername.addTextChangedListener(this); mEtLoginPwd.setOnFocusChangeListener(this); mEtLoginPwd.addTextChangedListener(this); } //融合状态栏 private void title() { if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); getWindow().setStatusBarColor(Color.TRANSPARENT); } } //显示loading对话框 private void showloading() { progressDialog.setTitle("登陆中"); progressDialog.setMessage("Loading..."); progressDialog.setCancelable(true); progressDialog.show(); } //关闭loading private void closeloading() { progressDialog.cancel(); } //云端数据库查到资料后放进本地数据库 private void addtolocal(String phone, String password, String name, String sex) { SQLiteDatabase db = dbhelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("phone", phone); values.put("password", password); values.put("name", name); values.put("sex", sex); db.insert("Book", null, values); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.ib_navigation_back: //返回 //finish(); break; case R.id.et_login_username: mEtLoginPwd.clearFocus(); mEtLoginUsername.setFocusableInTouchMode(true); mEtLoginUsername.requestFocus(); break; case R.id.et_login_pwd: mEtLoginUsername.clearFocus(); mEtLoginPwd.setFocusableInTouchMode(true); mEtLoginPwd.requestFocus(); break; case R.id.iv_login_username_del: //清空用户名 mEtLoginUsername.setText(null); break; case R.id.iv_login_pwd_del: //清空密码 mEtLoginPwd.setText(null); break; case R.id.bt_login_submit: //登录 loginRequest(); break; case R.id.bt_login_register: //注册 startActivity(new Intent(LoginActivity.this, RegisterActivity.class)); finish(); break; case R.id.tv_login_forget_pwd: //忘记密码 startActivity(new Intent(LoginActivity.this, ForgetPwdActivity.class)); break; default: break; } } //用户名密码焦点改变 @Override public void onFocusChange(View v, boolean hasFocus) { int id = v.getId(); if (id == R.id.et_login_username) { if (hasFocus) { mLlLoginUsername.setActivated(true); mLlLoginPwd.setActivated(false); } } else { if (hasFocus) { mLlLoginPwd.setActivated(true); mLlLoginUsername.setActivated(false); } } } //显示或隐藏logo @Override public void onGlobalLayout() { final ImageView ivLogo = this.mIvLoginLogo; Rect KeypadRect = new Rect(); mLayBackBar.getWindowVisibleDisplayFrame(KeypadRect); int screenHeight = mLayBackBar.getRootView().getHeight(); int keypadHeight = screenHeight - KeypadRect.bottom; //隐藏logo if (keypadHeight > 300 && ivLogo.getTag() == null) { final int height = ivLogo.getHeight(); final int width = ivLogo.getWidth(); this.mLogoHeight = height; this.mLogoWidth = width; ivLogo.setTag(true); ValueAnimator valueAnimator = ValueAnimator.ofFloat(1, 0); valueAnimator.setDuration(400).setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float animatedValue = (float) animation.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = ivLogo.getLayoutParams(); layoutParams.height = (int) (height * animatedValue); layoutParams.width = (int) (width * animatedValue); ivLogo.requestLayout(); ivLogo.setAlpha(animatedValue); } }); if (valueAnimator.isRunning()) { valueAnimator.cancel(); } valueAnimator.start(); } //显示logo else if (keypadHeight < 300 && ivLogo.getTag() != null) { final int height = mLogoHeight; final int width = mLogoWidth; ivLogo.setTag(null); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(400).setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float animatedValue = (float) animation.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = ivLogo.getLayoutParams(); layoutParams.height = (int) (height * animatedValue); layoutParams.width = (int) (width * animatedValue); ivLogo.requestLayout(); ivLogo.setAlpha(animatedValue); } }); if (valueAnimator.isRunning()) { valueAnimator.cancel(); } valueAnimator.start(); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } //用户名密码输入事件 @Override public void afterTextChanged(Editable s) { String username = mEtLoginUsername.getText().toString().trim(); String pwd = mEtLoginPwd.getText().toString().trim(); Log.d(TAG, "afterTextChanged: change"); //是否显示清除按钮 if (username.length() > 0) { mIvLoginUsernameDel.setVisibility(View.VISIBLE); } else { mIvLoginUsernameDel.setVisibility(View.INVISIBLE); } if (pwd.length() > 0) { mIvLoginPwdDel.setVisibility(View.VISIBLE); } else { mIvLoginPwdDel.setVisibility(View.INVISIBLE); } //登录按钮是否可用 if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(username)) { mBtLoginSubmit.setClickable(true); mBtLoginSubmit.setBackgroundResource(R.drawable.bg_login_submit); mBtLoginSubmit.setTextColor(getResources().getColor(R.color.black)); } else { mBtLoginSubmit.setBackgroundResource(R.drawable.bg_login_submit_lock); mBtLoginSubmit.setClickable(false); mBtLoginSubmit.setTextColor(getResources().getColor(R.color.account_lock_font_color)); } } //登录 private void loginRequest() { showloading(); Toast.makeText(LoginActivity.this, "showloading", Toast.LENGTH_SHORT).show(); String account = mEtLoginUsername.getText().toString(); String pass = mEtLoginPwd.getText().toString(); if (account == "" || pass == "") { closeloading(); Toast.makeText(LoginActivity.this, "请输入用户名或者密码", Toast.LENGTH_SHORT).show(); } Users logins = LocalDB.query_user(account,dbhelper); //如果本地数据库有记录,就直接放行,不去云端数据库搞事情了 if (logins != null && pass.equals(logins.getPassword())) { editor = preferences.edit(); if (markme.isChecked()) {//记住密码是否生效 editor.putBoolean("remember", true); editor.putString("account", account); editor.putString("password", pass); LocalDB.updata_user(account, pass,dbhelper); } else editor.clear(); editor.apply(); Toast.makeText(LoginActivity.this, "登陆成功", Toast.LENGTH_SHORT).show(); closeloading(); Nowusers.setPhone(account); Nowusers.setName(logins.getName()); Intent intent = new Intent(LoginActivity.this, MainActivity.class); intent.putExtra("user", account); startActivity(intent); finish(); } else {//本地数据库为空或者密码匹配不上 //请求云端服务器拉取信息 Toast.makeText(LoginActivity.this, "从云端数据库获取信息或者登陆失败", Toast.LENGTH_SHORT).show(); } } //退出时的时间 private long mExitTime; //对返回键进行监听 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { exit(); return true; } return super.onKeyDown(keyCode, event); } //退出方法 private void exit() { if ((System.currentTimeMillis() - mExitTime) > 2000) { Toast.makeText(LoginActivity.this, "再按1一次退出应用", Toast.LENGTH_SHORT).show(); mExitTime = System.currentTimeMillis(); } else { //用户退出处理 finish(); System.exit(0); } } }
a6b62d6639276297090cf75c5f6bdd3d0099bff8
09b5122d25fd3435bcce2513764c0ca2bd5c4d61
/app/src/main/java/at/mrtramoga/moviebuddy/themoviedb3/MovieReviewsAnswer.java
dca57a52ff357d991b0fd678d38cdde57c73eae3
[ "MIT" ]
permissive
ChristianMoesl/movie-buddy
64cc8c9dbfbcd35cd2edae51809aa1f7bd0f4943
a8bafa1fdc9f4184f553d20111d2eb9e23d3358e
refs/heads/master
2021-12-15T04:56:55.089073
2017-11-08T20:06:56
2017-11-08T20:06:56
90,909,728
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package at.mrtramoga.moviebuddy.themoviedb3; import java.util.List; public class MovieReviewsAnswer { public static class Review { private String id; private String author; private String content; private String url; public String getId() { return id; } public String getAuthor() { return author; } public String getContent() { return content; } public String getUrl() { return url; } } private long id; private long page; private List<Review> results; private long totalPages; private long totalResults; public long getId() { return id; } public long getPage() { return page; } public List<Review> getReviews() { return results; } public long getTotalPages() { return totalPages; } public long getTotalResults() { return totalResults; } }
f0ac0a5602cf159a6eaa744630fe93e0202ab8e2
d6bd75156e8a1a5287d67e4ca9d726d903468f06
/src/main/java/com/dayshare/utils/email/EmailServiceImpl.java
2673f71a6fd4307dc38a52f632fea9b55a5f7eb4
[]
no_license
kpl39/day-share-api
032be7aa65a7191f197fe88bd12e38198a71a43f
cacd89c5610b3e8403f59f3d0776e9449d44b391
refs/heads/master
2021-04-25T16:40:34.160886
2018-02-25T14:55:15
2018-02-25T14:55:15
108,195,131
1
0
null
null
null
null
UTF-8
Java
false
false
1,637
java
package com.dayshare.utils.email; import com.amazonaws.services.simpleemail.AmazonSimpleEmailService; import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder; import com.amazonaws.services.simpleemail.model.*; import com.dayshare.emails.Email; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class EmailServiceImpl implements EmailService { @Autowired private AmazonSimpleEmailService sesClient; public String sendEmail(Email email) { String recipient = "[email protected]"; String sender = "Day Share <[email protected]>"; String subject = email.getSubject(); String body = email.getMessageBody(); String status; try { SendEmailRequest request = new SendEmailRequest() .withDestination( new Destination().withToAddresses(recipient)) .withMessage(new Message() .withBody(new Body() .withText(new Content() .withCharset("UTF-8").withData(body))) .withSubject(new Content() .withCharset("UTF-8").withData(subject))) .withSource(sender); sesClient.sendEmail(request); status = "Great Success"; } catch (Exception ex) { System.out.println("Email not sent: " + ex.getMessage()); status = "Dumbass"; } return status; } }
a1c54b2ddae49b1b27e1f50b0fe463a3fa1f4b46
1cce29cd23674b1e7f3d523c779231032720add4
/src/main/java/com/suixingpay/profit/jikeshijian/xiengnengyouhua/DemoApplication15.java
79f52c53295a0a2662b78ab26246dc06c624085f
[]
no_license
histjxg/hxg-all
b87a30f2c18c8c075067c406fb1aac8b56dbff4d
01a1aabb12f3a56bb74698ac986fd16268421698
refs/heads/master
2023-07-11T22:10:39.808894
2021-08-18T16:07:35
2021-08-18T16:07:36
397,638,703
0
0
null
null
null
null
UTF-8
Java
false
false
2,593
java
package com.suixingpay.profit.jikeshijian.xiengnengyouhua; public class DemoApplication15 { public static void main(String[] args) { // 运行多线程 MultiThreadTester test1 = new MultiThreadTester(); test1.Start(); // 运行单线程 SerialTester test2 = new SerialTester(); test2.Start(); } static class MultiThreadTester extends ThreadContextSwitchTester { @Override public void Start() { long start = System.currentTimeMillis(); MyRunnable myRunnable1 = new MyRunnable(); Thread[] threads = new Thread[4]; // 创建多个线程 for (int i = 0; i < 4; i++) { threads[i] = new Thread(myRunnable1); threads[i].start(); } for (int i = 0; i < 4; i++) { try { // 等待一起运行完 threads[i].join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } long end = System.currentTimeMillis(); System.out.println("multi thread exce time: " + (end - start) + "s"); System.out.println("counter: " + counter); } // 创建一个实现 Runnable 的类 class MyRunnable implements Runnable { public void run() { while (counter < 100000000) { synchronized (this) { if(counter < 100000000) { increaseCounter(); } } } } } } // 创建一个单线程 static class SerialTester extends ThreadContextSwitchTester{ @Override public void Start() { long start = System.currentTimeMillis(); for (long i = 0; i < count; i++) { increaseCounter(); } long end = System.currentTimeMillis(); System.out.println("serial exec time: " + (end - start) + "s"); System.out.println("counter: " + counter); } } // 父类 static abstract class ThreadContextSwitchTester { public static final int count = 100000000; public volatile int counter = 0; public int getCount() { return this.counter; } public void increaseCounter() { this.counter += 1; } public abstract void Start(); } }
b0cbc5c2eadf67dbf1164838aadd8d35fb2c5d88
46d7a0d4b2e1bc62f3e6032da88ce9573db386fc
/br/unipe/java/unidade1/Aulas/Aula10/src/gravarObjeto/UsaContato.java
7e7a00919113395281af213c1692fc5e907c0a41
[]
no_license
danielnathan1/JavaP3
6474994de2a7561adb573d36e1e037041f0c9c3a
b8ced849977cb453ab6d3269345bf31f7d9dd3a7
refs/heads/master
2021-01-19T10:48:15.927823
2017-06-05T04:18:12
2017-06-05T04:18:12
82,205,050
0
0
null
null
null
null
UTF-8
Java
false
false
1,006
java
package gravarObjeto; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader; import java.io.ObjectOutputStream; import java.util.Scanner; public class UsaContato { public static void main(String[] args) { GravarObjeto gravar = new GravarObjeto(); LerObjeto ler = new LerObjeto(); Scanner leitor= new Scanner(System.in); System.out.println("Digite o ID: "); String id= leitor.nextLine(); System.out.println("Digite o Nome: "); String nome = leitor.nextLine(); try{ FileOutputStream fos = new FileOutputStream("arquivo.txt"); byte[] contentINBytes = id.getBytes(); fos.write(contentINBytes); byte[] contetINBytes2 = nome.getBytes(); fos.write(contetINBytes2); fos.close(); FileReader fr = new FileReader("arquivo.txt"); BufferedReader br = new BufferedReader(fr); String s = br.readLine(); br.close(); System.out.println(s); }catch (Exception e) { System.out.println("erro"); } } }
48416eb38340c89bb319689317131fab7b6da960
abbc8366dd0ceecc14861775f126b60020060175
/src/paquetePrincipal/TablaDescriptores.java
c0513ec542af5a488d4aacc0f821ff5ab206dd92
[]
no_license
cnuila/Compilador_VB6.0
98d3f82d2893627942bfdfad2b1021e5fbd98367
24a02a142af5143326aea422a37a07544e3ded8f
refs/heads/master
2023-05-30T18:14:28.717000
2021-06-24T21:58:34
2021-06-24T21:58:34
341,435,036
2
1
null
null
null
null
UTF-8
Java
false
false
262
java
package paquetePrincipal; import java.util.ArrayList; public class TablaDescriptores { private ArrayList<Boolean> tablaDescriptores; TablaDescriptores() { } public ArrayList<Boolean> getDescriptores(){ return tablaDescriptores; } }
73be8a2f2275d3e56eec10aab5302e4a9b52233f
bba653e4ec049feaee23e23f0ac8272112fb5f7b
/app/src/main/java/com/example/administrator/mytestdemo/verticalviewpager/ContentAdapter.java
125dd3dbdac28eedf7553b15c59d1f36703fa9de
[]
no_license
blueflychief/MyTestDemo
91437037c5c179a6c36c200f724fa2d51e07c8c5
0b3febfb4cd2dd907abbb1c5c1a01b893623fddd
refs/heads/master
2020-05-21T22:16:31.811995
2017-01-09T12:59:11
2017-01-09T12:59:11
65,727,183
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package com.example.administrator.mytestdemo.verticalviewpager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.administrator.mytestdemo.R; public class ContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ContentView(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_content, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { ContentView content = (ContentView) holder; content.textView.setText("content" + position); } @Override public int getItemCount() { return 15; } public class ContentView extends RecyclerView.ViewHolder { private TextView textView; public ContentView(View itemView) { super(itemView); textView = (TextView) itemView.findViewById(R.id.context_text); } } }
5cebb9d04ddc6a2ad4197de833835aa179f4cecd
672e0c8962118048b1a7e947dea4448bed4419a5
/android/SplashActivity.java
e57b19c43bbecb69509719acea4d32579578ad52
[]
no_license
jhnyang/postureRecognition
8ec355c53486ec1bc8cfbe80db12e24d7f7b9c29
54dd8b3e56a5f2767674bf1bd92858ae77cdfa50
refs/heads/master
2020-04-03T16:57:49.043251
2018-12-03T14:15:01
2018-12-03T14:15:01
155,426,035
0
0
null
null
null
null
UTF-8
Java
false
false
3,110
java
package com.example.yangJihyun.bubu_main; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.WindowManager; import android.widget.LinearLayout; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.remoteconfig.FirebaseRemoteConfig; import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; public class SplashActivity extends AppCompatActivity { private LinearLayout linearLayout; private FirebaseRemoteConfig mFirebaseRemoteConfig; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //state bar 제거 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); linearLayout = (LinearLayout) findViewById(R.id.splashactivity_linaerlayout); mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(BuildConfig.DEBUG) .build(); mFirebaseRemoteConfig.setConfigSettings(configSettings); mFirebaseRemoteConfig.setDefaults(R.xml.default_config); mFirebaseRemoteConfig.fetch(0) .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { // Once the config is successfully fetched it must be activated before newly fetched // values are returned. mFirebaseRemoteConfig.activateFetched(); } else { } displayMessage(); } }); } void displayMessage() { String splash_background = mFirebaseRemoteConfig.getString("splash_background"); boolean caps = mFirebaseRemoteConfig.getBoolean("splash_message_caps"); String splash_message = mFirebaseRemoteConfig.getString("splash_message"); linearLayout.setBackgroundColor(Color.parseColor(splash_background)); if(caps) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(splash_message).setPositiveButton("확인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { finish(); } }); builder.create().show(); } else { startActivity(new Intent(this,LoginActivity.class)); finish(); } } }
ba73bc0beb9fa9dfaa438f7624af22f6d995073e
99f8699e1e95589293dc0c188b104e8307c4bada
/src/main/java/com/cinema/utility/MovieType.java
90ea92a8b7c2206411ba8be52b2868ebbc068636
[]
no_license
bahatas/cinemaLab
6d45a3c80f5fa6ae493bdd264b54f27717268911
329f07b6279e72ff6cd2471048e16a32f1b89e03
refs/heads/master
2023-05-12T23:59:35.760616
2021-06-03T18:05:34
2021-06-03T18:05:34
372,898,708
0
0
null
null
null
null
UTF-8
Java
false
false
80
java
package com.cinema.utility; public enum MovieType { PREMIER,REGULAR; }
a470101c998c4c1ddf1a8cc1f861a1c823e453d1
db23b0198a89f132e98f2869d7ad3f09fbf8490e
/app/src/main/java/com/cyl/musiclake/player/playback/PlaybackListener.java
d51bcf8b0dffd7d954c1da26e6dd0233d4faa7b0
[ "Apache-2.0" ]
permissive
truongchec/MusicLake
8955941833acbed7dff1a74a64af4f27dd9a6fa3
3665b1c376f054c8333c6090af3c61b1b6fe6cfd
refs/heads/master
2022-03-28T12:49:13.132987
2020-01-01T02:24:45
2020-01-01T02:24:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.cyl.musiclake.player.playback; import android.media.MediaPlayer; public interface PlaybackListener { void onCompletionNext(); void onCompletionEnd(); void onBufferingUpdate(MediaPlayer mp, int percent); void onPrepared(); void onError(); }
ffc9155d748c07be402c1c0e6065b0eebc7793fa
a21a9d1f5800b96b66129ad76563d4b152914746
/src/lesson4/MovieSession.java
2a75e2d4ec05ed26cf6fb4049704fdcfdbdb5443
[]
no_license
Denki77/InterviewProject
fd528192801cf70d7b4c6e2806f9053a74c7e7de
b96a06f575574e45ba495f4d8f1f66f54b5603d3
refs/heads/master
2023-07-19T07:03:50.680725
2021-09-14T06:10:29
2021-09-14T06:10:29
390,234,914
0
0
null
2021-09-14T06:10:30
2021-07-28T06:09:53
Java
UTF-8
Java
false
false
891
java
package lesson4; import java.util.Date; public class MovieSession { private Date date = null; private int max_duration_film = 0; private CinemaHall cinemaHall = null; public MovieSession(Date date, int max_duration_film, CinemaHall cinemaHall) { this.date = date; this.max_duration_film = max_duration_film; this.cinemaHall = cinemaHall; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public int getMax_duration_film() { return max_duration_film; } public void setMax_duration_film(int max_duration_film) { this.max_duration_film = max_duration_film; } public CinemaHall getCinemaHall() { return cinemaHall; } public void setCinemaHall(CinemaHall cinemaHall) { this.cinemaHall = cinemaHall; } }
1d1241a77e0f6212a6a9afe8390669033a48d8ae
26b6fef94956bc713110189d3573f4ab3beebe4c
/Xidu-service/src/main/java/com/xidu/framework/fileloading/dto/BaseLoadingFileProcessDto.java
09b1a625f5b3a57c9b52c8c303cbee90e0550675
[]
no_license
zhang5883no1/anji
dca2c54a02cec65e5c943d7109d115b32062bbce
a16ae72bdc7c630b657503adedcf427c5e994e14
refs/heads/master
2021-01-18T15:40:32.248445
2017-03-30T07:19:31
2017-03-30T07:19:31
86,671,763
0
0
null
null
null
null
UTF-8
Java
false
false
5,029
java
/****************************************************************************** * @File name : BaseUploadFileProcessDto.java * @Author : XINLYU * @Date : 2013-6-20 * @Copyright Notice: * Copyright (c) 2012 Capgemini, Inc. All Rights Reserved. * ---------------------------------------------------------------------------- * Date Who Version Comments * 2013-6-20 上午11:51:07 XINLYU 1.0 Initial Version *****************************************************************************/ package com.xidu.framework.fileloading.dto; import java.io.Serializable; import java.util.Date; import org.springframework.web.multipart.MultipartFile; import com.xidu.framework.usermgnt.dto.SessionUserDto; public class BaseLoadingFileProcessDto implements Serializable{ private static final long serialVersionUID = -1247346399344228776L; private SessionUserDto sessionUser; private String operationUser; private String batchNo; private String memo; private Date operationDate; private String errorMsg; private String status; protected String statusDesc; private String operationDesc; private String functionCode; private String moduleCode; private String operationType; private String reason; protected String createUser; protected Date createDate; protected String lastUpdateUser; protected Date lastUpdateDate; private MultipartFile multipartFile; private String fileLocation; private Date operationEndDate; protected String createDateStr; protected String lastUpdateDateStr; public String getOperationUser() { return operationUser; } public void setOperationUser(String operationUser) { this.operationUser = operationUser; } public String getBatchNo() { return batchNo; } public void setBatchNo(String batchNo) { this.batchNo = batchNo; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public Date getOperationDate() { return operationDate; } public void setOperationDate(Date operationDate) { this.operationDate = operationDate; } public String getErrorMsg() { return errorMsg; } public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getStatusDesc() { return statusDesc; } public void setStatusDesc(String statusDesc) { this.statusDesc = statusDesc; } public String getCreateUser() { return createUser; } public void setCreateUser(String createUser) { this.createUser = createUser; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public String getLastUpdateUser() { return lastUpdateUser; } public void setLastUpdateUser(String lastUpdateUser) { this.lastUpdateUser = lastUpdateUser; } public Date getLastUpdateDate() { return lastUpdateDate; } public void setLastUpdateDate(Date lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } public MultipartFile getMultipartFile() { return multipartFile; } public void setMultipartFile(MultipartFile multipartFile) { this.multipartFile = multipartFile; } public String getCreateDateStr() { return createDateStr; } public void setCreateDateStr(String createDateStr) { this.createDateStr = createDateStr; } public String getLastUpdateDateStr() { return lastUpdateDateStr; } public void setLastUpdateDateStr(String lastUpdateDateStr) { this.lastUpdateDateStr = lastUpdateDateStr; } public SessionUserDto getSessionUser() { return sessionUser; } public void setSessionUser(SessionUserDto sessionUser) { this.sessionUser = sessionUser; } public String getFileLocation() { return fileLocation; } public void setFileLocation(String fileLocation) { this.fileLocation = fileLocation; } public String getOperationDesc() { return operationDesc; } public void setOperationDesc(String operationDesc) { this.operationDesc = operationDesc; } public String getFunctionCode() { return functionCode; } public void setFunctionCode(String functionCode) { this.functionCode = functionCode; } public String getModuleCode() { return moduleCode; } public void setModuleCode(String moduleCode) { this.moduleCode = moduleCode; } public String getOperationType() { return operationType; } public void setOperationType(String operationType) { this.operationType = operationType; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public Date getOperationEndDate() { return operationEndDate; } public void setOperationEndDate(Date operationEndDate) { this.operationEndDate = operationEndDate; } }
3759ff24f54bbf4724cef0783b9a9760d6b9de7e
6edf6c315706e14dc6aef57788a2abea17da10a3
/com/planet_ink/marble_mud/WebMacros/grinder/GrinderHolidays.java
4fb81a06883a5b7c99d1a52346d5ce855b6e45db
[]
no_license
Cocanuta/Marble
c88efd73c46bd152098f588ba1cdc123316df818
4306fbda39b5488dac465a221bf9d8da4cbf2235
refs/heads/master
2020-12-25T18:20:08.253300
2012-09-10T17:09:50
2012-09-10T17:09:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,446
java
package com.planet_ink.marble_mud.WebMacros.grinder; import com.planet_ink.marble_mud.WebMacros.RoomData; import com.planet_ink.marble_mud.core.interfaces.*; import com.planet_ink.marble_mud.core.*; import com.planet_ink.marble_mud.core.collections.*; import com.planet_ink.marble_mud.Abilities.interfaces.*; import com.planet_ink.marble_mud.Areas.interfaces.*; import com.planet_ink.marble_mud.Behaviors.interfaces.*; import com.planet_ink.marble_mud.CharClasses.interfaces.*; import com.planet_ink.marble_mud.Libraries.interfaces.*; import com.planet_ink.marble_mud.Common.interfaces.*; import com.planet_ink.marble_mud.Exits.interfaces.*; import com.planet_ink.marble_mud.Items.interfaces.*; import com.planet_ink.marble_mud.Locales.interfaces.*; import com.planet_ink.marble_mud.MOBS.interfaces.*; import com.planet_ink.marble_mud.Races.interfaces.*; import java.util.*; /* 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. */ @SuppressWarnings({"unchecked","rawtypes"}) public class GrinderHolidays { public String name() {return this.getClass().getName().substring(this.getClass().getName().lastIndexOf('.')+1);} protected static String setText(DVector sets, String var, String newVAL) { if(newVAL==null) newVAL=""; //var=var.toUpperCase().trim(); int index=sets.indexOf(var); String oldVal=index>=0?(String)sets.elementAt(index,2):""; if(index>=0) { if(!newVAL.equals(oldVal)) sets.setElementAt(index,2,newVAL); } else sets.addElement(var,newVAL,Integer.valueOf(-1)); return newVAL; } public static String createModifyHoliday(ExternalHTTPRequests httpReq, java.util.Map<String,String> parms, String holidayName) { int index=CMLib.quests().getHolidayIndex(holidayName); if(index<=0) { String err = CMLib.quests().createHoliday(holidayName,"ALL",true); if((err != null) && (err.trim().length()>0)) return err; index=CMLib.quests().getHolidayIndex(holidayName); if(index < 0) return "Error creating holiday file."; } List<String> steps=null; QuestManager.RawHolidayData encodedData = null; Object resp=CMLib.quests().getHolidayFile(); if(resp instanceof List) steps=(List<String>)resp; else if(resp instanceof String) return (String)resp; if(steps!=null) encodedData=CMLib.quests().getEncodedHolidayData(steps.get(index)); if(encodedData==null) return "Error reading holiday data (code: "+((resp instanceof List)?"T":"F")+":"+((steps==null)?"F":"T")+":"+((encodedData==null)?"F":"T")+")"; DVector settings=encodedData.settings; DVector behaviors=encodedData.behaviors; DVector properties=encodedData.properties; DVector stats=encodedData.stats; //List stepV=(List)encodedData.elementAt(4); //int pricingMobIndex=((Integer)encodedData.elementAt(5)).intValue(); String name=setText(settings,"NAME",httpReq.getRequestParameter("NAME")); if((name==null)||(name.trim().length()==0)) return "A name is required."; String duration=setText(settings,"DURATION",httpReq.getRequestParameter("DURATION")); if((duration==null)||(!CMath.isMathExpression(duration))) return "Duration is mal-formed."; if(!httpReq.isRequestParameter("SCHEDULETYPE")) return "Schedule not found."; int typeIndex=CMath.s_int(httpReq.getRequestParameter("SCHEDULETYPE")); int mudDayIndex=settings.indexOf("MUDDAY"); int dateIndex=settings.indexOf("DATE"); int waitIndex=settings.indexOf("WAIT"); String scheduleName=new String[]{"WAIT","MUDDAY","DATE"}[typeIndex]; if((typeIndex!=0)&&(waitIndex>=0)) settings.removeElement("WAIT"); if((typeIndex!=1)&&(mudDayIndex>=0)) settings.removeElement("MUDDAY"); if((typeIndex!=2)&&(dateIndex>=0)) settings.removeElement("DATE"); String newWait = setText(settings,scheduleName,httpReq.getRequestParameter(scheduleName)); switch(typeIndex) { case 0: { if(!CMath.isMathExpression(newWait)) return "Wait expression is invalid."; break; } case 1: case 2: { int dash=newWait.indexOf('-'); if(dash < 0) return "Given date is invalid. Use Month#-Day# format"; if(!CMath.isInteger(newWait.substring(0,dash).trim())) return "Month value in the given date is not valid."; if(!CMath.isInteger(newWait.substring(dash+1).trim())) return "Day value in the given date is not valid."; break; } } StringBuffer areaGroup = new StringBuffer(""); HashSet areaCodes=new HashSet(); String id=""; for(int i=0;httpReq.isRequestParameter("AREAGROUP"+id);id=Integer.toString(++i)) areaCodes.add(httpReq.getRequestParameter("AREAGROUP"+id)); if(areaCodes.contains("AREAGROUP1")) areaGroup.append("ANY"); else { int areaNum=2; boolean reallyAll=true; for(Enumeration e=CMLib.map().sortedAreas();e.hasMoreElements();areaNum++) if(areaCodes.contains("AREAGROUP"+areaNum)) areaGroup.append(" \"" + ((Area)e.nextElement()).Name()+"\""); else { reallyAll=false; e.nextElement(); } if(reallyAll) areaGroup.setLength(0); } setText(settings,"AREAGROUP",areaGroup.toString().trim()); setText(settings,"MOBGROUP",httpReq.getRequestParameter("MOBGROUP")); behaviors.clear(); setText(behaviors,"AGGRESSIVE",httpReq.getRequestParameter("AGGRESSIVE")); for(int i=1;httpReq.isRequestParameter("BEHAV"+i);i++) if(httpReq.getRequestParameter("BEHAV"+i).trim().length()>0) setText(behaviors,httpReq.getRequestParameter("BEHAV"+i),httpReq.getRequestParameter("BDATA"+i)); StringBuffer mudChats=new StringBuffer(""); for(int i=1;httpReq.isRequestParameter("MCWDS"+i);i++) { String words=httpReq.getRequestParameter("MCWDS"+i).trim(); words=CMStrings.replaceAll(words,",","|"); if((words.length()>0)&&(httpReq.isRequestParameter("MCSAYS"+i+"_1"))) { mudChats.append("("+words+");"); for(int ii=1;httpReq.isRequestParameter("MCSAYW"+i+"_"+ii);ii++) if(CMath.isInteger(httpReq.getRequestParameter("MCSAYW"+i+"_"+ii))) mudChats.append(httpReq.getRequestParameter("MCSAYW"+i+"_"+ii)+httpReq.getRequestParameter("MCSAYS"+i+"_"+ii)+";"); mudChats.append(";"); } } setText(behaviors,"MUDCHAT",mudChats.toString()); properties.clear(); setText(properties,"MOOD",httpReq.getRequestParameter("MOOD")); for(int i=1;httpReq.isRequestParameter("AFFECT"+i);i++) if(httpReq.getRequestParameter("AFFECT"+i).trim().length()>0) setText(properties,httpReq.getRequestParameter("AFFECT"+i),httpReq.getRequestParameter("ADATA"+i)); Vector priceFV=new Vector(); for(int i=1;httpReq.isRequestParameter("PRCFAC"+i);i++) if(CMath.isPct(httpReq.getRequestParameter("PRCFAC"+i).trim())) priceFV.add(((String)(CMath.s_pct(httpReq.getRequestParameter("PRCFAC"+i).trim())+" "+httpReq.getRequestParameter("PMASK"+i).trim())).trim()); setText(stats,"PRICEMASKS",CMParms.toStringList(priceFV)); String err=CMLib.quests().alterHoliday(holidayName, encodedData); if(err.length()==0) httpReq.addRequestParameters("HOLIDAY",name); return err; } }
d4c3326dde881b2e606f25793bbbaf09a4dd24a5
90122c18b51d027810b54bc519caeefd8b2f587b
/app/src/main/java/ru/evendate/android/ui/cities/CityPromptDialog.java
9e21182e8e4a577ce8e2c0fb71868211561211d9
[]
no_license
KardanovIR/evendate-android
c9da1b458f7fc5140a27c55efb808feedb4a70a7
87fce26681fdc51fcb9ab57123a0d9c9d2de2b89
refs/heads/master
2021-03-24T12:43:11.271688
2017-11-22T22:14:33
2017-11-22T22:14:33
53,123,544
0
0
null
null
null
null
UTF-8
Java
false
false
1,492
java
package ru.evendate.android.ui.cities; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; import ru.evendate.android.R; /** * Created by Aedirn on 11.03.17. */ public class CityPromptDialog extends Fragment { private PromptInteractionListener mListener; private Unbinder unbinder; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_city_prompt, container, false); unbinder = ButterKnife.bind(this, rootView); return rootView; } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof PromptInteractionListener) { mListener = (PromptInteractionListener)context; } else { throw new RuntimeException("Activity should implement PromptInteractionListener" + "interface"); } } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } @OnClick(R.id.button2) public void onClick() { mListener.onPlaceButtonClick(); } interface PromptInteractionListener { void onPlaceButtonClick(); } }
0819b19e049057e21da08e9281859eb37cf83874
4ff5fa08f47ab18fc7ac87e667321482e64a8602
/authentication-template/src/main/java/com/application/repositories/RoleRepository.java
1a6d386e410ea7ebd10b8eaf8c4b8c718e6f75de
[]
no_license
i-anshuman/spring-boot-template
912cf82dfa6f1279ad7dfcac35f65930a237561f
42b5a229eb0b634c3e369b50559c191acf086e5c
refs/heads/main
2023-08-24T05:39:08.798435
2021-10-16T18:40:00
2021-10-16T18:40:00
417,903,966
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.application.repositories; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.application.entities.Role; @Repository public interface RoleRepository extends JpaRepository<Role, Long> { Optional<Role> findByRole(com.application.core.Role role); }
d95c767c5d38392891b7c24946ed0a76a3f9ce01
45d4617df96a81397289372fc129bb98783ff849
/project/jcart-administrayion-back-3/src/main/java/io/hqk/jcartadministrayionback/po/ReturnHistory.java
7b3f4e5d9f8b4b2eea3a4f370c67a636ffe5eba4
[]
no_license
My-huang/huangqinkai
99f0df2ed678f98425153561eefdc01eb0057b0d
959258fb58da70bc7f6ce1a3194efb1d804ec512
refs/heads/master
2022-12-22T09:38:15.438809
2020-03-19T11:27:34
2020-03-19T11:27:34
200,996,260
0
0
null
2022-12-16T11:54:14
2019-08-07T07:25:42
JavaScript
UTF-8
Java
false
false
1,319
java
package io.hqk.jcartadministrayionback.po; import java.util.Date; public class ReturnHistory { private Long returnHistoryId; private Integer returnId; private Date time; private Byte returnStatus; private String comment; private Boolean customerNotified; public Long getReturnHistoryId() { return returnHistoryId; } public void setReturnHistoryId(Long returnHistoryId) { this.returnHistoryId = returnHistoryId; } public Integer getReturnId() { return returnId; } public void setReturnId(Integer returnId) { this.returnId = returnId; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public Byte getReturnStatus() { return returnStatus; } public void setReturnStatus(Byte returnStatus) { this.returnStatus = returnStatus; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment == null ? null : comment.trim(); } public Boolean getCustomerNotified() { return customerNotified; } public void setCustomerNotified(Boolean customerNotified) { this.customerNotified = customerNotified; } }
5f0064dc796bcaa734d0962bd90b9d3f682c734c
ebb00685bf845d10123a761fb587ed39731f7510
/app/src/main/java/com/samourai/wallet/payload/PayloadUtil.java
8278169180269b585da7ef19fa153c8eb720bdec
[ "Unlicense" ]
permissive
eMaringolo/samourai-wallet-android
4e73c24bec4670ff2fdba6fddbc03979c537e122
68faeb29de88df0db3c9a27b28c3774a62b63f27
refs/heads/develop
2021-04-29T16:45:13.606071
2018-02-14T14:32:42
2018-02-14T14:32:42
120,467,326
0
0
null
2018-02-06T18:28:41
2018-02-06T14:12:02
Java
UTF-8
Java
false
false
32,011
java
package com.samourai.wallet.payload; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Environment; import android.preference.PreferenceManager; import android.widget.Toast; //import android.util.Log; import com.samourai.wallet.R; import com.samourai.wallet.SamouraiWallet; import com.samourai.wallet.SendActivity; import com.samourai.wallet.access.AccessFactory; import com.samourai.wallet.api.APIFactory; import com.samourai.wallet.bip47.BIP47Meta; import com.samourai.wallet.bip47.BIP47Util; import com.samourai.wallet.crypto.AESUtil; import com.samourai.wallet.crypto.DecryptionException; import com.samourai.wallet.hd.HD_Account; import com.samourai.wallet.hd.HD_Wallet; import com.samourai.wallet.hd.HD_WalletFactory; import com.samourai.wallet.ricochet.RicochetMeta; import com.samourai.wallet.segwit.BIP49Util; import com.samourai.wallet.send.BlockedUTXO; import com.samourai.wallet.util.AddressFactory; import com.samourai.wallet.util.BatchSendUtil; import com.samourai.wallet.util.CharSequenceX; import com.samourai.wallet.util.PrefsUtil; import com.samourai.wallet.send.RBFUtil; import com.samourai.wallet.util.SIMUtil; import com.samourai.wallet.util.SendAddressUtil; import com.samourai.wallet.JSONRPC.TrustedNodeUtil; import com.samourai.wallet.util.TorUtil; import com.samourai.wallet.util.WebUtil; import org.apache.commons.codec.DecoderException; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.crypto.MnemonicException; import org.bitcoinj.params.MainNetParams; import org.bitcoinj.params.TestNet3Params; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; 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.io.OutputStreamWriter; import java.io.RandomAccessFile; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.security.SecureRandom; public class PayloadUtil { private final static String dataDir = "wallet"; private final static String strFilename = "samourai.dat"; private final static String strTmpFilename = "samourai.tmp"; private final static String strBackupFilename = "samourai.sav"; private final static String strOptionalBackupDir = "/samourai"; private final static String strOptionalFilename = "samourai.txt"; private static Context context = null; private static PayloadUtil instance = null; private PayloadUtil() { ; } public static PayloadUtil getInstance(Context ctx) { context = ctx; if (instance == null) { instance = new PayloadUtil(); } return instance; } public File getBackupFile() { String directory = Environment.DIRECTORY_DOCUMENTS; File dir = Environment.getExternalStoragePublicDirectory(directory + strOptionalBackupDir); File file = new File(dir, strOptionalFilename); return file; } public JSONObject putPayload(String data, boolean external) { JSONObject obj = new JSONObject(); try { obj.put("version", 1); obj.put("payload", data); obj.put("external", external); } catch(JSONException je) { return null; } return obj; } public boolean hasPayload(Context ctx) { File dir = ctx.getDir(dataDir, Context.MODE_PRIVATE); File file = new File(dir, strFilename); if(file.exists()) { return true; } return false; } public synchronized void wipe() throws IOException { BIP47Util.getInstance(context).reset(); BIP47Meta.getInstance().clear(); BIP49Util.getInstance(context).reset(); APIFactory.getInstance(context).reset(); try { int nbAccounts = HD_WalletFactory.getInstance(context).get().getAccounts().size(); for(int i = 0; i < nbAccounts; i++) { HD_WalletFactory.getInstance(context).get().getAccount(i).getReceive().setAddrIdx(0); HD_WalletFactory.getInstance(context).get().getAccount(i).getChange().setAddrIdx(0); AddressFactory.getInstance().setHighestTxReceiveIdx(i, 0); AddressFactory.getInstance().setHighestTxChangeIdx(i, 0); } HD_WalletFactory.getInstance(context).set(null); } catch(MnemonicException.MnemonicLengthException mle) { mle.printStackTrace(); } HD_WalletFactory.getInstance(context).clear(); File dir = context.getDir(dataDir, Context.MODE_PRIVATE); File datfile = new File(dir, strFilename); File tmpfile = new File(dir, strTmpFilename); if(tmpfile.exists()) { secureDelete(tmpfile); } if(datfile.exists()) { secureDelete(datfile); try { serialize(new JSONObject("{}"), new CharSequenceX("")); } catch(JSONException je) { je.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } } public JSONObject getPayload() { try { JSONObject wallet = new JSONObject(); wallet.put("testnet", SamouraiWallet.getInstance().isTestNet() ? true : false); if(HD_WalletFactory.getInstance(context).get().getSeedHex() != null) { wallet.put("seed", HD_WalletFactory.getInstance(context).get().getSeedHex()); wallet.put("passphrase", HD_WalletFactory.getInstance(context).get().getPassphrase()); // obj.put("mnemonic", getMnemonic()); } JSONArray accts = new JSONArray(); for(HD_Account acct : HD_WalletFactory.getInstance(context).get().getAccounts()) { accts.put(acct.toJSON(false)); } wallet.put("accounts", accts); // // export BIP47 payment code for debug payload // try { wallet.put("payment_code", BIP47Util.getInstance(context).getPaymentCode().toString()); } catch(AddressFormatException afe) { ; } // // export BIP49 account for debug payload // JSONArray bip49_account = new JSONArray(); bip49_account.put(BIP49Util.getInstance(context).getWallet().getAccount(0).toJSON(true)); wallet.put("bip49_accounts", bip49_account); // // can remove ??? // /* obj.put("receiveIdx", mAccounts.get(0).getReceive().getAddrIdx()); obj.put("changeIdx", mAccounts.get(0).getChange().getAddrIdx()); */ JSONObject meta = new JSONObject(); meta.put("version_name", context.getText(R.string.version_name)); meta.put("android_release", Build.VERSION.RELEASE == null ? "" : Build.VERSION.RELEASE); meta.put("device_manufacturer", Build.MANUFACTURER == null ? "" : Build.MANUFACTURER); meta.put("device_model", Build.MODEL == null ? "" : Build.MODEL); meta.put("device_product", Build.PRODUCT == null ? "" : Build.PRODUCT); meta.put("prev_balance", APIFactory.getInstance(context).getXpubBalance()); meta.put("sent_tos", SendAddressUtil.getInstance().toJSON()); meta.put("batch_send", BatchSendUtil.getInstance().toJSON()); meta.put("use_segwit", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_SEGWIT, true)); meta.put("use_like_typed_change", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_LIKE_TYPED_CHANGE, true)); meta.put("spend_type", PrefsUtil.getInstance(context).getValue(PrefsUtil.SPEND_TYPE, SendActivity.SPEND_BIP126)); meta.put("use_bip126", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_BIP126, true)); meta.put("rbf_opt_in", PrefsUtil.getInstance(context).getValue(PrefsUtil.RBF_OPT_IN, false)); meta.put("bip47", BIP47Meta.getInstance().toJSON()); meta.put("pin", AccessFactory.getInstance().getPIN()); meta.put("pin2", AccessFactory.getInstance().getPIN2()); meta.put("ricochet", RicochetMeta.getInstance(context).toJSON()); meta.put("trusted_node", TrustedNodeUtil.getInstance().toJSON()); meta.put("rbfs", RBFUtil.getInstance().toJSON()); meta.put("tor", TorUtil.getInstance(context).toJSON()); meta.put("blocked_utxos", BlockedUTXO.getInstance().toJSON()); meta.put("explorer", PrefsUtil.getInstance(context).getValue(PrefsUtil.BLOCK_EXPLORER, 0)); meta.put("trusted_no", PrefsUtil.getInstance(context).getValue(PrefsUtil.ALERT_MOBILE_NO, "")); meta.put("scramble_pin", PrefsUtil.getInstance(context).getValue(PrefsUtil.SCRAMBLE_PIN, false)); meta.put("haptic_pin", PrefsUtil.getInstance(context).getValue(PrefsUtil.HAPTIC_PIN, true)); meta.put("auto_backup", PrefsUtil.getInstance(context).getValue(PrefsUtil.AUTO_BACKUP, true)); meta.put("remote", PrefsUtil.getInstance(context).getValue(PrefsUtil.ACCEPT_REMOTE, false)); meta.put("use_trusted", PrefsUtil.getInstance(context).getValue(PrefsUtil.TRUSTED_LOCK, false)); meta.put("check_sim", PrefsUtil.getInstance(context).getValue(PrefsUtil.CHECK_SIM, false)); meta.put("fiat", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_FIAT, "USD")); meta.put("fiat_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_FIAT_SEL, 0)); meta.put("fx", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_EXCHANGE, "LocalBitcoins.com")); meta.put("fx_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_EXCHANGE_SEL, 0)); meta.put("use_trusted_node", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_TRUSTED_NODE, false)); meta.put("fee_provider_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.FEE_PROVIDER_SEL, 0)); meta.put("broadcast_tx", PrefsUtil.getInstance(context).getValue(PrefsUtil.BROADCAST_TX, true)); // meta.put("xpubreg44", PrefsUtil.getInstance(context).getValue(PrefsUtil.XPUB44REG, false)); meta.put("xpubreg49", PrefsUtil.getInstance(context).getValue(PrefsUtil.XPUB49REG, false)); meta.put("paynym_claimed", PrefsUtil.getInstance(context).getValue(PrefsUtil.PAYNYM_CLAIMED, false)); meta.put("paynym_refused", PrefsUtil.getInstance(context).getValue(PrefsUtil.PAYNYM_REFUSED, false)); JSONObject obj = new JSONObject(); obj.put("wallet", wallet); obj.put("meta", meta); return obj; } catch(JSONException ex) { throw new RuntimeException(ex); } catch(IOException ioe) { throw new RuntimeException(ioe); } catch(MnemonicException.MnemonicLengthException mle) { throw new RuntimeException(mle); } } public synchronized void saveWalletToJSON(CharSequenceX password) throws MnemonicException.MnemonicLengthException, IOException, JSONException, DecryptionException, UnsupportedEncodingException { // Log.i("PayloadUtil", get().toJSON().toString()); // save payload serialize(getPayload(), password); // save optional external storage backup // encrypted using passphrase; cannot be used for restored wallets that do not use a passphrase if(SamouraiWallet.getInstance().hasPassphrase(context) && isExternalStorageWritable() && PrefsUtil.getInstance(context).getValue(PrefsUtil.AUTO_BACKUP, true) && HD_WalletFactory.getInstance(context).get() != null) { final String passphrase = HD_WalletFactory.getInstance(context).get().getPassphrase(); String encrypted = null; try { encrypted = AESUtil.encrypt(getPayload().toString(), new CharSequenceX(passphrase), AESUtil.DefaultPBKDF2Iterations); serialize(encrypted); } catch (Exception e) { // Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show(); } finally { if (encrypted == null) { // Toast.makeText(context, R.string.encryption_error, Toast.LENGTH_SHORT).show(); return; } } } } public synchronized HD_Wallet restoreWalletfromJSON(JSONObject obj) throws DecoderException, MnemonicException.MnemonicLengthException { // Log.i("PayloadUtil", obj.toString()); HD_Wallet hdw = null; NetworkParameters params = SamouraiWallet.getInstance().getCurrentNetworkParams(); JSONObject wallet = null; JSONObject meta = null; try { if(obj.has("wallet")) { wallet = obj.getJSONObject("wallet"); } else { wallet = obj; } if(obj.has("meta")) { meta = obj.getJSONObject("meta"); } else { meta = obj; } } catch(JSONException je) { ; } try { SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); // Log.i("PayloadUtil", obj.toString()); if(wallet != null) { if(wallet.has("testnet")) { SamouraiWallet.getInstance().setCurrentNetworkParams(wallet.getBoolean("testnet") ? TestNet3Params.get() : MainNetParams.get()); PrefsUtil.getInstance(context).setValue(PrefsUtil.TESTNET, wallet.getBoolean("testnet")); } else { SamouraiWallet.getInstance().setCurrentNetworkParams(MainNetParams.get()); PrefsUtil.getInstance(context).removeValue(PrefsUtil.TESTNET); } hdw = new HD_Wallet(context, 44, wallet, params); hdw.getAccount(SamouraiWallet.SAMOURAI_ACCOUNT).getReceive().setAddrIdx(wallet.has("receiveIdx") ? wallet.getInt("receiveIdx") : 0); hdw.getAccount(SamouraiWallet.SAMOURAI_ACCOUNT).getChange().setAddrIdx(wallet.has("changeIdx") ? wallet.getInt("changeIdx") : 0); if(wallet.has("accounts")) { JSONArray accounts = wallet.getJSONArray("accounts"); // // temporarily set to 2 until use of public XPUB // for(int i = 0; i < 2; i++) { JSONObject account = accounts.getJSONObject(i); hdw.getAccount(i).getReceive().setAddrIdx(account.has("receiveIdx") ? account.getInt("receiveIdx") : 0); hdw.getAccount(i).getChange().setAddrIdx(account.has("changeIdx") ? account.getInt("changeIdx") : 0); AddressFactory.getInstance().account2xpub().put(i, hdw.getAccount(i).xpubstr()); AddressFactory.getInstance().xpub2account().put(hdw.getAccount(i).xpubstr(), i); } } } if(meta != null) { if(meta.has("prev_balance")) { APIFactory.getInstance(context).setXpubBalance(meta.getLong("prev_balance")); } if(meta.has("use_segwit")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_SEGWIT, meta.getBoolean("use_segwit")); editor.putBoolean("segwit", meta.getBoolean("use_segwit")); editor.commit(); } if(meta.has("use_like_typed_change")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_LIKE_TYPED_CHANGE, meta.getBoolean("use_like_typed_change")); editor.putBoolean("likeTypedChange", meta.getBoolean("use_like_typed_change")); editor.commit(); } if(meta.has("spend_type")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.SPEND_TYPE, meta.getInt("spend_type")); editor.putBoolean("bip126", meta.getInt("spend_type") == SendActivity.SPEND_BIP126 ? true : false); editor.commit(); } if(meta.has("use_bip126")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_BIP126, meta.getBoolean("use_bip126")); editor.putBoolean("bip126", meta.getBoolean("use_bip126")); editor.commit(); } if(meta.has("rbf_opt_in")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.RBF_OPT_IN, meta.getBoolean("rbf_opt_in")); editor.putBoolean("rbf", meta.getBoolean("rbf_opt_in") ? true : false); editor.commit(); } if(meta.has("sent_tos")) { SendAddressUtil.getInstance().fromJSON((JSONArray) meta.get("sent_tos")); } if(meta.has("batch_send")) { BatchSendUtil.getInstance().fromJSON((JSONArray) meta.get("batch_send")); } if(meta.has("bip47")) { try { BIP47Meta.getInstance().fromJSON((JSONObject) meta.get("bip47")); } catch(ClassCastException cce) { JSONArray _array = (JSONArray) meta.get("bip47"); JSONObject _obj = new JSONObject(); _obj.put("pcodes", _array); BIP47Meta.getInstance().fromJSON(_obj); } } if(meta.has("pin")) { AccessFactory.getInstance().setPIN((String) meta.get("pin")); } if(meta.has("pin2")) { AccessFactory.getInstance().setPIN2((String) meta.get("pin2")); } if(meta.has("ricochet")) { RicochetMeta.getInstance(context).fromJSON((JSONObject) meta.get("ricochet")); } if(meta.has("trusted_node")) { TrustedNodeUtil.getInstance().fromJSON((JSONObject) meta.get("trusted_node")); } if(meta.has("rbfs")) { RBFUtil.getInstance().fromJSON((JSONArray) meta.get("rbfs")); } if(meta.has("tor")) { TorUtil.getInstance(context).fromJSON((JSONObject) meta.get("tor")); } if(meta.has("blocked_utxos")) { BlockedUTXO.getInstance().fromJSON((JSONObject) meta.get("blocked_utxos")); } if(meta.has("explorer")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.BLOCK_EXPLORER, meta.getInt("explorer")); } if(meta.has("trusted_no")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.ALERT_MOBILE_NO, (String) meta.get("trusted_no")); editor.putString("alertSMSNo", meta.getString("trusted_no")); editor.commit(); } if(meta.has("scramble_pin")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.SCRAMBLE_PIN, meta.getBoolean("scramble_pin")); editor.putBoolean("scramblePin", meta.getBoolean("scramble_pin")); editor.commit(); } if(meta.has("haptic_pin")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.HAPTIC_PIN, meta.getBoolean("haptic_pin")); editor.putBoolean("haptic", meta.getBoolean("haptic_pin")); editor.commit(); } if(meta.has("auto_backup")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.AUTO_BACKUP, meta.getBoolean("auto_backup")); editor.putBoolean("auto_backup", meta.getBoolean("auto_backup")); editor.commit(); } if(meta.has("remote")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.ACCEPT_REMOTE, meta.getBoolean("remote")); editor.putBoolean("stealthRemote", meta.getBoolean("remote")); editor.commit(); } if(meta.has("use_trusted")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.TRUSTED_LOCK, meta.getBoolean("use_trusted")); editor.putBoolean("trustedLock", meta.getBoolean("use_trusted")); editor.commit(); } if(meta.has("check_sim")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.CHECK_SIM, meta.getBoolean("check_sim")); editor.putBoolean("sim_switch", meta.getBoolean("check_sim")); editor.commit(); if(meta.getBoolean("check_sim")) { SIMUtil.getInstance(context).setStoredSIM(); } } if (meta.has("fiat")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_FIAT, (String)meta.get("fiat")); } if (meta.has("fiat_sel")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_FIAT_SEL, meta.getInt("fiat_sel")); } if (meta.has("fx")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_EXCHANGE, (String)meta.get("fx")); } if(meta.has("fx_sel")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_EXCHANGE_SEL, meta.getInt("fx_sel")); } if(meta.has("use_trusted_node")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_TRUSTED_NODE, meta.getBoolean("use_trusted_node")); } if(meta.has("fee_provider_sel")) { // PrefsUtil.getInstance(context).setValue(PrefsUtil.FEE_PROVIDER_SEL, meta.getInt("fee_provider_sel") > 0 ? 0 : meta.getInt("fee_provider_sel")); PrefsUtil.getInstance(context).setValue(PrefsUtil.FEE_PROVIDER_SEL, 0); } if(meta.has("broadcast_tx")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.BROADCAST_TX, meta.getBoolean("broadcast_tx")); } /* if(meta.has("xpubreg44")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.XPUB44REG, meta.getBoolean("xpubreg44")); } */ if(meta.has("xpubreg49")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.XPUB49REG, meta.getBoolean("xpubreg49")); } if(meta.has("paynym_claimed")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.PAYNYM_CLAIMED, meta.getBoolean("paynym_claimed")); } if(meta.has("paynym_refused")) { PrefsUtil.getInstance(context).setValue(PrefsUtil.PAYNYM_REFUSED, meta.getBoolean("paynym_refused")); } /* if(obj.has("passphrase")) { Log.i("PayloadUtil", (String)obj.get("passphrase")); Toast.makeText(context, "'" + (String)obj.get("passphrase") + "'", Toast.LENGTH_SHORT).show(); } Toast.makeText(context, "'" + hdw.getPassphrase() + "'", Toast.LENGTH_SHORT).show(); */ } } catch(IOException ioe) { ioe.printStackTrace(); } catch(JSONException je) { je.printStackTrace(); } HD_WalletFactory.getInstance(context).getWallets().clear(); HD_WalletFactory.getInstance(context).getWallets().add(hdw); return hdw; } public synchronized HD_Wallet restoreWalletfromJSON(CharSequenceX password) throws DecoderException, MnemonicException.MnemonicLengthException { JSONObject obj = null; try { obj = deserialize(password, false); } catch(IOException ioe) { ioe.printStackTrace(); } catch(JSONException je0) { try { obj = deserialize(password, true); } catch(IOException ioe) { ioe.printStackTrace(); } catch(JSONException je1) { je1.printStackTrace(); } } return restoreWalletfromJSON(obj); } public synchronized boolean walletFileExists() { File dir = context.getDir(dataDir, Context.MODE_PRIVATE); File walletfile = new File(dir, strFilename); return walletfile.exists(); } private synchronized void serialize(JSONObject jsonobj, CharSequenceX password) throws IOException, JSONException, DecryptionException, UnsupportedEncodingException { File dir = context.getDir(dataDir, Context.MODE_PRIVATE); File newfile = new File(dir, strFilename); File tmpfile = new File(dir, strTmpFilename); File bakfile = new File(dir, strBackupFilename); newfile.setWritable(true, true); tmpfile.setWritable(true, true); bakfile.setWritable(true, true); // prepare tmp file. if(tmpfile.exists()) { tmpfile.delete(); // secureDelete(tmpfile); } String data = null; String jsonstr = jsonobj.toString(4); if(password != null) { data = AESUtil.encrypt(jsonstr, password, AESUtil.DefaultPBKDF2Iterations); } else { data = jsonstr; } JSONObject jsonObj = putPayload(data, false); if(jsonObj != null) { Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpfile), "UTF-8")); try { out.write(jsonObj.toString()); } finally { out.close(); } copy(tmpfile, newfile); copy(tmpfile, bakfile); // secureDelete(tmpfile); } // // test payload // } private synchronized JSONObject deserialize(CharSequenceX password, boolean useBackup) throws IOException, JSONException { File dir = context.getDir(dataDir, Context.MODE_PRIVATE); File file = new File(dir, useBackup ? strBackupFilename : strFilename); // Log.i("PayloadUtil", "wallet file exists: " + file.exists()); StringBuilder sb = new StringBuilder(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8")); String str = null; while((str = in.readLine()) != null) { sb.append(str); } in.close(); JSONObject jsonObj = null; try { jsonObj = new JSONObject(sb.toString()); } catch(JSONException je) { ; } String payload = null; if(jsonObj != null && jsonObj.has("payload")) { payload = jsonObj.getString("payload"); } // not a json stream, assume v0 if(payload == null) { payload = sb.toString(); } JSONObject node = null; if(password == null) { node = new JSONObject(payload); } else { String decrypted = null; try { decrypted = AESUtil.decrypt(payload, password, AESUtil.DefaultPBKDF2Iterations); } catch(Exception e) { return null; } if(decrypted == null) { return null; } node = new JSONObject(decrypted); } return node; } private synchronized void secureDelete(File file) throws IOException { if (file.exists()) { long length = file.length(); SecureRandom random = new SecureRandom(); RandomAccessFile raf = new RandomAccessFile(file, "rws"); for(int i = 0; i < 5; i++) { raf.seek(0); raf.getFilePointer(); byte[] data = new byte[64]; int pos = 0; while (pos < length) { random.nextBytes(data); raf.write(data); pos += data.length; } } raf.close(); file.delete(); } } public synchronized void copy(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dst); try { byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } } finally { out.close(); } } finally { in.close(); } } private boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); if(Environment.MEDIA_MOUNTED.equals(state)) { return true; } return false; } private synchronized void serialize(String data) throws IOException { String directory = Environment.DIRECTORY_DOCUMENTS; File dir = Environment.getExternalStoragePublicDirectory(directory + "/samourai"); if(!dir.exists()) { dir.mkdirs(); dir.setWritable(true, true); dir.setReadable(true, true); } File newfile = new File(dir, "samourai.txt"); newfile.setWritable(true, true); newfile.setReadable(true, true); JSONObject jsonObj = putPayload(data, false); if(jsonObj != null) { Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newfile), "UTF-8")); try { out.write(jsonObj.toString()); } finally { out.close(); } } // // test payload // } public String getDecryptedBackupPayload(String data, CharSequenceX password) { String encrypted = null; try { JSONObject jsonObj = new JSONObject(data); if(jsonObj != null && jsonObj.has("payload")) { encrypted = jsonObj.getString("payload"); } else { encrypted = data; } } catch(JSONException je) { encrypted = data; } String decrypted = null; try { decrypted = AESUtil.decrypt(encrypted, password, AESUtil.DefaultPBKDF2Iterations); } catch (Exception e) { Toast.makeText(context, R.string.decryption_error, Toast.LENGTH_SHORT).show(); } finally { if (decrypted == null || decrypted.length() < 1) { Toast.makeText(context, R.string.decryption_error, Toast.LENGTH_SHORT).show(); // AppUtil.getInstance(context).restartApp(); } } return decrypted; } }
951548b8771ff837e5c58cb3bfa20cd536bff40a
093e942f53979299f3e56c9ab1f987e5e91c13ab
/storm-client/src/jvm/org/apache/storm/trident/operation/builtin/MapGet.java
f8ca0e80524d9e0e97cc9b8b69dd53219be71b82
[ "Apache-2.0", "GPL-1.0-or-later", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
permissive
Whale-Storm/Whale
09bab86ce0b56412bc1b984bb5d47935cf0814aa
9b3e5e8bffbeefa54c15cd2de7f2fb67f36d64b2
refs/heads/master
2022-09-26T10:56:51.916884
2020-06-11T08:36:44
2020-06-11T08:36:44
266,803,131
3
0
Apache-2.0
2022-09-17T00:00:04
2020-05-25T14:39:22
Java
UTF-8
Java
false
false
1,539
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.storm.trident.operation.builtin; import org.apache.storm.tuple.Values; import java.util.List; import org.apache.storm.trident.operation.TridentCollector; import org.apache.storm.trident.state.BaseQueryFunction; import org.apache.storm.trident.state.map.ReadOnlyMapState; import org.apache.storm.trident.tuple.TridentTuple; public class MapGet extends BaseQueryFunction<ReadOnlyMapState, Object> { @Override public List<Object> batchRetrieve(ReadOnlyMapState map, List<TridentTuple> keys) { return map.multiGet((List) keys); } @Override public void execute(TridentTuple tuple, Object result, TridentCollector collector) { collector.emit(new Values(result)); } }
1deaa9e05d89c78bdc10cab1570d039c31446919
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/1c98b28f08cb8dc815eb30818f622e7549240adb/after/Indent.java
0c8ce579973c85ebc7f71466294716ddb55d911c
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
9,218
java
/* * Copyright 2000-2009 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.formatting; /** * The indent setting for a formatting model block. Indicates how the block is indented * relative to its parent block. * <p/> * Number of factory methods of this class use <code>'indent relative to direct parent'</code> flag. It specified anchor parent block * to use to apply indent. * <p/> * Consider the following situation: * <p/> * <pre> * return a == 0 && (b == 0 || c == 0); * </pre> * <p/> * Here is the following blocks hierarchy (going from child to parent): * <p/> * <ul> * <li><code>'|| c == 0`</code>;</li> * <li><code>'b == 0 || c == 0'</code>;</li> * <li><code>'(b == 0 || c == 0)'</code>;</li> * <li><code>'a == 0 && (b == 0 || c == 0)'</code>;</li> * <li><code>'return a == 0 && (b == 0 || c == 0)'</code>;</li> * </ul> * <p/> * By default formatter applies block indent to the first block ancestor (direct or indirect) that starts on a new line. That means * that such an ancestor for both blocks <code>'|| c == 0'</code> and <code>'&& (b == 0 || c == 0)'</code> * is <code>'return a == 0 && (b == 0 || c == 0)'</code>. That means that the code above is formatted as follows: * <p/> * <pre> * return a == 0 * && (b == 0 * || c == 0); * </pre> * <p/> * In contrast, it's possible to specify that direct parent block that starts on a line before target child block is used as an anchor. * Initial formatting example illustrates such approach. * * @see com.intellij.formatting.Block#getIndent() * @see com.intellij.formatting.ChildAttributes#getChildIndent() */ public abstract class Indent { private static IndentFactory myFactory; static void setFactory(IndentFactory factory) { myFactory = factory; } /** * Returns an instance of a regular indent, with the width specified * in "Project Code Style | General | Indent". * <p/> * <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block * * @return the indent instance. * @see #getNormalIndent(boolean) */ public static Indent getNormalIndent() { return myFactory.getNormalIndent(false); } /** * Returns an instance of a regular indent, with the width specified * in "Project Code Style | General | Indent" and given <code>'relative to direct parent'</code> flag * * @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free * to get more information about that at class-level javadoc) * @return newly created indent instance configured in accordance with the given parameter */ public static Indent getNormalIndent(boolean relativeToDirectParent) { return myFactory.getNormalIndent(relativeToDirectParent); } /** * Returns the standard "empty indent" instance, indicating that the block is not * indented relative to its parent block. * * @return the empty indent instance. */ public static Indent getNoneIndent() { return myFactory.getNoneIndent(); } /** * Returns the "absolute none" indent instance, indicating that the block will * be placed at the leftmost column in the document. * * @return the indent instance. */ public static Indent getAbsoluteNoneIndent() { return myFactory.getAbsoluteNoneIndent(); } /** * Returns the "absolute label" indent instance, indicating that the block will be * indented by the number of spaces indicated in the "Project Code Style | General | * Label indent" setting from the leftmost column in the document. * * @return the indent instance. */ public static Indent getAbsoluteLabelIndent() { return myFactory.getAbsoluteLabelIndent(); } /** * Returns the "label" indent instance, indicating that the block will be indented by * the number of spaces indicated in the "Project Code Style | General | Label indent" * setting relative to its parent block. * * @return the indent instance. */ public static Indent getLabelIndent() { return myFactory.getLabelIndent(); } /** * Returns the "continuation" indent instance, indicating that the block will be indented by * the number of spaces indicated in the "Project Code Style | General | Continuation indent" * setting relative to its parent block. * <p/> * <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block * * @return the indent instance. * @see #getContinuationIndent(boolean) */ public static Indent getContinuationIndent() { return myFactory.getContinuationIndent(false); } /** * Returns the "continuation" indent instance, indicating that the block will be indented by * the number of spaces indicated in the "Project Code Style | General | Continuation indent" * setting relative to its parent block and given <code>'relative to direct parent'</code> flag. * * @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free * to get more information about that at class-level javadoc) * @return newly created indent instance configured in accordance with the given parameter */ public static Indent getContinuationIndent(boolean relativeToDirectParent) { return myFactory.getContinuationIndent(relativeToDirectParent); } /** * Returns the "continuation without first" indent instance, indicating that the block will * be indented by the number of spaces indicated in the "Project Code Style | General | Continuation indent" * setting relative to its parent block, unless this block is the first of the children of its * parent having the same indent type. This is used for things like parameter lists, where the first parameter * does not have any indent and the remaining parameters are indented by the continuation indent. * <p/> * <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block * * @return the indent instance. * @see #getContinuationWithoutFirstIndent(boolean) */ public static Indent getContinuationWithoutFirstIndent() {//is default return myFactory.getContinuationWithoutFirstIndent(false); } /** * Returns the "continuation without first" indent instance, indicating that the block will * be indented by the number of spaces indicated in the "Project Code Style | General | Continuation indent" * setting relative to its parent block, unless this block is the first of the children of its * parent having the same indent type. This is used for things like parameter lists, where the first parameter * does not have any indent and the remaining parameters are indented by the continuation indent and given * <code>'relative to direct parent'</code> flag. * * @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free * to get more information about that at class-level javadoc) * @return newly created indent instance configured in accordance with the given parameter */ public static Indent getContinuationWithoutFirstIndent(boolean relativeToDirectParent) { return myFactory.getContinuationWithoutFirstIndent(relativeToDirectParent); } /** * Returns an indent with the specified width. * <p/> * <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block * * @param spaces the number of spaces in the indent. * @return the indent instance. * @see #getSpaceIndent(int, boolean) */ public static Indent getSpaceIndent(final int spaces) { return myFactory.getSpaceIndent(spaces, false); } /** * Returns an indent with the specified width and given <code>'relative to direct parent'</code> flag. * * @param spaces the number of spaces in the indent * @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free * to get more information about that at class-level javadoc) * @return newly created indent instance configured in accordance with the given parameter */ public static Indent getSpaceIndent(final int spaces, final boolean relativeToDirectParent) { return myFactory.getSpaceIndent(spaces, relativeToDirectParent); } }
cd9d3f9136e6038992569a94912dc7f373465eb7
aece520374f1718f03d6e209835700fe804932ff
/src/ex_java/Ex11_03_File.java
6a4ff460088f7b1449752894c08ef36de72aff13
[]
no_license
moonshot123/ex-java
7cf033e4950c62e51523576538eb1ab9a9a20cac
e68e7bc279b92212c3df1598f1445c74533ca679
refs/heads/master
2021-04-27T03:04:41.736409
2018-02-24T05:48:08
2018-02-24T05:48:08
122,707,285
0
0
null
null
null
null
UHC
Java
false
false
1,144
java
package ex_java; import java.io.File; import java.io.IOException; public class Ex11_03_File { public static void main(String[] args) { File f1 =new File("A");// 확장자가 없으면 폴더 File f2 =new File("B");// 따로 위치를 지정하지 않으면 지금 작업위치에 생김 File f3 =new File("C"); File f4 =new File(f1,"aa.txt");//f1 이 없다면 현재작업공간에 바로 생성 // if(f1.exists()){ f1.renameTo(f2);// 이름바꾸기f1> f2 이름으로 System.out.println("폴더이름 바꾸기 완료"); }else{ f1.mkdir();// 폴더만들기:mkdir(); System.out.println("폴더생성함"); try { f4.createNewFile(); //파일만들기:createNewFile(); //예외처리를 해줘야됨 System.out.println("화일생성함"); } catch (IOException e) { e.printStackTrace(); } } if(f3.exists()){ boolean bool = f3.delete();// 대소문자 상관없는듯 // 폴더안에 파일이 있으면 안지워짐 System.out.println(bool); if(bool){ //bool == true System.out.println("삭제완료"); }else{ System.out.println("삭제실패"); } } } }
64205defeb27c82432b50288ae52d0b95f8e83c6
d362e7ba8fee99415fedf762a530156c74ba89db
/Chapter8/Labs/Payroll.java
67a3c6809c66883a509fb625fbc4e36e4e93bf1c
[]
no_license
evilpegasus/APCS
5324d97b4598ebae0d9ad89512c443707c194154
6b04b0492de4418b74feaacd65df572c2ee85f82
refs/heads/master
2020-09-11T11:48:07.974958
2020-05-20T23:18:27
2020-05-20T23:18:27
222,054,169
5
0
null
2020-01-28T16:42:43
2019-11-16T05:54:59
Java
UTF-8
Java
false
false
2,310
java
// **************************************************************** // Payroll.java // // Represents a list of employees. // **************************************************************** import java.util.Scanner; import java.util.*; import java.io.*; public class Payroll { final int MAX = 30; Employee[] payroll = new Employee[MAX]; int numEmployees = 0; // --------------------------------------------------------- // Reads the list of employee wage data from the given // file. // --------------------------------------------------------- public void readPayrollInfo(String file) { String line; // a line in the file String name; // name of an employee int hours; // hours worked double rate; // hourly pay rate Scanner fileScan, lineScan; try { fileScan = new Scanner (new File(file)); while (fileScan.hasNext()) { line = fileScan.nextLine(); lineScan = new Scanner(line); name = lineScan.next (); try { hours = lineScan.nextInt(); rate = lineScan.nextDouble(); payroll[numEmployees] = new Employee (name, hours, rate); numEmployees++; } catch (InputMismatchException exception) { System.out.println ("Error in input. Line ignored."); System.out.println (line); } catch {ArrayIndexOutOfBoundsException exception) { System.out.println ("Too many employees!"); } } fileScan.close(); } catch (FileNotFoundException exception) { System.out.println ("The file " + file + " was not found."); } catch (IOException exception) { System.out.println (exception); } } // ------------------------------------------ // Returns the number of employees who // worked over 40 hours; the helper method // overtime is called to do all the work. // ------------------------------------------ public int numOvertime () { return overtime (0); } // ------------------------------------------------ // Returns the number of employees in the part // of the list from index start to the end who // worked more than 40 hours. // ------------------------------------------------ private int overtime (int start) { } }
7620ada843bafc5dd6437ce01d082c72e8c00754
c90bddf3367ecbab3e4509bdce682568c4cc8938
/src/test/java/br/com/alura/repository/CursoRepositoryTest.java
0cd7e855b5ea4e5ced540715f44f3c31d7c5e71d
[]
no_license
leonardo-teles/forum
1853fba433c2b5605df0267b63070e665f9b33ed
54fd7f69233724fff5f539e1b15d4e09d0b0f93d
refs/heads/master
2023-02-24T11:20:49.237953
2021-02-02T04:50:20
2021-02-02T04:50:20
267,756,504
0
0
null
null
null
null
UTF-8
Java
false
false
1,456
java
package br.com.alura.repository; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import br.com.alura.modelo.Curso; @RunWith(SpringRunner.class) @DataJpaTest @AutoConfigureTestDatabase(replace = Replace.NONE) @ActiveProfiles("test") public class CursoRepositoryTest { @Autowired private CursoRepository repository; @Autowired private TestEntityManager em; @Test public void deveriaCarregarUmCursoAoBuscarPeloSeuNome() { String nomeCurso = "HTML 5"; Curso html5 = new Curso(); html5.setNome(nomeCurso); html5.setCategoria("Programação"); em.persist(html5); Curso curso = repository.findByNome(nomeCurso); Assert.assertNotNull(curso); Assert.assertEquals(nomeCurso, curso.getNome()); } @Test public void naoDeveriaCarregarUmCursoCujoNomeNaoEstejaCadastrado() { String nomeCurso = "JPA"; Curso curso = repository.findByNome(nomeCurso); Assert.assertNull(curso); } }
46f8c29930165f736f2a7d1e721ae02197b1f45f
db3eb34e51ad0ec566727679826a62952ea74b68
/Inclass5_1_demo.java
6f4451fbef49588ad69a8845425a7d6b757e9e5d
[]
no_license
chasedarlington/CS112
bc7715870b05cca803116246afc56b2114fd7ccf
8456b9984b559c6ce4341e5d881836ca987a73e3
refs/heads/master
2020-07-11T10:45:37.878584
2019-12-06T09:42:35
2019-12-06T09:42:35
204,517,143
0
0
null
null
null
null
UTF-8
Java
false
false
2,210
java
import java.util.Scanner; public class Inclass5_1_demo { public static void main(String [] args) { Scanner input = new Scanner(System.in); String x = ""; long y = 0; float z = 0; //Run number ONE Inclass5_1 a1 = new Inclass5_1(); //Default constructor invoked System.out.println("Animal 1"); System.out.println("\t" + a1.get_name()); System.out.println("\t" + a1.get_population()); System.out.println("\t" + a1.get_growth()); //Run number TWO Inclass5_1 a2 = a1; System.out.println("Animal 2"); System.out.println("\t" + a2.get_name()); System.out.println("\t" + a2.get_population()); System.out.println("\t" + a2.get_growth()); //Run number THREE Inclass5_1 a3 = new Inclass5_1(x); //Other constructor invoked System.out.print("\n" + "Enter an animal name: "); x = input.next(); a3.set_name(x); // Invoking method of Animal class System.out.println("New Animal 3"); System.out.println("\t" + a3.get_name()); System.out.println("\t" + a3.get_population()); System.out.println("\t" + a3.get_growth()); //Run number FOUR Inclass5_1 a4 = new Inclass5_1(x,y); //Other constructor invoked System.out.print("\n" + "Enter an animal name and population: "); x = input.next(); y = input.nextLong(); a4.set_name(x); // Invoking method of Animal class a4.set_population(y); System.out.println("New Animal 4"); System.out.println("\t" + a4.get_name()); System.out.println("\t" + a4.get_population()); System.out.println("\t" + a4.get_growth()); //Run number FIVE Inclass5_1 a5 = new Inclass5_1(x,y,z); //Other constructor invoked System.out.print("\n" + "Enter an animal name, population, and population growth rate: "); x = input.next(); y = input.nextLong(); z = input.nextFloat(); a5.set_name(x); // Invoking method of Animal class a5.set_population(y); a5.set_growth(z); System.out.println("New Animal 5"); System.out.println("\t" + a5.get_name()); System.out.println("\t" + a5.get_population()); System.out.println("\t" + a5.get_growth()); /* if(r1==r2) System.out.println("Objects r1 and r2 are equal"); else System.out.println("Objects r1 and r2 are not equal"); */ } }
ae5932f0a6d6c4a7b7b3bab6ba56caf475d3a30c
f1abec4d472ab8ef7be47b4bb438ede9132c84c4
/src/ciupka/pokemon/pokemon/abilities/context/Switch.java
74e0f7915645e9bcd45665c2fb71220a42641734
[]
no_license
CutyCupy/PokemonSpiel
7b7063139da0cbcdba0ed8b706975c53cc3abb91
c085537cf77566a3bf6e639f2872ddd252f10866
refs/heads/master
2023-06-06T18:43:09.723619
2021-07-09T19:11:36
2021-07-09T19:11:36
94,694,584
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package ciupka.pokemon.pokemon.abilities.context; import ciupka.pokemon.pokemon.Pokemon; public class Switch { private Pokemon target; private Pokemon replacement; public Switch(Pokemon target, Pokemon replacement) { this.target = target; this.replacement = replacement; } public Pokemon getTarget() { return this.target; } public Pokemon getReplacement() { return this.replacement; } }
a1a786e1068dba98a64a6babe966019784b112e5
98b63e93d4bb7671656f55332e0c610f068f82bf
/sources/de/hfkbremen/creatingprocessingfinding/isosurface/SketchIsoSurface3.java
39c04840893b40786cd997daa373dbd8b1c2f17f
[]
no_license
Stehveh/creating-processing-finding
ea00279ff94cb4e16211bfb41d54dd4f446aa286
971c15e646cf86e4c85696321dbfededc202024b
refs/heads/master
2021-01-18T07:48:17.723996
2013-03-25T16:46:10
2013-03-25T16:46:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,043
java
package de.hfkbremen.creatingprocessingfinding.isosurface; import mathematik.Vector3f; import de.hfkbremen.creatingprocessingfinding.isosurface.marchingcubes.Metaball; import de.hfkbremen.creatingprocessingfinding.isosurface.marchingcubes.MetaballManager; import de.hfkbremen.creatingprocessingfinding.util.ArcBall; import processing.core.PApplet; import java.util.Vector; public class SketchIsoSurface3 extends PApplet { private MetaballManager mMetaballManager; private int mCurrentCircle = 0; private ArcBall mArcBall; public void setup() { size(1024, 768, OPENGL); textFont(createFont("Courier", 11)); mArcBall = new ArcBall(width / 2, height / 2, 0, 400.0f, this, true); mMetaballManager = new MetaballManager(); mMetaballManager.dimension.set(width, height, height); mMetaballManager.resolution.set(30, 30, 30); mMetaballManager.position.set(width / -2, height / -2, height / -2); mMetaballManager.add(new Metaball(new Vector3f(0, 0, 0), 1, 100)); } public void draw() { background(255); directionalLight(126, 126, 126, 0, 0, -1); ambientLight(102, 102, 102); /* draw extra info */ fill(0); noStroke(); text("ISOVALUE : " + mMetaballManager.isovalue(), 10, 12); text("SELECTED : " + mCurrentCircle, 10, 24); text("FPS : " + (int)frameRate, 10, 36); /* darw isosurface */ mArcBall.update(); if (!mMetaballManager.metaballs().isEmpty()) { mMetaballManager.metaballs().get(mCurrentCircle).position.x = mouseX - width / 2; mMetaballManager.metaballs().get(mCurrentCircle).position.y = mouseY - height / 2; } final Vector<Vector3f> myData = mMetaballManager.createSurface(); /* draw metaballs */ translate(width / 2, height / 2); fill(255, 127, 0); noStroke(); beginShape(TRIANGLES); for (int i = 0; i < myData.size(); i++) { vertex(myData.get(i).x, myData.get(i).y, myData.get(i).z); } endShape(); } public void keyPressed() { switch (key) { case '+': mMetaballManager.isovalue(mMetaballManager.isovalue() + 0.01f); break; case '-': mMetaballManager.isovalue(mMetaballManager.isovalue() - 0.01f); break; case ' ': mCurrentCircle++; mCurrentCircle %= mMetaballManager.metaballs().size(); break; case 'c': mMetaballManager.add(new Metaball(new Vector3f(mouseX - width / 2, mouseY - height / 2, random(-100, 100)), random(1, 2), random(50, 150))); break; } } public static void main(String args[]) { PApplet.main(new String[] {SketchIsoSurface3.class.getName()}); } }
ad11261ac1f7484a5f2702a6e83c1c42c64a964d
9bf1b5652f21cf7cccbff199850dea073603559e
/src/main/java/Utilities/PageUtil.java
ac309c3202a71ba27f284dd281b168ca8b2f8294
[]
no_license
prashant2906/CucumberTestNG
4bffdaa717a61bbc7f3d4377cbd1905af3fc5daa
419b6412b1ab1f4eff16a5a1e642014464aa41e0
refs/heads/master
2023-04-15T18:35:06.465258
2020-07-15T09:36:20
2020-07-15T09:36:20
279,229,524
0
0
null
2021-04-26T20:28:48
2020-07-13T06:26:06
HTML
UTF-8
Java
false
false
29,810
java
package Utilities; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; import java.util.concurrent.TimeUnit; import org.testng.Assert; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.asserts.Assertion; import org.testng.asserts.SoftAssert; import com.aventstack.extentreports.Status; import BDD_DEMO.BaseExecution.BaseSetup; import runner.TestRunner; import org.openqa.selenium.StaleElementReferenceException; public class PageUtil { WebDriver driver; SoftAssert sAssert; Assertion hAssert; String url = PropertyFiles.propertiesFile().getProperty("applicationUrl"); public PageUtil(WebDriver driver) { this.driver = driver; sAssert = new SoftAssert(); hAssert = new Assertion(); } public void implicitWait(WebDriver driver) { driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); } public void explicitWaitLink(WebDriver driver, String linkText) { WebDriverWait wait = new WebDriverWait(driver, 60); wait.until(ExpectedConditions.elementToBeClickable(By.linkText(linkText))); } public void explicitWaitForWebElement(WebDriver driver, By locator) { try { WebDriverWait wait = new WebDriverWait(driver, 120); wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); } catch (NoSuchElementException e) { // e.printStackTrace(); System.err.format("No Element Found: " + e); BaseSetup.test.log(Status.FAIL, "No Element Found after wait" + e); } } public void explicitWaitForWebElementAttribute(WebDriver driver, By locator, String attribute, String value) { try { WebDriverWait wait = new WebDriverWait(driver, 60); wait.until(ExpectedConditions.attributeContains(locator, attribute, value)); } catch (NoSuchElementException e) { // e.printStackTrace(); System.err.format("No Element Found: " + e); BaseSetup.test.log(Status.FAIL, "No Element Found after wait" + e); } } public String getCurrentPageTitle() { String title = null; try { title = driver.getTitle(); // System.out.println(title); //logger.info("User gets the Current Page Title " + title); } catch (Exception e) { e.printStackTrace(); //logger.info("Element is not found"); } return title; } public void verifyCurrentPageTitle(String expectedTitle) { String actualTitle = getCurrentPageTitle(); Assert.assertEquals(actualTitle, expectedTitle); BaseSetup.test.log(Status.PASS,"The expected title: " + expectedTitle + " matches with the title: " + actualTitle); //logger.info("User verifies the current Page Title as " + expectedTitle); // sAssert.assertAll(); } public String getCurrentPageUrl() { String pageUrl = driver.getCurrentUrl(); //logger.info("User gets the Current Page URL as " + pageUrl); return pageUrl; } public void assertCurrentPageUrl(String expectedUrl) { String actualUrl = getCurrentPageUrl(); Assert.assertTrue(actualUrl.contains(expectedUrl)); // hAssert.assertTrue(actualUrl.contains(expectedUrl), "The URL // validation matched"); // hAssert.assertEquals(actualUrl, expectedUrl); //logger.info("User verifies the current Page URL as " + expectedUrl); BaseSetup.test.log(Status.PASS, "The expected URL: " + expectedUrl + " matches with the URL: " + actualUrl); // return getCurrentPageUrl().contains(expectedUrl); } public boolean verifyElementPresent(By locator) { boolean bValue = false; WebElement element = null; try { element = driver.findElement(locator); if (element.isDisplayed() || element.isEnabled()) BaseSetup.test.log(Status.PASS, "The element " + element.toString() + " is found"); bValue = true; } catch (NoSuchElementException e) { e.printStackTrace(); //logger.info("The element is not found"); BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + " is not found"); bValue = false; } catch (StaleElementReferenceException e) { e.printStackTrace(); BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + "is not available in Dom"); //logger.info("The element is not available in Dom"); bValue = false; } return bValue; } public boolean verifyElementPresent(WebElement element) { boolean bValue = false; try { if (element.isDisplayed() || element.isEnabled()) BaseSetup.test.log(Status.PASS, "The element " + element.toString() + " is found"); bValue = true; } catch (NoSuchElementException e) { e.printStackTrace(); //logger.info("The element is not found"); BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + " is not found"); bValue = false; } catch (StaleElementReferenceException e) { e.printStackTrace(); BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + "is not available in Dom"); //logger.info("The element is not available in Dom"); bValue = false; } return bValue; } public boolean verifyElementNotPresent(By locator) { try { driver.findElement(locator); return false; } catch (NoSuchElementException e) { // e.getStackTrace(); return true; } } public boolean verifyElementVisible(By locator) { try { driver.findElement(locator).isDisplayed(); return true; } catch (NoSuchElementException e) { e.getStackTrace(); return false; } } public boolean verifyElementVisible(WebElement element) { try { element.isDisplayed(); return true; } catch (NoSuchElementException e) { e.getStackTrace(); return false; } } public boolean verifyElementNotVisible(By locator) { try { if (driver.findElement(locator).isDisplayed() == false) ; BaseSetup.test.log(Status.PASS, locator + " : element is not displaying on the page"); return false; } catch (NoSuchElementException e) { BaseSetup.test.log(Status.FAIL, locator + " : element is displaying on the page"); e.getStackTrace(); return true; } } public boolean verifyElementNotEnabled(By locator) { try { if (!(driver.findElement(locator).isEnabled())) //logger.info(locator + " : This element is enabled"); BaseSetup.test.log(Status.FAIL, locator + " : element is enabled"); return true; } catch (NoSuchElementException e) { e.getStackTrace(); //logger.info(locator + " : This element is not enabled"); BaseSetup.test.log(Status.FAIL, locator + " : element not enabled"); return false; } } // To get the Locator Text public String getLocatorText(By locator) { try { String sText = driver.findElement(locator).getText(); //logger.info("Element Text is " + sText); } catch (NoSuchElementException e) { e.printStackTrace(); //logger.info(locator + " : This element is not found"); BaseSetup.test.log(Status.FAIL, locator + " : element not found"); } return driver.findElement(locator).getText().toString(); } public boolean isElementDisplayed(By locator) { if (driver.findElements(locator).size() > 0 && driver.findElement(locator).isDisplayed()) { BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is displayed on the Page"); return true; } else { BaseSetup.test.log(Status.FAIL, locator + " is not Displayed on the Page"); return false; } } public boolean isElementDisplayed(WebElement element) { if (element.isDisplayed()) { BaseSetup.test.log(Status.PASS, element.getText() + " is displayed on the Page"); return true; } else { BaseSetup.test.log(Status.FAIL, element.getText() + " is not Displayed on the Page"); return false; } } public boolean isElementEnabled(By locator) { WebElement element = driver.findElement(locator); if (element.isEnabled()) { BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is enabled on the Page"); return true; } else { BaseSetup.test.log(Status.FAIL, locator + " is not enabled on the Page"); return false; } } public boolean isElementDisabled(By locator) { WebElement element = driver.findElement(locator); if (!element.isEnabled()) { BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is disabled on the Page"); return true; } else { BaseSetup.test.log(Status.FAIL, locator + " is not disabled on the Page"); return false; } } public boolean isLinkOrIconDisplayed(By locator, String elementName) { if (driver.findElements(locator).size() > 0 && driver.findElement(locator).isDisplayed()) { BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " " + elementName + " is displayed on the Page"); return true; } else { BaseSetup.test.log(Status.FAIL, elementName + " is not displayed on the Page"); return false; } } public boolean isElementNotDisplayed(By locator) { if (driver.findElements(locator).isEmpty()) { BaseSetup.test.log(Status.PASS, locator + " : is not displayed on the Page"); return true; } else { BaseSetup.test.log(Status.PASS, locator + " : is displayed on the Page"); return false; } } public void deleteCookies() { driver.manage().deleteAllCookies(); } public String getParentWindow() { String parent = driver.getWindowHandle(); return parent; } public String getObjectlLabel(By locator) { String title = null; try { driver.findElement(locator).isDisplayed(); title = driver.findElement(locator).getText(); //logger.info("User gets the test object Label as: " + title); // BaseSetup.test.log(Status.PASS, "User gets the test object Label // as: " + title); } catch (Exception e) { e.printStackTrace(); //logger.info("User gets a blank test object Label"); BaseSetup.test.log(Status.INFO, "User gets a blank test object Label"); } return title; } public String getObjectlLabel(WebElement element) { String sTitle = null; try { element.isDisplayed(); sTitle = element.getText(); // System.out.println(sTitle); //logger.info("User gets the test object Label as: " + sTitle); // BaseSetup.test.log(Status.PASS, "User gets the test object Label // as: " + title); } catch (Exception e) { e.printStackTrace(); //logger.info("User gets a blank test object Label"); BaseSetup.test.log(Status.FAIL, "User gets a blank test object Label"); } return sTitle; } public void verifyObjectLabel(By locator, String expectedObjectLabel) { String actualObjectLabel = getObjectlLabel(locator); // return getObjectlLabel(locator).contains(expectedObjectLabel); sAssert.assertEquals(actualObjectLabel, expectedObjectLabel); //logger.info("User verifies the test object Label as: " + expectedObjectLabel); BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel + " matches with the actual object label: " + actualObjectLabel); } public void verifyObjectLabel(WebElement element, String expectedObjectLabel) { String actualObjectLabel = getObjectlLabel(element); // return getObjectlLabel(element).contains(expectedObjectLabel); Assert.assertEquals(actualObjectLabel, expectedObjectLabel); //logger.info("User verifies the test object Label as: " + expectedObjectLabel); BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel + " matches with the actual object label: " + actualObjectLabel); } public void verifyObjectLabelContains(By locator, String expectedValue) { hAssert.assertTrue(getObjectlLabel(locator).contains(expectedValue), "The label contains the value" + expectedValue); //logger.info("User verifies the test object Label contains: " + expectedValue); BaseSetup.test.log(Status.PASS, "The expected object label contains: " + expectedValue); } public void verifyObjectLabelContains(WebElement element, String expectedValue) { Assert.assertTrue(getObjectlLabel(element).contains(expectedValue), "The label contains the value" + expectedValue); //logger.info("User verifies the test object Label contains: " + expectedValue); BaseSetup.test.log(Status.PASS, "The expected object label contains: " + expectedValue); } public void verifyObjectLabelNotContains(By locator, String expectedValue) { hAssert.assertFalse(getObjectlLabel(locator).contains(expectedValue), "The label does not contain the value" + expectedValue); //logger.info("User verifies the test object Label does not contain: " + expectedValue); BaseSetup.test.log(Status.PASS, "The expected object label does not contain: " + expectedValue); } public void verifyObjectLabelContains(String expectedValue, String actualValue) { sAssert.assertTrue(expectedValue.contains(actualValue), "The label contains the value" + actualValue); //logger.info("User verifies the test object Label contains: " + actualValue); BaseSetup.test.log(Status.PASS, "The expected object label" + expectedValue + "contains: " + actualValue); } public void assertObjectLabel(By locator, String expectedObjectLabel) { String actualObjectLabel = getObjectlLabel(locator); sAssert.assertEquals(actualObjectLabel, expectedObjectLabel); //logger.info("User verifies the test object Label as: " + expectedObjectLabel); BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel + " matches with the actual object label: " + actualObjectLabel); } public void assertObjectLabel(String actualObjectLabel, String expectedObjectLabel) { // return getObjectlLabel(locator).contains(expectedObjectLabel); sAssert.assertEquals(actualObjectLabel, expectedObjectLabel); //logger.info("User verifies the test object Label as: " + expectedObjectLabel); BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel + " matches with the actual object label: " + actualObjectLabel); } public void enterTextValue(By locator, String expectedData) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) // element.isDisplayed()) { element.clear(); element.sendKeys(expectedData); //logger.info("User enters " + expectedData + " in the " + element.getText() + " text box"); BaseSetup.test.log(Status.PASS, "User enters " + expectedData + " in the " + element.getText() + " text box"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to enter text" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e); } } public void enterTextValue(By locator, int expectedData) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) // element.isDisplayed()) { element.clear(); WebElement wb = element; JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("arguments[0].value='" + expectedData + "';", wb); // element.sendKeys(expectedData); //logger.info("User enters " + expectedData + " in the " + element.getText() + " text box"); BaseSetup.test.log(Status.PASS, "User enters " + expectedData + " in the " + element.getText() + " text box"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to enter text" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e); } } public void pressEnter(By locator) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) { element.sendKeys(Keys.RETURN); //logger.info("User presses the enter key"); BaseSetup.test.log(Status.PASS, ("User presses the enter key")); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to press enter" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to press enter" + e); } } public void clearTextBox(By locator) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) // element.isDisplayed()) { element.clear(); //logger.info("User clears the " + element.getText() + " text box"); BaseSetup.test.log(Status.PASS, "User clears the " + element.getText() + " text box"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to enter text" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e); } } public void click(By locator) { for (int iCount = 0; iCount < 3; iCount++) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) { //logger.info("User clicks on " + element.getText() + " button"); BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button"); element.click(); } break; } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform click" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e); } // explicitWaitUntilClickable(driver, locator); } } public static void click(WebElement element) { for (int iCount = 0; iCount < 3; iCount++) { try { if (element.isDisplayed()) { //logger.info("User clicks on " + element.getText() + " button"); BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button"); element.click(); } break; } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform click" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e); } } } public static void enterTextValue(WebElement element, int expectedData) { try { if (element.isDisplayed()) { //logger.info("User clicks on " + element.getText() + " button"); System.out.println(element.getText()); BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button"); //element.clear(); element.sendKeys("expectedData"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform click" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e); } } public void selectRadio(By locator) { try { WebElement element = driver.findElement(locator); if (verifyElementPresent(locator)) { //logger.info("User clicks on " + element.getText() + " button"); BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button"); element.click(); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform click" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e); } } //select the dropdown using "select by visible text", so pass VisibleText public void selectFromDropDownByVisibleText(By locator, String visibleText) { try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { Select selObj = new Select(element); selObj.selectByVisibleText(visibleText); //logger.info("User selects the visible text as " + visibleText + "from Dropdown"); BaseSetup.test.log(Status.PASS, "User selects the visible text as " + visibleText + "from Dropdown"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection in the dropdown" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } } // select the dropdown using "select by index", so pass IndexValue as '2' public void selectFromDropDownByIndex(By locator, int indexValue) { try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { Select selObj = new Select(element); selObj.selectByIndex(indexValue); //logger.info("User selects the index as " + indexValue + " from Dropdown"); BaseSetup.test.log(Status.PASS, "User selects the index as " + indexValue + " from Dropdown"); } else { BaseSetup.test.log(Status.FAIL, "Element not displaying"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } } // select the dropdown using "select by value", so pass Value as public void selectFromDropDownByValue(By locator, String value) { try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { Select selObj = new Select(element); selObj.selectByValue(value); System.out.println(element.getText()); //logger.info("User selects the value as " + value + "from Dropdown"); BaseSetup.test.log(Status.PASS, "User selects the value as " + value + "from Dropdown"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } } public String getAttributeValue(By locator, String attributeName) { String attributeValue = null; try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { attributeValue = element.getAttribute(attributeName); // System.out.println(value); //logger.info("User gets the value as " + attributeValue + " for the webelement"); BaseSetup.test.log(Status.PASS, "User gets the value as " + attributeValue + "for the webelement"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } return attributeValue; } public void assertAttributeValue(By locator, String attributeName, String expectedAttributeValue) { String actualAttributeValue = getAttributeValue(locator, attributeName); Assert.assertEquals(actualAttributeValue, expectedAttributeValue); //logger.info("the expected value: " + expectedAttributeValue + " matches the actual value: " + actualAttributeValue); BaseSetup.test.log(Status.PASS, "the expected value: " + expectedAttributeValue + " matches the actual value: " + actualAttributeValue); } public String getCssValue(WebElement element, String sPropertyName) { String propertyValue = null; try { if (element.isDisplayed()) { propertyValue = element.getCssValue(sPropertyName); // System.out.println(propertyValue); //logger.info("User gets the value as " + propertyValue + "for the webelement"); BaseSetup.test.log(Status.PASS, "User gets the value as " + propertyValue + "for the webelement"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } return propertyValue; } public boolean getCheckBoxState(By locator) { boolean value = false; try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { value = element.isSelected(); // System.out.println(value); //logger.info("User gets the value as " + value + " from the check box"); BaseSetup.test.log(Status.PASS, "User gets the value as " + value + " from the check box"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } return value; } public boolean getRadioButtonState(By locator) { boolean value = false; try { WebElement element = driver.findElement(locator); if (element.isDisplayed()) { value = element.isSelected(); // System.out.println(value); //logger.info("User gets the value as " + value + " from the radio button"); BaseSetup.test.log(Status.PASS, "User gets the value as " + value + " from the radio button"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to perform selection" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e); } return value; } public void launchApplication() throws InterruptedException { driver.navigate().to(url); //logger.info("User navigates to the URL: " + url); // BaseSetup.test.log(Status.PASS, "User navigates to the URL: " + url); if (isAlertPresent()) { acceptAlert(); Thread.sleep(1000); } } /*public void launchotherLanguages() { driver.navigate().to(applicationUrl); //logger.info("User navigates to the URL: " + GermanyUrl); BaseSetup.test.log(Status.PASS, "User navigates to the URL: " + GermanyUrl); }*/ public boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } // try catch (NoAlertPresentException Ex) { return false; } // catch } public void verifyStringValue(String expected, String actual) { Assert.assertEquals(expected, actual); //logger.info("the expected value: " + expected + " matches the actual value: " + actual); BaseSetup.test.log(Status.PASS, "the expected value: " + expected + " matches the actual value: " + actual); } public void verifyWebElementStateDiffers(boolean expected, boolean actual) { Assert.assertNotSame(expected, actual); //logger.info("the expected value: " + expected + " does not match the actual value: " + actual); BaseSetup.test.log(Status.PASS, "the expected value: " + expected + " does not match matche the actual value: " + actual); } public String getAlertMessage() { String alertText = null; boolean isAlertAvailable = isAlertPresent(); if (isAlertAvailable) { alertText = driver.switchTo().alert().getText(); // System.out.println(alertText); } return alertText; } public void verifyAlertMessage(String expectedMessage) { Assert.assertEquals(expectedMessage, getAlertMessage()); } public void acceptAlert() { boolean isAlertAvailable = isAlertPresent(); if (isAlertAvailable) { driver.switchTo().alert().accept(); } } public void dissmisAlert() { boolean isAlertAvailable = isAlertPresent(); if (isAlertAvailable) { driver.switchTo().alert().dismiss(); } } public void switchToChildWindow() { Set<String> s1 = driver.getWindowHandles(); Iterator<String> I1 = s1.iterator(); while (I1.hasNext()) { String child_window = I1.next(); // Here we will compare if parent window is not equal to child // window then we will close if (!getParentWindow().equals(child_window)) { driver.switchTo().window(child_window); } } } public String getMainWindowHandle(WebDriver driver) { return driver.getWindowHandle(); } public static boolean closeAllOtherWindows(WebDriver driver, String openWindowHandle) { Set<String> allWindowHandles = driver.getWindowHandles(); for (String currentWindowHandle : allWindowHandles) { if (!currentWindowHandle.equals(openWindowHandle)) { driver.switchTo().window(currentWindowHandle); driver.close(); } } driver.switchTo().window(openWindowHandle); if (driver.getWindowHandles().size() == 1) return true; else return false; } public void closeChildWindow() { driver.close(); } public void switchMainWindow(String wparent) { driver.switchTo().window(wparent); } public boolean verifyObjectWaterMark(By locator, String expectedObjectWaterMark) { //logger.info("User verifies the test object Label as: " + expectedObjectWaterMark); return getObjectlLabel(locator).contains(expectedObjectWaterMark.toLowerCase()); } public static List<WebElement> collectAllSimillarElements(WebDriver driver, By locator) { List<WebElement> elementList = new ArrayList<WebElement>(); elementList = driver.findElements(locator); return elementList; } public List<WebElement> countAllSimillarElements(WebDriver driver, By locator) { List<WebElement> elementList = new ArrayList<WebElement>(); elementList = driver.findElements(locator); for (int i = 0; i < elementList.size(); i++) { BaseSetup.test.log(Status.INFO, ": is displayed on the Page\n"+ elementList.get(1)); //countelements = elementList.size(); } return elementList; } public WebElement getWebElement(By locator) { return driver.findElement(locator); } public List<WebElement> getWebElements(By locator) { return driver.findElements(locator); } public void navigateto(String uri) { driver.get(uri); } public void enterTextValue(By username, Keys enter) { // TODO Auto-generated method stub try { WebElement element = driver.findElement(username); if (verifyElementPresent(username)) // element.isDisplayed()) { element.clear(); element.sendKeys(Keys.ENTER); //logger.info("User enters " + expectedData + " in the " + element.getText() + " text box"); BaseSetup.test.log(Status.PASS, "User Press enters in the " + element.getText() + " text box"); } } catch (NoSuchElementException e) { e.printStackTrace(); System.err.format("No Element Found to enter text" + e); BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e); } } }
f275dc228a8a2f292572ed34dcdf5b818ab60272
19d84a0d1980f775186f64d1bb3949d13f4ef0b6
/compilador/src/Frame/AccessList.java
38a10aaebf192ee8e1a634899a1e2d9a5420293e
[]
no_license
rbrito/old-projects
cc7a1d1730f8170e52587a3e3b2d3a5ced33ffbf
442bb27d5aa99c0af0bb163efd9fd338bccb90ba
refs/heads/master
2020-05-06T12:21:07.994529
2019-04-27T23:02:59
2019-04-27T23:02:59
5,565,923
2
0
null
null
null
null
UTF-8
Java
false
false
53
java
package Frame; public abstract class AccessList { }
d55863bca8e91ffd4c66360d6bdeec0a861774b5
5234bc430c83d616a8214d7f77c2c081543b6b26
/src/Java/101-200/143.ReorderList.java
69c9b072453e9e3e12b875829e537a4ced9967b0
[ "Apache-2.0" ]
permissive
AveryHuo/PeefyLeetCode
3e749b962cadfdf10d7f7b1ed21c5fafc4342950
92156e4b48ba19e3f02e4286b9f733e9769a1dee
refs/heads/master
2022-04-26T06:01:18.547761
2020-04-25T09:55:46
2020-04-25T09:55:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,354
java
import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Queue; import java.util.HashSet; import java.util.LinkedList; class ListNode { int val; ListNode next; ListNode(int x) { val = x; next = null; } } class Solution { public void reorderList(ListNode head) { if (head == null || head.next == null) return; ListNode p1 = head; ListNode p2 = head; // 找到链表的一半 while (p2.next != null && p2.next.next != null) { p1 = p1.next; p2 = p2.next.next; } // 将链表分为两段 p2 = p1.next; p1.next = null; p1 = head; // 将后半段进行链表的翻转 ListNode head2 = p2; ListNode next2; while (p2.next != null) { next2 = p2.next; p2.next = next2.next; next2.next = head2; head2 = next2; } p2 = head2; // 两条链表进行合并 ListNode next1; while (p2 != null) { next1 = p1.next; next2 = p2.next; p1.next = p2; p2.next = next1; p1 = next1; p2 = next2; } } }
75a493ea1825c2fcf40b708648368298c5f5dc46
2d9bd0fc6fd3e788b0cff0d17bc6d74c55d51671
/Sprint17_repush/commons/commons-data/src/main/java/dz/gov/mesrs/sii/commons/data/model/referentiel/Nomenclature.java
2eec30eb53a1c8478b4df63b1cdccf6aadcf01b7
[]
no_license
kkezzar/code2
952de18642d118d9dae9b10acc3b15ef7cfd709e
ee7bd0908ac7826074d26e214ef07c594e8a9706
refs/heads/master
2016-09-06T04:17:06.896511
2015-03-10T13:41:04
2015-03-10T13:41:04
31,958,723
1
1
null
null
null
null
UTF-8
Java
false
false
4,482
java
package dz.gov.mesrs.sii.commons.data.model.referentiel; // Generated 20 janv. 2014 11:10:42 by Hibernate Tools 3.6.0 import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * NcValues generated by hbm2java */ @Entity @Table(name = "nomenclature", schema = "nc") public class Nomenclature implements java.io.Serializable { /** * serialVersionUID * * @author BELDI Jamel on : 23 janv. 2014 11:20:05 */ private static final long serialVersionUID = 1L; private int id; private Nomenclature nomenclature; private NcNames ncNames; private String libelleLongFr; private String libelleLongAr; private String libelleCourtFr; private String libelleCourtAr; private Boolean status; private String code; // private Set<NcHistory> ncHistories = new HashSet<NcHistory>(0); private List<Nomenclature> nomenclatures; public Nomenclature() { } public Nomenclature(int id, String code) { this.id = id; this.code = code; } // public Nomenclature(int id, Nomenclature nomenclature, NcNames ncNames, // String libelleLongFr, String libelleLongAr, String libelleCourtFr, // String libelleCourtAr, Boolean status, String code, Set<NcHistory> // ncHistories, // Set<Nomenclature> ncValueses) { // this.id = id; // //this.nomenclature = nomenclature; // this.ncNames = ncNames; // this.libelleLongFr = libelleLongFr; // this.libelleLongAr = libelleLongAr; // this.libelleCourtFr = libelleCourtFr; // this.libelleCourtAr = libelleCourtAr; // this.status = status; // this.code = code; // this.ncHistories = ncHistories; // } @Id @SequenceGenerator(name = "seq_nc", initialValue = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_nc") @Column(name = "id", unique = true, nullable = false) public int getId() { return this.id; } public void setId(int id) { this.id = id; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ref_valeur") public Nomenclature getNomenclature() { return this.nomenclature; } public void setNomenclature(Nomenclature nomenclature) { this.nomenclature = nomenclature; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_list") public NcNames getNcNames() { return this.ncNames; } public void setNcNames(NcNames ncNames) { this.ncNames = ncNames; } @Column(name = "libelle_long_fr", length = 100) public String getLibelleLongFr() { return this.libelleLongFr; } public void setLibelleLongFr(String libelleLongFr) { this.libelleLongFr = libelleLongFr; } @Column(name = "libelle_long_ar", length = 100) public String getLibelleLongAr() { return this.libelleLongAr; } public void setLibelleLongAr(String libelleLongAr) { this.libelleLongAr = libelleLongAr; } @Column(name = "libelle_court_fr", length = 100) public String getLibelleCourtFr() { return this.libelleCourtFr; } public void setLibelleCourtFr(String libelleCourtFr) { this.libelleCourtFr = libelleCourtFr; } @Column(name = "libelle_court_ar", length = 100) public String getLibelleCourtAr() { return this.libelleCourtAr; } public void setLibelleCourtAr(String libelleCourtAr) { this.libelleCourtAr = libelleCourtAr; } @Column(name = "code", unique = false, nullable = false, length = 30) public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } /** * [Nomenclature.nomenclatures] Getter * @author MAKERRI Sofiane on : 6 janv. 2015 10:59:59 * @return the nomenclatures */ @OneToMany(fetch = FetchType.LAZY, mappedBy = "nomenclature", cascade = CascadeType.ALL, orphanRemoval = true) public List<Nomenclature> getNomenclatures() { return nomenclatures; } /** * [Nomenclature.nomenclatures] Setter * @author MAKERRI Sofiane on : 6 janv. 2015 10:59:59 * @param nomenclatures the nomenclatures to set */ public void setNomenclatures(List<Nomenclature> nomenclatures) { this.nomenclatures = nomenclatures; } @Column(name = "status") public Boolean getStatus() { return status; } public void setStatus(Boolean status) { this.status = status; } }
[ "root@lhalid-pc" ]
root@lhalid-pc
b823b68a3578f3d414b70d7f4d867a91a4405454
6e906d38822a7f03b3aacede6a0abcc1780ea18a
/src/main/java/net/qihoo/xlearning/webapp/InfoPage.java
27f4c1c85d234c6c3548aef1c375b48da6537209
[ "Apache-2.0" ]
permissive
skymysky/XLearning
7ae0e143d59a9de7cdbb74c495ef05aef20552cf
f479bd861e2e6148a6d2afabfa5dde451866636f
refs/heads/master
2021-08-23T13:32:58.013136
2017-12-05T02:47:24
2017-12-05T02:47:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package net.qihoo.xlearning.webapp; import org.apache.hadoop.yarn.webapp.SubView; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.HTML; import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout; import static org.apache.hadoop.yarn.util.StringHelper.join; public class InfoPage extends TwoColumnLayout implements AMParams { @Override protected void preHead(HTML<_> html) { super.preHead(html); setTitle(join($(APP_TYPE) + " Application ", $(APP_ID))); } @Override protected Class<? extends SubView> content() { if ($(APP_TYPE).equals("Tensorflow") || $(APP_TYPE).equals("Mxnet")) { return InfoBlock.class; } else { return SingleInfoBlock.class; } } @Override protected Class<? extends SubView> nav() { return NavBlock.class; } }
de6de07f4478ff1434c76d55f843ffa20e6d61d7
4d6793623d8c407169ae96d648d14231ee0a1c53
/lab3/soa-lab/lab3-dao/src/main/java/pl/edu/agh/soa/lab3/mapper/DeanMapper.java
cb1563fb19df9d25286a98bec15fca6f694f3c6d
[]
no_license
paulinastal/SOA-lab
cc36be98c9b21a27280b18e3d35279bc829af108
7eff5a22cd55b430f4be15a346887104bff4aeb1
refs/heads/master
2023-05-09T06:50:57.462582
2021-06-09T19:08:14
2021-06-09T19:08:14
375,458,525
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package pl.edu.agh.soa.lab3.mapper; import pl.edu.agh.soa.lab3.entity.DeanEntity; import pl.edu.agh.soa.model.Dean; public class DeanMapper { public static Dean entityToModel(DeanEntity entity){ Dean dean = new Dean(); dean.setId(entity.getId()); dean.setDegree(entity.getDegree()); dean.setName(entity.getName()); return dean; } public static DeanEntity modelToEntity(Dean dean){ DeanEntity deanEntity = new DeanEntity(); deanEntity.setDegree(dean.getDegree()); deanEntity.setId(dean.getId()); deanEntity.setName(dean.getName()); return deanEntity; } }
e47bbf4264d3b0017d72c6fa259a04adda828ae7
c2e6f7c40edce79fd498a5bbaba4c2d69cf05e0c
/src/main/java/com/google/android/gms/common/zzh.java
ed06314bf8d937217a05673da67f89ce81f44396
[]
no_license
pengju1218/decompiled-apk
7f64ee6b2d7424b027f4f112c77e47cd420b2b8c
b60b54342a8e294486c45b2325fb78155c3c37e6
refs/heads/master
2022-03-23T02:57:09.115704
2019-12-28T23:13:07
2019-12-28T23:13:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.google.android.gms.common; import com.google.android.gms.common.util.VisibleForTesting; @VisibleForTesting final class zzh { static final zze[] a = {new zzi(zze.a("0‚\u0004C0‚\u0003+ \u0003\u0002\u0001\u0002\u0002\t\u0000Âà‡FdJ00")), new zzj(zze.a("0‚\u0004¨0‚\u0003 \u0003\u0002\u0001\u0002\u0002\t\u0000Յ¸l}ÓNõ0"))}; }
8bd2d798eae469f16e05dea71e94818247c675c3
7da5206be6fac3e181c242d0530d227fe0b70cde
/src/main/java/cn/zjz/ssm/memento/EmpMemento.java
0eea44d96df18a698fba44238b14ab8846714772
[]
no_license
missaouib/gof
ee65204123f5b116dff93c960c7da7083cb95901
f10746ea0988aac439444162267af2b0dfd521fe
refs/heads/master
2022-12-28T09:43:44.336334
2019-07-23T01:49:16
2019-07-23T01:49:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package cn.zjz.ssm.memento; /** * 备忘录类 * @author Administrator * */ public class EmpMemento { private String ename; private int age; private double salary; public EmpMemento(Emp e) { this.ename = e.getEname(); this.age = e.getAge(); this.salary = e.getSalary(); } public String getEname() { return ename; } public void setEname(String ename) { this.ename = ename; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } }
8aef5622473bd8541e78897e492d1a4c86bc7c2e
12ccbc8b5331dd9612552c8499fcf031683df9d5
/src/main/java/com/mongodb/m101j/spark/HelloWorldMongoDBSparkFreemarkerStyle.java
b9b40a63507fdb0904ae62f98d72fdb5b5aef695
[]
no_license
Just-Fun/M101J_MongoDB
7ce970241cba9fd1eafeb72a5c1e0901822cc13f
7d052033296e8dbb7c5d224ccd1d9b8ff0d27649
refs/heads/master
2021-01-16T18:56:14.775642
2017-08-19T15:21:56
2017-08-19T15:21:56
100,131,730
0
0
null
null
null
null
UTF-8
Java
false
false
2,289
java
/* * Copyright 2015 MongoDB, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.mongodb.m101j.spark; import com.mongodb.MongoClient; import com.mongodb.ServerAddress; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; import freemarker.template.Configuration; import freemarker.template.Template; import org.bson.Document; import spark.Request; import spark.Response; import spark.Route; import spark.Spark; import java.io.StringWriter; public class HelloWorldMongoDBSparkFreemarkerStyle { public static void main(String[] args) { final Configuration configuration = new Configuration(); configuration.setClassForTemplateLoading (HelloWorldMongoDBSparkFreemarkerStyle.class, "/freemarker"); MongoClient client = new MongoClient(new ServerAddress("localhost", 27017)); MongoDatabase database = client.getDatabase("course"); final MongoCollection<Document> collection = database.getCollection("hello"); collection.drop(); collection.insertOne(new Document("name", "MongoDB")); Spark.get(new Route("/") { @Override public Object handle(final Request request, final Response response) { StringWriter writer = new StringWriter(); try { Template helloTemplate = configuration.getTemplate("hello.ftl"); Document document = collection.find().first(); helloTemplate.process(document, writer); } catch (Exception e) { halt(500); e.printStackTrace(); } return writer; } }); } }
6f762c70cb04c0818321dcee20dc03ac30dc4234
4e9c3b9d04a02c088d1e5b709bc025cb6109fe4a
/EXERCISE 2.1/src/Exercise4_6/Avocado.java
573b39535ef723a461ce5963fedc307b32edf1a9
[]
no_license
AuChyiMin/Exercise4.5
5c9aa73c43506df91b2988a65a5026f11b33e258
3516120626778eb71e3591690816750be6d6d988
refs/heads/master
2023-05-04T03:33:27.790599
2021-05-19T17:30:49
2021-05-19T17:30:49
365,812,657
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package Exercise4_6; public class Avocado extends Apple { public Avocado(String n, double p, int q) { super(n, p, q); } public String printBenefit() { //overriding method return "\n******Benefit******" + "\nAvocado help to regulate appetie and help keep eyes healthy."; } public String toString() { //overriding method return printBenefit(); } }
a0e294b70c313deab47e55847b3cb3a464d1f135
61103500eaa66125da9979c74667adc75c4ca397
/stubook/src/com/itqf/service/impl/ShowProductServiceImpl.java
a184fbd5fde194f695f18867901d0db34cb9f865
[]
no_license
Sun19930306/MyProject
0a5ad6425d9d19312d6092be716eca6eae4afb54
5117cd3de428e86cd5c6d403a5d7143a5a5b6b05
refs/heads/master
2021-05-12T06:31:21.590845
2018-01-13T01:07:28
2018-01-13T01:07:28
117,220,544
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.itqf.service.impl; import java.util.Map; import com.itqf.dao.ShowProduct; import com.itqf.dao.impl.ShowProductDaoImpl; import com.itqf.service.ShowProductService; public class ShowProductServiceImpl implements ShowProductService { private ShowProduct product = new ShowProductDaoImpl(); public Map<String, Object> query(int page) { return product.query(page); } }
e0291aef4371bd72a2700abc253d1ad725822dae
bfa33a35129e842c636df9d688f0248571ad8b60
/Demo21_IO(字符流)&字符流其他内容&递归/src/cn/zx/chario/Demo4_Buffered.java
1d38cb8396c2ca05c413bda9606b44a7f4f47959
[]
no_license
zhangxu1107/Learn_Demo
9cc2395d40db6306af584da6222781e7821698c4
d9d957fec60e8006dcfe7c79317a91f31c340f52
refs/heads/master
2020-03-31T11:42:06.203235
2018-10-16T13:29:44
2018-10-16T13:29:44
152,172,694
0
0
null
null
null
null
GB18030
Java
false
false
1,165
java
package cn.zx.chario; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class Demo4_Buffered { /** * @param args * 带缓冲区的流中的特殊方法 * readLine() * newLine(); * * newLine()与\r\n的区别 * newLine()是跨平台的方法 * \r\n只支持的是windows系统 * @throws IOException */ public static void main(String[] args) throws IOException { demo1(); //newLine()方法 BufferedReader br = new BufferedReader(new FileReader("zzz.txt")); BufferedWriter bw = new BufferedWriter(new FileWriter("aaa.txt")); String line; while((line = br.readLine()) != null) { bw.write(line); bw.newLine(); //写出回车换行符 //bw.write("\r\n"); } br.close(); bw.close(); } private static void demo1() throws FileNotFoundException, IOException { //readLine()方法 BufferedReader br = new BufferedReader(new FileReader("zzz.txt")); String line; while((line = br.readLine()) != null) { System.out.println(line); } br.close(); } }
fc3e10d0111ec746d1b47563738c7d78110c291a
645b3bdc2e37f282c3e8c631a458b94901742b8d
/job-tracker-dao/src/main/java/org/limbo/flowjob/tracker/dao/po/PlanInfoPO.java
e5918e3095858671db3e02dc1c6f33cd1358f53a
[ "Apache-2.0" ]
permissive
ExtremeYu/flow-job
6beef48f499eedfc77f7410777dd1b04b2f247d3
2706b3dc3ea6e5b4442b6309ca326fcc03adc2a1
refs/heads/master
2023-07-15T15:49:53.469436
2021-08-30T11:10:50
2021-08-30T11:10:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,167
java
/* * Copyright 2020-2024 Limbo Team (https://github.com/limbo-world). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.limbo.flowjob.tracker.dao.po; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import java.time.LocalDateTime; /** * plan 的信息存档 历史版本 * * @author Brozen * @since 2021-07-13 */ @Data @EqualsAndHashCode(callSuper = true) @TableName("flowjob_plan_info") public class PlanInfoPO extends PO { private static final long serialVersionUID = -1639602897831847418L; /** * DB自增序列ID,并不是唯一标识 */ private Long serialId; /** * 作业执行计划ID */ private String planId; /** * 版本 planId + version 唯一 */ private Integer version; /** * 执行计划描述 */ private String description; /** * 计划作业调度方式 */ private Byte scheduleType; /** * 从何时开始调度作业 */ private LocalDateTime scheduleStartAt; /** * 作业调度延迟时间,单位秒 */ private Long scheduleDelay; /** * 作业调度间隔时间,单位秒。 */ private Long scheduleInterval; /** * 作业调度的CRON表达式 */ private String scheduleCron; /** * 重试次数 超过执行就失败 * job上的这个版本不设计了,用户本来就需要做幂等处理 */ private Integer retry; /** * 任务 json string */ private String jobs; /** * 是否删除 */ private Boolean isDeleted; }
a020d27140e9b05bd3a96b9ad06c3bafb6eb5305
ced45223306b65c430c427996507224720aa42dc
/jdbcTestproject/src/johnabbott/test/configuration/WebAppInitializer.java
07f0e7d6394db37edc737f69c1dfb8b0c1742b3c
[]
no_license
rezash86/jdbctemplatetest
f536ab5d2ee461036ae176040571f9d3195d22c4
0105fbbbe5675718d1db5b5f88b4004450a3ad07
refs/heads/master
2022-12-23T23:35:49.019494
2020-01-06T02:03:13
2020-01-06T02:03:13
231,703,790
0
0
null
2022-12-15T23:56:59
2020-01-04T03:37:59
Java
UTF-8
Java
false
false
901
java
package johnabbott.test.configuration; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; public class WebAppInitializer implements WebApplicationInitializer { public void onStartup(ServletContext container) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(WebMvcConfig.class); ctx.setServletContext(container); ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.setLoadOnStartup(1); servlet.addMapping("/"); } }
d3478c8c3c05d333a3eca59b5bb5570a6d0d228a
2a927385052f1f58354801dd09e11e331b806977
/mybatis-3-mybatis-3.4.2/src/test/java/org/apache/ibatis/reflection/ReflectorTest.java
8b73b5813124db20cb0d96c82411dad076c56407
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
fenggulaike/SourceCode-mybatis
13e0ede395a988f02ebea0e33f0fc65dac4783b7
8733083a2154cc95320711b21369cb0bdee8f0c9
refs/heads/master
2020-03-11T23:33:15.304692
2018-04-20T09:02:21
2018-04-20T09:02:21
130,324,818
0
0
null
null
null
null
UTF-8
Java
false
false
6,487
java
/** * Copyright ${license.git.copyrightYears} the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.reflection; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import java.io.Serializable; import java.util.List; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class ReflectorTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void testGetSetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Section.class); Assert.assertEquals(Long.class, reflector.getSetterType("id")); } @Test public void testGetGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Section.class); Assert.assertEquals(Long.class, reflector.getGetterType("id")); } @Test public void shouldNotGetClass() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Section.class); Assert.assertFalse(reflector.hasGetter("class")); } static interface Entity<T> { T getId(); void setId(T id); } static abstract class AbstractEntity implements Entity<Long> { private Long id; @Override public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } } static class Section extends AbstractEntity implements Entity<Long> { } @Test public void shouldResolveSetterParam() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getSetterType("id")); } @Test public void shouldResolveParameterizedSetterParam() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(List.class, reflector.getSetterType("list")); } @Test public void shouldResolveArraySetterParam() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); Class<?> clazz = reflector.getSetterType("array"); assertTrue(clazz.isArray()); assertEquals(String.class, clazz.getComponentType()); } @Test public void shouldResolveGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("id")); } @Test public void shouldResolveSetterTypeFromPrivateField() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getSetterType("fld")); } @Test public void shouldResolveGetterTypeFromPublicField() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("pubFld")); } @Test public void shouldResolveParameterizedGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(List.class, reflector.getGetterType("list")); } @Test public void shouldResolveArrayGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); Class<?> clazz = reflector.getGetterType("array"); assertTrue(clazz.isArray()); assertEquals(String.class, clazz.getComponentType()); } static abstract class Parent<T extends Serializable> { protected T id; protected List<T> list; protected T[] array; private T fld; public T pubFld; public T getId() { return id; } public void setId(T id) { this.id = id; } public List<T> getList() { return list; } public void setList(List<T> list) { this.list = list; } public T[] getArray() { return array; } public void setArray(T[] array) { this.array = array; } public T getFld() { return fld; } } static class Child extends Parent<String> { } @Test public void shouldResoleveReadonlySetterWithOverload() throws Exception { class BeanClass implements BeanInterface<String> { public void setId(String id) {} } ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(BeanClass.class); assertEquals(String.class, reflector.getSetterType("id")); } interface BeanInterface<T> { void setId(T id); } @Test public void shouldSettersWithUnrelatedArgTypesThrowException() throws Exception { @SuppressWarnings("unused") class BeanClass { public void setTheProp(String arg) {} public void setTheProp(Integer arg) {} } expectedException.expect(ReflectionException.class); expectedException.expectMessage(allOf( containsString("theProp"), containsString("BeanClass"), containsString("java.lang.String"), containsString("java.lang.Integer"))); ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(BeanClass.class); reflector.getSetterType("theProp"); } }
[ "fenggulaike" ]
fenggulaike
e0b5d83b67d08ecfae0c90f5c93d85660db4ec65
b429ade6399c3a0cc6419f06bb0e335a6f563c5e
/backend/src/main/java/net/bons/comptes/cqrs/CreateProjectHandler.java
d0e28b7a59dd69916f3c16c9b260282cced0c1b6
[ "Beerware" ]
permissive
barmic/cotize
02874c60a8d836a153952fad190bf499df3ff295
9f4abd9f00aef2547c5680e38f62b0fe9f8d049d
refs/heads/master
2022-06-03T16:34:46.509423
2019-06-03T07:14:36
2019-06-03T07:14:36
41,143,047
3
3
NOASSERTION
2022-05-20T20:51:58
2015-08-21T07:50:15
Java
UTF-8
Java
false
false
1,639
java
package net.bons.comptes.cqrs; /* Licence Public Barmic * copyright 2014-2016 Michel Barret <[email protected]> */ import com.google.inject.Inject; import io.vertx.core.Handler; import io.vertx.rxjava.ext.web.RoutingContext; import net.bons.comptes.cqrs.command.CreateProject; import net.bons.comptes.cqrs.utils.CommandExtractor; import net.bons.comptes.cqrs.utils.Utils; import net.bons.comptes.service.MailService; import net.bons.comptes.service.ProjectStore; public class CreateProjectHandler implements Handler<RoutingContext> { private CommandExtractor commandExtractor; private MailService mailService; private ProjectStore projectStore; @Inject public CreateProjectHandler(CommandExtractor commandExtractor, MailService mailService, ProjectStore projectStore) { this.commandExtractor = commandExtractor; this.mailService = mailService; this.projectStore = projectStore; } @Override public void handle(RoutingContext event) { commandExtractor.readQuery(event, CreateProject::new) .flatMap(projectStore::storeProject) .map(project -> { mailService.sendCreatedProject(project, event.request().getHeader("host")); return project; }) .subscribe(tuple2 -> event.response() .putHeader("Content-Type", "application/json") .end(tuple2.toJson().toString()) , Utils.manageError(event)); } }
9c2d8968635e974e70d99c0b14381469ccd89611
6a73c05f6de364388de2bd9b16fcfd45f20dbfc0
/AIDL_Demo/src/main/java/com/zuimeia/aidl_demo/Book.java
d014141dd208040ecc185d2d986972847601c14f
[]
no_license
Adan0225/androiddemo
9eaf2ce33abd31d06c71a66bbfbdf51bea6d6108
c6e823f89eef3d36d90ab8d83ed0bcfe4e28fd3f
refs/heads/master
2020-03-28T18:35:13.616255
2018-09-15T10:52:28
2018-09-15T10:52:28
148,893,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,180
java
package com.zuimeia.aidl_demo; import android.os.Parcel; import android.os.Parcelable; /** * Created by chenzhiyong on 16/3/6. */ public class Book implements Parcelable { private String mDesc; private int mPrise; public String getDesc() { return mDesc; } public void setDesc(String desc) { mDesc = desc; } public int getPrise() { return mPrise; } public void setPrise(int prise) { mPrise = prise; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.mDesc); dest.writeInt(this.mPrise); } public Book() { } protected Book(Parcel in) { this.mDesc = in.readString(); this.mPrise = in.readInt(); } public static final Parcelable.Creator<Book> CREATOR = new Parcelable.Creator<Book>() { public Book createFromParcel(Parcel source) { return new Book(source); } public Book[] newArray(int size) { return new Book[size]; } }; }
[ "jason_yao" ]
jason_yao
cfcda5a2354a810bf0961570df987823728d6032
60704db00449ef8e898b2ef761e6e0ec38c36320
/src/main/java/com/adobe/cq/commerce/magento/graphql/RemoveCouponFromCartOutputQuery.java
e94b4401005cdc7827333af46edda103aac26477
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caciobanita/commerce-cif-magento-graphql
9e876607880cfe28ff5fcf2b005118d7818d44a1
5352a061ce3291c0a4cc424ad284ce03b2911bd0
refs/heads/master
2022-06-10T03:45:43.362661
2020-05-08T07:28:59
2020-05-08T07:28:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,375
java
/******************************************************************************* * * Copyright 2020 Adobe. All rights reserved. * This file is licensed 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 REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. * ******************************************************************************/ package com.adobe.cq.commerce.magento.graphql; import com.shopify.graphql.support.AbstractQuery; public class RemoveCouponFromCartOutputQuery extends AbstractQuery<RemoveCouponFromCartOutputQuery> { RemoveCouponFromCartOutputQuery(StringBuilder _queryBuilder) { super(_queryBuilder); } public RemoveCouponFromCartOutputQuery cart(CartQueryDefinition queryDef) { startField("cart"); _queryBuilder.append('{'); queryDef.define(new CartQuery(_queryBuilder)); _queryBuilder.append('}'); return this; } }
1884390134ae58909be2241b4a086653d4740b0f
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/machinelearning/azure-resourcemanager-machinelearning/src/main/java/com/azure/resourcemanager/machinelearning/models/ModelVersionProperties.java
93b7cedb104b128f851ad0990dae480401d1f3f3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
4,844
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.machinelearning.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** Model asset version details. */ @Fluent public final class ModelVersionProperties extends AssetBase { /* * Mapping of model flavors to their properties. */ @JsonProperty(value = "flavors") @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map<String, FlavorData> flavors; /* * Name of the training job which produced this model */ @JsonProperty(value = "jobName") private String jobName; /* * The storage format for this entity. Used for NCD. */ @JsonProperty(value = "modelType") private String modelType; /* * The URI path to the model contents. */ @JsonProperty(value = "modelUri") private String modelUri; /** Creates an instance of ModelVersionProperties class. */ public ModelVersionProperties() { } /** * Get the flavors property: Mapping of model flavors to their properties. * * @return the flavors value. */ public Map<String, FlavorData> flavors() { return this.flavors; } /** * Set the flavors property: Mapping of model flavors to their properties. * * @param flavors the flavors value to set. * @return the ModelVersionProperties object itself. */ public ModelVersionProperties withFlavors(Map<String, FlavorData> flavors) { this.flavors = flavors; return this; } /** * Get the jobName property: Name of the training job which produced this model. * * @return the jobName value. */ public String jobName() { return this.jobName; } /** * Set the jobName property: Name of the training job which produced this model. * * @param jobName the jobName value to set. * @return the ModelVersionProperties object itself. */ public ModelVersionProperties withJobName(String jobName) { this.jobName = jobName; return this; } /** * Get the modelType property: The storage format for this entity. Used for NCD. * * @return the modelType value. */ public String modelType() { return this.modelType; } /** * Set the modelType property: The storage format for this entity. Used for NCD. * * @param modelType the modelType value to set. * @return the ModelVersionProperties object itself. */ public ModelVersionProperties withModelType(String modelType) { this.modelType = modelType; return this; } /** * Get the modelUri property: The URI path to the model contents. * * @return the modelUri value. */ public String modelUri() { return this.modelUri; } /** * Set the modelUri property: The URI path to the model contents. * * @param modelUri the modelUri value to set. * @return the ModelVersionProperties object itself. */ public ModelVersionProperties withModelUri(String modelUri) { this.modelUri = modelUri; return this; } /** {@inheritDoc} */ @Override public ModelVersionProperties withIsAnonymous(Boolean isAnonymous) { super.withIsAnonymous(isAnonymous); return this; } /** {@inheritDoc} */ @Override public ModelVersionProperties withIsArchived(Boolean isArchived) { super.withIsArchived(isArchived); return this; } /** {@inheritDoc} */ @Override public ModelVersionProperties withDescription(String description) { super.withDescription(description); return this; } /** {@inheritDoc} */ @Override public ModelVersionProperties withProperties(Map<String, String> properties) { super.withProperties(properties); return this; } /** {@inheritDoc} */ @Override public ModelVersionProperties withTags(Map<String, String> tags) { super.withTags(tags); return this; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ @Override public void validate() { super.validate(); if (flavors() != null) { flavors() .values() .forEach( e -> { if (e != null) { e.validate(); } }); } } }
c104a4bacc2f6fbece1af58e1db7a87a113bb502
898d4aaeaaf76bfdeba4f2f3090c8de6b87f5b34
/app/src/main/java/com/example/akdenizapp/NewComplaint.java
77683fb3373b3a012a8bf2f5f0a06bc30c72ef6e
[]
no_license
ErkamDogan/UniversityApp
99b9e4c43f23502ea4641c8b13fa49f32b80c334
f2a0e8f5542e19b939ae7b186f2ae20d0a924548
refs/heads/master
2023-06-07T08:43:28.619100
2021-07-07T14:29:04
2021-07-07T14:29:04
383,804,215
1
0
null
null
null
null
UTF-8
Java
false
false
4,399
java
package com.example.akdenizapp; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.drawerlayout.widget.DrawerLayout; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.ImageButton; import com.google.android.material.navigation.NavigationView; import java.util.ArrayList; public class NewComplaint extends AppCompatActivity { private DrawerLayout mDrawer; private NavigationView nvDrawer; // Make sure to be using androidx.appcompat.app.ActionBarDrawerToggle version. private ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_complaints); ArrayList<String> units = new ArrayList<String>(); units.add("Hangi birime ulaştırmak istediğinizi seçiniz"); findViewById(R.id.button_complaint_send).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent t = new Intent(NewComplaint.this, Complaints.class); startActivity(t); } }); // This will display an Up icon (<-), we will replace it with hamburger later getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Find our drawer view mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerToggle.setDrawerIndicatorEnabled(true); mDrawer.addDrawerListener(drawerToggle); drawerToggle.syncState(); nvDrawer = (NavigationView) findViewById(R.id.nvView); nvDrawer.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener(){ @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int id = item.getItemId(); if(id == R.id.nav_home){ Intent t = new Intent(NewComplaint.this, HomePageActivity.class); startActivity(t); } if(id == R.id.nav_announcements){ Intent t = new Intent(NewComplaint.this,Announcements_stvs.class); startActivity(t); } if(id == R.id.nav_events){ Intent t = new Intent(NewComplaint.this,Events.class); startActivity(t); } if(id == R.id.nav_complaints){ Intent t = new Intent(NewComplaint.this, Complaints.class); startActivity(t); } if(id == R.id.nav_maps){ Intent t = new Intent(NewComplaint.this,MapsActivity.class); startActivity(t); } if(id == R.id.nav_feedback){ Intent t = new Intent(NewComplaint.this,feedback.class); startActivity(t); } if(id == R.id.nav_dinings){ Intent t = new Intent(NewComplaint.this,Dining.class); startActivity(t); } if(id == R.id.nav_classes){ Intent t = new Intent(NewComplaint.this,Classes.class); startActivity(t); } if(id == R.id.nav_clubs){ Intent t = new Intent(NewComplaint.this,StudentClubs.class); startActivity(t); } if(id == R.id.nav_Surveys){ Intent t = new Intent(NewComplaint.this,Surveys.class); startActivity(t); } if(id == R.id.nav_login){ Intent t = new Intent(NewComplaint.this,login.class); startActivity(t); } return true; } }); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if(drawerToggle.onOptionsItemSelected(item)) return true; return super.onOptionsItemSelected(item); } }
d7f2b492bc76a8f16113fe39ae9cebbb351ebcee
b4252cd1c9942474ca1a17cd906196d264f4d60e
/src/com/cartmatic/estore/imports/handler/product/ProductKindHandler.java
99abcda31a7bdd9ec8c592853c6ec42965308bc6
[]
no_license
1649865412/StoreAdminOne
5acb273becf848f5007320bff720924cb1fd5faf
70bc2fb098eafb436c8860cdf9a58e63ee61510b
refs/heads/master
2021-01-02T22:58:16.554900
2015-06-26T05:54:52
2015-06-26T05:54:52
38,096,515
0
3
null
null
null
null
UTF-8
Java
false
false
1,642
java
package com.cartmatic.estore.imports.handler.product; import java.math.BigDecimal; import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import com.cartmatic.estore.common.model.catalog.Product; import com.cartmatic.estore.imports.handler.ColumnHandler; import com.cartmatic.estore.imports.handler.basic.ColumnBasicHandler; import com.cartmatic.estore.imports.model.Column; import com.cartmatic.estore.imports.model.ImportModel; public class ProductKindHandler extends ColumnBasicHandler implements ColumnHandler { private Logger logger = Logger.getLogger(ProductKindHandler.class); public void setProperty(ImportModel importModel,Column column) throws Exception { Product product=(Product)importModel.getTarget(); Short origProductKind=product.getProductKind(); //目前只判断是否存在两个价格来决定是否变种 List<String> values = column.getValues(); int count=0; for (String value : values) { if (StringUtils.isNotBlank(value)) { try { if(new BigDecimal(value).doubleValue()>0) count++; } catch (Exception e) { // TODO: handle exception } } } Short productKind=null; if(count>1){ productKind=new Short("2"); }else{ productKind=new Short("1"); } if(product.getId()==null){ product.setProductKind(productKind); }else{ if(column.isSupportUpdate()){ product.setProductKind(productKind); }else if(productKind.intValue()!=origProductKind){ logger.warn("本条数据为更新,productKind不支持更新操作。"+column); } } } }
ef9af01006df7fbea42a9a4e6be7dee178f371f8
2f0320694e18b5200030bc7d5ab46bdd61a0e25a
/src/main/java/com/li/controller/HomeController.java
f6b08b47343135e0d6dcc826c0f01db96e211f61
[]
no_license
JarvisJim/HSSM
c2dd443de7fdcdd8baadc80b7c7f01ad01340c23
ecfa6df4f493fdb6e178745d8d14f53cf3ceee99
refs/heads/master
2020-06-18T08:35:58.171117
2018-07-30T06:56:56
2018-07-30T06:56:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package com.li.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HomeController { @RequestMapping("/index") public String index(){ return "listEmployee2"; } }
4bfb3535c07f444475309df37ce78d0625dc02e2
ab97b5478d007246782597387473bd3c11e39b1f
/src/main/java/net/kkolyan/elements/engine/core/slick2d/ShellAdapter.java
c0f3953d42d99c0680617cf21686692ce16ff1bc
[]
no_license
kkolyan/elements
41bbac7acf1bd683719698728c0684ddd52ba73b
a94c1e6386f9455fe6877041226dd2db64d606ab
refs/heads/master
2020-03-28T19:12:37.778846
2015-09-13T04:29:32
2015-09-13T04:29:32
42,209,588
0
0
null
null
null
null
UTF-8
Java
false
false
4,186
java
package net.kkolyan.elements.engine.core.slick2d; import org.newdawn.slick.Color; import org.newdawn.slick.Game; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Input; import org.newdawn.slick.KeyListener; import org.newdawn.slick.SlickException; import org.newdawn.slick.TrueTypeFont; import java.awt.Font; import java.util.ArrayList; import java.util.List; /** * @author nplekhanov */ public class ShellAdapter implements Game, KeyListener { private List<String> history = new ArrayList<String>(); private int historyCursor; private String commandLine; private Shell shell; private SwitchableInputGame target; private TrueTypeFont font; private Input input; public ShellAdapter(Shell shell, SwitchableInputGame target) { this.shell = shell; this.target = target; } @Override public void init(GameContainer container) throws SlickException { font = new TrueTypeFont(new Font("Courier New", Font.BOLD, 16), true); target.init(container); input = container.getInput(); input.addKeyListener(this); } @Override public void update(GameContainer container, int delta) throws SlickException { container.setShowFPS(commandLine == null); target.update(container, delta); } @Override public void render(GameContainer container, Graphics g) throws SlickException { target.render(container, g); if (commandLine != null) { g.setColor(new Color(0, 0, 0, 127)); g.fillRect(0, 0, container.getWidth(), container.getHeight()); g.setColor(Color.white); g.setFont(font); g.drawString(">"+commandLine+"_", 30, 30); } } @Override public boolean closeRequested() { return target.closeRequested(); } @Override public String getTitle() { return target.getTitle(); } @Override public void keyPressed(int key, char c) { if (key != -1) { // alt and control keys don't come through here if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) { return; } if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) { return; } } if (key == Input.KEY_GRAVE) { if (commandLine == null) { commandLine = ""; } else { commandLine = null; } target.setAcceptingInput(commandLine == null); return; } if (commandLine == null) { return; } if (key == Input.KEY_UP) { navigateHistory(1); } else if (key == Input.KEY_DOWN) { navigateHistory(-1); } else if (key == Input.KEY_BACK) { if (!commandLine.isEmpty()) { commandLine = commandLine.substring(0, commandLine.length() - 1); } } else if ((c < 127) && (c > 31)) { commandLine = commandLine + c; } else if (key == Input.KEY_RETURN) { if (!commandLine.isEmpty()) { shell.executeCommand(commandLine); history.add(commandLine); historyCursor = 0; commandLine = ""; } } } private void navigateHistory(int offset) { historyCursor += offset; if (historyCursor > history.size()) { historyCursor = history.size(); } if (historyCursor < 0) { historyCursor = 0; } if (historyCursor == 0) { commandLine = ""; } else { commandLine = history.get(history.size() - historyCursor); } } @Override public void keyReleased(int key, char c) { } @Override public void setInput(Input input) { } @Override public boolean isAcceptingInput() { return true; } @Override public void inputEnded() { } @Override public void inputStarted() { } }
[ "hidden" ]
hidden
f5e469bde59e2b0828bf111cf3f7d0f9fe1c648b
9cd45a02087dac52ea4d39a0c17e525c11a8ed97
/src/java/com/adincube/sdk/mediation/f/a.java
9fbe7066b8f98f878a17858c401f759188353ea1
[]
no_license
abhijeetvaidya24/INFO-NDVaidya
fffb90b8cb4478399753e3c13c4813e7e67aea19
64d69250163e2d8d165e8541aec75b818c2d21c5
refs/heads/master
2022-11-29T16:03:21.503079
2020-08-12T06:00:59
2020-08-12T06:00:59
286,928,296
0
0
null
null
null
null
UTF-8
Java
false
false
1,050
java
/* * Decompiled with CFR 0.0. * * Could not load the following classes: * java.lang.Integer * java.lang.Object * java.lang.String */ package com.adincube.sdk.mediation.f; import com.adincube.sdk.mediation.b; import com.adincube.sdk.mediation.j; public final class a { com.adincube.sdk.mediation.a a = null; private b b = null; public a(b b2) { this.b = b2; } public final void a() { com.adincube.sdk.mediation.a a2 = this.a; if (a2 != null) { a2.a(); } } public final void a(int n2) { if (this.a != null) { j.a a2 = j.a.d; if (n2 != -103 && n2 != -102) { if (n2 != -6) { if (n2 == 204) { a2 = j.a.b; } } else { a2 = j.a.d; } } else { a2 = j.a.c; } j j2 = new j(this.b, a2, Integer.toString((int)n2)); this.a.a(j2); } } }
6c67644d8702e2d4609ba311cc3191dc86fd0a04
53599bdf7ebfe935627fa9311c94446744614bbe
/Jarvis/app/src/main/java/com/example/jarvis/FriendList.java
353e6c7f043216b00ef901e9c3884032e3a7474b
[]
no_license
smkjason/Jarvis-CPEN-321-
42ff5bb24a808f35e8603a2530e6b58c040692f4
e7dc2ab568d21dde39a91276b67b923ff25349e0
refs/heads/master
2022-12-27T20:22:07.112408
2019-11-27T01:06:48
2019-11-27T01:06:48
209,467,543
0
0
null
2020-10-06T01:45:43
2019-09-19T05:13:03
Java
UTF-8
Java
false
false
4,602
java
package com.example.jarvis; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.provider.ContactsContract; import android.util.Log; import android.view.View; import android.widget.ListView; import android.widget.SimpleAdapter; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.jarvis.adapter.FriendAdapter; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONObject; import java.io.BufferedReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class FriendList extends AppCompatActivity { private RecyclerView recyclerView; private RecyclerView.Adapter mAdapter; private RecyclerView.LayoutManager layoutManager; private List<String> list; Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.friend_list); toolbar = findViewById(R.id.friend_toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("FriendList"); getSupportActionBar().setDisplayShowHomeEnabled(true); GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(this); //new BackendTask(acct.getEmail()).execute(); ListView resultsListView = (ListView) findViewById(R.id.results); HashMap<String,String> nameEmail = new HashMap<>(); nameEmail.put("a","a"); nameEmail.put("b","b"); nameEmail.put("c","c"); nameEmail.put("d","d"); nameEmail.put("e","e"); nameEmail.put("f","f"); nameEmail.put("g","g"); nameEmail.put("h","h"); nameEmail.put("i","i"); List<HashMap<String,String>> listItems = new ArrayList<>(); SimpleAdapter adapter = new SimpleAdapter(this,listItems,R.layout.friend_list_text_view, new String[]{"First Line", "Second Line"}, new int[]{R.id.name,R.id.email}); Iterator it = nameEmail.entrySet().iterator(); while (it.hasNext()) { HashMap<String,String> resultMap = new HashMap<>(); Map.Entry pair = (Map.Entry)it.next(); resultMap.put("First Line", pair.getKey().toString()); resultMap.put("Second Line", pair.getValue().toString()); listItems.add(resultMap); } resultsListView.setAdapter(adapter); // recyclerView = (RecyclerView) findViewById(R.id.friends_recycler_view); // // // use this setting to improve performance if you know that changes // // in content do not change the layout size of the RecyclerView // recyclerView.setHasFixedSize(true); // // // use a linear layout manager // layoutManager = new LinearLayoutManager(this); // recyclerView.setLayoutManager(layoutManager); // // list = Arrays.asList(getResources().getStringArray(R.array.test)); //change to friend list in data base // // specify an adapter (see also next example) // mAdapter = new FriendAdapter(list); // recyclerView.setAdapter(mAdapter); } private class BackendTask extends AsyncTask<Void, Void, String> { String email; BackendTask(String email) { this.email = email; } @Override protected String doInBackground(Void... v) { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://ec2-3-14-144-180.us-east-2.compute.amazonaws.com/user/" + email); String message = ""; try { HttpResponse response = client.execute(request); JSONObject friendlist = new JSONObject(response.toString()); } catch (java.io.IOException e) { Log.e("Error", "Connection Error"); } catch (org.json.JSONException je) { Log.e("Error", "Invalid JSONObject"); } return message; } protected void onProgressUpdate() { } protected void onPostExecute(String message) { } } }
7af371c31cf1eafda8b8d62bfe795558e1db1740
be76334be32ddf40f4c417e1f543e92b547fcda7
/Foros/generado/ForosISIS.api/src/main/java/co/edu/uniandes/csw/G3xtreme/lugar/logic/dto/LugarDTO.java
655b33605f3d23968d9bcff885ada394805824ac
[]
no_license
SamuelBaquero/ForosIsis
788895b2217e7673adeae9c47985116a2b11ab79
4a2da9f7add49987c6b497953d78e83d8f4df074
refs/heads/master
2021-01-15T13:33:24.136206
2014-10-28T21:18:07
2014-10-28T21:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,449
java
/* ======================================================================== * Copyright 2014 G3xtreme * * Licensed under the MIT, The MIT License (MIT) * Copyright (c) 2014 G3xtreme 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. * ======================================================================== Source generated by CrudMaker version 1.0.0.201408112050 */ package co.edu.uniandes.csw.G3xtreme.lugar.logic.dto; public class LugarDTO extends _LugarDTO { }
4a485980344b5db164e8aafa185b4b59a6bda38e
e9a2bd62e0e3a25821158fb2243d976076f565e1
/dt-parent/dt-web/src/main/java/com/techm/adms/dt/web/EmpathyService.java
677058be4d6877aec373e66aa796adedde30e004
[]
no_license
kailashsjk/latestdt
98caafbf2b0926ee708a4aca1b13bffbf03aa63d
48287afea859c2af0538dfb3175723de1de4f38d
refs/heads/master
2021-07-14T17:36:03.138327
2017-10-13T13:20:14
2017-10-13T13:20:14
106,825,130
0
0
null
null
null
null
UTF-8
Java
false
false
2,177
java
package com.techm.adms.dt.web; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.techm.adms.dt.common.exception.DTServiceException; import com.techm.adms.dt.entity.Empathy; import com.techm.adms.dt.entity.Observation; import com.techm.adms.dt.service.IDTEmpathyBean; import com.techm.adms.dt.web.util.ServiceConstants; @Path("/empathyservice") @RequestScoped public class EmpathyService { @Inject IDTEmpathyBean dTEmpathyBean; private static final Logger LOGGER = LoggerFactory.getLogger(EmpathyService.class); /** * Retrieves Empathy list to display in empathy map screen * * @param mediaId * @return */ @GET @Path("/getempathy/{mediaID}") @Produces({"application/json"}) public Empathy retrieveEmpathyList(@PathParam("mediaID") int mediaID){ LOGGER.info("In Service Class"); try{ List<Observation> observationsList = dTEmpathyBean.retrieveEmpathy(mediaID); return prepareEmpathyMap(observationsList); }catch(Exception e){ throw new DTServiceException(e); } } /* * Preparing the Empathy Map list from Observations based on Media */ private Empathy prepareEmpathyMap(List<Observation> observationsList){ Empathy empathy = new Empathy(); LOGGER.info("In Service Class"); try{ for(Observation observation:observationsList){ switch(observation.getObservationCategory().getObservationCategoryID()){ case ServiceConstants.OBSERVATION_CATEGORY_SAY_ID: empathy.addSayObservation(observation); break; case ServiceConstants.OBSERVATION_CATEGORY_DO_ID: empathy.addDoObservation(observation); break; case ServiceConstants.OBSERVATION_CATEGORY_FEEL_ID: empathy.addFeelObservation(observation); break; case ServiceConstants.OBSERVATION_CATEGORY_THINK_ID: empathy.addThinkObservation(observation); break; default: break; } } }catch(Exception e){ throw new DTServiceException(e); } return empathy; } }
df37c431603293ba1713fdd5dcb0572b5c62ea0e
55aca439e180a9bcf0a36f60320013979905d1e5
/efreight-afbase/src/main/java/com/efreight/afbase/controller/LcCostController.java
1402308778a535d15ad7c19c5ffa1195d9c542ba
[]
no_license
zhoudy-github/efreight-cloud
1a8f791f350a37c1f2828985ebc20287199a8027
fc669facfdc909b51779a88575ab4351e275bd25
refs/heads/master
2023-03-18T07:24:18.001404
2021-03-23T06:55:54
2021-03-23T06:55:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,047
java
package com.efreight.afbase.controller; import java.util.List; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.efreight.afbase.entity.LcCost; import com.efreight.afbase.service.LcCostService; import com.efreight.common.security.util.MessageInfo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @RestController @AllArgsConstructor @RequestMapping("/lc-cost") @Slf4j public class LcCostController { private final LcCostService service; /** * 查询成本明细(未完全对账的) * @param lcCost * @return */ @GetMapping("/list") public MessageInfo getCostList(LcCost lcCost) { try { List<LcCost> result = service.getCostList(lcCost); return MessageInfo.ok(result); } catch (Exception e) { log.info(e.getMessage()); return MessageInfo.failed(e.getMessage()); } } }
27ab7cfa26d7b8bb06ad541104bb3d86a68ded5a
4c730ce99f29fdc883557bbdcb52a48890e2ff18
/app/src/main/java/details/hotel/app/hoteldetails/Adapter/RoomCategoriesListAdapter.java
dfafee9dd2fe184395eebe0e68c9c0554ee6fe9d
[]
no_license
nisharzingo/HotelDetailsOptions
0b6ba91a0ee0b1e6ea956682bf0c315f86c73a30
48d9b007d6a3101ac4a46cfbe9f11703d6372107
refs/heads/master
2020-04-10T17:48:22.721586
2018-12-11T19:14:13
2018-12-11T19:14:13
161,184,769
0
0
null
null
null
null
UTF-8
Java
false
false
4,962
java
package details.hotel.app.hoteldetails.Adapter; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import details.hotel.app.hoteldetails.Customs.CustomFonts.TextViewRobotoregular; import details.hotel.app.hoteldetails.Model.HotelDetails; import details.hotel.app.hoteldetails.Model.Rates; import details.hotel.app.hoteldetails.Model.RoomCategories; import details.hotel.app.hoteldetails.R; import details.hotel.app.hoteldetails.UI.Activities.BookAvailablityScreen; import details.hotel.app.hoteldetails.Utils.Util; import details.hotel.app.hoteldetails.WebAPI.RateApi; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * Created by ZingoHotels Tech on 11-12-2018. */ public class RoomCategoriesListAdapter extends RecyclerView.Adapter<RoomCategoriesListAdapter.ViewHolder> { Context context; ArrayList<RoomCategories> roomCategories; public RoomCategoriesListAdapter(Context context, ArrayList<RoomCategories> roomCategories) { this.context = context; this.roomCategories = roomCategories; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_room_category_list,parent,false); return new ViewHolder(view); } @Override public void onBindViewHolder(final ViewHolder holder, final int position) { final RoomCategories roomCategory = roomCategories.get(position); if(roomCategory!=null){ holder.mCategoryName.setText(roomCategories.get(position).getCategoryName()); if(roomCategory.getRates()!=null){ if(roomCategory.getRates().size()!=0){ holder.mRate.setText("₹ "+roomCategory.getRates().get(0).getSellRateForSingle()+"/-(incl GST)"); } }else{ getRatesByCategoryId(roomCategory.getRoomCategoryId(),holder.mRate); } holder.mBookNow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent book = new Intent(context, BookAvailablityScreen.class); Bundle bundle = new Bundle(); bundle.putSerializable("Category",roomCategory); book.putExtras(bundle); context.startActivity(book); } }); }else{ } } @Override public int getItemCount() { return roomCategories.size(); } public class ViewHolder extends RecyclerView.ViewHolder { TextView mCategoryName,mRate; ImageView mCategoryImage; Button mBookNow; public ViewHolder(View itemView) { super(itemView); mCategoryName = (TextView)itemView.findViewById(R.id.category_name); mRate = (TextView) itemView.findViewById(R.id.rate); mCategoryImage = (ImageView) itemView.findViewById(R.id.category_image); mBookNow = (Button) itemView.findViewById(R.id.book_category); } } private void getRatesByCategoryId(final int categoryId, final TextView sellRate){ RateApi apiService = Util.getClient().create(RateApi.class); //String authenticationString = Util.getToken(context); String authenticationString = "Basic TW9obmlBdmQ6ODIyMDgxOTcwNg=="; Call<ArrayList<Rates>> call = apiService.getRatesByCategoryId(authenticationString,categoryId); call.enqueue(new Callback<ArrayList<Rates>>() { @Override public void onResponse(Call<ArrayList<Rates>> call, Response<ArrayList<Rates>> response) { try { int statusCode = response.code(); if (statusCode == 200||statusCode==201||statusCode==204) { if(response.body()!=null&&response.body().size()!=0){ sellRate.setText("₹ "+response.body().get(0).getSellRateForSingle()+"/-(incl GST)"); } }else { } } catch (Exception ex) { ex.printStackTrace(); } } @Override public void onFailure(Call<ArrayList<Rates>> call, Throwable t) { // Log error here since request failed Log.e("TAG", t.toString()); } }); } }
47e945dee6eac6bc68ee7a15cbd304dfaf0f85a3
25848f7a075be87ad7e0dad7ec300f9194a2fd11
/MakeTags.java
f2eb2f45bc9639a780d473a011ed41e825dd503b
[]
no_license
fearlessfreap24/StringOneJava
b0026d258da3b116d8b7d51603c3012ee10da543
f312e43d6627b8434e16f5143ca8fcba563d4051
refs/heads/master
2022-11-30T17:01:05.636671
2020-08-14T21:18:50
2020-08-14T21:18:50
287,103,960
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
import java.util.Arrays; //The web is built with HTML strings like "<i>Yay</i>" which draws //Yay as italic text. In this example, the "i" tag makes <i> and //</i> which surround the word "Yay". Given tag and word strings, //create the HTML string with tags around the word, e.g. "<i>Yay</i>". // //makeTags("i", "Yay") → "<i>Yay</i>" //makeTags("i", "Hello") → "<i>Hello</i>" //makeTags("cite", "Yay") → "<cite>Yay</cite>" public class MakeTags { public static void main(String[] args) { // TODO Auto-generated method stub MakeTags start = new MakeTags(); start.run(); } private void run() { // TODO Auto-generated method stub String[][] input = { {"i", "Yay"}, {"i", "Hello"}, {"cite", "Yay"} }; for ( String[] i : input ) { System.out.printf("i = %s : %s\n", Arrays.toString(i), makeTags( i[0], i[1])); } } private String makeTags(String tag, String word) { // TODO Auto-generated method stub return String.format("<%s>%s</%s>", tag, word, tag); } }
961bfcb56614d1fb21b6d57da9d3f39bd4fdf710
90cc58b0c2d519211416f73831f1896b54196e95
/ROOT/src/com/upmile/util/VelocityUtils.java
b81d34cc852d95fd12345de072ca514d1161d302
[]
no_license
kavram/bucket
0a3587017adf55aec051e96313e50f45ac8bb059
13f42a9662cb71d03b97fc21aa010abb39efc9e0
refs/heads/master
2021-01-19T08:53:30.015133
2014-02-26T05:25:13
2014-02-26T05:25:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,135
java
package com.upmile.util; import java.util.Properties; import org.apache.log4j.Logger; import org.apache.velocity.app.Velocity; public class VelocityUtils { static Logger log = Logger.getLogger(VelocityUtils.class); private String filePath; private String loader; private String forEachScopeControl; private String interpolateStringLiterals; private static String domain; private static String uploadedImagesUrl; private static String uploadedImagesPath; public void init(){ try { Properties props = new Properties(); props.put("file.resource.loader.path", filePath); props.put("resource.loader", loader); props.put("foreach.provide.scope.control", forEachScopeControl); props.put("runtime.interpolate.string.literals", interpolateStringLiterals); Velocity.init(props); } catch (Exception e) { log.error(e.getMessage(), e); } } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getLoader() { return loader; } public void setLoader(String loader) { this.loader = loader; } public String getForEachScopeControl() { return forEachScopeControl; } public void setForEachScopeControl(String forEachScopeControl) { this.forEachScopeControl = forEachScopeControl; } public String getInterpolateStringLiterals() { return interpolateStringLiterals; } public void setInterpolateStringLiterals(String interpolateStringLiterals) { this.interpolateStringLiterals = interpolateStringLiterals; } public void setDomain(String domain) { VelocityUtils.domain = domain; } public static String getDomain() { return VelocityUtils.domain; } public void setUploadedImagesUrl(String uploadedImagesUrl) { VelocityUtils.uploadedImagesUrl = uploadedImagesUrl; } public static String getUploadedImagesUrl() { return VelocityUtils.uploadedImagesUrl; } public void setUploadedImagesPath(String uploadedImagesPath) { VelocityUtils.uploadedImagesPath = uploadedImagesPath; } public static String getUploadedImagesPath() { return VelocityUtils.uploadedImagesPath; } }
3e82ef9a5edb15f02a0ae312e102236a35e9c7c0
df3b9e4d50e53de5e6132ba26165f15c2500256c
/src/main/java/com/blanche/softpairing/util/Auxiliary.java
b1d8220bc0f1ced2531644c1854e6fb2e3dcd4e9
[]
no_license
blanche789/softpairing
b9334be8df753ee5d3f6eb4ddda75f7e1768a473
19c66be5080c2bdb983d62fca2c9d2ce743d02dc
refs/heads/master
2020-08-15T09:31:18.576996
2019-10-16T16:02:12
2019-10-16T16:02:12
215,317,294
0
0
null
null
null
null
UTF-8
Java
false
false
6,849
java
package com.blanche.softpairing.util; import java.util.Random; /** * @Auther:Blanche * @Date:2019/10/13 * @Description:com.blanche.softpairing.util * @version:1.0 */ public class Auxiliary { Random random = new Random(); public int commonDivisor(int numerator, int denominator) { //生成最大公约数 int num = 1; for (int i = 1; i <= numerator; i++) { if (numerator % i == 0 && denominator % i == 0) { num = i; } } return num; } public int[] indexArray(int operatorNum , int totalOperator) { //生成运算符匹配的索引 Random random = new Random(); int[] operatorIndex = new int[operatorNum]; for (int i = 0; i < operatorNum; i++) { operatorIndex[i] = random.nextInt(totalOperator); } return operatorIndex; } public String splicingFormula(int[] operatorIndex, int[] operands, int operatorNum) {//将运算符与操作数连接 //判断式子形式的标志 int tag = random.nextInt(2); StringBuilder stringBuilder = new StringBuilder(); switch (operatorNum) { case 1: //a+b的式子 stringBuilder.append(operands[0]) .append(" ") .append(Generate.operatorArr[operatorIndex[0]]) .append(" ") .append(operands[1]) .append(" ") .append("=") .append(" "); break; case 2: if (tag == 0) { //a+b+c的式子 stringBuilder.append(operands[0]) .append(" ") .append(Generate.operatorArr[operatorIndex[0]]) .append(" ") .append(operands[1]) .append(" ") .append(Generate.operatorArr[operatorIndex[1]]) .append(" ") .append(operands[2]) .append(" ") .append("=") .append(" "); }else { //a+(b+c)的式子 stringBuilder.append(operands[0]) .append(" ") .append(Generate.operatorArr[operatorIndex[0]]) .append(" ") .append("(") .append(" ") .append(operands[1]) .append(" ") .append(Generate.operatorArr[operatorIndex[1]]) .append(" ") .append(operands[2]) .append(" ") .append(")") .append(" ") .append("=") .append(" "); } break; case 3: if (tag == 0) {//a+b+c+d的式子 stringBuilder.append(operands[0]) .append(" ") .append(Generate.operatorArr[operatorIndex[0]]) .append(" ") .append(operands[1]) .append(" ") .append(Generate.operatorArr[operatorIndex[1]]) .append(" ") .append(operands[2]) .append(" ") .append(Generate.operatorArr[operatorIndex[2]]) .append(" ") .append(operands[3]) .append(" ") .append("=") .append(" "); } else { //a+((b+c)+d)的式子 stringBuilder.append(operands[0]) .append(" ") .append(Generate.operatorArr[operatorIndex[0]]) .append(" ") .append("((") .append(" ") .append(operands[1]) .append(" ") .append(Generate.operatorArr[operatorIndex[1]]) .append(" ") .append(operands[2]) .append(" ") .append(")") .append(" ") .append(Generate.operatorArr[operatorIndex[2]]) .append(" ") .append(operands[3]) .append(" ") .append(")") .append(" ") .append("=") .append(" "); } break; } return stringBuilder.toString(); } //生成互质的两个数,分别作为分子分母 public int[] primeNumber(int numRange) { int x = random.nextInt(numRange) + 1; int y = random.nextInt(numRange) + 1; int[] primeNumArr = new int[2]; int divisor = commonDivisor(x, y); if (divisor != 1) { x = x / divisor; y = y / divisor; } primeNumArr[0] = x; primeNumArr[1] = y; return primeNumArr; } //转换为真分数 public String properFraction(int x, int y) { String properFraction; if (x > y) { if (y != 1) { int n = x / y; x = x - n * y; properFraction = n + "'" + x + "/" + y; } else { properFraction = String.valueOf(x); } } else if (x == y) { properFraction = String.valueOf(1); }else { properFraction = x + "/" + y; } return properFraction; } public int caculate(int a, int b, String operator) {//计算两个整数 char operatorChar = operator.charAt(0); int result = 0; switch (operatorChar) { case '+': result = a + b; break; case '-': result = a - b; break; case '*': result = a * b; break; case '÷': if (b == 0) { result = -1; } else if (a % b != 0) { result = -2; }else result = a / b; break; } return result; } }
d47ea119c8da6a75ef312a5c0f3f7633e22b17f7
a3b0886f7c447d202faef59ecea86e455f4803cc
/app/src/main/java/suleman/martin/com/service/bundle_values_class.java
57d15af7323ef14c45573e18ef356f42079a6ac1
[]
no_license
sulemartin87/Service_Smart_App
a10e38653cbb822601c476fb77efddd5c715669b
1c108e88d8727ea874009b8d947ebc149b14d8f0
refs/heads/master
2021-01-10T03:06:30.579644
2015-11-30T21:10:32
2015-11-30T21:10:32
46,877,179
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package suleman.martin.com.service; public class bundle_values_class { private String bundle_value; public String getbundle_value() { return bundle_value; } public void setbundle_value(String bundle_value) { this.bundle_value = bundle_value; } @Override public String toString() { return bundle_value; } }
b5c65f35a94811aa14f363029326f31297c06192
2600d49514fbc88d4367a2f0709d61f9ffcf56db
/epei/src/main/java/com/acooly/epei/domain/Department.java
425d1961ce5dbcc3a01936d2ee46ba5403ef1cf2
[]
no_license
hyx66/lpz
534df3e34f684ea0272c2b5ebff246c8d8a32f88
1d851b91ac52d285575367b6843b89876a4d16f7
refs/heads/master
2020-12-30T18:03:32.154503
2017-05-12T07:09:32
2017-05-12T07:09:32
90,950,780
0
0
null
null
null
null
UTF-8
Java
false
false
2,283
java
package com.acooly.epei.domain; import java.math.BigDecimal; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Parameter; /** * 医院科室 Entity * * @author Acooly Code Generator * Date: 2015-10-19 18:43:56 */ @Entity @Table(name = "EP_DEPARTMENT") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Department extends TimeEntity { /** serialVersionUID */ private static final long serialVersionUID = 1L; /** 主键 */ private Long id; /**医院ID*/ private Long hospitalId; /**医院名称*/ private String hospitalName; /** 科室 */ private String name; /** 删除 */ private int deleted; /**陪护价格*/ private BigDecimal phServicePrice; @Id @GeneratedValue(generator = "sequence") @GenericGenerator(name = "sequence", strategy = "sequence", parameters = { @Parameter(name = "sequence", value = "SEQ_EP_DEPARTMENT") }) public Long getId(){ return this.id; } public void setId(Long id){ this.id = id; } public Long getHospitalId() { return hospitalId; } public void setHospitalId(Long hospitalId) { this.hospitalId = hospitalId; } public String getName(){ return this.name; } public void setName(String name){ this.name = name; } public int getDeleted(){ return this.deleted; } public void setDeleted(int deleted){ this.deleted = deleted; } public String getHospitalName() { return hospitalName; } public void setHospitalName(String hospitalName) { this.hospitalName = hospitalName; } public BigDecimal getPhServicePrice() { return phServicePrice; } public void setPhServicePrice(BigDecimal phServicePrice) { this.phServicePrice = phServicePrice; } @Override public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); } }
7541f1a1ff391380c6c07cbe1568a65de8f381fa
d320858fd9f9c420050491750b6871d1cb4646e2
/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildEntity.java
9c71be0540e8a3dfe9cf475199e5925f61979a2d
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
chenxingxing6/mapstruct-examples
a811619992ca8bb89bcc3d74b066b1f570b726fa
362a43dff818c35614a5fe5cc216845e1faff77f
refs/heads/master
2020-05-17T18:31:57.529811
2019-03-23T08:11:40
2019-03-23T08:11:40
183,886,691
1
0
NOASSERTION
2019-04-28T09:27:12
2019-04-28T09:27:11
null
UTF-8
Java
false
false
1,240
java
/** * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) * and/or other contributors as indicated by the @authors tag. See the * copyright.txt file in the distribution for a full listing of all * contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mapstruct.jpa; /** * * @author Sjaak Derksen */ public class ChildEntity { private String name; private Integer childAge; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getChildAge() { return childAge; } public void setChildAge(Integer childAge) { this.childAge = childAge; } }
760c9004cab87ed9cd776bee42986eba4c895447
63e6db6507fa7bdfa5f7da9bc260e63e619a90f6
/src/main/java/pl/moras/tracker/services/ITrackingService.java
20aaa8f5a339848155c22268059fe34f157f4a2e
[]
no_license
Moras-del/FindMyFriend
efe21df89dd9f7743003bf554b3f9ed50bf9da20
df7b6b1da5030edd329f2b5e7e6c9f751eabe0e7
refs/heads/master
2021-05-17T13:55:13.058028
2020-05-23T21:42:11
2020-05-23T21:42:11
250,805,750
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package pl.moras.tracker.services; import pl.moras.tracker.model.LocationDto; import pl.moras.tracker.model.User; import java.util.List; public interface ITrackingService { List<User> getOnlineFriends(String username); User updateLocation(User user, LocationDto locationDto); User enableTracking(User user); User disableTracking(User user); }
216b59ac7729e253cfe40683139b06457116ecf9
f95ae56d5828c6d91729ca7dbe637986afaed579
/src/main/java/org/xcoderelease/parser/JSONFlattener.java
cc5d7d41c9947df33e4f6bf8019110e16b913a0b
[]
no_license
ykhandelwal913/checkXodeRelease
c540677c24a8b89db9d1ee07a152cceaa6ad35bb
d1cab86645f36e031c0a682019696a21c8d2a542
refs/heads/master
2023-04-16T12:10:44.766107
2020-09-17T19:50:17
2020-09-17T19:50:17
282,170,906
0
0
null
2021-04-26T20:31:24
2020-07-24T08:53:27
Java
UTF-8
Java
false
false
7,656
java
/* * Copyright 2012-2014 Dristhi software * Copyright 2015 Arkni Brahim * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package org.xcoderelease.parser; import java.io.File; import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class JSONFlattener { /** * The JSONObject type */ private static final Class<?> JSON_OBJECT = JSONObject.class; /** * The JSONArray type */ private static final Class<?> JSON_ARRAY = JSONArray.class; /** * The class Logger */ private static final Logger LOGGER = Logger.getLogger(JSONFlattener.class); /** * Parse the JSON content at the given URI using the default * character encoding UTF-8 * * @param uri * @return */ public static List<Map<String, String>> parseJson(URI uri) { return parseJson(uri, "UTF-8"); } /** * Parse the JSON content at the given URI using the specified * character encoding * * @param uri * @return */ public static List<Map<String, String>> parseJson(URI uri, String encoding) { List<Map<String, String>> flatJson = null; String json = ""; try { json = IOUtils.toString(uri, encoding); flatJson = parseJson(json); } catch (IOException e) { LOGGER.error("JsonFlattener#ParseJson(uri, encoding) IOException: ", e); } catch (Exception ex) { LOGGER.error("JsonFlattener#ParseJson(uri, encoding) Exception: ", ex); } return flatJson; } /** * Parse the JSON file using the default character encoding UTF-8 * * @param file * @return */ public static List<Map<String, String>> parseJson(File file) { return parseJson(file, "UTF-8"); } /** * Parse the JSON file using the specified character encoding * * @param file * @return */ public static List<Map<String, String>> parseJson(File file, String encoding) { List<Map<String, String>> flatJson = null; String json = ""; try { json = FileUtils.readFileToString(file, encoding); flatJson = parseJson(json); } catch (IOException e) { LOGGER.error("JsonFlattener#ParseJson(file, encoding) IOException: ", e); } catch (Exception ex) { LOGGER.error("JsonFlattener#ParseJson(file, encoding) Exception: ", ex); } return flatJson; } /** * Parse the JSON String * * @param json * @return * @throws Exception */ public static List<Map<String, String>> parseJson(String json) { List<Map<String, String>> flatJson = null; try { JSONObject jsonObject = new JSONObject(json); flatJson = new ArrayList<Map<String, String>>(); flatJson.add(parse(jsonObject)); } catch (JSONException je) { LOGGER.info("Handle the JSON String as JSON Array"); flatJson = handleAsArray(json); } return flatJson; } /** * Parse a JSON Object * * @param jsonObject * @return */ public static Map<String, String> parse(JSONObject jsonObject) { Map<String, String> flatJson = new LinkedHashMap<String, String>(); flatten(jsonObject, flatJson, ""); return flatJson; } /** * Parse a JSON Array * * @param jsonArray * @return */ public static List<Map<String, String>> parse(JSONArray jsonArray) { JSONObject jsonObject = null; List<Map<String, String>> flatJson = new ArrayList<Map<String, String>>(); int length = jsonArray.length(); for (int i = 0; i < length; i++) { jsonObject = jsonArray.getJSONObject(i); Map<String, String> stringMap = parse(jsonObject); flatJson.add(stringMap); } return flatJson; } /** * Handle the JSON String as Array * * @param json * @return * @throws Exception */ private static List<Map<String, String>> handleAsArray(String json) { List<Map<String, String>> flatJson = null; try { JSONArray jsonArray = new JSONArray(json); flatJson = parse(jsonArray); } catch (Exception e) { // throw new Exception("Json might be malformed"); LOGGER.error("JSON might be malformed, Please verify that your JSON is valid"); } return flatJson; } /** * Flatten the given JSON Object * * This method will convert the JSON object to a Map of * String keys and values * * @param obj * @param flatJson * @param prefix */ private static void flatten(JSONObject obj, Map<String, String> flatJson, String prefix) { Iterator<?> iterator = obj.keys(); String _prefix = prefix != "" ? prefix + "." : ""; while (iterator.hasNext()) { String key = iterator.next().toString(); if (obj.get(key).getClass() == JSON_OBJECT) { JSONObject jsonObject = (JSONObject) obj.get(key); flatten(jsonObject, flatJson, _prefix + key); } else if (obj.get(key).getClass() == JSON_ARRAY) { JSONArray jsonArray = (JSONArray) obj.get(key); if (jsonArray.length() < 1) { continue; } flatten(jsonArray, flatJson, _prefix + key); } else { String value = obj.get(key).toString(); if (value != null && !value.equals("null")) { flatJson.put(_prefix + key, value); } } } } /** * Flatten the given JSON Array * * @param obj * @param flatJson * @param prefix */ private static void flatten(JSONArray obj, Map<String, String> flatJson, String prefix) { int length = obj.length(); for (int i = 0; i < length; i++) { if (obj.get(i).getClass() == JSON_ARRAY) { JSONArray jsonArray = (JSONArray) obj.get(i); // jsonArray is empty if (jsonArray.length() < 1) { continue; } flatten(jsonArray, flatJson, prefix + "[" + i + "]"); } else if (obj.get(i).getClass() == JSON_OBJECT) { JSONObject jsonObject = (JSONObject) obj.get(i); flatten(jsonObject, flatJson, prefix + "[" + (i + 1) + "]"); } else { String value = obj.get(i).toString(); if (value != null) { flatJson.put(prefix + "[" + (i + 1) + "]", value); } } } } }