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
7658e0027a774a3a4cdf3aaea356dd22379c9bce
53ec3bbb9135a1942026d9cf7f4aae5ab27811de
/src/com/base/engine/BasicShader.java
92dc8418682cc78656eb5d0304c971a19325631a
[]
no_license
pnientiedt/wolfenstein-3d-clone
a15694acb1be50df8839ff5a327a1dc128e97c20
572e5598a82957c073de0c6910f38cd9fa2bda4f
refs/heads/master
2021-04-12T01:05:55.937322
2014-04-07T17:11:15
2014-04-07T17:11:15
249,072,577
0
0
null
null
null
null
UTF-8
Java
false
false
840
java
package com.base.engine; public class BasicShader extends Shader { private static BasicShader instance; private BasicShader() { super(); addVertexShaderFromFile("basicVertex.glsl"); addFragmentShaderFromFile("basicFragment.glsl"); compileShader(); addUniform("transform"); addUniform("color"); } public static BasicShader getInstance() { if (instance == null) { synchronized (BasicShader.class) { instance = new BasicShader(); } } return instance; } @Override public void updateUniforms(Matrix4f worldMatrix, Matrix4f projectedMatrix, Material material) { if (material.getTexture() != null) material.getTexture().bind(); else RenderUtil.unbindTextures(); setUniform("transform", projectedMatrix); setUniform("color", material.getColor()); } }
a34f36a8848d3d8bf46faadb63dab93a6f7e512d
cd84d3b09daca9cc55d6ebf8d77ceef798bb008a
/app/src/main/java/finder/flight/gr/flightfinderv02/FlightData.java
a66bf1a6311cc96e9169971699aa3496085ee29a
[]
no_license
Aggelonias/Flight-Finder
f6fbc1cc82c9b69439f23dcc46e1832800cd0da8
30cdcf432fe043e5cd0f745ef74a81bd450dc505
refs/heads/master
2020-07-25T13:42:47.131081
2019-09-13T17:52:19
2019-09-13T17:52:19
208,309,979
0
1
null
null
null
null
UTF-8
Java
false
false
2,450
java
package finder.flight.gr.flightfinderv02; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.AnimationDrawable; import android.os.AsyncTask; import java.util.ArrayList; public class FlightData { // Found airports public static ArrayList<String> from_airport_code = new ArrayList<String>(); public static ArrayList<String> from_airport_label = new ArrayList<String>(); public static ArrayList<String> to_airport_code = new ArrayList<String>(); public static ArrayList<String> to_airport_label = new ArrayList<String>(); // Initial Data public static String DEPART_DATE; public static String RETURN_DATE; public static String FROM; public static String TO; public static String CURRENCY = "EUR€"; public static String NOR; public static boolean CELSIUS; // Searching Animation public static AnimationDrawable animation; public static boolean animation_loaded; // Final Flight Results public static ArrayList<Flight> flights; // Final Weather Results public static Weather weather_origin; public static Weather weather_dest; //Found Airlines public static ArrayList<String> codes = new ArrayList<String>(); public static ArrayList<String> airlines = new ArrayList<String>(); // Details public static ArrayList<Detail> details_depart; public static ArrayList<Detail> details_return; // Current Flight public static int position; public static int index; public static void restart() { // This class from_airport_code = new ArrayList<String>(); from_airport_label = new ArrayList<String>(); to_airport_code = new ArrayList<String>(); to_airport_label = new ArrayList<String>(); DEPART_DATE = new String(); RETURN_DATE = new String(); FROM = new String(); TO = new String(); weather_origin = null; weather_dest = null; codes = new ArrayList<String>(); airlines = new ArrayList<String>(); // FetchFlights FetchFlights.weather_origin = false; FetchFlights.weather_dest = false; FetchFlights.shouldCalcWeather1 = -1; FetchFlights.shouldCalcWeather2 = -1; FetchFlights.airportsFound = 0; FetchFlights.resultsFound = 0; FetchFlights.wrong = false; // Other Other.restart(); } }
ad0c9faca6d08b364d0efb958764c8449b53406f
28369068a49bc686a29e6c9023c9b5700d629c50
/src/main/java/org/yeffrey/cheesecake/features/course/create/CreateCourseController.java
2b7ba44c54b428ca68f108ce69de64ec4942863f
[]
no_license
YeFFreY/cheesecake-api
747cfcdc0efba423a20086144c5bf2559ceb84a8
078f84b6380766114dbe86fd3889ce71d061d86f
refs/heads/main
2021-12-02T17:05:54.105487
2021-11-29T17:02:10
2021-11-29T17:02:10
216,364,812
0
0
null
2020-09-10T16:28:03
2019-10-20T13:17:31
PHP
UTF-8
Java
false
false
896
java
package org.yeffrey.cheesecake.features.course.create; import io.micronaut.http.HttpStatus; import io.micronaut.http.annotation.Body; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Post; import io.micronaut.http.annotation.Status; import io.micronaut.validation.Validated; import org.yeffrey.cheesecake.core.infra.rest.CommandResult; import javax.validation.Valid; import java.util.Optional; import java.util.UUID; @Validated @Controller("/api/courses") public class CreateCourseController { private final CreateCourseService service; public CreateCourseController(CreateCourseService service) { this.service = service; } @Post @Status(HttpStatus.CREATED) public Optional<CommandResult<UUID>> createClass(@Valid @Body CreateCourseCommand command) { return service.create(command).map(CommandResult::new); } }
617397cf1baffb05d2e35eaed0daf0ec547c6e51
a6d227fec6b98943f2d1fa1c375c7ff25499160e
/src/main/java/br/com/timbrasil/operations/daos/CityDao.java
5406b3674b515f6201f222c15b97fdba4a14c71f
[]
no_license
timbrasil/work-order
33e804333fc81d86dac06f0debd0302e03f827bd
9fb6b09745013fdf8e9e038a9e876febc1f3ba46
refs/heads/master
2021-01-22T21:03:36.995899
2015-11-04T23:20:13
2015-11-04T23:20:13
41,934,038
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package br.com.timbrasil.operations.daos; import br.com.timbrasil.operations.models.City; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.TypedQuery; import java.util.List; @RequestScoped public class CityDao { private EntityManager manager; @Inject public CityDao(EntityManager manager) { this.manager = manager; } /** * CDI */ @Deprecated public CityDao() { this(null); } public City find(City city){ return manager.find(City.class,city.getId()); } public List<City> list(){ String jpql = "select c from City as c"; TypedQuery<City> typedQuery = manager.createQuery(jpql,City.class); try{ return typedQuery.getResultList(); } catch (NoResultException nre){ return null; } } }
92745c49d4784193568df01ff43e63e5d77252c0
6abf3ee544e574b835286d4e4a9c072f254babac
/EJERCICIOS/JAIME_PALAZON/src/ejercicio29.04/Prueba5.java
6178a448a7936f238aa45469eecbe6b14529995a
[]
no_license
gsegovia69/BecaJava_2019
089143fb6292be695bfa81668d7b5ce4bac860a6
038c8718624823794319f4e3191c1ea0a7a8f615
refs/heads/develop
2023-04-14T00:27:11.594563
2020-10-14T09:13:45
2020-10-14T09:13:45
183,160,387
0
0
null
2023-04-04T00:23:59
2019-04-24T06:13:55
PHP
UTF-8
Java
false
false
1,247
java
package jaimepalazon; public class Prueba5 { private String nombre; private String apellidos; private String email; private String ciudad; public Prueba5() { } public Prueba5(String nombre) { this.nombre = nombre; } public Prueba5(String nombre, String apellidos) { this.nombre = nombre; this.apellidos = apellidos; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellidos() { return apellidos; } public void setApellidos(String apellidos) { this.apellidos = apellidos; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCiudad() { return ciudad; } public void setCiudad(String ciudad) { this.ciudad = ciudad; } public String allString () { return nombre + " " + apellidos + "//////// " + email + "////// " + ciudad; } public String toString () { return nombre + " " + apellidos + "//////// " + email + "////// " + ciudad; } public String remolacha () { return nombre; } public int compareTo(Prueba5 list) { int result = list.getApellidos().compareTo(list.getApellidos()); return result; } }
[ "jpg9_1hotmail.com" ]
jpg9_1hotmail.com
61590b0aa683c2b0ced135abd4de9ca0b73906eb
2a5a28e4debf17b24b9aa9b21ca4f8e108eb0b0d
/app/src/main/java/com/example/earthquake/EathquakeAdapter.java
c83dbb31f0fb692d26bdb52be65c641234328679
[]
no_license
ibrahim-python/EarthQuake2
8898b066b60a40d448d1d7ff87031976e845a280
94ef39d5bc001910db0e4743ca88dd51f10b77db
refs/heads/master
2020-09-14T20:52:26.155128
2019-11-24T14:55:31
2019-11-24T14:55:31
223,251,310
1
0
null
null
null
null
UTF-8
Java
false
false
1,924
java
package com.example.earthquake; import android.content.Context; import android.support.annotation.NonNull; 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.earthquake.POJO.Feature; import java.util.List; public class EathquakeAdapter extends RecyclerView.Adapter<EathquakeAdapter.PropertyViewHolder> { private List<Feature> featureList; private Context context; public EathquakeAdapter(List<Feature> featureList, Context context) { this.featureList = featureList; this.context = context; } public void setFeatureList(List<Feature> featureList) { this.featureList = featureList; notifyDataSetChanged(); } @Override public PropertyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(context).inflate(R.layout.recycle_view,viewGroup,false); return new PropertyViewHolder(view); } @Override public void onBindViewHolder(PropertyViewHolder propertyViewHolder, int i) { String magnitude = String.valueOf(featureList.get(i).getProperties().getMag()); propertyViewHolder.place.setText(featureList.get(i).getProperties().getPlace()); propertyViewHolder.magnitudeView.setText(magnitude); } @Override public int getItemCount() { if(featureList != null){ return featureList.size(); } return 0; } class PropertyViewHolder extends RecyclerView.ViewHolder { TextView magnitudeView; TextView place; public PropertyViewHolder(View itemView) { super(itemView); place = (TextView) itemView.findViewById(R.id.place); magnitudeView = (TextView) itemView.findViewById(R.id.magnitude); } } }
8476d87a0c1783505f186b14f5e5aa27225ba795
b39d7e1122ebe92759e86421bbcd0ad009eed1db
/sources/android/net/wifi/rtt/ResponderLocation.java
7f899149c4581e906d2d08c942d5558d7d7820e8
[]
no_license
AndSource/miuiframework
ac7185dedbabd5f619a4f8fc39bfe634d101dcef
cd456214274c046663aefce4d282bea0151f1f89
refs/heads/master
2022-03-31T11:09:50.399520
2020-01-02T09:49:07
2020-01-02T09:49:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
37,499
java
package android.net.wifi.rtt; import android.annotation.SystemApi; import android.location.Address; import android.location.Location; import android.net.MacAddress; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import android.text.TextUtils; import android.util.SparseArray; import android.webkit.MimeTypeMap; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; public final class ResponderLocation implements Parcelable { public static final int ALTITUDE_FLOORS = 2; private static final int ALTITUDE_FRACTION_BITS = 8; public static final int ALTITUDE_METERS = 1; private static final int ALTITUDE_UNCERTAINTY_BASE = 21; public static final int ALTITUDE_UNDEFINED = 0; private static final int BYTES_IN_A_BSSID = 6; private static final int BYTE_MASK = 255; private static final int CIVIC_COUNTRY_CODE_INDEX = 0; private static final int CIVIC_TLV_LIST_INDEX = 2; public static final Creator<ResponderLocation> CREATOR = new Creator<ResponderLocation>() { public ResponderLocation createFromParcel(Parcel in) { return new ResponderLocation(in, null); } public ResponderLocation[] newArray(int size) { return new ResponderLocation[size]; } }; public static final int DATUM_NAD83_MLLW = 3; public static final int DATUM_NAD83_NAV88 = 2; public static final int DATUM_UNDEFINED = 0; public static final int DATUM_WGS84 = 1; private static final int LATLNG_FRACTION_BITS = 25; private static final int LATLNG_UNCERTAINTY_BASE = 8; private static final double LAT_ABS_LIMIT = 90.0d; public static final int LCI_VERSION_1 = 1; private static final byte[] LEAD_LCI_ELEMENT_BYTES = new byte[]{(byte) 1, (byte) 0, (byte) 8}; private static final byte[] LEAD_LCR_ELEMENT_BYTES = new byte[]{(byte) 1, (byte) 0, (byte) 11}; private static final double LNG_ABS_LIMIT = 180.0d; public static final int LOCATION_FIXED = 0; public static final int LOCATION_MOVEMENT_UNKNOWN = 2; private static final String LOCATION_PROVIDER = "WiFi Access Point"; public static final int LOCATION_RESERVED = 3; public static final int LOCATION_VARIABLE = 1; private static final int LSB_IN_BYTE = 1; private static final int MAP_TYPE_URL_DEFINED = 0; private static final int MAX_BUFFER_SIZE = 256; private static final byte MEASUREMENT_REPORT_MODE = (byte) 0; private static final byte MEASUREMENT_TOKEN_AUTONOMOUS = (byte) 1; private static final byte MEASUREMENT_TYPE_LCI = (byte) 8; private static final byte MEASUREMENT_TYPE_LCR = (byte) 11; private static final int MIN_BUFFER_SIZE = 3; private static final int MSB_IN_BYTE = 128; private static final byte SUBELEMENT_BSSID_LIST = (byte) 7; private static final int SUBELEMENT_BSSID_LIST_INDEX = 1; private static final int SUBELEMENT_BSSID_LIST_MIN_BUFFER_LENGTH = 1; private static final int SUBELEMENT_BSSID_MAX_INDICATOR_INDEX = 0; private static final int SUBELEMENT_IMAGE_MAP_TYPE_INDEX = 0; private static final byte SUBELEMENT_LCI = (byte) 0; private static final int SUBELEMENT_LCI_ALT_INDEX = 6; private static final int SUBELEMENT_LCI_ALT_TYPE_INDEX = 4; private static final int SUBELEMENT_LCI_ALT_UNCERTAINTY_INDEX = 5; private static final int[] SUBELEMENT_LCI_BIT_FIELD_LENGTHS = new int[]{6, 34, 6, 34, 4, 6, 30, 3, 1, 1, 1, 2}; private static final int SUBELEMENT_LCI_DATUM_INDEX = 7; private static final int SUBELEMENT_LCI_DEPENDENT_STA_INDEX = 10; private static final int SUBELEMENT_LCI_LAT_INDEX = 1; private static final int SUBELEMENT_LCI_LAT_UNCERTAINTY_INDEX = 0; private static final int SUBELEMENT_LCI_LENGTH = 16; private static final int SUBELEMENT_LCI_LNG_INDEX = 3; private static final int SUBELEMENT_LCI_LNG_UNCERTAINTY_INDEX = 2; private static final int SUBELEMENT_LCI_REGLOC_AGREEMENT_INDEX = 8; private static final int SUBELEMENT_LCI_REGLOC_DSE_INDEX = 9; private static final int SUBELEMENT_LCI_VERSION_INDEX = 11; private static final byte SUBELEMENT_LOCATION_CIVIC = (byte) 0; private static final int SUBELEMENT_LOCATION_CIVIC_MAX_LENGTH = 256; private static final int SUBELEMENT_LOCATION_CIVIC_MIN_LENGTH = 2; private static final byte SUBELEMENT_MAP_IMAGE = (byte) 5; private static final int SUBELEMENT_MAP_IMAGE_URL_MAX_LENGTH = 256; private static final byte SUBELEMENT_USAGE = (byte) 6; private static final int SUBELEMENT_USAGE_LENGTH1 = 1; private static final int SUBELEMENT_USAGE_LENGTH3 = 3; private static final int SUBELEMENT_USAGE_MASK_RETENTION_EXPIRES = 2; private static final int SUBELEMENT_USAGE_MASK_RETRANSMIT = 1; private static final int SUBELEMENT_USAGE_MASK_STA_LOCATION_POLICY = 4; private static final int SUBELEMENT_USAGE_PARAMS_INDEX = 0; private static final byte SUBELEMENT_Z = (byte) 4; private static final int[] SUBELEMENT_Z_BIT_FIELD_LENGTHS = new int[]{2, 14, 24, 8}; private static final int SUBELEMENT_Z_FLOOR_NUMBER_INDEX = 1; private static final int SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_INDEX = 2; private static final int SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_UNCERTAINTY_INDEX = 3; private static final int SUBELEMENT_Z_LAT_EXPECTED_TO_MOVE_INDEX = 0; private static final int SUBELEMENT_Z_LENGTH = 6; private static final String[] SUPPORTED_IMAGE_FILE_EXTENSIONS = new String[]{"", "png", "gif", "jpg", "svg", "dxf", "dwg", "dwf", "cad", "tif", "gml", "kml", "bmp", "pgm", "ppm", "xbm", "xpm", "ico"}; private static final int UNCERTAINTY_UNDEFINED = 0; private static final int Z_FLOOR_HEIGHT_FRACTION_BITS = 12; private static final int Z_FLOOR_NUMBER_FRACTION_BITS = 4; private static final int Z_MAX_HEIGHT_UNCERTAINTY_FACTOR = 25; private double mAltitude; private int mAltitudeType; private double mAltitudeUncertainty; private ArrayList<MacAddress> mBssidList; private CivicLocation mCivicLocation; private String mCivicLocationCountryCode; private String mCivicLocationString; private int mDatum; private int mExpectedToMove; private double mFloorNumber; private double mHeightAboveFloorMeters; private double mHeightAboveFloorUncertaintyMeters; private boolean mIsBssidListValid; private boolean mIsLciValid; private boolean mIsLocationCivicValid; private boolean mIsMapImageValid; private boolean mIsUsageValid; private final boolean mIsValid; private boolean mIsZValid; private double mLatitude; private double mLatitudeUncertainty; private boolean mLciDependentStation; private boolean mLciRegisteredLocationAgreement; private boolean mLciRegisteredLocationDse; private int mLciVersion; private double mLongitude; private double mLongitudeUncertainty; private int mMapImageType; private Uri mMapImageUri; private boolean mUsageExtraInfoOnAssociation; private boolean mUsageRetentionExpires; private boolean mUsageRetransmit; @Retention(RetentionPolicy.SOURCE) public @interface AltitudeType { } @Retention(RetentionPolicy.SOURCE) public @interface DatumType { } @Retention(RetentionPolicy.SOURCE) public @interface ExpectedToMoveType { } public ResponderLocation(byte[] lciBuffer, byte[] lcrBuffer) { int length; byte[] bArr; boolean z = false; this.mIsLciValid = false; this.mIsZValid = false; this.mIsUsageValid = true; this.mIsBssidListValid = false; this.mIsLocationCivicValid = false; this.mIsMapImageValid = false; boolean isLciIeValid = false; boolean isLcrIeValid = false; setLciSubelementDefaults(); setZaxisSubelementDefaults(); setUsageSubelementDefaults(); setBssidListSubelementDefaults(); setCivicLocationSubelementDefaults(); setMapImageSubelementDefaults(); if (lciBuffer != null) { length = lciBuffer.length; bArr = LEAD_LCI_ELEMENT_BYTES; if (length > bArr.length) { isLciIeValid = parseInformationElementBuffer(8, lciBuffer, bArr); } } if (lcrBuffer != null) { length = lcrBuffer.length; bArr = LEAD_LCR_ELEMENT_BYTES; if (length > bArr.length) { isLcrIeValid = parseInformationElementBuffer(11, lcrBuffer, bArr); } } boolean isLciValid = isLciIeValid && this.mIsUsageValid && (this.mIsLciValid || this.mIsZValid || this.mIsBssidListValid); boolean isLcrValid = isLcrIeValid && this.mIsUsageValid && (this.mIsLocationCivicValid || this.mIsMapImageValid); if (isLciValid || isLcrValid) { z = true; } this.mIsValid = z; if (!this.mIsValid) { setLciSubelementDefaults(); setZaxisSubelementDefaults(); setCivicLocationSubelementDefaults(); setMapImageSubelementDefaults(); } } private ResponderLocation(Parcel in) { boolean z = false; this.mIsLciValid = false; this.mIsZValid = false; this.mIsUsageValid = true; this.mIsBssidListValid = false; this.mIsLocationCivicValid = false; this.mIsMapImageValid = false; this.mIsValid = in.readByte() != (byte) 0; this.mIsLciValid = in.readByte() != (byte) 0; this.mIsZValid = in.readByte() != (byte) 0; this.mIsUsageValid = in.readByte() != (byte) 0; this.mIsBssidListValid = in.readByte() != (byte) 0; this.mIsLocationCivicValid = in.readByte() != (byte) 0; this.mIsMapImageValid = in.readByte() != (byte) 0; this.mLatitudeUncertainty = in.readDouble(); this.mLatitude = in.readDouble(); this.mLongitudeUncertainty = in.readDouble(); this.mLongitude = in.readDouble(); this.mAltitudeType = in.readInt(); this.mAltitudeUncertainty = in.readDouble(); this.mAltitude = in.readDouble(); this.mDatum = in.readInt(); this.mLciRegisteredLocationAgreement = in.readByte() != (byte) 0; this.mLciRegisteredLocationDse = in.readByte() != (byte) 0; this.mLciDependentStation = in.readByte() != (byte) 0; this.mLciVersion = in.readInt(); this.mExpectedToMove = in.readInt(); this.mFloorNumber = in.readDouble(); this.mHeightAboveFloorMeters = in.readDouble(); this.mHeightAboveFloorUncertaintyMeters = in.readDouble(); this.mUsageRetransmit = in.readByte() != (byte) 0; this.mUsageRetentionExpires = in.readByte() != (byte) 0; if (in.readByte() != (byte) 0) { z = true; } this.mUsageExtraInfoOnAssociation = z; this.mBssidList = in.readArrayList(MacAddress.class.getClassLoader()); this.mCivicLocationCountryCode = in.readString(); this.mCivicLocationString = in.readString(); this.mCivicLocation = (CivicLocation) in.readParcelable(getClass().getClassLoader()); this.mMapImageType = in.readInt(); String urlString = in.readString(); if (TextUtils.isEmpty(urlString)) { this.mMapImageUri = null; } else { this.mMapImageUri = Uri.parse(urlString); } } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int flags) { parcel.writeByte((byte) this.mIsValid); parcel.writeByte((byte) this.mIsLciValid); parcel.writeByte((byte) this.mIsZValid); parcel.writeByte((byte) this.mIsUsageValid); parcel.writeByte((byte) this.mIsBssidListValid); parcel.writeByte((byte) this.mIsLocationCivicValid); parcel.writeByte((byte) this.mIsMapImageValid); parcel.writeDouble(this.mLatitudeUncertainty); parcel.writeDouble(this.mLatitude); parcel.writeDouble(this.mLongitudeUncertainty); parcel.writeDouble(this.mLongitude); parcel.writeInt(this.mAltitudeType); parcel.writeDouble(this.mAltitudeUncertainty); parcel.writeDouble(this.mAltitude); parcel.writeInt(this.mDatum); parcel.writeByte((byte) this.mLciRegisteredLocationAgreement); parcel.writeByte((byte) this.mLciRegisteredLocationDse); parcel.writeByte((byte) this.mLciDependentStation); parcel.writeInt(this.mLciVersion); parcel.writeInt(this.mExpectedToMove); parcel.writeDouble(this.mFloorNumber); parcel.writeDouble(this.mHeightAboveFloorMeters); parcel.writeDouble(this.mHeightAboveFloorUncertaintyMeters); parcel.writeByte((byte) this.mUsageRetransmit); parcel.writeByte((byte) this.mUsageRetentionExpires); parcel.writeByte((byte) this.mUsageExtraInfoOnAssociation); parcel.writeList(this.mBssidList); parcel.writeString(this.mCivicLocationCountryCode); parcel.writeString(this.mCivicLocationString); parcel.writeParcelable(this.mCivicLocation, flags); parcel.writeInt(this.mMapImageType); Uri uri = this.mMapImageUri; if (uri != null) { parcel.writeString(uri.toString()); } else { parcel.writeString(""); } } /* JADX WARNING: Missing block: B:48:0x00a5, code skipped: return false; */ private boolean parseInformationElementBuffer(int r10, byte[] r11, byte[] r12) { /* r9 = this; r0 = 0; r1 = r11.length; r2 = 0; r3 = 3; if (r1 < r3) goto L_0x00a5; L_0x0006: r3 = 256; // 0x100 float:3.59E-43 double:1.265E-321; if (r1 <= r3) goto L_0x000c; L_0x000a: goto L_0x00a5; L_0x000c: r3 = r12.length; r3 = java.util.Arrays.copyOfRange(r11, r0, r3); r4 = java.util.Arrays.equals(r3, r12); if (r4 != 0) goto L_0x0018; L_0x0017: return r2; L_0x0018: r4 = r12.length; r0 = r0 + r4; L_0x001a: r4 = r0 + 1; r5 = 1; if (r4 >= r1) goto L_0x00a4; L_0x001f: r4 = r0 + 1; r0 = r11[r0]; r6 = r4 + 1; r4 = r11[r4]; r7 = r6 + r4; if (r7 > r1) goto L_0x00a3; L_0x002b: if (r4 > 0) goto L_0x002f; L_0x002d: goto L_0x00a3; L_0x002f: r7 = r6 + r4; r7 = java.util.Arrays.copyOfRange(r11, r6, r7); r8 = 8; if (r10 != r8) goto L_0x007a; L_0x0039: if (r0 == 0) goto L_0x0068; L_0x003b: r5 = 4; if (r0 == r5) goto L_0x005a; L_0x003e: r5 = 6; if (r0 == r5) goto L_0x0053; L_0x0041: r5 = 7; if (r0 == r5) goto L_0x0045; L_0x0044: goto L_0x009f; L_0x0045: r5 = r9.parseSubelementBssidList(r7); r9.mIsBssidListValid = r5; r5 = r9.mIsBssidListValid; if (r5 != 0) goto L_0x009f; L_0x004f: r9.setBssidListSubelementDefaults(); goto L_0x009f; L_0x0053: r5 = r9.parseSubelementUsage(r7); r9.mIsUsageValid = r5; goto L_0x009f; L_0x005a: r5 = r9.parseSubelementZ(r7); r9.mIsZValid = r5; r5 = r9.mIsZValid; if (r5 != 0) goto L_0x009f; L_0x0064: r9.setZaxisSubelementDefaults(); goto L_0x009f; L_0x0068: r8 = r9.parseSubelementLci(r7); r9.mIsLciValid = r8; r8 = r9.mIsLciValid; if (r8 == 0) goto L_0x0076; L_0x0072: r8 = r9.mLciVersion; if (r8 == r5) goto L_0x009f; L_0x0076: r9.setLciSubelementDefaults(); goto L_0x009f; L_0x007a: r5 = 11; if (r10 != r5) goto L_0x009f; L_0x007e: if (r0 == 0) goto L_0x0092; L_0x0080: r5 = 5; if (r0 == r5) goto L_0x0084; L_0x0083: goto L_0x009f; L_0x0084: r5 = r9.parseSubelementMapImage(r7); r9.mIsMapImageValid = r5; r5 = r9.mIsMapImageValid; if (r5 != 0) goto L_0x009f; L_0x008e: r9.setMapImageSubelementDefaults(); goto L_0x009f; L_0x0092: r5 = r9.parseSubelementLocationCivic(r7); r9.mIsLocationCivicValid = r5; r5 = r9.mIsLocationCivicValid; if (r5 != 0) goto L_0x009f; L_0x009c: r9.setCivicLocationSubelementDefaults(); L_0x009f: r0 = r6 + r4; goto L_0x001a; L_0x00a3: return r2; L_0x00a4: return r5; L_0x00a5: return r2; */ throw new UnsupportedOperationException("Method not decompiled: android.net.wifi.rtt.ResponderLocation.parseInformationElementBuffer(int, byte[], byte[]):boolean"); } private boolean parseSubelementLci(byte[] buffer) { boolean z = false; if (buffer.length > 16) { return false; } swapEndianByteByByte(buffer); long[] subelementLciFields = getFieldData(buffer, SUBELEMENT_LCI_BIT_FIELD_LENGTHS); if (subelementLciFields == null) { return false; } this.mLatitudeUncertainty = decodeLciLatLngUncertainty(subelementLciFields[0]); this.mLatitude = decodeLciLatLng(subelementLciFields, SUBELEMENT_LCI_BIT_FIELD_LENGTHS, 1, LAT_ABS_LIMIT); this.mLongitudeUncertainty = decodeLciLatLngUncertainty(subelementLciFields[2]); this.mLongitude = decodeLciLatLng(subelementLciFields, SUBELEMENT_LCI_BIT_FIELD_LENGTHS, 3, LNG_ABS_LIMIT); this.mAltitudeType = ((int) subelementLciFields[4]) & 255; this.mAltitudeUncertainty = decodeLciAltUncertainty(subelementLciFields[5]); this.mAltitude = (double) Math.scalb((float) subelementLciFields[6], -8); this.mDatum = ((int) subelementLciFields[7]) & 255; this.mLciRegisteredLocationAgreement = subelementLciFields[8] == 1; this.mLciRegisteredLocationDse = subelementLciFields[9] == 1; if (subelementLciFields[10] == 1) { z = true; } this.mLciDependentStation = z; this.mLciVersion = (int) subelementLciFields[11]; return true; } private double decodeLciLatLng(long[] fields, int[] bitFieldSizes, int offset, double limit) { double angle; if ((fields[offset] & ((long) Math.pow(2.0d, (double) (bitFieldSizes[offset] - 1)))) != 0) { angle = Math.scalb(((double) fields[offset]) - Math.pow(2.0d, (double) bitFieldSizes[offset]), -25); } else { angle = (double) Math.scalb((float) fields[offset], -25); } if (angle > limit) { return limit; } if (angle < (-limit)) { return -limit; } return angle; } private double decodeLciLatLngUncertainty(long encodedValue) { return Math.pow(2.0d, (double) (8 - encodedValue)); } private double decodeLciAltUncertainty(long encodedValue) { return Math.pow(2.0d, (double) (21 - encodedValue)); } private boolean parseSubelementZ(byte[] buffer) { if (buffer.length != 6) { return false; } swapEndianByteByByte(buffer); long[] subelementZFields = getFieldData(buffer, SUBELEMENT_Z_BIT_FIELD_LENGTHS); if (subelementZFields == null) { return false; } this.mExpectedToMove = ((int) subelementZFields[0]) & 255; this.mFloorNumber = decodeZUnsignedToSignedValue(subelementZFields, SUBELEMENT_Z_BIT_FIELD_LENGTHS, 1, 4); this.mHeightAboveFloorMeters = decodeZUnsignedToSignedValue(subelementZFields, SUBELEMENT_Z_BIT_FIELD_LENGTHS, 2, 12); long zHeightUncertainty = subelementZFields[3]; if (zHeightUncertainty <= 0 || zHeightUncertainty >= 25) { return false; } this.mHeightAboveFloorUncertaintyMeters = Math.pow(2.0d, (double) ((12 - zHeightUncertainty) - 1)); return true; } private double decodeZUnsignedToSignedValue(long[] fieldValues, int[] fieldLengths, int index, int fraction) { int value = (int) fieldValues[index]; if (value > ((int) Math.pow(2.0d, (double) (fieldLengths[index] - 1))) - 1) { value = (int) (((double) value) - Math.pow(2.0d, (double) fieldLengths[index])); } return (double) Math.scalb((float) value, -fraction); } private boolean parseSubelementUsage(byte[] buffer) { boolean z = true; if (buffer.length != 1 && buffer.length != 3) { return false; } this.mUsageRetransmit = (buffer[0] & 1) != 0; this.mUsageRetentionExpires = (buffer[0] & 2) != 0; this.mUsageExtraInfoOnAssociation = (buffer[0] & 4) != 0; if (!this.mUsageRetransmit || this.mUsageRetentionExpires) { z = false; } return z; } private boolean parseSubelementBssidList(byte[] buffer) { if (buffer.length < 1 || (buffer.length - 1) % 6 != 0) { return false; } int bssidListLength = (buffer.length - 1) / 6; if ((buffer[0] & 255) != bssidListLength) { return false; } int bssidOffset = 1; for (int i = 0; i < bssidListLength; i++) { this.mBssidList.add(MacAddress.fromBytes(Arrays.copyOfRange(buffer, bssidOffset, bssidOffset + 6))); bssidOffset += 6; } return true; } private boolean parseSubelementLocationCivic(byte[] buffer) { if (buffer.length < 2 || buffer.length > 256) { return false; } this.mCivicLocationCountryCode = new String(Arrays.copyOfRange(buffer, 0, 2)).toUpperCase(); CivicLocation civicLocation = new CivicLocation(Arrays.copyOfRange(buffer, 2, buffer.length), this.mCivicLocationCountryCode); if (!civicLocation.isValid()) { return false; } this.mCivicLocation = civicLocation; this.mCivicLocationString = civicLocation.toString(); return true; } private boolean parseSubelementMapImage(byte[] buffer) { if (buffer.length > 256) { return false; } int mapImageType = buffer[0]; int supportedTypesMax = SUPPORTED_IMAGE_FILE_EXTENSIONS.length - 1; if (mapImageType < 0 || mapImageType > supportedTypesMax) { return false; } this.mMapImageType = mapImageType; this.mMapImageUri = Uri.parse(new String(Arrays.copyOfRange(buffer, 1, buffer.length), StandardCharsets.UTF_8)); return true; } private String imageTypeToMime(int imageTypeCode, String imageUrl) { int supportedExtensionsMax = SUPPORTED_IMAGE_FILE_EXTENSIONS.length - 1; if ((imageTypeCode == 0 && imageUrl == null) || imageTypeCode > supportedExtensionsMax) { return null; } MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); if (imageTypeCode == 0) { return mimeTypeMap.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(imageUrl)); } return mimeTypeMap.getMimeTypeFromExtension(SUPPORTED_IMAGE_FILE_EXTENSIONS[imageTypeCode]); } private long[] getFieldData(byte[] buffer, int[] bitFieldSizes) { int i; int i2; int bufferLengthBits = buffer.length * 8; int sumBitFieldSizes = 0; for (int i22 : bitFieldSizes) { if (i22 > 64) { return null; } sumBitFieldSizes += i22; } if (bufferLengthBits != sumBitFieldSizes) { return null; } long[] fieldData = new long[bitFieldSizes.length]; i = 0; for (int fieldIndex = 0; fieldIndex < bitFieldSizes.length; fieldIndex++) { i22 = bitFieldSizes[fieldIndex]; long field = 0; for (int n = 0; n < i22; n++) { field |= ((long) getBitAtBitOffsetInByteArray(buffer, i + n)) << n; } fieldData[fieldIndex] = field; i += i22; } return fieldData; } private int getBitAtBitOffsetInByteArray(byte[] buffer, int bufferBitOffset) { return (buffer[bufferBitOffset / 8] & (128 >> (bufferBitOffset % 8))) == 0 ? 0 : 1; } private void swapEndianByteByByte(byte[] buffer) { for (int n = 0; n < buffer.length; n++) { byte currentByte = buffer[n]; byte reversedByte = (byte) 0; byte bitSelectorMask = (byte) 1; for (int i = 0; i < 8; i++) { reversedByte = (byte) (reversedByte << 1); if ((currentByte & bitSelectorMask) != 0) { reversedByte = (byte) (reversedByte | 1); } bitSelectorMask = (byte) (bitSelectorMask << 1); } buffer[n] = reversedByte; } } private void setLciSubelementDefaults() { this.mIsLciValid = false; this.mLatitudeUncertainty = 0.0d; this.mLatitude = 0.0d; this.mLongitudeUncertainty = 0.0d; this.mLongitude = 0.0d; this.mAltitudeType = 0; this.mAltitudeUncertainty = 0.0d; this.mAltitude = 0.0d; this.mDatum = 0; this.mLciRegisteredLocationAgreement = false; this.mLciRegisteredLocationDse = false; this.mLciDependentStation = false; this.mLciVersion = 0; } private void setZaxisSubelementDefaults() { this.mIsZValid = false; this.mExpectedToMove = 0; this.mFloorNumber = 0.0d; this.mHeightAboveFloorMeters = 0.0d; this.mHeightAboveFloorUncertaintyMeters = 0.0d; } private void setUsageSubelementDefaults() { this.mUsageRetransmit = true; this.mUsageRetentionExpires = false; this.mUsageExtraInfoOnAssociation = false; } private void setBssidListSubelementDefaults() { this.mIsBssidListValid = false; this.mBssidList = new ArrayList(); } public void setCivicLocationSubelementDefaults() { this.mIsLocationCivicValid = false; String str = ""; this.mCivicLocationCountryCode = str; this.mCivicLocationString = str; this.mCivicLocation = null; } private void setMapImageSubelementDefaults() { this.mIsMapImageValid = false; this.mMapImageType = 0; this.mMapImageUri = null; } public boolean equals(Object obj) { boolean z = true; if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ResponderLocation other = (ResponderLocation) obj; if (!(this.mIsValid == other.mIsValid && this.mIsLciValid == other.mIsLciValid && this.mIsZValid == other.mIsZValid && this.mIsUsageValid == other.mIsUsageValid && this.mIsBssidListValid == other.mIsBssidListValid && this.mIsLocationCivicValid == other.mIsLocationCivicValid && this.mIsMapImageValid == other.mIsMapImageValid && this.mLatitudeUncertainty == other.mLatitudeUncertainty && this.mLatitude == other.mLatitude && this.mLongitudeUncertainty == other.mLongitudeUncertainty && this.mLongitude == other.mLongitude && this.mAltitudeType == other.mAltitudeType && this.mAltitudeUncertainty == other.mAltitudeUncertainty && this.mAltitude == other.mAltitude && this.mDatum == other.mDatum && this.mLciRegisteredLocationAgreement == other.mLciRegisteredLocationAgreement && this.mLciRegisteredLocationDse == other.mLciRegisteredLocationDse && this.mLciDependentStation == other.mLciDependentStation && this.mLciVersion == other.mLciVersion && this.mExpectedToMove == other.mExpectedToMove && this.mFloorNumber == other.mFloorNumber && this.mHeightAboveFloorMeters == other.mHeightAboveFloorMeters && this.mHeightAboveFloorUncertaintyMeters == other.mHeightAboveFloorUncertaintyMeters && this.mUsageRetransmit == other.mUsageRetransmit && this.mUsageRetentionExpires == other.mUsageRetentionExpires && this.mUsageExtraInfoOnAssociation == other.mUsageExtraInfoOnAssociation && this.mBssidList.equals(other.mBssidList) && this.mCivicLocationCountryCode.equals(other.mCivicLocationCountryCode) && this.mCivicLocationString.equals(other.mCivicLocationString) && Objects.equals(this.mCivicLocation, other.mCivicLocation) && this.mMapImageType == other.mMapImageType && Objects.equals(this.mMapImageUri, other.mMapImageUri))) { z = false; } return z; } public int hashCode() { return Objects.hash(new Object[]{Boolean.valueOf(this.mIsValid), Boolean.valueOf(this.mIsLciValid), Boolean.valueOf(this.mIsZValid), Boolean.valueOf(this.mIsUsageValid), Boolean.valueOf(this.mIsBssidListValid), Boolean.valueOf(this.mIsLocationCivicValid), Boolean.valueOf(this.mIsMapImageValid), Double.valueOf(this.mLatitudeUncertainty), Double.valueOf(this.mLatitude), Double.valueOf(this.mLongitudeUncertainty), Double.valueOf(this.mLongitude), Integer.valueOf(this.mAltitudeType), Double.valueOf(this.mAltitudeUncertainty), Double.valueOf(this.mAltitude), Integer.valueOf(this.mDatum), Boolean.valueOf(this.mLciRegisteredLocationAgreement), Boolean.valueOf(this.mLciRegisteredLocationDse), Boolean.valueOf(this.mLciDependentStation), Integer.valueOf(this.mLciVersion), Integer.valueOf(this.mExpectedToMove), Double.valueOf(this.mFloorNumber), Double.valueOf(this.mHeightAboveFloorMeters), Double.valueOf(this.mHeightAboveFloorUncertaintyMeters), Boolean.valueOf(this.mUsageRetransmit), Boolean.valueOf(this.mUsageRetentionExpires), Boolean.valueOf(this.mUsageExtraInfoOnAssociation), this.mBssidList, this.mCivicLocationCountryCode, this.mCivicLocationString, this.mCivicLocation, Integer.valueOf(this.mMapImageType), this.mMapImageUri}); } public boolean isValid() { return this.mIsValid; } public boolean isLciSubelementValid() { return this.mIsLciValid; } public double getLatitudeUncertainty() { if (this.mIsLciValid) { return this.mLatitudeUncertainty; } throw new IllegalStateException("getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false."); } public double getLatitude() { if (this.mIsLciValid) { return this.mLatitude; } throw new IllegalStateException("getLatitude(): invoked on an invalid result: mIsLciValid = false."); } public double getLongitudeUncertainty() { if (this.mIsLciValid) { return this.mLongitudeUncertainty; } throw new IllegalStateException("getLongitudeUncertainty(): invoked on an invalid result: mIsLciValid = false."); } public double getLongitude() { if (this.mIsLciValid) { return this.mLongitude; } throw new IllegalStateException("getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false."); } public int getAltitudeType() { if (this.mIsLciValid) { return this.mAltitudeType; } throw new IllegalStateException("getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false."); } public double getAltitudeUncertainty() { if (this.mIsLciValid) { return this.mAltitudeUncertainty; } throw new IllegalStateException("getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false."); } public double getAltitude() { if (this.mIsLciValid) { return this.mAltitude; } throw new IllegalStateException("getAltitude(): invoked on an invalid result: mIsLciValid = false."); } public int getDatum() { if (this.mIsLciValid) { return this.mDatum; } throw new IllegalStateException("getDatum(): invoked on an invalid result: mIsLciValid = false."); } public boolean getRegisteredLocationAgreementIndication() { if (this.mIsLciValid) { return this.mLciRegisteredLocationAgreement; } throw new IllegalStateException("getRegisteredLocationAgreementIndication(): invoked on an invalid result: mIsLciValid = false."); } public boolean getRegisteredLocationDseIndication() { if (this.mIsLciValid) { return this.mLciRegisteredLocationDse; } throw new IllegalStateException("getRegisteredLocationDseIndication(): invoked on an invalid result: mIsLciValid = false."); } public boolean getDependentStationIndication() { if (this.mIsLciValid) { return this.mLciDependentStation; } throw new IllegalStateException("getDependentStationIndication(): invoked on an invalid result: mIsLciValid = false."); } public int getLciVersion() { if (this.mIsLciValid) { return this.mLciVersion; } throw new IllegalStateException("getLciVersion(): invoked on an invalid result: mIsLciValid = false."); } public Location toLocation() { if (this.mIsLciValid) { Location location = new Location(LOCATION_PROVIDER); location.setLatitude(this.mLatitude); location.setLongitude(this.mLongitude); location.setAccuracy(((float) (this.mLatitudeUncertainty + this.mLongitudeUncertainty)) / 2.0f); location.setAltitude(this.mAltitude); location.setVerticalAccuracyMeters((float) this.mAltitudeUncertainty); location.setTime(System.currentTimeMillis()); return location; } throw new IllegalStateException("toLocation(): invoked on an invalid result: mIsLciValid = false."); } public boolean isZaxisSubelementValid() { return this.mIsZValid; } public int getExpectedToMove() { if (this.mIsZValid) { return this.mExpectedToMove; } throw new IllegalStateException("getExpectedToMove(): invoked on an invalid result: mIsZValid = false."); } public double getFloorNumber() { if (this.mIsZValid) { return this.mFloorNumber; } throw new IllegalStateException("getFloorNumber(): invoked on an invalid result: mIsZValid = false)"); } public double getHeightAboveFloorMeters() { if (this.mIsZValid) { return this.mHeightAboveFloorMeters; } throw new IllegalStateException("getHeightAboveFloorMeters(): invoked on an invalid result: mIsZValid = false)"); } public double getHeightAboveFloorUncertaintyMeters() { if (this.mIsZValid) { return this.mHeightAboveFloorUncertaintyMeters; } throw new IllegalStateException("getHeightAboveFloorUncertaintyMeters():invoked on an invalid result: mIsZValid = false)"); } public boolean getRetransmitPolicyIndication() { return this.mUsageRetransmit; } public boolean getRetentionExpiresIndication() { return this.mUsageRetentionExpires; } @SystemApi public boolean getExtraInfoOnAssociationIndication() { return this.mUsageExtraInfoOnAssociation; } public List<MacAddress> getColocatedBssids() { return Collections.unmodifiableList(this.mBssidList); } public Address toCivicLocationAddress() { CivicLocation civicLocation = this.mCivicLocation; if (civicLocation == null || !civicLocation.isValid()) { return null; } return this.mCivicLocation.toAddress(); } public SparseArray toCivicLocationSparseArray() { CivicLocation civicLocation = this.mCivicLocation; if (civicLocation == null || !civicLocation.isValid()) { return null; } return this.mCivicLocation.toSparseArray(); } public String getCivicLocationCountryCode() { return this.mCivicLocationCountryCode; } public String getCivicLocationElementValue(int key) { return this.mCivicLocation.getCivicElementValue(key); } public String getMapImageMimeType() { Uri uri = this.mMapImageUri; if (uri == null) { return null; } return imageTypeToMime(this.mMapImageType, uri.toString()); } public Uri getMapImageUri() { return this.mMapImageUri; } }
a8adfe5a176e9933353e0bfd3881934044863a97
c7c00a1353f81ddc27cc2b35b22ccdd5f6793a54
/src/main/java/com/phone/orders/core/EmailParam.java
7534cb026823cea57a5429530882dff3a6952d25
[]
no_license
NickHaski/Orders
5e171d4c9b9adab15e0c678a13703042074e0519
f5f6e760d3750b42715f9bf91fbac4c7007f214e
refs/heads/master
2020-03-22T23:57:19.090228
2018-09-13T13:35:31
2018-09-13T13:35:31
140,836,119
0
0
null
null
null
null
UTF-8
Java
false
false
1,138
java
package com.phone.orders.core; import org.apache.commons.lang3.StringUtils; import javax.validation.Constraint; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import javax.validation.Payload; import java.lang.annotation.*; @Documented @Constraint(validatedBy = EmailParam.EmailParamValidator.class) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) public @interface EmailParam { String EMAIL = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; String message() default "Email is invalid."; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; class EmailParamValidator implements ConstraintValidator<EmailParam, String> { @Override public void initialize(final EmailParam paramA) { //empty } @Override public boolean isValid(final String email, final ConstraintValidatorContext ctx) { return StringUtils.isNotEmpty(email) && email.matches(EMAIL); } } }
7f82e5216bccaf6eb89fb68a020756b8bb5b89a3
911fcfb2546280aca44d919b55738224e915b63a
/src/internet/lambda/SourceCode/u1/Operation.java
bb9343785eaa3197526c39e44f4d311b88cda3f6
[]
no_license
lyapandra/OCA_OCP
01b06eef3d2291bced40a614e7ec55e3b1097f0e
54dab90d4ea6d053bdfc7e3627b6e00236aec7b9
refs/heads/master
2020-03-08T20:11:02.988786
2018-07-03T11:45:23
2018-07-03T11:45:23
128,375,408
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package internet.lambda.SourceCode.u1; import javax.annotation.PostConstruct; public interface Operation { double getResult(double value1, double value2); } interface OperationNoParameters { double getResult(); } @FunctionalInterface interface OperationDouble { double getResult(double value1, double value2); } interface OperationInt { int getResult(double value1, double value2); }
39c3798c6d8e5e7913ff7b0f30c312ff12b18bd2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_a8a1f729ecd533fd9a87d36b89d77d88c258f82f/LibraryView/27_a8a1f729ecd533fd9a87d36b89d77d88c258f82f_LibraryView_t.java
ce5b9328275cca69c01dcfa4a6ac677afc52de81
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,282
java
package house.neko.media.common; import java.util.Observable; import java.util.Vector; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.commons.logging.Log; /** * * @author andy */ public class LibraryView extends Observable implements java.util.Observer { private MediaLibrary library; private LibrarySearchResult visibleMedia; private String[] columnHeaders = { }; private Class[] columnClasses = { }; private HierarchicalConfiguration config; private Log log = null; /** * * @param r */ public LibraryView(MediaLibrary m, HierarchicalConfiguration config) { this.log = ConfigurationManager.getLog(getClass()); this.config = config; this.library = m; // setup default columns String[] columns = this.config.getStringArray("Column"); if(columns == null || columns.length < 1) { columns = new String[2]; columns[0] = Media.ARTIST; columns[1] = Media.NAME; } else { for(int i = 0; i < columns.length; i++) { if(Media.NAME.equalsIgnoreCase(columns[i])) { columns[i] = Media.NAME; } else if(Media.ARTIST.equalsIgnoreCase(columns[i])) { columns[i] = Media.ARTIST; } else if(Media.ALBUM.equalsIgnoreCase(columns[i])) { columns[i] = Media.ALBUM; } if(log.isTraceEnabled()) { log.trace("Adding column " + columns[i] + " to view"); } } } setColumns(columns); clearFilter(); } public String[] getColumnHeaders() { return columnHeaders; } public Class[] getColumnClasses() { return columnClasses; } public void setColumns(String[] names) { if(names == null || names.length < 1) { return; } columnHeaders = new String[names.length]; columnClasses = new Class[names.length]; for(int i = 0; i < names.length; i++) { columnHeaders[i] = names[i]; columnClasses[i] = names[i].getClass(); } } public LibrarySearchResult getVisibleMedia() { synchronized(this) { if(log.isTraceEnabled()) { log.trace("getting visible results" + this.visibleMedia); } } return this.visibleMedia; } public void applySimpleFilter(String filter) { if(log.isDebugEnabled()) { log.debug("applySimpleFilter: " + filter); } Media[] list = library.getAllMedia(); Vector<Media> found = new Vector<Media>(list.length); for(Media m : list) { String s = m.getName(); if(s != null && s.toLowerCase().indexOf(filter) > -1) { found.add(m); continue; } s = m.getArtist(); if(s != null && s.toLowerCase().indexOf(filter) > -1) { found.add(m); continue; } s = m.getAlbum(); if(s != null && s.toLowerCase().indexOf(filter) > -1) { found.add(m); continue; } } synchronized(this) { this.visibleMedia = mapMediaToResult(found); } setChanged(); notifyObservers(); } private LibrarySearchResult mapMediaToResult(Vector<Media> found) { String[] cn = columnHeaders; Class[] ct = columnClasses; Object[][] o = new Object[found.size()][cn.length + 1]; for(int i = 0; i < o.length; i++) { Media m = found.elementAt(i); for(int j = 0;j < cn.length; j++) { if(cn[j] == Media.NAME) { o[i][j] = m.getName(); } else if(cn[j] == Media.ARTIST) { o[i][j] = m.getArtist(); } else if(cn[j] == Media.ALBUM) { o[i][j] = m.getAlbum(); } else { o[i][j] = "UNKNOWN"; } } o[i][cn.length] = m; } return new LibrarySearchResult(cn, ct, o, cn.length); } public void clearFilter() { if(log.isDebugEnabled()) { log.debug("clearFilter"); } Media[] list = library.getAllMedia(); Vector<Media> found = new Vector<Media>(list.length); for(Media m : list) { found.add(m); } synchronized(this) { this.visibleMedia = mapMediaToResult(found); } if(log.isDebugEnabled()) { log.debug("Clearing filter"); } setChanged(); notifyObservers(); } public void update(java.util.Observable o, Object arg) { if(log.isTraceEnabled()) { log.trace("Updated : " + o + " -> " + arg); } if(o.hasChanged()) { if(log.isTraceEnabled()) { log.trace("noticed change to " + o); } } setChanged(); notifyObservers(arg); } }
83dff5e3d0b00d9b29200c834aba5f4dfbc852fa
995f73d30450a6dce6bc7145d89344b4ad6e0622
/Mate20-9.0/src/main/java/com/huawei/pgmng/api/PGManager.java
43675628574c42c4df50064695a3f9a234000e66
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,225
java
package com.huawei.pgmng.api; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import com.huawei.pgmng.api.IPGManager; import java.util.ArrayList; import java.util.List; public class PGManager { private static final String TAG = "PGManager"; private static PGManager sInstance = null; private Context mContext; private IPGManager mService = IPGManager.Stub.asInterface(ServiceManager.getService("pgservice")); private PGManager(Context context) { this.mContext = context; } public static PGManager getInstance(Context context) { PGManager pGManager; synchronized (PGManager.class) { if (sInstance == null) { sInstance = new PGManager(context); } pGManager = sInstance; } return pGManager; } public long proxyBroadcast(List<String> pkgs, boolean proxy) { try { return this.mService.proxyBroadcast(pkgs, proxy); } catch (Exception e) { Log.w(TAG, "proxy broadcast failed", e); return -1; } } public long proxyBroadcastByPid(List<Integer> pids, boolean proxy) { List<String> spids = new ArrayList<>(); if (pids != null) { for (Integer pid : pids) { spids.add(pid.toString()); } } else { spids = null; } try { return this.mService.proxyBroadcastByPid(spids, proxy); } catch (Exception e) { Log.w(TAG, "proxy broadcast by pid failed", e); return -1; } } public void setProxyBCActions(List<String> actions) { try { this.mService.setProxyBCActions(actions); } catch (Exception e) { Log.w(TAG, "set proxy broadcast actions", e); } } public void setActionExcludePkg(String action, String pkg) { try { this.mService.setActionExcludePkg(action, pkg); } catch (Exception e) { Log.w(TAG, "set action exclude pkg", e); } } public void proxyBCConfig(int type, String key, List<String> value) { try { this.mService.proxyBCConfig(type, key, value); } catch (Exception e) { Log.w(TAG, "config proxy broadcast", e); } } public void proxyWakeLockByPidUid(int pid, int uid, boolean proxy) { try { this.mService.proxyWakeLockByPidUid(pid, uid, proxy); } catch (Exception e) { Log.w(TAG, "proxyWakeLockByPidUid Exception: ", e); } } public void forceReleaseWakeLockByPidUid(int pid, int uid) { try { this.mService.forceReleaseWakeLockByPidUid(pid, uid); } catch (Exception e) { Log.w(TAG, "forceReleaseWakeLockByPidUid Exception: ", e); } } public void forceRestoreWakeLockByPidUid(int pid, int uid) { try { this.mService.forceRestoreWakeLockByPidUid(pid, uid); } catch (Exception e) { Log.w(TAG, "forceRestoreWakeLockByPidUid Exception: ", e); } } public boolean getWakeLockByUid(int uid, int wakeflag) { try { if (this.mService != null) { return this.mService.getWakeLockByUid(uid, wakeflag); } return false; } catch (Exception ex) { Log.w(TAG, "getWakeLockByUid Exception: ", ex); return false; } } public void setLcdRatio(int ratio, boolean autoAdjust) { try { if (this.mService != null) { this.mService.setLcdRatio(ratio, autoAdjust); } } catch (Exception ex) { Log.w(TAG, "setLcdRatio Exception: ", ex); } } public boolean proxyApp(String pkg, int uid, boolean proxy) { try { return this.mService.proxyApp(pkg, uid, proxy); } catch (Exception e) { Log.w(TAG, "proxy app failed", e); return false; } } public void refreshPackageWhitelist(int type, List<String> pkgList) { try { this.mService.refreshPackageWhitelist(type, pkgList); } catch (Exception e) { Log.w(TAG, "refreshGpsWhitelist failed", e); } } public void configBrightnessRange(int ratioMin, int ratioMax, int autoLimit) { try { if (this.mService != null) { this.mService.configBrightnessRange(ratioMin, ratioMax, autoLimit); } } catch (Exception ex) { Log.w(TAG, "configBrightnessRange Exception: ", ex); } } public void getWlBatteryStats(List<String> list) { try { if (this.mService != null) { this.mService.getWlBatteryStats(list); } } catch (Exception ex) { Log.w(TAG, "getWlBatteryStats Exception: ", ex); } } public boolean setPgConfig(int type, int subType, List<String> value) { try { return this.mService.setPgConfig(type, subType, value); } catch (Exception e) { Log.w(TAG, "pg config failed", e); return false; } } public boolean closeSocketsForUid(int uid) { try { if (this.mService != null) { return this.mService.closeSocketsForUid(uid); } } catch (Exception ex) { Log.w(TAG, "closeSocketsForUid Exception: ", ex); } return false; } public void killProc(int pid) { try { if (this.mService != null) { this.mService.killProc(pid); } } catch (RemoteException ex) { Log.w(TAG, "killProc RemoteException: ", ex); } } public boolean setFirewallPidRule(int chain, int pid, int rule) { try { if (this.mService != null) { return this.mService.setFirewallPidRule(chain, pid, rule); } } catch (Exception ex) { Log.w(TAG, "setFirewallPidRule Exception: ", ex); } return false; } }
e445ca532fbbd9c004bbbc8c6cb1942f70878207
c9a1c0e7c9bf074417ff06a375ca397c3f32b8bb
/PokerNationService/src/test/java/com/pokernation/service/PokerNationServiceApplicationTests.java
1b9f4aa5f51104732e7649d7275f817aa0eaec52
[]
no_license
baskarf/springboot
5702077343456a2637ca44d766f6e1c59189be1f
0cef8e13a1f4f1310211436b6ce83f10ea4034d1
refs/heads/master
2021-07-21T23:29:23.952859
2017-10-31T19:31:05
2017-10-31T19:31:05
108,958,612
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.pokernation.service; 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 PokerNationServiceApplicationTests { @Test public void contextLoads() { } }
594409bc87db598bf8048b55b0cf0374b337ccf9
c7929226a0fa9ea78c7e5cbcb1a4f0b156349ecf
/src/main/java/com/github/mrzhqiang/maplestory/domain/DWzQuestActSkillData.java
dc476a39462d7491483f33a6c72534f9824c167e
[]
no_license
justddd/ms079
7a969099a7ee9680694968f67636a5f1d4235ee6
edcbd94d252f44fdd6c093246135d9f6cf920ad1
refs/heads/main
2023-08-19T22:22:36.721965
2021-09-18T02:52:28
2021-09-18T02:52:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
package com.github.mrzhqiang.maplestory.domain; import javax.persistence.*; @Entity @Table(name = "wz_questactskilldata") public class DWzQuestActSkillData { @Id @Column(name = "id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "skillid", nullable = false) private Integer skillid; @Column(name = "skillLevel", nullable = false) private Integer skillLevel; @Column(name = "masterLevel", nullable = false) private Integer masterLevel; @Column(name = "uniqueid", nullable = false) private Integer uniqueid; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } public void setSkillid(Integer skillid) { this.skillid = skillid; } public Integer getSkillid() { return skillid; } public void setSkillLevel(Integer skillLevel) { this.skillLevel = skillLevel; } public Integer getSkillLevel() { return skillLevel; } public void setMasterLevel(Integer masterLevel) { this.masterLevel = masterLevel; } public Integer getMasterLevel() { return masterLevel; } public void setUniqueid(Integer uniqueid) { this.uniqueid = uniqueid; } public Integer getUniqueid() { return uniqueid; } @Override public String toString() { return "DWzQuestActSkillData{" + "id=" + id + '\'' + "skillid=" + skillid + '\'' + "skillLevel=" + skillLevel + '\'' + "masterLevel=" + masterLevel + '\'' + "uniqueid=" + uniqueid + '\'' + '}'; } }
960a8a57929f309db267ee5da56673a1ff31480e
d78b2536d9a4afa8f906c87aebad21bc95abfd45
/src/main/java/com/grokonez/jwtauthentication/controller/ColisController.java
44d8b64d227c750862f2741a9444293d3b0211cf
[]
no_license
chourabi-dev/nithal-server
0ab80bdb0ae2bf17a1f7c5d0d7400d04cae51276
9f6b0b9707e548514e77e2cb2ab0b48f907b1af8
refs/heads/master
2023-08-17T06:31:37.643718
2021-09-15T21:57:22
2021-09-15T21:57:22
406,934,996
0
0
null
null
null
null
UTF-8
Java
false
false
6,308
java
package com.grokonez.jwtauthentication.controller; import java.sql.Date; import java.util.List; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.websocket.server.PathParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.grokonez.jwtauthentication.entitys.Colis; import com.grokonez.jwtauthentication.entitys.Course; import com.grokonez.jwtauthentication.entitys.Notifications; import com.grokonez.jwtauthentication.message.response.CordsResponse; import com.grokonez.jwtauthentication.model.User; import com.grokonez.jwtauthentication.repository.ColisRepository; import com.grokonez.jwtauthentication.repository.CourseRepository; import com.grokonez.jwtauthentication.repository.NotificationsRepository; import com.grokonez.jwtauthentication.repository.UserRepository; import com.grokonez.jwtauthentication.security.jwt.JwtProvider; @CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/colis") public class ColisController { @Autowired ColisRepository colisRepository; @Autowired CourseRepository courseRepository; @Autowired JwtProvider jwtProvider; @Autowired UserRepository userRepository; @Autowired NotificationsRepository notificationsRepository; @GetMapping("/list") public ResponseEntity <List <Colis>>getAllColis(HttpServletRequest req) { Optional<User> current; String token = req.getHeader("authorization").replace("Bearer " ,""); System.out.println(token); String username=this.jwtProvider.getUserNameFromJwtToken(token); current=this.userRepository.findByUsername(username); List<Colis> colis = colisRepository.findByUser(current.get()); return new ResponseEntity<>(colis,HttpStatus.OK); } @GetMapping("/tous/list") public ResponseEntity <List <Colis>>getAllColisRequests( ) { List<Colis> colis = colisRepository.findAll(); return new ResponseEntity<>(colis,HttpStatus.OK); } @GetMapping("/find/{id}") public ResponseEntity <Colis>getColisById(@PathVariable("id") Long id){ Colis colis = colisRepository.findById(id).get(); return new ResponseEntity<>(colis,HttpStatus.OK); } @GetMapping("/cords/{id}") public CordsResponse findLivreurCords(@PathVariable("id") Long id){ CordsResponse cords= new CordsResponse(); Colis colis = colisRepository.findById(id).get(); //search for the colis livreur Course course = this.courseRepository.findByColis(colis).get(0); User livreur = course.getLivreur(); cords.setLatitude(livreur.getLatitute() ); cords.setLongitude(livreur.getLongitde()); return cords; } @PostMapping("/add") public ResponseEntity<Colis> addColis(@RequestBody Colis colis,HttpServletRequest req) { Optional<User> current; String token = req.getHeader("authorization").replace("Bearer " ,""); System.out.println(token); String username=this.jwtProvider.getUserNameFromJwtToken(token); current=this.userRepository.findByUsername(username); colis.setUser(current.get()); // notifcation for the admin long millis=System.currentTimeMillis(); Notifications parcNotif = new Notifications(); parcNotif.setTitle("Nouvel Colis"); parcNotif.setMessage("Un client a ajouté une nouvelle commande, consultez-la."); parcNotif.setAdddate( new Date(millis) ); parcNotif.setSeen(false); parcNotif.setUser( this.userRepository.findByUsername("[email protected]").get() ) ; this.notificationsRepository.save(parcNotif); Colis newColis = colisRepository.save(colis); return new ResponseEntity<>(newColis, HttpStatus.OK); } @PostMapping("/update") public ResponseEntity<Colis>updateColis(@RequestBody Colis tmp){ Colis old = this.colisRepository.findById(tmp.getId()).get(); old.setAdrDistinataire(tmp.getAdrDistinataire()); old.setAdrExpediteur(tmp.getAdrExpediteur()); old.setCodePostalDistinataire(tmp.getCodePostalDistinataire()); old.setCollect(tmp.isCollect()); old.setDescription(tmp.getDescription()); old.setGovDistinataire(tmp.getGovDistinataire()); old.setHauteur(tmp.getHauteur()); old.setLargeur(tmp.getLargeur()); old.setPoids(tmp.getPoids()); old.setUrgence(tmp.getUrgence()); old.setType(tmp.getType()); old.setVilleDistinataire(tmp.getVilleDistinataire()); colisRepository.save(old); return new ResponseEntity<>(old, HttpStatus.OK); } @GetMapping("/delete/{id}") public ResponseEntity<?> deleteColis(@PathVariable("id") Long id){ colisRepository.delete(colisRepository.findById(id).get()); return new ResponseEntity<>(HttpStatus.OK); } @GetMapping("/delivered/{id}") public ResponseEntity <Colis>delivered(@PathVariable("id") Long id){ Colis colis = colisRepository.findById(id).get(); colis.setEtat(2); // send notif to user long millis=System.currentTimeMillis(); Notifications parcNotif = new Notifications(); parcNotif.setTitle("Livraison de colis"); parcNotif.setMessage("votre colis a été livré avec succès, merci d'utiliser nos services."); parcNotif.setAdddate( new Date(millis) ); parcNotif.setSeen(false); parcNotif.setUser( colis.getUser() ) ; this.notificationsRepository.save(parcNotif); return new ResponseEntity<>(this.colisRepository.save(colis),HttpStatus.OK); } }
32a1b7da791368c9901fdf6a5b3ecf4005f3afb1
75d5f2955b7cc38dbed300a9c77ef1cdc77df0fe
/ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/parsers/DeleteTapeFailureNotificationRegistrationSpectraS3ResponseParser.java
692684fb05a738e336ed6475b22f89fe82a147c0
[ "Apache-2.0" ]
permissive
shabtaisharon/ds3_java_sdk
00b4cc960daf2007c567be04dd07843c814a475f
f97d10d0e644f20a7a40c5e51101bab3e4bd6c8f
refs/heads/master
2021-01-18T00:44:19.369801
2018-09-18T18:17:23
2018-09-18T18:17:23
43,845,561
0
0
null
2015-10-07T21:25:06
2015-10-07T21:25:06
null
UTF-8
Java
false
false
2,267
java
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ // This code is auto-generated, do not modify package com.spectralogic.ds3client.commands.parsers; import com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser; import com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils; import com.spectralogic.ds3client.commands.spectrads3.notifications.DeleteTapeFailureNotificationRegistrationSpectraS3Response; import com.spectralogic.ds3client.networking.WebResponse; import java.io.IOException; public class DeleteTapeFailureNotificationRegistrationSpectraS3ResponseParser extends AbstractResponseParser<DeleteTapeFailureNotificationRegistrationSpectraS3Response> { private final int[] expectedStatusCodes = new int[]{204}; @Override public DeleteTapeFailureNotificationRegistrationSpectraS3Response parseXmlResponse(final WebResponse response) throws IOException { final int statusCode = response.getStatusCode(); if (ResponseParserUtils.validateStatusCode(statusCode, expectedStatusCodes)) { switch (statusCode) { case 204: //There is no payload, return an empty response handler return new DeleteTapeFailureNotificationRegistrationSpectraS3Response(this.getChecksum(), this.getChecksumType()); default: assert false: "validateStatusCode should have made it impossible to reach this line"; } } throw ResponseParserUtils.createFailedRequest(response, expectedStatusCodes); } }
03734191c9843bec3bfe606c627448e34e3ca583
c6473aabcc5a479700664ffc57143f6092a50936
/app/src/main/java/com/dafelo/co/redditreader/subreddits/data/datasource/local/RedditDbContract.java
9d1c7dcaf8402f2d6d6b9aa464dc62486e83fe85
[]
no_license
DanielLoaiza/SimpleRedditReader
50b98e8422eb7be13a7f04f0c48c55fedbd97ebc
6341163b2b4f7f1ac989628501a7cabfc45bc34f
refs/heads/master
2021-01-12T00:51:36.509269
2017-01-10T22:45:30
2017-01-10T22:45:30
78,307,965
0
0
null
null
null
null
UTF-8
Java
false
false
1,957
java
package com.dafelo.co.redditreader.subreddits.data.datasource.local; import android.provider.BaseColumns; /** * Created by root on 9/01/17. */ public final class RedditDbContract { // To prevent someone from accidentally instantiating the contract class, // give it an empty constructor. private RedditDbContract() {} /* Inner class that defines the table contents */ public static final class SubRedditEntry implements BaseColumns { public static final String TABLE_NAME = "subreddit"; public static final String COLUMN_BANNER_IMG = "banner_img"; public static final String COLUMN_SUBMIT_TEXT_HTML = "submit_text_html"; public static final String COLUMN_SUBMIT_TEXT = "submit_text"; public static final String COLUMN_DISPLAY_NAME = "display_name"; public static final String COLUMN_HEADER_IMG = "header_img"; public static final String COLUMN_DESCRIPTION_HTML = "description_html"; public static final String COLUMN_TITLE = "title"; public static final String COLUMN_PUBLIC_DESCRIPTION_HTML = "public_description_html"; public static final String COLUMN_ICON_IMG = "icon_img"; public static final String COLUMN_HEADER_TITLE = "header_title"; public static final String COLUMN_DESCRIPTION = "description"; public static final String COLUMN_SUBSCRIBERS = "subscribers"; public static final String COLUMN_SUBMIT_TEXT_LABEL = "submit_text_label"; public static final String COLUMN_LANG = "lang"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_CREATED = "created"; public static final String COLUMN_URL = "url"; public static final String COLUMN_CREATED_UTC = "created_utc"; public static final String COLUMN_PUBLIC_DESCRIPTION = "public_description"; public static final String COLUMN_SUBREDDIT_TYPE = "subreddit_type"; } }
95c594af6b023fd4fb62bc8184f3eadf234126f5
5e5a40d02130cbd6cd3e6adb7cc0b66b6a5df6ca
/src/main/java/org/caltech/miniswingpilot/web/dto/CustResponseDto.java
d6b36de3731a826054a9c735c4bbe5cec5ab19ca
[]
no_license
boykis82/ec2test
f8d2d864a3ec93d2a6d8ef0c43f625e1df0f6fe6
30679bbeddedd6e5cdcd70bd481e990114b6af8f
refs/heads/master
2023-04-19T16:31:28.419293
2021-04-29T23:56:55
2021-04-29T23:56:55
360,031,394
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package org.caltech.miniswingpilot.web.dto; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.caltech.miniswingpilot.domain.CustTypCd; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; import java.time.LocalDate; @NoArgsConstructor @Getter @Setter public class CustResponseDto { private int custNum; private String custNm; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate custRgstDt; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate birthDt; private CustTypCd custTypCd; }
7fe452a759a080f4054f320ceb8163fdb2726035
afe0988b50dd4d593581b821593d1d7a8c4dfdd8
/src/test/java/testCases/TC0001_GET_Request.java
7ad319b65a8812d71ba694237c422cea38056cd4
[]
no_license
RaviBhatia121/RestAssuredAPITestingTestNGSDET
35b3096ce13947cecdd788192f6199fd3dfb4354
f28c2c888be63f27cd3583c3b32a3609f91fe7e8
refs/heads/master
2023-05-14T11:56:40.016351
2020-06-17T13:40:04
2020-06-17T13:40:04
272,983,889
0
0
null
2023-05-09T18:47:43
2020-06-17T13:39:16
HTML
UTF-8
Java
false
false
1,067
java
package testCases; import org.testng.Assert; import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.http.Method; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; public class TC0001_GET_Request { @Test void getWeatherDetails() { // Specify base URI RestAssured.baseURI = "http://restapi.demoqa.com/utilities/weather/city"; // Request object RequestSpecification httpRequest = RestAssured.given(); // Response object Response response = httpRequest.request(Method.GET, "/Hyderabad"); //print response in console window String responseBody= response.getBody().asString(); System.out.println("Response is: "+ responseBody); //status code validation int statusCode= response.getStatusCode(); Assert.assertEquals(statusCode, 200); //status line verification String statusLine= response.getStatusLine(); Assert.assertEquals(statusLine, "HTTP/1.1 200 OK"); //RestAssured.baseURI } }
daed618edee4d01ba631e2e1ace8f7ced962091f
25fd01de19deb79ecc3b43a701aa4f15c3089a20
/backend/src/test/java/com/drblury/shopkeeper/DemoApplicationTests.java
64db5f159daecd2647456616e4e5b255da2fc9fe
[ "MIT" ]
permissive
DrBlury/Shopkeeper
20e33160980ba433412ecaa8230647850a86f275
6df5c8c27dc92fcf28def1fbeb4ed83a7b1ece5c
refs/heads/master
2022-10-11T18:33:12.787066
2020-10-02T13:31:34
2020-10-02T13:31:34
230,750,773
3
0
MIT
2022-09-21T21:39:40
2019-12-29T13:00:13
Vue
UTF-8
Java
false
false
212
java
package com.drblury.shopkeeper; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoApplicationTests { @Test void contextLoads() { } }
1c28a12af8d512082f409c54878da755e7c480bb
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_42_buggy/mutated/1678/HtmlTreeBuilder.java
739f160ec5c06ea3f142bb80cc5ccd919e22f7df
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,145
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.helper.Validate; import org.jsoup.nodes.*; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; /** * HTML Tree Builder; creates a DOM from Tokens. */ class HtmlTreeBuilder extends TreeBuilder { private HtmlTreeBuilderState state; // the current state private HtmlTreeBuilderState originalState; // original / marked state private boolean baseUriSetFromDoc = false; private Element headElement; // the current head element private Element formElement; // the current form element private Element contextElement; // fragment parse context -- could be null even if fragment parsing private DescendableLinkedList<Element> formattingElements = new DescendableLinkedList<Element>(); // active (open) formatting elements private List<Token.Character> pendingTableCharacters = new ArrayList<Token.Character>(); // chars in table to be shifted out private boolean framesetOk = true; // if ok to go into frameset private boolean fosterInserts = false; // if next inserts should be fostered private boolean fragmentParsing = false; // if parsing a fragment of html HtmlTreeBuilder() {} @Override Document parse(String input, String baseUri, ParseErrorList errors) { state = HtmlTreeBuilderState.Initial; return super.parse(input, baseUri, errors); } List<Node> parseFragment(String inputFragment, Element context, String baseUri, ParseErrorList errors) { // context may be null initialiseParse(inputFragment, baseUri, errors); contextElement = context; fragmentParsing = true; Element root = null; if (context != null) { if (context.ownerDocument() != null) // quirks setup: doc.quirksMode(context.ownerDocument().quirksMode()); // initialise the tokeniser state: String contextTag = context.tagName(); if (StringUtil.in(contextTag, "title", "textarea")) tokeniser.transition(TokeniserState.Rcdata); else if (StringUtil.in(contextTag, "iframe", "noembed", "noframes", "style", "xmp")) tokeniser.transition(TokeniserState.Rawtext); else if (contextTag.equals("script")) tokeniser.transition(TokeniserState.ScriptData); else if (contextTag.equals(("noscript"))) tokeniser.transition(TokeniserState.Data); // if scripting enabled, rawtext else if ("address".equals("plaintext")) tokeniser.transition(TokeniserState.Data); else tokeniser.transition(TokeniserState.Data); // default root = new Element(Tag.valueOf("html"), baseUri); doc.appendChild(root); stack.push(root); resetInsertionMode(); // todo: setup form element to nearest form on context (up ancestor chain) } runParser(); if (context != null) return root.childNodes(); else return doc.childNodes(); } @Override protected boolean process(Token token) { currentToken = token; return this.state.process(token, this); } boolean process(Token token, HtmlTreeBuilderState state) { currentToken = token; return state.process(token, this); } void transition(HtmlTreeBuilderState state) { this.state = state; } HtmlTreeBuilderState state() { return state; } void markInsertionMode() { originalState = state; } HtmlTreeBuilderState originalState() { return originalState; } void framesetOk(boolean framesetOk) { this.framesetOk = framesetOk; } boolean framesetOk() { return framesetOk; } Document getDocument() { return doc; } String getBaseUri() { return baseUri; } void maybeSetBaseUri(Element base) { if (baseUriSetFromDoc) // only listen to the first <base href> in parse return; String href = base.absUrl("href"); if (href.length() != 0) { // ignore <base target> etc baseUri = href; baseUriSetFromDoc = true; doc.setBaseUri(href); // set on the doc so doc.createElement(Tag) will get updated base, and to update all descendants } } boolean isFragmentParsing() { return fragmentParsing; } void error(HtmlTreeBuilderState state) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), "Unexpected token [%s] when in state [%s]", currentToken.tokenType(), state)); } Element insert(Token.StartTag startTag) { // handle empty unknown tags // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate fake end tag. if (startTag.isSelfClosing() && !Tag.isKnownTag(startTag.name())) { Element el = insertEmpty(startTag); process(new Token.EndTag(el.tagName())); // ensure we get out of whatever state we are in return el; } Element el = new Element(Tag.valueOf(startTag.name()), baseUri, startTag.attributes); insert(el); return el; } Element insert(String startTagName) { Element el = new Element(Tag.valueOf(startTagName), baseUri); insert(el); return el; } void insert(Element el) { insertNode(el); stack.add(el); } Element insertEmpty(Token.StartTag startTag) { Tag tag = Tag.valueOf(startTag.name()); Element el = new Element(tag, baseUri, startTag.attributes); insertNode(el); if (startTag.isSelfClosing()) { tokeniser.acknowledgeSelfClosingFlag(); if (!tag.isKnownTag()) // unknown tag, remember this is self closing for output tag.setSelfClosing(); } return el; } void insert(Token.Comment commentToken) { Comment comment = new Comment(commentToken.getData(), baseUri); insertNode(comment); } void insert(Token.Character characterToken) { Node node; // characters in script and style go in as datanodes, not text nodes if (StringUtil.in(currentElement().tagName(), "script", "style")) node = new DataNode(characterToken.getData(), baseUri); else node = new TextNode(characterToken.getData(), baseUri); currentElement().appendChild(node); // doesn't use insertNode, because we don't foster these; and will always have a stack. } private void insertNode(Node node) { // if the stack hasn't been set up yet, elements (doctype, comments) go into the doc if (stack.size() == 0) doc.appendChild(node); else if (isFosterInserts()) insertInFosterParent(node); else currentElement().appendChild(node); } Element pop() { // todo - dev, remove validation check if (stack.peekLast().nodeName().equals("td") && !state.name().equals("InCell")) Validate.isFalse(true, "pop td not in cell"); if (stack.peekLast().nodeName().equals("html")) Validate.isFalse(true, "popping html!"); return stack.pollLast(); } void push(Element element) { stack.add(element); } DescendableLinkedList<Element> getStack() { return stack; } boolean onStack(Element el) { return isElementInQueue(stack, el); } private boolean isElementInQueue(DescendableLinkedList<Element> queue, Element element) { Iterator<Element> it = queue.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next == element) { return true; } } return false; } Element getFromStack(String elName) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next.nodeName().equals(elName)) { return next; } } return null; } boolean removeFromStack(Element el) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next == el) { it.remove(); return true; } } return false; } void popStackToClose(String elName) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next.nodeName().equals(elName)) { it.remove(); break; } else { it.remove(); } } } void popStackToClose(String... elNames) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (StringUtil.in(next.nodeName(), elNames)) { it.remove(); break; } else { it.remove(); } } } void popStackToBefore(String elName) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next.nodeName().equals(elName)) { break; } else { it.remove(); } } } void clearStackToTableContext() { clearStackToContext("table"); } void clearStackToTableBodyContext() { clearStackToContext("tbody", "tfoot", "thead"); } void clearStackToTableRowContext() { clearStackToContext("tr"); } private void clearStackToContext(String... nodeNames) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (StringUtil.in(next.nodeName(), nodeNames) || next.nodeName().equals("html")) break; else it.remove(); } } Element aboveOnStack(Element el) { assert onStack(el); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next == el) { return it.next(); } } return null; } void insertOnStackAfter(Element after, Element in) { int i = stack.lastIndexOf(after); Validate.isTrue(i != -1); stack.add(i+1, in); } void replaceOnStack(Element out, Element in) { replaceInQueue(stack, out, in); } private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) { int i = queue.lastIndexOf(out); Validate.isTrue(i != -1); queue.remove(i); queue.add(i, in); } void resetInsertionMode() { boolean last = false; Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (!it.hasNext()) { last = true; node = contextElement; } String name = node.nodeName(); if ("select".equals(name)) { transition(HtmlTreeBuilderState.InSelect); break; // frag } else if (("td".equals(name) || "td".equals(name) && !last)) { transition(HtmlTreeBuilderState.InCell); break; } else if ("tr".equals(name)) { transition(HtmlTreeBuilderState.InRow); break; } else if ("tbody".equals(name) || "thead".equals(name) || "tfoot".equals(name)) { transition(HtmlTreeBuilderState.InTableBody); break; } else if ("caption".equals(name)) { transition(HtmlTreeBuilderState.InCaption); break; } else if ("colgroup".equals(name)) { transition(HtmlTreeBuilderState.InColumnGroup); break; // frag } else if ("table".equals(name)) { transition(HtmlTreeBuilderState.InTable); break; } else if ("head".equals(name)) { transition(HtmlTreeBuilderState.InBody); break; // frag } else if ("body".equals(name)) { transition(HtmlTreeBuilderState.InBody); break; } else if ("frameset".equals(name)) { transition(HtmlTreeBuilderState.InFrameset); break; // frag } else if ("html".equals(name)) { transition(HtmlTreeBuilderState.BeforeHead); break; // frag } else if (last) { transition(HtmlTreeBuilderState.InBody); break; // frag } } } // todo: tidy up in specific scope methods private boolean inSpecificScope(String targetName, String[] baseTypes, String[] extraTypes) { return inSpecificScope(new String[]{targetName}, baseTypes, extraTypes); } private boolean inSpecificScope(String[] targetNames, String[] baseTypes, String[] extraTypes) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element el = it.next(); String elName = el.nodeName(); if (StringUtil.in(elName, targetNames)) return true; if (StringUtil.in(elName, baseTypes)) return false; if (extraTypes != null && StringUtil.in(elName, extraTypes)) return false; } Validate.fail("Should not be reachable"); return false; } boolean inScope(String[] targetNames) { return inSpecificScope(targetNames, new String[]{"applet", "caption", "html", "table", "td", "th", "marquee", "object"}, null); } boolean inScope(String targetName) { return inScope(targetName, null); } boolean inScope(String targetName, String[] extras) { return inSpecificScope(targetName, new String[]{"applet", "caption", "html", "table", "td", "th", "marquee", "object"}, extras); // todo: in mathml namespace: mi, mo, mn, ms, mtext annotation-xml // todo: in svg namespace: forignOjbect, desc, title } boolean inListItemScope(String targetName) { return inScope(targetName, new String[]{"ol", "ul"}); } boolean inButtonScope(String targetName) { return inScope(targetName, new String[]{"button"}); } boolean inTableScope(String targetName) { return inSpecificScope(targetName, new String[]{"html", "table"}, null); } boolean inSelectScope(String targetName) { Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element el = it.next(); String elName = el.nodeName(); if (elName.equals(targetName)) return true; if (!StringUtil.in(elName, "optgroup", "option")) // all elements except return false; } Validate.fail("Should not be reachable"); return false; } void setHeadElement(Element headElement) { this.headElement = headElement; } Element getHeadElement() { return headElement; } boolean isFosterInserts() { return fosterInserts; } void setFosterInserts(boolean fosterInserts) { this.fosterInserts = fosterInserts; } Element getFormElement() { return formElement; } void setFormElement(Element formElement) { this.formElement = formElement; } void newPendingTableCharacters() { pendingTableCharacters = new ArrayList<Token.Character>(); } List<Token.Character> getPendingTableCharacters() { return pendingTableCharacters; } void setPendingTableCharacters(List<Token.Character> pendingTableCharacters) { this.pendingTableCharacters = pendingTableCharacters; } /** 11.2.5.2 Closing elements that have implied end tags<p/> When the steps below require the UA to generate implied end tags, then, while the current node is a dd element, a dt element, an li element, an option element, an optgroup element, a p element, an rp element, or an rt element, the UA must pop the current node off the stack of open elements. @param excludeTag If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list. */ void generateImpliedEndTags(String excludeTag) { while ((excludeTag != null && !currentElement().nodeName().equals(excludeTag)) && StringUtil.in(currentElement().nodeName(), "dd", "dt", "li", "option", "optgroup", "p", "rp", "rt")) pop(); } void generateImpliedEndTags() { generateImpliedEndTags(null); } boolean isSpecial(Element el) { // todo: mathml's mi, mo, mn // todo: svg's foreigObject, desc, title String name = el.nodeName(); return StringUtil.in(name, "address", "applet", "area", "article", "aside", "base", "basefont", "bgsound", "blockquote", "body", "br", "button", "caption", "center", "col", "colgroup", "command", "dd", "details", "dir", "div", "dl", "dt", "embed", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "isindex", "li", "link", "listing", "marquee", "menu", "meta", "nav", "noembed", "noframes", "noscript", "object", "ol", "p", "param", "plaintext", "pre", "script", "section", "select", "style", "summary", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "ul", "wbr", "xmp"); } // active formatting elements void pushActiveFormattingElements(Element in) { int numSeen = 0; Iterator<Element> iter = formattingElements.descendingIterator(); while (iter.hasNext()) { Element el = iter.next(); if (el == null) // marker break; if (isSameFormattingElement(in, el)) numSeen++; if (numSeen == 3) { iter.remove(); break; } } formattingElements.add(in); } private boolean isSameFormattingElement(Element a, Element b) { // same if: same namespace, tag, and attributes. Element.equals only checks tag, might in future check children return a.nodeName().equals(b.nodeName()) && // a.namespace().equals(b.namespace()) && a.attributes().equals(b.attributes()); // todo: namespaces } void reconstructFormattingElements() { int size = formattingElements.size(); if (size == 0 || formattingElements.getLast() == null || onStack(formattingElements.getLast())) return; Element entry = formattingElements.getLast(); int pos = size - 1; boolean skip = false; while (true) { if (pos == 0) { // step 4. if none before, skip to 8 skip = true; break; } entry = formattingElements.get(--pos); // step 5. one earlier than entry if (entry == null || onStack(entry)) // step 6 - neither marker nor on stack break; // jump to 8, else continue back to 4 } while(true) { if (!skip) // step 7: on later than entry entry = formattingElements.get(++pos); Validate.notNull(entry); // should not occur, as we break at last element // 8. create new element from element, 9 insert into current node, onto stack skip = false; // can only skip increment from 4. Element newEl = insert(entry.nodeName()); // todo: avoid fostering here? // newEl.namespace(entry.namespace()); // todo: namespaces newEl.attributes().addAll(entry.attributes()); // 10. replace entry with new entry formattingElements.add(pos, newEl); formattingElements.remove(pos + 1); // 11 if (pos == size-1) // if not last entry in list, jump to 7 break; } } void clearFormattingElementsToLastMarker() { while (!formattingElements.isEmpty()) { Element el = formattingElements.peekLast(); formattingElements.removeLast(); if (el == null) break; } } void removeFromActiveFormattingElements(Element el) { Iterator<Element> it = formattingElements.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next == el) { it.remove(); break; } } } boolean isInActiveFormattingElements(Element el) { return isElementInQueue(formattingElements, el); } Element getActiveFormattingElement(String nodeName) { Iterator<Element> it = formattingElements.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next == null) // scope marker break; else if (next.nodeName().equals(nodeName)) return next; } return null; } void replaceActiveFormattingElement(Element out, Element in) { replaceInQueue(formattingElements, out, in); } void insertMarkerToFormattingElements() { formattingElements.add(null); } void insertInFosterParent(Node in) { Element fosterParent = null; Element lastTable = getFromStack("table"); boolean isLastTableParent = false; if (lastTable != null) { if (lastTable.parent() != null) { fosterParent = lastTable.parent(); isLastTableParent = true; } else fosterParent = aboveOnStack(lastTable); } else { // no table == frag fosterParent = stack.get(0); } if (isLastTableParent) { Validate.notNull(lastTable); // last table cannot be null by this point. lastTable.before(in); } else fosterParent.appendChild(in); } @Override public String toString() { return "TreeBuilder{" + "currentToken=" + currentToken + ", state=" + state + ", currentElement=" + currentElement() + '}'; } }
f5d862a603d6642370ecc6323cbcb2247ad2cfb3
f9a9fd3f1e18c2f2cabcc2f0ebc225b1b25de60e
/app/src/main/java/com/ming/sjll/my/fragment/OrderCurriculumFragemt.java
18c6cdeda65cf2cee8bce6a1aedffec337019c86
[]
no_license
15307388990/SJLL
273541dfa40f8a3a92e88890941ed68a5cd129d5
e4dd377d6408b6c28e6683843cc4f39c11f2442b
refs/heads/master
2020-08-03T04:27:46.225903
2019-11-23T02:41:32
2019-11-23T02:41:32
211,624,684
1
0
null
null
null
null
UTF-8
Java
false
false
2,325
java
package com.ming.sjll.my.fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.RadioButton; import com.ming.sjll.R; import com.ming.sjll.base.fragment.MvpFragment; import com.ming.sjll.base.widget.ToastShow; import com.ming.sjll.my.adapter.OrderCurriculumAdapter; import com.ming.sjll.my.bean.CurriculumBean; import com.ming.sjll.my.presenter.OrderBusinessPresenter; import com.ming.sjll.my.presenter.OrderCurriculumPresenter; import com.ming.sjll.my.view.CurriculumView; import com.ming.sjll.purchaser.adapter.ProjectManagementAdapter; import com.ming.sjll.purchaser.bean.ProjectManagementBean; import com.ming.sjll.purchaser.view.ProjectManagementView; import butterknife.BindView; /** * @author luoming * created at 2019-10-14 10:32 * 我的订单*课程 */ public class OrderCurriculumFragemt extends MvpFragment<CurriculumView, OrderCurriculumPresenter> implements CurriculumView { @BindView(R.id.recyclerview) RecyclerView recyclerview; public static OrderCurriculumFragemt newInstance() { OrderCurriculumFragemt projectManagementFragemt = new OrderCurriculumFragemt(); return projectManagementFragemt; } @Override protected void onCreateView(Bundle savedInstanceState) { super.onCreateView(savedInstanceState); setContentView(R.layout.fragemt_recycle); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); } @Override protected OrderCurriculumPresenter createPresenter() { return new OrderCurriculumPresenter(); } @Override public void showLoading(String msg) { } @Override public void hideLoading() { } @Override public void showError(String msg) { ToastShow.s(msg); } @Override public void onDestroyView() { super.onDestroyView(); } @Override public void ShowData(CurriculumBean pBean) { recyclerview.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerview.setAdapter(new OrderCurriculumAdapter(pBean.getData().getData())); } }
990cfac0bc8007dfce6afe83cd2a0c0ccdaa3b10
7bb17981e2e8e39960adc01b169965bbfb3d9c4d
/src/example1/Radio.java
3f869b3cc1ddba84fcf7d9c2aedf73876c55869f
[]
no_license
VladKozachek/-Java.-State-
79b49a454a4439d07921815379fc24325acc959b
b2b80786843917bb2498fa3804887cc865acfd92
refs/heads/master
2020-03-21T02:24:31.342600
2018-06-20T09:29:54
2018-06-20T09:29:54
137,996,943
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package example1; //Context public class Radio { private IRadioStation station; void setRadioStation(IRadioStation station){ this.station=station; } void nextStation(){ if(station instanceof HitFM){ setRadioStation(new AutoradioFM()); } else if (station instanceof AutoradioFM){ setRadioStation(new KissFM()); } else if (station instanceof KissFM){ setRadioStation(new HitFM()); } } void play(){ station.play(); } }
d9872cec07c8330a701ab9dc1a8bc1e9eb9d3448
ffb3088693a94cff1973f0e7ae6461885a3611c1
/restaurant/src/main/java/fu/service/ICategoryService.java
0df361693af5611da73218c681c6cc20cff2c79b
[]
no_license
NguyeDuc/CapstoneProject
46d92299f91198f0dcbac88d5df01b6f294d6862
de4a976739c06cf3e361d54e73c274f08f0423da
refs/heads/master
2022-11-17T22:27:09.826121
2020-06-27T11:38:30
2020-06-27T11:38:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
60
java
package fu.service; public interface ICategoryService { }
8280b974dcaefe7c19dbb881f3c74b45a57ec736
a7214eeb0e7dab722a66941270816ba425ed1769
/TankGameDemo/Tank/T0.9/TankClient.java
2e4ed88b9c87b77777854f93c2a0c6374d50a59e
[]
no_license
AnderJoeSun/JavaSE-Demos
5f9106ced7d8a00298c8415262cbef5d97d7aec2
ba47fd0638604b8be2971241a709dbb408d0b1a3
refs/heads/master
2020-12-20T04:19:51.583187
2020-01-24T07:45:52
2020-01-24T07:45:52
235,959,429
0
0
null
null
null
null
UTF-8
Java
false
false
1,754
java
import java.awt.*; import java.awt.event.*; public class TankClient extends Frame { public static final int GAME_WIDTH = 800; public static final int GAME_HEIGHT = 600; Tank myTank = new Tank(50, 50); Image offScreenImage = null; public void paint(Graphics g) { myTank.draw(g); } public void update(Graphics g) { if(offScreenImage == null) { offScreenImage = this.createImage(GAME_WIDTH, GAME_HEIGHT); } Graphics gOffScreen = offScreenImage.getGraphics(); Color c = gOffScreen.getColor(); gOffScreen.setColor(Color.GREEN); gOffScreen.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT); gOffScreen.setColor(c); paint(gOffScreen); g.drawImage(offScreenImage, 0, 0, null); } public void lauchFrame() { this.setLocation(400, 300); this.setSize(GAME_WIDTH, GAME_HEIGHT); this.setTitle("TankWar"); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); this.setResizable(false); this.setBackground(Color.GREEN); this.addKeyListener(new KeyMonitor()); setVisible(true); new Thread(new PaintThread()).start(); } public static void main(String[] args) { TankClient tc = new TankClient(); tc.lauchFrame(); } private class PaintThread implements Runnable { public void run() { while(true) { repaint(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } } } private class KeyMonitor extends KeyAdapter { public void keyReleased(KeyEvent e) { myTank.keyReleased(e); } public void keyPressed(KeyEvent e) { myTank.keyPressed(e); } } }
4ebd456937b4b2f2c4fa290cab12d42ea5b46a4c
5412f18fafb75955e6dc16cf3dcfcfa3067dd454
/limo_apps/MapSDK/src/com/reconinstruments/mapsdk/geodataservice/clientinterface/worldobjects/DownhillSkiTrail_Red.java
6e7985b8545a8e618368a25d5c980d7c847157ed
[]
no_license
mfkiwl/jet
a6080e6f76add78a51c8f2136ba49344f0126581
d375f89c1d5be0aa43cab8ade08d4b55d74a3f37
refs/heads/master
2021-05-31T20:44:46.987776
2016-05-27T21:45:55
2016-05-27T21:45:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,630
java
package com.reconinstruments.mapsdk.geodataservice.clientinterface.worldobjects; import java.util.ArrayList; import android.os.Parcel; import android.os.Parcelable; import com.reconinstruments.mapsdk.geodataservice.clientinterface.capabilities.Capability; public class DownhillSkiTrail_Red extends DownhillSkiTrail implements Parcelable { private final static String TAG = "DownhillSkiTrail_Red"; // constructors public DownhillSkiTrail_Red(String name, ArrayList<PointXY> _nodes, DownhillSkiTrail.DownhillDirection _downhillDir, Capability.DataSources dataSource) { super(WorldObjectTypes.DOWNHILLSKITRAIL_RED, name, _nodes, _downhillDir, dataSource); // calc mMainAngleFromNorth } public DownhillSkiTrail_Red(Parcel _parcel) { super(_parcel); // first instantiate it readFromParcel(_parcel); // then load from parcel } //============ parcelable protocol handlers public static final Parcelable.Creator<DownhillSkiTrail_Red> CREATOR = new Parcelable.Creator<DownhillSkiTrail_Red>() { public DownhillSkiTrail_Red createFromParcel(Parcel _parcel) { return new DownhillSkiTrail_Red(_parcel); } public DownhillSkiTrail_Red[] newArray(int size) { return new DownhillSkiTrail_Red[size]; } }; @Override public void writeToParcel(Parcel _parcel, int flags) { // data out (encoding) super.writeToParcel(_parcel, flags); // write all super member data to parcel first } @Override protected void readFromParcel(Parcel _parcel) { // data in (decoding) super.readFromParcel(_parcel); } }
680de60c4218271e9127236274d3e08cc0f1ef8a
35e0e1d580e07f3972bf5bf24ac53454e588b684
/src/main/java/ge/magti/server/sets.java
3e8826d0f829369ab29fd6f399542cd33fa3c615
[]
no_license
paatap/CallCenter
97b12e0695c36ae099271d098f5b02a62357117f
1d1c70619c962c901d508bf0667f987c2fc3a4d9
refs/heads/master
2022-10-11T17:18:53.035415
2017-07-28T13:17:18
2017-07-28T13:17:18
84,037,506
0
1
null
2022-09-22T17:54:45
2017-03-06T06:21:41
Java
UTF-8
Java
false
false
3,181
java
package ge.magti.server; import ge.magti.EchoServer; /** * Created by user on 3/10/17. */ public class sets { public static boolean firstinit =true; public static void init(){ if (firstinit){ firstinit=false; String ss=functions.file2str("/opt/cc_crm.conf"); db_stringnewcc=functions.getparam(ss,"db_stringnewcc",db_stringnewcc); db_usernewcc=functions.getparam(ss,"db_usernewcc",db_usernewcc); db_passnewcc=functions.getparam(ss,"db_passnewcc",db_passnewcc); debug=functions.getparam(ss,"debug","").equals("true"); messagestring=functions.getparam(ss,"messagestring",messagestring); System.out.println("db_stringnewcc="+db_stringnewcc); System.out.println("db_usernewcc="+db_usernewcc); System.out.println("debug="+debug); System.out.println("messagestring="+messagestring); EchoServer.starttimer(); } } public static boolean debug=false; public static final String db_driver = "org.postgresql.Driver"; public static final String db_stringnew = "jdbc:postgresql://192.168.1.63:5432/callcenter"; public static final String db_stringbackup = "jdbc:postgresql://192.168.1.69:5432/callcenter"; public static final String db_stringgwt = "jdbc:postgresql://192.168.18.43:5432/gwtadmin"; public static final String db_user = "cc_crm"; public static final String db_pass = ""; public static String db_stringnewcc = "111111111111111jdbc:postgresql://192.168.27.30:5432/cc_crm"; public static String db_usernewcc = "cc_crm"; public static String db_passnewcc = ""; public static String messagestring = "ws://127.0.0.1:9080/CallCenter/message"; public static String db_drivermysql = "com.mysql.jdbc.Driver"; public static String db_string12 = new String("11111111111111jdbc:mysql://192.168.27.12:3306/"); public static String db_user12 = new String("ccmaster-manage"); public static String db_pass12 = new String("uH8Zj23Ha8mN"); public static final int mobile =0; public static final int gov =2; public static final int magtisat =13; public static final int magtifix =3; public static final int marketing =5; public static final int info =7; public static final int nophone =-1; public static final int SendRingFile =200; public static final int LOGIN =201; public static final int BUSY =202; public static final int READY =203; public static final int RINGING =204; public static final int REST =205; public static final int ANSWER =206; public static final int CON =207; public static final int TERMINATE =208; public static final int END =209; public static final int PlayWtOpFile =210; public static final int PlayMenu =211; public static final int RESTWARNING =301; public static int RestFullTime=1800; public static int RestWarnTime=600; public static String gobsip="192.168.27.27"; public static String asterip="192.168.27.12"; }
0487c8528f193c412ff3d158fe62ff25df55d11b
65a6643add2ce642a6bc33fbd2e2ce46fc940352
/app/src/main/java/aplikasiku/padi/tnfaid/pantaupadi/User/Login.java
cf34c354c96c235743ac68d7f4c6f5de548e4a45
[]
no_license
tnfaid/pantauPadi
2e8305120b09bd2709978754534a72eb145f7ec3
eede629be490fe99aa6311fbd7c024a968e1daa0
refs/heads/master
2020-04-26T22:16:37.966436
2019-05-27T02:51:38
2019-05-27T02:51:38
173,867,443
1
0
null
null
null
null
UTF-8
Java
false
false
8,910
java
package aplikasiku.padi.tnfaid.pantaupadi.User; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.android.volley.NetworkResponse; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.ServerError; import com.android.volley.VolleyError; import com.android.volley.toolbox.HttpHeaderParser; import com.android.volley.toolbox.StringRequest; import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Map; import aplikasiku.padi.tnfaid.pantaupadi.MainActivity; import aplikasiku.padi.tnfaid.pantaupadi.R; import aplikasiku.padi.tnfaid.pantaupadi.app.AppController; import aplikasiku.padi.tnfaid.pantaupadi.util.Server; public class Login extends AppCompatActivity { ProgressDialog pDialog; Button btn_register, btn_login; EditText txt_email, txt_password; Intent intent; int success; ConnectivityManager conMgr; private String url = Server.URL + "ApiLogin.php"; private static final String TAG = Login.class.getSimpleName(); private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; public final static String TAG_EMAIL = "email"; public final static String TAG_ID = "id"; String tag_json_obj = "json_obj_req"; SharedPreferences sharedpreferences; Boolean session = false; String id, email; public static final String my_shared_preferences = "my_shared_preferences"; public static final String session_status = "session_status"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); { if (conMgr.getActiveNetworkInfo() != null && conMgr.getActiveNetworkInfo().isAvailable() && conMgr.getActiveNetworkInfo().isConnected()) { } else { Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_LONG).show(); } } btn_login = (Button) findViewById(R.id.btn_login); btn_register = (Button) findViewById(R.id.btn_sign_up); txt_email = (EditText) findViewById(R.id.txt_email); txt_password = (EditText) findViewById(R.id.txt_password); // Cek session login jika TRUE maka langsung buka MainActivity sharedpreferences = getSharedPreferences(my_shared_preferences, Context.MODE_PRIVATE); session = sharedpreferences.getBoolean(session_status, false); id = sharedpreferences.getString(TAG_ID, null); email = sharedpreferences.getString(TAG_EMAIL, null); if (session) { Intent intent = new Intent(Login.this, MainActivity.class); intent.putExtra(TAG_ID, id); intent.putExtra(TAG_EMAIL, email); finish(); startActivity(intent); } btn_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String email = txt_email.getText().toString(); String password = txt_password.getText().toString(); // mengecek kolom yang kosong if (email.trim().length() > 0 && password.trim().length() > 0) { if (conMgr.getActiveNetworkInfo() != null && conMgr.getActiveNetworkInfo().isAvailable() && conMgr.getActiveNetworkInfo().isConnected()) { checkLogin(email, password); } else { Toast.makeText(getApplicationContext() ,"No Internet Connection", Toast.LENGTH_LONG).show(); } } else { // Prompt user to enter credentials Toast.makeText(getApplicationContext() ,"Kolom tidak boleh kosong", Toast.LENGTH_LONG).show(); } } }); btn_register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub intent = new Intent(Login.this, SignUp.class); finish(); startActivity(intent); } }); } private void checkLogin(final String email, final String password) { pDialog = new ProgressDialog(this); pDialog.setCancelable(false); pDialog.setMessage("Logging in ..."); showDialog(); StringRequest strReq = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.e(TAG, "Login Response: " + response.toString()); hideDialog(); try { JSONObject jObj = new JSONObject(response); success = jObj.getInt(TAG_SUCCESS); // Check for error node in json if (success == 1) { String email = jObj.getString(TAG_EMAIL); String id = jObj.getString(TAG_ID); Log.e("Successfully Login!", jObj.toString()); Toast.makeText(getApplicationContext(), jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show(); // menyimpan login ke session SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putBoolean(session_status, true); editor.putString(TAG_ID, id); editor.putString(TAG_EMAIL, email); editor.commit(); // Memanggil main activity Intent intent = new Intent(Login.this, MainActivity.class); intent.putExtra(TAG_ID, id); intent.putExtra(TAG_EMAIL, email); finish(); startActivity(intent); } else { Toast.makeText(getApplicationContext(), jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { // JSON error e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e(TAG, "Login Error: " + error.getMessage()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show(); hideDialog(); } }) { @Override protected Map<String, String> getParams() { // Posting parameters to login url Map<String, String> params = new HashMap<String, String>(); params.put("email", email); params.put("password", password); return params; } }; // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_json_obj); } private void showDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideDialog() { if (pDialog.isShowing()) pDialog.dismiss(); } public void onErrorResponse(VolleyError error) { // As of f605da3 the following should work NetworkResponse response = error.networkResponse; if (error instanceof ServerError && response != null) { try { String res = new String(response.data, HttpHeaderParser.parseCharset(response.headers, "utf-8")); // Now you can use any deserializer to make sense of data JSONObject obj = new JSONObject(res); } catch (UnsupportedEncodingException e1) { // Couldn't properly decode data to string e1.printStackTrace(); } catch (JSONException e2) { // returned data is not JSONObject? e2.printStackTrace(); } } } }
e9377f1e8e371297090e18648f7784b498d516b5
78695174fcd9d35966cfe3bbc8d16b8156a43ce1
/Trees&Graphs/src/com/snarula/algo/tree/TreeOperations.java
0fae28e145b696cb6c5aeea5fc156562d04574ff
[]
no_license
narulasanam/AlgorithmsDesign
0af80016fe406147ec362500289d68a1a437414c
8a0a8b3853cd8b42b02f573e99e0fa3d375f1248
refs/heads/master
2021-01-15T15:31:05.095401
2016-06-14T22:06:04
2016-06-14T22:06:04
44,458,978
2
0
null
null
null
null
UTF-8
Java
false
false
2,016
java
package com.snarula.algo.tree; public class TreeOperations { public boolean isBalanced(Node root) { if (root == null) { return false; } if (checkHeight(root)) { return true; } return false; } public boolean validateBST(Node root) { return validateBST(root, null, null); } private boolean validateBST(Node root,Integer min, Integer max){ if (root == null) return true; if (((min != null) && root.data <= min) || ((max != null) && (root.data > max))) return false; if (!validateBST(root.left,min, root.data) || !validateBST(root.right, root.data, max)) return false; return true; } private boolean checkHeight(Node root) { if (root == null) return true; int leftHeight = getHeight(root.left); int rightHeight = getHeight(root.right); if (Math.abs(leftHeight - rightHeight) > 1) { return false; } else { return checkHeight(root.left) && checkHeight(root.right); } } private int getHeight(Node root) { if (root == null) return -1; return Math.max(getHeight(root.left), getHeight(root.right)) + 1; } public boolean checkSubTree(Node root1, Node root2){ StringBuilder s1 = new StringBuilder(); StringBuilder s2 = new StringBuilder(); getOrderString(root1, s1); getOrderString(root2, s2); return s1.indexOf(s2.toString()) != -1; } private void getOrderString(Node node, StringBuilder s1) { if(node == null){ s1.append("X"); return; } s1.append(String.valueOf(node.data)+","); getOrderString(node.left,s1); getOrderString(node.right, s1); } public Node inOrderSuccessor(Node node) { if(node == null) return null; if(node.right !=null){ return leftMostChild(node.right); } else { Node q = node; Node parent = q.parent; while(parent != null && parent.left !=q){ q= parent; parent = parent.parent; } return q; } } private Node leftMostChild(Node node) { while(node.left !=null){ node = node.left; } return node; } }
314fc4fa84c307f5318dfce50ae277986d66f6b1
d88917ba637b96ed8c2c7f65530f0e5e146286e7
/org.inaetics.pubsub.examples/mp_pubsub/subscriber/src/main/java/org/inaetics/pubsub/examples/mp_pubsub/subscriber/Activator.java
d4123115417d6755bd8b9df28887c6d4dee0a5c5
[ "Apache-2.0" ]
permissive
swordiemen/pub-sub-admin-java
f281a2a256110467d0e9db1e18421de28a42bf58
28286af7d865e93b655c2843f727a1b60eea6525
refs/heads/master
2020-03-22T09:24:21.852733
2018-07-05T10:56:08
2018-07-05T10:56:08
139,835,046
0
0
Apache-2.0
2018-07-05T10:42:39
2018-07-05T10:42:39
null
UTF-8
Java
false
false
2,136
java
/******************************************************************************* * 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.inaetics.pubsub.examples.mp_pubsub.subscriber; import java.util.Dictionary; import java.util.Hashtable; import org.apache.felix.dm.DependencyActivatorBase; import org.apache.felix.dm.DependencyManager; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.service.log.LogService; public class Activator extends DependencyActivatorBase { @Override public void init(BundleContext bundleContext, DependencyManager manager) { try { String[] objectClass = new String[] {Object.class.getName()}; Dictionary<String, Object> properties = new Hashtable<String, Object>(); properties.put(Constants.SERVICE_PID, Demo.SERVICE_PID); manager.add( manager.createComponent() .setInterface(objectClass, properties) .setImplementation(Demo.class) .add(createServiceDependency() .setService(LogService.class) .setRequired(false)) .add(createConfigurationDependency() .setRequired(false) .setPid(Demo.SERVICE_PID)) ); } catch (Exception e) { e.printStackTrace(); } } }
ef26dce7afb1e9a2258c9693470a5992d2059609
65ce6407650f71b7702e81405bb4b6acf3e6d58f
/src/java/jena-arq-2.9.0-incubating/src/main/java/org/openjena/atlas/io/CharStreamBasic.java
f18f2b64d897790445ad391917ac2f5aeeaf021c
[ "Apache-2.0" ]
permissive
arjunakula/Visual-Dialogue-System
00177cb15fb148a8bb4884946f81201926935627
7629301ae28acd6618dd54fd73e40e28584f0c56
refs/heads/master
2020-05-02T09:14:32.519255
2019-03-26T20:56:34
2019-03-26T20:56:34
177,865,899
1
0
null
null
null
null
UTF-8
Java
false
false
1,555
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.openjena.atlas.io; import java.io.IOException ; import java.io.Reader ; /** A PeekReaderSource that does no buffering - just wraps a reader. */ public final class CharStreamBasic extends CharStreamReader { private Reader reader ; CharStreamBasic(Reader reader) { this.reader = reader ; } @Override public int advance() { try { return reader.read() ; } catch (IOException ex) { ex.printStackTrace(); return -1 ; } } @Override public void closeStream() { try { reader.close() ; } catch (IOException ex) { ex.printStackTrace(); } } }
f3d32846f194c38879203db2c394057db6f85300
f99b7feea5251d598cc5d89eee2c325bd4653212
/A6/src/refria/Refrigerante.java
1fb39c84ca1ee0aded66f1817a05b0114da48da2
[]
no_license
RevolverOcelotIII/AtividadesPOO
ef47414b8fe92a6e492681dd27864025f0622df9
e44b4eefb7af896de07a84bef4ba4e1afe42a7e0
refs/heads/master
2020-05-05T12:16:47.552724
2019-04-07T21:16:36
2019-04-07T21:16:36
180,021,604
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package refria; /** * * @author danpg */ public class Refrigerante { private String nome; private double preco; private int qtd; public double efetuarVenda(double valor){ if(valor>=this.preco){ this.qtd-=1; if(valor>this.preco){ return valor-this.preco; } return 0; } return valor; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public double getPreco() { return preco; } public void setPreco(double preco) { this.preco = preco; } public int getQtd() { return qtd; } public void setQtd(int qtd) { this.qtd = qtd; } public Refrigerante(String nome, double preco, int qtd){ this.nome = nome; this.preco=preco; this.qtd = qtd; } }
ad576636679d967840d1ad174aff0e3073cee444
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project261/src/test/java/org/gradle/test/performance/largejavamultiproject/project261/p1308/Test26179.java
1aec3b66293f746cfb4c4dfae7350c2a3b9fdd85
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,274
java
package org.gradle.test.performance.largejavamultiproject.project261.p1308; import org.gradle.test.performance.largejavamultiproject.project261.p1307.Production26152; import org.junit.Test; import static org.junit.Assert.*; public class Test26179 { Production26179 objectUnderTest = new Production26179(); @Test public void testProperty0() { Production26152 value = new Production26152(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production26165 value = new Production26165(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production26178 value = new Production26178(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
b25862d5a357ce294fc728dfae45b4de79cddf89
181c28e33ad3bbc72cb5f0d8d85a69122a4468c4
/app/src/main/java/com/example/zealjiang/txtjsoneditor/MainActivity.java
faca3256763b1c4947fd644820bed6a782fdf4e3
[]
no_license
zealjiang/adda
fe330b1b6cd80551cdc83fda41123e94ec8abbea
180156d86724c7981bd4e94c96ee156730444a4d
refs/heads/master
2021-05-17T15:31:52.264800
2020-03-28T16:47:04
2020-03-28T16:47:04
250,846,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,732
java
package com.example.zealjiang.txtjsoneditor; import android.app.Activity; import android.content.Intent; import android.net.Uri; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private static final int FILE_SELECT_CODE = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); chooseFile(); startActivity(new Intent(this,FileSearchActivity.class)); } private void chooseFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); try { startActivityForResult(Intent.createChooser(intent, "选择文件"), FILE_SELECT_CODE); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(this, "亲,木有文件管理器啊-_-!!", Toast.LENGTH_SHORT).show(); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub if (resultCode != Activity.RESULT_OK) { Log.e(MainActivity.class.getName(), "onActivityResult() error, resultCode: " + resultCode); super.onActivityResult(requestCode, resultCode, data); return; } if (requestCode == FILE_SELECT_CODE) { Uri uri = data.getData(); Log.i(MainActivity.class.getName(), "------->" + uri.getPath()); } super.onActivityResult(requestCode, resultCode, data); } }
c07a65ee738c466237f7996c417c734cd17dba36
3005e461b76f75668f1480fb00d343b0d1d147b2
/Práctica Final/src/ast/i/InstruccionDeclaracion.java
f161971b4a9a8851a3eda0b055e0d21f86fdd4a3
[]
no_license
ManuOr98/PracticaPL
3dc073a72d96492a0aad25eeeab7ce636917fa07
1b1dca4a232d69268164a361b40d875b169ac79e
refs/heads/main
2023-04-06T15:37:38.756285
2021-04-17T14:19:25
2021-04-17T14:19:25
356,626,917
0
0
null
2021-04-16T16:29:16
2021-04-10T15:48:07
Java
UTF-8
Java
false
false
887
java
package ast.i; import ast.e.Expresion; import ast.e.Id; import ast.t.Tipo; public class InstruccionDeclaracion extends Instruccion { private Tipo tipo; private Id id; private Expresion valor; public InstruccionDeclaracion(Tipo tipo, Id id) { this.tipo = tipo; this.id = id; this.valor = null; } public InstruccionDeclaracion(Tipo tipo, Id id, Expresion valor) { this.tipo = tipo; this.id = id; this.valor = valor; } public TipoInstruccion getTipo() { return TipoInstruccion.DECL; } public String toString() { String s = "{{_Declaracion_}{" + tipo.toString() + ',' + id.toString(); if(valor != null) { s += ',' + valor.toString(); } s += "}}"; return s; } }
895e061b05d5c6b8b4c0c9648cedeaaddc02bcdc
9a8ac5e334acfc5ca9e614f7aa1b6496a2cd2be2
/src/cn/com/aidaban/presenter/LoginPresenter.java
a9082a9fbe718ca1b1fe7edde4fd140aa3cea2e3
[]
no_license
fgnna/aidaban
39323ec2adb68b190cdda8ca82b181968460aa21
2d7f22c1f81f36823efd011e4a0147665133f9e1
refs/heads/master
2016-09-05T16:34:40.417090
2015-04-21T04:52:38
2015-04-21T04:52:38
32,917,602
0
1
null
null
null
null
UTF-8
Java
false
false
1,630
java
package cn.com.aidaban.presenter; import android.content.Context; import android.view.View; import android.view.View.OnClickListener; import cn.com.aidaban.R; import cn.com.aidaban.common.BaseImageFactory; import cn.com.aidaban.model.UserInfoModel; import cn.com.aidaban.model.bean.UserBean; import cn.com.aidaban.presenter.modelinterface.UserInfoModelInterface; import cn.com.aidaban.presenter.viewinterface.LoginViewInterface; /** * 登录界面 主导器 * @author jie * */ public class LoginPresenter implements OnClickListener { private final String LOG_TAG = "LoginPresenter"; private Context mContext; private LoginViewInterface mLoginViewInterface; private UserInfoModelInterface mModelInterface; public LoginPresenter(Context context, LoginViewInterface loginViewInterface) { this.mContext = context; this.mLoginViewInterface = loginViewInterface; this.mModelInterface = new UserInfoModel(context); this.init(); } /** * 初始化 * 设置登录按钮的点击事件 */ private void init() { this.mLoginViewInterface.setLoginButtonOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.login_button: this.LoginButtonOnClick(); break; default: break; } } /** * 登录按钮点击事件处理 */ private void LoginButtonOnClick() { UserBean user = this.mLoginViewInterface.getUserInput(); user = mModelInterface.login(user); if(null != user) { this.mLoginViewInterface.returnMainActiviy(); } else { this.mLoginViewInterface.toastMessage("用户名密码不能为空"); } } }
b9bf2517142d58abb37f6350102dfb430f609d45
07769dbb01fcdfcab2b393348ab7e9f91c5da61a
/src/com/jantze/redditreader/RedditListFragment.java
1843474090502fc198a534e977e5401d5bc0cec2
[]
no_license
cjantze/RedditReader
666cbd7698de624ea3230b0880348e39218c0685
56ff1f10dd81199ff772ff6e2ff2dc964f6732c2
refs/heads/master
2021-05-27T19:09:39.838062
2013-08-15T06:46:21
2013-08-15T06:46:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,143
java
/** * */ package com.jantze.redditreader; import java.util.ArrayList; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.ListFragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.URLUtil; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2; import com.handmark.pulltorefresh.library.PullToRefreshListView; /** * @author chris * * Pull To Refresh Functionality: https://github.com/chrisbanes/Android-PullToRefresh * */ public class RedditListFragment extends ListFragment implements OnRefreshListener<ListView> { private static final String LOG_TAG = "RedditListFragment"; private ArrayList<RedditLink> mLinks; private PullToRefreshListView mPullToRefreshListView; private static final String EXTRA_AFTER = "com.jantze.redditreader.after"; private String mAfter; /** * onCreate ` */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mAfter = savedInstanceState.getString(EXTRA_AFTER); } setRetainInstance(true); new FetchItemsTask().execute(); setupAdapter(); } /** * onCreateView * * (non-Javadoc) * @see android.support.v4.app.ListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = super.onCreateView(inflater, container, savedInstanceState); ListView lv = (ListView) layout.findViewById(android.R.id.list); ViewGroup parent = (ViewGroup) lv.getParent(); // Remove ListView and add PullToRefreshListView in its place int lvIndex = parent.indexOfChild(lv); parent.removeViewAt(lvIndex); mPullToRefreshListView = new PullToRefreshListView(layout.getContext()); mPullToRefreshListView.setMode(Mode.PULL_FROM_END); mPullToRefreshListView.setOnRefreshListener(new OnRefreshListener2<ListView>(){ @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { // do nothing } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { // save index and top position ListView lv = (ListView)mPullToRefreshListView.getRefreshableView(); int listIndex = lv.getFirstVisiblePosition(); View v = lv.getChildAt(0); int listTop = (v == null) ? 0 : v.getTop(); Log.i(LOG_TAG, "onPullUpToRefresh() index: " + listIndex + " top: " + listTop); // bottom, fetch older items new FetchItemsTask().execute(); //mPullToRefreshListView.onRefreshComplete(); // restore last position //lv.setSelectionFromTop(listIndex, listTop); //lv.setSelection(index); // TODO: check for "no more items" } }); parent.addView(mPullToRefreshListView, lvIndex, lv.getLayoutParams()); return layout; } /** * onRefresh */ @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { Log.d(LOG_TAG, "********* onRefresh() called ***********"); // Do work to refresh the list here. //new FetchItemsTask().execute(); } /** * onSaveInstanceState * * (non-Javadoc) * @see android.support.v4.app.Fragment#onSaveInstanceState(android.os.Bundle) */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(EXTRA_AFTER, mAfter); } /** * setupAdapter * */ void setupAdapter() { if (getActivity() == null) { return; } if (mLinks != null) { RedditListAdapter adapter = new RedditListAdapter(mLinks); setListAdapter(adapter); } else { setListAdapter(null); } } /** * onResume */ @Override public void onResume() { super.onResume(); if (getActivity() == null || mLinks == null) { return; } ((RedditListAdapter)getListAdapter()).notifyDataSetChanged(); } /** * onListItemClick */ @Override public void onListItemClick(ListView l, View v, int position, long id) { // NOTE: position is base 1 while array is base 0, compensate RedditLink link = ((RedditListAdapter)getListAdapter()).getItem(position-1); Uri linkUri = Uri.parse(link.getUrl()); // Start RedditLinkActivity Intent intentView = new Intent(getActivity(), RedditViewActivity.class); intentView.setData(linkUri); //i.putExtra(RedditListFragment.EXTRA_LINK_ID, link.getId()); startActivity(intentView); } /** * class CrimeAdapter * @author chris * */ private class RedditListAdapter extends ArrayAdapter<RedditLink> { public RedditListAdapter(ArrayList<RedditLink> links) { super(getActivity(), 0, links); } @Override public View getView(int position, View convertView, ViewGroup parent) { // if we weren't given a view, inflate one if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_redditlink, null); } RedditLink link = getItem(position); // is_self indicator if (link.isIs_self()) { } // more button + self text final Button moreButton = (Button)convertView.findViewById(R.id.reddit_list_item_more_button); final TextView selfTextView = (TextView)convertView.findViewById(R.id.reddit_list_item_selftext); selfTextView.setVisibility(View.GONE); if (link.getSelftext().isEmpty()) { moreButton.setVisibility(View.GONE); } else { moreButton.setVisibility(View.VISIBLE); moreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (selfTextView.isShown()) { selfTextView.setVisibility(View.GONE); moreButton.setText(R.string.list_item_more_button); } else { selfTextView.setVisibility(View.VISIBLE); moreButton.setText(R.string.list_item_less_button); } } }); selfTextView.setText(link.getSelftext()); } // score TextView scoreTextView = (TextView)convertView.findViewById(R.id.reddit_list_item_score); scoreTextView.setText(Integer.toString(link.getScore())); // title TextView titleTextView = (TextView)convertView.findViewById(R.id.reddit_list_item_title); titleTextView.setText(link.getTitle()); //comments int count = link.getNum_comments(); Resources res = getResources(); String commentsMade = res.getQuantityString(R.plurals.number_of_comments, count, count); TextView commentsTextView = (TextView)convertView.findViewById(R.id.reddit_list_item_comments); commentsTextView.setText(commentsMade); // thumbnail - network access must be done on a thread String thumbnailUrl = link.getThumbnail(); if (URLUtil.isValidUrl(thumbnailUrl)) { ImageView thumbnailImageView = (ImageView)convertView.findViewById(R.id.reddit_list_item_thumbnail); new DrawableManager().fetchDrawableOnThread(thumbnailUrl, thumbnailImageView); } return convertView; } } /** * class FetchItemsTask * * Utilize RedditFetcher class to fetch all items from reddit * @author chris * */ private class FetchItemsTask extends AsyncTask<Void,Void,ArrayList<RedditLink>> { /** * onPostExecute * * (non-Javadoc) * @see android.os.AsyncTask#onPostExecute(java.lang.Object) */ @Override protected void onPostExecute(ArrayList<RedditLink> links) { // append new links to existing if (mLinks == null) { mLinks = links; } else { mLinks.addAll(links); } setupAdapter(); mPullToRefreshListView.onRefreshComplete(); Log.d(LOG_TAG, "onPostExecute() refresh complete -------"); } /** * doInBackground * * (non-Javadoc) * @see android.os.AsyncTask#doInBackground(Params[]) */ @Override protected ArrayList<RedditLink> doInBackground(Void... params) { // instantiate RedditFetcher and set the "after" value RedditFetcher fetcher = RedditFetcher.get(getActivity()); fetcher.setAfter(mAfter); // fetch items, returns only additional links ArrayList<RedditLink> links = fetcher.fetchLinks(); // retrieve new "after" value and update fragment arguments mAfter = fetcher.getAfter(); return links; } } }
0230184e1be7e65d546dfb462414a1a0f77d3293
b70f256b09f3bd949e7a734709811d870d3ebcf7
/app/src/main/java/com/aitec/appbeber/MyProfile/event/ProfileEvent.java
03511b24e6b1dd996c1f3c3446189b9466f5906e
[]
no_license
vpanchojs/AppBeber
b9260dfa1b344aef4c0a1e899376e8e3497d5314
044a7a85932ed09ccad496a8695378c4f1d79a31
refs/heads/master
2022-08-08T02:13:49.883041
2018-08-06T04:06:05
2018-08-06T04:06:06
114,903,751
0
0
null
null
null
null
UTF-8
Java
false
false
1,271
java
package com.aitec.appbeber.MyProfile.event; import java.util.List; /** * Created by victor on 5/9/17. */ public class ProfileEvent { public final static int onSignOutError = 1; public final static int onSignOutSucces = 0; public final static int onGetUserSuccess = 6; public final static int onGetUserError = 7; public final static int onUpdatePhotoSuccess = 8; public final static int onUpdatePhotoError = 9; public final static int onUpdateUserSuccess = 10; public final static int onUpdateUserError = 11; private String menssage; private int event; private Object object; private List<Object> objectList; public Object getObject() { return object; } public void setObject(Object object) { this.object = object; } public List<Object> getObjectList() { return objectList; } public void setObjectList(List<Object> objectList) { this.objectList = objectList; } public int getEvent() { return event; } public void setEvent(int event) { this.event = event; } public String getMenssage() { return menssage; } public void setMenssage(String menssage) { this.menssage = menssage; } }
1d114108da81969910f060a0832f3564a3eccbcd
633939a9ccf11cbc5a92e4c77fd2d8cc07142eb4
/basic/src/main/java/DBO/WorkTask.java
2f6202dbb9950cfad01e753d6f850676aadbcc5e
[]
no_license
lyakechko/Implementation_Embedded
bd521bb66c666906e10b53027c0f16640ace5c30
eddaa40a6b55719f66672e4f863a37aa838e890a
refs/heads/main
2023-06-05T01:26:22.972028
2021-07-04T12:25:33
2021-07-04T12:25:33
378,086,567
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package DBO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.Locale; @Data @NoArgsConstructor @AllArgsConstructor @DiscriminatorValue("W") @Entity @Table public class WorkTask extends Task { @Column(name = "cost") private Locale cost; }
ffc333fa33daa2f58e72570583ca46cc558111a3
ffb6fe775e8db66aa47ef24fa5aa2fc076a11eb0
/src/test/java/com/youwiz/practices/service/AccountFindServiceTest.java
c956d8f17d090e1d891c79f8baa97e67d4d894b0
[]
no_license
head1ton-dhg/spring_boot_practices
3b90d1c6d8664bf48bb2f0d524f66ff7f59db867
7ded610c73a1619756cd96f9f0e6269eafd0764c
refs/heads/master
2022-12-03T03:01:48.711844
2020-08-24T14:59:29
2020-08-24T14:59:29
289,715,712
0
0
null
null
null
null
UTF-8
Java
false
false
2,729
java
package com.youwiz.practices.service; import com.youwiz.practices.domain.Account; import com.youwiz.practices.domain.Email; import com.youwiz.practices.exception.AccountNotFoundException; import com.youwiz.practices.repository.AccountRepository; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Optional; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @ExtendWith(MockitoExtension.class) public class AccountFindServiceTest { @InjectMocks private AccountFindService accountFindService; @Mock private AccountRepository accountRepository; private Account account; private Email email; @BeforeEach public void setUp() throws Exception { email = Email.of("[email protected]"); account = Account.builder() .email(email) .build(); } @Test public void findById_존재하는경우() { //given given(accountRepository.findById(any())).willReturn(Optional.of(account)); //when final Account findAccount = accountFindService.findById(1L); //then assertEquals(findAccount.getEmail().getValue(), account.getEmail().getValue()); } @Test public void findById_없는경우() { assertThrows(AccountNotFoundException.class, () -> { //given given(accountRepository.findById(any())).willReturn(Optional.empty()); //when accountFindService.findById(1L); //then }); } @Test public void findByEmail_없는경우() { assertThrows(AccountNotFoundException.class, () -> { //given given(accountRepository.findByEmail(any())).willReturn(null); //when accountFindService.findByEmail(email); //then }); } @Test public void isExistedEmail_이메일있으면_true() { //given given(accountRepository.existsByEmail(email)).willReturn(true); //when final boolean existedEmail = accountFindService.isExistedEmail(email); //then assertTrue(existedEmail); } @Test public void isExistedEmail_이메일없으면_false() { //given given(accountRepository.existsByEmail(email)).willReturn(false); //when final boolean existedEmail = accountFindService.isExistedEmail(email); //then assertFalse(existedEmail); } }
e802e8147b1aef72e6bd20bb4c7d6bd212ed5a04
eff5e2396f31ed1b791bccf0121680145c5479c0
/app/src/main/java/com/example/mithilesh/healthportal/Model/Place.java
a9db9d9aac8017c6cb34ccfa86c2246164b93371
[]
no_license
mithilesh-parmar/Health-Portal
e486fe6277acf7d5a3a26383e220ee74c7538258
15b6051286d34ae5505eeb09b7178aa08e3c2516
refs/heads/master
2020-04-17T11:25:09.925832
2019-01-19T12:01:50
2019-01-19T12:01:50
166,539,828
1
0
null
null
null
null
UTF-8
Java
false
false
2,708
java
package com.example.mithilesh.healthportal.Model; import android.location.Location; import java.util.HashMap; import java.util.Map; public class Place { private String id; private String name; private String placeId; private Double rating; private int userRatingsTotal; private String vicinity; private PlaceLocation location; private boolean openNow; private String iconUrl; private PlaceDetail placeDetail; // private PlacePhotos placePhotos; public Place() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPlaceId() { return placeId; } public void setPlaceId(String placeId) { this.placeId = placeId; } public Double getRating() { return rating; } public void setRating(Double rating) { this.rating = rating; } public int getUserRatingsTotal() { return userRatingsTotal; } public void setUserRatingsTotal(int userRatingsTotal) { this.userRatingsTotal = userRatingsTotal; } public String getVicinity() { return vicinity; } public void setVicinity(String vicinity) { this.vicinity = vicinity; } public PlaceLocation getLocation() { return location; } public void setLocation(Double lat,Double lon) { this.location = new PlaceLocation(lat,lon); } public boolean isOpenNow() { return openNow; } public void setOpenNow(boolean openNow) { this.openNow = openNow; } public String getIconUrl() { return iconUrl; } public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; } public PlaceDetail getPlaceDetail() { return placeDetail; } public void setPlaceDetail(PlaceDetail placeDetail) { this.placeDetail = placeDetail; } @Override public String toString() { return "\nName: "+name +"\nPlace Id"+placeId+"\nVicinity: "+vicinity; } public Map<String,Object> toMap(){ Map<String,Object> map = new HashMap<>(); map.put("id",id); map.put("name",name); map.put("placeId",placeId); map.put("rating",rating); map.put("userRatingsTotal",userRatingsTotal); map.put("vicinity",vicinity); map.put("location",location); map.put("openNow",openNow); map.put("iconUrl",iconUrl); map.put("placeDetail",placeDetail.toMap()); return map; } }
76fc706e30c23a419b986cfa8441a6a1a324d897
9bd44bb0f4e17cd470c8b1f64834d0a41866cc06
/app/src/main/java/com/goodhappiness/dao/Observer.java
da69afc91ab25d1f65cd0f62fd1b6bc6de586804
[]
no_license
hackerlank/hxf-android_2
00469e8e6ecc7a2bc5c250a38de7e2625555bf7d
0e7b5ae840920a66390fc69094a3c20aec88f314
refs/heads/master
2020-03-12T08:39:48.214609
2017-02-11T11:21:07
2017-02-11T11:21:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
112
java
package com.goodhappiness.dao; public interface Observer { public void onNetStateChange(boolean isConnect); }
a605bee09728ee5299d231dc05b2592543cee245
a7f3973b69053e632f6595ae78e0c56adff2bf2c
/src/main/java/ir/maktab/homeService/exceptions/checkes/CustomerNotFoundException.java
fcaabfc58c811c29de0782453a45e2bbb05b6b1c
[]
no_license
YeganehNobakht/Home_Service_Spring_Boot
75ecd90ea5d605807795067c5615d4bc5d275c10
a253d2c1315113768fd19eb86535e01c89d26b87
refs/heads/master
2023-06-18T08:25:50.316259
2021-07-13T15:21:54
2021-07-13T15:21:54
379,605,016
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package ir.maktab.homeService.exceptions.checkes; public class CustomerNotFoundException extends Exception { public CustomerNotFoundException(String message) { super(message); } }
1a463e7b56a05af6867d4959d944ee94b61b7949
490898e81a8c2af15127d7b9a2b35dbac632f098
/src/test/java/Theatrolabs/assignment/MasterParser/AppTest.java
13bf8f51ede4459351aee9a1e4e536622b7933ca
[]
no_license
munjalupadhyay/MasterFileParser
676586252f96ec112f4d9d0d3ba3fb198f3275bb
77765a9dfc36c56dff44290ab6eaedf2b961d7c0
refs/heads/master
2020-07-01T19:20:13.723181
2016-11-20T09:30:11
2016-11-20T09:30:11
74,263,596
0
0
null
null
null
null
UTF-8
Java
false
false
1,272
java
package Theatrolabs.assignment.MasterParser; import org.junit.runner.RunWith; import org.junit.runners.Suite; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ @RunWith(Suite.class) @Suite.SuiteClasses({ CSVFileParserTester.class, XLSFileParserTester.class, MasterFileParserTester.class }) public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ //CSVFileParserTester csv= new CSVFileParserTester("/home/munjal/Desktop/TheatroLabs/assignment.csv"); public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { //TestSuite suite = new TestSuite("Test ExpenseTest"); return new TestSuite( AppTest.class ); //suite.addTest(new AppTest("testApp")); // suite.addTest(AppTest.class); //suite.addTest(CSVFileParserTesterTester.class); //suite.addTest(new AppTest("CSV_Open_NullTest")); //return suite; } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
832c2152a9a826562a42365635ffd541f83d126a
34a2d3324180cdb90341923dd73394649719c124
/src/Battleship.java
88def51dea2df04b1a59e80d15b16ca8b693d665
[]
no_license
TheMissingText/Assignment-3
da7781685be774109f0b298abcc91a3a813fbfee
bdcb349c031a51acb4796df99b7efcd48bea2503
refs/heads/master
2023-02-04T05:20:57.659655
2020-12-22T12:13:34
2020-12-22T12:13:34
322,662,687
0
0
null
2020-12-22T12:13:35
2020-12-18T17:32:56
Java
UTF-8
Java
false
false
631
java
public class Battleship implements Ships{ private int length = 4; private int strength = 4; private boolean sunk = false; @Override public int getLength() { return this.length; } @Override public boolean getStatus() { return this.sunk; } @Override public String getName(){ return "BattleShip"; } @Override public boolean checkStatus() { return (this.strength == 0); } @Override public int getStrength() { return this.strength; } @Override public void takeStrength() { this.strength -= 1; } }
78253d6300e87e4114c9d68d3417730eac65cd1d
c60ca24dbb2ce8be7d42d70c12fadf40f4f1dc1a
/Game/EasymemCleanerJava/EasyMemoryCleaner/com/sun/jna/platform/win32/COM/UnknownListener.java
94e002aeeb65bd2409f61b5ca374bb6f7211b063
[]
no_license
Niharkanta1/JavaRepo
8e57a3e6c2ed113029bbff71f7fba23f8dc2b6cd
daa4f7f5c67bf8e38c1282ab340e084e1d1c0726
refs/heads/master
2021-07-07T20:47:21.224172
2019-06-30T11:47:27
2019-06-30T11:47:27
194,510,056
0
0
null
2020-10-13T14:17:34
2019-06-30T11:50:19
Java
UTF-8
Java
false
false
2,211
java
/* */ package com.sun.jna.platform.win32.COM; /* */ /* */ import com.sun.jna.Pointer; /* */ import com.sun.jna.Structure; /* */ import com.sun.jna.platform.win32.Guid; /* */ import com.sun.jna.platform.win32.WinNT; /* */ import com.sun.jna.ptr.PointerByReference; /* */ import java.util.Arrays; /* */ import java.util.List; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class UnknownListener /* */ extends Structure /* */ { /* */ public UnknownVTable.ByReference vtbl; /* */ /* */ public UnknownListener(IUnknownCallback callback) { /* 29 */ this.vtbl = constructVTable(); /* 30 */ initVTable(callback); /* 31 */ write(); /* */ } /* */ /* */ /* */ /* */ /* */ /* 38 */ protected List<String> getFieldOrder() { return Arrays.asList(new String[] { "vtbl" }); } /* */ /* */ /* */ /* 42 */ protected UnknownVTable.ByReference constructVTable() { return new UnknownVTable.ByReference(); } /* */ /* */ /* */ protected void initVTable(final IUnknownCallback callback) { /* 46 */ this.vtbl.QueryInterfaceCallback = new UnknownVTable.QueryInterfaceCallback() /* */ { /* */ public WinNT.HRESULT invoke(Pointer thisPointer, Guid.GUID.ByValue refid, PointerByReference ppvObject) { /* 49 */ return callback.QueryInterface(refid, ppvObject); /* */ } /* */ }; /* 52 */ this.vtbl.AddRefCallback = new UnknownVTable.AddRefCallback() /* */ { /* */ public int invoke(Pointer thisPointer) { /* 55 */ return callback.AddRef(); /* */ } /* */ }; /* 58 */ this.vtbl.ReleaseCallback = new UnknownVTable.ReleaseCallback() /* */ { /* */ public int invoke(Pointer thisPointer) { /* 61 */ return callback.Release(); /* */ } /* */ }; /* */ } /* */ } /* Location: D:\CODING\JAVA\Game\lemons tf2 cheat xd.jar!\com\sun\jna\platform\win32\COM\UnknownListener.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.0.4 */
4f11b59f547aca6f77bd94e274dc0ccad66c6b9b
bb30e5021a17f8711c47cd36108cf87311efde29
/app/src/main/java/demoaudio/yixiao/com/androidcameraapi/VersionUtils.java
0145e8397bbdc6933dceda9e7912fdb8ac001690
[]
no_license
MediaAndAudio/AndroidCameraAPI
4c3434a6f2d37a08c4dae13b53b275b044e470f7
ca985a0b55a21c8d9b7bca0bf36451eb0b65c257
refs/heads/master
2021-08-24T06:03:19.356499
2017-12-08T09:58:00
2017-12-08T09:58:00
113,524,484
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package demoaudio.yixiao.com.androidcameraapi; public class VersionUtils { public static int getSDKVersionNumber() { int sdkVersion; try { sdkVersion = Integer.valueOf(android.os.Build.VERSION.SDK); } catch (NumberFormatException e) { sdkVersion = 0; } LogUtil.i("TAG", "sdkVersion:"+sdkVersion); return sdkVersion; } /** * 检测当前系统版本是否大于等于checkVersion版本 * @param checkVersion 对比检测版本 * @return */ public static boolean checkSDKVersion(int checkVersion){ return getSDKVersionNumber() >= checkVersion ? true : false; } }
115a1b3113065a3cab19a0391c43d59f5a72abe6
868dc0b5f42cd52f65ab4a920fc77995ba31a534
/src/main/java/com/presentes/controller/CategoriaController.java
c29d19e8603e2ae81cd8a4c373784e99f65ceddc
[]
no_license
JhonDonavan/presentes
09e64b5075d5cdc92b3dde3ece9e8a570be88402
bd4f729dee9de42c5f203ff39c5070b16169d57f
refs/heads/master
2022-10-29T05:33:06.313159
2020-06-16T15:19:10
2020-06-16T15:19:10
272,742,345
0
0
null
null
null
null
UTF-8
Java
false
false
2,601
java
package com.presentes.controller; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.presentes.model.Categoria; import com.presentes.services.CategoriaService; import com.presentes.services.CategoriaServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @CrossOrigin(origins = "*", allowedHeaders = "*") @Api(value = "Categorias") @RestController @RequestMapping("/api/v1/categorias") public class CategoriaController { @Autowired CategoriaService categoriaService; @ApiOperation(value = "Retorna lista de todas Categorias") @GetMapping("/") public ResponseEntity<List<Categoria>> findAll() { return ResponseEntity.status(HttpStatus.OK).body(categoriaService.findAllCategoria()); } @ApiOperation(value = "Retorna Categoria por ID") @GetMapping(value = "/{id}") public ResponseEntity<Optional<Categoria>> show(@PathVariable("id") int id) { return ResponseEntity.status(HttpStatus.OK).body(categoriaService.findCategoriaById(id)); } @ApiOperation(value = "Remove Categoria por id") @DeleteMapping(value = "/{id}") public ResponseEntity<?> deletar(@PathVariable("id") int id) { categoriaService.deleteCategoria(id); return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } @ApiOperation(value = "Cadastra uma Categoria") @PostMapping(value = "/") public @ResponseBody ResponseEntity<?> cadastrar(@Valid @RequestBody Categoria categoria) { return ResponseEntity.status(HttpStatus.CREATED).body(categoriaService.createCategoria(categoria)); } @ApiOperation(value = "Atualizar uma Categoria") @PutMapping(value = "/") public @ResponseBody ResponseEntity<?> atualizar(@Valid @RequestBody Categoria categoria) { return ResponseEntity.status(HttpStatus.OK).body(categoriaService.updateCategoria(categoria)); } }
8b0d1ed378ef53b65193905fe5b45b928d2c883d
e579172e56ba490edce2697f34ad41c191c1a177
/cargo-commons/src/main/java/com/commom/mq/MqProducer.java
826132e2a5d1c80ef20d71b7e9064011226a6156
[]
no_license
sdajava/xinya-cargo
82a5aa3f148bade6494eb3fd426bbb339856a57f
ba8e9731441d45b5be273c7e7309d3f7cdb2337e
refs/heads/main
2023-01-23T00:06:25.332976
2020-11-25T02:14:49
2020-11-25T02:14:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.commom.mq; import org.springframework.stereotype.Component; @Component public class MqProducer { public static String GpsQueue = "MqGpsLocation"; // public static String MqGpsQueue = "MqGps"; // public void sendLocationMsg(String msg) { // rabbitTemplate.convertAndSend(GpsQueue, msg); // } }
f6a0381d00c7f7913b115b463773794e3faa5aca
04b5b0ee2f66a15e8636dabcee53f52736a93f23
/src/main/java/abstractfactory/practice/Guest.java
c413e323e60ffac560a741ca1cbaf2ea98695496
[]
no_license
yunseop-kim/practice-java-design-pattern
c2cf295d22cd57624e7c46ae2ccbcb461bea296c
4757f48da2add5bc9cd1b710c29eca85f564dc7e
refs/heads/master
2022-01-15T19:34:25.717838
2019-07-21T12:35:41
2019-07-21T12:35:41
198,054,099
0
0
null
null
null
null
UTF-8
Java
false
false
647
java
package abstractfactory.practice; public abstract class Guest { private String name; protected String contact; protected String email; protected String snsId; Guest(String name, String contact, String email, String snsId) { this.name = name; this.contact = contact; this.email = email; this.snsId = snsId; } abstract boolean validate(); public String getName() { return name; } public String getContact() { return contact; } public String getEmail() { return email; } public String getSnsId() { return snsId; } }
67c059a140465e73b8465e5850ae4e2f1e73d32d
73f28b105a5fd70b18b2c3df8d46dc065e2c6338
/getIntersection.java
9d88602124ca49a4f446e067bed0164953579154
[]
no_license
AnnieZhou08/LeetAlgo
b3f311f48ec6fdc496ef9aeacff4a2102a9780da
1026a4c10b1859b2aabcb2f8b4a9b4da5f5322ba
refs/heads/master
2021-05-04T06:07:47.587191
2017-05-08T16:36:20
2017-05-08T16:36:20
71,029,199
3
1
null
null
null
null
UTF-8
Java
false
false
715
java
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if (headA == null || headB == null) return null; ListNode a = headA; ListNode b = headB; while(a != b){ if (a == null){ a = headB; }else{ a = a.next; } if (b == null){ b = headA; }else{ b = b.next; } } return a; } }
15276ccecd48dccc0b1cb9e44390ad630403bf18
7c7460e7d96c6bd8559204b8148eada39228bd05
/src/main/java/com/jc/aop/RedisAop.java
a1c0a54d11ea509d8b16d9be16de7d46e24b1675
[]
no_license
chenzhichengczc/gzjc
bad8dac058d9315a2a5c5eb2c2f5a8a35694a860
1e58d2c02596d36bf7cea3c96c1ceb05510cbb5b
refs/heads/master
2020-04-26T16:41:19.588785
2019-04-12T19:58:30
2019-04-12T19:58:30
173,688,295
0
0
null
null
null
null
UTF-8
Java
false
false
4,168
java
package com.jc.aop; import com.jc.common.annotation.RedisCache; import com.jc.common.exception.JcException; import com.jc.common.utils.RedisUtil; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.lang.reflect.Method; /** * @author :fenghuang * @date :Created in 2019/3/26 19:10 * @description:Redis缓存AOP * @modified By: * @version: */ @Aspect @Component public class RedisAop { public static final Logger logger = LoggerFactory.getLogger(RedisAop.class); @Autowired private RedisUtil redisUtil; /** * 给所有使用RedisCache注解的方法设置切点 */ @Pointcut("@annotation(com.jc.common.annotation.RedisCache)") public void redisCache(){} /** * 给所有业务的数据的插入,更新,删除设置切点 */ @Pointcut("execution(* com.jc.modules.*.service..*.insert*(..)) || " + "execution(* com.jc.modules.*.service..*.batch*(..)) || " + "execution(* com.jc.modules.*.service..*.update*(..)) || " + "execution(* com.jc.modules.*.service..*.delete*(..))" ) public void cleanCache(){} @Around("redisCache()") public Object around(ProceedingJoinPoint joinPoint)throws Throwable{ System.out.println("RedisAop.around"); Signature signature = joinPoint.getSignature(); MethodSignature methodSignature = (MethodSignature) signature; //获取注解类 RedisCache annotation = methodSignature.getMethod().getAnnotation(RedisCache.class); //获取注解key的值 String key = annotation.key(); if(key == null || key == ""){ throw new JcException("后台需要设置缓存的键"); } if(key.isEmpty()){ logger.info("RedisCache注解传入的key为空"); } //判断redis是否存在当前key if(!redisUtil.hasKey(key)){ Object proceed = joinPoint.proceed(); final Object[] args = joinPoint.getArgs(); //设置失效时间 boolean isSetCache = redisUtil.set(key,proceed, annotation.time()); if(!isSetCache){ logger.info("设置redis缓存失败"); return new JcException("设置redis缓存失败"); } return proceed; } //从缓存中获取数据 Object cacheBytes = redisUtil.get(key); System.out.println("cacheBytes = " + cacheBytes); if(cacheBytes == null){ logger.info("从redis缓存中获取数据失败"); return new JcException("从redis缓存中获取数据失败"); } return cacheBytes; } @Around("cleanCache()") public void cleanCacheAround(ProceedingJoinPoint joinPoint) throws Throwable{ System.out.println("joinPoint = [" + joinPoint + "]"); Object object = joinPoint.proceed(); //通过java反射获取当前AOP截取的类 Class clazz = Class.forName(joinPoint.getTarget().getClass().getName()); //获取当前类所有的方法 Method[] methods = clazz.getMethods(); for(Method method :methods){ boolean annotationPresent = method.isAnnotationPresent(RedisCache.class); //判断当前方法是否有RedisCache缓存注解 if(annotationPresent){ RedisCache annotation = method.getAnnotation(RedisCache.class); //获取redis缓存注解的key String key = annotation.key(); if(key.isEmpty()){ logger.info("当前RedisCache注解没有key"); throw new JcException("当前RedisCache注解没有key"); } redisUtil.deleteCache(key); } } } }
cd835917c01c14ee7e57bdf74324bbed21f7883f
078a17a420cc4f79448d0c42960b53ae8bb9b68d
/DataCollectWebApp/src/com/wwhisdavid/servlet/UserServlet.java
e57a22af82959ebc23bf26fa67ecc0450d440e6d
[]
no_license
wwhisdavid/Data-Aggregation-by-Java-Socket
bc6e2f8efb89446dde5bad61a465ca10500f1590
6f87aca451d90325cc52f3d0e2cc7f2588f00b82
refs/heads/master
2021-01-21T12:59:16.001622
2016-05-24T13:48:43
2016-05-24T13:48:43
48,532,564
1
0
null
null
null
null
UTF-8
Java
false
false
4,251
java
package com.wwhisdavid.servlet; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.beanutils.BeanUtils; import com.wwhisdavid.entity.UserEntity; import com.wwhisdavid.exception.UserExistsException; import com.wwhisdavid.service.UserService; import com.wwhisdavid.service.impl.UserServiceImpl; import com.wwhisdavid.util.WebBeanUtil; /** * Servlet implementation class UserServlet */ @WebServlet("/UserServlet") public class UserServlet extends HttpServlet { private static final long serialVersionUID = 1L; private UserService service = new UserServiceImpl(); /** * @see HttpServlet#HttpServlet() */ public UserServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 获取操作类型 String method = request.getParameter("method"); String loginName = (String) request.getSession().getAttribute("loginName"); if ("register".equals(method)) { this.register(request, response); } else if("login".equals(method)){ System.out.println("loginname:"+loginName); if (loginName == null || "".equals(loginName)) { this.login(request, response); }else{ // 跳转到需要到的界面 request.getRequestDispatcher("/ProjectListServlet").forward(request, response); } } else if ("logout".equals(method)) { HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute("loginName"); } response.sendRedirect("login.jsp"); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } private void register(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ // 1.获取请求参数 // String username = request.getParameter("username"); // String password = request.getParameter("password"); // System.out.println(username +":"+ password); // UserEntity userEntity = new UserEntity(); // userEntity.setUsername(userName); // userEntity.setPassword(password); UserEntity userEntity = WebBeanUtil.copyToBean(request, UserEntity.class); System.out.println(userEntity.getUsername() +":"+ userEntity.getPassword()); try { service.register(userEntity); request.setAttribute("message", "注册成功!"); request.getRequestDispatcher("/login.jsp").forward(request, response); } catch (UserExistsException e) { request.setAttribute("message", "用户名已存在!"); request.getRequestDispatcher("/register.jsp").forward(request, response); } catch (Exception e) { response.sendRedirect(request.getContextPath() + "/error/error.jsp"); } } private void login(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { UserEntity userEntity = WebBeanUtil.copyToBean(request, UserEntity.class); // 登陆校验 UserEntity userEntity2 = service.login(userEntity); // String loginStatus = (String) request.getSession().getAttribute("loginStatus"); if (userEntity2 != null) { // 登陆成功 /** *登录成功后,把用户数据保存session对象中 */ HttpSession session = request.getSession(); session.setAttribute("loginName", userEntity2.getUsername()); // 跳转到需要到的界面 request.getRequestDispatcher("/ProjectListServlet").forward(request, response); } else if (userEntity2 == null ) { // 登陆失败 request.setAttribute("message", "账号密码错误!"); request.getRequestDispatcher("/login.jsp").forward(request, response); } } }
458049b89f4488397de6134524bcf7f925ce550a
a0b732448e08291c894e7edf73a2d0c01124016a
/templates/googlesamples-mvp-clean/app/src/main/java/com/example/android/architecture/blueprints/todoapp/BaseView.java
c4283cab8fd620f0e51af05bb60a8d565795ea1e
[ "MIT" ]
permissive
androidstarters/androidstarters.com
5c29f99ccd696118f75bedb41783347077db388a
010258565bc3e941d73f9ab3950f8bae0ad38e7b
refs/heads/develop
2023-08-22T11:56:29.637058
2018-09-27T05:13:01
2018-09-27T05:13:01
95,357,887
299
28
MIT
2021-01-07T13:41:32
2017-06-25T12:18:07
Java
UTF-8
Java
false
false
739
java
/* * Copyright 2016, 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 <%= appPackage %>; public interface BaseView<T extends BasePresenter> { void setPresenter(T presenter); }
83e1a536b594c5f6e1803907dbb79e360123c2d7
447520f40e82a060368a0802a391697bc00be96f
/apks/comparison_androart/ro.btrl.pay/source/o/tF.java
0b7acc98388a5b73e64e550f420e458c069142f2
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
1,775
java
package o; public final class tF<T> extends st<T> { final T[] ॱ; public tF(T[] paramArrayOfT) { this.ॱ = paramArrayOfT; } public void ˋ(sx<? super T> paramSx) { if localIf = new if(paramSx, this.ॱ); paramSx.ˊ(localIf); if (localIf.ॱ) { return; } localIf.ʻ(); } static final class if<T> extends tk<T> { int ˊ; volatile boolean ˋ; final T[] ˎ; final sx<? super T> ˏ; boolean ॱ; if(sx<? super T> paramSx, T[] paramArrayOfT) { this.ˏ = paramSx; this.ˎ = paramArrayOfT; } public T o_() { int i = this.ˊ; Object[] arrayOfObject = this.ˎ; if (i != arrayOfObject.length) { this.ˊ = (i + 1); return te.ˎ(arrayOfObject[i], "The array element is null"); } return null; } void ʻ() { Object[] arrayOfObject = this.ˎ; int j = arrayOfObject.length; int i = 0; while ((i < j) && (!ˎ())) { Object localObject = arrayOfObject[i]; if (localObject == null) { this.ˏ.ˏ(new NullPointerException("The " + i + "th element is null")); return; } this.ˏ.ˏ(localObject); i += 1; } if (!ˎ()) { this.ˏ.ˏ(); } } public void ˊ() { this.ˊ = this.ˎ.length; } public boolean ˋ() { return this.ˊ == this.ˎ.length; } public boolean ˎ() { return this.ˋ; } public int ˏ(int paramInt) { if ((paramInt & 0x1) != 0) { this.ॱ = true; return 1; } return 0; } public void ॱ() { this.ˋ = true; } } }
77672df43cd90372aa6ce3222b0837ab9f1abf04
0dd283366ad30e739fb96399b6591cefe07479ba
/emovie/src/main/java/com/ab/ethioflix/exception/MyFileNotFoundException.java
d0a683cc2e921e5cf04808e68375452bfd390357
[]
no_license
Tsegawbaharu/emovie
bbcb99f93f1e1d1b43f8499a7229981c892fc989
0ec069b6524d680eacb150efc59a67e5bce6b45b
refs/heads/master
2020-04-28T22:08:09.787129
2019-03-14T11:20:51
2019-03-14T11:20:51
175,607,187
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.ab.ethioflix.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class MyFileNotFoundException extends RuntimeException{ private static final long serialVersionUID = 1L; public MyFileNotFoundException(String message) { super(message); } public MyFileNotFoundException(String message, Throwable cause) { super(message,cause); } }
82e1ba34f73ff713f2ced2ee38eb37a845a947bb
ca4e423a8f5943db0c6f95a56818c86d9307052d
/app/src/androidTest/java/com/example/newborn/ExampleInstrumentedTest.java
c1ee1113df681d5de7880a74f6375d65bd24e2a1
[]
no_license
Jbemb/NewBorn
596fb557681247e7735bf49d13f3a915f31c5dd5
8009869fa9c529fcf328d1c300126616dc100e8e
refs/heads/master
2022-12-02T07:18:02.015399
2020-08-14T08:45:34
2020-08-14T08:45:34
285,761,651
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package com.example.newborn; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.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() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.newborn", appContext.getPackageName()); } }
d7b052bb546f13d65910422cd74a3844e51d9a79
515078b95028763708c27a0e88c000e359b0459f
/app/controllers/WS.java
9b5e5edeb2bfc5d94db85dfa5ade1b980dde130b
[ "Apache-2.0" ]
permissive
dozken/kora.kz
7b0de0bc5ae838ffb33e8540dca0add95b50d1b6
71b9ada8111b45567ddc2aab72f3497a9a006de6
refs/heads/master
2023-07-19T12:58:38.581149
2015-04-27T06:42:54
2015-04-27T06:42:54
93,726,621
0
0
NOASSERTION
2023-07-09T16:37:28
2017-06-08T08:40:33
HTML
UTF-8
Java
false
false
1,220
java
package controllers; import java.util.ArrayList; import play.libs.F.Callback; import play.libs.F.Callback0; import play.libs.Json; import play.mvc.WebSocket; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; public class WS { public static ArrayList<WebSocket.Out<JsonNode>> channels = new ArrayList<WebSocket.Out<JsonNode>>(); public static WebSocket<JsonNode> socket = new WebSocket<JsonNode>() { // called when the websocket is established @Override public void onReady(WebSocket.In<JsonNode> in, WebSocket.Out<JsonNode> out) { channels.add(out); // When the message come. in.onMessage(new Callback<JsonNode>() { @Override public void invoke(JsonNode event) { } }); // When the socket is closed. in.onClose(new Callback0() { @Override public void invoke() { ObjectNode event = Json.newObject(); event.put("connection", "disconnected"); } }); ObjectNode event = Json.newObject(); event.put("connection", "estabilished"); out.write(event); } }; public static void send(JsonNode event) { for (WebSocket.Out<JsonNode> channel : channels) { channel.write(event); } } }
[ "balancy@localhost" ]
balancy@localhost
42af486d2b7f5ce81da1d7f5b5b319407650b029
5a448ddbefa3392fce47fa582a1c6d3c4c0e3885
/src/entity_dm/Admin.java
fbe82225951eb8fed81e4e789fc2cac4bd9c476f
[]
no_license
Abdallah-Sobehy/MailBox_Project
19b0f98bf7863e7d4d3553dacc06469f1e9b12cd
9fde93ee67b4a97c5ac1ec76edd3d78557bdf39e
refs/heads/master
2021-01-17T07:14:58.291217
2016-05-28T12:35:41
2016-05-28T12:35:41
43,646,444
0
1
null
2016-05-28T12:35:41
2015-10-04T18:03:46
Java
UTF-8
Java
false
false
1,465
java
/** * The entity package contains the objects of the program */ package entity_dm; import javax.persistence.*; /** * The Admin class inherits MailUser class. This type of user is able to: * Create a new user, set rights for user, delete users */ @Entity @Table(name="MAILUSER") @DiscriminatorValue("admin") public class Admin extends MailUser { /** Empty Constructor*/ public Admin(){} /** * Constructor initializes an admin user * Assigns the rights of the admin * @param name name of the admin */ public Admin(String name, String pword) { super(name,pword); setUserRights("admin"); } /** * Creates a new user and assigns a private mailbox to the user * sends the new user info to the Directory Manager to store it to the database * @param name name of the new user * @param rights the rights of the user: "admin, bcast, or normal" * @return user object. */ public MailUser create_user(String name,String pword, String rights) { MailUser user = new MailUser(name,pword); set_rights(user,rights); return user; } /** * Assigns rights to a user * @param rights the created user is either "admin, bcast, or normal" */ public void set_rights(MailUser user,String rights) { if (!(rights.equals("normal")) && !(rights.equals("bcast")) && !(rights.equals("admin"))) { System.out.println("Invalid user rights, Rights will be forced to normal."); rights = "normal"; } user.setUserRights(rights); } }
93b70a05c97509a08a7ed1178ac9b3ec594ad409
d05fdd18082f6c3b6c721f5c07aa9c7a5d32e16a
/src/interfejsy/Main.java
582cc4bb83d08698dc4dc8e996ccf61d506d47fd
[]
no_license
KamilCiepiela/JavaCourse
339c5466e142e92d9973aaf10a022976afab6f84
7dfd773927e3656c28ee1f6d849fc584c85e57f2
refs/heads/master
2020-07-01T21:39:30.222548
2020-01-08T14:29:41
2020-01-08T14:29:41
201,309,928
0
0
null
null
null
null
UTF-8
Java
false
false
3,002
java
package interfejsy; import javax.sound.midi.Soundbank; import java.text.Collator; import java.util.Arrays; import java.util.Collections; public class Main { public static void main(String[] args) { // nazwaInterfejsu a = new Pracownik(); // ((Pracownik)a).getWynagrodzenie(); // downcasting - rzutowanie do klasy implementującej interfejs, aby dostać się do metod System.out.println(nazwaInterfejsu.PI); int[] tab = new int[3]; tab[0] = 3; tab[1] = -5; tab[2] = 13; Arrays.sort(tab); System.out.println(tab[0]); Pracownik[] pracownik = new Pracownik[3]; pracownik[0] = new Pracownik(10000); pracownik[1] = new Pracownik(1000); pracownik[2] = new Pracownik(5000); System.out.println("Przed sortowaniem: "); for (Pracownik p: pracownik) { System.out.println(p.getWynagrodzenie()); } System.out.println(pracownik[0].compareTo(pracownik[1])); System.out.println(); // Arrays.sort(pracownik); //wymagane jest, aby zaimplementować intefejs Comperable w klasach, które mają korzystać z metody sort Arrays.sort(pracownik, Collections.reverseOrder()); //sortowanie malejąco; domyślnie jest rosnąco // System.out.println(pracownik[0].getWynagrodzenie()); System.out.println("Po sortowaniu: "); for (Pracownik p: pracownik) { System.out.println(p.getWynagrodzenie()); } System.out.println(pracownik[0].compareTo(pracownik[1])); } } interface nazwaInterfejsu { double PI = 3.14; //public (dostępna wszędzie, z innych pakunków) static (dostępne zawsze) final (stałe i niezmienne) void cos(); //public (dostępna wszędzie, z innych pakunków) abstract (musi zostać nadpisana w klasie, która będzie ją implementować) } interface cosik { } class Pracownik implements nazwaInterfejsu, cosik, Comparable //wymagane jest, aby zaimplementować intefejs Comperable w klasach, które mają korzystać z metody sort /* od razu musimy zaimplementować wszystkie metody interfejsu (abstrakcyjne) można implementować więcej niż 1 interfejs */ { @Override public void cos() { } Pracownik(double wynagrodzenie) { this.wynagrodzenie = wynagrodzenie; } public double getWynagrodzenie() { return this.wynagrodzenie; } private double wynagrodzenie; @Override public int compareTo(Object o) { Pracownik przyslany = (Pracownik)o; if (this.wynagrodzenie < przyslany.wynagrodzenie) return -1; //jak jest return to funkcja wychodzi z instrukcji warunkowej if (this.wynagrodzenie > przyslany.wynagrodzenie) return 1; return 0; } } // //class Programista extends Pracownik // ale rozszerzać możesz tylko JEDNĄ klasę //{ // //wymaga konstruktora w klasie, którą klasa Pracownik rozszerza //}
09969436ac20ae2f9ab02fe9cb9105d8283ac0a1
749d9f90a262bf0b41d00018e5fd9ef8eef59f2a
/ decimal to octal/Main.java
1e63d83bd8d797298ff7208296e007cb1e7651a4
[]
no_license
adithyasaiselva/Playground
0fdc08c951b1a76625fd2984240021a27949be42
a97b6eca760fdd5e4a48751f720dba1ac11e0e7f
refs/heads/master
2020-06-05T02:17:14.571860
2019-08-01T10:17:50
2019-08-01T10:17:50
192,279,064
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
#include<iostream> using namespace std; int main() { int n,a[60]; cin>>n; int i=0; while(n!=0) { a[i]=n%8; n=n/8; i++; } for(int j=i-1;j>=0;j--) cout<<a[j]; return 0; }
89fd9d20795a388e0fa80773d3b7195647357f62
1ebd71e2179be8a2baec90ff3f326a3f19b03a54
/hybris/bin/modules/web-content-management-system/cmsfacades/testsrc/de/hybris/platform/cmsfacades/catalogversions/impl/DefaultCatalogVersionFacadeTest.java
2eadc57d6669fd1a101405b276518ea6c61557d2
[]
no_license
shaikshakeeb785/hybrisNew
c753ac45c6ae264373e8224842dfc2c40a397eb9
228100b58d788d6f3203333058fd4e358621aba1
refs/heads/master
2023-08-15T06:31:59.469432
2021-09-03T09:02:04
2021-09-03T09:02:04
402,680,399
0
0
null
null
null
null
UTF-8
Java
false
false
2,686
java
/* * Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.cmsfacades.catalogversions.impl; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import de.hybris.bootstrap.annotations.UnitTest; import de.hybris.platform.catalog.CatalogVersionService; import de.hybris.platform.catalog.model.CatalogVersionModel; import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException; import de.hybris.platform.cmsfacades.catalogversions.service.PageDisplayConditionService; import de.hybris.platform.cmsfacades.data.CatalogVersionData; import de.hybris.platform.cmsfacades.data.DisplayConditionData; import de.hybris.platform.servicelayer.dto.converter.Converter; import java.util.Arrays; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @UnitTest @RunWith(MockitoJUnitRunner.class) public class DefaultCatalogVersionFacadeTest { private static final String CATALOG_ID = "test-catalog-id"; private static final String VERSION_ID = "test-version-id"; @InjectMocks private final DefaultCatalogVersionFacade catalogVersionFacade = new DefaultCatalogVersionFacade(); @Mock private Converter<CatalogVersionModel, CatalogVersionData> catalogVersionConverter; @Mock private CatalogVersionService catalogVersionService; @Mock private PageDisplayConditionService displayConditionService; @Mock private DisplayConditionData displayConditionData; @Mock private CatalogVersionModel catalogVersionModel; private CatalogVersionData catalogVersionData; @Before public void setUp() { catalogVersionData = new CatalogVersionData(); when(catalogVersionConverter.convert(catalogVersionModel)).thenReturn(catalogVersionData); when(catalogVersionService.getCatalogVersion(CATALOG_ID, VERSION_ID)).thenReturn(catalogVersionModel); } @Test public void shouldGetCatalogVersion() throws CMSItemNotFoundException { when(displayConditionService.getDisplayConditions()).thenReturn(Arrays.asList(displayConditionData)); catalogVersionData = catalogVersionFacade.getCatalogVersion(CATALOG_ID, VERSION_ID); verify(catalogVersionService).getCatalogVersion(CATALOG_ID, VERSION_ID); verify(displayConditionService).getDisplayConditions(); } @Test(expected = CMSItemNotFoundException.class) public void shouldFailGetCatalogVersion_CatalogVersionNotFound() throws CMSItemNotFoundException { when(catalogVersionService.getCatalogVersion(CATALOG_ID, VERSION_ID)).thenReturn(null); catalogVersionFacade.getCatalogVersion(CATALOG_ID, VERSION_ID); } }
de8439963eed465e50e94d1e1e300696ff63ee47
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/actorapp--actor-platform/0f8b6348c0762b694cfa968f81954bb261e846d0/before/SecuritySettingsFragment.java
b7d125fc3282c7d36af4427a405fa2bab4840f53
[]
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
7,172
java
package im.actor.messenger.app.fragment.settings; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import im.actor.messenger.R; import im.actor.messenger.app.fragment.BaseFragment; import im.actor.model.api.AuthHolder; import im.actor.model.api.AuthSession; import im.actor.model.concurrency.CommandCallback; import static im.actor.messenger.app.core.Core.messenger; /** * Created by ex3ndr on 09.10.14. */ public class SecuritySettingsFragment extends BaseFragment { private TextView loading; private LinearLayout authItems; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fr_settings_encryption, container, false); loading = (TextView) res.findViewById(R.id.loading); loading.setVisibility(View.GONE); loading.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { performLoad(); } }); authItems = (LinearLayout) res.findViewById(R.id.authItems); res.findViewById(R.id.terminateSessions).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(getActivity()) .setMessage(R.string.security_terminate_message) .setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { execute(messenger().terminateAllSessions(), R.string.progress_common, new CommandCallback<Boolean>() { @Override public void onResult(Boolean res) { performLoad(); } @Override public void onError(Exception e) { performLoad(); Toast.makeText(getActivity(), "Unable to remove auth", Toast.LENGTH_SHORT) .show(); } }); } }) .setNegativeButton(R.string.dialog_no, null) .show() .setCanceledOnTouchOutside(true); } }); performLoad(); return res; } private void performLoad() { loading.setText("Loading..."); loading.setClickable(true); showView(loading, false); executeSilent(messenger().loadSessions(), new CommandCallback<List<AuthSession>>() { @Override public void onResult(List<AuthSession> res) { goneView(loading, false); authItems.removeAllViews(); ArrayList<AuthSession> items = new ArrayList<AuthSession>(res); Collections.sort(items, new Comparator<AuthSession>() { @Override public int compare(AuthSession lhs, AuthSession rhs) { return rhs.getAuthTime() - lhs.getAuthTime(); } }); for (final AuthSession item : items) { if (getActivity() == null) return; View view = getActivity().getLayoutInflater().inflate(R.layout.adapter_auth, authItems, false); boolean isThisDevice = item.getAuthHolder() == AuthHolder.OTHERDEVICE; String deviceTitle = (isThisDevice ? "(This) " : "") + item.getDeviceTitle(); ((TextView) view.findViewById(R.id.date)).setText(messenger().getFormatter().formatShortDate(item.getAuthTime() * 1000L)); ((TextView) view.findViewById(R.id.appTitle)).setText(item.getAppTitle()); ((TextView) view.findViewById(R.id.deviceTitle)).setText(deviceTitle); if (!isThisDevice) { view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(getActivity()) .setMessage("Are you sure want to logout " + item.getDeviceTitle() + " device? All data will be lost on this device.") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { execute(messenger().terminateSession(item.getId()), R.string.progress_common, new CommandCallback<Boolean>() { @Override public void onResult(Boolean res) { performLoad(); } @Override public void onError(Exception e) { Toast.makeText(getActivity(), "Unable to remove auth", Toast.LENGTH_SHORT).show(); performLoad(); } }); } }) .setNegativeButton("No", null) .show() .setCanceledOnTouchOutside(true); } }); } authItems.addView(view); } } @Override public void onError(Exception e) { loading.setText("Unable to load. Press to try again."); loading.setClickable(true); showView(loading, false); } }); } }
7f982dca10fd5fc55b1909e03c1d39e6894a815a
e61a99c7aad06184dccc0c872c38fe7e936a310d
/src/main/java/com/chainsys/ldm/bookList/BookListDAO.java
96997f8887828610bbba94ca1e14e6a9f2c01dfe
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
csys-fresher-batch-2019/libraryapp-chinraj
858f21bbff1b887eb2411386a64545095ede1e61
9bbab9319a5e091476fc57e5f528649c13c204b4
refs/heads/master
2020-12-28T05:45:33.780632
2020-02-17T09:15:52
2020-02-17T09:15:52
238,201,252
0
0
MIT
2020-10-13T19:16:52
2020-02-04T12:31:32
Java
UTF-8
Java
false
false
237
java
package com.chainsys.ldm.bookList; import java.util.ArrayList; public interface BookListDAO { int addBooks(BookList books); int removeBooks(BookList isbn); public java.util.List<BookList> viewBooks(); public ArrayList<BookList> list(); }
57be65582a82701e0e6eaba1d3f5bde7cb0c9e16
32b6bce1df9211b8686602a07dc18d2f8f5dd908
/netty-websocket/src/main/java/org/cn/monkey/netty/ProtoWebSocketHandler.java
c520d6f285e57124bcddbaf2714063950462de3e
[ "Apache-2.0" ]
permissive
F-Monkey/webRTC-Netty
84b23b1482dc7a48317503b7deae04c017e77b4f
c443fa3b094543d3fced002cb6bb7a7677439c49
refs/heads/master
2022-12-10T14:55:58.443729
2020-09-09T16:14:09
2020-09-09T16:14:09
292,825,066
5
0
null
null
null
null
UTF-8
Java
false
false
2,749
java
package org.cn.monkey.netty; import com.google.protobuf.InvalidProtocolBufferException; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; import org.cn.monkey.cmd.proto.Command; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; @ChannelHandler.Sharable public class ProtoWebSocketHandler extends SimpleChannelInboundHandler<BinaryWebSocketFrame> { private static final Logger log = LoggerFactory.getLogger(ProtoWebSocketHandler.class); private final List<Filter> filters; private final Dispatcher dispatcher; public ProtoWebSocketHandler(List<Filter> filters, Dispatcher dispatcher) { this.filters = filters; this.dispatcher = dispatcher; } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { log.info("get connection from: {}", ctx.channel().remoteAddress()); } private Session initSession(ChannelHandlerContext ctx) { Session session; Channel channel = ctx.channel(); if (channel.hasAttr(Session.KEY)) { session = channel.attr(Session.KEY).get(); } else { session = new NettyWebSocketSession(ctx); channel.attr(Session.KEY).set(session); } return session; } @Override protected void channelRead0(ChannelHandlerContext ctx, BinaryWebSocketFrame frame) { ByteBuf content = frame.content(); byte[] bytes = new byte[content.readableBytes()]; content.readBytes(bytes); Session session = this.initSession(ctx); Command.Cmd cmd; try { cmd = Command.Cmd.parseFrom(bytes); log.info("pkg.cmdType:{}", cmd.getCmdType()); } catch (InvalidProtocolBufferException e) { session.send("error"); log.error("can not parse content", e); return; } boolean needDispatch = true; if (this.filters != null && this.filters.size() > 0) { for (Filter filter : this.filters) { if (!filter.filter(session, cmd)) needDispatch = false; } } if (needDispatch) { if (this.dispatcher != null) { this.dispatcher.dispatch(session, cmd); return; } } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { log.error("handle error:\n", cause); ctx.close(); } }
44c2da9056259285357f481e8e4483bbf51e5628
75b8c676e33cdccbbba86eddf6acccfa20c43fd9
/Ptolemy/ptolemy/codegen/c/actor/lib/Gaussian.java
ce513dfccd70053d4d56de5db43c749bea8995be
[ "MIT-Modern-Variant" ]
permissive
sf577/Project
6538af5228ad0eac94bc495b0089b144f4503189
adfd2f369a29250a9f4fb3f579f80ce5ec0140d7
refs/heads/master
2021-01-23T07:26:58.590441
2013-04-18T23:35:36
2013-04-18T23:35:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,426
java
/* A helper class for actor.lib.Gaussian @Copyright (c) 2005-2006 The Regents of the University of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. PT_COPYRIGHT_VERSION_2 COPYRIGHTENDKEY */ package ptolemy.codegen.c.actor.lib; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; import ptolemy.kernel.util.IllegalActionException; /** * A helper class for ptolemy.actor.lib.Gaussian. * * @author Man-Kit Leung * @version $Id: Gaussian.java,v 1.32 2006/05/09 21:39:35 cxh Exp $ * @since Ptolemy II 6.0 * @Pt.ProposedRating Green (mankit) * @Pt.AcceptedRating Green (mankit) */ public class Gaussian extends RandomSource { /** * Construct a Gaussian helper. * * @param actor * the associated actor */ public Gaussian(ptolemy.actor.lib.Gaussian actor) { super(actor); } /** * Generate shared code. Read from Gaussian.c, replace macros with their * values and return the processed code string. * * @return The processed code string. * @exception IllegalActionException * If the code stream encounters an error in processing the * specified code block(s). */ public Set getSharedCode() throws IllegalActionException { // LinkedHashSet gives order to the insertion. The order of code block // is important here because gaussianBlock uses code from the other // shared code blocks. Set sharedCode = new LinkedHashSet(); sharedCode.addAll(super.getSharedCode()); // gaussianBlock is from the RandomSource parent class. sharedCode.add(_generateBlockCode("gaussianBlock")); return sharedCode; } /** * Get the files needed by the code generated for the Gaussian actor. * * @return A set of Strings that are names of the files needed by the code * generated for the Gaussian actor. * @exception IllegalActionException * Not Thrown in this subclass. */ public Set getHeaderFiles() throws IllegalActionException { Set files = new HashSet(); files.addAll(super.getHeaderFiles()); files.add("<math.h>"); return files; } // ///////////////////////////////////////////////////////////////// // // protected methods //// /** * Generate code for producing a new random number. * * @exception IllegalActionException * Not thrown in this base class. */ protected String _generateRandomNumber() throws IllegalActionException { return _generateBlockCode("randomBlock"); } }
2b7d29f6014c03a10bd5be80fe95138a25df6545
6aad201bb109761d5ebcd06f016b84ce6e4908b1
/herd-code/herd-service/src/main/java/org/finra/herd/service/IndexSearchService.java
7df8e08b0e0dd83f0651c211375a1b54e5375a40
[ "Apache-2.0" ]
permissive
kusid/herd
c95d211613da02e8f63e3f10eb692d40330178b9
a37768f7f968eb9b18649a1669810bd56071f7e2
refs/heads/master
2020-05-29T11:50:41.171454
2017-10-25T17:15:20
2017-10-25T17:15:20
43,909,041
0
0
null
2015-10-08T18:37:39
2015-10-08T18:37:39
null
UTF-8
Java
false
false
1,565
java
/* * Copyright 2015 herd 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.finra.herd.service; import java.util.Set; import org.finra.herd.model.api.xml.IndexSearchRequest; import org.finra.herd.model.api.xml.IndexSearchResponse; /** * IndexSearchService */ public interface IndexSearchService { /** * The index indexSearch method will take as parameters an index indexSearch request that contains a indexSearch term string, and a set of field strings. * It will perform an index indexSearch on the indexSearch term and return the fields specified in the index indexSearch response. * * @param request the index indexSearch request that contains a indexSearch term string * @param fields the set of fields that are to be returned in the index indexSearch response * * @return an index indexSearch response object containing the total index indexSearch results and index indexSearch results */ IndexSearchResponse indexSearch(final IndexSearchRequest request, final Set<String> fields); }
125589255d372ffaa0a9c90d1957c7b22595490c
a5f4c3f6c302c1ad4e3d510893eebf1435ee3836
/app/src/main/java/com/jujinziben/duty/util/ClipboardUtils.java
c0d1a045e63e2b009d4cd6a730234f0f3bf0e26f
[]
no_license
andShine/duty_android
6c9c1c694265fee544407fd166e47425409d800c
efc14a15fa2ea1725b36c139664d38f04e043ea9
refs/heads/master
2021-06-24T17:23:46.581381
2017-09-11T03:47:19
2017-09-11T03:47:19
103,081,622
2
0
null
null
null
null
UTF-8
Java
false
false
2,309
java
package com.jujinziben.duty.util; import android.annotation.TargetApi; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.os.Build; /** * @author MaTianyu @http://litesuits.com * @date 2015-08-25 */ public class ClipboardUtils { public static void copyToClipboardSupport(Context context, String text) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(text); } public static void getLatestTextSupport(Context context) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.getText(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void copyToClipboard(Context context, String text) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText(null, text)); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static int getItemCount(Context context) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData data = clipboard.getPrimaryClip(); return data.getItemCount(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static String getText(Context context, int index) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip != null && clip.getItemCount() > index) { return String.valueOf(clip.getItemAt(0).coerceToText(context)); } return null; } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static String getLatestText(Context context) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip != null && clip.getItemCount() > 0) { return String.valueOf(clip.getItemAt(0).coerceToText(context)); } return null; } }
104b91cde28ae99c713cb944a470af26c9e1943f
759f5996d6a7f2335f3637adac4eaaa0b128ad7d
/boxes/src/practice2boxesclasses/box.java
7e42a51ab3f4b12752e599cd00da337cf6d75b85
[]
no_license
SyedZubairQadri/my-java-learning-projects
e7e885ca084c3bef3c858d12f5a39ce4eb45c8d3
a375370e2d70f63807a6c4a9805114500b6ef1fa
refs/heads/master
2021-01-17T17:24:49.988242
2016-06-28T20:54:58
2016-06-28T20:54:58
62,173,596
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package practice2boxesclasses; /** * Created by Nexus on 6/11/2016. */ public class box { int length; int width ; void calculateArea(){ int Area = length *width; System.out.println("Total Area is" + Area); } }
3b50e89d61f4e0a4320c7e6da4396da06175f45f
0bebade609885f3428730941cd2ba8faa6453ab5
/app/src/main/java/com/myprescriptions/Adapter/DetailsAdapter.java
957d8fade5f2712e3f35cca3d1610800fe550973
[]
no_license
anandhamurthy/MyPrescriptions
e15d672cd23e4d68ad83fcd7db1f5248d3ef812a
3f77f6169988d3c4ddec322a237d1b949c71a77e
refs/heads/master
2021-04-23T22:58:37.389574
2020-09-24T14:48:32
2020-09-24T14:48:32
250,026,058
1
0
null
null
null
null
UTF-8
Java
false
false
2,113
java
package com.myprescriptions.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.google.firebase.auth.FirebaseAuth; import com.myprescriptions.R; import com.myprescriptions.models.Med; import java.util.List; public class DetailsAdapter extends RecyclerView.Adapter<DetailsAdapter.ImageViewHolder> { private Context mContext; private List<Med> DetailsList; private FirebaseAuth mAuth; public DetailsAdapter(Context context, List<Med> list) { mContext = context; DetailsList = list; } @Override public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.single_prescription_row, parent, false); return new ImageViewHolder(view); } @Override public void onBindViewHolder(@NonNull final ImageViewHolder holder, final int position) { Med med = DetailsList.get(position); holder.Name.setText(med.getName()); holder.AfterNoon.setText(med.getAft()); holder.Evening.setText(med.getEve()); holder.Morning.setText(med.getMor()); holder.Night.setText(med.getNig()); holder.Quantity.setText(med.getQuantity()); } @Override public int getItemCount() { return DetailsList.size(); } public class ImageViewHolder extends RecyclerView.ViewHolder { private TextView Name, Quantity, Morning, AfterNoon, Evening, Night; public ImageViewHolder(View itemView) { super(itemView); Name=itemView.findViewById(R.id.name); Quantity=itemView.findViewById(R.id.quantity); Morning=itemView.findViewById(R.id.morning); AfterNoon=itemView.findViewById(R.id.afternoon); Evening=itemView.findViewById(R.id.evening); Night=itemView.findViewById(R.id.night); } } }
bf227af80d5aef38eb437b055c40f9be2691eba3
ee8a774abc894a83f9b191cffae8edb603674ae9
/src/test/java/textmining/RemoveNumberTest.java
966cb0508924b5870295780cfd2fb94cd50fb13d
[]
no_license
LeonardoScalabrini/tcc-bigdata-datascience
79b93abc3146c72e0d219a0e513aa11e9b54d7f1
ef9e3ef7a73bdc7e790fc16768620f3a3a671917
refs/heads/master
2022-06-28T10:46:27.264475
2022-01-28T15:19:37
2022-01-28T15:19:37
204,209,437
0
0
null
2022-06-27T17:27:49
2019-08-24T20:31:24
Java
UTF-8
Java
false
false
469
java
package textmining; import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertTrue; public class RemoveNumberTest { private final RemoveNumber removeNumber = new RemoveNumber(); @Test public void deveRemoverNumeros(){ List<String> removed = removeNumber.remove(new ArrayList<>(Arrays.asList("1", "3.52", "5.0", "5"))); assertTrue(removed.isEmpty()); } }
66078f2a951d3aba7d15645cf7687fd46cc16b51
deb47e139696d84d318476d81eb55c06063924b6
/app/src/test/java/com/ifrj/pibic/teclingo/ExampleUnitTest.java
7b046933acd2f0b784d233cf0bcc6e37a850e881
[]
no_license
gurrenPizza/Teclingo
81646f87bf7e4713ed05c70c651484e961b60ef3
61e60ba51891b5526574a5e03958566f019e9665
refs/heads/master
2020-05-07T18:51:13.027467
2019-05-31T15:23:34
2019-05-31T15:23:34
180,786,444
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.ifrj.pibic.teclingo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
32fb04b12e3b37c5c0ce890261b6da32b1f88876
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/codecentric--spring-boot-admin/6fdaf8c181d4273f4a2f2c86a77ced1a79991887/after/ApplicationOperationsTest.java
89a09542b49b23a724dca7627e9912951798dfa5
[]
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
2,753
java
package de.codecentric.boot.admin.web.client; import static java.util.Arrays.asList; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.Serializable; import java.net.URI; import java.util.Map; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import de.codecentric.boot.admin.model.Application; public class ApplicationOperationsTest { private RestTemplate restTemplate = mock(RestTemplate.class); private HttpHeadersProvider headersProvider = mock(HttpHeadersProvider.class); private ApplicationOperations ops = new ApplicationOperations(restTemplate, headersProvider); @Test @SuppressWarnings("rawtypes") public void test_getInfo() { Application app = Application.create("test").withHealthUrl("http://health") .withManagementUrl("http://mgmt").build(); ArgumentCaptor<HttpEntity> requestEntity = ArgumentCaptor.forClass(HttpEntity.class); HttpHeaders headers = new HttpHeaders(); headers.add("auth", "foo:bar"); when(headersProvider.getHeaders(eq(app))).thenReturn(headers); when(restTemplate.exchange(eq(URI.create("http://mgmt/info")), eq(HttpMethod.GET), requestEntity.capture(), eq(Map.class))) .thenReturn(ResponseEntity.ok().body((Map) singletonMap("foo", "bar"))); ResponseEntity<Map<String, Serializable>> response = ops.getInfo(app); assertThat(response.getBody()).containsEntry("foo", "bar"); assertThat(requestEntity.getValue().getHeaders()).containsEntry("auth", asList("foo:bar")); } @Test @SuppressWarnings("rawtypes") public void test_getHealth() { Application app = Application.create("test").withHealthUrl("http://health") .withManagementUrl("http://mgmt").build(); ArgumentCaptor<HttpEntity> requestEntity = ArgumentCaptor.forClass(HttpEntity.class); HttpHeaders headers = new HttpHeaders(); headers.add("auth", "foo:bar"); when(headersProvider.getHeaders(eq(app))).thenReturn(headers); when(restTemplate.exchange(eq(URI.create("http://health")), eq(HttpMethod.GET), requestEntity.capture(), eq(Map.class))) .thenReturn(ResponseEntity.ok().body((Map) singletonMap("foo", "bar"))); ResponseEntity<Map<String, Serializable>> response = ops.getHealth(app); assertThat(response.getBody()).containsEntry("foo", "bar"); assertThat(requestEntity.getValue().getHeaders()).containsEntry("auth", asList("foo:bar")); } }
d79aed7c3bcc0f285aab611ede22d68cfa4cb841
b3537afb99e7a71d730ca2f1b29103a15bce7402
/app/src/main/java/com/versapp/vcard/VCard.java
d8f3bf387c04c87aa19bead705abec56f6f422a6
[]
no_license
willbrazil/versapp
12d65164cac01ed882de9a828c128ce52344bb94
3fb2cd533f38050f120937e2289e22c0f53a00f5
refs/heads/master
2021-05-31T20:10:09.971068
2014-11-04T01:12:46
2014-11-04T01:12:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,150
java
package com.versapp.vcard; /** * Created by william on 21/09/14. */ public class VCard { public static final String NICKNAME_TAG_ITEM = "NICKNAME"; public static final String FULL_NAME_TAG_ITEM = "FN"; public static final String FIRST_NAME_TAG_ITEM = "GIVEN"; public static final String LAST_NAME_TAG_ITEM = "FAMILY"; public static final String USERNAME_TAG_ITEM = "USERNAME"; private String nickname; private String firstName; private String lastName; public VCard(String firstName, String lastName) { this.nickname = firstName; this.setFirstName(firstName); this.setLastName(lastName); } public VCard() { } public String getNickName() { return this.nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getFirstName() { if (firstName == null) { return ""; } return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { if (lastName == null) { return ""; } return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Override public String toString() { StringBuilder xmlProperties = new StringBuilder(); xmlProperties.append(String.format("<%s>%s</%s>", FULL_NAME_TAG_ITEM, String.format("%s %s", this.firstName, this.lastName), FULL_NAME_TAG_ITEM)); xmlProperties.append("<N>"); xmlProperties.append(String.format("<%s>%s</%s>", FIRST_NAME_TAG_ITEM, this.getFirstName(), FIRST_NAME_TAG_ITEM)); xmlProperties.append(String.format("<%s>%s</%s>", LAST_NAME_TAG_ITEM, this.getLastName(), LAST_NAME_TAG_ITEM)); xmlProperties.append("</N>"); xmlProperties.append(String.format("<%s>%s</%s>", NICKNAME_TAG_ITEM, this.nickname, NICKNAME_TAG_ITEM)); return xmlProperties.toString(); } public String getFullName() { return String.format("%s %s", getFirstName(), getLastName()); } }
88596e9473897d40a8ea6347b6fdfaef5d9aaa16
813a54d365ee7fd53f41631d941b22e3447d0c54
/src/main/java/cn/wolfcode/crm/web/controller/SystemLogController.java
c2b0df3a64d516a194ba4091764973d1a184bc34
[]
no_license
VictorDon1030/crm
4df7b7a9b3b325ac87b3410afbfd51549463370d
67a424fd21fecfd0dde15252bd00d7e4f843258c
refs/heads/master
2020-03-07T17:49:27.247880
2018-04-01T08:45:38
2018-04-01T08:45:38
127,621,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package cn.wolfcode.crm.web.controller; import cn.wolfcode.crm.query.SystemLogQuery; import cn.wolfcode.crm.service.ISystemLogService; import cn.wolfcode.crm.util.PageResult; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * Demo class * * @author user * @date yyyy/MM/dd */ @Controller @RequestMapping("systemLog") public class SystemLogController { @Autowired ISystemLogService systemLogService; @RequestMapping("selectAll") @ResponseBody public Object selectAll(){ return systemLogService.selectAll(); } @RequestMapping("view") @RequiresPermissions(value={"systemLog:view","部门列表"},logical = Logical.OR) public String view(){ return "systemLog"; } @RequestMapping("list") @ResponseBody public PageResult list(SystemLogQuery qo){ return systemLogService.query(qo); } }
7a2118c5efc3d602c6f4675fa2c918a9e3b2417a
7d0f8ede58844d374ab7b922ad6254ae93cbadf7
/ExceptionExamples (2)/src/FileExam.java
aa795d41b65df603b5dc87a7df54fa056a2c98be
[]
no_license
youngha20104/tutorial
8542410f8bad1aea3e2a864090ce6a20c7409cfc
980e54b2cf5c02a8593bc16b4ef9fa2663877b74
refs/heads/master
2021-04-26T22:11:21.663746
2018-05-25T02:02:20
2018-05-29T04:40:00
124,359,322
0
1
null
null
null
null
UTF-8
Java
false
false
421
java
import java.io.FileReader; import java.io.FileWriter; public class FileExam { public static void main(String[] args) { try { @SuppressWarnings("resource") FileReader fr = new FileReader("datar.txt"); @SuppressWarnings("resource") FileWriter fw = new FileWriter("dataw.txt"); int c; while((c = fr.read())!= -1) { fw.write(c); } } catch(Exception e) {System.out.println(e.toString()); } } }
2bfe9b541f8e706714a228c8e5d31d3cd9778aae
e70123c2640dda33f7bcbd7a9df3c317ac36eeaa
/Unit FourA/src/com/bayviewglen/daytwo/ExampleThree.java
b622f66ad9c348fad28a2e7d15e0bbe35d7571b0
[]
no_license
caitlynmei/ICS3U
e58987289aa7b70b6ca899570a8244b7a9c67f81
48e6d315edcd62f656022c937ca2fae51ae9a1d4
refs/heads/master
2020-12-25T14:32:50.746713
2017-05-15T01:45:47
2017-05-15T01:45:47
67,826,820
3
0
null
null
null
null
UTF-8
Java
false
false
689
java
package com.bayviewglen.daytwo; import java.util.Scanner; public class ExampleThree { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Please enter width and height of the box: "); int width = scanner.nextInt(); int height = scanner.nextInt(); for (int i=1; i<=width; i++){ System.out.print('*'); } System.out.println(); for (int j=1; j<=height-2; j++){ System.out.print('*'); for (int k=1; k<=width-2; k++){ System.out.print(' '); } System.out.println('*'); } for (int i=1; i<=width; i++){ System.out.print('*'); } System.out.println(); } }
e09d7be855d88203779290484ab327ccb5f7fa9c
cdead6b863004fd05e07bbaa409734d790d71d70
/Eleccion.java
b07edbef4e3cda0ef3f3b0cc97594770874d5e22
[]
no_license
programacionDAMVC/dudasExamen12019-20
d17c1d70053500520ce79f885b2f812dd77a9014
2a03c1f429f18d95d69a8b16806f858ecddba785
refs/heads/master
2020-09-18T13:08:20.466075
2019-11-26T09:06:45
2019-11-26T09:06:45
224,147,896
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
import java.util.Scanner; public class Eleccion { public static void main (String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Introduce el nombre de un mes"); String mes = sc.next(); sc.close(); switch (mes.toLowerCase()) { case "febrero" : System.out.printf("%S tiene 28 días%n", mes); break; case "abril" : System.out.printf("%S tiene 30 días%n", mes); break; case "junio" : System.out.printf("%S tiene 30 días%n", mes); break; case "septiembre" : System.out.printf("%S tiene 30 días%n", mes); break; case "noviembre" : System.out.printf("%S tiene 30 días%n", mes); break; default: System.out.printf("%S tiene 31 días%n", mes); break; } } }
e1efa175d00a6df6a18b8d5747dc81287a60d946
263b9556d76279459ab9942b0005a911e2b085c5
/src/main/java/com/alipay/api/domain/FengdieActivityCreatePagesData.java
25d1fd8c7c44fd610c5577ae70203b97e1fb8931
[ "Apache-2.0" ]
permissive
getsgock/alipay-sdk-java-all
1c98ffe7cb5601c715b4f4b956e6c2b41a067647
1ee16a85df59c08fb9a9b06755743711d5cd9814
refs/heads/master
2020-03-30T05:42:59.554699
2018-09-19T06:17:22
2018-09-19T06:17:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,857
java
package com.alipay.api.domain; import java.util.List; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; /** * 凤蝶创建站点初始化数据 * * @author auto create * @since 1.0, 2018-05-17 14:44:09 */ public class FengdieActivityCreatePagesData extends AlipayObject { private static final long serialVersionUID = 3862714579245727437L; /** * 指定页面使用的组件,展示顺序和传入的列表顺序一致,一旦使用这个参数,模板中 {% components %} {% endcomponents %} 区域只会显示这里指定的组件 */ @ApiListField("components") @ApiField("fengdie_activity_component_model") private List<FengdieActivityComponentModel> components; /** * 指定模板中页面采用的 schema 数据,默认为 schema 默认数据 */ @ApiListField("page_data") @ApiField("fengdie_activity_schema_model") private List<FengdieActivitySchemaModel> pageData; /** * 模板中页面的路径(相对于项目根目录) */ @ApiField("page_path") private String pagePath; /** * 站点标题,默认为“未命名标题” */ @ApiField("title") private String title; public List<FengdieActivityComponentModel> getComponents() { return this.components; } public void setComponents(List<FengdieActivityComponentModel> components) { this.components = components; } public List<FengdieActivitySchemaModel> getPageData() { return this.pageData; } public void setPageData(List<FengdieActivitySchemaModel> pageData) { this.pageData = pageData; } public String getPagePath() { return this.pagePath; } public void setPagePath(String pagePath) { this.pagePath = pagePath; } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } }
43848f72d188f81e811048c5c1d2a61c1a78d0bf
fa73a8b1bcc252884945ac0ea2237364a58ad522
/src/sml/hashTableDemo/HashTableDemo.java
f297be9bd13f254f924f4b28c573898aadb9bc59
[]
no_license
sunmaolin/searchAlgorithm
91246e77db8679030116cbc0d7b4f8555ca82956
4de32f98fe73fbcd14bf4d7e0931230531981b66
refs/heads/master
2022-12-18T03:03:37.717174
2020-09-25T16:11:13
2020-09-25T16:11:13
289,017,589
1
0
null
null
null
null
UTF-8
Java
false
false
3,719
java
package sml.hashTableDemo; import java.util.Scanner; /** * hashtable就是数组加链表 */ public class HashTableDemo { public static void main(String[] args) { HashTable hashTable = new HashTable(5); while(true){ System.out.println("add,list,find,exit"); Scanner scanner = new Scanner(System.in); String key = scanner.next(); switch (key){ case "add": System.out.println("id:"); int id = scanner.nextInt(); System.out.println("姓名:"); String name = scanner.next(); Emp emp = new Emp(id,name); hashTable.add(emp); continue; case "list": hashTable.list(); continue; case "find": System.out.println("请输入id"); int findId = scanner.nextInt(); hashTable.find(findId); continue; case "exit": scanner.close(); System.exit(1); } } } } //创建HashTable,管理多条链表 class HashTable{ private int size;//表示多少条链表 private EmpLinkedList[] empLinkedLists; public HashTable(int size) { this.size = size; empLinkedLists = new EmpLinkedList[size]; for (int i = 0; i < size; i++) { empLinkedLists[i] = new EmpLinkedList(); } } public void add(Emp emp){//添加 int empLinkedListNo = hashFun(emp.id); empLinkedLists[empLinkedListNo].add(emp); } public void list(){//遍历 for (int i = 0; i < size; i++) { System.out.println("数组"+(i+1)+":"); empLinkedLists[i].list(); } } public void find(int id){//查找 Emp emp = empLinkedLists[hashFun(id)].findById(id); if(emp != null){ System.out.println(emp.toString()); } } public int hashFun(int id){ return id % size; } } //表示雇员 class Emp{ int id; String name; Emp next;//默认为空即可 public Emp(int id, String name) { this.id = id; this.name = name; } @Override public String toString() { return "Emp{" + "id='" + id + '\'' + ", name='" + name + '\'' + '}'; } } //表示链表 class EmpLinkedList{ private Emp head;//首指针 private Emp last;//尾指针 int size = 0; //添加操作 public void add(Emp emp){ if(head == null){ head = emp; last = emp; head.next = last; size++; return; } if(head == last){ head.next = emp; last = emp; size++; return; } last.next = emp; last = emp; size++; } //查找链表 public Emp findById(int id){ if(head == null){ System.out.println("链表为空"); return null; } Emp emp = head; for (int i = 0; i < size; i++) { if(emp.id == id){ return emp; } if(emp.next == last){ System.out.println("未找到"); return null; } emp = emp.next; } return null; } //遍历链表 public void list(){ Emp emp = head; for (int i = 0; i < size; i++) { System.out.println(emp.toString()); emp = emp.next; } } }
18ee27a708725291330d6dea4e191030ca1cfa7b
2f965c6e2ecfee21f9c57d5f68ee00fbdd698064
/Poem-Distillery/src/PoemDistillery.java
3da0178983bddd8865a8fba9631027be22081d86
[]
no_license
m-haris-n/java-projects
e875f6a75d70dbad8c0ed40d729246a7065576b8
e06ac21c2216ad8297b3ee7e8e8f44aaa717d8ef
refs/heads/main
2023-08-24T17:06:04.262029
2021-10-13T18:49:12
2021-10-13T18:49:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class PoemDistillery { private final String PUNCTUATION = ".!?\""; private Scanner scan; private String fileName; private String[] poem; public PoemDistillery(String fileName){ this.fileName = fileName; poem = createPoem(); } public String[] createPoem(){ // Determine number of lines (weighted random between 1-6); int lineNum; int r = (int) (Math.random() * 60); if(r > 54) lineNum = 6; else if(r > 47) lineNum = 5; else if(r > 40) lineNum = 4; else if(r > 30) lineNum = 3; else if(r > 10) lineNum = 2; else lineNum = 1; System.out.println("Line number: "+lineNum); poem = new String[lineNum]; for(int i=0; i<lineNum; i++){ poem[i] = findLine(); } return poem; } // Find sentence to splice public String findLine(){ try { scan = new Scanner(new FileReader(fileName)); } catch (FileNotFoundException e) { e.printStackTrace(); } int r = (int) (Math.random()*5000); for(int i=0; i<r; i++){ if(!scan.hasNext()) return findLine(); scan.nextLine(); } // SHITS BROKEN HERE String line = ""; r = (int) (Math.random()*5); String word = scan.next(); for(int i=0; i<r; i++){ for(char c : word.toCharArray()){ if(PUNCTUATION.indexOf(c) != -1) line+=word; else i--; } } System.out.println("Line: "+line); return line; } public void writePoem(){ } public void printPoem(){ for(String l : poem){ System.out.println(l); } } }
72c55572f256a7045b820703e724275da4a7e4c6
e61766bc08edf045dbeb69f19da76174c7161279
/app/src/main/java/com/jimju/androidutils/widget/recyclerview/SwipeItemClickListener.java
f7d7d2965ed2b4fac0be049bf1c05edf9eabf31e
[]
no_license
jimju/AndroidUtils
8bd0910f4490de48ffea87a15e6f1031ee3327de
236c575ba389044f8042ac27724c43f4c722661d
refs/heads/master
2021-05-03T18:50:54.302013
2018-06-13T09:40:54
2018-06-13T09:40:54
120,416,447
0
0
null
null
null
null
UTF-8
Java
false
false
820
java
/* * Copyright 2017 Yan Zhenjie * * 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.jimju.androidutils.widget.recyclerview; import android.view.View; /** * Created by YanZhenjie on 2017/7/21. */ public interface SwipeItemClickListener { void onItemClick(View itemView, int position); }
ae9c88aae1b20e279c59bf413aba18badb03effb
9fe099e7cc3dbb66b4438effe5bac273274e4e3a
/Express/app/src/main/java/com/bs/express/ui/activity/NewOrderActivity.java
fd173a2f61675a8e78424dfa7f44c3ad2832b634
[]
no_license
nuclearpoi/Express_Application
8fdc0c572e8e779c7af2548d6af7dc92a288abf7
c88e86032010a82f851a82619d957caee2350113
refs/heads/master
2020-05-01T03:19:58.831725
2019-03-26T07:30:16
2019-03-26T07:30:16
177,242,414
0
1
null
null
null
null
UTF-8
Java
false
false
6,029
java
package com.bs.express.ui.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.TextUtils; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.listener.OnTimeSelectListener; import com.bigkoo.pickerview.view.TimePickerView; import com.bmob.express.R; import com.bs.express.base.BaseActivity; import com.bs.express.bean.Address; import com.bs.express.bean.OrderBean; import com.bs.express.bean.UserBean; import java.text.SimpleDateFormat; import java.util.Date; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.SaveListener; public class NewOrderActivity extends BaseActivity implements View.OnClickListener { private EditText et_title; private TextView et_name; private TextView et_phone; private TextView et_address; private EditText et_money; private TextView tv_time; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_release); onSetTitle("New Order"); initView(); } private void initView() { et_title = findViewById(R.id.et_title); et_name = findViewById(R.id.et_name); et_phone = findViewById(R.id.et_phone); et_address = findViewById(R.id.et_address); tv_time = findViewById(R.id.tv_time); et_money = findViewById(R.id.et_money); et_phone.setOnClickListener(this); et_address.setOnClickListener(this); et_name.setOnClickListener(this); Button send = findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String title = et_title.getText().toString(); String name = et_name.getText().toString(); String phone = et_phone.getText().toString(); String address = et_address.getText().toString(); String money = et_money.getText().toString(); String time = tv_time.getText().toString(); if (TextUtils.isEmpty(title)){ onToast("Express number can not be empty"); return; } if (TextUtils.isEmpty(name)){ onToast("name can not be empty"); return; } if (TextUtils.isEmpty(phone)){ onToast("phone can not be empty"); return; } if (TextUtils.isEmpty(address)){ onToast("address can not be empty"); return; } if (TextUtils.isEmpty(money)){ onToast("fee can not be empty"); return; } if (TextUtils.isEmpty(time)){ onToast("deadline can not be empty"); return; } showProgressDialog(NewOrderActivity.this,"loading"); OrderBean orderBean = new OrderBean(); orderBean.setTitle(title); orderBean.setName(name); orderBean.setAddress(address); orderBean.setPhone(phone); orderBean.setTime(time); orderBean.setStatus("1"); orderBean.setMoney(money); orderBean.setUserbean(BmobUser.getCurrentUser(UserBean.class)); orderBean.save(new SaveListener<String>() { @Override public void done(String s, BmobException e) { hidProgressDialog(); if (e==null){ onToast("success"); finish(); }else{ onToast("fail"); } } }); } }); tv_time.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TimePickerView pvTime = new TimePickerBuilder(NewOrderActivity.this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date, View v) { tv_time.setText(getTime(date)); } }) .setType(new boolean[]{true, true, true, true, true, false}) .setLabel("Y","M","D","H","M","") .build(); pvTime.show(); } }); } private String getTime(Date date) {//可根据需要自行截取数据显示 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); return format.format(date); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.et_address: case R.id.et_name: case R.id.et_phone: Intent intent = new Intent(NewOrderActivity.this,AddressListActivity.class); intent.putExtra("type","choose"); startActivityForResult(intent,100); break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode==100&&resultCode==RESULT_OK){ Address address = (Address) data.getSerializableExtra("data"); et_name.setText(address.getName()); et_phone.setText(address.getPhone()); et_address.setText(address.getAddress()); } } }
b08d533e04e608eb8ec04effc54898807fd9fef4
6be4e264330971ee7cba0d2874438e55407c0933
/src/br/unip/models/Analise.java
5ed7e87a12dd38c679d1c444dd7e18e889ee751a
[]
no_license
MatheusAlvesSouza/Desktop-BI-System
f5589d5072211fd773edbec595336e8319fba042
34d224db1f937fcabf2758902879d3ffdded5291
refs/heads/master
2020-03-29T04:40:38.866778
2018-11-25T01:06:06
2018-11-25T01:06:06
149,542,118
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package br.unip.models; public class Analise { private String reserva; private String cidade; private String estado; private int populacao; private int natalidade; private int mortalidade; private int denuncias; public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public String getReserva() { return reserva; } public void setReserva(String reserva) { this.reserva = reserva; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public int getPopulacao() { return populacao; } public void setPopulacao(int populacao) { this.populacao = populacao; } public int getNatalidade() { return natalidade; } public void setNatalidade(int natalidade) { this.natalidade = natalidade; } public int getMortalidade() { return mortalidade; } public void setMortalidade(int mortalidade) { this.mortalidade = mortalidade; } public int getDenuncias() { return denuncias; } public void setDenuncias(int denuncias) { this.denuncias = denuncias; } }
e9674b8fc86a57fd498f7ee39c67beb1a478b3e9
b1c43631dfdbbd13129e699b9e282da11dedb9b3
/testy/src/Sumofdigits.java
f054eab3b35687bc484fa7e18354c64085f43f36
[]
no_license
SavithaKiran/TYSSsavithak
caf2d7802c8cb0ffc8edbbef92f0bfe4a62d14fc
575c18841206b2c0c527399f390656c6dea853ac
refs/heads/master
2021-08-04T08:51:39.148036
2020-05-14T08:51:22
2020-05-14T08:51:22
169,522,227
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
import java.util.Scanner; //sum of the digits of a given number public class Sumofdigits { @SuppressWarnings("resource") public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("Enter the number"); int num = s.nextInt(); int temp = num; int sum=0,n=0; while(num>0) { n=num%10; sum=sum+n; num=num/10; } System.out.println("The sum of the digits of "+temp+" is: "+sum); } }
b06ba9820159cd05ae8fffd5e121fd93c865eee5
f71d9f6517a9a8be12f2fd0c43b751c4d5e95351
/src/main/java/cl/joshone/joshone/search/model/SearchMavenResponse.java
e13675bd583b19f1ad27293d6df7aafdcfbd3482
[]
no_license
joshone/mvn-versions-check
db3a5b1e3627ac1b9feefadd1d83907f5f94817b
f26b0d286403e5875a2e9c76c3cfcfbc67c1df4c
refs/heads/master
2020-06-12T02:45:15.428977
2019-06-27T22:48:12
2019-06-27T22:48:12
194,172,269
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
package cl.joshone.joshone.search.model; public class SearchMavenResponse { private Response response; private ResponseHeader responseHeader; public SearchMavenResponse() { this.response = new Response(); this.responseHeader = new ResponseHeader(); } public SearchMavenResponse(Response response, ResponseHeader responseHeader) { this.response = response; this.responseHeader = responseHeader; } public Response getResponse() { return response; } public void setResponse(Response response) { this.response = response; } public ResponseHeader getResponseHeader() { return responseHeader; } public void setResponseHeader(ResponseHeader responseHeader) { this.responseHeader = responseHeader; } }
957928a3b9de116aa5a3dfb6cae2317a08a19334
59bed3dc6bc049075c989ec1f9357b87e478d82f
/src/main/java/com/informatorio/ecommerce/repository/UsuarioRepository.java
32f8a379858bf6913bd18f2d2d5340ac3d7d15b2
[]
no_license
Sultana02/e-commerce
d50639c591cb94dc614658565889e8b616ad7ef7
84a3dc727e5ded292439079555710d7469281dcc
refs/heads/master
2023-07-23T06:32:09.520907
2021-09-05T21:13:18
2021-09-05T21:13:18
403,409,931
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package com.informatorio.ecommerce.repository; import com.informatorio.ecommerce.domain.Usuario; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; import java.util.List; @Repository public interface UsuarioRepository extends JpaRepository<Usuario, Long> { List<Usuario> findByFechaDeCreacionAfter(LocalDateTime dateTime); List<Usuario> findByFechaDeCreacionBetween(LocalDateTime desde, LocalDateTime hasta); List<Usuario> findByCiudadContaining(String ciudad); }
cc9a2bf7cd8059669bd7c4175b988add27c416ed
49105fefb4ef774caf36f97c03c5bc952004bb90
/app/src/main/java/gmedia/net/id/vasgmediasemarang/menu_history_ts/HistoryTS.java
687d6ee70d293de0ef0234c79ed2526a7649bce0
[]
no_license
BayuW1995/VASGmediaSemarang
9e913d1bc82d5eff1ca9513f182a1925bd733662
64a5962c9edc673c8ab56f73f8fe640183e57b46
refs/heads/master
2020-04-23T14:32:32.724200
2019-11-05T07:36:16
2019-11-05T07:36:16
171,235,271
0
0
null
null
null
null
UTF-8
Java
false
false
3,756
java
package gmedia.net.id.vasgmediasemarang.menu_history_ts; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import android.widget.ListView; import java.util.ArrayList; import gmedia.net.id.vasgmediasemarang.MainActivity; import gmedia.net.id.vasgmediasemarang.R; import gmedia.net.id.vasgmediasemarang.menu_job_daily_ts.JobDailyTS; public class HistoryTS extends AppCompatActivity { private ArrayList<ModelListHistoryTS> list; private ListAdapterHistoryTS adapter; private ListView listView; private String tanggal[] = { "11 januari 2013", "20 januari 2019", "11 januari 2013", "20 januari 2019", "11 januari 2013", "20 januari 2019", "11 januari 2013", "20 januari 2019", }; private String jam[] = { "10.00", "12.00", "10.00", "12.00", "10.00", "12.00", "10.00", "12.00", }; private String nama[] = { "E-Plaza", "Citraland", "E-Plaza", "Citraland", "E-Plaza", "Citraland", "E-Plaza", "Citraland", }; private String alamat[] = { "Gajahmada Plaza Lt.2 Simpang Lima", "Jl. Jendral Sudirman No.294 Semarang", "Jl. Sisinga Mangaraja No.16 Semarang", "Gajahmada Plaza Lt.2 Simpang Lima", "Jl. Jendral Sudirman No.294 Semarang", "Jl. Sisinga Mangaraja No.16 Semarang", "Jl. Jendral Sudirman No.294 Semarang", "Jl. Sisinga Mangaraja No.16 Semarang", }; private String jenis_job[] = { "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", "Instalasi (LAN / Wifi)", }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history_ts); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("History TS"); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.layoutKuning))); if (android.os.Build.VERSION.SDK_INT >= 21) { Window window = HistoryTS.this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(getResources().getColor(R.color.notifBarKuning)); } initUI(); initAction(); } private void initUI() { listView = (ListView) findViewById(R.id.lv_history_ts); } private void initAction() { list = new ArrayList<>(); list = prepareDataHistoryTS(); adapter = new ListAdapterHistoryTS(HistoryTS.this, list); listView.setAdapter(adapter); } private ArrayList<ModelListHistoryTS> prepareDataHistoryTS() { ArrayList<ModelListHistoryTS> rvData = new ArrayList<>(); for (int i = 0; i < tanggal.length; i++) { ModelListHistoryTS model = new ModelListHistoryTS(); model.setTanggal(tanggal[i]); model.setJam(jam[i]); model.setNama(nama[i]); model.setAlamat(alamat[i]); model.setJenis_job(jenis_job[i]); rvData.add(model); } return rvData; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { super.onBackPressed(); MainActivity.posisi = true; } }
f590c58fceaf7b05d09b2813b175a204520ab4cc
3c70742a28e848d002467d375686ab676a859374
/src/test/java/com/bootproj/pmcweb/Service/DateServiceImplTest.java
ac515365288885a787bae4302e98cee62d1e0a75
[]
no_license
pmc-web/pmcFirstWeb
7d4cf87549ad1e95944f0c4f1a68dc9bcca92b8b
47142b58be51a2f70ddf978e23c49adbe7c43710
refs/heads/master
2023-03-06T21:11:04.665440
2021-02-08T08:36:46
2021-02-08T08:36:46
304,723,620
1
1
null
null
null
null
UTF-8
Java
false
false
1,706
java
package com.bootproj.pmcweb.Service; import com.bootproj.pmcweb.Domain.Dates; import com.bootproj.pmcweb.PmcwebApplication; import lombok.extern.log4j.Log4j2; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.Date; import java.util.List; @Log4j2 @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PmcwebApplication.class) class DateServiceImplTest { @Autowired DateService dateService; Dates dates = new Dates().builder().date(new Date()).description(" new study date").studyId(3L).build(); @Test void createDate() { Long result = dateService.createDate(dates); org.assertj.core.api.Assertions.assertThat(result.equals(dates.getId())); } @Test void getDatesList() { List<Dates> list = dateService.getDatesList(3L, "2020", null, null); Assertions.assertThat(list.size()>0); } @Test void getDate() { Dates dates = dateService.getDateById(1L); Assertions.assertThat(dates.getId().equals(1L)); } @Test void updateDate(){ Dates dates = new Dates().builder().id(1L).description("일정 수정합니다").build(); Dates update = dateService.updateDates(dates); Assertions.assertThat(update.getId().equals(dates.getId())); } @Test void deleteDates() { Boolean result = dateService.deleteDates(4L); Assertions.assertThat(result.equals(false)); } }
bec972c8c8e3e631923e6a2a5338280b31c8e4d2
fcea882d49ec69104bafd94d2fe2583932060134
/src/Village.java
e26d87c8bf28e6eeddb51c3a8fb3a7c5532ba6fb
[]
no_license
ttkyle/TWFB
304454d31fd84c72a5fa696c0864ce32c707d309
80f20ceecd3deaff1a3de7ec6fde682ad0ab9680
refs/heads/master
2021-01-16T21:21:13.457127
2012-09-19T14:19:11
2012-09-19T14:19:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
49,704
java
import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.StaleElementReferenceException; import java.io.*; import java.util.Scanner; import static org.apache.commons.lang.StringUtils.substring; /** * The village class holds most of the information for the village * and holds most of the methods that manipulate GUI elements * * The village class will update on the fly when a user selects a * village to manipulate. test */ public class Village { //global variables static public String xLoc; static public String yLoc; static public FileOutputStream fout; static public String villageFileName; static public int numberOfFarms = 1; static public int villageHQWoodCost; static public int villageHQClayCost; static public int villageHQIronCost; static public boolean villageHQHasCost = true; static public int barracksWoodCost; static public int barracksClayCost; static public int barracksIronCost; static public boolean barracksHasCost = true; static public int stableWoodCost; static public int stableClayCost; static public int stableIronCost; static public boolean stableHasCost = true; static public int workShopWoodCost; static public int workShopClayCost; static public int workShopIronCost; static public boolean workShopHasCost = true; static public int smithyWoodCost; static public int smithyClayCost; static public int smithyIronCost; static public boolean smithyHasCost = true; static public int marketWoodCost; static public int marketClayCost; static public int marketIronCost; static public boolean marketHasCost = true; static public int timberWoodCost; static public int timberClayCost; static public int timberIronCost; static public boolean timberHasCost = true; static public int clayWoodCost; static public int clayClayCost; static public int clayIronCost; static public boolean clayHasCost = true; static public int ironWoodCost; static public int ironClayCost; static public int ironIronCost; static public boolean ironHasCost = true; static public int farmWoodCost; static public int farmClayCost; static public int farmIronCost; static public boolean farmHasCost = true; static public int wareHouseWoodCost; static public int wareHouseClayCost; static public int wareHouseIronCost; static public boolean wareHouseHasCost = true; static public int wallWoodCost; static public int wallClayCost; static public int wallIronCost; static public boolean wallHasCost = true; static public int academyWoodCost; static public int academyClayCost; static public int academyIronCost; static public boolean academyHasCost = true; static public int hidingPlaceWoodCost; static public int hidingPlaceClayCost; static public int hidingPlaceIronCost; static public boolean hidingPlaceHasCost = true; static public int currentWood; static public int currentClay; static public int currentIron; static public int currentPopulation; static public int maxPopulation; static public String durationOne; static public double totalOne = 0; static public double totalOneOne; static public double totalOneThird; static public double totalOneFourth; static public double totalOneSixth; static public double totalOneSeventh; static public double totalOneSecond; static public double totalOneEighth; //Constructor to set village name so that we know what to name text files //Also writes the x and y coords for the village to attack Village(String villageName) throws IOException { villageFileName = villageName; fout = new FileOutputStream("C:\\Users\\kyle\\Documents\\Tribalwars\\" + villageFileName + ".txt"); this.writeX(); this.writeY(); numberOfFarms++; } //Reads the lines that you tell it to via startLine and endLine public void readFile(int startLine, int endLine) { int currentLineNo = 0; BufferedReader in = null; try { in = new BufferedReader(new FileReader("C:\\Users\\kyle\\Documents\\Tribalwars\\" + villageFileName + ".txt")); //read to startLine while(currentLineNo < startLine) { if (in.readLine() == null) { //early end throw new IOException("File too small"); } currentLineNo++; } //read until endLine while(currentLineNo <= endLine) { String line = in.readLine(); if (line == null) { return; } System.out.println(line); currentLineNo++; } } catch (IOException ex) { System.out.println("Problem reading file.\n" + ex.getMessage()); } finally { try { if (in!=null) in.close(); } catch(IOException ignore) {} } } //Reads the x coord of a village file public String readX() { this.readFile(0, 0); return xLoc; } //Reads the y coord of a village file public String readY() { this.readFile(1, 1); return yLoc; } //Writes a specified message to the startLine through the endLine //I may need to work on this method so that it won't overwrite another x or y coord if the file is already made public String writeFile(int startLine, int endLine, String msg) throws IOException { int currentLineNo = 0; //Get to start line to start writing while(currentLineNo < startLine) { currentLineNo++; } // Print a line of text while(currentLineNo <= endLine) { new PrintStream(fout).println(msg); currentLineNo++; } return msg; } // Writes the X coord based on user input //This method needs to be made so that it won't overwrite an X coord that is already entered public void writeX() throws IOException { System.out.println("Type x coord, it can only be 3 numbers long."); Scanner userInputXLoc = new Scanner(System.in); xLoc = userInputXLoc.next(); while(xLoc.length() != 3) { System.out.println("Please re-enter x coord."); xLoc = userInputXLoc.next(); } System.out.println(xLoc); writeFile(0, 0, xLoc); } //Writes the Y coord based on user input //This method needs to be made so that it won't overwrite an Y coord that is already entered public void writeY() throws IOException { System.out.println("Type y coord, it can only be 3 numbers long."); Scanner userInputXLoc = new Scanner(System.in); yLoc = userInputXLoc.next(); while(yLoc.length() != 3) { System.out.println("Please re-enter y coord."); yLoc = userInputXLoc.next(); } writeFile(1, 1, yLoc); fout.close(); } //Gets the file names in the tribalwars folder //Eventually need to make a method that goes through every file and pulls the X and Y coord data out //of the text files public void getFileName() { File folder = new File("C:\\Users\\kyle\\Documents\\Tribalwars"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println("File " + listOfFiles[i].getName()); } else if (listOfFiles[i].isDirectory()) { System.out.println("Directory " + listOfFiles[i].getName()); } } } //Sends number of spears to the GUI public static void setSpears() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String spearLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(spearLabel, 2, 7).equals("Spear") || substring(spearLabel, 3, 8).equals("Spear") || substring(spearLabel, 4, 9).equals("Spear") || substring(spearLabel, 5, 10).equals("Spear") || substring(spearLabel, 6, 11).equals("Spear") || substring(spearLabel, 7, 12).equals("Spear")) { TroopsDetailPanel.setSpearLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setSpearLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends number of Swords to the GUI public static void setSwords() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String swordLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(swordLabel, 2, 7).equals("Sword") || substring(swordLabel, 3, 8).equals("Sword") || substring(swordLabel, 4, 9).equals("Sword") || substring(swordLabel, 5, 10).equals("Sword") || substring(swordLabel, 6, 11).equals("Sword") || substring(swordLabel, 7, 12).equals("Sword")) { TroopsDetailPanel.setSwordLabelLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setSwordLabelLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends number of axes to the GUI public static void setAxes() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String axeLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(axeLabel, 1, 4).equals("Axe") || substring(axeLabel, 2, 5).equals("Axe") || substring(axeLabel, 3, 6).equals("Axe") || substring(axeLabel, 4, 7).equals("Axe") || substring(axeLabel, 5, 8).equals("Axe") || substring(axeLabel, 6, 9).equals("Axe") || substring(axeLabel, 7, 10).equals("Axe")) { TroopsDetailPanel.setAxeLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setAxeLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends number of scouts to the GUI public static void setSpies() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String spyLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(spyLabel, 2, 7).equals("Scout") || substring(spyLabel, 3, 8).equals("Scout") || substring(spyLabel, 4, 9).equals("Scout") || substring(spyLabel, 5, 10).equals("Scout") || substring(spyLabel, 6, 11).equals("Scout") || substring(spyLabel, 7, 12).equals("Scout")) { TroopsDetailPanel.setSpyLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setSpyLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends number of light cal to the GUI public static void setLightCal() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String lightCalLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(lightCalLabel, 2, 7).equals("Light") || substring(lightCalLabel, 3, 8).equals("Light") || substring(lightCalLabel, 4, 9).equals("Light") || substring(lightCalLabel, 5, 10).equals("Light") || substring(lightCalLabel, 6, 11).equals("Light") || substring(lightCalLabel, 7, 12).equals("Light")) { TroopsDetailPanel.setLightCalLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setLightCalLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends whether or not the village has a paladin public static void setPaladin() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String paladinLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(paladinLabel, 0, 7).equals("Paladin")) { TroopsDetailPanel.setPaladinLabel("1"); break; } //the troop was not found else { TroopsDetailPanel.setPaladinLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends the number of catapults to the GUI public static void setCatapult() { //loop through all the show unit lines //if the unit name is found then display it on the GUI for(int i = 1; i < 15; i++) { try { String catapultLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_units\"]/div/table/tbody/tr[" + i + "]")).getText(); if(substring(catapultLabel, 2, 10).equals("Catapult") || substring(catapultLabel, 3, 11).equals("Catapult") || substring(catapultLabel, 4, 12).equals("Catapult") || substring(catapultLabel, 5, 13).equals("Catapult") || substring(catapultLabel, 6, 14).equals("Catapult") || substring(catapultLabel, 7, 15).equals("Catapult")) { TroopsDetailPanel.setCatapultLabel(WebAutomation.driver.findElement(By.xpath("//*[@id='show_units']/div/table/tbody/tr[" + i + "]/td/strong")).getText()); break; } //the troop was not found else { TroopsDetailPanel.setCatapultLabel("0"); } } catch(NoSuchElementException e) { } } } //Sends the level of villageHQ to the GUI public static void setVillageHQ() { //loop through the building rows for(int i = 2; i < 20; i++) { try { String villageHQLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); //if the building was found then set the name and level if(substring(villageHQLabel, 0, 7).equals("Village")) { BuildPanel.setVillageHQLabel("Village HQ " + substring(villageHQLabel, 21, 31)); //if the building level is not present then make it level 0 if(substring(villageHQLabel, 21, 31).equals("")) { BuildPanel.setVillageHQLabel("Village HQ (Level 0)"); BuildPanel.setVillageHQButtonTrueOrFalse(false); } break; } //if the building is not found at all make it level 0 else { BuildPanel.setVillageHQLabel("Village HQ (Level 0)"); } } //if the element does not exist on the webpage then it's max level catch(NoSuchElementException e) { BuildPanel.setUpgradeVillageHQLabel("Cannot upgrade"); BuildPanel.setVillageHQButtonTrueOrFalse(false); BuildPanel.setVillageHQLabel("Village max level"); } } } //Sends the level of barracks to the GUI public static void setBarracks() { for(int i = 2; i < 20; i++) { try { String barracksLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(barracksLabel, 0, 8).equals("Barracks")) { BuildPanel.setBarracksLabel("Barracks " + substring(barracksLabel, 9, 20)); if(substring(barracksLabel, 9, 20).equals("")) { BuildPanel.setBarracksLabel("Barracks (Level 0)"); BuildPanel.setBarracksButtonTrueOrFalse(false); } break; } else { BuildPanel.setBarracksLabel("Barracks (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeBarracksLabel("Cannot upgrade"); BuildPanel.setBarracksButtonTrueOrFalse(false); BuildPanel.setBarracksLabel("Barracks max level"); } } } //Sends the level of stable to the GUI public static void setStable() { for(int i = 2; i < 20; i++) { try { String stableLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(stableLabel, 0, 6).equals("Stable")) { BuildPanel.setStableLabel("Stable " + substring(stableLabel, 7, 17)); if(substring(stableLabel, 7, 17).equals("")) { BuildPanel.setStableLabel("Stable (Level 0)"); BuildPanel.setStableButtonTrueOrFalse(false); } break; } else { BuildPanel.setStableLabel("Stable (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeStableLabel("Cannot upgrade"); BuildPanel.setStableButtonTrueOrFalse(false); BuildPanel.setStableLabel("Stable max level"); } } } //Sends the level of workshop to the GUI public static void setWorkShop() { for(int i = 2; i < 20; i++) { try { String workShopLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(workShopLabel, 0, 8).equals("Workshop")) { BuildPanel.setWorkShopLabel("Workshop " + substring(workShopLabel, 9, 19)); if(substring(workShopLabel, 9, 19).equals("")) { BuildPanel.setWorkShopLabel("Workshop (Level 0)"); BuildPanel.setWorkShopButtonTrueOrFalse(false); } break; } else { BuildPanel.setWorkShopLabel("Workshop (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeWorkShopLabel("Cannot upgrade"); BuildPanel.setWorkShopButtonTrueOrFalse(false); BuildPanel.setWorkShopLabel("Workshop max level"); } } } //Sends the level of smithy to the GUI public static void setSmithy() { for(int i = 2; i < 20; i++) { try { String smithyLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(smithyLabel, 0, 6).equals("Smithy")) { BuildPanel.setSmithyLabel("Smithy " + substring(smithyLabel, 7, 17)); if(substring(smithyLabel, 7, 17).equals("")) { BuildPanel.setSmithyLabel("Smithy (Level 0)"); BuildPanel.setSmithyButtonTrueOrFalse(false); } break; } else { BuildPanel.setSmithyLabel("Smithy (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeSmithyLabel("Cannot upgrade"); BuildPanel.setSmithyButtonTrueOrFalse(false); BuildPanel.setSmithyLabel("Smithy max level"); } } } //Sends the level of market to the GUI public static void setMarket() { for(int i = 2; i < 20; i++) { try { String marketLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(marketLabel, 0, 6).equals("Market")) { BuildPanel.setMarketLabel("Market " + substring(marketLabel, 7, 17)); if(substring(marketLabel, 7, 17).equals("")) { BuildPanel.setMarketLabel("Market (Level 0)"); BuildPanel.setMarketButtonTrueOrFalse(false); } break; } else { BuildPanel.setMarketLabel("Market (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeMarketLabel("Cannot upgrade"); BuildPanel.setMarketButtonTrueOrFalse(false); BuildPanel.setMarketLabel("Market max level"); } } } //Sends the level of timber to the GUI public static void setTimber() { for(int i = 2; i < 20; i++) { try { String timberLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(timberLabel, 0, 6).equals("Timber")) { BuildPanel.setTimberLabel("Timber " + substring(timberLabel, 12, 22)); if(substring(timberLabel, 12, 22).equals("")) { BuildPanel.setTimberLabel("Timber (Level 0)"); BuildPanel.setTimberButtonTrueOrFalse(false); } break; } else { BuildPanel.setTimberLabel("Timber (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeTimberLabel("Cannot upgrade"); BuildPanel.setTimberButtonTrueOrFalse(false); BuildPanel.setTimberLabel("Timber max level"); } } } //Sends the level of clay to the GUI public static void setClay() { for(int i = 2; i < 20; i++) { try { String clayLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(clayLabel, 0, 4).equals("Clay")) { BuildPanel.setClayLabel("Clay " + substring(clayLabel, 5, 19)); if(substring(clayLabel, 9, 19).equals("")) { BuildPanel.setClayLabel("Clay (Level 0)"); BuildPanel.setClayButtonTrueOrFalse(false); } break; } else { BuildPanel.setClayLabel("Clay (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeClayLabel("Cannot upgrade"); BuildPanel.setClayButtonTrueOrFalse(false); BuildPanel.setClayLabel("Clay max level"); } } } //Sends the level of iron to the GUI public static void setIron() { for(int i = 2; i < 20; i++) { try { String ironLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(ironLabel, 0, 4).equals("Iron")) { BuildPanel.setIronLabel("Iron " + substring(ironLabel, 5, 20)); if(substring(ironLabel, 10, 20).equals("")) { BuildPanel.setIronLabel("Iron (Level 0)"); BuildPanel.setIronButtonTrueOrFalse(false); } break; } else { BuildPanel.setIronLabel("Iron (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeIronLabel("Cannot upgrade"); BuildPanel.setIronButtonTrueOrFalse(false); BuildPanel.setIronLabel("Iron max level"); } } } //Sends the level of farm to the GUI public static void setFarm() { for(int i = 2; i < 20; i++) { try { String farmLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(farmLabel, 0, 4).equals("Farm")) { BuildPanel.setFarmLabel("Farm " + substring(farmLabel, 5, 15)); if(substring(farmLabel, 5, 15).equals("")) { BuildPanel.setFarmLabel("Farm (Level 0)"); BuildPanel.setFarmButtonTrueOrFalse(false); } break; } else { BuildPanel.setFarmLabel("Farm (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeFarmLabel("Cannot upgrade"); BuildPanel.setFarmButtonTrueOrFalse(false); BuildPanel.setFarmLabel("Farm max level"); } } } //Sends the level of warehouse to the GUI public static void setWarehouse() { for(int i = 2; i < 20; i++) { try { String wareHouseLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(wareHouseLabel, 0, 9).equals("Warehouse")) { BuildPanel.setWareHouseLabel("Warehouse " + substring(wareHouseLabel, 10, 20)); if(substring(wareHouseLabel, 10, 20).equals("")) { BuildPanel.setWareHouseLabel("Warehouse (Level 0)"); BuildPanel.setWareHouseButtonTrueOrFalse(false); } break; } else { BuildPanel.setWareHouseLabel("Warehouse (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeWareHouseLabel("Cannot upgrade"); BuildPanel.setWareHouseButtonTrueOrFalse(false); BuildPanel.setWareHouseLabel("Warehouse max level"); } } } //Sends the level of hiding place to the GUI public static void setHidingPlace() { for(int i = 2; i < 20; i++) { try { String hidingPlaceLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(hidingPlaceLabel, 0, 6).equals("Hiding")) { BuildPanel.setHidingPlaceLabel("Hiding " + substring(hidingPlaceLabel, 7, 22)); if(substring(hidingPlaceLabel, 13, 22).equals("")) { BuildPanel.setHidingPlaceLabel("Hiding place (Level 0)"); BuildPanel.setHidingPlaceButtonTrueOrFalse(false); } break; } else { BuildPanel.setHidingPlaceLabel("Hiding place (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeHidingPlaceLabel("Cannot upgrade"); BuildPanel.setHidingPlaceButtonTrueOrFalse(false); BuildPanel.setHidingPlaceLabel("Hiding place max level"); } } } //Sends the level of wall to the GUI public static void setWall() { for(int i = 2; i < 20; i++) { try { String wallLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(wallLabel, 0, 4).equals("Wall")) { BuildPanel.setWallLabel("Wall " + substring(wallLabel, 5, 14)); if(substring(wallLabel, 5, 14).equals("")) { BuildPanel.setWallLabel("Wall (Level 0)"); BuildPanel.setWallButtonTrueOrFalse(false); } break; } else { BuildPanel.setWallLabel("Wall (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeWallLabel("Cannot upgrade"); BuildPanel.setWallButtonTrueOrFalse(false); BuildPanel.setWallLabel("Wall max level"); } } } //Sends the level of academy to the GUI public static void setAcademy() { for(int i = 2; i < 20; i++) { try { String academyLabel = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildings\"]/tbody/tr[" + i + "]/td[1]")).getText(); if(substring(academyLabel, 0, 7).equals("Academy")) { BuildPanel.setAcademyLabel("Academy " + substring(academyLabel, 8, 16)); if(substring(academyLabel, 8, 16).equals("")) { BuildPanel.setAcademyLabel("Academy (Level 0)"); BuildPanel.setAcademyButtonTrueOrFalse(false); } break; } else { BuildPanel.setAcademyLabel("Academy (Level 0)"); } } catch(NoSuchElementException e) { BuildPanel.setUpgradeAcademyLabel("Cannot upgrade"); BuildPanel.setAcademyButtonTrueOrFalse(false); BuildPanel.setAcademyLabel("Academy max level"); } } } //update build queue one with building name public static void constructionOne() { try { String buildingName = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[2]/td[1]")).getText(); BuildingConstructionPanel.setAssignmentOne(buildingName); durationOne = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[2]/td[2]/span")).getText(); BuildingConstructionPanel.setDurationOne(durationOne); String completion = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[2]/td[3]")).getText(); BuildingConstructionPanel.setCompletionOne(completion); } catch(NoSuchElementException e) { } } public static void constructionOneTimer() throws InterruptedException { for(int i = 0; i < 500; i++) { int hours = (int) (totalOne / (60 * 60 * 1000)); int minutes = (int) ((totalOne /(60 * 1000)) % 60); int seconds = (int) ((totalOne / 1000) % 60); String sec = Integer.toString(seconds); String min = Integer.toString(minutes); System.out.println(min); System.out.println(substring(min, 0, 1)); System.out.println(substring(min, 0, 2)); //if(Integer.parseInt(durationOne.substring(6,7)) == 0) { //BuildingConstructionPanel.setDurationOne(hours + ":" + minutes + ":" + seconds + 0); //} if(substring(sec, 1, 2).equals("")) { BuildingConstructionPanel.setDurationOne(hours + ":" + minutes + ":" + 0 + seconds); } if(substring(min, 1, 2).equals("")) { BuildingConstructionPanel.setDurationOne(hours + ":" + 0 + minutes + ":" + seconds); } if(substring(sec, 1, 2).equals("") && substring(min, 1, 2).equals("")) { BuildingConstructionPanel.setDurationOne(hours + ":" + 0 + minutes + ":" + "0" + seconds); } else { BuildingConstructionPanel.setDurationOne(hours + ":" + minutes + ":" + seconds); } if(totalOne < 10000) { BuildingConstructionPanel.setDurationOne("0"); break; } totalOne = totalOne - 10000; Thread.sleep(10000); } } public static void constructionOneGetTime() { try { if(substring(Village.durationOne, 1, 2).equals(":")) { if(totalOneOne == 0) { totalOneOne = 0; } else { totalOneOne = totalOneOne * 3600000; } if(totalOneThird == 0) { totalOneThird = 0; } else { totalOneThird *= 600000; } if(totalOneFourth == 0) { totalOneFourth = 0; } else { totalOneFourth *= 60000; } if(totalOneSixth == 0) { totalOneSixth = 0; } else { totalOneSixth *= 10000; } if(totalOneSeventh == 0) { totalOneSeventh = 0; } else { totalOneSeventh *= 1000; } totalOne = totalOneOne + totalOneThird + totalOneFourth + totalOneSixth + totalOneSeventh; } else { } } catch(NullPointerException e) { } } public static void constructionOneGetNumbers() { try { Village.totalOneOne = Integer.parseInt(substring(Village.durationOne, 0, 1)); // String second = : Village.totalOneThird = Integer.parseInt(substring(Village.durationOne, 2, 3)); Village.totalOneFourth = Integer.parseInt(substring(Village.durationOne, 3, 4)); //int fifth = : Village.totalOneSixth = Integer.parseInt(substring(Village.durationOne, 5, 6)); Village.totalOneSeventh = Integer.parseInt(substring(Village.durationOne, 6, 7)); } catch(NumberFormatException e) { } //int eight = would be last number } //update build queue two with building name public static void constructionTwo() { try { String buildingName = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[3]/td[1]")).getText(); BuildingConstructionPanel.setAssignmentOne(buildingName); String duration = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[3]/td[2]/span")).getText(); BuildingConstructionPanel.setDurationOne(duration); String completion = WebAutomation.driver.findElement(By.xpath("//*[@id=\"buildqueue\"]/tr[3]/td[3]")).getText(); BuildingConstructionPanel.setCompletionOne(completion); } catch(NoSuchElementException e) { } } //Sends the level of wood generation to the GUI public static void setWoodResource() { try { String wood; wood = WebAutomation.driver.findElement(By.xpath("//*[@id=\"wood\"]")).getText(); BuildPanel.setVillageWoodAmountLabel(wood); } catch(NoSuchElementException e) { } catch(StaleElementReferenceException e) { } } //Sends the level of clay generation to the GUI public static void setClayResource() { try { String clay; clay = WebAutomation.driver.findElement(By.xpath("//*[@id=\"stone\"]")).getText(); BuildPanel.setVillageClayAmountLabel(clay); } catch(NoSuchElementException e) { } catch(StaleElementReferenceException e) { } } ////Sends the level of iron generation to the GUI public static void setIronResource() { try { String iron; iron = WebAutomation.driver.findElement(By.xpath("//*[@id=\"iron\"]")).getText(); BuildPanel.setVillageIronAmountLabel(iron); } catch(NoSuchElementException e) { } catch(StaleElementReferenceException e) { } } //Tells the user if they are being attacked public static void isAttacked() { try { String incoming; incoming = WebAutomation.driver.findElement(By.xpath("//*[@id=\"show_incoming_units\"]/h4")).getText(); if(substring(incoming, 0, 8).equals("Incoming")) { BuildPanel.setVillageIncomingLabel(WebAutomation.driver.findElement(By.xpath("//*[@id=\"header_info\"]/tbody/tr/td[7]/table/tbody/tr[1]/td/table/tbody/tr/td[2]")).getText() + " Attacks incoming"); } } catch(NoSuchElementException e) { } } //Sends the population to the GUI public static void setPopulation() { try { String setPopulaton; setPopulaton = WebAutomation.driver.findElement(By.xpath("//*[@id=\"pop_current_label\"]")).getText(); String setPopulationMax; setPopulationMax = WebAutomation.driver.findElement(By.xpath("//*[@id=\"pop_max_label\"]")).getText(); TroopsDetailPanel.setPopulationCountLabel(setPopulaton + "/" + setPopulationMax); } catch(NoSuchElementException e) { } catch(StaleElementReferenceException e) { } } //updates just the buildings public static void updateBuildings() { setVillageHQ(); setBarracks(); setStable(); setWorkShop(); setSmithy(); setMarket(); setTimber(); setClay(); setIron(); setFarm(); setWarehouse(); setHidingPlace(); setWall(); setAcademy(); constructionOne(); } //contains all the troop update functions public static void updateTroops() { setSwords(); setAxes(); setSpears(); setSpies(); setLightCal(); setPaladin(); setCatapult(); } //gets the village HQ cost public static void getVillageHQCost() { try { villageHQWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_main\"]/td[2]")).getText()); villageHQClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_main\"]/td[3]")).getText()); villageHQIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_main\"]/td[4]")).getText()); } //if the costs arent found then it cant be built catch(NoSuchElementException e) { villageHQHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getBarracksCost() { try { barracksWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_barracks\"]/td[2]")).getText()); barracksClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_barracks\"]/td[3]")).getText()); barracksIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_barracks\"]/td[4]")).getText()); } catch(NoSuchElementException e) { barracksHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getStableCost() { try { stableWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stable\"]/td[2]")).getText()); stableClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stable\"]/td[3]")).getText()); stableIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stable\"]/td[4]")).getText()); } catch(NoSuchElementException e) { stableHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getWorkShopCost() { try { workShopWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_garage\"]/td[2]")).getText()); workShopClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_garage\"]/td[3]")).getText()); workShopIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_garage\"]/td[4]")).getText()); } catch(NoSuchElementException e) { workShopHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getSmithtyCost() { try { smithyWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_smith\"]/td[2]")).getText()); smithyClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_smith\"]/td[3]")).getText()); smithyIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_smith\"]/td[4]")).getText()); } catch(NoSuchElementException e) { smithyHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getMarketCost() { try { marketWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_market\"]/td[2]")).getText()); marketClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_market\"]/td[3]")).getText()); marketIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_market\"]/td[4]")).getText()); } catch(NoSuchElementException e) { marketHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getTimberCost() { try { timberWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wood\"]/td[2]")).getText()); timberClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wood\"]/td[3]")).getText()); timberIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wood\"]/td[4]")).getText()); } catch(NoSuchElementException e) { timberHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getClayCost() { try { clayWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stone\"]/td[2]")).getText()); clayClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stone\"]/td[3]")).getText()); clayIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_stone\"]/td[4]")).getText()); } catch(NoSuchElementException e) { clayHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getIronCost() { try { ironWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_iron\"]/td[2]")).getText()); ironClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_iron\"]/td[3]")).getText()); ironIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_iron\"]/td[4]")).getText()); } catch(NoSuchElementException e) { ironHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getFarmCost() { try { farmWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_farm\"]/td[2]")).getText()); farmClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_farm\"]/td[3]")).getText()); farmIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_farm\"]/td[4]")).getText()); } catch(NoSuchElementException e) { farmHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getWareHouseCost() { try { wareHouseWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_storage\"]/td[2]")).getText()); wareHouseClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_storage\"]/td[3]")).getText()); wareHouseIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_storage\"]/td[4]")).getText()); } catch(NoSuchElementException e) { wareHouseHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getWallCost() { try { wallWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wall\"]/td[2]")).getText()); wallClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wall\"]/td[3]")).getText()); wallIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_wall\"]/td[4]")).getText()); } catch(NoSuchElementException e) { wallHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getAcademyCost() { try { academyWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_snob\"]/td[2]")).getText()); academyClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_snob\"]/td[3]")).getText()); academyIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_snob\"]/td[4]")).getText()); } catch(NoSuchElementException e) { academyHasCost = false; } catch(StaleElementReferenceException e) { } } public static void getHidingPlaceCost() { try { hidingPlaceWoodCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_hide\"]/td[2]")).getText()); hidingPlaceClayCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_hide\"]/td[3]")).getText()); hidingPlaceIronCost = Integer.parseInt(WebAutomation.driver.findElement(By.xpath("//*[@id=\"main_buildrow_hide\"]/td[4]")).getText()); } catch(NoSuchElementException e) { hidingPlaceHasCost = false; } catch(StaleElementReferenceException e) { } } //method to easily get all the building costs public static void getAllBuildingCosts() { getVillageHQCost(); getBarracksCost(); getStableCost(); getWorkShopCost(); getSmithtyCost(); getMarketCost(); getTimberCost(); getClayCost(); getIronCost(); getFarmCost(); getWareHouseCost(); getWallCost(); getAcademyCost(); getHidingPlaceCost(); } }
9a0a63ffb422364c85bc6cd84a73314f153cd071
5b41e86fef6551cd6be1fd6aa9c3f136a9391837
/reservations/src/main/java/com/sauravsahu/ReservationsApplication.java
0a8160a63e3cadd5185f915dfdfc8e35d994065d
[]
no_license
Scry-Saurav/Spring
cac0f3f74e020456fe94b767ffa5cc5e3ed73b08
09cf35512266c79cf9b8c4d2b2df1b58190a5177
refs/heads/master
2020-04-03T18:10:10.674642
2018-11-01T20:41:53
2018-11-01T20:41:53
155,473,535
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.sauravsahu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ReservationsApplication { public static void main(String[] args) { SpringApplication.run(ReservationsApplication.class, args); } }
b4fe22788f28e4f3e46c2f2a1b11b2a4ac39c797
dd975d9f786bf4967da78da29767036f76ef1d3f
/Practice/src/practice10/PTra10_06.java
5ca0608f3478fda2dc367633808a8c5d080acc73
[]
no_license
ifukutatsunori/JavaBasic
2b28e9ff0592a3aed650a71815a0646809a03932
6182c36b0e6c3405e606257d412cc2427bb00d46
refs/heads/master
2021-04-28T16:13:57.353012
2018-03-08T09:30:40
2018-03-08T09:30:40
122,009,878
0
0
null
null
null
null
UTF-8
Java
false
false
1,084
java
package practice10; /* * PTra10_06.java * 作成 LIKEIT 2017 *------------------------------------------------------------ * Copyright(c) Rhizome Inc. All Rights Reserved. */ public class PTra10_06 { /* * PTra10_05で作成したCarクラスを使用します */ public static void main(String[] args) { /* * carインスタンスを3件作成し、それぞれの色、ガソリンを入力して決定してください * 各carインスタンスのrunメソッドを実行して、それぞれ「目的地にまでn時間かかりました。残りのガソリンは、xリットルです」を出力してください。 */ Car[]car=new Car[3]; for(int i=0;i<car.length;i++) { car[i]=new Car(); car[i].gasoline=50; car[i].color="red"; final int distance=300; int sum=0; int n=0; while(true) { int go = car[i].run(); n++; sum+=go; if(sum>distance) { System.out.println("目的地にまで"+n+"時間かかりました。残りのガソリンは、"+car[i].gasoline+"リットルです"); break; } } } } }
a819f274209dafd31e6ad1a5161f4474fdd7748a
81c06074f367fd2eefbeb079257d9f28625b319d
/src/org/pesc/core/coremain/v1_12/LocalOrganizationIDType.java
be747cdf81aa261b778d0f94ad271be7efc06596
[]
no_license
rgehbauer/cdsWebserver
f1a461718caff9d1094945c771bd8a223ac3c018
a787d3d369dec70df4c1ff12c8d948a342274864
refs/heads/master
2021-01-18T10:59:42.715030
2014-06-27T23:05:31
2014-06-27T23:05:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,026
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.01.23 at 05:40:47 PM PST // package org.pesc.core.coremain.v1_12; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for LocalOrganizationIDType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="LocalOrganizationIDType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="LocalOrganizationIDCode" type="{urn:org:pesc:core:CoreMain:v1.12.0}LocalOrganizationIDCodeType"/> * &lt;element name="LocalOrganizationIDQualifier" type="{urn:org:pesc:core:CoreMain:v1.12.0}LocalOrganizationIDCodeQualifierType"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LocalOrganizationIDType", propOrder = { "localOrganizationIDCode", "localOrganizationIDQualifier" }) public class LocalOrganizationIDType { @XmlElement(name = "LocalOrganizationIDCode", required = true) protected String localOrganizationIDCode; @XmlElement(name = "LocalOrganizationIDQualifier", required = true) protected LocalOrganizationIDCodeQualifierType localOrganizationIDQualifier; /** * Gets the value of the localOrganizationIDCode property. * * @return * possible object is * {@link String } * */ public String getLocalOrganizationIDCode() { return localOrganizationIDCode; } /** * Sets the value of the localOrganizationIDCode property. * * @param value * allowed object is * {@link String } * */ public void setLocalOrganizationIDCode(String value) { this.localOrganizationIDCode = value; } /** * Gets the value of the localOrganizationIDQualifier property. * * @return * possible object is * {@link LocalOrganizationIDCodeQualifierType } * */ public LocalOrganizationIDCodeQualifierType getLocalOrganizationIDQualifier() { return localOrganizationIDQualifier; } /** * Sets the value of the localOrganizationIDQualifier property. * * @param value * allowed object is * {@link LocalOrganizationIDCodeQualifierType } * */ public void setLocalOrganizationIDQualifier(LocalOrganizationIDCodeQualifierType value) { this.localOrganizationIDQualifier = value; } }
331e6e746005b884f6582111ec8d4bea690b72fd
4d361cd1287745e1ba82a051b73ec693b022fb04
/jOOQ/src/main/java/org/jooq/impl/DefaultRecordMapper.java
013962139c173ea777ab0237c8331b15fb7eb6d0
[ "Apache-2.0" ]
permissive
Vertabelo/jOOQ
db8619efea4b982983201c7d0e1d223421a4d715
e65f62d833286ea0689748e3be47dabe94a9f511
refs/heads/master
2021-01-18T09:34:29.600129
2014-11-07T15:32:33
2014-11-21T11:08:43
26,956,264
1
0
null
null
null
null
UTF-8
Java
false
false
25,179
java
/** * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) * All rights reserved. * * This work is dual-licensed * - under the Apache Software License 2.0 (the "ASL") * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") * ============================================================================= * You may choose which license applies to you: * * - If you're using this work with Open Source databases, you may choose * either ASL or jOOQ License. * - If you're using this work with at least one commercial database, you must * choose jOOQ License * * For more information, please visit http://www.jooq.org/licenses * * Apache Software License 2.0: * ----------------------------------------------------------------------------- * 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. * * jOOQ License and Maintenance Agreement: * ----------------------------------------------------------------------------- * Data Geekery grants the Customer the non-exclusive, timely limited and * non-transferable license to install and use the Software under the terms of * the jOOQ License and Maintenance Agreement. * * This library is distributed with a LIMITED WARRANTY. See the jOOQ License * and Maintenance Agreement for more details: http://www.jooq.org/licensing */ package org.jooq.impl; import static org.jooq.impl.Utils.getAnnotatedGetter; import static org.jooq.impl.Utils.getAnnotatedMembers; import static org.jooq.impl.Utils.getAnnotatedSetters; import static org.jooq.impl.Utils.getMatchingGetter; import static org.jooq.impl.Utils.getMatchingMembers; import static org.jooq.impl.Utils.getMatchingSetters; import static org.jooq.impl.Utils.getPropertyName; import static org.jooq.impl.Utils.hasColumnAnnotations; import static org.jooq.tools.reflect.Reflect.accessible; import java.beans.ConstructorProperties; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.sql.Timestamp; import java.util.Arrays; import java.util.HashMap; import java.util.List; import javax.persistence.Column; import org.jooq.Attachable; import org.jooq.AttachableInternal; import org.jooq.Configuration; import org.jooq.Field; import org.jooq.Record; import org.jooq.Record1; import org.jooq.RecordMapper; import org.jooq.RecordMapperProvider; import org.jooq.RecordType; import org.jooq.exception.MappingException; import org.jooq.tools.Convert; import org.jooq.tools.reflect.Reflect; /** * This is the default implementation for <code>RecordMapper</code> types. * <p> * The mapping algorithm is this: * <p> * <h5>If <code>&lt;E></code> is an array type:</h5> * <p> * The resulting array is of the nature described in {@link Record#intoArray()}. * Arrays more specific than <code>Object[]</code> can be specified as well, * e.g. <code>String[]</code>. If conversion to the element type of more * specific arrays fails, a {@link MappingException} is thrown, wrapping * conversion exceptions. * <p> * <h5>If <code>&lt;E></code> is a field "value type" and <code>&lt;R></code> * has exactly one column:</h5> * <p> * Any Java type available from {@link SQLDataType} qualifies as a well-known * "value type" that can be converted from a single-field {@link Record1}. The * following rules apply: * <p> * <ul> * <li>If <code>&lt;E></code> is a reference type like {@link String}, * {@link Integer}, {@link Long}, {@link Timestamp}, etc., then converting from * <code>&lt;R></code> to <code>&lt;E></code> is mere convenience for calling * {@link Record#getValue(int, Class)} with <code>fieldIndex = 0</code></li> * <li>If <code>&lt;E></code> is a primitive type, the mapping result will be * the corresponding wrapper type. <code>null</code> will map to the primitive * type's initialisation value, e.g. <code>0</code> for <code>int</code>, * <code>0.0</code> for <code>double</code>, <code>false</code> for * <code>boolean</code>.</li> * </ul> * <h5>If a default constructor is available and any JPA {@link Column} * annotations are found on the provided <code>&lt;E></code>, only those are * used:</h5> * <p> * <ul> * <li>If <code>&lt;E></code> contains public single-argument instance methods * annotated with <code>Column</code>, those methods are invoked</li> * <li>If <code>&lt;E></code> contains public no-argument instance methods * starting with <code>getXXX</code> or <code>isXXX</code>, annotated with * <code>Column</code>, then matching public <code>setXXX()</code> instance * methods are invoked</li> * <li>If <code>&lt;E></code> contains public instance member fields annotated * with <code>Column</code>, those members are set</li> * </ul> * Additional rules: * <ul> * <li>The same annotation can be re-used for several methods/members</li> * <li>{@link Column#name()} must match {@link Field#getName()}. All other * annotation attributes are ignored</li> * <li>Static methods / member fields are ignored</li> * <li>Final member fields are ignored</li> * </ul> * <p> * <h5>If a default constructor is available and if there are no JPA * <code>Column</code> annotations, or jOOQ can't find the * <code>javax.persistence</code> API on the classpath, jOOQ will map * <code>Record</code> values by naming convention:</h5> * <p> * If {@link Field#getName()} is <code>MY_field</code> (case-sensitive!), then * this field's value will be set on all of these: * <ul> * <li>Public single-argument instance method <code>MY_field(...)</code></li> * <li>Public single-argument instance method <code>myField(...)</code></li> * <li>Public single-argument instance method <code>setMY_field(...)</code></li> * <li>Public single-argument instance method <code>setMyField(...)</code></li> * <li>Public non-final instance member field <code>MY_field</code></li> * <li>Public non-final instance member field <code>myField</code></li> * </ul> * <p> * <h5>If no default constructor is available, but at least one constructor * annotated with <code>ConstructorProperties</code> is available, that one is * used</h5> * <p> * <ul> * <li>The standard JavaBeans {@link ConstructorProperties} annotation is used * to match constructor arguments against POJO members or getters.</li> * <li>If those POJO members or getters have JPA annotations, those will be used * according to the aforementioned rules, in order to map <code>Record</code> * values onto constructor arguments.</li> * <li>If those POJO members or getters don't have JPA annotations, the * aforementioned naming conventions will be used, in order to map * <code>Record</code> values onto constructor arguments.</li> * <li>When several annotated constructors are found, the first one is chosen * (as reported by {@link Class#getDeclaredConstructors()}</li> * <li>When invoking the annotated constructor, values are converted onto * constructor argument types</li> * </ul> * <p> * <h5>If no default constructor is available, but at least one "matching" * constructor is available, that one is used</h5> * <p> * <ul> * <li>A "matching" constructor is one with exactly as many arguments as this * record holds fields</li> * <li>When several "matching" constructors are found, the first one is chosen * (as reported by {@link Class#getDeclaredConstructors()}</li> * <li>When invoking the "matching" constructor, values are converted onto * constructor argument types</li> * </ul> * <p> * <h5>If the supplied type is an interface or an abstract class</h5> * <p> * Abstract types are instantiated using Java reflection {@link Proxy} * mechanisms. The returned proxy will wrap a {@link HashMap} containing * properties mapped by getters and setters of the supplied type. Methods (even * JPA-annotated ones) other than standard POJO getters and setters are not * supported. Details can be seen in {@link Reflect#as(Class)}. * <p> * <h5>Other restrictions</h5> * <p> * <ul> * <li><code>&lt;E></code> must provide a default or a "matching" constructor. * Non-public default constructors are made accessible using * {@link Constructor#setAccessible(boolean)}</li> * <li>primitive types are supported. If a value is <code>null</code>, this will * result in setting the primitive type's default value (zero for numbers, or * <code>false</code> for booleans). Hence, there is no way of distinguishing * <code>null</code> and <code>0</code> in that case.</li> * </ul> * <p> * This mapper is returned by the {@link DefaultRecordMapperProvider}. You can * override this behaviour by specifying your own custom * {@link RecordMapperProvider} in {@link Configuration#recordMapperProvider()} * * @author Lukas Eder * @see RecordMapper * @see DefaultRecordMapperProvider * @see Configuration */ @SuppressWarnings("unchecked") public class DefaultRecordMapper<R extends Record, E> implements RecordMapper<R, E> { /** * The record type. */ private final Field<?>[] fields; /** * The target type. */ private final Class<? extends E> type; /** * The configuration in whose context this {@link RecordMapper} operates. * <p> * This configuration can be used for caching reflection information. */ private final Configuration configuration; /** * An optional target instance to use instead of creating new instances. */ private transient E instance; /** * A delegate mapper created from type information in <code>type</code>. */ private RecordMapper<R, E> delegate; public DefaultRecordMapper(RecordType<R> rowType, Class<? extends E> type) { this(rowType, type, null, null); } DefaultRecordMapper(RecordType<R> rowType, Class<? extends E> type, Configuration configuration) { this(rowType, type, null, configuration); } DefaultRecordMapper(RecordType<R> rowType, Class<? extends E> type, E instance) { this(rowType, type, instance, null); } DefaultRecordMapper(RecordType<R> rowType, Class<? extends E> type, E instance, Configuration configuration) { this.fields = rowType.fields(); this.type = type; this.instance = instance; this.configuration = configuration; init(); } private final void init() { // Arrays can be mapped easily if (type.isArray()) { delegate = new ArrayMapper(); return; } // [#3212] "Value types" can be mapped from single-field Record1 types for convenience if (type.isPrimitive() || DefaultDataType.types().contains(type)) { delegate = new ValueTypeMapper(); return; } // [#1470] Return a proxy if the supplied type is an interface if (Modifier.isAbstract(type.getModifiers())) { delegate = new ProxyMapper(); return; } // [#2989] [#2836] Records are mapped if (AbstractRecord.class.isAssignableFrom(type)) { delegate = (RecordMapper<R, E>) new RecordToRecordMapper(); return; } // [#1340] Allow for using non-public default constructors try { delegate = new MutablePOJOMapper(type.getDeclaredConstructor()); return; } catch (NoSuchMethodException ignore) {} // [#1336] If no default constructor is present, check if there is a // "matching" constructor with the same number of fields as this record Constructor<E>[] constructors = (Constructor<E>[]) type.getDeclaredConstructors(); // [#1837] If any java.beans.ConstructorProperties annotations are // present use those rather than matching constructors by the number of // arguments for (Constructor<E> constructor : constructors) { ConstructorProperties properties = constructor.getAnnotation(ConstructorProperties.class); if (properties != null) { delegate = new ImmutablePOJOMapperWithConstructorProperties(constructor, properties); return; } } // [#1837] Without ConstructorProperties, match constructors by matching // argument length for (Constructor<E> constructor : constructors) { Class<?>[] parameterTypes = constructor.getParameterTypes(); // Match the first constructor by parameter length if (parameterTypes.length == fields.length) { delegate = new ImmutablePOJOMapper(constructor, parameterTypes); return; } } throw new MappingException("No matching constructor found on type " + type + " for record " + this); } @Override public final E map(R record) { if (record == null) { return null; } try { return attach(delegate.map(record), record); } // Pass MappingExceptions on to client code catch (MappingException e) { throw e; } // All other reflection exceptions are intercepted catch (Exception e) { throw new MappingException("An error ocurred when mapping record to " + type, e); } } /** * Convert a record into an array of a given type. * <p> * The supplied type is usually <code>Object[]</code>, but in some cases, it * may make sense to supply <code>String[]</code>, <code>Integer[]</code> * etc. */ private class ArrayMapper implements RecordMapper<R, E> { @Override public final E map(R record) { int size = record.size(); Class<?> componentType = type.getComponentType(); Object[] result = (Object[]) (instance != null ? instance : Array.newInstance(componentType, size)); // Just as in Collection.toArray(Object[]), return a new array in case // sizes don't match if (size > result.length) { result = (Object[]) Array.newInstance(componentType, size); } for (int i = 0; i < size; i++) { result[i] = Convert.convert(record.getValue(i), componentType); } return (E) result; } } private class ValueTypeMapper implements RecordMapper<R, E> { @Override public final E map(R record) { int size = record.size(); if (size != 1) throw new MappingException("Cannot map multi-column record of degree " + size + " to value type " + type); return record.getValue(0, type); } } /** * Convert a record into an hash map proxy of a given type. * <p> * This is done for types that are not instanciable */ private class ProxyMapper implements RecordMapper<R, E> { private final MutablePOJOMapper localDelegate; ProxyMapper() { this.localDelegate = new MutablePOJOMapper(null); } @Override public final E map(R record) { E previous = instance; try { instance = Reflect.on(HashMap.class).create().as(type); return localDelegate.map(record); } finally { instance = previous; } } } /** * Convert a record into another record type. */ private class RecordToRecordMapper implements RecordMapper<R, AbstractRecord> { @Override public final AbstractRecord map(R record) { try { if (record instanceof AbstractRecord) { return ((AbstractRecord) record).intoRecord((Class<AbstractRecord>) type); } throw new MappingException("Cannot map record " + record + " to type " + type); } catch (Exception e) { throw new MappingException("An error ocurred when mapping record to " + type, e); } } } /** * Convert a record into a mutable POJO type * <p> * jOOQ's understanding of a mutable POJO is a Java type that has a default * constructor */ private class MutablePOJOMapper implements RecordMapper<R, E> { private final Constructor<? extends E> constructor; private final boolean useAnnotations; private final List<java.lang.reflect.Field>[] members; private final List<java.lang.reflect.Method>[] methods; MutablePOJOMapper(Constructor<? extends E> constructor) { this.constructor = accessible(constructor); this.useAnnotations = hasColumnAnnotations(configuration, type); this.members = new List[fields.length]; this.methods = new List[fields.length]; for (int i = 0; i < fields.length; i++) { Field<?> field = fields[i]; // Annotations are available and present if (useAnnotations) { members[i] = getAnnotatedMembers(configuration, type, field.getName()); methods[i] = getAnnotatedSetters(configuration, type, field.getName()); } // No annotations are present else { members[i] = getMatchingMembers(configuration, type, field.getName()); methods[i] = getMatchingSetters(configuration, type, field.getName()); } } } @Override public final E map(R record) { try { E result = instance != null ? instance : constructor.newInstance(); for (int i = 0; i < fields.length; i++) { for (java.lang.reflect.Field member : members[i]) { // [#935] Avoid setting final fields if ((member.getModifiers() & Modifier.FINAL) == 0) { map(record, result, member, i); } } for (java.lang.reflect.Method method : methods[i]) { method.invoke(result, record.getValue(i, method.getParameterTypes()[0])); } } return result; } catch (Exception e) { throw new MappingException("An error ocurred when mapping record to " + type, e); } } private final void map(Record record, Object result, java.lang.reflect.Field member, int index) throws IllegalAccessException { Class<?> mType = member.getType(); if (mType.isPrimitive()) { if (mType == byte.class) { member.setByte(result, record.getValue(index, byte.class)); } else if (mType == short.class) { member.setShort(result, record.getValue(index, short.class)); } else if (mType == int.class) { member.setInt(result, record.getValue(index, int.class)); } else if (mType == long.class) { member.setLong(result, record.getValue(index, long.class)); } else if (mType == float.class) { member.setFloat(result, record.getValue(index, float.class)); } else if (mType == double.class) { member.setDouble(result, record.getValue(index, double.class)); } else if (mType == boolean.class) { member.setBoolean(result, record.getValue(index, boolean.class)); } else if (mType == char.class) { member.setChar(result, record.getValue(index, char.class)); } } else { member.set(result, record.getValue(index, mType)); } } } /** * Convert a record into an "immutable" POJO (final fields, "matching" * constructor). */ private class ImmutablePOJOMapper implements RecordMapper<R, E> { private final Constructor<E> constructor; private final Class<?>[] parameterTypes; public ImmutablePOJOMapper(Constructor<E> constructor, Class<?>[] parameterTypes) { this.constructor = accessible(constructor); this.parameterTypes = parameterTypes; } @Override public final E map(R record) { try { Object[] converted = Convert.convert(record.intoArray(), parameterTypes); return constructor.newInstance(converted); } catch (Exception e) { throw new MappingException("An error ocurred when mapping record to " + type, e); } } } /** * Create an immutable POJO given a constructor and its associated JavaBeans * {@link ConstructorProperties} */ private class ImmutablePOJOMapperWithConstructorProperties implements RecordMapper<R, E> { private final Constructor<E> constructor; private final Class<?>[] parameterTypes; private final Object[] parameterValues; private final List<String> propertyNames; private final boolean useAnnotations; private final List<java.lang.reflect.Field>[] members; private final java.lang.reflect.Method[] methods; ImmutablePOJOMapperWithConstructorProperties(Constructor<E> constructor, ConstructorProperties properties) { this.constructor = constructor; this.propertyNames = Arrays.asList(properties.value()); this.useAnnotations = hasColumnAnnotations(configuration, type); this.parameterTypes = constructor.getParameterTypes(); this.parameterValues = new Object[parameterTypes.length]; this.members = new List[fields.length]; this.methods = new Method[fields.length]; for (int i = 0; i < fields.length; i++) { Field<?> field = fields[i]; // Annotations are available and present if (useAnnotations) { members[i] = getAnnotatedMembers(configuration, type, field.getName()); methods[i] = getAnnotatedGetter(configuration, type, field.getName()); } // No annotations are present else { members[i] = getMatchingMembers(configuration, type, field.getName()); methods[i] = getMatchingGetter(configuration, type, field.getName()); } } } @Override public final E map(R record) { try { for (int i = 0; i < fields.length; i++) { for (java.lang.reflect.Field member : members[i]) { int index = propertyNames.indexOf(member.getName()); if (index >= 0) { parameterValues[index] = record.getValue(i); } } if (methods[i] != null) { String name = getPropertyName(methods[i].getName()); int index = propertyNames.indexOf(name); if (index >= 0) { parameterValues[index] = record.getValue(i); } } } Object[] converted = Convert.convert(parameterValues, parameterTypes); return accessible(constructor).newInstance(converted); } catch (Exception e) { throw new MappingException("An error ocurred when mapping record to " + type, e); } } } private static <E> E attach(E attachable, Record record) { // [#2869] Attach the mapped outcome if it is Attachable and if the context's // Settings.attachRecords flag is set if (attachable instanceof Attachable && record instanceof AttachableInternal) { Attachable a = (Attachable) attachable; AttachableInternal r = (AttachableInternal) record; if (Utils.attachRecords(r.configuration())) { a.attach(r.configuration()); } } return attachable; } }
2660c39dd312384cdf6a4fc4f389a4efad3f558a
1cfd7b55c3ddbb72290be7b715f896cdbae2d780
/src/main/java/com/lakala/ls/ms/domain/Channel.java
0bb2c9ca5c46933c989debdb2f15075ee4d9fdd9
[]
no_license
wangtongbo/yunhui
efbd1e49b9c0f5b69ff2622fde22df493d412736
fea749ca4f9819f3f2ce9e0dc274663e1b03fdbd
refs/heads/master
2021-04-15T08:22:14.592498
2018-03-23T01:21:47
2018-03-23T01:21:47
126,285,601
1
0
null
null
null
null
UTF-8
Java
false
false
1,637
java
package com.lakala.ls.ms.domain; import java.util.Date; public class Channel { private long id; private String name; private String linkName; private String linkMobile; private String state; private String creditState; private long parentId; private Date createTime; private Date updateTime; private String parentName; public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLinkName() { return linkName; } public void setLinkName(String linkName) { this.linkName = linkName; } public String getLinkMobile() { return linkMobile; } public void setLinkMobile(String linkMobile) { this.linkMobile = linkMobile; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getCreditState() { return creditState; } public void setCreditState(String creditState) { this.creditState = creditState; } public long getParentId() { return parentId; } public void setParentId(long parentId) { this.parentId = parentId; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
4bb77400b914ea93e0bae00424d46caeae80398f
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-datalabeling/samples/snippets/generated/com/google/cloud/datalabeling/v1beta1/datalabelingservice/getevaluationjob/SyncGetEvaluationJobEvaluationjobname.java
7175485cad2b15efb8b3be15fb5b7ec618d4be66
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481897
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
2023-09-13T21:21:23
2014-11-04T17:57:16
Java
UTF-8
Java
false
false
1,989
java
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.datalabeling.v1beta1.samples; // [START datalabeling_v1beta1_generated_DataLabelingService_GetEvaluationJob_Evaluationjobname_sync] import com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient; import com.google.cloud.datalabeling.v1beta1.EvaluationJob; import com.google.cloud.datalabeling.v1beta1.EvaluationJobName; public class SyncGetEvaluationJobEvaluationjobname { public static void main(String[] args) throws Exception { syncGetEvaluationJobEvaluationjobname(); } public static void syncGetEvaluationJobEvaluationjobname() throws Exception { // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { EvaluationJobName name = EvaluationJobName.of("[PROJECT]", "[EVALUATION_JOB]"); EvaluationJob response = dataLabelingServiceClient.getEvaluationJob(name); } } } // [END datalabeling_v1beta1_generated_DataLabelingService_GetEvaluationJob_Evaluationjobname_sync]
2e2be4d3b07a5ab7b75cb0b007cc51ab4cc228a0
a92db1404001628ab0763527e67a708dce7e770b
/src/main/java/com/test/设计模式/委派模式delegate/A.java
0907cd3d77841128840938e9639ba0627d98aedd
[]
no_license
menghucheng/test
a60b355dac6fb4d7ddf8969339edec7077be3de0
afca7f910b3c5f484987dacbbd6a2c0a4aa45f71
refs/heads/master
2021-01-10T07:34:15.890524
2016-04-01T10:21:26
2016-04-01T10:21:26
53,011,541
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.test.设计模式.委派模式Delegate; /** * Created by MENGHUCHENG012 on 2016/3/8. */ public class A { public void move(){ System.out.println("moving..."); } public void talk(){ System.out.println("taking..."); } }
fc02f6668f224c32333ecf162209b52fd4d11455
ae3c143b68a3f6aaac7dcd46678e11c8225382d2
/app/src/main/java/com/xgimi/zhushou/adapter/MyCollectMovieAdapter.java
54b86526ac309a050bec116e805d66ed82110633
[]
no_license
led-os/XgimiAssistantv3.6.0
d7829fd1073cd1206f52264e1320ad67b9ba767b
ef63e0d2d1328690574cd556846d8200a73bf7cf
refs/heads/master
2020-04-06T13:02:18.509708
2017-10-23T11:24:14
2017-10-23T11:24:14
157,480,913
1
0
null
2018-11-14T02:51:53
2018-11-14T02:51:53
null
UTF-8
Java
false
false
2,441
java
package com.xgimi.zhushou.adapter; import android.app.Activity; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.xgimi.zhushou.R; import com.xgimi.zhushou.bean.MovieCollectBeen; import com.xgimi.zhushou.netUtil.ImageLoaderUtils; import java.util.List; /** * Created by Administrator on 2016/8/27. */ public class MyCollectMovieAdapter extends BaseAdapter{ private Activity mActivity; private List<MovieCollectBeen.data> mDatas; private int mPostion; public MyCollectMovieAdapter(int postion, Activity activity, List<MovieCollectBeen.data> data){ this.mActivity=activity; this.mDatas=data; this.mPostion=postion; } public void dataChange(List<MovieCollectBeen.data> datas){ this.mDatas=datas; notifyDataSetChanged(); } @Override public int getCount() { // TODO Auto-generated method stub return mDatas.size(); } public void dataChange(int postion){ this.mPostion=postion; notifyDataSetChanged(); } @Override public MovieCollectBeen.data getItem(int arg0) { // TODO Auto-generated method stub return mDatas.get(arg0); } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public View getView(int arg0, View arg1, ViewGroup arg2) { // TODO Auto-generated method stub View view=arg1; ViewHolder vh; if(view==null){ vh=new ViewHolder(); view=View.inflate(mActivity, R.layout.my_collect_movie_item, null); vh.iv= (ImageView) view.findViewById(R.id.iv); vh.tv1= (TextView) view.findViewById(R.id.fm_title); vh.tv2= (TextView) view.findViewById(R.id.fm_artist); vh.tv3= (TextView) view.findViewById(R.id.add_time); view.setTag(vh); }else{ vh=(ViewHolder) view.getTag(); } ImageLoaderUtils.display(mActivity,vh.iv, mDatas.get(arg0).video_cover); vh.tv1.setText(mDatas.get(arg0).video_title); vh.tv2.setText(mDatas.get(arg0).video_type); vh.tv3.setText(mDatas.get(arg0).add_time); return view; } public class ViewHolder{ public ImageView iv; public TextView tv1,tv2,tv3; } }
b9e85523fb794f41d110f63ed2508cfc2204ae60
0bf70b85b5a3f0fb51c6c3c45c2d8a7c4fa79a87
/net.solarnetwork.node.dao.jdbc/src/net/solarnetwork/node/dao/jdbc/AbstractJdbcDao.java
6c72d83bd900ee652bf98218ba6ec95f9160fdaf
[]
no_license
Spudmn/solarnetwork-node
7a1839b41a1cd2d4e996caa8cb1d82baac3fcfeb
8701e756d91a92f76234c4b7a6e026528625b148
refs/heads/master
2021-01-15T11:03:11.181320
2014-11-06T20:21:13
2014-11-06T20:21:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,723
java
/* =================================================================== * AbstractJdbcDao.java * * Created Jul 15, 2008 8:36:00 AM * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * =================================================================== */ package net.solarnetwork.node.dao.jdbc; import static net.solarnetwork.node.dao.jdbc.JdbcDaoConstants.SCHEMA_NAME; import static net.solarnetwork.node.dao.jdbc.JdbcDaoConstants.TABLE_SETTINGS; import java.io.IOException; import java.io.InputStreamReader; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.ConnectionCallback; import org.springframework.jdbc.core.PreparedStatementCallback; import org.springframework.jdbc.core.PreparedStatementCreator; import org.springframework.jdbc.core.support.JdbcDaoSupport; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; /** * Base class for JDBC based DAO implementations. * * <p> * This class extends {@link JdbcDaoSupport} with methods for handling upgrade * maintenance of the table(s) managed by this DAO over time, e.g. creating * tables if they don't exist, running DDL update scripts to upgrade to a new * version, etc. * </p> * * @author matt * @version 1.1 * @param <T> * the domain object type managed by this DAO */ public abstract class AbstractJdbcDao<T> extends JdbcDaoSupport implements JdbcDao { /** A class-level Logger. */ protected final Logger log = LoggerFactory.getLogger(getClass()); private String sqlGetTablesVersion = null; private String sqlResourcePrefix = null; private int tablesVersion = 1; private boolean useAutogeneratedKeys = false; private Resource initSqlResource = null; private String schemaName = SCHEMA_NAME; private String tableName = TABLE_SETTINGS; private MessageSource messageSource = null; private final Map<String, String> sqlResourceCache = new HashMap<String, String>(10); /** * Initialize this class after properties are set. */ public void init() { // verify database table exists, and if not create it verifyDatabaseExists(this.schemaName, this.tableName, this.initSqlResource); // now veryify database tables version is up-to-date try { upgradeTablesVersion(); } catch ( IOException e ) { throw new RuntimeException("Unable to upgrade tables to version " + getTablesVersion(), e); } if ( messageSource == null ) { ResourceBundleMessageSource ms = new ResourceBundleMessageSource(); ms.setBasename(getClass().getName()); ms.setBundleClassLoader(getClass().getClassLoader()); setMessageSource(ms); } } /** * Insert a new domain object. * * @param obj * the domain object to insert * @param sqlInsert * the SQL to persist the object with */ protected void insertDomainObject(final T obj, final String sqlInsert) { getJdbcTemplate().update(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = con.prepareStatement(sqlInsert); setStoreStatementValues(obj, ps); return ps; } }); } /** * Store (insert) a new domain object. * * <p> * If {@link #isUseAutogeneratedKeys()} is <em>true</em> then this method * will use JDBC's {@link Statement#RETURN_GENERATED_KEYS} to obtain the * auto-generated primary key for the newly inserted object. Otherwise, this * method will call the * {@link #storeDomainObjectWithoutAutogeneratedKeys(T, String)} method. * </p> * * @param obj * the domain object to persist * @param sqlInsert * the SQL to persist the object with * @return the primary key created for the domain object */ protected Long storeDomainObject(final T obj, final String sqlInsert) { if ( !useAutogeneratedKeys ) { return storeDomainObjectWithoutAutogeneratedKeys(obj, sqlInsert); } GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); getJdbcTemplate().update(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = con.prepareStatement(sqlInsert, Statement.RETURN_GENERATED_KEYS); setStoreStatementValues(obj, ps); return ps; } }, keyHolder); if ( keyHolder.getKey() != null ) { return Long.valueOf(keyHolder.getKey().longValue()); } return null; } /** * Set {@link PreparedStatement} values for storing a domain object. * * <p> * Called from {@link #storeDomainObject(T, String)} and * {@link #storeDomainObjectWithoutAutogeneratedKeys(T, String)} to persist * values of a domain object. * </p> * * <p> * This implementation does not do anything. Extending classes should * override this and set values on the {@code PreparedStatement} object as * needed to persist the domain object. * </p> * * @param obj * the domain object to persist * @param ps * the PreparedStatement to persist with * @throws SQLException * if any SQL error occurs */ protected void setStoreStatementValues(T obj, PreparedStatement ps) throws SQLException { // this is a no-op method, override to do something useful } /** * Persist a domain object, without using auto-generated keys. * * @param obj * the domain object to persist * @param sqlInsert * the SQL insert statement to use * @return the primary key created for the domain object */ protected Long storeDomainObjectWithoutAutogeneratedKeys(final T obj, final String sqlInsert) { Object result = getJdbcTemplate().execute(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = con.prepareStatement(sqlInsert); setStoreStatementValues(obj, ps); return ps; } }, new PreparedStatementCallback<Object>() { @Override public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { ps.execute(); int count = ps.getUpdateCount(); if ( count == 1 && ps.getMoreResults() ) { ResultSet rs = ps.getResultSet(); if ( rs.next() ) { return rs.getObject(1); } } return null; } }); if ( result instanceof Long ) { return (Long) result; } else if ( result instanceof Number ) { return Long.valueOf(((Number) result).longValue()); } if ( log.isWarnEnabled() ) { log.warn("Unexpected (non-number) primary key returned: " + result); } return null; } /** * Verify a database table exists, and if not initialize the database with * the SQL in the provided {@code initSqlResource}. * * @param schema * the schema to check * @param table * the table to check * @param initSql * the init SQL resource */ protected void verifyDatabaseExists(final String schema, final String table, final Resource initSql) { getJdbcTemplate().execute(new ConnectionCallback<Object>() { @Override public Object doInConnection(Connection con) throws SQLException, DataAccessException { if ( !tableExists(con, schema, table) ) { String[] initSqlStatements = getBatchSqlResource(initSql); if ( initSqlStatements != null ) { if ( log.isInfoEnabled() ) { log.info("Initializing database from [" + initSql + ']'); } getJdbcTemplate().batchUpdate(initSqlStatements); } } return null; } }); } /** * Test if a table exists in the database. * * @param conn * the connection * @param aSchemaName * the schema name to look for (or <em>null</em> for any schema) * @param aTableName * the table name to look for * @return boolean if table is found * @throws SQLException * if any SQL error occurs */ protected boolean tableExists(Connection conn, String aSchemaName, String aTableName) throws SQLException { DatabaseMetaData dbMeta = conn.getMetaData(); ResultSet rs = null; try { rs = dbMeta.getTables(null, null, null, null); while ( rs.next() ) { String schema = rs.getString(2); String table = rs.getString(3); if ( (aSchemaName == null || (aSchemaName.equalsIgnoreCase(schema))) && aTableName.equalsIgnoreCase(table) ) { if ( log.isDebugEnabled() ) { log.debug("Found table " + schema + '.' + table); } return true; } } return false; } finally { if ( rs != null ) { try { rs.close(); } catch ( SQLException e ) { // ignore this } } } } /** * Upgrade the database tables to the configured version, if the database * version is less than the configured version. * * <p> * This method uses the {@link #getSqlGetTablesVersion()} SQL statement to * query for the current database table version. If the version found there * is less than the {@link #getTablesVersion()} value then a sequence of SQL * resources, relative to the {@link #getInitSqlResource()} resource, are * loaded and executed. The resources are assumed to have a file name patter * like <code><em>[tablesUpdatePrefix]</em>-update-<em>[#]</em>.sql</code> * where <em>[tablesUpdatePrefix]</em> is the * {@link #getTablesUpdatePrefix()} value and <em>[#]</em> is the version * number, starting at the currently found table version + 1 up through and * including {@link #getTablesVersion()}. If no version value is found when * querying, the current version is assumed to be {@code 0}. * </p> * * <p> * For example, if by querying the current version is reported as {@code 1} * and the {@link #getTablesVersion()} value is {@code 3}, and the * {@link #getTablesUpdatePrefix()} is {@code derby-mytable}, the following * SQL resources will be exectued: * </p> * * <ol> * <li>derby-mytable-update-2.sql</li> * <li>derby-mytable-update-3.sql</li> * </ol> * * <p> * Each update SQL is expected, therefor, to also update the "current" table * version so that after running the update subsequent calls to this method * where {@link #getTablesVersion()} has not changed will not do anything. * </p> * * @throws IOException * if update resources cannot be found */ protected void upgradeTablesVersion() throws IOException { String currVersion = "0"; try { currVersion = getJdbcTemplate().queryForObject(sqlGetTablesVersion, String.class); } catch ( EmptyResultDataAccessException e ) { if ( log.isInfoEnabled() ) { log.info("Table version setting not found, assuming version 0."); } } int curr = Integer.parseInt(currVersion); while ( curr < this.tablesVersion ) { if ( log.isInfoEnabled() ) { log.info("Updating database tables version from " + curr + " to " + (curr + 1)); } Resource sql = this.initSqlResource.createRelative(this.sqlResourcePrefix + "-update-" + (curr + 1) + ".sql"); String[] batch = getBatchSqlResource(sql); int[] result = getJdbcTemplate().batchUpdate(batch); if ( log.isDebugEnabled() ) { log.debug("Database tables updated to version " + (curr + 1) + " update results: " + Arrays.toString(result)); } curr++; } } /** * Load a classpath SQL resource into a String. * * <p> * The classpath resource is taken as the {@link #getSqlResourcePrefix()} * value and {@code -} and the {@code classPathResource} combined with a * {@code .sql} suffix. If that resoruce is not found, then the prefix is * split into components separated by a {@code -} character, and the last * component is dropped and then combined with {@code -} and * {@code classPathResource} again to try to find a match, until there is no * prefix left and just the {@code classPathResource} itself is tried. * </p> * * <p> * This method will cache the SQL resource in-memory for quick future * access. * </p> * * @param string * the classpath resource to load as a SQL string * @return the String */ protected String getSqlResource(String classPathResource) { Class<?> myClass = getClass(); String resourceName = getSqlResourcePrefix() + "-" + classPathResource + ".sql"; String key = myClass.getName() + ";" + classPathResource; if ( sqlResourceCache.containsKey(key) ) { return sqlResourceCache.get(key); } String[] prefixes = getSqlResourcePrefix().split("-"); int prefixEndIndex = prefixes.length - 1; try { Resource r = new ClassPathResource(resourceName, myClass); while ( !r.exists() && prefixEndIndex >= 0 ) { // try by chopping down prefix, which we split on a dash character String subName; if ( prefixEndIndex > 0 ) { String[] subPrefixes = new String[prefixEndIndex]; System.arraycopy(prefixes, prefixEndIndex, subPrefixes, 0, prefixEndIndex); subName = StringUtils.arrayToDelimitedString(subPrefixes, "-") + "-" + classPathResource; } else { subName = classPathResource; } subName += ".sql"; r = new ClassPathResource(subName, myClass); prefixEndIndex--; } if ( !r.exists() ) { throw new RuntimeException("SQL resource " + resourceName + " not found"); } String result = FileCopyUtils.copyToString(new InputStreamReader(r.getInputStream())); if ( result != null && result.length() > 0 ) { sqlResourceCache.put(key, result); } return result; } catch ( IOException e ) { throw new RuntimeException(e); } } /** * Load a SQL resource into a String. * * @param resource * the SQL resource to load * @return the String */ protected String getSqlResource(Resource resource) { try { return FileCopyUtils.copyToString(new InputStreamReader(resource.getInputStream())); } catch ( IOException e ) { throw new RuntimeException(e); } } /** * Get batch SQL statements, split into multiple statements on the * {@literal ;} character. * * @param sqlResource * the SQL resource to load * @return split SQL */ protected String[] getBatchSqlResource(Resource sqlResource) { String sql = getSqlResource(sqlResource); if ( sql == null ) { return null; } return sql.split(";\\s*"); } /** * This implementation simply returns a new array with a single value: * {@link #getTableName()}. * * @see net.solarnetwork.node.dao.jdbc.JdbcDao#getTableNames() */ @Override public String[] getTableNames() { return new String[] { getTableName() }; } public String getSqlGetTablesVersion() { return sqlGetTablesVersion; } public void setSqlGetTablesVersion(String sqlGetTablesVersion) { this.sqlGetTablesVersion = sqlGetTablesVersion; } /** * @return the tablesUpdatePrefix * @deprecated use {@link #getSqlResourcePrefix()} */ @Deprecated public String getTablesUpdatePrefix() { return getSqlResourcePrefix(); } /** * @param tablesUpdatePrefix * the tablesUpdatePrefix to set * @deprecated use {@link #setSqlResourcePrefix(String)} */ @Deprecated public void setTablesUpdatePrefix(String tablesUpdatePrefix) { setSqlResourcePrefix(tablesUpdatePrefix); } public String getSqlResourcePrefix() { return sqlResourcePrefix; } public void setSqlResourcePrefix(String sqlResourcePrefix) { this.sqlResourcePrefix = sqlResourcePrefix; } public int getTablesVersion() { return tablesVersion; } /** * @param tablesVersion * the tablesVersion to set */ public void setTablesVersion(int tablesVersion) { this.tablesVersion = tablesVersion; } public boolean isUseAutogeneratedKeys() { return useAutogeneratedKeys; } public void setUseAutogeneratedKeys(boolean useAutogeneratedKeys) { this.useAutogeneratedKeys = useAutogeneratedKeys; } public Resource getInitSqlResource() { return initSqlResource; } public void setInitSqlResource(Resource initSqlResource) { this.initSqlResource = initSqlResource; } @Override public String getSchemaName() { return schemaName; } public void setSchemaName(String schemaName) { this.schemaName = schemaName; } @Override public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } @Override public MessageSource getMessageSource() { return messageSource; } public void setMessageSource(MessageSource messageSource) { this.messageSource = messageSource; } }
68a9eb11a8d76009f3f98da0ee1b8ce6d1490e0a
0d84c7a8a324860148d8b49e02a655b545628565
/src/model/data_structures/Stack.java
18717bb0bad4a5d421258da8f8fa157ffe7f9145
[]
no_license
jpcano1/taller_google_maps
2cedd3323fff75a11570120bfdee3d4f63bf091e
eba2f2d1c64ea74a0e9d68a76b39d92fc7a35a95
refs/heads/master
2020-09-05T23:15:36.376537
2020-01-18T03:20:04
2020-01-18T03:20:04
220,241,221
0
0
null
null
null
null
UTF-8
Java
false
false
2,312
java
package model.data_structures; import java.util.Iterator; /** * @author Juan Pablo Cano * @param <T> The generic type */ public class Stack<T extends Comparable<T>> { /** * @author Juan Pablo Cano * The Node class * @param <T> The generic Type */ @SuppressWarnings("hiding") public class Node<T extends Comparable<T>> { Node<T> next; T element; public Node(T pElement) { next = null; element = pElement; } public Node<T> getNext() { return next; } public T getElement() { return element; } public void setNext(Node<T> pNext) { next = pNext; } public void setElement(T pElement) { element = pElement; } } private Node<T> head; private int size; public Stack() { head = null; size = 0; } public Node<T> getHead() { return head; } public Iterator<T> iterator() { return new Iterator<T>() { Node<T> actual = head; @Override public boolean hasNext() { return actual != null; } @Override public T next() { if(hasNext()) { T data = actual.getElement(); actual = actual.getNext(); return data; } return null; } }; } public boolean isEmpty() { return size == 0; } public int size() { return size; } public void push(T t) { try { Node<T> nuevo = new Node<T>(t); if(head != null) { nuevo.setNext(head); } head = nuevo; size++; } catch(Exception e) { System.out.println(e.getMessage()); } } public T pop() { if(head != null) { T actual = head.getElement(); head = head.getNext(); size--; return actual; } return null; } }
2f51e07da36d1f7f1ded8e54836d1f4a45720844
c1e32f1067b23df0752ff5e668771b902cf268cd
/Lab11/Lab11.java
a28a081e03d7030a324e4bb5dfeaf209dd2d3271
[]
no_license
abertella/Algorithms
a907a825cd5dcf9aec5cc6b4de72cd6b356c127a
5d727ff5da285ba7f8c920b3f5fbecd6d4e09098
refs/heads/master
2023-03-04T14:43:30.830738
2021-02-05T19:16:26
2021-02-05T19:16:26
336,366,501
0
0
null
null
null
null
UTF-8
Java
false
false
2,053
java
import java.util.*; public class Lab11 { public static void main(String[] args) { Graph myg = new Graph(6); myg.addEdge(1, 2); myg.addEdge(1, 5); myg.addEdge(2, 5); myg.addEdge(2, 3); myg.addEdge(2, 4); myg.addEdge(3, 4); myg.addEdge(4, 5); System.out.println("***printGraph"); myg.printGraph(); System.out.println("***allPaths"); for(int i = 0; i < myg.numNodes; i++) { allPaths(myg, i); } try { Graph myg2 = new Graph("mediumG.txt"); System.out.println("***Medium"); myg2.BFS(0); myg2.endKey = 200; myg2.printPath(0, 200); myg2.endKey = 249; myg2.printPath(0, 249); System.out.format("Depth of 249 = %d\n", myg2.verts.get(249).depth); myg2.endKey = 120; myg2.printPath(0, 120); long startT, endT; Graph myg3 = new Graph("largeG.txt"); System.out.println("***Large"); startT = System.nanoTime(); myg3.BFS(0); endT = System.nanoTime(); System.out.format("**BFS on graph %s = %d\u03BCs\n", myg3.name, (endT-startT)/1000); myg3.endKey = 999082; myg3.printPath(0, 999082); System.out.format("Depth of 999082 = %d\n", myg3.verts.get(999082).depth); allPaths(myg2, 0); }catch(Exception e) { System.err.println(e.getMessage()); System.exit(-1); } } public static void allPaths(Graph g, int key) { long startT, endT; startT = System.nanoTime(); g.BFS(key); endT = System.nanoTime(); System.out.format("BFS on graph %s = %d\u03BCs\n", g.name, (endT-startT)/1000); for(Map.Entry<Integer, GraphNode> entry : g.verts.entrySet()) { int end = entry.getValue().key; g.endKey = end; g.printPath(key, end); } System.out.println(); } }