blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
85b57985a83fac9514093b1a01436230af359bf4
dd5a0e06ca0d1a875df2bdb25417d8da2572a36e
/app/src/main/java/com/aby/c0769778_ex7/MainActivity.java
a6fd6ee9de0f45e73cd672f3018bc3d5d34df89a
[]
no_license
AbhishekSanthoshJaya/C0769778_Ex7
5796f314253cc00f00a31c50d5f1e685d703201f
ed3a6860b556762da9c2ad6cbbdf76fff4f34139
refs/heads/master
2021-05-25T22:11:39.169374
2020-04-08T00:21:54
2020-04-08T00:21:54
253,941,829
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
java
package com.aby.c0769778_ex7; import android.os.Bundle; import com.google.android.material.bottomnavigation.BottomNavigationView; import androidx.appcompat.app.AppCompatActivity; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomNavigationView navView = findViewById(R.id.nav_view); // Passing each menu ID as a set of Ids because each // menu should be considered as top level destinations. AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( R.id.navigation_android, R.id.navigation_studentProfile, R.id.navigation_aboutUs) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setupWithNavController(navView, navController); } }
[ "AbhishekSanthoshJaya@users.noreply.github.com" ]
AbhishekSanthoshJaya@users.noreply.github.com
6708776b7a17a773b72ddbe1c2d6670f0d5c22bf
3de873826855b18c4f6439acd0594e1f56c484a4
/A1/systemC/src/main/java/system/SystemCPlumber.java
a8d0508f3d49e91175a2afb1f9668aa1149d7a2b
[]
no_license
chuyahui/17-655-A1
12840571f12ab2a6659969ee7ba7caa168511bd0
cbf903876c570bf49283ecd87007a03907e8fb58
refs/heads/master
2021-01-16T18:53:35.229444
2016-02-16T02:22:19
2016-02-16T02:22:19
51,839,993
0
0
null
2016-02-16T14:02:33
2016-02-16T14:02:33
null
UTF-8
Java
false
false
7,724
java
package system; import framework.MeasurementConfig; import shared.*; import java.util.Arrays; /** * Plumber for system C * * @since 1.0.0 */ public class SystemCPlumber { private static String getBaseFolder(String[] args) { if (args.length <= 0) { System.out.println("Please provide the absolute execution folder path as the first argument"); System.exit(-1); } return args[0]; } public static void main(String[] args) throws Exception { System.out.println("System C running..."); /**=============================================================================== * Section A: Create filters * The filters to be created are as follows (They are indexed by their filter id): * 1 - FileSourceFilter: read data from file * 2 - DataDroppingFilter: drop attitude, temperature and velocity data * 3 - FileSourceFilter: read data from file * 4 - DataDroppingFilter: drop attitude, temperature and velocity data * 5 - TimeSortFilter: time align the incoming data * 6 - AltitudeFilter: filter out any data frame with altitude less than 10K * 7 - DataDroppingFilter: drop pressure data * 8 - TimeConvertingFilter: format time * 9 - AltitudeFormattingFilter: format altitude * 10 - FormattingFilter: format time and altitude into a single line * 11 - FileSinkFilter: write to file * 12 - DataDroppingFilter: drop altitude data * 13 - WildPressureFilter: identity and extrapolate wild pressure points * 14 - JunkSinkFilter: discard valid data frame with valid pressure points * 15 - TimeConvertingFilter: format time * 16 - PressureFormattingFilter: format pressure * 17 - FormattingFilter: format time, pressure into a single line * 18 - FileSinkFilter: write to file * =============================================================================== */ // 1 - FileSourceFilter FileSourceFilter fileSourceA = new FileSourceFilter("1", getBaseFolder(args) + "/SubSetA.dat"); // 2 - DataDroppingFilter DataDroppingFilter streamADrop = new DataDroppingFilter("2", MeasurementConfig.defaultConfig()); streamADrop.setDropAttitude(true); streamADrop.setDropTemperature(true); streamADrop.setDropVelocity(true); // 3 - FileSourceFilter FileSourceFilter fileSourceB = new FileSourceFilter("3", getBaseFolder(args) + "/SubSetB.dat"); // 4 - DataDroppingFilter DataDroppingFilter streamBDrop = new DataDroppingFilter("4", MeasurementConfig.defaultConfig()); streamBDrop.setDropAttitude(true); streamBDrop.setDropTemperature(true); streamBDrop.setDropVelocity(true); // 5 - TimeSortFilter TimeSortFilter timeSortFilter = new TimeSortFilter("5", MeasurementConfig.defaultConfig()); // 6 - AltitudeFilter AltitudeFilter altitudeFilter = new AltitudeFilter("6", MeasurementConfig.defaultConfig()); // 7 - DataDroppingFilter DataDroppingFilter dropPressureFilter = new DataDroppingFilter("7", MeasurementConfig.defaultConfig()); dropPressureFilter.setDropPressure(true); // 8 - TimeConvertingFilter TimeConvertingFilter timeConvertingFilter1 = new TimeConvertingFilter("8", MeasurementConfig.defaultConfig()); // 9 - AltitudeFormattingFilter AltitudeFormattingFilter altitudeFormattingFilter = new AltitudeFormattingFilter("9", MeasurementConfig.defaultConfig().expectTimeWithLength(16)); // 10 - FormattingFilter FormattingFilter formattingFilter1 = new FormattingFilter("10", MeasurementConfig.defaultConfig().expectTimeWithLength(16).expectAltitudeWithLength(13)); formattingFilter1.setTimeRequired(true); formattingFilter1.setAltitudeRequired(true); // 11 - FileSinkFilter FileSinkFilter lessThan10KSink = new FileSinkFilter("11", getBaseFolder(args) + "/LessThan10K.dat"); // 12 - DataDroppingFilter DataDroppingFilter dropAltitudeFilter = new DataDroppingFilter("12", MeasurementConfig.defaultConfig()); dropAltitudeFilter.setDropAltitude(true); // 13 - WildPressureFilter WildPressureFilter wildPressureFilter = new WildPressureFilter("13", MeasurementConfig.defaultConfig()); // 14 - JunkSinkFilter JunkSinkFilter junkSinkFilter = new JunkSinkFilter("14"); // 15 - TimeConvertingFilter TimeConvertingFilter timeConvertingFilter2 = new TimeConvertingFilter("15", MeasurementConfig.defaultConfig()); // 16 - PressureFormattingFilter PressureFormattingFilter pressureFormattingFilter = new PressureFormattingFilter("16", MeasurementConfig.defaultConfig().expectTimeWithLength(16)); // 17 - FormattingFilter FormattingFilter formattingFilter2 = new FormattingFilter("17", MeasurementConfig.defaultConfig().expectTimeWithLength(16).expectPressureWithLength(9)); formattingFilter2.setTimeRequired(true); formattingFilter2.setPressureRequired(true); // 18 - FileSinkFilter FileSinkFilter pressureWildPointsSink = new FileSinkFilter("18", getBaseFolder(args) + "/PressureWildPoints.dat"); /**=================================================================== * Section B: Connect filters. * Referencing the filters' id, the system will have a topology like: * * 1 -> 2 \ /-> 7 -> 8 -> 10 -> 11 * -> 5 -> 6 * 3 -> 4 / \ /-> 14 * \-> 12 -> 13 * \-> 15 -> 16 -> 17 -> 18 * =================================================================== */ lessThan10KSink.connect(formattingFilter1); formattingFilter1.connect(altitudeFormattingFilter); altitudeFormattingFilter.connect(timeConvertingFilter1); timeConvertingFilter1.connect(dropPressureFilter); dropPressureFilter.connect(altitudeFilter); pressureWildPointsSink.connect(formattingFilter2); formattingFilter2.connect(pressureFormattingFilter); pressureFormattingFilter.connect(timeConvertingFilter2); junkSinkFilter.connect(wildPressureFilter); timeConvertingFilter2.connect(wildPressureFilter); wildPressureFilter.connect(dropAltitudeFilter); dropAltitudeFilter.connect(altitudeFilter); altitudeFilter.connect(timeSortFilter); timeSortFilter.connect(streamADrop); timeSortFilter.connect(streamBDrop); streamADrop.connect(fileSourceA); streamBDrop.connect(fileSourceB); /**======================== * Section C: Start filters * ======================== */ for (Thread filter : Arrays.asList( fileSourceA, fileSourceB, streamADrop, streamBDrop, timeSortFilter, altitudeFilter, dropPressureFilter, timeConvertingFilter1, altitudeFormattingFilter, formattingFilter1, lessThan10KSink, dropAltitudeFilter, wildPressureFilter, junkSinkFilter, timeConvertingFilter2, pressureFormattingFilter, formattingFilter2, pressureWildPointsSink )) { filter.start(); } } }
[ "davidiamyou@gmail.com" ]
davidiamyou@gmail.com
16429931e1b59cee67ac3da4e059c35bbbf9432d
4cedc85d337b9b3b77bc1d009437a6a60e031434
/src/main/java/com/lekmiti/designpatterns/abstractfactory/Green.java
ddc92e426263b15f6c153bf53f907984c3b6c890
[]
no_license
lekmiti/design-patterns
d90f9434edf9ac19959857a51f5f973bcdc6a180
6f34d3213e8b293bda8626467031d235b33debc3
refs/heads/master
2020-05-14T15:28:34.866663
2019-04-19T08:58:59
2019-04-19T08:59:28
181,855,091
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package com.lekmiti.designpatterns.abstractfactory; public class Green implements Color{ @Override public String getColor() { return "Green"; } }
[ "lekmiti1992@gmail.com" ]
lekmiti1992@gmail.com
c062ed7b6a38ca428e3a1c6fef5b54ad88fb8f8e
c04e0ba6caf6fef6ee218e6b46685b724c48e73e
/java/com/blavasgps/covidcheckup/Design/Register/RegisterUserActivity.java
86adc34f3827ade2ca2b917d1b1bd754b908cc81
[]
no_license
AnkitPanditJi/COVID-19
f83b9387b61e535192e4b69970ef773b63a47846
331455756fdec3085eaadcf990350ec35ff64aff
refs/heads/master
2022-12-17T05:53:45.100600
2020-09-29T03:40:51
2020-09-29T03:40:51
299,494,115
0
0
null
null
null
null
UTF-8
Java
false
false
13,810
java
package com.blavasgps.covidcheckup.Design.Register; import android.Manifest; import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import com.blavasgps.covidcheckup.Design.MainActivity; import com.blavasgps.covidcheckup.R; import com.blavasgps.covidcheckup.commons.server.ServerConfig; import com.blavasgps.covidcheckup.commons.server.ServerConnector; import com.blavasgps.covidcheckup.commons.session.SessionManager; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import org.json.JSONObject; import java.io.IOException; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Locale; public class RegisterUserActivity extends AppCompatActivity implements View.OnClickListener { RadioGroup rbg; Button registerUser; private EditText UserAge, HomeAddress, CityAddress, StateAddress, CountryAddress; String locCityName, locStateName, locCoutryName; double locLatitude, loclongitude; int PERMISSION_ID = 44; FusedLocationProviderClient mFusedLocationClient; ProgressDialog progressDialog; String address = ""; // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() String city = ""; String state = ""; String country = ""; String postalCode = ""; String knownName = ""; RadioButton gender; SessionManager sessionManager; HashMap<String, String> user; @RequiresApi(api = Build.VERSION_CODES.M) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register_screen); sessionManager = new SessionManager(this); user = sessionManager.getUserDetails(); progressDialog = new ProgressDialog(this); mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this); getLastLocation(); rbg=(RadioGroup) findViewById(R.id.radioGrp); UserAge = (EditText)findViewById(R.id.user_age); HomeAddress = (EditText)findViewById(R.id.house_address); CityAddress = (EditText)findViewById(R.id.city); StateAddress = (EditText)findViewById(R.id.state); CountryAddress= (EditText)findViewById(R.id.country); registerUser=(Button) findViewById(R.id.register_user); registerUser.setOnClickListener(this); } @SuppressLint("MissingPermission") private void getLastLocation(){ if (checkPermissions()) { if (isLocationEnabled()) { mFusedLocationClient.getLastLocation().addOnCompleteListener( new OnCompleteListener<Location>() { @Override public void onComplete(@NonNull Task<Location> task) { Location location = task.getResult(); if (location == null) { requestNewLocationData(); } else { locLatitude = location.getLatitude(); loclongitude = location.getLongitude(); Geocoder geocoder; List<Address> addresses; geocoder = new Geocoder(RegisterUserActivity.this, Locale.getDefault()); try { addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1); // Here 1 represent max location result to returned, by documents it recommended 1 to address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() city = addresses.get(0).getLocality(); state = addresses.get(0).getAdminArea(); country = addresses.get(0).getCountryName(); postalCode = addresses.get(0).getPostalCode(); knownName = addresses.get(0).getFeatureName(); HomeAddress.setText(address); CityAddress.setText(city); StateAddress.setText(state); CountryAddress.setText(country); locCityName = city; } catch (IOException e) { e.printStackTrace(); } } } } ); } else { Toast.makeText(this, "Turn on location", Toast.LENGTH_LONG).show(); Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent); } } else { requestPermissions(); } } @SuppressLint("MissingPermission") private void requestNewLocationData(){ LocationRequest mLocationRequest = new LocationRequest(); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); mLocationRequest.setInterval(0); mLocationRequest.setFastestInterval(0); mLocationRequest.setNumUpdates(1); mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this); mFusedLocationClient.requestLocationUpdates( mLocationRequest, mLocationCallback, Looper.myLooper() ); } private LocationCallback mLocationCallback = new LocationCallback() { @Override public void onLocationResult(LocationResult locationResult) { Location mLastLocation = locationResult.getLastLocation(); // latTextView.setText(mLastLocation.getLatitude()+""); // lonTextView.setText(mLastLocation.getLongitude()+""); locLatitude = mLastLocation.getLatitude(); loclongitude = mLastLocation.getLongitude(); Geocoder geocoder; List<Address> addresses; geocoder = new Geocoder(RegisterUserActivity.this, Locale.getDefault()); try { addresses = geocoder.getFromLocation(mLastLocation.getLatitude(), mLastLocation.getLongitude(), 1); // Here 1 represent max location result to returned, by documents it recommended 1 to address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() city = addresses.get(0).getLocality(); state = addresses.get(0).getAdminArea(); country = addresses.get(0).getCountryName(); postalCode = addresses.get(0).getPostalCode(); knownName = addresses.get(0).getFeatureName(); HomeAddress.setText(address); CityAddress.setText(city); StateAddress.setText(state); CountryAddress.setText(country); locCityName = city; } catch (IOException e) { e.printStackTrace(); } } }; private boolean checkPermissions() { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { return true; } return false; } private void requestPermissions() { ActivityCompat.requestPermissions( this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_ID ); } private boolean isLocationEnabled() { LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER ); } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == PERMISSION_ID) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { getLastLocation(); } } } @Override public void onResume(){ super.onResume(); if (checkPermissions()) { getLastLocation(); } } @Override public void onClick(View view) { switch (view.getId()) { case R.id.register_user: int selected=rbg.getCheckedRadioButtonId(); gender=(RadioButton) findViewById(selected); if(gender == null) { Toast.makeText(getApplicationContext(),"Please Select Gender.",Toast.LENGTH_LONG).show(); return; } if(UserAge.getText().toString().isEmpty()) { Toast.makeText(getApplicationContext(),"Please enter your age.",Toast.LENGTH_LONG).show(); return; } doRegister(user.get(SessionManager.KEY_MOBILE)); break; default: break; } } public void doRegister(String userPhone){ String urlParameters = ""; try { progressDialog.setMessage("Loading, Please wait.."); progressDialog.show(); //Called To Show Loading // loginView.showLoading(); //Call when user successfully login urlParameters = "mobile=" + URLEncoder.encode(userPhone, "UTF-8") + "&gender=" + URLEncoder.encode(gender.getText().toString(), "UTF-8") + "&longitude=" + URLEncoder.encode(String.valueOf(loclongitude), "UTF-8") + "&latitude=" + URLEncoder.encode(String.valueOf(locLatitude), "UTF-8") + "&age=" + URLEncoder.encode(UserAge.getText().toString(), "UTF-8") + "&address=" + URLEncoder.encode(address, "UTF-8") + "&state=" + URLEncoder.encode(state, "UTF-8") + "&city=" + URLEncoder.encode(city, "UTF-8"); ServerConnector connector = new ServerConnector(urlParameters); connector.setDataDownloadListner(response -> { Log.e("Response", "Response : " + response); try { JSONObject jsonObject = new JSONObject(response); if(jsonObject.has("success")) { String message = jsonObject.getString("message"); if(jsonObject.getBoolean("success") == true) { sessionManager.updateUserVerified(jsonObject.getString("verified")); Toast.makeText(this, message, Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); }else { Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } } }catch (Exception e) { e.printStackTrace(); }finally { progressDialog.dismiss(); } }); connector.execute(ServerConfig.Register); } catch (Exception e) { e.printStackTrace(); } } }
[ "noreply@github.com" ]
noreply@github.com
743603fcd4c4e376046727e7d998ded2c130057a
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/plugin/appbrand/jsapi/bluetooth/a.java
5162e7ab4b1e9916f5e308745fc7a6f16e380c34
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
218
java
// INTERNAL ERROR // /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes8.jar * Qualified Name: com.tencent.mm.plugin.appbrand.jsapi.bluetooth.a * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
51b599b4ba0951bfdba86eeb03174cddca354b8a
c955b8c5e1b9262eaa8d9da9d54e87f360de5e3e
/3bb4-exam-review/BarberShop.java
04565a1c976db3c3c8f96ca202464c0c652f1a60
[]
no_license
artemkokhanov/concurrent-system-design
9a21a10abfc33fc04f750de1d64467eea80fbbd7
f42b323657824bf939b1771bc2d0ffb75d3fa1fd
refs/heads/master
2020-05-23T09:04:29.705574
2019-07-07T17:49:55
2019-07-07T17:49:55
186,701,546
0
0
null
null
null
null
UTF-8
Java
false
false
2,540
java
//%%writefile village.java class Barber extends Thread { BarberShop barberShop; Barber(BarberShop s) { barberShop = s; } public void run() { while (true) { try { barberShop.getNextCustomer(); // wait for a customer to sit in the barber's chair System.out.println("cutting hair"); Thread.sleep(1000); // milliseconds barberShop.finishedCut(); // allow the customer to leave; returns after the customer left } catch (InterruptedException e) {} } } } class Customer extends Thread { BarberShop barberShop; int cust; Customer(BarberShop s, int c) { barberShop = s; cust = c; } public void run() { while (true) { try { System.out.println(cust + " lives happily"); Thread.sleep(2000); // milliseconds barberShop.getHaircut(cust); // returns after the customer has received a the haircut } catch (InterruptedException e) {} } } } class BarberShop { int barber = 0; int chair = 0; int exit = 0; // 0 ≤ barber ≤ 1 ∧ 0 ≤ chair ≤ 1 ∧ 0 ≤ exit ≤ 1 synchronized void getHaircut(int cust) throws InterruptedException { System.out.println(cust + " waiting for barber"); while (barber == 0) wait(); // await barber > 0 barber -= 1; chair += 1; notifyAll(); // chair > 0 System.out.println(cust + " waiting for exit door"); while (exit == 0) wait(); // await exit > 0 exit -= 1 ; notifyAll(); // exit == 0 } synchronized void getNextCustomer() throws InterruptedException { // requires barber == 0 barber += 1; notifyAll(); // barber > 0 System.out.println("waiting for customer to set in chair"); while (chair == 0) wait(); // await chair > 0 chair -= 1; } synchronized void finishedCut() throws InterruptedException { // requires exit == 0 exit += 1; notifyAll(); // exit > 0 System.out.println("waiting for barber to leave"); while (exit > 0) wait(); // await exit == 0 } public static void main(String[] args) { //int numCust = Integer.parseInt(args[0]); int numCust = 5; BarberShop s = new BarberShop(); new Barber(s).start(); for (int c = 0; c < numCust; c++) new Customer(s, c).start(); System.out.println("done"); } }
[ "noreply@github.com" ]
noreply@github.com
4088b4621db647fbfc4fa70d24d4686f6547d8a1
cf96815e18846473392047616b9f9f5e08a637b7
/src/vanetsim/gui/controlpanels/EditVehicleControlPanel.java
ba2eceefc18b8536d94ea5efb684b4133c51b7e7
[]
no_license
propcgrogrammer/vanetsim
9ddd8b78912d5f6c16e482704dbd83b5e2b7322b
94eaf123954ad461763083149edac06aaf5b36e3
refs/heads/master
2021-07-13T11:40:59.992694
2017-10-18T08:36:12
2017-10-18T08:36:12
107,215,497
0
0
null
null
null
null
UTF-8
Java
false
false
20,438
java
package vanetsim.gui.controlpanels; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.text.NumberFormat; import java.util.Random; import java.util.ArrayDeque; //import java16.util.ArrayDeque; import javax.swing.JColorChooser; import javax.swing.JComboBox; import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import vanetsim.ErrorLog; import vanetsim.VanetSimStart; import vanetsim.debug.Debug; import vanetsim.gui.Renderer; import vanetsim.gui.helpers.ButtonCreator; import vanetsim.gui.helpers.TextAreaLabel; import vanetsim.gui.helpers.VehicleType; import vanetsim.gui.helpers.VehicleTypeXML; import vanetsim.localization.Messages; import vanetsim.map.Map; import vanetsim.routing.WayPoint; import vanetsim.scenario.Vehicle; /** * This class represents the control panel for adding random vehicles. */ public class EditVehicleControlPanel extends JPanel implements ActionListener, MouseListener{ /** The necessary constant for serializing. */ private static final long serialVersionUID = 1347869556374738481L; /** A JComboBox Label for vehicle type. */ private JLabel chooseVehicleTypeLabel_; /** A JComboBox to switch between vehicles types. */ private JComboBox chooseVehicleType_; /** The input field for the vehicle length (cm) */ private final JFormattedTextField vehicleLength_; /** The input field for the minimum speed. */ private final JFormattedTextField minSpeed_; /** The input field for the maximum speed. */ private final JFormattedTextField maxSpeed_; /** The input field for the minimum communication distance. */ private final JFormattedTextField minCommDist_; /** The input field for the maximum communication distance.. */ private final JFormattedTextField maxCommDist_; /** The input field for the minimum wait in milliseconds. */ private final JFormattedTextField minWait_; /** The input field for the maximum wait in milliseconds. */ private final JFormattedTextField maxWait_; /** The input field for the minimum braking rate in cm/s^2. */ private final JFormattedTextField minBraking_; /** The input field for the maximum braking rate in cm/s^2. */ private final JFormattedTextField maxBraking_; /** The input field for the minimum acceleration rate in cm/s^2. */ private final JFormattedTextField minAcceleration_; /** The input field for the maximum acceleration rate in cm/s^2. */ private final JFormattedTextField maxAcceleration_; /** The input field for the minimum time distance in ms. */ private final JFormattedTextField minTimeDistance_; /** The input field for the maximum time distance in ms. */ private final JFormattedTextField maxTimeDistance_; /** The input field for the minimum politeness factor in %. */ private final JFormattedTextField minPoliteness_; /** The input field for the maximum politeness factor in %. */ private final JFormattedTextField maxPoliteness_; /** The input field for the percentage of vehicles with WiFi. */ private final JFormattedTextField wiFi_; /** The input field for the percentage of emergency vehicles. */ private final JFormattedTextField emergencyVehicle_; /** The input field for the amount of vehicles to be created. */ private final JFormattedTextField amount_; /** The input field for a restriction that source an destination may only be on specific streets. */ private final JFormattedTextField speedStreetRestriction_; /** The input field for the wait in milliseconds. */ private final JPanel colorPreview_; /** * Constructor. */ public EditVehicleControlPanel(){ Debug.whereru(this.getClass().getName(), true); Debug.callFunctionInfo(this.getClass().getName(), "EditVehicleControlPanel()", true); setLayout(new GridBagLayout()); // global layout settings GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.PAGE_START; c.weightx = 0.5; c.gridx = 0; c.gridy = 0; c.gridheight = 1; c.insets = new Insets(5,5,5,5); //add vehicle types comboBox chooseVehicleTypeLabel_ = new JLabel(Messages.getString("EditOneVehicleControlPanel.selectVehicleType")); //$NON-NLS-1$ ++c.gridy; add(chooseVehicleTypeLabel_,c); chooseVehicleType_ = new JComboBox(); chooseVehicleType_.setName("chooseVehicleType"); //load vehicle types from vehicleTypes.xml into JCombobox refreshVehicleTypes(); chooseVehicleType_.addActionListener(this); c.gridx = 1; add(chooseVehicleType_, c); //add vehicle properties c.gridx = 0; JLabel jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minSpeed")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minSpeed_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minSpeed_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minSpeed_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxSpeed")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxSpeed_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxSpeed_.setPreferredSize(new Dimension(60,20));; c.gridx = 1; add(maxSpeed_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minCommDistance")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minCommDist_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minCommDist_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minCommDist_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxCommDistance")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxCommDist_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxCommDist_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxCommDist_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minWaittime")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minWait_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minWait_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minWait_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxWaittime")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxWait_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxWait_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxWait_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minBraking_rate")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minBraking_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minBraking_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minBraking_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxBraking_rate")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxBraking_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxBraking_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxBraking_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minAcceleration_rate")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minAcceleration_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minAcceleration_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minAcceleration_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxAcceleration_rate")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxAcceleration_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxAcceleration_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxAcceleration_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minTimeDistance")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minTimeDistance_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minTimeDistance_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minTimeDistance_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxTimeDistance")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxTimeDistance_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxTimeDistance_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxTimeDistance_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minPoliteness")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); minPoliteness_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); minPoliteness_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(minPoliteness_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxPoliteness")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); maxPoliteness_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); maxPoliteness_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(maxPoliteness_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.vehicleLength")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); vehicleLength_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); vehicleLength_.setPreferredSize(new Dimension(60,20)); c.gridx = 1; add(vehicleLength_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.wiFiVehicles")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); wiFi_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); wiFi_.setPreferredSize(new Dimension(60,20)); wiFi_.setValue(100); c.gridx = 1; add(wiFi_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.emergencyVehicles")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); emergencyVehicle_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); emergencyVehicle_.setPreferredSize(new Dimension(60,20)); emergencyVehicle_.setValue(0); c.gridx = 1; add(emergencyVehicle_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.amount")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); amount_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); amount_.setPreferredSize(new Dimension(60,20)); amount_.setValue(100); c.gridx = 1; add(amount_,c); c.gridx = 0; jLabel1 = new JLabel(Messages.getString("EditOneVehicleControlPanel.color")); //$NON-NLS-1$ ++c.gridy; add(jLabel1,c); colorPreview_ = new JPanel(); colorPreview_.setBackground(Color.black); colorPreview_.setSize(10, 10); colorPreview_.addMouseListener(this); c.gridx = 1; add(colorPreview_,c); c.gridx = 0; jLabel1 = new JLabel("<html>" + Messages.getString("EditVehicleControlPanel.onlyOnLowerSpeedStreets")); //$NON-NLS-1$ //$NON-NLS-2$ ++c.gridy; add(jLabel1,c); speedStreetRestriction_ = new JFormattedTextField(NumberFormat.getIntegerInstance()); speedStreetRestriction_.setPreferredSize(new Dimension(60,20)); speedStreetRestriction_.setValue(80); c.gridx = 1; add(speedStreetRestriction_,c); c.gridx = 0; c.gridwidth = 2; ++c.gridy; add(ButtonCreator.getJButton("randomVehicles.png", "createRandom", Messages.getString("EditVehicleControlPanel.createRandom"), this),c); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ c.gridx = 0; c.gridwidth = 2; ++c.gridy; add(ButtonCreator.getJButton("deleteAll.png", "clearVehicles", Messages.getString("EditVehicleControlPanel.btnClearVehicles"), this),c); TextAreaLabel jlabel1 = new TextAreaLabel(Messages.getString("EditVehicleControlPanel.note")); //$NON-NLS-1$ ++c.gridy; c.gridx = 0; c.gridwidth = 2; add(jlabel1, c); //to consume the rest of the space c.weighty = 1.0; ++c.gridy; add(new JPanel(), c); //updates the input fields to the first vehicle type actionPerformed(new ActionEvent(chooseVehicleType_,0,"comboBoxChanged")); } /** * An implemented <code>ActionListener</code> which performs all needed actions when a <code>JButton</code> * is clicked. * * @param e an <code>ActionEvent</code> */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if("createRandom".equals(command)){ //$NON-NLS-1$ Renderer.getInstance().setShowVehicles(true); Runnable job = new Runnable() { public void run() { int i, j, k, l = 0; VanetSimStart.setProgressBar(true); int maxX = Map.getInstance().getMapWidth(); int maxY = Map.getInstance().getMapHeight(); int minSpeedValue = (int)Math.round(((Number)minSpeed_.getValue()).intValue() * 100000.0/3600); int maxSpeedValue = (int)Math.round(((Number)maxSpeed_.getValue()).intValue() * 100000.0/3600); int minCommDistValue = ((Number)minCommDist_.getValue()).intValue()*100; int maxCommDistValue = ((Number)maxCommDist_.getValue()).intValue()*100; int minWaitValue = ((Number)minWait_.getValue()).intValue(); int maxWaitValue = ((Number)maxWait_.getValue()).intValue(); int minBrakingValue = ((Number)minBraking_.getValue()).intValue(); int maxBrakingValue = ((Number)maxBraking_.getValue()).intValue(); int minAccelerationValue = ((Number)minAcceleration_.getValue()).intValue(); int maxAccelerationValue = ((Number)maxAcceleration_.getValue()).intValue(); int minTimeDistance = ((Number)minTimeDistance_.getValue()).intValue(); int maxTimeDistance = ((Number)maxTimeDistance_.getValue()).intValue(); int minPoliteness = ((Number)minPoliteness_.getValue()).intValue(); int maxPoliteness = ((Number)maxPoliteness_.getValue()).intValue(); int wiFiValue = ((Number)wiFi_.getValue()).intValue(); int emergencyValue = ((Number)emergencyVehicle_.getValue()).intValue(); int speedRestriction = (int)Math.round(((Number)speedStreetRestriction_.getValue()).intValue() * 100000.0/3600); if(wiFiValue < 0){ wiFiValue = 0; wiFi_.setValue(0); } else if(wiFiValue > 100){ wiFiValue = 100; wiFi_.setValue(100); } if(emergencyValue < 0){ emergencyValue = 0; emergencyVehicle_.setValue(0); } else if(emergencyValue > 100){ emergencyValue = 100; emergencyVehicle_.setValue(100); } int amountValue = ((Number)amount_.getValue()).intValue(); boolean wiFiEnabled; boolean emergencyEnabled; ArrayDeque<WayPoint> destinations = null; Vehicle tmpVehicle; Random random = new Random(); // create the random vehicles. It may fail lots of times if the map is almost empty. Then, possible less // vehicles are created than specified because it's only tried 4 x amountValue! for(i = 0; i < amountValue;){ j = 0; k = 0; ++l; destinations = new ArrayDeque<WayPoint>(2); while(j < 2 && k < 20){ // if snapping fails more than 20 times break try{ ++k; WayPoint tmpWayPoint = new WayPoint(random.nextInt(maxX),random.nextInt(maxY),getRandomRange(minWaitValue, maxWaitValue, random)); if(tmpWayPoint.getStreet().getSpeed() <= speedRestriction){ destinations.add(tmpWayPoint); ++j; } } catch (Exception e) {} } if(k < 20) { try { if(getRandomRange(0, 99, random) < wiFiValue) wiFiEnabled = true; else wiFiEnabled = false; if(getRandomRange(0, 99, random) < emergencyValue) emergencyEnabled = true; else emergencyEnabled = false; tmpVehicle = new Vehicle(destinations, ((Number)vehicleLength_.getValue()).intValue(), getRandomRange(minSpeedValue, maxSpeedValue, random), getRandomRange(minCommDistValue, maxCommDistValue, random), wiFiEnabled, emergencyEnabled, getRandomRange(minBrakingValue, maxBrakingValue, random), getRandomRange(minAccelerationValue, maxAccelerationValue, random), getRandomRange(minTimeDistance, maxTimeDistance, random), getRandomRange(minPoliteness, maxPoliteness, random), colorPreview_.getBackground()); Map.getInstance().addVehicle(tmpVehicle); ++i; } catch (Exception e) {} } if(l > amountValue*4) break; } int errorLevel = 2; if(i < amountValue) errorLevel = 6; ErrorLog.log(Messages.getString("EditVehicleControlPanel.createdRandomVehicles") + i + " (" + amountValue +Messages.getString("EditVehicleControlPanel.requested"), errorLevel, getClass().getName(), "actionPerformed", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ VanetSimStart.setProgressBar(false); Renderer.getInstance().ReRender(false, false); } }; new Thread(job).start(); } //update GUI when vehicle type is selected else if ("comboBoxChanged".equals(command)){ if(((Component) e.getSource()).getName().equals("chooseVehicleType")){ VehicleType tmpVehicleType = (VehicleType) chooseVehicleType_.getSelectedItem(); if(tmpVehicleType != null){ maxSpeed_.setValue((int)Math.round(tmpVehicleType.getMaxSpeed() / (100000.0/3600))); vehicleLength_.setValue(tmpVehicleType.getVehicleLength()); maxCommDist_.setValue((int)Math.round(tmpVehicleType.getMaxCommDist() / 100)); maxWait_.setValue((int)tmpVehicleType.getMaxWaittime()); maxBraking_.setValue((int)tmpVehicleType.getMaxBrakingRate()); maxAcceleration_.setValue((int)tmpVehicleType.getMaxAccelerationRate()); maxTimeDistance_.setValue((int)tmpVehicleType.getMaxTimeDistance()); maxPoliteness_.setValue((int)tmpVehicleType.getMaxPoliteness()); minSpeed_.setValue((int)Math.round(tmpVehicleType.getMinSpeed() / (100000.0/3600))); minCommDist_.setValue((int)Math.round(tmpVehicleType.getMinCommDist() / 100)); minWait_.setValue((int)tmpVehicleType.getMinWaittime()); minBraking_.setValue((int)tmpVehicleType.getMinBrakingRate()); minAcceleration_.setValue((int)tmpVehicleType.getMinAccelerationRate()); minTimeDistance_.setValue((int)tmpVehicleType.getMinTimeDistance()); minPoliteness_.setValue((int)tmpVehicleType.getMinPoliteness()); colorPreview_.setBackground(new Color(tmpVehicleType.getColor())); } } } //delete all Vehicles else if("clearVehicles".equals(command)){ if(JOptionPane.showConfirmDialog(null, Messages.getString("EditVehicleControlPanel.msgBoxClearAll"), "", JOptionPane.YES_NO_OPTION) == 0){ Map.getInstance().clearVehicles(); Renderer.getInstance().ReRender(true, false); } } } /** * Gets an integer in the range between <code>min</code> and <code>max</code> (including both!). If you don't put the bigger variable in * the <code>min</code>, the variables will be automatically swapped. * * @param min the first integer (lower limit) * @param max the second integer (upper limit) * @param random the random number generator * * @return the random range */ private int getRandomRange(int min, int max, Random random){ if(min == max) return min; else { if(max < min){ //swap to make sure that smallest value is in min if wrong values were passed int tmp = max; max = min; min = tmp; } return (random.nextInt(max - min + 1) + min); } } /** * updates the vehicle types combobox */ public void refreshVehicleTypes(){ chooseVehicleType_.removeActionListener(this); //important: remove all ActionListeners before removing all items chooseVehicleType_.removeAllItems(); VehicleTypeXML xml = new VehicleTypeXML(null); for(VehicleType type : xml.getVehicleTypes()){ chooseVehicleType_.addItem(type); } chooseVehicleType_.addActionListener(this); } /** * Mouse listener used to open JColorChooser dialog when colorPreview Panel is clicked */ public void mouseClicked(MouseEvent e) { colorPreview_.setBackground(JColorChooser.showDialog(null, Messages.getString("EditOneVehicleControlPanel.color"), colorPreview_.getBackground())); } public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} }
[ "lin19921127@gmail.com" ]
lin19921127@gmail.com
493b9f0af1c8fc29145f6a7d18e7ad68cfd61c44
7773b42970a6d3492d6cefeb167eeea55a48deb9
/gun_3/src/gun_3_odev_2/User.java
04123b887cb6ae86fb85c14203f2deb4f6e40a50
[]
no_license
Mehmet-Ozan-Ozsoy/javaKampOdev
7168cd623a90bb130bc3160ecf31e011d8592c2d
412c5d559483205d720bc597c5d36c7be1479f72
refs/heads/main
2023-04-24T15:38:06.808053
2021-05-11T16:12:34
2021-05-11T16:12:34
362,233,405
0
0
null
null
null
null
UTF-8
Java
false
false
2,213
java
package gun_3_odev_2; public class User { public User() { } public User(int id, String nationalIdNumber, String firstName, String lastName, int birthYear, String birthPlace, String phone, String eMail, String address, String category) { this(); this.id = id; this.nationalIdNumber = nationalIdNumber; this.firstName = firstName; this.lastName = lastName; this.birthYear = birthYear; this.birthPlace = birthPlace; this.phone = phone; this.eMail = eMail; this.address = address; this.category = category; } private int id; private String nationalIdNumber; private String firstName; private String lastName; private int birthYear; private String birthPlace; private String phone; private String eMail; private String address; private String userCode; private String category; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNationalIdNumber() { return nationalIdNumber; } public void setNationalIdNumber(String nationalIdNumber) { this.nationalIdNumber = nationalIdNumber; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getBirthYear() { return birthYear; } public void setBirthYear(int birthYear) { this.birthYear = birthYear; } public String getBirthPlace() { return birthPlace; } public void setBirthPlace(String birthPlace) { this.birthPlace = birthPlace; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String geteMail() { return eMail; } public void setEMail(String eMail) { this.eMail = eMail; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getUserCode() { return id + firstName.substring(0,1) + lastName.substring(0,1); } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } }
[ "62773795+Mehmet-Ozan-Ozsoy@users.noreply.github.com" ]
62773795+Mehmet-Ozan-Ozsoy@users.noreply.github.com
dcf76ec356f600ebf5f8b859d267a276d4faa3f6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_c09d0527760f7c3e889562aa34510f91b5878e3b/BlockingRouter/4_c09d0527760f7c3e889562aa34510f91b5878e3b_BlockingRouter_s.java
648da2d185e64f57721fa5d485ea2f33b636317f
[]
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
3,830
java
/** * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package jmt.engine.NodeSections; import jmt.common.exception.NetException; import jmt.engine.QueueNet.BlockingRegion; import jmt.engine.QueueNet.Job; import jmt.engine.QueueNet.NetEvent; import jmt.engine.QueueNet.NetMessage; import jmt.engine.QueueNet.NetNode; /** * This class implements a blocking router, i.e. a router which sends a job inside * a region with constraints (the "blocking region"). The destination node has been * already defined (the node each job has been redirected from), therefore no * routing strategy is required. * @author Stefano Omini */ public class BlockingRouter extends OutputSection { /** Property Identifier: Routing strategy.*/ public static final int PROPERTY_ID_ROUTING_STRATEGY = 0x0101; /** Property Identifier: Busy.*/ public static final int PROPERTY_ID_BUSY = 0x0102; /** The number of waiting acks */ private int waitingAcks = 0; //TODO: dopo le modifiche non serve pi //the blocking region private BlockingRegion blockingRegion; //to speed up performance Job job = null; NetNode realDestinationNode = null; /** Creates a new instance of Router which limitates the number of * jobs entering in the region with constraints. * No routing strategy is required: the destination node is already known * when the job arrives to the input station. * @param blockingReg The blocking Region whose access is controlled by this blocking router */ public BlockingRouter(BlockingRegion blockingReg) { //FCR bug fix: Constructor modified from super() to spuer(true,false) which will enable //Jobs in Joblist at NodeSection to be automatically dropped where as for Node to be manually handled. super(true, false); this.blockingRegion = blockingReg; } @Override protected void nodeLinked(NetNode node) { blockingRegion.setInputStation(node); return; } @Override protected int process(NetMessage message) throws NetException { switch (message.getEvent()) { case NetEvent.EVENT_JOB: // Sends the message to the real destination and wait for the ack job = message.getJob(); //this is the real destination, i.e. the internal node that at first //had redirected the job to the input station realDestinationNode = job.getOriginalDestinationNode(); send(job, 0.0, realDestinationNode); waitingAcks++; return MSG_PROCESSED; case NetEvent.EVENT_ACK: //this ack has been received from one of the output nodes (router was waiting for this ack) //sends an ack back to the service section to request another job to be routed if (waitingAcks >= 0) { sendBackward(NetEvent.EVENT_ACK, message.getJob(), 0.0); } else { // Nobody was waiting this ACK. return MSG_NOT_PROCESSED; } return MSG_PROCESSED; default: return MSG_NOT_PROCESSED; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b39f074b2d5a3f88e91688381d0842435a04413e
ad6c39f979c4f1726225cf83df4016b2479bdd60
/src/main/java/vote/golos/electionobserver/Entities/Static/Theme.java
3d93b0a8de8069eb0fe223354dff4cf79bb1af91
[]
no_license
grebennikovas/ElectionObserver
f1e4d8ebbb0f9031d6d0481a7e737832c8350f84
f7721dba64093da811790f95e66bae444df0912d
refs/heads/master
2023-09-02T08:33:59.039849
2021-10-26T08:42:26
2021-10-26T08:42:26
410,393,339
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package vote.golos.electionobserver.Entities.Static; import lombok.Data; import lombok.ToString; import javax.persistence.*; @Entity @Data @ToString // Справочник тем для обучения public class Theme { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column private Long id; // наименование темы @Column(nullable = false) private String name; }
[ "Andrey.Grebennikov@sas.com" ]
Andrey.Grebennikov@sas.com
70f7d2215c9aa4a906a00ae98c913d168e4bac5b
c2459390aacab2afcef7831f5382fe28bebec1aa
/TestServer/src/org/tmatesoft/sqljet/core/internal/schema/SqlJetTableDef.java
f02f8f1d0a9ad008304f165614c5eb9f4e60f0b3
[]
no_license
element14/nocturne
0112ae31f12127e4f3c394ea9f44c283a6e283c2
cfecda760061a5d3e4867518ee7f626f749a1a15
refs/heads/master
2016-09-06T06:42:21.305878
2015-09-10T08:45:03
2015-09-10T08:45:03
10,694,825
1
1
null
null
null
null
UTF-8
Java
false
false
13,705
java
/** * SqlJetTableDef.java * Copyright (C) 2009-2013 TMate Software Ltd * * 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; version 2 of the License. * * 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. */ package org.tmatesoft.sqljet.core.internal.schema; import org.antlr.runtime.tree.CommonTree; import org.tmatesoft.sqljet.core.SqlJetErrorCode; import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.sqljet.core.internal.lang.SqlParser; import org.tmatesoft.sqljet.core.schema.*; import java.util.*; /** * @author TMate Software Ltd. * @author Dmitry Stadnik (dtrace@seznam.cz) */ public class SqlJetTableDef implements ISqlJetTableDef { private final String name; private final String quotedName; private final String databaseName; private final boolean temporary; private final boolean ifNotExists; private final List<ISqlJetColumnDef> columns; private final List<ISqlJetTableConstraint> constraints; private int page; private long rowId; private boolean rowIdPrimaryKey; private boolean autoincremented; private String primaryKeyIndexName; private String rowIdPrimaryKeyColumnName; private int rowIdPrimaryKeyColumnIndex = -1; private final List<String> primaryKeyColumns = new ArrayList<String>(); // index name -> column index constraint private final Map<String, SqlJetColumnIndexConstraint> columnConstraintsIndexCache = new TreeMap<String, SqlJetColumnIndexConstraint>( String.CASE_INSENSITIVE_ORDER); // index name -> table index constraint private final Map<String, SqlJetTableIndexConstraint> tableConstrainsIndexCache = new TreeMap<String, SqlJetTableIndexConstraint>( String.CASE_INSENSITIVE_ORDER); private final List<ISqlJetColumnDef> notNullColumnsCache = new ArrayList<ISqlJetColumnDef>(); SqlJetTableDef(String name, String databaseName, boolean temporary, boolean ifNotExists, List<ISqlJetColumnDef> columns, List<ISqlJetTableConstraint> constraints, int page, long rowid) throws SqlJetException { this.name = SqlParser.unquoteId(name); this.quotedName = name; this.databaseName = databaseName; this.temporary = temporary; this.ifNotExists = ifNotExists; this.columns = Collections.unmodifiableList(columns); this.constraints = Collections.unmodifiableList(constraints); this.page = page; this.rowId = rowid; resolveConstraints(); } public SqlJetTableDef(CommonTree ast, int page) throws SqlJetException { CommonTree optionsNode = (CommonTree) ast.getChild(0); temporary = hasOption(optionsNode, "temporary"); ifNotExists = hasOption(optionsNode, "exists"); CommonTree nameNode = (CommonTree) ast.getChild(1); name = nameNode.getText(); quotedName = SqlParser.quotedId(nameNode); databaseName = nameNode.getChildCount() > 0 ? nameNode.getChild(0).getText() : null; List<ISqlJetColumnDef> columns = new ArrayList<ISqlJetColumnDef>(); List<ISqlJetTableConstraint> constraints = new ArrayList<ISqlJetTableConstraint>(); if (ast.getChildCount() > 2) { CommonTree defNode = (CommonTree) ast.getChild(2); if ("columns".equalsIgnoreCase(defNode.getText())) { for (int i = 0; i < defNode.getChildCount(); i++) { columns.add(new SqlJetColumnDef((CommonTree) defNode.getChild(i))); } if (ast.getChildCount() > 3) { CommonTree constraintsNode = (CommonTree) ast.getChild(3); assert "constraints".equalsIgnoreCase(constraintsNode.getText()); for (int i = 0; i < constraintsNode.getChildCount(); i++) { CommonTree constraintRootNode = (CommonTree) constraintsNode.getChild(i); assert "table_constraint".equalsIgnoreCase(constraintRootNode.getText()); CommonTree constraintNode = (CommonTree) constraintRootNode.getChild(0); String constraintType = constraintNode.getText(); String constraintName = constraintRootNode.getChildCount() > 1 ? constraintRootNode.getChild(1) .getText() : null; if ("primary".equalsIgnoreCase(constraintType)) { constraints.add(new SqlJetTablePrimaryKey(constraintName, constraintNode)); } else if ("unique".equalsIgnoreCase(constraintType)) { constraints.add(new SqlJetTableUnique(constraintName, constraintNode)); } else if ("check".equalsIgnoreCase(constraintType)) { constraints.add(new SqlJetTableCheck(constraintName, constraintNode)); } else if ("foreign".equalsIgnoreCase(constraintType)) { constraints.add(new SqlJetTableForeignKey(constraintName, constraintNode)); } else { assert false; } } } } else { // TODO: handle select } } this.columns = Collections.unmodifiableList(columns); this.constraints = Collections.unmodifiableList(constraints); this.page = page; resolveConstraints(); } private void resolveConstraints() throws SqlJetException { int columnIndex = 0, autoindexNumber = 0; for (ISqlJetColumnDef column : columns) { ((SqlJetColumnDef) column).setIndex(columnIndex); boolean notNull = false; for (ISqlJetColumnConstraint constraint : column.getConstraints()) { if (constraint instanceof ISqlJetColumnPrimaryKey) { SqlJetColumnPrimaryKey pk = (SqlJetColumnPrimaryKey) constraint; primaryKeyColumns.add(column.getName()); if (column.hasExactlyIntegerType()) { rowIdPrimaryKeyColumnName = column.getName(); rowIdPrimaryKeyColumnIndex = columnIndex; rowIdPrimaryKey = true; autoincremented = pk.isAutoincremented(); } else { pk.setIndexName(primaryKeyIndexName = generateAutoIndexName(getName(), ++autoindexNumber)); columnConstraintsIndexCache.put(pk.getIndexName(), pk); } } else if (constraint instanceof ISqlJetColumnUnique) { SqlJetColumnUnique uc = (SqlJetColumnUnique) constraint; uc.setIndexName(generateAutoIndexName(getName(), ++autoindexNumber)); columnConstraintsIndexCache.put(uc.getIndexName(), uc); } else if (constraint instanceof ISqlJetColumnNotNull) { notNull = true; } else if (constraint instanceof SqlJetColumnDefault) { if (notNull) { final SqlJetColumnDefault value = (SqlJetColumnDefault) constraint; notNull = null == value.getExpression().getValue(); } } } if (notNull) { notNullColumnsCache.add(column); } columnIndex++; } for (ISqlJetTableConstraint constraint : constraints) { if (constraint instanceof ISqlJetTablePrimaryKey) { boolean b = false; SqlJetTablePrimaryKey pk = (SqlJetTablePrimaryKey) constraint; assert primaryKeyColumns.isEmpty(); primaryKeyColumns.addAll(pk.getColumns()); if (pk.getColumns().size() == 1) { final String n = pk.getColumns().get(0); final ISqlJetColumnDef c = getColumn(n); if (null == c) { throw new SqlJetException(SqlJetErrorCode.ERROR, "Wrong column '" + n + "' in PRIMARY KEY"); } else if (c.hasExactlyIntegerType()) { rowIdPrimaryKeyColumnName = n; rowIdPrimaryKeyColumnIndex = getColumnNumber(n); rowIdPrimaryKey = true; b = true; } } if (!b) { pk.setIndexName(primaryKeyIndexName = generateAutoIndexName(getName(), ++autoindexNumber)); tableConstrainsIndexCache.put(pk.getIndexName(), pk); } } else if (constraint instanceof ISqlJetTableUnique) { SqlJetTableUnique uc = (SqlJetTableUnique) constraint; uc.setIndexName(generateAutoIndexName(getName(), ++autoindexNumber)); tableConstrainsIndexCache.put(uc.getIndexName(), uc); } } } private static String generateAutoIndexName(String tableName, int i) { return SqlJetSchema.generateAutoIndexName(tableName, i); } static boolean hasOption(CommonTree optionsNode, String name) { for (int i = 0; i < optionsNode.getChildCount(); i++) { CommonTree optionNode = (CommonTree) optionsNode.getChild(i); if (name.equalsIgnoreCase(optionNode.getText())) { return true; } } return false; } public String getName() { return name; } public String getQuotedName() { return quotedName; } public String getDatabaseName() { return databaseName; } public boolean isTemporary() { return temporary; } public boolean isKeepExisting() { return ifNotExists; } public List<ISqlJetColumnDef> getColumns() { return columns; } public ISqlJetColumnDef getColumn(String name) { for (ISqlJetColumnDef column : getColumns()) { if (column.getName().equalsIgnoreCase(name)) { return column; } } return null; } public int getColumnNumber(String name) { for (ISqlJetColumnDef column : getColumns()) { if (column.getName().equalsIgnoreCase(name)) { return column.getIndex(); } } return -1; } public List<ISqlJetTableConstraint> getConstraints() { return constraints; } public boolean isRowIdPrimaryKey() { return rowIdPrimaryKey; } public boolean isAutoincremented() { return autoincremented; } // Internal API public int getPage() { return page; } public void setPage(int page) { this.page = page; } public long getRowId() { return rowId; } public void setRowId(long rowId) { this.rowId = rowId; } /** * Returns name of the primary key index. */ public String getPrimaryKeyIndexName() { return primaryKeyIndexName; } public String getRowIdPrimaryKeyColumnName() { return rowIdPrimaryKeyColumnName; } public int getRowIdPrimaryKeyColumnIndex() { return rowIdPrimaryKeyColumnIndex; } public List<String> getPrimaryKeyColumnNames() { return primaryKeyColumns; } public SqlJetColumnIndexConstraint getColumnIndexConstraint(String indexName) { return columnConstraintsIndexCache.get(indexName); } public SqlJetTableIndexConstraint getTableIndexConstraint(String indexName) { return tableConstrainsIndexCache.get(indexName); } /** * @return the notNullColumnsCache */ public List<ISqlJetColumnDef> getNotNullColumns() { return notNullColumnsCache; } // Serialization @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getPage()); buffer.append("/"); buffer.append(getRowId()); buffer.append(": "); buffer.append(toSQL(false)); return buffer.toString(); } public String toSQL() { return toSQL(true); } public String toSQL(boolean schemaStrict) { StringBuffer buffer = new StringBuffer(); buffer.append("CREATE "); if (isTemporary()) { buffer.append("TEMPORARY "); } buffer.append("TABLE "); if (!schemaStrict) { if (isKeepExisting()) { buffer.append("IF NOT EXISTS "); } if (getDatabaseName() != null) { buffer.append(getDatabaseName()); buffer.append('.'); } } buffer.append(getQuotedName()); buffer.append(" ("); List<ISqlJetColumnDef> columns = getColumns(); for (int i = 0; i < columns.size(); i++) { if (i > 0) { buffer.append(", "); } buffer.append(columns.get(i).toString()); } List<ISqlJetTableConstraint> constraints = getConstraints(); for (int i = 0; i < constraints.size(); i++) { buffer.append(", "); buffer.append(constraints.get(i).toString()); } buffer.append(')'); return buffer.toString(); } }
[ "andyaspellclark@gmail.com" ]
andyaspellclark@gmail.com
c987dd7a45297da1f85dd7fc528a0a7ae78ca36e
ae81ad9e17f2aae9abd2c6a3c0d8d2734dc9c986
/src/main/namespace/DataHelper.java
a5c567c18434afb4e6cd414347930cbef269aeea
[]
no_license
MartenOlofsson/trainingdiary
2986a4eb3cbccef03735bd76052d45213a1043db
fa4ef71ae1121db0f836541b345898f64beeb00c
refs/heads/master
2021-01-10T19:50:16.117140
2011-11-08T15:49:13
2011-11-08T15:49:13
2,734,808
0
0
null
null
null
null
UTF-8
Java
false
false
3,316
java
package main.namespace; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class DataHelper { public static final String KEY_ROWID = "_id"; public static final String KEY_NAME = "training_name"; public static final String KEY_TIME = "training_time"; public static final String KEY_DATE = "training_date"; public static final String KEY_COMMENT = "training_comment"; private static final String DATABASE_NAME = "TrainingDb"; private static final String DATABASE_TABLE = "TrainingTable"; private static final int DATABASE_VERSION = 1; private DbHelper ourHelper; private final Context ourContext; private SQLiteDatabase ourDatabase; public static class DbHelper extends SQLiteOpenHelper { public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NAME + " TEXT NOT NULL, " + KEY_DATE + " TEXT NOT NULL, " + KEY_COMMENT + " TEXT NOT NULL, " + KEY_TIME + " TEXT NOT NULL);" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE); onCreate(db); } } public DataHelper (Context c) { ourContext = c; } public DataHelper open() throws SQLException{ ourHelper = new DbHelper(ourContext); ourDatabase = ourHelper.getWritableDatabase(); return this; } public void close(){ ourHelper.close(); } public long createEntry(String activity, String date, String duration, String comment) { ContentValues cv = new ContentValues(); cv.put(KEY_NAME, activity); cv.put(KEY_TIME, duration); cv.put(KEY_DATE, date); cv.put(KEY_COMMENT, comment); return ourDatabase.insert(DATABASE_TABLE, null, cv); //http://www.youtube.com/watch?v=HRId7kvLyJk&feature=relmfu } public String getData() { String[] columns = new String[] {KEY_ROWID, KEY_NAME, KEY_TIME, KEY_DATE, KEY_COMMENT}; Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null); String result = ""; int IRow = c.getColumnIndex(KEY_ROWID); int IName = c.getColumnIndex(KEY_NAME); int ITime = c.getColumnIndex(KEY_TIME); int IDate = c.getColumnIndex(KEY_DATE); int IComment = c.getColumnIndex(KEY_COMMENT); for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) { result = result + c.getString(IDate) + " - " + c.getString(IName)+ " " + c.getString(ITime) +" ("+ c.getString(IComment)+")" + "\n"; } return result; } public void deleteEntry(int row) { int loop = 100; for(int i =0; i<loop; i++){ ourDatabase.delete(DATABASE_TABLE, KEY_ROWID + "=" + i, null); } } }
[ "marten.olofsson@valtech.se" ]
marten.olofsson@valtech.se
041d017f2b2bab37df019a3ccafc277bb4f71fcb
402c5c8352e6ec5c1f692ec075ff49047002c38b
/src/me/stutiguias/mcmmorankup/command/Help.java
11bc05a2876afb752db82d89b70d73c1eda513a8
[]
no_license
stutiguias/mcmmorankup
9e7e9b7425c579bc8b4bedc7714600cc4cbe139c
8782bdf0a6d48f56fc1bd3592ea188d59798bd8a
refs/heads/master
2021-01-18T22:09:20.817723
2020-08-26T07:49:02
2020-08-26T07:49:02
4,894,011
1
1
null
2020-08-26T05:34:40
2012-07-04T22:51:07
Java
UTF-8
Java
false
false
3,506
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 me.stutiguias.mcmmorankup.command; import me.stutiguias.mcmmorankup.Mcmmorankup; import static me.stutiguias.mcmmorankup.Mcmmorankup.Message; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; /** * * @author Daniel */ public class Help extends CommandHandler { public Help(Mcmmorankup plugin) { super(plugin); } @Override protected Boolean OnCommand(CommandSender sender, String[] args) { this.sender = sender; player = (Player) sender; SendMessage(Message.MessageSeparator); SendMessage(" &7RANKING HELP "); if (plugin.hasPermission(player, "mru.hability")) { SendMessage("&6/mru view <on|off> &7" + Message.HelpView); SendMessage("&6/mru hab &7" + Message.HelpHab); SendMessage("&6/mru hab <ability> " + SetHelpForHab()); SendMessage("&6/mru display <ability> <gender> &7" + Message.HelpDisplayHab); } if (plugin.hasPermission(player, "mru.rankup")) { SendMessage("&6/mru rank &7" + Message.HelpRank); } if (plugin.UseGenderClass && plugin.hasPermission(player, "mru.setgender")) { SendMessage("&6/mru <male|female> &7" + Message.HelpMaleFemale); } for (String key : plugin.CustomAvaibleRanks) { SendMessage("&6/mru "+ key +" &7 - set custom rank line"); } if (plugin.hasPermission(player, "mru.playerfeeds") && plugin.playerBroadcastFeed) { SendMessage("&6/mru feeds &7" + Message.HelpFeeds); } if (plugin.hasPermission(player, "mru.buyrankxp") || plugin.hasPermission(player, "mru.buyrankbuks")) { SendMessage("&6/mru buy <x | b> &7" + Message.BuyMenu.replace("%currencyname%", plugin.BuyRankCurrencyName)); } if (plugin.hasPermission(player, "mru.stats") || plugin.hasPermission(player, "mru.stats.others")) { SendMessage("&6/mru stats [player] &7Stats Skill Check. [player] Optional"); } if (plugin.hasPermission(player, "mru.admin.config")) { SendMessage(Message.MessageSeparator); SendMessage(" &7ADMIN HELP "); SendMessage("&6/mru ver &7Show mcmmoRankup version information"); SendMessage("&6/mru report &7Admin Ranking Report Options"); SendMessage("&6/mru set <setting> <value> &7Set Config. Settings"); SendMessage("&6/mru pinfo &7Toggle Next Promotion Info. &e" + (plugin.displayNextPromo ? "OFF" : "ON")); } if (plugin.hasPermission(player, "mru.admin.reload")) { SendMessage("&6/mru reload &7Reload the all configs..."); } SendMessage(Message.MessageSeparator); return true; } private String SetHelpForHab(){ String outMsg; if (!plugin.isIgnored(player)) { outMsg = "&7" + Message.HelpSethab; } else { outMsg = "&c" + Message.HelpSethabIgnore; } return outMsg; } @Override protected Boolean isInvalid(CommandSender sender, String[] args) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "dracondf@gmail.com" ]
dracondf@gmail.com
3f7913b649b627cd7d6bd6122076441bccd74574
7a6957080b475ac4e80b9390eede6eb0e14f221d
/rest-genoa/src/main/java/com/genoa/repository/LoteRepository.java
ee1bcaa82f7660ed79519eac933fb5b9f87a5cf0
[]
no_license
joaocesarfernandes/modelos
a40ff814be94d74076593efd2d6680ef333eec81
fed968d904fab988429a9c09a872c73dca55502f
refs/heads/master
2022-06-28T13:55:18.662702
2016-12-08T11:08:59
2016-12-08T11:08:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,923
java
package com.genoa.repository; import com.genoa.model.Lote; import com.genoa.model.Vendas; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.time.LocalDate; import java.util.List; import java.util.Optional; /** * Created by valdisnei on 24/09/16. */ @Repository public interface LoteRepository extends JpaRepository<Lote,Long> { @Query(value = "select lote,trunc(DTAHORA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_VENDAS " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTAHORA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteVendas(LocalDate dtalote); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_PED_PEND_COMPRA " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteCompra(LocalDate localDate); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_ESTOQUE " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteEstoque(LocalDate localDate); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_PROD_PEND_FAT " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteFaturamento(LocalDate localDate); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_PROD_PEND_REC " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,DTA_EXTRACAO,dtalote order by lote",nativeQuery = true) List<Lote> listLoteRecebimento(LocalDate localDate); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_CATALOGO " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteCatalogo(LocalDate localDate); @Query(value = "select lote,trunc(DTA_EXTRACAO) dta_extracao,dtalote,count(1) quantidade from bi_user.SETAT_GENOA_CATALOGO_STATUS " + " where lote is not null and trunc(dtalote) = ? " + " group by lote,trunc(DTA_EXTRACAO),dtalote order by lote",nativeQuery = true) List<Lote> listLoteCatalogoStatus(LocalDate localDate); }
[ "joaocesarfernandes@gmail.com" ]
joaocesarfernandes@gmail.com
7531080dcb5aab52874b748c5d0a8d04e3530291
f525deacb5c97e139ae2d73a4c1304affb7ea197
/gitv/src/main/java/com/gala/albumprovider/logic/a.java
8a69658ab2ef62a46953ec4b31dd57ae041656ca
[]
no_license
AgnitumuS/gitv
93b2359e1bf9f2b6c945298c61c5c6dbfeea49b3
242c9a10a0aeb41b9589de9f254e6ce9f57bd77a
refs/heads/master
2021-08-08T00:50:10.630301
2017-11-09T08:10:33
2017-11-09T08:10:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,828
java
package com.gala.albumprovider.logic; import android.content.Context; import android.util.SparseArray; import com.gala.albumprovider.base.IAlbumProvider; import com.gala.albumprovider.base.IAlbumSource; import com.gala.albumprovider.logic.source.AlbumChannelSource; import com.gala.albumprovider.logic.source.AlbumFavoritesSource; import com.gala.albumprovider.logic.source.AlbumSubscribeSource; import com.gala.albumprovider.logic.source.SourceTool; import com.gala.albumprovider.logic.source.search.AlbumSearchSource; import com.gala.albumprovider.model.QChannel; import com.gala.albumprovider.private.d; import com.gala.albumprovider.private.g; import com.gala.albumprovider.util.DefaultMenus; import com.gala.albumprovider.util.USALog; import com.gala.tvapi.tv2.model.Channel; import java.util.List; public class a implements IAlbumProvider { private final String a = "AlbumProvider"; public a() { DefaultMenus.initData(); } public void setChannels(List<Channel> channels) { g.a().a((List) channels); } public SparseArray<QChannel> getChannels() { return g.a().a(); } public void isNeedChannelCache(boolean isNeedCache) { d.a().a(isNeedCache); } public IAlbumSource getChannelAlbumSource(String id, boolean isFree, String version) { if (g.a().a().size() == 0) { USALog.e((Object) "getChannelAlbumSource()---MemoryCache.get().getChannelList().size() == 0"); } return new AlbumChannelSource(id, isFree); } public IAlbumSource getSearchSourceByChinese(String keyword) { return new AlbumSearchSource(keyword); } public IAlbumSource getFavouritesAlbumSource() { return new AlbumFavoritesSource(); } public IAlbumSource getSubscribeSource() { return new AlbumSubscribeSource(); } public void setContext(Context context) { SourceTool.setContent(context); } public IAlbumSource getChannelAlbumSource(String id, boolean isFree, String version, boolean isNeedLive) { if (g.a().a().size() == 0) { USALog.e((Object) "getChannelAlbumSource()---MemoryCache.get().getChannelList().size() == 0"); } return new AlbumChannelSource(id, isFree, isNeedLive); } public IAlbumSource getChannelAlbumSource(String id, boolean isFree, String version, boolean isNeedLive, boolean isSupportInitMovie) { if (g.a().a().size() == 0) { USALog.e((Object) "getChannelAlbumSource()---MemoryCache.get().getChannelList().size() == 0"); } return new AlbumChannelSource(id, isFree, isNeedLive, isSupportInitMovie); } public AlbumProviderProperty getProperty() { return b.a(); } public void setChannelCacheTime(long cacheTime) { d.a().a(cacheTime); } }
[ "liuwencai@le.com" ]
liuwencai@le.com
2bc09793ad0383eeff1465dae27e694e46a2c2c7
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava4/Foo843.java
8908130824cb88e7099be96c28d2fd5d99f9e697
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package applicationModulepackageJava4; public class Foo843 { public void foo0() { new applicationModulepackageJava4.Foo842().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
fd659d62587b52e6b274e3b91dd5c3a91061d533
8596e250bf0ce1c0f8abd0ab4b25efd1632b307f
/src/main/java/com/algorithm/a1005/Sqrt.java
7f6992ecb31f77c9e4352d155ca31eba9ce5c7e4
[]
no_license
itxingfeichen/algorithm-learning
ae47d7f1d08e8cf0c6a154dcccdd5be80ace47ff
8dd0e8616302e4399e9eae569fe13a2b700fa131
refs/heads/master
2023-08-23T16:21:29.308747
2021-10-10T13:35:03
2021-10-10T13:35:03
415,194,740
0
0
null
null
null
null
UTF-8
Java
false
false
848
java
package com.algorithm.a1005; /** * 平方根 * * @author xf.chen * @date 2021/10/5 10:59 * @since 1.0.0 */ public class Sqrt { public static int getSqrt(int num) { // 二分查找 return (int) newton(2,num); } private static int binarySearch(int num) { int index = -1, left = 0, right = num; while (left <= right) { int mid = left + (right - left) / 2; if (mid * mid <= num) { left = mid + 1; index = mid; } else { right = right - 1; } } return index; } // x = n*n public static double newton(int i, int num) { int res = (i + num /i ) / 2; if (res == i) { return res; } else { return newton(res, num); } } }
[ "chenxingfei@aixuexi.com" ]
chenxingfei@aixuexi.com
1173cb73a68140902263cd655c4b2e61dcacccba
8d3a4a4b11081245913b6369068e8607e78c0ecf
/src/org/dimigo/oop/Snack.java
a079803a4786f1c4d3a2e597f30297a85d7192f5
[]
no_license
nate2402/JavaClass
6f999b3ae983bf4f82bb181b856be7daf84abf60
3a968cd4a9048d593f5d2e4900440233bb4f798a
refs/heads/master
2020-06-17T00:54:42.081913
2019-07-08T06:18:48
2019-07-08T06:18:48
195,748,735
0
0
null
null
null
null
UTF-8
Java
false
false
1,520
java
package org.dimigo.oop; public class Snack { private String name; private String company; private int price; private int number; //constructor public Snack() { } public Snack(String name, String company, int price, int number) { this.name = name; this.company = company; this.price = price; this.number = number; } //getter public String getName() { return name; } public String getCompany() { return company; } public int getPrice() { return price; } public int getNumber() { return number; } //setter public void setName(String name) { this.name = name; } public void setCompany(String company) { this.company = company; } public void setPrice(int price) { this.price = price; } public void setNumber(int number) { this.number = number; } public int calcprice() { return(price * number); } //toString @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("이름: ").append(name) .append("\n제조사: ").append(company) .append("\n가격: ").append(String.format("%,d원",price)) .append("\n개수: ").append(number) .append("\n"); return sb.toString(); } }
[ "nate2402@naver.com" ]
nate2402@naver.com
b625300d259e67ac751336b5e76cb591124ac6ec
1144e56d2ceac368a61852b6fee254eb323ebb06
/src/Domain/Shape/Models/Size.java
0d0d518ef74f2ac2cd102092233437151abe1fca
[]
no_license
blopezv/class-diagrammer
2f45703685984eba715d3d859e0a39620b1aabb3
8a21b2248eb6097e94ae1c9d3b4d87a5e6f13bd4
refs/heads/master
2020-03-21T23:52:40.051033
2018-06-30T04:13:07
2018-06-30T04:13:07
139,211,161
0
0
null
null
null
null
UTF-8
Java
false
false
775
java
package Domain.Shape.Models; import java.io.Serializable; public class Size implements Serializable { private int height; private int width; public Size(int width, int height) { this.height = height; this.width = width; } public int getHeight() { return height; } public int getWidth() { return width; } public int getHalfHeight() { return Math.round((float) (height / 2.0)); } public int getHalfWidth() { return Math.round((float) (width / 2.0)); } public int getWidth(int percentage) { return (int) (width * (percentage / (double) 100)); } public int getHeight(int percentage) { return (int) (height * (percentage / (double) 100)); } }
[ "brendavelasco@gmail.com" ]
brendavelasco@gmail.com
6c93f2bd0790dadaf5888a5aa01f0f928178523b
bf5dad8ce0a64fe8945638725105ecd02ee9e620
/user/src/main/java/greencity/service/AchievementService.java
4227e4321dd8ae82180ef6e92b0f44bf305e0797
[ "MIT" ]
permissive
Skajl-dev/GreenCityUser
e1ef4b81f92e9ad1e3d9bded8098290ccab81350
5beede43336f5976fb2548ef3a68042b6a3f3ade
refs/heads/master
2023-02-13T15:42:34.894469
2020-12-29T17:09:45
2020-12-29T17:09:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package greencity.service; import greencity.dto.achievement.AchievementDTO; import greencity.dto.achievement.AchievementVO; import java.util.List; public interface AchievementService { /** * Method for finding all the achievements. * * @return list of all{@link AchievementDTO}. */ List<AchievementVO> findAll(); }
[ "orest199910@gmail.com" ]
orest199910@gmail.com
2fc9da2859d9ecfb690922da381953ca3bfe197d
8034bc23b7d54fb3d088c77ff09bf1f66312a950
/index.java
c163f489680df3f06e38e4e5ff8b88552162b26c
[]
no_license
SaudUlHassan/COURSERA
3b57d1cd57267be2add950befbf8533507e8d0eb
b2bd6f49b2cb5862c6a9299e42c2839b6c8d751c
refs/heads/master
2020-04-10T19:06:19.995823
2018-12-10T19:17:24
2018-12-10T19:17:24
161,223,091
0
0
null
null
null
null
UTF-8
Java
false
false
6,909
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 Interfaces; //import AdminInterfaces.index_1; import AdminInterfaces.Login_a; /** * * @author Lenovo */ public class index extends javax.swing.JFrame { /** * Creates new form index */ public index() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { admin_icon_1 = new javax.swing.JLabel(); admin_icon_2 = new javax.swing.JLabel(); user_icon_1 = new javax.swing.JLabel(); user_icon_2 = new javax.swing.JLabel(); background = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); getContentPane().setLayout(null); admin_icon_1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); admin_icon_1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { admin_icon_1MouseClicked(evt); } }); getContentPane().add(admin_icon_1); admin_icon_1.setBounds(130, 120, 200, 130); admin_icon_2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); admin_icon_2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { admin_icon_2MouseClicked(evt); } }); admin_icon_2.addAncestorListener(new javax.swing.event.AncestorListener() { public void ancestorMoved(javax.swing.event.AncestorEvent evt) { } public void ancestorAdded(javax.swing.event.AncestorEvent evt) { admin_icon_2AncestorAdded(evt); } public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { } }); getContentPane().add(admin_icon_2); admin_icon_2.setBounds(170, 280, 120, 40); user_icon_1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); user_icon_1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { user_icon_1MouseClicked(evt); } }); getContentPane().add(user_icon_1); user_icon_1.setBounds(460, 120, 190, 130); user_icon_2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); user_icon_2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { user_icon_2MouseClicked(evt); } }); getContentPane().add(user_icon_2); user_icon_2.setBounds(500, 280, 110, 40); background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagess/Index.jpg"))); // NOI18N getContentPane().add(background); background.setBounds(0, 0, 780, 500); setSize(new java.awt.Dimension(788, 527)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void admin_icon_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_admin_icon_1MouseClicked Login_a log_1 = new Login_a(); log_1.setVisible(true); this.dispose(); }//GEN-LAST:event_admin_icon_1MouseClicked private void admin_icon_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_admin_icon_2MouseClicked Login_a log_1 = new Login_a(); log_1.setVisible(true); this.dispose(); }//GEN-LAST:event_admin_icon_2MouseClicked private void user_icon_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_user_icon_2MouseClicked Login log_1 = new Login(); log_1.setVisible(true); this.dispose(); }//GEN-LAST:event_user_icon_2MouseClicked private void user_icon_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_user_icon_1MouseClicked Login log_1 = new Login(); log_1.setVisible(true); this.dispose(); }//GEN-LAST:event_user_icon_1MouseClicked private void admin_icon_2AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_admin_icon_2AncestorAdded // TODO add your handling code here: }//GEN-LAST:event_admin_icon_2AncestorAdded /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(index.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(index.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(index.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(index.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new index().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel admin_icon_1; private javax.swing.JLabel admin_icon_2; private javax.swing.JLabel background; private javax.swing.JLabel user_icon_1; private javax.swing.JLabel user_icon_2; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
18116c46c5aac1f1ad4960fdfd3af9480df8b043
755a5432e9b53191a8941591f560e7a4fc28b1a0
/java-project-server/src07/main/java/com/eomcs/lms/ServerTest.java
e7381ef516aeba4be3561e0b2463b83b3f575e93
[]
no_license
SeungWanWoo/bitcamp-java-2018-12
4cff763ddab52721f24ce8abcebcec998dacc9e3
d14a8a935ef7a4d24eb633fedea892378e59168d
refs/heads/master
2021-08-06T22:11:24.954160
2019-08-06T08:17:07
2019-08-06T08:17:07
163,650,664
0
0
null
2020-04-30T03:39:17
2018-12-31T08:00:39
Java
UTF-8
Java
false
false
1,264
java
// 4단계 : 서버 실행 테스트. package com.eomcs.lms; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; public class ServerTest { static ObjectOutputStream out; static ObjectInputStream in; public static void main(String[] args) { try (Socket socket = new Socket("127.0.0.1", 9545); ObjectOutputStream out = new ObjectOutputStream( socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream( socket.getInputStream())) { System.out.println("서버와 연결되었음."); ServerTest.in = in; ServerTest.out = out; new MemberTest(out, in).test(); System.out.println("------------------------------------"); new LessonTest(out, in).test(); System.out.println("------------------------------------"); new BoardTest(out, in).test(); System.out.println("------------------------------------"); quit(); } catch (Exception e) { e.printStackTrace(); } System.out.println("서버와 연결을 끊었음"); } static void quit() throws Exception { out.writeUTF("quit"); out.flush(); System.out.println(in.readUTF()); } }
[ "seungwan.woo94@gmail.com" ]
seungwan.woo94@gmail.com
61e6546c973ac1dc28c11d794a2c1c0c3890bf6e
81719679e3d5945def9b7f3a6f638ee274f5d770
/aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/transform/DeploymentConfigInfoMarshaller.java
329f7ca38bd4c5eb28335bfacc28afe1fc1741fc
[ "Apache-2.0" ]
permissive
ZeevHayat1/aws-sdk-java
1e3351f2d3f44608fbd3ff987630b320b98dc55c
bd1a89e53384095bea869a4ea064ef0cf6ed7588
refs/heads/master
2022-04-10T14:18:43.276970
2020-03-07T12:15:44
2020-03-07T12:15:44
172,681,373
1
0
Apache-2.0
2019-02-26T09:36:47
2019-02-26T09:36:47
null
UTF-8
Java
false
false
3,827
java
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.codedeploy.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.codedeploy.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * DeploymentConfigInfoMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DeploymentConfigInfoMarshaller { private static final MarshallingInfo<String> DEPLOYMENTCONFIGID_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("deploymentConfigId").build(); private static final MarshallingInfo<String> DEPLOYMENTCONFIGNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("deploymentConfigName").build(); private static final MarshallingInfo<StructuredPojo> MINIMUMHEALTHYHOSTS_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("minimumHealthyHosts").build(); private static final MarshallingInfo<java.util.Date> CREATETIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("createTime").timestampFormat("unixTimestamp").build(); private static final MarshallingInfo<String> COMPUTEPLATFORM_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("computePlatform").build(); private static final MarshallingInfo<StructuredPojo> TRAFFICROUTINGCONFIG_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("trafficRoutingConfig").build(); private static final DeploymentConfigInfoMarshaller instance = new DeploymentConfigInfoMarshaller(); public static DeploymentConfigInfoMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(DeploymentConfigInfo deploymentConfigInfo, ProtocolMarshaller protocolMarshaller) { if (deploymentConfigInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deploymentConfigInfo.getDeploymentConfigId(), DEPLOYMENTCONFIGID_BINDING); protocolMarshaller.marshall(deploymentConfigInfo.getDeploymentConfigName(), DEPLOYMENTCONFIGNAME_BINDING); protocolMarshaller.marshall(deploymentConfigInfo.getMinimumHealthyHosts(), MINIMUMHEALTHYHOSTS_BINDING); protocolMarshaller.marshall(deploymentConfigInfo.getCreateTime(), CREATETIME_BINDING); protocolMarshaller.marshall(deploymentConfigInfo.getComputePlatform(), COMPUTEPLATFORM_BINDING); protocolMarshaller.marshall(deploymentConfigInfo.getTrafficRoutingConfig(), TRAFFICROUTINGCONFIG_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
f8394f791bad91649c2c627a65f52b3196313867
a3c7380701dad3a0a917cdac9da1b58b28f88b2c
/Public, Private, Protected/src/PublicPrivateProtected.java
fc582bd25b834e84753a9a9704939ee2d6c4a7e6
[]
no_license
lenny666/Eclipse-Projects
266f0c2e83e34e771feca600ddfb2a09a41f35bd
7babd5bd4d69db8643789c033925f070a3090a6c
refs/heads/master
2020-06-04T12:44:01.903936
2015-03-21T17:23:36
2015-03-21T17:23:36
31,828,549
0
0
null
null
null
null
UTF-8
Java
false
false
809
java
import world.Plant; /* * private --- only within same class * public --- from anywhere * protected --- subclass and same package * no modifier --- same package only * * you can always access from the same class * classes can't be private, but they can be without public (or any other) prefix */ public class PublicPrivateProtected { public static void main(String[] args) { Plant plant = new Plant(); System.out.println(plant.name); System.out.println(plant.ID); // size is protected; this .java file is not in sama packages as Plant // Won't work //System.out.println(plant.size); // Won't work; this .java file is in different package as Plant, height has package level visibility //System.out.println(plant.height); } }
[ "lenny666@users.noreply.github.com" ]
lenny666@users.noreply.github.com
51120816e5c8493288c75fb4d3adf25f5ce07537
25c011de2e9a0b1c1c9a9d633e8c4008b2ab7861
/Project-4/Plane.java
ce94245e8100c225c52136c6867c88f04e79e6d0
[]
no_license
dbenson24/comp86
3392063c9eb8cbebb01234fffbca2839c65d70a2
21c732ec2d956897c9ca4b53cfe9ecee1f13245c
refs/heads/master
2021-01-10T12:48:43.598815
2015-12-08T20:10:57
2015-12-08T20:10:57
43,102,328
0
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
/** * File: Plane.java * Date: Oct 12, 2015 * Author: Derek * Email: Derek.Benson@tufts.edu * Description: * Plane is an abstract class that represents a drawable plane. * Protected variables include it's x and y location in pixels on the canvas, * it's current direction, speed, and altitude as an integer out of 100, * and an integer id which is supposed to be able to uniquely identify the plane. */ import java.awt.Graphics; import java.awt.Point; public abstract class Plane { protected int x, y, direction, speed, altitude, id, maxSpeed; protected boolean active; Plane(int x, int y) { active = false; this.x = x; this.y = y; direction = 0; speed = 0; altitude = 0; id = 0; maxSpeed = 0; } Plane(boolean active) { this.active = active; x = 0; y = 0; direction = 0; speed = 0; altitude = 0; id = 0; maxSpeed = 0; } Plane(boolean active, int x, int y) { this.active = active; this.x = x; this.y = y; direction = 0; speed = 0; altitude = 0; id = 0; maxSpeed = 0; } public void translate(int dx, int dy) { x = x + dx; y = y + dy; } public void setActive(boolean active) { this.active = active; } public void setSpeed(int speed) { this.speed = speed; } public int getSpeed() { return speed; } public void setAltitude(int altitude) { this.altitude = altitude; } public int getAltitude() { return altitude; } public void setDirection(int direction) { this.direction = direction; } public int getDirection() { return direction; } public void setID(int id) { this.id = id; } public int getID() { return id; } public void setMaxSpeed(int maxSpeed) { this.maxSpeed = maxSpeed; } public int getMaxSpeed() { return maxSpeed; } public void tick() { double radians = Math.toRadians((double)direction / 100.0 * 359.0); int dy = (int)((double)speed / 100 * maxSpeed * Math.cos(radians) / 20.0); int dx = (int)((double)speed / 100 * maxSpeed * Math.sin(radians) / 20.0); this.translate(dx, -dy); } abstract void draw(Graphics g); abstract boolean contains(Point p); }
[ "derek.benson@tufts.edu" ]
derek.benson@tufts.edu
4287c7a2cd4952989fb515b3f96918a6c1af5c5a
cf3b1c322d5f950d08be7ec96d0ce55fd1e47ee7
/dragonfly-core/src/main/java/com/agileapes/dragonfly/error/EntityContextReInitializationError.java
43db162d294f563a0eec4c6f925fa4dce0d8f31b
[ "MIT" ]
permissive
pooyaho/dragonfly
3b40ab869c3114541ace4eebfe45970bf2d1e1bd
c84c39fb7c8385b3912bc810505ecc9d4f2c7e00
refs/heads/master
2021-01-18T10:21:19.703600
2014-04-07T10:18:07
2014-04-07T10:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,205
java
/* * Copyright (c) 2013 AgileApes, Ltd. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall * be included in all copies or substantial portions of the * Software. */ package com.agileapes.dragonfly.error; /** * This error indicates that the entity context has been initialized once. This error helps * prevent hard-to-trace errors due to overriding injected dependencies from happening. * * @author Mohammad Milad Naseri (m.m.naseri@gmail.com) * @since 1.0 (2013/11/13, 10:32) */ public class EntityContextReInitializationError extends DataAccessError { public EntityContextReInitializationError() { super("The entity context has been initialized once, and as such cannot be initialized again."); } }
[ "m.m.naseri@gmail.com" ]
m.m.naseri@gmail.com
7f1144f007fd20f5fe2920a7ee419f1f0f576184
208ba847cec642cdf7b77cff26bdc4f30a97e795
/di/da/src/main/java/org.wp.da/ui/prefs/AccountSettingsActivity.java
b491e1aa07ad7a74c77ca3d8cac9d858e4cfd30f
[]
no_license
kageiit/perf-android-large
ec7c291de9cde2f813ed6573f706a8593be7ac88
2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8
refs/heads/master
2021-01-12T14:00:19.468063
2016-09-27T13:10:42
2016-09-27T13:10:42
69,685,305
0
0
null
2016-09-30T16:59:49
2016-09-30T16:59:48
null
UTF-8
Java
false
false
1,533
java
package org.wp.da.ui.prefs; import android.app.FragmentManager; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import org.wp.da.ui.ActivityLauncher; public class AccountSettingsActivity extends AppCompatActivity { private static final String KEY_ACCOUNT_SETTINGS_FRAGMENT = "account-settings-fragment"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } FragmentManager fragmentManager = getFragmentManager(); AccountSettingsFragment accountSettingsFragment = (AccountSettingsFragment) fragmentManager.findFragmentByTag(KEY_ACCOUNT_SETTINGS_FRAGMENT); if (accountSettingsFragment == null) { accountSettingsFragment = new AccountSettingsFragment(); fragmentManager.beginTransaction() .add(android.R.id.content, accountSettingsFragment, KEY_ACCOUNT_SETTINGS_FRAGMENT) .commit(); } } @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; } return super.onOptionsItemSelected(item); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
62196d234e3bff4fc031cf8489cae12c0d6435af
901756053cbc9828d15e81d585123804f0e028df
/datamapper/org.wso2.datamapper.engine/src/main/java/org/wso2/datamapper/engine/core/writer/WriterRegistry.java
3e4e7c5e2857995ed939a588178f976fcec58b42
[ "Apache-2.0" ]
permissive
Gayany/developer-studio
9d5bbe6fbefdf056f00d1e5d774bcac64b6c6e1e
4db36ffea7cac55b5f6b1883beaf6680f89e3fce
refs/heads/master
2021-01-14T08:31:07.660709
2014-06-24T08:15:09
2014-06-24T08:15:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,042
java
/* * Copyright 2005,2014 WSO2, Inc. http://www.wso2.org * * 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.wso2.datamapper.engine.core.writer; import java.util.HashMap; import java.util.Map; import org.apache.avro.generic.GenericRecord; import org.apache.avro.io.DatumWriter; /** * A registry of writer. */ public class WriterRegistry { /** * Singleton instance. */ private static WriterRegistry singleton; /** * writer map. */ private Map<String, Class<? extends DatumWriter<GenericRecord>>> writerMap; /** * */ private WriterRegistry() { writerMap = new HashMap<String, Class<? extends DatumWriter<GenericRecord>>>(); // FIXME : use java service provider interface rather than hard-coding class names/ importing classes writerMap.put("text/csv",CSVDatumWriter.class); writerMap.put("application/xml", XMLDatumWriter.class); writerMap.put("application/json", JSONDatumWriter.class); } /** * @return singleton instance. */ public static WriterRegistry getInstance() { if (null == singleton) { singleton = new WriterRegistry(); } return singleton; } @SuppressWarnings("unchecked") public Class<DatumWriter<GenericRecord>> get(String mediaType){ Class<DatumWriter<GenericRecord>> writer = null; if(writerMap.containsKey(mediaType)){ writer = (Class<DatumWriter<GenericRecord>>) writerMap.get(mediaType); } else { throw new RuntimeException("No writer found for " + mediaType); } //FIXME: use proper error handling return writer; } }
[ "jasinthad@gmail.com" ]
jasinthad@gmail.com
3aab70394ee0fc3d09a85aad373fc07a324795b0
76cb8b6291f6444d018694181cd493d65eba0f35
/api/src/main/java/com/perhab/napalm/statement/InvocationError.java
86b599fbc14158de796d94a012699080d9c45ec4
[]
no_license
bigbear3001/java-performance-test
691430fd658c7e9f527a4572bee3aeb4b582b1ac
996e8b8d56e1096c6dc8b0f5825f4c96821e4b26
refs/heads/master
2021-06-03T02:31:23.599062
2017-12-05T20:22:20
2017-12-05T20:22:20
4,754,564
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
package com.perhab.napalm.statement; public class InvocationError extends RuntimeException { public InvocationError(String message, Exception e) { super(message, e); } }
[ "bigbear.ap@gmail.com" ]
bigbear.ap@gmail.com
354b907687d56b909fb6d29d119e51c7174558f0
23bac07b363f1cee09a17b9411b779dadc2004e4
/backup/Lifter.java
56332f3d1541f6028ab5ab008da2c778806f1218
[]
no_license
FRC1735/2015RecycleRush
780b714831f4c17661752c7b791d0036b717cefa
b6173100a150ef5dd39832e972ca5e4e7a52b30b
refs/heads/master
2021-05-29T01:04:41.461772
2015-05-26T13:10:29
2015-05-26T13:10:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,860
java
// RobotBuilder Version: 1.5 // // This file was generated by RobotBuilder. It contains sections of // code that are automatically generated and assigned by robotbuilder. // These sections will be updated in the future when you export to // Java from RobotBuilder. Do not put any code or make any change in // the blocks indicating autogenerated code or it will be lost on an // update. Deleting the comments indicating the section will prevent // it from being updated in the future. package org.usfirst.frc1735.RecycleRush2015.subsystems; import org.usfirst.frc1735.RecycleRush2015.Robot; import org.usfirst.frc1735.RecycleRush2015.RobotMap; import org.usfirst.frc1735.RecycleRush2015.commands.LiftWithJoystick; import edu.wpi.first.wpilibj.AnalogPotentiometer; import edu.wpi.first.wpilibj.Counter; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.Servo; import edu.wpi.first.wpilibj.Solenoid; import edu.wpi.first.wpilibj.SpeedController; import edu.wpi.first.wpilibj.command.PIDSubsystem; import edu.wpi.first.wpilibj.livewindow.LiveWindow; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.CANTalon; /** * */ public class Lifter extends PIDSubsystem { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS SpeedController lifterMotor = RobotMap.lifterLifterMotor; Servo ratchetServo = RobotMap.lifterRatchetServo; Solenoid ratchetPiston = RobotMap.lifterRatchetPiston; DigitalInput toteReadyIndicator = RobotMap.lifterToteReadyIndicator; AnalogPotentiometer liftHeightPot = RobotMap.lifterLiftHeightPot; DigitalInput limitHigh = RobotMap.lifterLimitHigh; DigitalInput limitLow = RobotMap.lifterLimitLow; // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS // Add a possible counter to detect limit switch pulse (in case we travel PAST the limit switch) Counter highLimitCounter = new Counter(limitHigh); // HACK ALERT: // RobotBuilder doesn't support CANTalon, so manually creating it. CANTalon lifterMotorCAN = RobotMap.lifterLifterMotorCAN; // Lifter ratchet constants public static final double RATCHET_ENGAGED = 90; //degrees public static final double RATCHET_DISENGAGED = 0; // Initialize your subsystem here public Lifter() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID super("Lifter", 1.0, 0.0, 0.0); setAbsoluteTolerance(0.2); getPIDController().setContinuous(false); LiveWindow.addActuator("Lifter", "PIDSubsystem Controller", getPIDController()); // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID // Set the source edge counter for the limit switch counter highLimitCounter.setUpSourceEdge(false, true); // rising edge, falling edge. Our switch triggers on a falling edge. // Use these to get going: // setSetpoint() - Sets where the PID controller should move the system // to // enable() - Enables the PID controller. // Initialize the ratchet wait time variables to zero/false so that it is a known (and small) value. // This is needed so that if the first thing we do with the robot is go "up", then the code that waits for current time to be later than the wait time will work properly m_ratchetWaitTime = 0; m_liftWaitTime = 0; m_releasingRatchet = false; m_heightPotTimeoutCounter = 0; m_lastHeightPotValue = 8.5; // Assume pot was roughly at lowest position when program started. // FOR PID subsystem use: // Downward rotation of the motor is faster than the lifter will fall, and we tend to get the rope all tangled up off the spooler. // Thus, clamp any negative magnitudes to some smaller (tunable) max so that we avoid this issue. //FIXME: Causes exception: Robot.lifter.setOutputRange(-0.3333, 1); // Limit downward speed to 33% // Try this instead: setOutputRange(-0.3333,1); // Limit downward speed to 33% } public void initDefaultCommand() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND setDefaultCommand(new LiftWithJoystick()); // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND // Set the default command for a subsystem here. //setDefaultCommand(new MySpecialCommand()); } protected double returnPIDInput() { // Return your input value for the PID loop // e.g. a sensor, like a potentiometer: // yourPot.getAverageVoltage() / kYourMaxVoltage; // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE return liftHeightPot.get(); // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE } protected void usePIDOutput(double output) { // Use output to drive your system, like a motor // e.g. yourMotor.set(output); // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=OUTPUT lifterMotor.pidWrite(output); // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=OUTPUT // HACK to allow use of CANTalon. Above motor is not utilized. // PID debug, step one: physically disable the pawl and directly control the motor until we get a basic PID tuning // TODO: Comment this line out when we proceed to step two of the PID debug. //lifterMotorCAN.pidWrite(output); // Step two... we can't just directly move to the setpoint because of the ratchet. // So, use the a wrapper function that the joystick manual override can also (eventually) use. // for now, keep the functions separate so that we dont screw up the joystick control until we have the PID system humming along! //lifterMove(output, System.currentTimeMillis()*1000); // Send current time in seconds to match Command time granularity } // --------------------------------- // User-defined functions start here // --------------------------------- public void ratchetDisengage() { // RobotMap.lifterRatchetServo.setAngle(RATCHET_DISENGAGED); // Post-Reading, we switched the ratchet mechanism and replaced the servo with a pneumatic piston RobotMap.lifterRatchetPiston.set(true); } public void ratchetEngage() { // RobotMap.lifterRatchetServo.setAngle(RATCHET_ENGAGED); // Post-Reading, we switched the ratchet mechanism and replaced the servo with a pneumatic piston RobotMap.lifterRatchetPiston.set(false); } // Wrapper PID function for handling ratchet plus lifter. Called by Commands. public void lifterMove(double setpoint, double currentTime) { // Because there is a ratchet interlock, we need to determine if the ratchet needs to be disengaged before invoking the PID controller! // Handle the ratchet pawl // If the current encoder value is BELOW (or equal to) the setpoint, engage the ratchet. // If the current encoder value is ABOVE the setpoint, we have to lower the lift and should DISENGAGE the ratchet. boolean goingUp = (Robot.lifter.getPosition() < setpoint), stoppedOrGoingUp = (Robot.lifter.getPosition() <= setpoint); if (stoppedOrGoingUp) { ratchetEngage(); } else { // Find out if the ratchet is currently engaged: if (!m_releasingRatchet && (RobotMap.lifterRatchetServo.getAngle() >10)) { // engaged is 90. Use >10 rather than >0 just in case the servo didn't truly reach zero for some reason. //Then we are requesting a state change to the ratchet. // We need to goose the motor up a little bit in order to get the ratchet disengaged from the pawl, // as gravity could be forcing the ratchet down against it and rendering it impossible to lift the pawl! // Make a guess that 40% up for the duration we wait for the servo will be sufficient: // If we are right up against the limit switch or hard limit... this may not work, // or may jam us completely since it ignores the limit switch and could travel up to the Point of No Return. // Problem is, if we ran up to the high limit already, we can only go down, so we have to rise up a little bit even if the limit switch were activated. // thus, we set the lifter magnitude to just barely rise and take the load off the pawl, but **HOPEFULLY** not enough to completely jam us. // #FINGERSCROSSED m_releasingRatchet = true; ratchetDisengage(); //Set a 40ms timer to let server get out of the way before we engage the motor downwards. m_liftWaitTime = currentTime + 0.2; m_ratchetWaitTime = currentTime + 0.25;// With a 50ms PID polling loop, this should put us one loop out. } } if (m_releasingRatchet && (currentTime <= m_liftWaitTime)) { // Here we need to run the motor up to get the backpressure off the pawl //lifterMotorCAN.set(1.0); } // Wait a moment for the ratchet to get out of the way. // Get the current count, and continue only if we are far enough beyond it. // Note: for going up, m_ratchetWaitTime will be either the constructor-time init value (0) or the last time we lowered... both of which will be less than the current time. if (currentTime >= m_ratchetWaitTime) { // Clear the flag. we're done with waiting. m_releasingRatchet = false; // finally, move the lifter directly. Motor controller and joystick both work on -1..1 value range. // We need limit switches to protect top and bottom lifter movement! // Only move the motor if the requested direction is not in the same direction as a pressed limit switch. if (!((goingUp && reachedHighLimit()) || (!stoppedOrGoingUp && reachedLowLimit()))) { // Here we are NOT asking to move higher, but the high limit is set... or lower, but the low limit is set... // So, we can move the motor. Clamping of downward motion handled in the lifter's constructor. Robot.lifter.setSetpoint(setpoint); Robot.lifter.enable(); } // Otherwise, we have hit a limit switch and are requesting to go even further. // Ignore the request and just return. } // If not, then the ratchet may not be out of the way and we can't move the motor yet. } public void liftWithJoystick(Joystick lifterJoy, double currentTime) { //if (Robot.oi.getAccessoryJoystick().getTrigger()) { return;) // // Collect the Joystick info. // We need to filter out very small joystick values and clamp them to zero // so that a slightly off-center joystick doesn't send signals to the motor. // Joystick is reversed direction (up is negative) double joy = lifterJoy.getY(); //Apply Filter if (Math.abs(joy) < Robot.m_joystickFilter) {joy = 0;} // We don't use a PID controller at this point (As we don't have a good feedback mechanism). // Even if using a PID, you could use the joystick to bump the setpoint up and down. :-) // // Instead, explicitly make sure the PID controller is disabled, and then access the motor controller directly. // Use limit switches to prevent us from (literally) going off the rails. Robot.lifter.disable(); // Make sure the PID controller is still disabled (in case something enabled it) double magnitude = joy; // We want joystick "up" (negative joy values) to be lifter down, keep polarity numbers for the remainder of the calculations.... liftWithLimits(magnitude, currentTime); } // NON-PID function for controlling the lifter public void liftWithLimits(double magnitude, double currentTime) { double currentHeight = liftHeightPot.get(); // Used for downward timeout counter // Handle the ratchet pawl // if we are going up (or stopping!), engage the ratchet. // If we are going down, disengage the ratchet // Negative Y values are joystick-forward. Define that as "down". if (magnitude >= 0) { ratchetEngage(); m_heightPotTimeoutCounter = 0; // reset the counter that determines if we stalled going down } else { // Find out if the ratchet is currently engaged: // Post-Reading we swapped the servo for a piston... //if (!m_releasingRatchet && (RobotMap.lifterRatchetServo.getAngle() > 10)) { // engaged is 90. Use >10 rather than >0 just in case the servo didn't truly reach zero for some reason. if (!m_releasingRatchet && (!RobotMap.lifterRatchetPiston.get())) { // engaged is 'false' (piston active fights the spring and releases the pawl) //Then we are requesting a state change to the ratchet. // We need to goose the motor up a little bit in order to get the ratchet disengaged from the pawl, // as gravity could be forcing the ratchet down against it and rendering it impossible to lift the pawl! // Make a guess that 40% up will be sufficient: // If we are right up against the limit switch or hard limit... this may not work, // or may jam us completely since it ignores the limit switch and could travel up to the Point of No Return. // Problem is, if we ran up to the high limit already, we can only go down, so we have to rise up a little bit even if the limit switch were activated. // thus, we set the lifter magnitude to just barely rise and take the load off the pawl, but **HOPEFULLY** not enough to completely jam us. // #FINGERSCROSSED m_releasingRatchet = true; ratchetDisengage(); //Set a 40ms timer to let server get out of the way before we engage the motor downwards. m_liftWaitTime = currentTime + 0.2; //m_ratchetWaitTime = currentTime + 0.25;// With a 20ms polling loop, this should put us two loops out. One was not enough. m_ratchetWaitTime = currentTime + 0.1;// With a 20ms polling loop, this should put us five loops out. Plenty of time for a fast piston... } } /* No longer needed with piston if (m_releasingRatchet && currentTime <= m_liftWaitTime) { // Here we need to run the motor up to get the backpressure off the pawl //lifterMotorCAN.set(1.0); // Motor magnitude is nonlinear, so 40% of full value is actually much less than that power-wise. } */ // Wait a moment for the ratchet pawl to get out of the way. // Get the current count, and continue only if we are far enough beyond it. // Note: for going up, m_ratchetWaitTime will be either the constructor-time init value (0) or the last time we lowered... both of which will be less than the current time. if (currentTime >= m_ratchetWaitTime) { // Clear the flag. we're done with waiting. m_releasingRatchet = false; // finally, move the lifter directly. Motor controller and joystick both work on -1..1 value range. // We need limit switches to protect top and bottom lifter movement! // Only move the motor if the requested direction is not in the same direction as a pressed limit switch. if (!(((magnitude >= 0) && reachedHighLimit()) || ((magnitude < 0) && reachedLowLimit()))) { // Here we are NOT asking to move higher, but the high limit is set... or lower, but the low limit is set... // So, we can move the motor // Downward rotation of the motor is faster than the lifter will fall, and we tend to get the rope all tangled up off the spooler. // Thus, clamp any negative magnitudes to some smaller (tunable) max so that we avoid this issue. if (magnitude < -0.3333) { magnitude = -0.3333; }// Clamp downward motion to a max of this value // Next problem: If the lifter arm hits an obstacle (like, say, a misaligned tote) the motor will continue to // unspool and the rope will STILL unspool and tangle. // So, check whether the tape pot has moved since the last N polling intervals. If it hasn't, then // we should stop the motor from going further down. if (magnitude < 0) { // Allow for some noise in the system. Say, +/- 0.1... double delta_low = m_lastHeightPotValue - 0.1 ; // relative to pot double delta_high = m_lastHeightPotValue + 0.1; if ((currentHeight > delta_low) && (currentHeight < delta_high)) { // e.g. delta_low = 6.9 // current = 7.0 // delta_high = 7.1 // if > low and < high, we are within the noise margin of not having moved since the last polling interval. m_heightPotTimeoutCounter++; } } // if going down if (m_heightPotTimeoutCounter <= 5) { lifterMotorCAN.set(magnitude); if (Robot.m_debugOn) {System.out.println("engaging lifter with magnitude = " + magnitude);} // Alternate counter-based limit switch would need to reset the counter if moving in a direction away from the limit switch, e.g., //if (magnitude < 0) {highLimitCounter.reset()}; } else { // otherwise we were moving down and the tape pot wasn't keeping pace. Don't move the motor. // Also, put a big visual indicator on the screen to indicate the condition! SmartDashboard.putBoolean("Down Stall", true); System.out.println("Down Timeout reached! Count = " + m_heightPotTimeoutCounter); } } // limitswitch check // Otherwise, we have hit a limit switch and are requesting to go even further. // Ignore the request and just return. // Update the value, but only if we were not in the ratchet wait time interval (where we aren't moving the motor!) m_lastHeightPotValue = currentHeight; // save for next iteration } // Ratchet wait time } public boolean reachedHighLimit() { // Digital IO reads a '1'/true when nothing is connected. // If the switch gets ripped out, we want to continue operations, so we want "ok to move" to be ==1 // Therefore 'hit limit' should be ==0 (meaning return the opposite of what we read) // Assumes switch wiring is momentary contact = grounded return (!limitHigh.get()); // Alternate counter-based implementation: ///return (highLimitCounter.get() > 0); } public boolean reachedLowLimit() { // Digital IO reads a '1'/true when nothing is connected. // If the switch gets ripped out, we want to continue operations, so we want "ok to move" to be ==1 // Therefore 'hit limit' should be ==0 (meaning return the opposite of what we read) // Assumes switch wiring is momentary contact = grounded return (!limitLow.get()); } public void stop() { disable(); lifterMotorCAN.set(0); } public double calculateMagnitudeDirection(double setpoint) { // Based on current position and desired setpoint, return the Direction/Magnitude. // Do this in a general function for maintainability. // Query the Tape Pot. Rough values: // 9 is lowest height, 3 is highest. double currentPosition = liftHeightPot.get(); if (currentPosition >= setpoint) { // Pot is wired for high numbers = low elevator, low numbers = high elevator. //Therefore a currentPosition value larger than the setpoint means we are below it. We need to go up. return 1.0; // For now, assume "up" is full strength to combat large stacks. } else { // Else, we go down return -0.3333; // For now, assume "Down" is clamped to 1/3 speed so that the motor doesn't spin faster than gravity pulls the load down. } } public boolean lifterTargetReached(double setpoint, double currentPosition, double magnitudeDirection) { // Pot is wired for high numbers = low elevator, low numbers = high elevator. //Therefore a currentPosition value larger than the setpoint means we are below it. return (((magnitudeDirection >= 0) && currentPosition <= setpoint) || // if going up and have exceeded setpoint (smaller means above), or ((magnitudeDirection < 0 ) && currentPosition >= setpoint)); // if going down and have exceeded setpoint (bigger value means below) } // Storage for the end time of the ratchet delay wait double m_liftWaitTime; double m_ratchetWaitTime; boolean m_releasingRatchet; double m_heightPotTimeoutCounter; double m_lastHeightPotValue; }
[ "s-taylor@att.net" ]
s-taylor@att.net
a0950c0a750558d6b363d73b725df785fcf22798
dbec444d769dd76ed192245ca134e3c7372a70ad
/app/src/main/java/com/example/hoanglong/bushelper/POJO/BusStopDB.java
7310c443195efe565f74a64a8a3dc782bef8f66b
[]
no_license
hoanglong26/BusHelper
bba4eeb9cf220c42c1674d23cf2effb51ded6278
cdc0420e59d54346e23966852b99787de50b72b2
refs/heads/master
2020-12-02T23:54:36.617259
2017-11-07T01:10:30
2017-11-07T01:10:30
95,959,511
3
0
null
null
null
null
UTF-8
Java
false
false
1,566
java
package com.example.hoanglong.bushelper.POJO; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by hoanglong on 10-Jul-17. */ public class BusStopDB { @SerializedName("Beacon_BusStop") private List<BeaconBusStop> beaconList; @SerializedName("id") private int id; @SerializedName("name") private String name; @SerializedName("latitude") private double latitude; @SerializedName("longitude") private double longitude; @SerializedName("BusInfo_BusStop") private List<BusInfoBusStop> busInfoBusStops; public List<BusInfoBusStop> getBusInfoBusStops() { return busInfoBusStops; } public void setBusInfoBusStops(List<BusInfoBusStop> busInfoBusStops) { this.busInfoBusStops = busInfoBusStops; } public List<BeaconBusStop> getBeaconList() { return beaconList; } public void setBeaconList(List<BeaconBusStop> beaconList) { this.beaconList = beaconList; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } }
[ "long.phamlp94@gmail.com" ]
long.phamlp94@gmail.com
d1acf40f27ec4d1b27a1fcfea9118fe0a28e820c
b8b6c4398e606549573a528c296739a1f77d2031
/projetomv-persistence/src/main/java/br/com/projetomv/dto/MensagemRetornoDTO.java
7c501fe1ce70128c17e1932ee867e69071d84b30
[]
no_license
antoniorafaelcl/projetomv-backend
ed527da09dc2650ed6a749c800fe99cc1fbd7ebd
2f4835000dd5141a53fe52e3a478f71946afdba3
refs/heads/master
2022-12-04T20:11:50.066694
2020-08-20T07:41:12
2020-08-20T07:41:12
287,542,738
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package br.com.projetomv.dto; public class MensagemRetornoDTO extends BaseDTO { private static final long serialVersionUID = -5607996709576941404L; private String mensagem; public MensagemRetornoDTO() { super(); } public MensagemRetornoDTO(String mensagem) { super(); this.mensagem = mensagem; } public String getMensagem() { return mensagem; } public void setMensagem(String mensagem) { this.mensagem = mensagem; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mensagem == null) ? 0 : mensagem.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MensagemRetornoDTO other = (MensagemRetornoDTO) obj; if (mensagem == null) { if (other.mensagem != null) return false; } else { if (!mensagem.equals(other.mensagem)) { return false; } } return true; } }
[ "antoniorafaelcl@gmail.com" ]
antoniorafaelcl@gmail.com
3712e68abf8eeb8f6f57f076966fe7f4cad948e8
321b7273a4a059341b2db96fac4bec03929d85bb
/bleconsultant/src/main/java/ml/xuexin/bleconsultant/tool/BleLog.java
2572fa1174a4615d00e041716ec64c07655269fa
[]
no_license
MakeblockAndroid/BleConsultant
99ec66ddc0602ee893151e6e6e4c6c2841adddf9
61ab47c55a4555f2943ed22d4e228eebeee62afa
refs/heads/master
2021-01-22T19:05:03.384308
2020-11-24T01:40:52
2020-11-24T01:40:52
85,162,574
2
0
null
null
null
null
UTF-8
Java
false
false
966
java
package ml.xuexin.bleconsultant.tool; import android.util.Log; /** * Created by xuexin on 2017/3/7. */ public class BleLog { public static boolean DEBUG = false; public static final String TAG = "BleConsultant"; public static void e(String msg) { if (msg != null) Log.e(TAG, msg); } public static void d(String msg) { if (msg != null) if (DEBUG) Log.d(TAG, msg); } public static void w(String msg) { if (msg != null) if (DEBUG) Log.w(TAG, msg); } public static void i(String msg) { if (msg != null) if (DEBUG) Log.i(TAG, msg); } /** * parse byte[] to hex string * * @param data * @return */ public static String parseByte(byte[] data) { String s = ""; for (int i = 0; i < data.length; ++i) { s += String.format(" %02x", data[i] & 0x0ff); } return s; } }
[ "taiyangniaoming@foxmail.com" ]
taiyangniaoming@foxmail.com
b5bc602292eeea51c33dc0b19d844845a2ec8bba
632290eceb705611bd01183001cd62c50b218763
/src/main/java/com/etc/api/param/SaveCartItemParam.java
0a13f04ccf260d96655af03d5f31e8f174ef9f07
[]
no_license
watormail/finalwatershop
491375e8f3e602d430d1c7a37b5ca762614b7cc1
adf33a05a9140ad1eba0d19e07cf936e1a2c59de
refs/heads/master
2023-02-19T12:00:54.496658
2021-01-21T01:16:42
2021-01-21T01:16:42
331,477,298
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
/** * 严肃声明: * 开源版本请务必保留此注释头信息,若删除我方将保留所有法律责任追究! * 本软件已申请软件著作权,受国家版权局知识产权以及国家计算机软件著作权保护! * 可正常分享和学习源码,不得用于违法犯罪活动,违者必究! * Copyright (c) 2020 十三 all rights reserved. * 版权所有,侵权必究! */ package com.etc.api.param; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; /** * 添加购物项param */ @Data public class SaveCartItemParam implements Serializable { @ApiModelProperty("商品数量") private Integer goodsCount; @ApiModelProperty("商品id") private Long goodsId; }
[ "774198485@qq.com" ]
774198485@qq.com
31959c28c9cb3a256f3864fa5398e59829bf1095
44af0c79617dbb6b713773fa512425c128cf1244
/LibrarySystem/app/src/main/java/com/nyit/librarysystem/admin/AdminAddBook.java
2b9b9c0fe31f8e59f3e2fe4760a01f50b3758736
[]
no_license
kishangabani/Library_Management_System
f80c910a2d3fb3675833e751c8d37dc6defcc7d2
d1f01fc9317102caa786b43857afbc56329a51f6
refs/heads/master
2021-01-20T22:09:38.895991
2017-08-29T19:40:21
2017-08-29T19:40:21
101,798,766
1
1
null
null
null
null
UTF-8
Java
false
false
5,922
java
package com.nyit.librarysystem.admin; import java.io.IOException; import java.util.ArrayList; import com.nyit.helper.DataBaseHelper; import com.nyit.librarysystem.R; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Spinner; import android.widget.Toast; public class AdminAddBook extends Activity{ private LinearLayout llRadio,llExisting,llnewBook,llCommon; private RadioGroup radioAddBookGroup; private RadioButton radioAddBookButton; private Button btnSubmit,btnLLExisting; private Spinner spISBN,spBranch,spPosition,spPublisher; private EditText edtISBN,edtTitle,edtAuthor,edtPubDate; private DataBaseHelper db; int selectedId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.admin_addbook); try { db = new DataBaseHelper(this); } catch (IOException e) { e.printStackTrace(); } setListener(); btnSubmit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectedId = radioAddBookGroup.getCheckedRadioButtonId(); radioAddBookButton = (RadioButton) findViewById(selectedId); Toast.makeText(AdminAddBook.this,radioAddBookButton.getText(), Toast.LENGTH_SHORT).show(); llRadio.setVisibility(View.GONE); if (selectedId == R.id.radioExisting) { ArrayList<String> isbnList = new ArrayList<String>(); isbnList = db.getAllISBN(); ArrayAdapter<String> isbnAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, isbnList); spISBN.setAdapter(isbnAdapter); llExisting.setVisibility(View.VISIBLE); llCommon.setVisibility(View.VISIBLE); } if (selectedId == R.id.radioNew) { ArrayList<String> publisherList = new ArrayList<String>(); publisherList = db.getAllPublisher(); ArrayAdapter<String> publisherAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, publisherList); spPublisher.setAdapter(publisherAdapter); llnewBook.setVisibility(View.VISIBLE); llCommon.setVisibility(View.VISIBLE); } ArrayList<String> branchList = new ArrayList<String>(); branchList = db.getAllBranch(); ArrayAdapter<String> branchAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, branchList); spBranch.setAdapter(branchAdapter); ArrayList<String> positionList = new ArrayList<String>(); positionList = db.getAllPositioin(); ArrayAdapter<String> positionAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, positionList); spPosition.setAdapter(positionAdapter); btnLLExisting.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String selectedISBN = "",title="",authorName="",pubDate="",selectedPublisher; String selectedBranch = (String) spBranch.getSelectedItem(); String selectedposition = (String) spPosition.getSelectedItem(); if (selectedId == R.id.radioExisting) { selectedISBN = (String) spISBN.getSelectedItem(); int bookID = db.getBookID(selectedISBN); int branchID = db.getBranchID(selectedBranch); Long insID = db.addBookLocation(bookID,branchID,selectedposition); if (insID>0) { Toast.makeText(getApplicationContext(), "Book "+bookID+" is added", Toast.LENGTH_LONG).show(); //finish(); }else { Toast.makeText(getApplicationContext(), "Book "+bookID+" is not added", Toast.LENGTH_LONG).show(); } } else if (selectedId == R.id.radioNew) { selectedISBN = edtISBN.getText().toString(); title = edtTitle.getText().toString(); selectedPublisher = (String) spPublisher.getSelectedItem(); authorName = edtAuthor.getText().toString(); pubDate = edtPubDate.getText().toString(); Long insIDAu = db.addAuthor(authorName); Long insIDBo = db.addBook(selectedISBN); int publisherID = db.getPublisherID(selectedPublisher); int authorID = db.getAuthorID(authorName); Long insIDbi = db.addBookInfo(selectedISBN,title,publisherID,pubDate,authorID); Log.e("Author Book BookInfo", insIDAu+" "+insIDBo+" "+insIDbi); if (insIDbi>0) { Toast.makeText(getApplicationContext(), "Book is added", Toast.LENGTH_LONG).show(); //finish(); }else { Toast.makeText(getApplicationContext(), "Book is not added", Toast.LENGTH_LONG).show(); } System.out.println(insIDbi); //author,book,bookinfo } else { } } }); } }); } private void setListener() { radioAddBookGroup = (RadioGroup) findViewById(R.id.radioAddBook); btnSubmit = (Button) findViewById(R.id.btnRadio); llRadio = (LinearLayout) findViewById(R.id.llRadio); llExisting = (LinearLayout) findViewById(R.id.llExistingBook); llCommon = (LinearLayout) findViewById(R.id.llCommon); llnewBook = (LinearLayout) findViewById(R.id.llnewBook); spISBN = (Spinner) findViewById(R.id.spISBN); spBranch = (Spinner) findViewById(R.id.spBranch); spPosition = (Spinner) findViewById(R.id.spPosition); spPublisher = (Spinner) findViewById(R.id.spPublisher); btnLLExisting = (Button) findViewById(R.id.btnLlExisting); edtISBN = (EditText) findViewById(R.id.edtISBN); edtTitle = (EditText) findViewById(R.id.edtTitle); edtAuthor = (EditText) findViewById(R.id.edtAuthor); edtPubDate = (EditText) findViewById(R.id.edtPubDate); } }
[ "kishan.gabani600@gmail.com" ]
kishan.gabani600@gmail.com
c1592021e14a2ed7a0bd6a56d7ba447845697962
ae914e5d261dabe13b45d8832791338c2d192332
/parser/ParseException.java
9a6c18fe3b446756fb1e0322428f9b5fa5945bbd
[]
no_license
spcfox/prog-intro
e787ec097ecbf77242024fbeb074f3d5d1e40240
55b0bc21016bb39839e623c09641035e7abce050
refs/heads/master
2023-03-31T01:35:09.944818
2021-04-10T08:55:41
2021-04-10T08:55:41
356,518,666
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package parser; public class ParseException extends Exception { public ParseException() { super(); } public ParseException(final String message) { super(message); } public ParseException(final String message, Exception e) { super(message, e); } }
[ "rafter.gar@yandex.ru" ]
rafter.gar@yandex.ru
ac907f5c78ce14de95b1f0c8c434f98a9037458f
0eb08cdd9c7098f0de019e2847e6bdb326a8595b
/src/main/java/com/util/MyMap.java
92ecbcfa14c9a77e7618393e0c53ee8803773dfc
[]
no_license
rongdc/rongdcHashMap
138db576f83b4fc800f2b446ba4757b474cd46d2
49e54d365cd6229bb14edb6054381211884b710e
refs/heads/master
2020-03-28T09:07:04.448489
2018-09-09T10:32:36
2018-09-09T10:32:36
148,015,031
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package com.util; public interface MyMap<K, V> { public V put(K k, V v); public V get(K k); interface Entry<K, V> { public K getKey(); public V getValue(); } }
[ "rongdechun@163.com" ]
rongdechun@163.com
50423390e784deb9dcdebdcd93fcbae94c997058
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/11893997.java
68e5552e26ef2b68de8b067cb7dd7eeee1412c66
[]
no_license
whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254688
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,190
java
import java.io.UncheckedIOException; class c11893997 { private String digestPassword(String password) { StringBuffer hexString = new StringBuffer(); try { MyHelperClass MessageDigest = new MyHelperClass(); MessageDigest algorithm =(MessageDigest)(Object) MessageDigest.getInstance("MD5"); algorithm.reset(); algorithm.update(password.getBytes()); byte[] messageDigest =(byte[])(Object) algorithm.digest(); for (byte b : messageDigest) { hexString.append(Integer.toHexString(0xFF & b)); } } catch (UncheckedIOException e) { e.printStackTrace(); } return hexString.toString(); } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass getInstance(String o0){ return null; }} class MessageDigest { public MyHelperClass reset(){ return null; } public MyHelperClass digest(){ return null; } public MyHelperClass update(byte[] o0){ return null; }} class NoSuchAlgorithmException extends Exception{ public NoSuchAlgorithmException(String errorMessage) { super(errorMessage); } }
[ "piyush16066@iiitd.ac.in" ]
piyush16066@iiitd.ac.in
77330cc2498f825d7912c907cba41a03c9e64b6d
aca682b897230bcdfd6ce991e3c74af5abd763ed
/消息队列/PaulMQ/PaulMQ/src/main/java/com/paul/mq/broker/LauncherListener.java
63bc3e94c1eb38098fa50054bf1b5ec35021ce44
[]
no_license
liangruuu/LearningNote
4447f2d15334aa6ad1cb5d4e8c482e05e8243a75
44a5a52ec1c1acdf833ccdfb5d1f0f69867a68cf
refs/heads/main
2023-07-29T05:36:37.960336
2021-09-07T23:41:01
2021-09-07T23:41:01
328,384,752
1
1
null
null
null
null
UTF-8
Java
false
false
498
java
package com.paul.mq.broker; import com.paul.mq.common.CallBack; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; public class LauncherListener implements ChannelFutureListener{ private CallBack<Object> invoke = null; public LauncherListener(CallBack<Object> invoke){ this.invoke = invoke; } @Override public void operationComplete(ChannelFuture future) throws Exception { if(!future.isSuccess()){ invoke.setReason(future.cause()); } } }
[ "1024311844@qq.com" ]
1024311844@qq.com
241512733147f4eac51b1d1e809fc032c099b737
c79a207f5efdc03a2eecea3832b248ca8c385785
/com.googlecode.jinahya/ocap-api/1.2/src/main/java/javax/tv/locator/MalformedLocatorException.java
967bd944ed6a9e331e9216330fb04bf63ad27534
[]
no_license
jinahya/jinahya
977e51ac2ad0af7b7c8bcd825ca3a576408f18b8
5aef255b49da46ae62fb97bffc0c51beae40b8a4
refs/heads/master
2023-07-26T19:08:55.170759
2015-12-02T07:32:18
2015-12-02T07:32:18
32,245,127
2
1
null
2023-07-12T19:42:46
2015-03-15T04:34:19
Java
UTF-8
Java
false
false
2,055
java
/** <p>This is not an official specification document, and usage is restricted. </p> <a name="notice"><strong><center> NOTICE </center></strong><br> <br> (c) 2005-2008 Sun Microsystems, Inc. All Rights Reserved. <p> Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. <p> Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative use only. For example, this file and any files generated from it may be used to generate other documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. This file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms. By contrast, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification. <p> Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety. <p> This work corresponds to the API signatures of JSR 927: Java TV API 1.1.1. In the event of a discrepency between this work and the JSR 927 specification, which is available at http://www.jcp.org/en/jsr/detail?id=927, the latter takes precedence. */ package javax.tv.locator; /** * This exception is thrown to indicate that a malformed locator * string has been used. Either no legal mapping could be determined * for the specified string, or the string could not be parsed. */ public class MalformedLocatorException extends Exception { /** * Constructs a <code>MalformedLocatorException</code> with no * detail message. */ public MalformedLocatorException() { } /** * Constructs a <code>MalformedLocatorException</code> with the * specified detail message. * * @param reason The reason the exception was raised. */ public MalformedLocatorException(String reason) { } }
[ "onacit@e3df469a-503a-0410-a62b-eff8d5f2b914" ]
onacit@e3df469a-503a-0410-a62b-eff8d5f2b914
df69cb54f25587f162a843b995f7bd71b4eadc04
daa69869dbb4f447994f92241cb4bbe97e511d69
/src/com/capgemini/test/SavingAccountTest.java
5a1cd53fa9e78f028dade2f3f4cab73df30a383a
[]
no_license
akshaydonode/collection-assignment
7de3cf85fc23ff44cad9080b1fefd42eb81163f0
f1ce7904ab26497e0f6b3ac6742f3f6b9d048240
refs/heads/master
2020-04-30T09:31:35.534144
2019-03-20T14:20:47
2019-03-20T14:20:47
176,749,890
0
0
null
null
null
null
UTF-8
Java
false
false
66
java
package com.capgemini.test; public class SavingAccountTest { }
[ "akshay.donode@capgemini.com" ]
akshay.donode@capgemini.com
dfb129f23d2406aa9ba497888a875680eb1deaf5
f6668a87ead018242d008bfeae56de5f5f126105
/20.04.27/src/homework/Task_3.java
f04020a4460e91cb1747b6903ce7269c75868195
[]
no_license
evgeniy2702/EvgeniyZhurenkoJAVA
e66061c1e00a0d1cf589204f6cc4708494a4ac36
b0aad10c7637300b980907dd77ae63d69066afa2
refs/heads/master
2022-12-27T13:24:34.665640
2020-10-03T16:45:39
2020-10-03T16:45:39
278,164,951
0
0
null
null
null
null
UTF-8
Java
false
false
3,228
java
package homework; import java.util.Scanner; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Task_3 { public static void main(String[] args) { // Задание: Написать программу которая будет подсчитывать количество слов, гласных и // * согласных букв в строке введённой пользователем. Дополнительно выводить // * количество знаков пунктуации, цифр и др. символов. // * // * Прмер: // * Для введенной строки: "Hello World" // * Вывод на консоль будет: // * Слов - 2 // * Гласных - 3 // * Согласных - 7 String stringInsert = new String (new StringBuffer()); System.out.println("Введите строку :"); while (true) { Scanner sc = new Scanner(System.in); stringInsert = sc.nextLine(); if (stringInsert.isEmpty()) { System.out.println("Вы ничего не ввели. Попробуйте еще раз : "); } else { break; } } System.out.println("Вы ввели следующую строку : " + stringInsert); StringTokenizer stringToken = new StringTokenizer(stringInsert); int n = stringToken.countTokens(); System.out.println("В введеной Вами строке через класс StringTokenizer посчитано :\nCлов - " + n); final String regex = "\\b"; final String regex1 = "([eyuioaEYUIOA]|[уеыаоэяиюУЕЫАОЭЯИЮ])"; final String regex2 = "([qwrtpsdfghjklzxcvbnmQWRTPSDFGHJKLZXCVBNM]|[йцкнгшщзхъфвпрлджчсмтьбЙЦКНГШЩЗХЪФВПРЛДЖЧСМТЬБ])"; final String string = stringInsert; final String string1 = stringInsert; final String string2 = stringInsert; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Pattern pattern1 = Pattern.compile(regex1, Pattern.MULTILINE); final Pattern pattern2 = Pattern.compile(regex2, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); final Matcher matcher1 = pattern1.matcher(string1); final Matcher matcher2 = pattern2.matcher(string2); int word=0; while (matcher.find()) { word++; } System.out.println("В введеной Вами строке через регулярные выражения посчитано :\nCлов - " + word/2); int glasnie = 0; while ((matcher1.find())){ glasnie++; } System.out.println("Гласных - " + glasnie); int soglasnie = 0; while ((matcher2.find())){ soglasnie++; } System.out.println("Согласных - " + soglasnie); System.out.println("Знаков пунктуации, цифр и др. символов - " + (stringInsert.length()- glasnie - soglasnie)); } }
[ "evgeniy.zhurenko@gmail.com" ]
evgeniy.zhurenko@gmail.com
f4b39e42be0986c97d53e4316a18f368a2bdec26
e89eb556a963ae5f2f3eb0626b89702d706a450c
/app/src/main/java/com/pratap/endlessrecyclerview/DataAdapter.java
033fb1966e3ad5bd8077951802fc132e57e136c3
[]
no_license
sahityakumarsuman/EndlessRecyclerView
1e097afb5987cc09919fe89a4f37c49add08bd4b
4a309fb0c2e677098c2de8626381ed58d7eba494
refs/heads/master
2021-01-10T03:55:24.405204
2016-02-21T09:47:10
2016-02-21T09:47:10
52,199,800
1
0
null
null
null
null
UTF-8
Java
false
false
3,984
java
package com.pratap.endlessrecyclerview; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import java.util.List; public class DataAdapter extends RecyclerView.Adapter { private final int VIEW_ITEM = 1; private final int VIEW_PROG = 0; private List<Student> studentList; // The minimum amount of items to have below your current scroll position // before loading more. private int visibleThreshold = 5; private int lastVisibleItem, totalItemCount; private boolean loading; private OnLoadMoreListener onLoadMoreListener; public DataAdapter(List<Student> students, RecyclerView recyclerView) { studentList = students; if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { final LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView .getLayoutManager(); recyclerView .addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); totalItemCount = linearLayoutManager.getItemCount(); lastVisibleItem = linearLayoutManager .findLastVisibleItemPosition(); if (!loading && totalItemCount <= (lastVisibleItem + visibleThreshold)) { // End has been reached // Do something if (onLoadMoreListener != null) { onLoadMoreListener.onLoadMore(); } loading = true; } } }); } } @Override public int getItemViewType(int position) { return studentList.get(position) != null ? VIEW_ITEM : VIEW_PROG; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder vh; if (viewType == VIEW_ITEM) { View v = LayoutInflater.from(parent.getContext()).inflate( R.layout.list_row, parent, false); vh = new StudentViewHolder(v); } else { View v = LayoutInflater.from(parent.getContext()).inflate( R.layout.progress_item, parent, false); vh = new ProgressViewHolder(v); } return vh; } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof StudentViewHolder) { Student singleStudent= (Student) studentList.get(position); ((StudentViewHolder) holder).tvName.setText(singleStudent.getName()); ((StudentViewHolder) holder).tvEmailId.setText(singleStudent.getEmailId()); ((StudentViewHolder) holder).student= singleStudent; } else { ((ProgressViewHolder) holder).progressBar.setIndeterminate(true); } } public void setLoaded() { loading = false; } @Override public int getItemCount() { return studentList.size(); } public void setOnLoadMoreListener(OnLoadMoreListener onLoadMoreListener) { this.onLoadMoreListener = onLoadMoreListener; } // public static class StudentViewHolder extends RecyclerView.ViewHolder { public TextView tvName; public TextView tvEmailId; public Student student; public StudentViewHolder(View v) { super(v); tvName = (TextView) v.findViewById(R.id.tvName); tvEmailId = (TextView) v.findViewById(R.id.tvEmailId); v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(v.getContext(), "OnClick :" + student.getName() + " \n "+student.getEmailId(), Toast.LENGTH_SHORT).show(); } }); } } public static class ProgressViewHolder extends RecyclerView.ViewHolder { public ProgressBar progressBar; public ProgressViewHolder(View v) { super(v); progressBar = (ProgressBar) v.findViewById(R.id.progressBar1); } } }
[ "sahityakumarsuman@gmail.com" ]
sahityakumarsuman@gmail.com
f1d147ca8d36d4e7b1939a8f5c25e23f48e38413
14020c172a5efe7d435e40967fedeb70dd81ed80
/src/main/java/com/sandeepkamathkr/webservice/model/Comment.java
da907a51c924f9744947df1f31fea22c61eb86f2
[]
no_license
sandeepkamathkr/java-codetest-api
ccef0a8630a09aba5792fc637210782adfdb7338
a20a9ee6f7a2a42a8dd1fa8ac25eff742fc3a088
refs/heads/master
2021-03-29T07:05:21.752408
2020-03-17T20:30:53
2020-03-17T20:30:53
247,929,238
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package com.sandeepkamathkr.webservice.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; @Data @AllArgsConstructor @NoArgsConstructor @Builder @Entity @Table(name = "Comment") public class Comment { @Id @GeneratedValue(strategy = GenerationType.TABLE) @Column(name = "ID") private long Id; @Column(name = "POST_ID",columnDefinition = "VARCHAR(50)", nullable = false) private long postId; @Column(name = "NAME",columnDefinition = "VARCHAR(2000)", nullable = false ) private String name; @Column(name = "EMAIL",columnDefinition = "VARCHAR(50)", nullable = false ) private String email; @Column(name = "BODY",columnDefinition = "VARCHAR(4000)", nullable = false ) private String body; }
[ "sandeepkamathkr@gmail.com" ]
sandeepkamathkr@gmail.com
f2f58f3c4660a322cb43b23d7af1970005a292e7
5e224ff6d555ee74e0fda6dfa9a645fb7de60989
/database/src/main/java/adila/db/x9079_x9079.java
4563d3827cb6ab9e63a123a94df69e3f0374d4ec
[ "MIT" ]
permissive
karim/adila
8b0b6ba56d83f3f29f6354a2964377e6197761c4
00f262f6d5352b9d535ae54a2023e4a807449faa
refs/heads/master
2021-01-18T22:52:51.508129
2016-11-13T13:08:04
2016-11-13T13:08:04
45,054,909
3
1
null
null
null
null
UTF-8
Java
false
false
199
java
// This file is automatically generated. package adila.db; /* * Oppo X9079 * * DEVICE: X9079 * MODEL: X9079 */ final class x9079_x9079 { public static final String DATA = "Oppo|X9079|"; }
[ "keldeeb@gmail.com" ]
keldeeb@gmail.com
52df4991e8181cbdf3bc38f153f576b338f4a511
8deb58bba8c3b3c36572215186404a2460c6964f
/src/Sorts.java
e8135f05a85dccabb0652555afa97c555a68fd4c
[]
no_license
willcohen2000/Sorts
bb74af80dbc298c10430414a5921de569553335f
d43d8ba498eea4fc5ced4c408e5260717064ad3b
refs/heads/master
2022-09-11T12:37:34.572123
2020-06-02T13:22:59
2020-06-02T13:22:59
265,305,259
0
0
null
null
null
null
UTF-8
Java
false
false
1,886
java
import java.util.Random; public class Sorts { public static void main(String[] args) { Mergesort mergesort = new Mergesort(); SelectionSort selectionSort = new SelectionSort(); InsertionSort insertionSort = new InsertionSort(); BubbleSort bubbleSort = new BubbleSort(); ShellSort shellSort = new ShellSort(); QuickSort quickSort = new QuickSort(); System.out.println(quickSort.getRuntime()); System.out.println(shellSort.getRuntime()); Sort title = new Sort(true); int num = 100000; int[] test = getRandomIntArray(num); int[] test2 = getRandomIntArray(num); int[] test3 = getRandomIntArray(num); int[] test4 = getRandomIntArray(num); int[] test5 = getRandomIntArray(num); int[] test6 = getRandomIntArray(num); mergesort.sort(test); selectionSort.sort(test2); insertionSort.sort(test3); bubbleSort.sort(test4); shellSort.sort(test5); quickSort.sort(test5); Sort[] sorts = {title, mergesort, selectionSort, insertionSort, bubbleSort, shellSort, quickSort}; compare(sorts); } public static int[] getRandomIntArray(int numItems) { int min = 0; int max = numItems * 2; int[] randomArr = new int[numItems]; Random random = new Random(); for (int i = 0; i < randomArr.length; i++) { randomArr[i] = random.nextInt(max); } return randomArr; } public static void compare(Sort[] sorts) { for (Sort sort : sorts) { System.out.println("|----------------------------------------------------------------|"); System.out.println(sort.getFormattedString(10000)); } System.out.println("|----------------------------------------------------------------|"); } }
[ "willcohen2000@gmail.com" ]
willcohen2000@gmail.com
2af2d2119e0d2cbeb20b97dc7045fcba6f79a4ab
8751216ebe6ef64aaf2ae72ba61c71dd40b56c9d
/src/org/kiwi/dictao/webservices/dvs/VerifyAuthenticationEx.java
6857a776554efeaeb78f61c06e86eb83c1143f39
[]
no_license
MasterScott/kdc
556cabc78568dba3906959513eb2c681bfcd94ea
c40651f3fcb084bc2f6ccc1554af244232cd1669
refs/heads/master
2020-09-09T09:54:57.325393
2012-02-18T23:47:36
2012-02-18T23:47:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,673
java
package org.kiwi.dictao.webservices.dvs; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="transactionId" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="refreshCRLs" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="tag" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="authenticationFormat" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="authenticationType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="userIdentifier" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="scope" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="token" type="{http://www.dictao.com/DVS/Interface}dataType"/> * &lt;element name="userPassword" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="properties" type="{http://www.dictao.com/DVS/Interface}dataType" minOccurs="0"/> * &lt;element name="pluginParameter" type="{http://www.dictao.com/DVS/Interface}ArrayOfPluginParameterStruct" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "requestId", "transactionId", "refreshCRLs", "tag", "authenticationFormat", "authenticationType", "sessionId", "userIdentifier", "scope", "token", "userPassword", "properties", "pluginParameter" }) @XmlRootElement(name = "verifyAuthenticationEx") public class VerifyAuthenticationEx { @XmlElement(required = true) protected String requestId; @XmlElement(required = true) protected String transactionId; protected int refreshCRLs; @XmlElement(required = true) protected String tag; @XmlElement(required = true) protected String authenticationFormat; protected String authenticationType; protected String sessionId; @XmlElement(required = true) protected String userIdentifier; protected String scope; @XmlElement(required = true) protected DataType token; protected String userPassword; protected DataType properties; protected ArrayOfPluginParameterStruct pluginParameter; /** * Gets the value of the requestId property. * * @return * possible object is * {@link String } * */ public String getRequestId() { return requestId; } /** * Sets the value of the requestId property. * * @param value * allowed object is * {@link String } * */ public void setRequestId(String value) { this.requestId = value; } /** * Gets the value of the transactionId property. * * @return * possible object is * {@link String } * */ public String getTransactionId() { return transactionId; } /** * Sets the value of the transactionId property. * * @param value * allowed object is * {@link String } * */ public void setTransactionId(String value) { this.transactionId = value; } /** * Gets the value of the refreshCRLs property. * */ public int getRefreshCRLs() { return refreshCRLs; } /** * Sets the value of the refreshCRLs property. * */ public void setRefreshCRLs(int value) { this.refreshCRLs = value; } /** * Gets the value of the tag property. * * @return * possible object is * {@link String } * */ public String getTag() { return tag; } /** * Sets the value of the tag property. * * @param value * allowed object is * {@link String } * */ public void setTag(String value) { this.tag = value; } /** * Gets the value of the authenticationFormat property. * * @return * possible object is * {@link String } * */ public String getAuthenticationFormat() { return authenticationFormat; } /** * Sets the value of the authenticationFormat property. * * @param value * allowed object is * {@link String } * */ public void setAuthenticationFormat(String value) { this.authenticationFormat = value; } /** * Gets the value of the authenticationType property. * * @return * possible object is * {@link String } * */ public String getAuthenticationType() { return authenticationType; } /** * Sets the value of the authenticationType property. * * @param value * allowed object is * {@link String } * */ public void setAuthenticationType(String value) { this.authenticationType = value; } /** * Gets the value of the sessionId property. * * @return * possible object is * {@link String } * */ public String getSessionId() { return sessionId; } /** * Sets the value of the sessionId property. * * @param value * allowed object is * {@link String } * */ public void setSessionId(String value) { this.sessionId = value; } /** * Gets the value of the userIdentifier property. * * @return * possible object is * {@link String } * */ public String getUserIdentifier() { return userIdentifier; } /** * Sets the value of the userIdentifier property. * * @param value * allowed object is * {@link String } * */ public void setUserIdentifier(String value) { this.userIdentifier = value; } /** * Gets the value of the scope property. * * @return * possible object is * {@link String } * */ public String getScope() { return scope; } /** * Sets the value of the scope property. * * @param value * allowed object is * {@link String } * */ public void setScope(String value) { this.scope = value; } /** * Gets the value of the token property. * * @return * possible object is * {@link DataType } * */ public DataType getToken() { return token; } /** * Sets the value of the token property. * * @param value * allowed object is * {@link DataType } * */ public void setToken(DataType value) { this.token = value; } /** * Gets the value of the userPassword property. * * @return * possible object is * {@link String } * */ public String getUserPassword() { return userPassword; } /** * Sets the value of the userPassword property. * * @param value * allowed object is * {@link String } * */ public void setUserPassword(String value) { this.userPassword = value; } /** * Gets the value of the properties property. * * @return * possible object is * {@link DataType } * */ public DataType getProperties() { return properties; } /** * Sets the value of the properties property. * * @param value * allowed object is * {@link DataType } * */ public void setProperties(DataType value) { this.properties = value; } /** * Gets the value of the pluginParameter property. * * @return * possible object is * {@link ArrayOfPluginParameterStruct } * */ public ArrayOfPluginParameterStruct getPluginParameter() { return pluginParameter; } /** * Sets the value of the pluginParameter property. * * @param value * allowed object is * {@link ArrayOfPluginParameterStruct } * */ public void setPluginParameter(ArrayOfPluginParameterStruct value) { this.pluginParameter = value; } }
[ "gentilkiwi@gmail.com" ]
gentilkiwi@gmail.com
41b98aef878cbc3a47564535b7869a3aa1d9ffc1
bfbe846da37057f20b6b4bb7fceec0b052ae9099
/icm-common/icm-common-service/src/main/java/com/kamixiya/icm/service/common/service/base/SystemFileService.java
8049b5c230a2765db1b9c29976ace67ae943fc17
[]
no_license
kamixiya/icm
9435a8270fa18fd7583dad8cf3f52d263a22c6d3
5e13148f5b37d71fb68a7f6c2ec17aca047bea58
refs/heads/master
2022-05-28T18:02:48.327440
2020-04-21T15:00:13
2020-04-21T15:00:13
245,168,788
0
0
null
null
null
null
UTF-8
Java
false
false
2,901
java
package com.kamixiya.icm.service.common.service.base; import com.kamixiya.icm.model.base.SystemFileDTO; import com.kamixiya.icm.model.common.PageDataDTO; import net.sourceforge.tess4j.TesseractException; import java.io.File; import java.io.IOException; import java.util.List; /** * SystemFileService * * @author Zhu Jie * @date 2020/4/8 */ public interface SystemFileService { /** * 保存文件 * * @param type 类型,用于标识文件属于某一业务种类,并非文件的格式 * @param files 要保存的文件 * @return 已保存的文件信息 * @throws IOException 找不到ID对应的文件 */ SystemFileDTO[] persist(String type, File[] files) throws IOException; /** * 删除文件 * * @param fileId 文件id */ void deleteFile(String fileId); /** * 根据文件ID查询文件 * * @param fileId 文件ID * @return SystemFileDTO */ SystemFileDTO findById(String fileId); /** * 复制文件 * * @param type 文件的类型 * @param id 文件的ID * @return 文件对象 * @throws IOException 文件流异常 */ SystemFileDTO copy(String type, String id) throws IOException; /** * 通过保存的文件名来取文件 * * @param name 文件名或key * @return 保存的文件 * @throws IOException 找不到ID对应的文件 */ File getFile(String name) throws IOException; /** * 识别图片或pdf文件转成txt文件 * * @param resourceFile 图片或pdf文件 * @return SystemFileDTO * @throws IOException 无法找到文件或失败则抛出异常 * @throws TesseractException 图片识别错误抛出异常 */ SystemFileDTO getTxtFile(File resourceFile) throws IOException, TesseractException; /** * 分页查询文件 * * @param page 页号 * @param size 每页纪录条数 * @param sort 排序字段, 例如:字段1,asc,字段2,desc * @param type 文件类型 * @return 全局参数配置dto信息集合 */ PageDataDTO<SystemFileDTO> findOnePage(int page, int size, String sort, String type); /** * 分页查询文件 * * @param page 页号 * @param size 每页纪录条数 * @param sort 排序字段, 例如:字段1,asc,字段2,desc * @param type 文件类型 * @param referenceId 引用id * @return 全局参数配置dto信息集合 */ PageDataDTO<SystemFileDTO> findOnePage(int page, int size, String sort, String type, String referenceId); /** * 分页查询所有文件 * * @param type 文件类型 * @param referenceId 引用id * @return 全局参数配置dto信息集合 */ List<SystemFileDTO> findAll(String type, String referenceId); }
[ "zhujie@matech.cn" ]
zhujie@matech.cn
c4671f4ccc366d99f9fa0c51b88a5032a56981f3
360b3bc5b0d8cfe654efe90c766b7a90c39a5b82
/src/main/java/org/ldk/structs/PeerHandleError.java
b24730289942c82b409ec7f46ff61236e2c612fa
[]
no_license
galderz/ldk-garbagecollected
218a8cf6f30b1cd074d5f4f0d2d912e96c596bb1
085016be15a3ea80e3772cb66579a8e0ea52773c
refs/heads/main
2023-06-09T02:45:01.748995
2021-02-02T22:45:37
2021-02-03T01:53:14
344,395,350
0
0
null
2021-03-04T08:01:06
2021-03-04T08:01:05
null
UTF-8
Java
false
false
1,257
java
package org.ldk.structs; import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class PeerHandleError extends CommonBase { PeerHandleError(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); if (ptr != 0) { bindings.PeerHandleError_free(ptr); } } public PeerHandleError clone() { long ret = bindings.PeerHandleError_clone(this.ptr); PeerHandleError ret_hu_conv = new PeerHandleError(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } public boolean get_no_connection_possible() { boolean ret = bindings.PeerHandleError_get_no_connection_possible(this.ptr); return ret; } public void set_no_connection_possible(boolean val) { bindings.PeerHandleError_set_no_connection_possible(this.ptr, val); } public static PeerHandleError constructor_new(boolean no_connection_possible_arg) { long ret = bindings.PeerHandleError_new(no_connection_possible_arg); PeerHandleError ret_hu_conv = new PeerHandleError(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } }
[ "git@bluematt.me" ]
git@bluematt.me
92fe64e8c145498fa4f2613b34a4416464d8fb1d
80d391dd94728eca4f7bcb283d924118125235c3
/Contact.java
28651048db5579dc482e45588f4b4deda015a260
[]
no_license
sietsemayer/wicketFrames
5373e682d04879a193aa23a11ce5bd0433de6ec7
2b36f9a2bc1f4d25bf165a4f8ac323246a0d3f47
refs/heads/master
2020-08-05T21:37:47.532237
2015-09-01T13:35:25
2015-09-01T13:35:25
41,443,826
0
0
null
null
null
null
UTF-8
Java
false
false
115
java
package com.roseindia.wicket; public class Contact extends WebSite{ public Contact(){ super(); } }
[ "sietse.mayer@gmail.com" ]
sietse.mayer@gmail.com
be994f552e653c6da0f91033192aeed9f0a97843
2c1a4f44576566cfe942876ba3ef8d32c653425d
/app/src/test/java/com/example/ipetrash/oneshotdecodeqrcode/ExampleUnitTest.java
69a31669f459940780fb779fdcf6a097c3ea01e7
[]
no_license
gil9red/OneShotDecodeQRcode
75330861f17b8f53a0e75b479cb0616bd5fb561c
ca9f18ec4433dd1708d53187d920d9b477c725a0
refs/heads/master
2021-01-17T14:45:04.829709
2016-07-17T13:40:02
2016-07-17T13:40:02
48,946,540
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.example.ipetrash.oneshotdecodeqrcode; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "ilya.petrash@inbox.ru" ]
ilya.petrash@inbox.ru
5450cefe30f71bc31e0c6fe11337b29e201ec553
6a839aabae1615a427a82969fe83eebe1d111280
/model/DAO.java
141aef4f2254a57e3770d67b696cde1f1157d0c0
[]
no_license
JayMoliya33/Library-Management-System
124470c680c58300f7da02be8cdea639d3711ea3
f2fa2c781111be83bd7da844f8713876af55a0e2
refs/heads/master
2020-12-12T00:49:06.049689
2020-01-15T04:36:42
2020-01-15T04:36:42
233,998,956
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package LMS.model; public class DAO { public static Students students[] = new Students[3]; public static HardMedia hardmedia[] = new HardMedia[3]; public static void initData() { students[0]=new Students(1,"Jay",0,"CE"); students[1]=new Students(2,"Vimal",0,"CE"); students[2]=new Students(3,"Mayank",0,"CE"); hardmedia[0]=new HardMedia(1,"OOPJ",4); hardmedia[1]=new HardMedia(2,"ADA",4); hardmedia[2]=new HardMedia(3,"System Programming",4); } }
[ "jaymoliya33200@gmail.com" ]
jaymoliya33200@gmail.com
3f8789637360defb31f1c315330495541918676c
426ed1fed4c81d72867b6672d597dd9f1e30eb0f
/Java-Design-Patterns-1/src/com/moleksyuk/chapter5/Singleton/SingletonLazy.java
65910ed8c7fb68f68c6bbd92b1795a04d8f79ddf
[]
no_license
Sargovindan/design-patterns
834dfc70192e7fb0d915f27436f8db3c2a0ca6c2
9f57b96a7a6775635dd4e647b99d1b41a66e84df
refs/heads/master
2021-07-05T11:21:49.778838
2021-03-16T05:03:29
2021-03-16T05:03:29
13,791,075
0
0
null
2021-06-07T19:04:42
2013-10-23T01:56:36
Java
UTF-8
Java
false
false
394
java
/** * */ package com.moleksyuk.chapter5.Singleton; /** * Based on: "Patterns in Java", Mark Grand. * * Date: Aug 1, 2011 * * @author moleksyuk */ public class SingletonLazy { private static SingletonLazy instance; private SingletonLazy() { } public static SingletonLazy getInstance() { if (instance == null) { instance = new SingletonLazy(); } return instance; } }
[ "github.com" ]
github.com
498df29de6b055e7cb43597286a86bdbc285b8b6
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava9/Foo882.java
d4365c2d869132265fe8f7007b2114d1a1e9856e
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package applicationModulepackageJava9; public class Foo882 { public void foo0() { final Runnable anything0 = () -> System.out.println("anything"); new applicationModulepackageJava9.Foo881().foo9(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } public void foo9() { foo8(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
8832e728d27bf1a328bded7766633d014cca0592
1476b5f5e8d32d14d2e7959dfdbb4ca8473477fe
/src/main/java/mp/dw/db/document/DocumentDAOImpl.java
262e90eb8c2e6087025969cd4120cdfae28798a7
[]
no_license
malpalma/dw3
14049f2c579ca1c14123ba318a1b9af7ee608552
942f4211cfc0900b87f5d57a726fa4e3fabf1351
refs/heads/master
2020-03-31T18:41:04.996499
2018-10-22T07:28:24
2018-10-22T07:28:24
152,468,269
0
0
null
null
null
null
UTF-8
Java
false
false
1,771
java
package mp.dw.db.document; import java.util.ArrayList; import java.util.List; import javax.persistence.Query; import org.springframework.stereotype.Repository; import mp.dw.db.BaseDAOImpl; @Repository public class DocumentDAOImpl extends BaseDAOImpl<Document, Long> implements DocumentDAO { public Iterable<Document> getAll() { return em.createQuery("select d from Document d").getResultList(); } public String getStatusById(Long id) { Query query = em.createQuery("select status from Document d where id = :id"); query.setParameter("id", id); return (String) query.getResultList().get(0); } public String getUserById(Long id) { Query query = em.createQuery("select usern from Document d where id = :id"); query.setParameter("id", id); List res = query.getResultList(); if(res.get(0) == null) { return ""; } else { return (String) res.get(0); } } public boolean existByContractorData(String name, String address, String regNumber) { Query query = em.createQuery("select id from Document d where sellersName = :sellersName and " + "sellersAddress = :sellersAddress and sellersRegNumber = :sellersRegNumber"); query.setParameter("sellersName", name); query.setParameter("sellersAddress", address); query.setParameter("sellersRegNumber", regNumber); int result = query.getResultList().size(); if(result > 0) { return true; } else { return false; } } public boolean existByPM(String descr) { Query query = em.createQuery("select id from Document d where paymentMethod = :paymentMethod"); query.setParameter("paymentMethod", descr); int result = query.getResultList().size(); if(result > 0) return true; else return false; } }
[ "Małgorzata Palma@old-one" ]
Małgorzata Palma@old-one
e235071d6d51540ad71953848e1eaeaaba000132
6a347b5283f51a67c5aefdf27d2387bddb421dbc
/spring/src/test/java/net/bridge/spring/ApplicationTests.java
4d83c74500b5187a3c2c9f543cf53d3f74b1d2ea
[]
no_license
GustavoSaibro/gustavo_saibro_fullstack_corrigido
d0c89cf965be9d0d52552baea681b84ff898f270
d6b0962393dd3ad924bfd1708ee4ab4dd348082a
refs/heads/master
2022-12-13T08:10:31.204809
2020-09-17T20:17:18
2020-09-17T20:17:18
296,431,466
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package net.bridge.spring; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ApplicationTests { @Test void contextLoads() { } }
[ "gustavosaibro@gmail.com" ]
gustavosaibro@gmail.com
93212d5d0808568c69a7023c1ed18380bde83417
1b52e14abf8dcbd7025ecc4a586e21a3efa5e7b8
/src/main/java/com/example/demo/config/CustomFailingHealthIndicator.java
5f49b78a9d091868778343f04ac67e2253af6732
[]
no_license
keithkroeger/actuator-demo
faec01eeb0d6493d7e0ee16024afb75950137f91
b3f3890568a7b5732e3e06efba5f815489dbc0d0
refs/heads/master
2020-04-29T03:46:16.816141
2019-04-04T10:06:34
2019-04-04T10:06:34
175,822,826
1
0
null
null
null
null
UTF-8
Java
false
false
815
java
package com.example.demo.config; import org.springframework.boot.actuate.health.AbstractHealthIndicator; import org.springframework.boot.actuate.health.Health; import org.springframework.stereotype.Component; @Component public class CustomFailingHealthIndicator extends AbstractHealthIndicator { private Integer counter = 0; @Override protected void doHealthCheck(Health.Builder builder) throws Exception { counter++; if ( (counter % 2) == 0 ){ builder.up() .withDetail("app", "Seems to be down"); throw new Exception("the counter is even so error"); } else { builder.up() .withDetail("app", "Alive and Kicking ok") .withDetail("error", "Nothing! I'm good."); } } }
[ "kkroeger_work@hotmail.com" ]
kkroeger_work@hotmail.com
a8244176a070e6f0529ffb4d8092dcef91839949
84e67899eeaa0ed3e22f7fb8682157c6cb0c618c
/frag_d/app/src/main/java/com/example/frag_d/frag1.java
ffb5028d9adcc8d31df7bb3137c9893034d4a3ea
[]
no_license
mohamadnehme/Android-Studio
a49dcbdbc43dddca117eb76cb36eb5a6784c7e8e
f19177b93f381d4405d3d6abeeacf454d867e611
refs/heads/master
2023-01-09T13:01:27.812521
2020-11-12T23:02:28
2020-11-12T23:02:28
312,413,431
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
package com.example.frag_d; import android.icu.util.BuddhistCalendar; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import java.nio.BufferUnderflowException; public class frag1 extends Fragment { Button btn; EditText t1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_frag1,container,false); btn = view.findViewById(R.id.btn); t1 = view.findViewById(R.id.editText); return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Fragment f = new frag2(); Bundle b = new Bundle(); b.putString("test",t1.getText().toString()); f.setArguments(b); FragmentManager m = getActivity().getSupportFragmentManager(); FragmentTransaction t = m.beginTransaction(); t.replace(R.id.out,f); t.commit(); } }); } }
[ "hassan2001nehme@gmail.com" ]
hassan2001nehme@gmail.com
4509b0cb36e9e2a2a85b458ce7829882c1c59304
5eafb88f67a69971b9d443f57cf38c42c3d8e84b
/src/main/java/org/abeyj/protocol/besu/response/privacy/PrivFindPrivacyGroup.java
40182435a75d85378e5129022f32d74c349772e4
[]
no_license
abeychain/abeyj
6f8a1ee8b8d91157334d1f2f79e1c049ea57bf42
78369edd7ecf4d8aa1761bbca6d9171df050898e
refs/heads/main
2023-03-24T23:40:37.085552
2021-03-27T05:57:07
2021-03-27T05:57:07
348,636,005
0
2
null
null
null
null
UTF-8
Java
false
false
855
java
/* * Copyright 2019 Web3 Labs Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.abeyj.protocol.besu.response.privacy; import org.abeyj.protocol.core.Response; import java.util.List; public class PrivFindPrivacyGroup extends Response<List<PrivacyGroup>> { public List<PrivacyGroup> getGroups() { return getResult(); } }
[ "johnson0628@protonmail.com" ]
johnson0628@protonmail.com
4b9980cd8b78a34be0593e627036cedde44f5cd7
4519fc010c4429c89261ce57a8cae15900375ee4
/raytracer/src/raytracer/Matrix.java
5c808da2ce5437025ee0a80a8660371975895921
[]
no_license
3ximus/render-farm
f73a460e8c401fccfa860bf6da34a024b6dd235a
b7f957f293952ed9af1d2e30d759e7d8569a989a
refs/heads/master
2021-03-27T16:22:40.898078
2017-05-20T16:34:39
2017-05-20T16:32:45
88,051,930
3
1
null
null
null
null
UTF-8
Java
false
false
1,487
java
package raytracer; public class Matrix { private double m[][]; public Matrix(double m[][]) { if(m.length < 4 || m[0].length < 4) throw new IllegalArgumentException("Matrix must be a 4x4 array"); this.m = m; } /* public Matrix inverse() { double i[][] = new double[4][4]; return i; } */ public Matrix transpose() { double t[][] = new double[4][4]; t[0][0] = m[0][0]; t[1][0] = m[0][1]; t[2][0] = m[0][2]; t[3][0] = m[0][3]; t[0][1] = m[1][0]; t[1][1] = m[1][1]; t[2][1] = m[1][2]; t[3][1] = m[1][3]; t[0][2] = m[2][0]; t[1][2] = m[2][1]; t[2][2] = m[2][2]; t[3][2] = m[2][3]; t[0][3] = m[3][0]; t[1][3] = m[3][1]; t[2][3] = m[3][2]; t[3][3] = m[3][3]; return new Matrix(t); } public Matrix times(Matrix matrix) { double m2[][] = matrix.m; double r[][] = new double[4][4]; for(int row=0;row<4;row++) { for(int col=0;col<4;col++) { r[row][col] = m[row][0] * m2[0][col] + m[row][1] * m2[1][col] + m[row][2] * m2[2][col] + m[row][3] * m2[3][col]; } } return new Matrix(r); } public Vector times(Vector v) { double x, y, z; x = m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * 1.0; y = m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * 1.0; z = m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * 1.0; // fourth coordinate double mag = m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * 1.0; x /= mag; y /= mag; z /= mag; return new Vector(x, y, z); } }
[ "fabio_r11@hotmail.com" ]
fabio_r11@hotmail.com
13d76a42926e1a7c280a878af4a1e51a3ae02120
3a0bfd5e7c40d1b0b2917ad4a10e9f1680f18433
/MIO/AS2/src/main/java/com/asinfo/as2/clases/ProductoEstadoImportacion.java
5e401482be22a52ed2a82c99bed7e0e057c41142
[]
no_license
CynPa/gambaSoftware
983827a718058261c1f11eb63991d4be76423139
61ae4f46bc5fdf8d44ad678c4dd67a0a4a89aa6b
refs/heads/master
2021-09-03T16:42:41.120391
2018-01-10T14:25:24
2018-01-10T14:25:24
109,645,375
0
1
null
null
null
null
UTF-8
Java
false
false
2,278
java
/* 1: */ package com.asinfo.as2.clases; /* 2: */ /* 3: */ import java.math.BigDecimal; /* 4: */ import java.util.Date; /* 5: */ /* 6: */ public class ProductoEstadoImportacion /* 7: */ { /* 8: */ private String procesoImportacion; /* 9: */ private String estadoImportacion; /* 10: */ private BigDecimal cantidad; /* 11: */ private Date fecha; /* 12: */ private String transporte; /* 13: */ /* 14: */ public String getProcesoImportacion() /* 15: */ { /* 16: 44 */ return this.procesoImportacion; /* 17: */ } /* 18: */ /* 19: */ public void setProcesoImportacion(String procesoImportacion) /* 20: */ { /* 21: 54 */ this.procesoImportacion = procesoImportacion; /* 22: */ } /* 23: */ /* 24: */ public String getEstadoImportacion() /* 25: */ { /* 26: 63 */ return this.estadoImportacion; /* 27: */ } /* 28: */ /* 29: */ public void setEstadoImportacion(String estadoImportacion) /* 30: */ { /* 31: 73 */ this.estadoImportacion = estadoImportacion; /* 32: */ } /* 33: */ /* 34: */ public BigDecimal getCantidad() /* 35: */ { /* 36: 82 */ return this.cantidad; /* 37: */ } /* 38: */ /* 39: */ public void setCantidad(BigDecimal cantidad) /* 40: */ { /* 41: 92 */ this.cantidad = cantidad; /* 42: */ } /* 43: */ /* 44: */ public Date getFecha() /* 45: */ { /* 46:101 */ return this.fecha; /* 47: */ } /* 48: */ /* 49: */ public void setFecha(Date fecha) /* 50: */ { /* 51:111 */ this.fecha = fecha; /* 52: */ } /* 53: */ /* 54: */ public String getTransporte() /* 55: */ { /* 56:120 */ return this.transporte; /* 57: */ } /* 58: */ /* 59: */ public void setTransporte(String transporte) /* 60: */ { /* 61:130 */ this.transporte = transporte; /* 62: */ } /* 63: */ } /* Location: C:\backups\AS2(26-10-2017)\WEB-INF\classes\ * Qualified Name: com.asinfo.as2.clases.ProductoEstadoImportacion * JD-Core Version: 0.7.0.1 */
[ "Gambalit@DESKTOP-0C2RSIN" ]
Gambalit@DESKTOP-0C2RSIN
e4549d5f5d6c21779edf696d55712b2cf6f473ea
868c0bdcd6270d17911cd19430c90118c18ab3ca
/app/src/main/java/com/berishaerblin/moneymanager/Category/Pasqyra/CustomAdapterPasqyra.java
fbf79c004e8f6139afdd8f126a7f2ae47a3985e4
[]
no_license
rancoo/MoneyManager
3af532f67d018ad131342e16cd707e0d97e705d1
a2146d01822621c992475e2a7ab5b9bc99fc6f4f
refs/heads/master
2021-01-12T04:25:10.346735
2016-12-27T20:00:15
2016-12-27T20:00:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,316
java
package com.berishaerblin.moneymanager.Category.Pasqyra; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.berishaerblin.moneymanager.R; import com.berishaerblin.moneymanager.dataBase.DataBaseSource; import com.berishaerblin.moneymanager.dataBase.model.Category; import com.berishaerblin.moneymanager.dataBase.model.Expense; import com.berishaerblin.moneymanager.dataBase.model.Income; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Created by mergimkrasniqi on 12/26/16. */ public class CustomAdapterPasqyra extends BaseAdapter { private Context context; private List<Object> mirrors = new ArrayList<Object>(); private static LayoutInflater inflater = null; DataBaseSource dataBaseSource; public CustomAdapterPasqyra(Context context, List<Object> mirrors){ this.context = context; this.mirrors = mirrors; inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); dataBaseSource = new DataBaseSource(context); } @Override public int getCount() { return mirrors.size(); } @Override public Object getItem(int position) { return mirrors.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View view, ViewGroup viewGroup) { if (view == null) view = inflater.inflate(R.layout.adapterpasqyrarow, null); ImageView icon = (ImageView) view.findViewById(R.id.list_image); TextView title = (TextView) view.findViewById(R.id.list_title); TextView sum = (TextView) view.findViewById(R.id.list_sum); TextView date = (TextView) view.findViewById(R.id.list_date); Object i = mirrors.get(position); if(i instanceof Income){ Income income = (Income) mirrors.get(position); sum.setTextColor(context.getResources().getColor(R.color.bg_screen2)); sum.setText(String.valueOf(income.getIncomeValue()) + "€"); Category c = dataBaseSource.getCategory(income.getfICategoryType()); int resId = context.getResources().getIdentifier(c.getCategoryImage().split("\\.")[2], "drawable", context.getPackageName()); date.setText(income.getIncomeDate()); icon.setImageResource(resId); title.setText(c.getCategoryName()); } else { Expense expense = (Expense) mirrors.get(position); sum.setTextColor(context.getResources().getColor(R.color.bg_screen1)); sum.setText("-" + String.valueOf(expense.getExpenseValue()) + "€"); Category c = dataBaseSource.getCategory(expense.getfECategoryType()); int resId = context.getResources().getIdentifier(c.getCategoryImage().split("\\.")[2], "drawable", context.getPackageName()); date.setText(expense.getExpenseDate()); icon.setImageResource(resId); title.setText(c.getCategoryName()); } return view; } }
[ "mkrasniqi571@gmail.com" ]
mkrasniqi571@gmail.com
d5037a92c97ba79dcad164d0fe627186a367e489
ed5159d056e98d6715357d0d14a9b3f20b764f89
/src/irvine/oeis/a041/A041307.java
56e4b426e947a4f271516864d1115a5d4fa9562e
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package irvine.oeis.a041; // Generated by gen_seq4.pl cfsqden 166 at 2019-07-04 10:59 // DO NOT EDIT here! import irvine.math.z.Z; import irvine.oeis.ContinuedFractionOfSqrtSequence; /** * A041307 Denominators of continued fraction convergents to <code>sqrt(166)</code>. * @author Georg Fischer */ public class A041307 extends ContinuedFractionOfSqrtSequence { /** Construct the sequence. */ public A041307() { super(0, 166); } @Override public Z next() { final Z result = getDenominator(); iterate(); iterateConvergents(); return result; } }
[ "sean.irvine@realtimegenomics.com" ]
sean.irvine@realtimegenomics.com
7b5e7efd72e4ede34a86dce6be2a8737a62b00a6
16b1f46c1e00f033db04a401c63831b366f0647f
/p2p_home/src/com/itheima/dao/impl/ProductAccountDaoImpl.java
88cc41741895c7d76c37e1177377b6081b4a9e4d
[]
no_license
Tangzhen2089/p2p
39ea908428ea10e46752cff109e20a147cedbcff
321df3ac3607ad82447e04703c1160890d7bb1eb
refs/heads/master
2023-04-03T12:31:46.283630
2021-04-01T03:23:03
2021-04-01T03:23:03
353,559,506
0
0
null
null
null
null
GB18030
Java
false
false
1,237
java
package com.itheima.dao.impl; import java.util.List; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayListHandler; import com.itheima.dao.IProductAccountDao; import com.itheima.domain.ProductAccount; import com.itheima.utils.JDBCUtils; public class ProductAccountDaoImpl implements IProductAccountDao { //天机投资记录 @Override public void add(ProductAccount productAccount) throws Exception { QueryRunner queryRunner = new QueryRunner(); queryRunner.update(JDBCUtils.getConnection(), "insert into product_account values(null,?,CURRENT_DATE,?,?,?,?)", productAccount.getPa_num(),productAccount.getCustomer().getId(), productAccount.getProduct().getId(),productAccount.getMoney(),productAccount.getInterest()); } @Override public List<Object[]> findByCustomer(int id) throws Exception { QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource()); List<Object[]> list = queryRunner.query("select pa.pa_num,p.proName,p.proLimit,p.annualized,pa.interest,c.c_name,pa.pa_date,pa.money " + "from product_account pa,product p,customer c where pa.c_id=c.id and pa.p_id=p.id and c.id = ?", new ArrayListHandler(),id); return list; } }
[ "821305324@qq.com" ]
821305324@qq.com
595708b4ecc56e536f7f367304a17f592666fd69
234a5e7114ff8db732d4d3a392d6210473b6b36d
/game-app/src/main/java/com/ssic/game/app/controller/dto/CafetoriumConfigScoreReportDto.java
89d8adbbf25e5f9f3212de7f5d7f5a82565fd01d
[]
no_license
wwbg1988/game
2aa9a604f7de4dc08c3ac6dd66867e16306036d2
1880c3a1de6665adeb0fa4f4db2fdec1c5553aee
refs/heads/master
2020-06-21T03:46:48.495600
2016-11-26T06:41:37
2016-11-26T06:41:37
74,809,476
0
1
null
null
null
null
UTF-8
Java
false
false
520
java
package com.ssic.game.app.controller.dto; import java.util.List; import lombok.Getter; import lombok.Setter; import com.ssic.catering.base.dto.CafetoriumDto; import com.ssic.catering.base.pojo.Config; public class CafetoriumConfigScoreReportDto { /** * 食堂信息 */ @Getter @Setter private CafetoriumDto cafetoriumDto; /** * 评分服务项 */ @Getter @Setter private List<Config> configList; /** * 评分信息 */ @Getter @Setter private HistoryConfigScoreDto historyConfigScoreDto; }
[ "wuweitree@163.com" ]
wuweitree@163.com
2adfc2c6d4ccb00b5164e03930ca88c11c4d5570
8c232956da78ec76a3261a2033e44c31807c1614
/vokter-core/src/test/java/com/edduarte/vokter/diff/DifferenceDetectorTest.java
3d10a934357cc6b9b6c6b5f41dde1a374b99cb9c
[ "Apache-2.0" ]
permissive
vokter/vokter
b22273182c5055cf711a2b9c803356792b081387
983453bbfccb07d855451b1d594fed5a9fcdb5f9
refs/heads/v1
2022-12-07T20:49:58.577300
2019-11-13T11:53:55
2019-11-13T11:53:55
25,128,479
7
2
Apache-2.0
2023-03-20T11:55:12
2014-10-12T18:46:45
Java
UTF-8
Java
false
false
4,312
java
/* * Copyright 2015 Eduardo Duarte * * 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.edduarte.vokter.diff; import com.edduarte.vokter.document.Document; import com.edduarte.vokter.document.DocumentBuilder; import com.edduarte.vokter.parser.ParserPool; import com.edduarte.vokter.parser.SimpleParser; import com.mongodb.DB; import com.mongodb.MongoClient; import org.apache.commons.io.IOUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.List; import static org.junit.Assert.assertEquals; /** * @author Eduardo Duarte (<a href="mailto:hello@edduarte.com">hello@edduarte.com</a>) * @version 1.3.2 * @since 1.0.0 */ public class DifferenceDetectorTest { private static final Logger logger = LoggerFactory.getLogger(DifferenceDetectorTest.class); private static MongoClient mongoClient; private static DB occurrencesDB; private static ParserPool parserPool; @BeforeClass public static void setUp() throws IOException, InterruptedException { mongoClient = new MongoClient("localhost", 27017); occurrencesDB = mongoClient.getDB("test_terms_db"); parserPool = new ParserPool(); parserPool.place(new SimpleParser()); } @AfterClass public static void close() { occurrencesDB.dropDatabase(); mongoClient.close(); } @Test public void testSimple() { String url = "http://www.bbc.com/news/uk/"; String type = "text/html"; String oldSnapshot = "is the of the 100-eyed giant in Greek mythology."; String newSnapshot = "Argus Panoptes is the name of the 100-eyed giant in Norse mythology."; Document oldSnapshotDoc = DocumentBuilder .fromString(url, oldSnapshot, type) .ignoreCase() .withStopwords() .withStemming() .build(occurrencesDB, parserPool); Document newSnapshotDoc = DocumentBuilder .fromString(url, newSnapshot, type) .ignoreCase() .withStopwords() .withStemming() .build(occurrencesDB, parserPool); DifferenceDetector comparison = new DifferenceDetector( oldSnapshotDoc, newSnapshotDoc, parserPool ); List<Difference> diffList = comparison.call(); assertEquals(5, diffList.size()); } @Test public void testBBCNews() throws IOException { String url = "http://www.bbc.com/news/uk/"; String type = "text/html"; InputStream oldStream = getClass().getResourceAsStream("bbc_news_8_12_2014_11_00.html"); InputStream newStream = getClass().getResourceAsStream("bbc_news_8_12_2014_13_00.html"); String oldSnapshot = IOUtils.toString(oldStream); String newSnapshot = IOUtils.toString(newStream); Document oldSnapshotDoc = DocumentBuilder .fromString(url, oldSnapshot, type) .ignoreCase() .withStopwords() .withStemming() .build(occurrencesDB, parserPool); Document newSnapshotDoc = DocumentBuilder .fromString(url, newSnapshot, type) .ignoreCase() .withStopwords() .withStemming() .build(occurrencesDB, parserPool); DifferenceDetector comparison = new DifferenceDetector( oldSnapshotDoc, newSnapshotDoc, parserPool ); List<Difference> diffList = comparison.call(); assertEquals(352, diffList.size()); } }
[ "eduarte@ubiwhere.com" ]
eduarte@ubiwhere.com
1914584868a06624854868d351aa2e6d54836a65
7773ea6f465ffecfd4f9821aad56ee1eab90d97a
/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/modifier/afterChangeVisibilityModificatorToPublicForInner.java
33bc33347d42bfaaf3c06dad6578ba180bc73817
[ "Apache-2.0" ]
permissive
aghasyedbilal/intellij-community
5fa14a8bb62a037c0d2764fb172e8109a3db471f
fa602b2874ea4eb59442f9937b952dcb55910b6e
refs/heads/master
2023-04-10T20:55:27.988445
2020-05-03T22:00:26
2020-05-03T22:26:23
261,074,802
2
0
Apache-2.0
2020-05-04T03:48:36
2020-05-04T03:48:35
null
UTF-8
Java
false
false
170
java
// "Make 'Item' public" "true" import java.util.ArrayList; class GenericImplementsPrivate extends ArrayList<GenericImplementsPrivate.Item> { public class Item { } }
[ "intellij-monorepo-bot-no-reply@jetbrains.com" ]
intellij-monorepo-bot-no-reply@jetbrains.com
18f106c152ed2fa41a801173a981974b89cfc52b
281f91a06819c29d1fccc0363529cc2c86548a2b
/app/src/androidTest/java/com/davincilabs/amey/sharedtransitionanimation/ApplicationTest.java
4722ca92f28ea3d44b9112a3a69bc2e8a5debbfd
[]
no_license
ameyjain/Shared-Element-Transition-Animation-Android
fa61fde6a253685ded3f2c72ccec9473a6d3bafa
71c197ade09cb24f01ecb07b299e6c5ded382e65
refs/heads/master
2021-01-11T11:03:04.992359
2017-01-15T18:04:33
2017-01-15T18:04:33
79,046,849
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.davincilabs.amey.sharedtransitionanimation; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "aj.jain1992@gmail.com" ]
aj.jain1992@gmail.com
5d3217021705e69f26c97632e617dc4378edcd0c
b08a313eeacff04700734840e2146c600f501bc7
/guvnor-ng/guvnor-core/guvnor-datamodel/guvnor-datamodel-backend/src/test/java/org/kie/guvnor/datamodel/backend/server/DataModelGlobalsTest.java
ad978021d4f6b32e7ff15b1b795c702ed7a48988
[ "Apache-2.0" ]
permissive
Brianxia/guvnor
4d68bb549a7cb1274aaf49ba17f2c1cadcc6781b
cfbd7f763f8c2aad4224397ee4bd73d1644da620
refs/heads/master
2021-01-17T21:55:31.542359
2013-05-10T12:07:26
2013-05-10T12:09:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,327
java
package org.kie.guvnor.datamodel.backend.server; import java.util.Arrays; import org.drools.workbench.models.commons.shared.imports.Import; import org.drools.workbench.models.commons.shared.imports.Imports; import org.junit.Test; import org.kie.guvnor.datamodel.backend.server.builder.packages.PackageDataModelOracleBuilder; import org.kie.guvnor.datamodel.backend.server.builder.projects.ProjectDataModelOracleBuilder; import org.kie.guvnor.datamodel.backend.server.testclasses.Product; import org.kie.guvnor.datamodel.oracle.PackageDataModelOracle; import org.kie.guvnor.datamodel.oracle.ProjectDataModelOracle; import static org.junit.Assert.*; /** * Tests for Globals */ public class DataModelGlobalsTest { @Test public void testGlobal() throws Exception { final ProjectDataModelOracle pd = ProjectDataModelOracleBuilder.newProjectOracleBuilder() .addClass( Product.class ) .build(); final PackageDataModelOracle dmo = PackageDataModelOracleBuilder.newPackageOracleBuilder( "org.kie.guvnor.datamodel.backend.server.testclasses" ) .setProjectOracle( pd ) .addGlobals( "global org.kie.guvnor.datamodel.backend.server.testclasses.Product g;" ) .build(); assertNotNull( dmo ); assertEquals( 1, dmo.getFactTypes().length ); assertEquals( "Product", dmo.getFactTypes()[ 0 ] ); assertEquals( 1, dmo.getGlobalVariables().length ); assertEquals( "g", dmo.getGlobalVariables()[ 0 ] ); assertEquals( "Product", dmo.getGlobalVariable( "g" ) ); final String[] fields = dmo.getFieldCompletions( "Product" ); assertNotNull( fields ); assertTrue( Arrays.asList( fields ).contains( "this" ) ); assertTrue( Arrays.asList( fields ).contains( "colour" ) ); assertEquals( 0, dmo.getGlobalCollections().length ); } @Test public void testGlobalCollections() throws Exception { final ProjectDataModelOracle pd = ProjectDataModelOracleBuilder.newProjectOracleBuilder() .addClass( java.util.List.class ) .build(); final PackageDataModelOracle dmo = PackageDataModelOracleBuilder.newPackageOracleBuilder( "org.kie.guvnor.datamodel.backend.server.testclasses" ) .setProjectOracle( pd ) .addGlobals( "global java.util.List list;" ) .build(); final Imports imports = new Imports(); imports.addImport( new Import( "java.util.List" ) ); dmo.filter( imports ); assertNotNull( dmo ); assertEquals( 1, dmo.getFactTypes().length ); assertEquals( "List", dmo.getFactTypes()[ 0 ] ); assertEquals( 1, dmo.getGlobalVariables().length ); assertEquals( "list", dmo.getGlobalVariables()[ 0 ] ); assertEquals( "List", dmo.getGlobalVariable( "list" ) ); assertEquals( 1, dmo.getGlobalCollections().length ); assertEquals( "list", dmo.getGlobalCollections()[ 0 ] ); } }
[ "michael.anstis@gmail.com" ]
michael.anstis@gmail.com
a97308a571eaaaa39129463b9706bdbe08e16cc0
41c4703f9e4784c45aed5a819c301d1829ec5836
/coding/src/main/java/com/github/baoti/coding/AccountType.java
5416416b696baab4c27acccf0a5639e8e3a8333e
[ "MIT" ]
permissive
baoti/Whats-Git-on-Android
6c9484bee1afbea55f43527fc4070eb896240865
64962a2a782656cb4726d6c955556a9f47e5d2bd
refs/heads/master
2021-01-17T10:34:40.684244
2015-07-20T07:54:42
2015-07-20T07:54:42
32,581,104
1
1
null
null
null
null
UTF-8
Java
false
false
523
java
package com.github.baoti.coding; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Qualifier @Target({FIELD, PARAMETER, METHOD}) @Documented @Retention(RUNTIME) public @interface AccountType { }
[ "yed.liu@gmail.com" ]
yed.liu@gmail.com
6ac554ad2e25b126a317a2b5d51a67f81d759dab
5b891818a10fd0f4b2238d1f76f6976c30c9a30f
/springannotation/src/test/java/com/atguigu/test/IOCTest_tx.java
8ce27d5b216272c6af63721f8674a7d61244e6a8
[]
no_license
laoking2016/learning
8fbd1155b7fd64759ae183c001084e54f0852934
d2768616d69b3342dc2be4d3e6efe304be55d49f
refs/heads/master
2023-03-20T21:59:10.419471
2021-03-21T01:24:14
2021-03-21T01:24:14
302,475,788
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package com.atguigu.test; import com.atguigu.tx.TxConfig; import com.atguigu.tx.UserService; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class IOCTest_tx { @Test public void test01(){ AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(TxConfig.class); UserService userService = applicationContext.getBean(UserService.class); userService.insertUser(); applicationContext.close(); } }
[ "laoking@live.com" ]
laoking@live.com
c30941a4b3a197aaff225fae516bc057bfc91a78
1d2a29cfb026add4f946998f1a630cce4dbc3bd0
/src/main/java/java8/web/LocalTime/Java8Tester1.java
a62e3e0e0124eeba58949fb43d58bcb291f5e8b1
[]
no_license
quyixiao/ThinkJava
59a7e134dd3695a3474ebdf9bd28671df90879f7
ecf5948ea7e06f09b94fc0c736f5daf3d81a6b47
refs/heads/master
2022-06-30T15:25:35.752250
2019-05-29T07:30:20
2019-05-29T07:30:20
163,674,080
1
0
null
2022-06-17T02:04:00
2018-12-31T14:11:43
Java
UTF-8
Java
false
false
2,787
java
package java8.web.LocalTime; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Month; /*** * 八、Java 8 日期时间 API Java 8通过发布新的Date-Time API (JSR 310)来进一步加强对日期与时间的处理。 在旧版的Java 中,日期时间API 存在诸多问题,其中有: ·        非线程安全 − java.util.Date 是非线程安全的,所有的日期类都是可变的,这是Java日期类最大的问题之一。 ·        设计很差 − Java的日期/时间类的定义并不一致,在java.util和java.sql的包中都有日期类,此外用于格式化和解析的类在java.text包中定义。java.util.Date同时包含日期和时间,而java.sql.Date仅包含日期,将其纳入java.sql包并不合理。另外这两个类都有相同的名字,这本身就是一个非常糟糕的设计。 ·        时区处理麻烦 − 日期类并不提供国际化,没有时区支持,因此Java引入了java.util.Calendar和java.util.TimeZone类,但他们同样存在上述所有的问题。 Java 8 在 java.time 包下提供了很多新的 API。以下为两个比较重要的 API: ·        Local(本地) − 简化了日期时间的处理,没有时区的问题。 ·        Zoned(时区) − 通过制定的时区处理日期时间。 新的java.time包涵盖了所有处理日期,时间,日期/时间,时区,时刻(instants),过程(during)与时钟(clock)的操作。 */ public class Java8Tester1 { public static void main(String args[]) { Java8Tester1 java8tester = new Java8Tester1(); java8tester.testLocalDateTime(); } public void testLocalDateTime() { // 获取当前的日期时间 LocalDateTime currentTime = LocalDateTime.now(); System.out.println("当前时间: " + currentTime); LocalDate date1 = currentTime.toLocalDate(); System.out.println("date1: " + date1); Month month = currentTime.getMonth(); int day = currentTime.getDayOfMonth(); int seconds = currentTime.getSecond(); System.out.println("月: " + month + ", 日: " + day + ", 秒: " + seconds); LocalDateTime date2 = currentTime.withDayOfMonth(10).withYear(2012); System.out.println("date2: " + date2); // 12 december 2014 LocalDate date3 = LocalDate.of(2014, Month.DECEMBER, 12); System.out.println("date3: " + date3); // 22 小时 15 分钟 LocalTime date4 = LocalTime.of(22, 15); System.out.println("date4: " + date4); // 解析字符串 LocalTime date5 = LocalTime.parse("20:15:30"); System.out.println("date5: " + date5); } }
[ "2621048238@qq.com" ]
2621048238@qq.com
5eefc7d8463e301a2d37381c6d44fa49ceef32fa
97dc1cb8954f15c73659f6b255e2254e1146744d
/nonobank_v2/.svn/pristine/56/568bee0e04180d02732f3ef5d0be26170dffb8d6.svn-base
d979e33d4f169538eec3fe991600f457107df25e
[]
no_license
dengjiaping/tutorial
dc31f96b5b9db35c9ee82b89fe6de91fd111381d
9efd8e6a76808475edd86ac52dbe9bb00b4f66b1
refs/heads/master
2021-01-19T17:47:35.010752
2014-10-31T00:47:00
2014-10-31T00:47:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
/* * Copyright (c) 2009-2014. 上海诺诺镑客 All rights reserved. * @(#) JdbcScoreRankRepositoryTest.java 2014-10-27 16:41 */ package com.nonobank.user.base.jdbc.ext; import com.nonobank.common.json.JsonMapper; import com.nonobank.user.domain.ext.ScoreRank; import com.nonobank.user.domain.ext.capital.ScoreCapitalInfo; import com.nonobank.user.domain.ext.common.ImageProp; import org.hamcrest.core.IsNull; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; import java.util.List; import static org.junit.Assert.assertThat; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:/META-INF/spring/test-context.xml") public class JdbcScoreRankRepositoryTest { @Resource private JdbcScoreRankRepository scoreRankRepository; @Test public void testFindByScore() throws Exception { ScoreRank scoreRank = scoreRankRepository.findByScore(85); assertThat(scoreRank, IsNull.notNullValue()); String icon = scoreRank.getRankIcon(); assertThat(icon, IsNull.notNullValue()); ImageProp imageProp = JsonMapper.getDefault().readValue(icon, ImageProp.class); assertThat(imageProp, IsNull.notNullValue()); String capital = scoreRank.getScoreCapital(); assertThat(capital, IsNull.notNullValue()); List<ScoreCapitalInfo> list = JsonMapper.getDefault().readToList(capital, ScoreCapitalInfo.class); assertThat(list, IsNull.notNullValue()); } }
[ "simonpatrick@163.com" ]
simonpatrick@163.com
a7971da14199249b390c0461e8b6e0b31a41c539
92e32f0f60ba521cf0b5ada432f72e8b0b259c84
/app/src/main/java/com/cse60333/jschudt/lab1_jschudt/ScheduleAdapter.java
0a6361a949600596924aa5f131c79d3a6854a26a
[]
no_license
jschudt/lab5_jschudt
20a6c847468ab2423f69c8de0188c4add8d309d7
358f8555c1d23ec35dfbc9825b9c41ae24c6fde0
refs/heads/master
2021-01-17T11:18:22.050006
2017-03-06T05:08:28
2017-03-06T05:08:28
84,030,304
0
0
null
null
null
null
UTF-8
Java
false
false
1,487
java
package com.cse60333.jschudt.lab1_jschudt; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import static com.cse60333.jschudt.lab1_jschudt.R.layout.schedule_item; /** * Created by JoeS on 2/11/2017. */ public class ScheduleAdapter extends ArrayAdapter<Team> { ScheduleAdapter (Context context, ArrayList<Team> teams){ super(context, schedule_item, teams); }; @Override public View getView (int position, View convertView, ViewGroup parent) { LayoutInflater scheduleInflater = LayoutInflater.from(getContext()); View scheduleView = scheduleInflater.inflate(schedule_item, parent, false); Team matchItem = getItem(position); ImageView TeamLogo = (ImageView) scheduleView.findViewById(R.id.TeamLogo); String mDrawableName = matchItem.teamLogo; int resID = getContext().getResources().getIdentifier(mDrawableName , "mipmap", getContext().getPackageName()); TeamLogo.setImageResource(resID); TextView TeamName = (TextView) scheduleView.findViewById(R.id.TeamName); TeamName.setText(matchItem.getTeamName()); TextView GameDate = (TextView) scheduleView.findViewById(R.id.GameDate); GameDate.setText(matchItem.getGameDate()); return scheduleView; } }
[ "jschudt@nd.edu" ]
jschudt@nd.edu
925f763c1513f92bb903df293ba1e030f5d95560
f1c52bbcaad8dffa02aa867653b82cad3657f430
/test/unit/org/apache/cassandra/index/sai/cql/BooleanTypeTest.java
75e72b1686e712f397a05e67e9ecd1dcd928e319
[ "Apache-2.0", "MIT", "CC0-1.0", "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
permissive
apache/cassandra
eb81e98f2d0db853abecdbfcd30750808dde80ad
b966f6af112331a4d01b6be2818e4e5b09245880
refs/heads/trunk
2023-09-05T11:57:07.865593
2023-09-04T14:59:50
2023-09-04T15:23:43
206,424
7,798
5,558
Apache-2.0
2023-09-14T15:52:22
2009-05-21T02:10:09
Java
UTF-8
Java
false
false
1,599
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.cassandra.index.sai.cql; import org.junit.Test; import org.apache.cassandra.index.sai.SAITester; import static org.junit.Assert.assertEquals; public class BooleanTypeTest extends SAITester { @Test public void test() throws Throwable { createTable("CREATE TABLE %s (id text PRIMARY KEY, val boolean)"); createIndex("CREATE CUSTOM INDEX ON %s(val) USING 'StorageAttachedIndex'"); execute("INSERT INTO %s (id, val) VALUES ('0', false)"); execute("INSERT INTO %s (id, val) VALUES ('1', true)"); execute("INSERT INTO %s (id, val) VALUES ('2', true)"); assertEquals(2, execute("SELECT id FROM %s WHERE val = true").size()); assertEquals(1, execute("SELECT id FROM %s WHERE val = false").size()); } }
[ "maedhroz@users.noreply.github.com" ]
maedhroz@users.noreply.github.com
dd8ae980ae7db07d08facc37c74c08464801d86c
6f78924178011b8c4d7feb5f02ae865a9a565563
/app/src/main/java/com/ezpz/pos/other/FileUtils.java
111dc2a127098f356e3cdacf0110e49afbdb668b
[]
no_license
rezapramudhika/pos-android
e232e27ffa9a392e8827b366e0a5e80ba513e9f6
a8705d1e3626881d443ac4927368bb1abac8b063
refs/heads/master
2021-07-12T01:05:26.611418
2017-10-05T12:17:58
2017-10-05T12:17:58
103,534,658
0
0
null
null
null
null
UTF-8
Java
false
false
7,934
java
package com.ezpz.pos.other; import android.content.ContentUris; import android.content.Context; import android.content.CursorLoader; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; /** * Created by Wim on 9/29/16. */ public class FileUtils { /** * @return Whether the URI is a local one. */ public static boolean isLocal(String url) { if (url != null && !url.startsWith("http://") && !url.startsWith("https://")) { return true; } return false; } /** * @param uri The Uri to check. * @return Whether the Uri authority is ExternalStorageProvider. * @author paulburke */ public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is DownloadsProvider. * @author paulburke */ public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is MediaProvider. * @author paulburke */ public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is Old Google Photos. */ public static boolean isGoogleOldPhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is New Google Photos. */ public static boolean isGoogleNewPhotosUri(Uri uri) { return "com.google.android.apps.photos.contentprovider".equals(uri.getAuthority()); } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } } finally { if (cursor != null) cursor.close(); } return null; } public static String getPath(final Context context, final Uri uri) { // DocumentProvider if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if(DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } // TODO handle non-primary volumes } // DownloadsProvider else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } // MediaProvider else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[]{ split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { // Return the remote address if (isGoogleOldPhotosUri(uri)) { // return http path, then download file. return uri.getLastPathSegment(); } else if (isGoogleNewPhotosUri(uri)) { if(getDataColumn(context, uri, null, null) == null) { return getDataColumn(context, Uri.parse(getImageUrlWithAuthority(context,uri)), null, null); }else{ return getDataColumn(context, uri, null, null); } } return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } }else{ String[] proj = { MediaStore.Images.Media.DATA }; String result = null; CursorLoader cursorLoader = new CursorLoader( context, uri, proj, null, null, null); Cursor cursor = cursorLoader.loadInBackground(); if(cursor != null){ int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); result = cursor.getString(column_index); } return result; } return null; } public static File getFile(Context context, Uri uri) { if (uri != null) { String path = getPath(context, uri); if (path != null && isLocal(path)) { return new File(path); } } return null; } public static String getImageUrlWithAuthority(Context context, Uri uri) { InputStream is = null; if (uri.getAuthority() != null) { try { is = context.getContentResolver().openInputStream(uri); Bitmap bmp = BitmapFactory.decodeStream(is); return writeToTempImageAndGetPathUri(context, bmp).toString(); } catch (FileNotFoundException e) { e.printStackTrace(); }finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; } public static Uri writeToTempImageAndGetPathUri(Context inContext, Bitmap inImage) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); return Uri.parse(path); } }
[ "rezapramudhika@gmail.com" ]
rezapramudhika@gmail.com
17f496722914c8b618556de6e5e8b2586adb9a11
2adf7ca88a9f972faff6538a57b512037e704c5d
/pehlaschool/proj.android-studio/app/src/org/cocos2dx/cpp/maq/kitkitProvider/KitkitDBHandler.java
f9d5608cfb06b02d40408bb94a44ab501d14a6ec
[ "Apache-2.0", "MIT" ]
permissive
maqsoftware/Pehla-School
3c92539b95640e00a5d0993be0fba9a605b1a249
61aeae0f1d91952b44eaeaff5d2f6ec1d5aa3c43
refs/heads/newmaster
2020-05-25T05:56:47.466659
2019-11-18T05:00:30
2019-11-18T05:00:30
187,654,296
2
6
Apache-2.0
2020-06-21T13:26:21
2019-05-20T14:16:22
C++
UTF-8
Java
false
false
23,546
java
package org.cocos2dx.cpp.maq.kitkitProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; /** * Created by ingtellect on 9/1/17. */ // NB(xenosoz, 2018): SNTP Result table by me. public class KitkitDBHandler extends SQLiteOpenHelper { private ContentResolver myCR; private static final int DATABASE_VERSION = 15; public static final String DATABASE_NAME = "userDB.db"; public static final String TABLE_USERS = "users"; public static final String TABLE_CURRENT_USER = "current_user"; public static final String TABLE_SNTP_RESULT = "sntp_result_id"; public static final String TABLE_FISHES = "fishes"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_USERNAME = "username"; public static final String COLUMN_STARS = "stars"; public static final String COLUMN_FINISH_TUTORIAL = "finish_tutorial"; public static final String COLUMN_UNLOCK_DRUM = "unlock_drum"; public static final String COLUMN_UNLOCK_MARIMBA = "unlock_marimba"; public static final String COLUMN_UNLOCK_DRAWING = "unlock_drawing"; public static final String COLUMN_UNLOCK_COLORING = "unlock_coloring"; public static final String COLUMN_UNLOCK_BLACKBOARD = "unlock_blackboard"; public static final String COLUMN_FINISH_LAUNCHER_TUTORIAL = "finish_launcher_tutorial"; public static final String COLUMN_DISPLAY_NAME = "display_name"; public static final String COLUMN_OPEN_LIBRARY = "open_library"; public static final String COLUMN_OPEN_TOOLS = "open_tools"; public static final String COLUMN_UNLOCK_FISH_BOWL = "unlock_fish_bowl"; public static final String COLUMN_UNLOCK_WRITING_BOARD = "unlock_writing_board"; public static final String COLUMN_FINISH_WRITING_BOARD_TUTORIAL = "finish_writing_board_tutorial"; public static final String COLUMN_SERVER_SPEC = "server_spec"; public static final String COLUMN_TIME_NOW = "time_now"; public static final String COLUMN_TIME_SNOW = "time_snow"; public static final String COLUMN_FISH_ID = "fish_id"; public static final String COLUMN_FISH_SKIN_NO = "skin_no"; public static final String COLUMN_FISH_NAME = "name"; public static final String COLUMN_FISH_CREATE_TIME = "create_time"; public static final String COLUMN_FISH_POSITION = "position"; final String CREATE_USER_TABLE = "CREATE TABLE " + TABLE_USERS + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USERNAME + " TEXT," + COLUMN_STARS + " INTEGER," + COLUMN_FINISH_TUTORIAL + " BOOLEAN," + COLUMN_UNLOCK_DRUM + " BOOLEAN," + COLUMN_UNLOCK_MARIMBA + " BOOLEAN," + COLUMN_UNLOCK_DRAWING + " BOOLEAN," + COLUMN_UNLOCK_COLORING + " BOOLEAN," + COLUMN_UNLOCK_BLACKBOARD + " BOOLEAN," + COLUMN_FINISH_LAUNCHER_TUTORIAL + " BOOLEAN," + COLUMN_DISPLAY_NAME + " TEXT," + COLUMN_OPEN_LIBRARY + " BOOLEAN," + COLUMN_OPEN_TOOLS + " BOOLEAN," + COLUMN_UNLOCK_FISH_BOWL + " BOOLEAN," + COLUMN_UNLOCK_WRITING_BOARD + " BOOLEAN," + COLUMN_FINISH_WRITING_BOARD_TUTORIAL + " BOOLEAN" + ")"; final String CREATE_CURRENT_USER_TABLE = "CREATE TABLE " + TABLE_CURRENT_USER + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USERNAME + " TEXT" + ")"; final String CREATE_SNTP_RESULT_TABLE = "CREATE TABLE " + TABLE_SNTP_RESULT + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + "," + COLUMN_SERVER_SPEC + " TEXT" + "," + COLUMN_TIME_NOW + " INTEGER" + "," + COLUMN_TIME_SNOW + " TEXT" //+ ",UNIQUE(" + COLUMN_SERVER_SPEC + ")" + ")"; final String CREATE_FISH_TABLE = "CREATE TABLE " + TABLE_FISHES + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USERNAME + " TEXT," + COLUMN_FISH_ID + " TEXT," + COLUMN_FISH_SKIN_NO + " INTEGER," + COLUMN_FISH_NAME + " TEXT," + COLUMN_FISH_CREATE_TIME + " TEXT," + COLUMN_FISH_POSITION + " TEXT" + ")"; private String[] arr_sql_table = { CREATE_USER_TABLE, CREATE_CURRENT_USER_TABLE, CREATE_SNTP_RESULT_TABLE, CREATE_FISH_TABLE }; public KitkitDBHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); myCR = context.getContentResolver(); } @Override public void onCreate(SQLiteDatabase db) { execRawQuery(db, arr_sql_table); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(KitkitDBHandler.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion); if (oldVersion < newVersion) { List<String> arrSql = new ArrayList<String>(); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_DISPLAY_NAME + " TEXT DEFAULT ('');"); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_OPEN_LIBRARY + " BOOLEAN DEFAULT (" + (User.DEFAULT_OPEN_LIBRARY == false ? 0 : 1) + ");"); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_OPEN_TOOLS + " BOOLEAN DEFAULT (" + (User.DEFAULT_OPEN_TOOLS == false ? 0 : 1) + ");"); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_UNLOCK_FISH_BOWL + " BOOLEAN DEFAULT (" + 0 + ");"); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_UNLOCK_WRITING_BOARD + " BOOLEAN DEFAULT (" + 0 + ");"); arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_FINISH_WRITING_BOARD_TUTORIAL + " BOOLEAN DEFAULT (" + 0 + ");"); execRawQuery(db, arr_sql_table); // create table String[] sql_array = arrSql.toArray(new String[arrSql.size()]); execRawQuery(db, sql_array); } } private void execRawQuery(SQLiteDatabase db, String[] arr_sql) { if (arr_sql != null) { for (String sql : arr_sql) { try { db.execSQL(sql); } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(),"SQL ERROR : " + sql); } } } } public void addUser(User user) { ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, user.getUserName()); values.put(COLUMN_STARS, user.getNumStars()); values.put(COLUMN_FINISH_TUTORIAL, user.isFinishTutorial()); values.put(COLUMN_UNLOCK_DRUM, user.isUnlockDrum()); values.put(COLUMN_UNLOCK_MARIMBA, user.isUnlockMarimba()); values.put(COLUMN_UNLOCK_DRAWING, user.isUnlockDrawing()); values.put(COLUMN_UNLOCK_COLORING, user.isUnlockColoring()); values.put(COLUMN_UNLOCK_BLACKBOARD, user.isUnlockBlackboard()); values.put(COLUMN_FINISH_LAUNCHER_TUTORIAL, user.isFinishLauncherTutorial()); values.put(COLUMN_OPEN_LIBRARY, user.isOpenLibrary()); values.put(COLUMN_OPEN_TOOLS, user.isOpenTools()); values.put(COLUMN_UNLOCK_FISH_BOWL, user.isUnlockFishBowl()); values.put(COLUMN_UNLOCK_WRITING_BOARD, user.isUnlockWritingBoard()); values.put(COLUMN_FINISH_WRITING_BOARD_TUTORIAL, user.isFinishWritingBoardTutorial()); myCR.insert(KitkitProvider.CONTENT_URI, values); } public User findUser(String username) { String[] projection = {COLUMN_ID, COLUMN_USERNAME, COLUMN_STARS, COLUMN_FINISH_TUTORIAL, COLUMN_UNLOCK_DRUM, COLUMN_UNLOCK_MARIMBA, COLUMN_UNLOCK_DRAWING, COLUMN_UNLOCK_COLORING, COLUMN_UNLOCK_BLACKBOARD, COLUMN_FINISH_LAUNCHER_TUTORIAL, COLUMN_DISPLAY_NAME, COLUMN_OPEN_LIBRARY, COLUMN_OPEN_TOOLS, COLUMN_UNLOCK_FISH_BOWL, COLUMN_UNLOCK_WRITING_BOARD, COLUMN_FINISH_WRITING_BOARD_TUTORIAL }; String selection = "username = \"" + username + "\""; Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI, projection, selection, null, null); User user = new User(); if (cursor.moveToFirst()) { cursor.moveToFirst(); user.setID(Integer.parseInt(cursor.getString(0))); user.setUserName(cursor.getString(1)); user.setNumStars(Integer.parseInt(cursor.getString(2))); user.setFinishTutorial("1".equals(cursor.getString(3))); user.setUnlockDrum("1".equals(cursor.getString(4))); user.setUnlockMarimba("1".equals(cursor.getString(5))); user.setUnlockDrawing("1".equals(cursor.getString(6))); user.setUnlockColoring("1".equals(cursor.getString(7))); user.setUnlockBlackboard("1".equals(cursor.getString(8))); user.setFinishLauncherTutorial("1".equals(cursor.getString(9))); user.setDisplayName(cursor.getString(10)); user.setOpenLibrary("1".equals(cursor.getString(11))); user.setOpenTools("1".equals(cursor.getString(12))); user.setUnlockFishBowl("1".equals(cursor.getString(13))); user.setUnlockWritingBoard("1".equals(cursor.getString(14))); user.setFinishWritingBoardTutorial("1".equals(cursor.getString(15))); cursor.close(); } else { user = null; cursor.close(); } return user; } public ArrayList<User> getUserList() { String[] projection = {COLUMN_ID, COLUMN_USERNAME, COLUMN_STARS, COLUMN_FINISH_TUTORIAL, COLUMN_UNLOCK_DRUM, COLUMN_UNLOCK_MARIMBA, COLUMN_UNLOCK_DRAWING, COLUMN_UNLOCK_COLORING, COLUMN_UNLOCK_BLACKBOARD, COLUMN_FINISH_LAUNCHER_TUTORIAL, COLUMN_DISPLAY_NAME, COLUMN_OPEN_LIBRARY, COLUMN_OPEN_TOOLS, COLUMN_UNLOCK_FISH_BOWL, COLUMN_UNLOCK_WRITING_BOARD, COLUMN_FINISH_WRITING_BOARD_TUTORIAL }; Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI, projection, null, null, null); ArrayList<User> result = new ArrayList<User>(); if(cursor.moveToFirst()) { do { User user = new User(); user.setID(Integer.parseInt(cursor.getString(0))); user.setUserName(cursor.getString(1)); user.setNumStars(Integer.parseInt(cursor.getString(2))); user.setFinishTutorial("1".equals(cursor.getString(3))); user.setUnlockDrum("1".equals(cursor.getString(4))); user.setUnlockMarimba("1".equals(cursor.getString(5))); user.setUnlockDrawing("1".equals(cursor.getString(6))); user.setUnlockColoring("1".equals(cursor.getString(7))); user.setUnlockBlackboard("1".equals(cursor.getString(8))); user.setFinishLauncherTutorial("1".equals(cursor.getString(9))); user.setDisplayName(cursor.getString(10)); user.setOpenLibrary("1".equals(cursor.getString(11))); user.setOpenTools("1".equals(cursor.getString(12))); user.setUnlockFishBowl("1".equals(cursor.getString(13))); user.setUnlockWritingBoard("1".equals(cursor.getString(14))); user.setFinishWritingBoardTutorial("1".equals(cursor.getString(15))); result.add(user); } while(cursor.moveToNext()); } cursor.close(); return result; } public boolean deleteUser(String username) { boolean result = false; String selection = "username = \"" + username + "\""; int rowsDeleted = myCR.delete(KitkitProvider.CONTENT_URI, selection, null); if (rowsDeleted > 0) result = true; return result; } public int numUser() { String[] projection = {"COUNT(*) AS COUNT"}; Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI, projection, null, null, null); if (cursor != null) { cursor.moveToFirst(); int numUser = cursor.getInt(0); cursor.close(); return numUser; } return 0; } public int numUserSeenLauncherTutorial() { String[] projection = {COLUMN_USERNAME}; Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI, projection, COLUMN_FINISH_LAUNCHER_TUTORIAL + "=1", null, null); int count = cursor.getCount(); cursor.close(); Log.w(KitkitDBHandler.class.getName(), "numUserSeenLauncherTutorial count : " + count); return count; } public boolean currentUserExist() { String[] projection = {"COUNT(*) AS COUNT"}; Cursor cursor = myCR.query(KitkitProvider.CURRENT_USER_URI, projection, null, null, null); cursor.moveToFirst(); int numUser = cursor.getInt(0); cursor.close(); return numUser > 0; } public void setCurrentUser(String username) { User user = findUser(username); setCurrentUser(user); } public void setCurrentUser(User user) { if (currentUserExist()) { String selection = COLUMN_ID + " = 1"; ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, user.getUserName()); myCR.update(KitkitProvider.CURRENT_USER_URI, values, selection, null); } else { ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, user.getUserName()); myCR.insert(KitkitProvider.CURRENT_USER_URI, values); } } public User getCurrentUser() { String[] projection = {COLUMN_USERNAME}; Cursor cursor = myCR.query(KitkitProvider.CURRENT_USER_URI, projection, null, null, null); try { cursor.moveToFirst(); } catch (NullPointerException ne) { return null; } String currentUserName = cursor.getString(0); User user = findUser(currentUserName); cursor.close(); return user; } public String getCurrentUsername() { String[] projection = {COLUMN_USERNAME}; Cursor cursor = myCR.query(KitkitProvider.CURRENT_USER_URI, projection, null, null, null); try { cursor.moveToFirst(); } catch (NullPointerException ne) { return null; } String result = cursor.getString(0); cursor.close(); return result; } public void updateUser(User user) { String selection = "username = \"" + user.getUserName() + "\""; ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, user.getUserName()); values.put(COLUMN_STARS, user.getNumStars()); values.put(COLUMN_FINISH_TUTORIAL, user.isFinishTutorial()); values.put(COLUMN_UNLOCK_DRUM, user.isUnlockDrum()); values.put(COLUMN_UNLOCK_MARIMBA, user.isUnlockMarimba()); values.put(COLUMN_UNLOCK_DRAWING, user.isUnlockDrawing()); values.put(COLUMN_UNLOCK_COLORING, user.isUnlockColoring()); values.put(COLUMN_UNLOCK_BLACKBOARD, user.isUnlockBlackboard()); values.put(COLUMN_FINISH_LAUNCHER_TUTORIAL, user.isFinishLauncherTutorial()); values.put(COLUMN_DISPLAY_NAME, user.getDisplayName()); values.put(COLUMN_OPEN_LIBRARY, user.isOpenLibrary()); values.put(COLUMN_OPEN_TOOLS, user.isOpenTools()); values.put(COLUMN_UNLOCK_FISH_BOWL, user.isUnlockFishBowl()); values.put(COLUMN_UNLOCK_WRITING_BOARD, user.isUnlockWritingBoard()); values.put(COLUMN_FINISH_WRITING_BOARD_TUTORIAL, user.isFinishWritingBoardTutorial()); Log.i("myLog", "value : " + values.toString()); myCR.update(KitkitProvider.CONTENT_URI, values, selection, null); } public void uniqueInsertSntpResult(SntpResult sntpResult) { // NB(xenosoz, 2018): myCR.update doesn't do the trick here, // and myCR doesn't support 'INSERT OR IGNORE' statement. SntpResult sr = sntpResult; String where = COLUMN_SERVER_SPEC + "=" + ("\"" + sr.serverSpec + "\""); ContentValues values = new ContentValues(); values.put(COLUMN_SERVER_SPEC, sr.serverSpec); values.put(COLUMN_TIME_NOW, sr.now); values.put(COLUMN_TIME_SNOW, sr.snow); String[] args = null; myCR.delete(KitkitProvider.SNTP_RESULT_URI, where, args); myCR.insert(KitkitProvider.SNTP_RESULT_URI, values); } public List<SntpResult> getSntpResults() { ArrayList<SntpResult> results = new ArrayList<SntpResult>(); Cursor cursor = myCR.query(KitkitProvider.SNTP_RESULT_URI, null, null, null, null); while (cursor != null && cursor.moveToNext()) { String serverSpec = cursor.getString(cursor.getColumnIndex(COLUMN_SERVER_SPEC)); long now = cursor.getLong(cursor.getColumnIndex(COLUMN_TIME_NOW)); String snow = cursor.getString(cursor.getColumnIndex(COLUMN_TIME_SNOW)); int id = -1; try { id = cursor.getInt(cursor.getColumnIndexOrThrow(COLUMN_ID)); } catch (Exception e) { Log.e("myLog", "" + e); } SntpResult sr = new SntpResult(id, serverSpec, now, snow); results.add(sr); } if (cursor != null) { cursor.close(); } return results; } public String getTabletNumber() { Cursor cursor = myCR.query(KitkitProvider.PREFERENCE_URI, null, null, null, null); String result = ""; try { cursor.moveToFirst(); result = cursor.getString(0); cursor.close(); } catch (Exception e) { } return result; } public void addFish(String fishID, int skinNo, String fishName, String position) { try { ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, getCurrentUser().getUserName()); values.put(COLUMN_FISH_ID, fishID); values.put(COLUMN_FISH_SKIN_NO, skinNo); values.put(COLUMN_FISH_NAME, fishName); values.put(COLUMN_FISH_CREATE_TIME, getTimeFormatString(System.currentTimeMillis(), "yyyyMMddHHmmss")); values.put(COLUMN_FISH_POSITION, position); myCR.insert(KitkitProvider.FISHES_URI, values); } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(), "" + e); } } public void updateFish(Fish fish) { try { String selection = COLUMN_ID + " = " + fish._id; ContentValues values = new ContentValues(); values.put(COLUMN_ID, fish._id); values.put(COLUMN_USERNAME, fish._userName); values.put(COLUMN_FISH_ID, fish._fishID); values.put(COLUMN_FISH_SKIN_NO, fish._skinNo); values.put(COLUMN_FISH_NAME, fish._name); values.put(COLUMN_FISH_CREATE_TIME, fish._createTime); values.put(COLUMN_FISH_POSITION, fish._position); myCR.update(KitkitProvider.FISHES_URI, values, selection, null); } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(), "" + e); } } public ArrayList<Fish> getFishes() { ArrayList<Fish> result = new ArrayList<>(); try { String[] projection = { COLUMN_ID, COLUMN_USERNAME, COLUMN_FISH_ID, COLUMN_FISH_SKIN_NO, COLUMN_FISH_NAME, COLUMN_FISH_CREATE_TIME, COLUMN_FISH_POSITION }; String selection = COLUMN_USERNAME + " = \"" + getCurrentUser().getUserName() + "\""; Cursor cursor = myCR.query(KitkitProvider.FISHES_URI, projection, selection, null, COLUMN_ID + " ASC"); if(cursor.moveToFirst()) { do { Fish fish = new Fish(); fish._id = cursor.getInt(0); fish._userName = cursor.getString(1); fish._fishID = cursor.getString(2); fish._skinNo = cursor.getInt(3); fish._name = cursor.getString(4); fish._createTime = cursor.getString(5); fish._position = cursor.getString(6); result.add(fish); } while(cursor.moveToNext()); } cursor.close(); } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(), "" + e); } long currentTime = System.currentTimeMillis(); String strCurrentTime = getTimeFormatString(currentTime, "yyyyMMddHHmmss"); for (Fish fish : result) { if (currentTime < getCalendarFromString(fish._createTime, "yyyyMMddHHmmss").getTimeInMillis()) { fish._createTime = strCurrentTime; updateFish(fish); } } return result; } public boolean deleteFish(int id) { boolean result = false; try { String selection = "_id = \"" + id + "\""; int rowsDeleted = myCR.delete(KitkitProvider.FISHES_URI, selection, null); if (rowsDeleted > 0) result = true; } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(), "" + e); } return result; } public static String getTimeFormatString(long time, String timeFormat) { String result; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat, Locale.US); Date date = new Date(time); result = simpleDateFormat.format(date); return result; } public static Calendar getCalendarFromString(String string, String dateFormat) { Calendar calendar = null; try { SimpleDateFormat format = new SimpleDateFormat(dateFormat); Date date = format.parse(string); calendar = Calendar.getInstance(); calendar.setTime(date); } catch (Exception e) { Log.e(KitkitDBHandler.class.getName(), "" + e); calendar = Calendar.getInstance(); } return calendar; } }
[ "nikhilm@maqsoftware.com" ]
nikhilm@maqsoftware.com
731cf852020f07639f8fb3c3ce1a293a6d510073
a79bbd5f40a12fd587999631468e4f82db788e3c
/serialization/test-base/src/test/java/nl/example/serialization/SerializeStringPrefixMapWithKryo.java
49f8051c1d48b1f08b6de10a19570e0e75cc61a7
[ "Apache-2.0" ]
permissive
nielsbasjes/prefixmap
33caa5faccd4164058aa9fafd7be9d3502a14e6a
43c0c74164b4bdfd09b4d1043acd4977827052f5
refs/heads/main
2023-08-29T20:05:23.400770
2023-08-28T07:07:26
2023-08-28T08:19:22
162,128,553
6
2
null
2023-09-14T18:58:34
2018-12-17T12:38:22
Java
UTF-8
Java
false
false
925
java
/* * Copyright (C) 2018-2021 Niels Basjes * * 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 nl.example.serialization; import nl.basjes.collections.PrefixMap; import nl.basjes.collections.prefixmap.StringPrefixMap; public class SerializeStringPrefixMapWithKryo extends AbstractSerializeWithKryo { @Override PrefixMap<String> createInstance() { return new StringPrefixMap<>(false); } }
[ "niels@basjes.nl" ]
niels@basjes.nl
21c14428844f764633b33b22e9a0b2fa6fb34b60
e1e30607a5b187faa4c9bc35b36bb4f458170683
/week2-041.GuessingNumberGame/src/GuessingNumberGame.java
402b149b10c7cec39194713e3b7270ee33610a07
[]
no_license
andreigeorgiancraciun/Object-Oriented-programming-with-Java-part-I
07e15f023833269842297e1cec353695f71e53c3
c969ee0a7db7d0b43c5b399594d1ebccab9bf50e
refs/heads/master
2020-08-29T08:14:18.202904
2019-10-28T06:58:58
2019-10-28T06:58:58
217,917,168
0
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
import java.util.Random; import java.util.Scanner; public class GuessingNumberGame { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int numberDrawn = drawNumber(); System.out.println(numberDrawn); int counter = 0; while (true) { int yourNumber = Integer.parseInt(reader.nextLine()); counter++; if (yourNumber < numberDrawn) { System.out.println("The number is greater, guesses made " + counter); } else if (yourNumber > numberDrawn) { System.out.println("The number is lesser , guesses made " + counter); } else { System.out.println("Congratulations, your guess is correct!"); break; } // program your solution here. Do not touch the above lines! } } // DO NOT MODIFY THIS! private static int drawNumber() { return new Random().nextInt(101); } }
[ "49304063+andreigeorgiancraciun@users.noreply.github.com" ]
49304063+andreigeorgiancraciun@users.noreply.github.com
6a5b540796c511a5cac58c46334ebdcb4beba99d
f05c86f9f5172af3e420df5e39122cb820cf4623
/src/main/java/com/example/kafka/zmart/StreamsSerdes.java
3d2cfd2653a451038893392983329c655c400bed
[]
no_license
chengxuetao/__kafka
aefff000dc42d467bd172a34aaaf27a87943bc65
8b63bb12de07cf39763198217fe37fb1e48ee746
refs/heads/master
2023-02-25T19:00:25.570523
2021-02-05T02:29:41
2021-02-05T02:29:41
290,107,310
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package com.example.kafka.zmart; import org.apache.kafka.common.serialization.Serde; import com.example.kafka.zmart.model.Purchase; import com.example.kafka.zmart.model.PurchasePattern; import com.example.kafka.zmart.model.RewardAccumulator; public class StreamsSerdes { public static Serde<Purchase> purchaseSerde() { return new PurchaseSerde(); } public static Serde<PurchasePattern> purchasePatternSerde() { return new PurchasePatternsSerde(); } public static Serde<RewardAccumulator> rewardAccumulatorSerde() { return new RewardAccumulatorSerde(); } public static final class PurchaseSerde extends WrapperSerde<Purchase> { public PurchaseSerde() { super(new JsonSerializer<Purchase>(), new JsonDeserializer<Purchase>(Purchase.class)); } } public static final class PurchasePatternsSerde extends WrapperSerde<PurchasePattern> { public PurchasePatternsSerde() { super(new JsonSerializer<PurchasePattern>(), new JsonDeserializer<PurchasePattern>(PurchasePattern.class)); } } public static final class RewardAccumulatorSerde extends WrapperSerde<RewardAccumulator> { public RewardAccumulatorSerde() { super(new JsonSerializer<RewardAccumulator>(), new JsonDeserializer<RewardAccumulator>(RewardAccumulator.class)); } } }
[ "chengxuetao@detadata.com" ]
chengxuetao@detadata.com
1e0bd8fedd3d5ea25bdf6661e7dadca7baa007be
952789d549bf98b84ffc02cb895f38c95b85e12c
/V_2.x/Server/tags/SpagoBI-2.2.0(20090630)/SpagoBIProject/src/it/eng/spagobi/engines/chart/SpagoBIChartInternalEngine.java
9e65025b7b8f6c56cf82bc35204257496726e012
[]
no_license
emtee40/testingazuan
de6342378258fcd4e7cbb3133bb7eed0ebfebeee
f3bd91014e1b43f2538194a5eb4e92081d2ac3ae
refs/heads/master
2020-03-26T08:42:50.873491
2015-01-09T16:17:08
2015-01-09T16:17:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,741
java
/** SpagoBI - The Business Intelligence Free Platform Copyright (C) 2005-2008 Engineering Ingegneria Informatica S.p.A. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA **/ package it.eng.spagobi.engines.chart; import it.eng.spago.base.RequestContainer; import it.eng.spago.base.ResponseContainer; import it.eng.spago.base.SessionContainer; import it.eng.spago.base.SourceBean; import it.eng.spago.error.EMFErrorHandler; import it.eng.spago.error.EMFErrorSeverity; import it.eng.spago.error.EMFUserError; import it.eng.spago.security.IEngUserProfile; import it.eng.spagobi.analiticalmodel.document.bo.BIObject; import it.eng.spagobi.analiticalmodel.document.bo.ObjTemplate; import it.eng.spagobi.behaviouralmodel.analyticaldriver.bo.BIObjectParameter; import it.eng.spagobi.commons.bo.UserProfile; import it.eng.spagobi.commons.constants.ObjectsTreeConstants; import it.eng.spagobi.commons.constants.SpagoBIConstants; import it.eng.spagobi.commons.dao.DAOFactory; import it.eng.spagobi.commons.utilities.GeneralUtilities; import it.eng.spagobi.engines.InternalEngineIFace; import it.eng.spagobi.engines.chart.bo.ChartImpl; import it.eng.spagobi.engines.chart.bo.charttypes.ILinkableChart; import it.eng.spagobi.engines.chart.bo.charttypes.barcharts.LinkableBar; import it.eng.spagobi.engines.chart.utils.DatasetMap; import it.eng.spagobi.engines.drivers.exceptions.InvalidOperationRequest; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import org.apache.log4j.Logger; /** Internal Engine * * @author Giulio Gavardi * giulio.gavardi@eng.it */ public class SpagoBIChartInternalEngine implements InternalEngineIFace { private static transient Logger logger = Logger.getLogger(SpagoBIChartInternalEngine.class); public static final String messageBundle = "component_spagobichartKPI_messages"; /** * Executes the document and populates the response. * * @param requestContainer The <code>RequestContainer</code>chartImp object (the session can be retrieved from this object) * @param obj The <code>BIObject</code> representing the document to be executed * @param response The response <code>SourceBean</code> to be populated * * @throws EMFUserError the EMF user error */ public void execute(RequestContainer requestContainer, BIObject obj, SourceBean response) throws EMFUserError{ DatasetMap datasets=null; ChartImpl sbi=null; //RequestContainer requestContainer=RequestContainer.getRequestContainer(); ResponseContainer responseContainer=ResponseContainer.getResponseContainer(); EMFErrorHandler errorHandler=responseContainer.getErrorHandler(); if (obj == null) { logger.error("The input object is null."); throw new EMFUserError(EMFErrorSeverity.ERROR, "100", messageBundle); } if (!obj.getBiObjectTypeCode().equalsIgnoreCase("DASH")) { logger.error("The input object is not a dashboard."); throw new EMFUserError(EMFErrorSeverity.ERROR, "1001", messageBundle); } String documentId=obj.getId().toString(); SessionContainer session = requestContainer.getSessionContainer(); IEngUserProfile userProfile = (IEngUserProfile) session.getPermanentContainer().getAttribute(IEngUserProfile.ENG_USER_PROFILE); String userId=(String)((UserProfile)userProfile).getUserId(); Locale locale=GeneralUtilities.getDefaultLocale(); String lang=(String)session.getPermanentContainer().getAttribute(SpagoBIConstants.AF_LANGUAGE); String country=(String)session.getPermanentContainer().getAttribute(SpagoBIConstants.AF_COUNTRY); if(lang!=null && country!=null){ locale=new Locale(lang,country,""); } logger.debug("got parameters userId="+userId+" and documentId="+documentId.toString()); // **************get the template***************** logger.debug("getting template"); SourceBean serviceRequest=requestContainer.getServiceRequest(); try{ SourceBean content = null; byte[] contentBytes = null; try{ ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(Integer.valueOf(documentId)); if(template==null) throw new Exception("Active Template null"); contentBytes = template.getContent(); if(contentBytes==null) { logger.error("TEMPLATE DOESN'T EXIST !!!!!!!!!!!!!!!!!!!!!!!!!!!"); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2007); userError.setBundle("messages"); throw userError; } // get bytes of template and transform them into a SourceBean String contentStr = new String(contentBytes); content = SourceBean.fromXMLString(contentStr); } catch (Exception e) { logger.error("Error while converting the Template bytes into a SourceBean object"); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2003); userError.setBundle("messages"); throw userError; } // **************take informations on the chart type***************** String type=content.getName(); String subtype = (String)content.getAttribute("type"); String data=""; try{ logger.debug("Getting Data Set ID"); if(obj.getDataSetId()!=null){ data=obj.getDataSetId().toString(); } else { logger.error("Data Set not defined"); throw new Exception("Data Set not defined"); } }catch (Exception e) { logger.error("Error while getting the dataset"); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 9207); userError.setBundle("messages"); throw userError; } HashMap parametersMap=null; //Search if the chart has parameters List parametersList=obj.getBiObjectParameters(); logger.debug("Check for BIparameters and relative values"); if(parametersList!=null){ parametersMap=new HashMap(); for (Iterator iterator = parametersList.iterator(); iterator.hasNext();) { BIObjectParameter par= (BIObjectParameter) iterator.next(); String url=par.getParameterUrlName(); List values=par.getParameterValues(); if(values!=null){ if(values.size()==1){ String value=(String)values.get(0); /*String parType=par.getParameter().getType(); if(parType.equalsIgnoreCase("STRING") || parType.equalsIgnoreCase("DATE")){ value="'"+value+"'"; }*/ parametersMap.put(url, value); }else if(values.size() >=1){ String value = "'"+(String)values.get(0)+"'"; for(int k = 1; k< values.size() ; k++){ value = value + ",'" + (String)values.get(k)+"'"; } parametersMap.put(url, value); } } } } // end looking for parameters try{ logger.debug("create the chart"); // set the right chart type sbi=ChartImpl.createChart(type, subtype); sbi.setProfile(userProfile); sbi.setType(type); sbi.setSubtype(subtype); sbi.setData(data); sbi.setParametersObject(parametersMap); // configure the chart with template parameters sbi.configureChart(content); sbi.setLocalizedTitle(locale); boolean linkable=sbi.isLinkable(); if(linkable){ logger.debug("Linkable chart, search in request for serieurlname or categoryurlname"); String serieurlname=""; String categoryurlname=""; //checjk if is a linkable bar or pie boolean linkableBar=false; if(sbi instanceof LinkableBar)linkableBar=true; else linkableBar=false; //check is these parameters are in request, if not take them from template, if not use series and category by default if(linkableBar){ if(serviceRequest.getAttribute("serieurlname")!=null){ serieurlname=(String)serviceRequest.getAttribute("serieurlname"); ((LinkableBar)sbi).setSerieUrlname(serieurlname); } } //category is defined both for pie and bar linkable charts if(serviceRequest.getAttribute("categoryurlname")!=null){ categoryurlname=(String)serviceRequest.getAttribute("categoryurlname"); ((ILinkableChart)sbi).setCategoryUrlName(categoryurlname); } //check if there are other parameters from the drill parameters whose value is in the request; elsewhere take them from template logger.debug("Linkable chart: search in the request for other parameters"); HashMap drillParameters=new HashMap(); if(((ILinkableChart)sbi).getDrillParameter()!= null){ drillParameters=(HashMap)((ILinkableChart)sbi).getDrillParameter().clone(); for (Iterator iterator = drillParameters.keySet().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); if(serviceRequest.getAttribute(name)!=null){ String value=(String)serviceRequest.getAttribute(name); ((ILinkableChart)sbi).getDrillParameter().remove(name); ((ILinkableChart)sbi).getDrillParameter().put(name, value); } } } } } catch (Exception e) { logger.error("Error while creating the chart"); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2004); userError.setBundle("messages"); throw userError; } // calculate values for the chart try{ logger.debug("Retrieve value by executing the dataset"); datasets=sbi.calculateValue(); } catch (Exception e) { logger.error("Error in retrieving the value", e); EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2006); userError.setBundle("messages"); throw userError; } //JFreeChart chart=null; // create the chart //in the re-drawing case in document-composition check if serie or categories or cat_group have been set String serie=null; String category=null; String catGroup=null; if(serviceRequest.getAttribute("serie")!=null) { List series=(List)serviceRequest.getAttributeAsList("serie"); for(Iterator it=series.iterator();it.hasNext();){ serie=(String)it.next(); response.setAttribute("serie",serie); } } if(serviceRequest.getAttribute("cat_group")!=null) { List catGroups=(List)serviceRequest.getAttributeAsList("cat_group"); for(Iterator it=catGroups.iterator();it.hasNext();){ catGroup=(String)it.next(); response.setAttribute("cat_group",catGroup); } } if(serviceRequest.getAttribute("category")!=null) { Object catO=serviceRequest.getAttribute("category"); category=""; try{ category=(String)catO; } catch (Exception e) { Integer catI=(Integer)catO; category=catI.toString(); } response.setAttribute("category",category); } try{ //chart = sbi.createChart(title,dataset); logger.debug("successfull chart creation"); response.setAttribute("datasets",datasets); response.setAttribute(ObjectsTreeConstants.SESSION_OBJ_ATTR,obj); response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "CHARTKPI"); response.setAttribute("sbi",sbi); } catch (Exception eex) { EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2004); userError.setBundle("messages"); throw userError; } logger.debug("OUT"); } catch (EMFUserError e) { errorHandler.addError(e); } catch (Exception e) { EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 101); logger.error("Generic Error"); errorHandler.addError(userError); } } /** * The <code>SpagoBIDashboardInternalEngine</code> cannot manage subobjects so this method must not be invoked. * * @param requestContainer The <code>RequestContainer</code> object (the session can be retrieved from this object) * @param obj The <code>BIObject</code> representing the document * @param response The response <code>SourceBean</code> to be populated * @param subObjectInfo An object describing the subobject to be executed * * @throws EMFUserError the EMF user error */ public void executeSubObject(RequestContainer requestContainer, BIObject obj, SourceBean response, Object subObjectInfo) throws EMFUserError { // it cannot be invoked logger.error("SpagoBIDashboardInternalEngine cannot exec subobjects."); throw new EMFUserError(EMFErrorSeverity.ERROR, "101", messageBundle); } /** * Function not implemented. Thid method should not be called * * @param requestContainer The <code>RequestContainer</code> object (the session can be retrieved from this object) * @param response The response <code>SourceBean</code> to be populated * @param obj the obj * * @throws InvalidOperationRequest the invalid operation request * @throws EMFUserError the EMF user error */ public void handleNewDocumentTemplateCreation(RequestContainer requestContainer, BIObject obj, SourceBean response) throws EMFUserError, InvalidOperationRequest { logger.error("SpagoBIDashboardInternalEngine cannot build document template."); throw new InvalidOperationRequest(); } /** * Function not implemented. Thid method should not be called * * @param requestContainer The <code>RequestContainer</code> object (the session can be retrieved from this object) * @param response The response <code>SourceBean</code> to be populated * @param obj the obj * * @throws InvalidOperationRequest the invalid operation request * @throws EMFUserError the EMF user error */ public void handleDocumentTemplateEdit(RequestContainer requestContainer, BIObject obj, SourceBean response) throws EMFUserError, InvalidOperationRequest { logger.error("SpagoBIDashboardInternalEngine cannot build document template."); throw new InvalidOperationRequest(); } }
[ "giachino@99afaf0d-6903-0410-885a-c66a8bbb5f81" ]
giachino@99afaf0d-6903-0410-885a-c66a8bbb5f81
2cbfdc94d63cb31bcf41faa3fd0054d072466911
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/elastic--elasticsearch/712b7116f48c982be8d398bfc14e97baa86f3ae1/after/SumParser.java
3373017095fd8c667f4a4d2d5061596be06c1f1b
[]
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
1,698
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.search.aggregations.metrics.sum; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.metrics.NumericValuesSourceMetricsAggregatorParser; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSourceParser; /** * */ public class SumParser extends NumericValuesSourceMetricsAggregatorParser<InternalSum> { public SumParser() { super(InternalSum.TYPE); } @Override protected AggregatorFactory createFactory(String aggregationName, ValuesSourceParser.Input<ValuesSource.Numeric> input) { return new SumAggregator.Factory(aggregationName, input); } // NORELEASE implement this method when refactoring this aggregation @Override public AggregatorFactory getFactoryPrototype() { return null; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
9e8f1233ddecc7dc067192127bcb3205b8c01293
a1c6e00891e9bba046310deb935b6f6aefbfe7d5
/app/src/main/java/com/example/andrew/thermal_cam/TAmgRegs.java
5dff271ce46b2b4006f0218ee45ab7e20e7de9e3
[]
no_license
SiberK/Thermal_Cam
278b40efdc2600ded8bbd56a97d364ede7b08166
b564cd0788c52fb2eec96fa29e4d920bb1c654dc
refs/heads/master
2020-03-19T05:54:58.573547
2018-06-04T05:12:01
2018-06-04T05:12:01
135,974,062
0
0
null
null
null
null
UTF-8
Java
false
false
10,350
java
package com.example.andrew.thermal_cam; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; /** * Created by Andrew on 25.05.18. */ public class TAmgRegs{ private byte PCTL ; private byte FPSC ; private byte INTC ; private byte STAT ; private byte AVE ; private short TTH ; private float TempPxl[] ;// значения температуры полученные с сенсора (8х8) public float IntPxl[] ;// интерполированные значения температуры (24х24) public int ImgPxl[] ;// цветовая интерпретация температур (24х24) private int IxTrg = -1 ; public final int AMG_COLS = 8 ; public final int AMG_ROWS = 8 ; public final int AMG_COUNT_CELLS = AMG_COLS * AMG_ROWS ; public final int INTERPOLATED_COLS = 24 ; public final int INTERPOLATED_ROWS = 24 ; public final int INT_COUNT_CELLS = INTERPOLATED_COLS * INTERPOLATED_ROWS ; private final int CamColors[] = { 0x480078,0x400078,0x400078,0x400078,0x400080,0x380080,0x380080,0x380080, 0x380080,0x300080,0x300080,0x300080,0x280080,0x280080,0x280080,0x280080, 0x200080,0x200080,0x200080,0x180080,0x180080,0x180088,0x180088,0x100088, 0x100088,0x100088,0x080088,0x080088,0x080088,0x000088,0x000088,0x000088, 0x000088,0x000088,0x000488,0x000488,0x000888,0x000C90,0x000C90,0x001090, 0x001490,0x001490,0x001890,0x001C90,0x001C90,0x002090,0x002490,0x002890, 0x002890,0x002C90,0x003090,0x003090,0x003490,0x003890,0x003C98,0x003C98, 0x004098,0x004498,0x004898,0x004898,0x004C98,0x005098,0x005498,0x005898, 0x005898,0x005C98,0x006098,0x006498,0x006498,0x006898,0x006C98,0x0070A0, 0x0074A0,0x0078A0,0x0078A0,0x007CA0,0x0080A0,0x0084A0,0x0088A0,0x008CA0, 0x008CA0,0x0090A0,0x0094A0,0x0098A0,0x009CA0,0x00A0A0,0x00A4A0,0x00A4A0, 0x00A8A0,0x00A8A0,0x00ACA0,0x00ACA0,0x00AC98,0x00AC98,0x00AC98,0x00AC90, 0x00AC90,0x00AC90,0x00AC88,0x00B088,0x00B088,0x00B080,0x00B080,0x00B078, 0x00B078,0x00B078,0x00B070,0x00B470,0x00B470,0x00B468,0x00B468,0x00B468, 0x00B460,0x00B460,0x00B458,0x00B858,0x00B858,0x00B850,0x00B850,0x00B850, 0x00B848,0x00B848,0x00B840,0x00BC40,0x00BC40,0x00BC38,0x00BC38,0x00BC30, 0x00BC30,0x00BC30,0x00BC28,0x00BC28,0x00C020,0x00C020,0x00C020,0x00C018, 0x00C018,0x00C010,0x00C010,0x00C008,0x00C408,0x00C408,0x00C400,0x00C400, 0x00C400,0x00C400,0x08C400,0x08C400,0x08C800,0x10C800,0x10C800,0x18C800, 0x18C800,0x20C800,0x20C800,0x28C800,0x28CC00,0x30CC00,0x30CC00,0x38CC00, 0x38CC00,0x38CC00,0x40CC00,0x40CC00,0x48CC00,0x48D000,0x50D000,0x50D000, 0x58D000,0x58D000,0x60D000,0x60D000,0x68D000,0x68D400,0x70D400,0x70D400, 0x78D400,0x78D400,0x80D400,0x80D400,0x88D400,0x88D800,0x90D800,0x90D800, 0x98D800,0x98D800,0xA0D800,0xA8D800,0xA8D800,0xB0DC00,0xB0DC00,0xB8DC00, 0xB8DC00,0xC0DC00,0xC0DC00,0xC8DC00,0xC8DC00,0xD0DC00,0xD0E000,0xD8E000, 0xD8DC00,0xD8D800,0xD8D400,0xD8D000,0xD8D000,0xE0CC00,0xE0C800,0xE0C400, 0xE0C000,0xE0BC00,0xE0B800,0xE0B400,0xE0B000,0xE0AC00,0xE0A800,0xE0A400, 0xE0A000,0xE09C00,0xE09800,0xE09400,0xE09000,0xE08C00,0xE88800,0xE88400, 0xE88000,0xE87C00,0xE87800,0xE87400,0xE87000,0xE86C00,0xE86800,0xE86400, 0xE86000,0xE85C00,0xE85800,0xE85400,0xE85000,0xE84C00,0xE84800,0xF04400, 0xF04000,0xF03C00,0xF03800,0xF03400,0xF03000,0xF02C00,0xF02800,0xF02000, 0xF01C00,0xF01800,0xF01400,0xF01000,0xF00C00,0xF00800,0xF00400,0xF80000 }; //======================================================================================= TAmgRegs(){ PCTL = FPSC = INTC = STAT = AVE = 0 ; TTH = 0 ; TempPxl = new float[AMG_COUNT_CELLS] ; IntPxl = new float[INT_COUNT_CELLS] ; ImgPxl = new int[INTERPOLATED_ROWS * INTERPOLATED_COLS] ; } //======================================================================================= public void Set(byte[] buf,float TempMin,float TempMax){ if(buf != null && TempPxl != null && IntPxl != null && ImgPxl != null){ ByteBuffer bbPack = ByteBuffer.wrap(buf) ; bbPack.order(ByteOrder.LITTLE_ENDIAN) ; ShortBuffer sbPack = bbPack.asShortBuffer(); PCTL = bbPack.get(0) ; FPSC = bbPack.get(1) ; INTC = bbPack.get(2) ; STAT = bbPack.get(3) ; AVE = bbPack.get(4) ; TTH = sbPack.get(3) ; for(int ix=0;ix<AMG_COUNT_CELLS;ix++){ short val = sbPack.get(ix + 4); if((val & 0x800) != 0) val = (short)(val | 0xF000); TempPxl[ix] = val * 0.25f ;// переводим в градусы! } interpolate_image(TempPxl, AMG_ROWS, AMG_COLS, IntPxl, INTERPOLATED_ROWS, INTERPOLATED_COLS); for(int ix=0;ix<INTERPOLATED_ROWS * INTERPOLATED_COLS;ix++){ int val = map(IntPxl[ix],TempMin,TempMax,0,255) ; ImgPxl[ix] = CamColors[val] ; } } } //======================================================================================= TAmgRegs(byte[] buf,float TempMin,float TempMax){ TempPxl = new float[AMG_COUNT_CELLS] ; IntPxl = new float[INT_COUNT_CELLS] ; ImgPxl = new int[INTERPOLATED_ROWS * INTERPOLATED_COLS]; Set(buf,TempMin,TempMax) ; } //======================================================================================= public float GetTempTrg(int ixTrg){ return (ixTrg >= 0 && ixTrg < INT_COUNT_CELLS) ? IntPxl[ixTrg] : 0f ;} //======================================================================================= //======================================================================================= //======================================================================================= private int map(float val,float valMin,float valMax,int outMin,int outMax){ val = (val<valMin) ? valMin :(val>valMax) ? valMax : val ; int result = (int) (outMin + (val-valMin)/(valMax-valMin)*(outMax-outMin)); result = (result<outMin) ? outMin : (result > outMax) ? outMax : result ; return result ;} //======================================================================================= // src is a grid src_rows * src_cols // dest is a pre-allocated grid, dest_rows*dest_cols private void interpolate_image(float src[], int src_rows, int src_cols, float dest[], int dest_rows, int dest_cols) { float mu_x = (src_cols - 1.0f) / (dest_cols - 1.0f); float mu_y = (src_rows - 1.0f) / (dest_rows - 1.0f); float adj_2d[] = new float[16]; // matrix for storing adjacents for (int y_idx=0; y_idx < dest_rows; y_idx++) { for (int x_idx=0; x_idx < dest_cols; x_idx++) { float x = x_idx * mu_x; float y = y_idx * mu_y; get_adjacents_2d(src, adj_2d, src_rows, src_cols, (int)x, (int)y); float frac_x = x - (int)x; // we only need the ~delta~ between the points float frac_y = y - (int)y; // we only need the ~delta~ between the points float out = bicubicInterpolate(adj_2d, frac_x, frac_y); if ((x_idx >= 0) && (x_idx < dest_cols) && (y_idx >= 0) && (y < dest_rows)) dest[y_idx * dest_cols + x_idx] = out ; } } } //======================================================================================= private float get_point(float p[], int rows, int cols, int x, int y) { if (x < 0) x = 0; if (y < 0) y = 0; if (x >= cols) x = cols - 1; if (y >= rows) y = rows - 1; return p[y * cols + x]; } //======================================================================================= // p is a list of 4 points, 2 to the left, 2 to the right private float cubicInterpolate(float p[],int offset , float x) { float r = p[1+offset] + (0.5f * x * (p[2+offset] - p[0+offset] + x*(2.0f*p[0+offset] - 5.0f*p[1+offset] + 4.0f*p[2+offset] - p[3+offset] + x*(3.0f*(p[1+offset] - p[2+offset]) + p[3+offset] - p[0+offset])))); return r; } //======================================================================================= // p is a 16-point 4x4 array of the 2 rows & columns left/right/above/below private float bicubicInterpolate(float p[], float x, float y) { float arr[] = {0,0,0,0}; arr[0] = cubicInterpolate(p, 0, x); arr[1] = cubicInterpolate(p, 4, x); arr[2] = cubicInterpolate(p, 8, x); arr[3] = cubicInterpolate(p,12, x); return cubicInterpolate(arr, 0, y); } //======================================================================================= // src is rows*cols and dest is a 16-point array passed in already allocated! private void get_adjacents_2d(float src[], float dest[], int rows, int cols, int x, int y) { for (int delta_y = -1; delta_y < 3; delta_y++) { // -1, 0, 1, 2 int row_offset = 4 * (delta_y+1); // index into each chunk of 4 for (int delta_x = -1; delta_x < 3; delta_x++) { // -1, 0, 1, 2 dest[delta_x+1+row_offset] = get_point(src, rows, cols, x+delta_x, y+delta_y); } } } //======================================================================================= //======================================================================================= }
[ "siberc@mail.ru" ]
siberc@mail.ru
76976b9535a0870e3afb168003eb9cab9e286062
7a250c16b79b2d0690270f72fd160d6cf8c02614
/jupiter/src/main/java/com/laioffer/jupiter/entity/Item.java
2876b8de9e9db7b8c6540ab7f03cec8defc8bac2
[]
no_license
xiaochenma131/Twitch-Video-Recommendation
cac1d2e21b69f1e5605252cd0d3e8d32c526eeb7
255a4696968628b94b87c28281769c8ac5030c7c
refs/heads/master
2023-07-11T20:44:45.063186
2021-08-23T02:01:25
2021-08-23T02:01:25
398,944,879
0
0
null
null
null
null
UTF-8
Java
false
false
3,385
java
package com.laioffer.jupiter.entity; import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonDeserialize(builder = Item.Builder.class) public class Item { @JsonProperty("id") private final String id; @JsonProperty("title") private final String title; @JsonProperty("thumbnail_url") private final String thumbnailUrl; @JsonProperty("broadcaster_name") @JsonAlias({ "user_name" }) private String broadcasterName; @JsonProperty("url") private String url; @JsonProperty("game_id") private String gameId; @JsonProperty("item_type") private ItemType type; private Item(Builder builder) { this.id = builder.id; this.title = builder.title; this.url = builder.url; this.thumbnailUrl = builder.thumbnailUrl; this.broadcasterName = builder.broadcasterName; this.gameId = builder.gameId; this.type = builder.type; } public String getId() { return id; } public String getTitle() { return title; } public String getUrl() { return url; } public Item setUrl(String url) { this.url = url; return this; } public String getThumbnailUrl() { return thumbnailUrl; } public String getBroadcasterName() { return broadcasterName; } public String getGameId() { return gameId; } public Item setGameId(String gameId) { this.gameId = gameId; return this; } public ItemType getType() { return type; } public Item setType(ItemType type) { this.type = type; return this; } @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public static class Builder { @JsonProperty("id") private String id; @JsonProperty("title") private String title; @JsonProperty("url") private String url; @JsonProperty("thumbnail_url") private String thumbnailUrl; @JsonProperty("broadcaster_name") @JsonAlias({ "user_name" }) private String broadcasterName; @JsonProperty("game_id") private String gameId; @JsonProperty("item_type") private ItemType type; public Builder id(String id) { this.id = id; return this; } public Builder title(String title) { this.title = title; return this; } public Builder url(String url) { this.url = url; return this; } public Builder thumbnailUrl(String thumbnailUrl) { this.thumbnailUrl = thumbnailUrl; return this; } public Builder broadcasterName(String broadcasterName) { this.broadcasterName = broadcasterName; return this; } public Builder gameId(String gameId) { this.gameId = gameId; return this; } public Builder type(ItemType type) { this.type = type; return this; } public Item build() { return new Item(this); } } }
[ "ma.xiaoch@northeastern.edu" ]
ma.xiaoch@northeastern.edu
9665970935eb6be8da4a9b2d0e59fc3f3a126c9a
54cb1dec5f794b0385b57f309fb7dae911ce9f51
/exam/src/exampack/Results.java
b455e996d902073058be803d8739a1259b2c3d76
[]
no_license
molerreshma/JAVAPROJECTS
cf8751522f820494fbfeb378a31f09740b5d966a
6d152d96539b74fd7f0d1c9a4b5b4a003265852c
refs/heads/master
2020-07-29T07:31:09.922188
2019-09-21T08:22:37
2019-09-21T08:22:37
209,716,100
0
0
null
null
null
null
UTF-8
Java
false
false
644
java
package exampack; import java.util.Scanner; public class Results { public static void main(String[] args) { int n; Scanner sc=new Scanner(System.in); System.out.println("Enter the number of students"); n=sc.nextInt(); System.out.println("Enter the marks of students"); int arr[]=new int[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } System.out.println("The average is"); int sum=0; int avg; for(int i=0;i<n;i++) { sum=sum+arr[i]; } avg=sum/n; System.out.println(avg); } }
[ "Face@Face-PC" ]
Face@Face-PC
b26aa988c7d0bd559e6066342145ff8930eea104
2da17b1dbb19c0a436867fda0d8024f629e712ff
/DrawnerSolution/app/src/test/java/com/example/mfernandes/drawnersolution/ExampleUnitTest.java
d837fb06b43ef57552dbd74b88d42eaf8343df20
[]
no_license
MiqueiasFernandes/SolutionDrawner
dd4985be38b0add7ea8cc776ab8c6ccad4085e65
ba73f4c33277e6329440acf8854cfee09bfbb6f6
refs/heads/master
2021-01-24T11:27:59.291581
2016-10-12T18:37:51
2016-10-12T18:37:51
70,205,519
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.example.mfernandes.drawnersolution; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "mfernandes@localhost.localdomain" ]
mfernandes@localhost.localdomain
702c4466d32ffd8ceb399cb1ebde8a80db0d67df
f9fb6243a56eb25591ff97d18f15d24e88ef5015
/Project Code/src/jm/audio/synth/Comb.java
11056ca6128c64b3efc597df048f1e0ce82f2677
[]
no_license
gw-sd-2016/SPLALO
bc7a771ddc3941e8c2e6afac55d26744cfc9a88b
b7a865af1b7f7334c65f7c585c860952e5d075c2
refs/heads/master
2021-01-21T14:01:04.087575
2016-05-12T00:01:37
2016-05-12T00:01:37
44,283,713
0
0
null
2015-12-11T05:30:51
2015-10-15T00:19:38
Java
UTF-8
Java
false
false
1,327
java
package jm.audio.synth; import jm.audio.AOException; import jm.audio.AudioObject; public final class Comb extends AudioObject { private float decay; private int delay; private float[] delayLine; private int delayIndex; public Comb(AudioObject paramAudioObject, int paramInt) { this(paramAudioObject, paramInt, 0.5D); } public Comb(AudioObject paramAudioObject, int paramInt, double paramDouble) { super(paramAudioObject, "[Comb]"); this.decay = ((float)paramDouble); this.delay = paramInt; } public int work(float[] paramArrayOfFloat) throws AOException { int i = this.previous[0].nextWork(paramArrayOfFloat); for (int j = 0; j < i; j++) { float f = this.delayLine[this.delayIndex]; paramArrayOfFloat[j] += f * this.decay; this.delayLine[(this.delayIndex++)] = paramArrayOfFloat[j]; if (this.delayIndex >= this.delayLine.length) { this.delayIndex = 0; } } return j; } public void build() { int i = (int)(this.delay / 1000.0F * this.sampleRate); this.delayLine = new float[i * this.channels]; this.delayIndex = 0; } } /* Location: C:\Users\Kweku Emuze\Downloads\jMusic1.6.4.jar!\jm\audio\synth\Comb.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "ellisyarboi@gwmail.gwu.edu" ]
ellisyarboi@gwmail.gwu.edu
1b6e1aa59c0a5acb011c922daa5ee595bc3d1c15
66d3571cfb63f2756b89a31e021bee9226396907
/src/Logging.java
5dc840b8bc2fa0b95706f6abd6cb3ca8d83d1eca
[]
no_license
sunnypatel2141/TweetToKafka
9dd542e8aca04a62954508938402fb507e517788
c3342601a735a95b7d801c10848498dbc2747c74
refs/heads/master
2021-08-14T08:21:00.324757
2017-11-15T04:00:38
2017-11-15T04:00:38
110,158,258
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
import java.text.SimpleDateFormat; import java.util.Date; public class Logging { private static final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss"); public static void print(String message) { Date d = new Date(); System.out.println(sdf.format(d) + ": " + message); } }
[ "sanipatel2141@hotmail.com" ]
sanipatel2141@hotmail.com
f005f664ae24073ac4be6b96b7474005f29e9a38
d8b6ffb590daa6cf6861c0cc4a4549eaa2c58b0a
/src/br/com/eagravos/mobile/tools/Operator.java
98fd4aafc0f333c74bbc82f7bb16208fa9701b82
[]
no_license
albuquerquecesar/egravos_mobile
3c7c1d9ee352e4366e741435251db65a66cfeb3d
0f4e17271592559f02a61a3996d876318c7b6f98
refs/heads/master
2021-05-27T10:11:39.337146
2014-06-07T17:12:43
2014-06-07T17:12:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package br.com.eagravos.mobile.tools; /** * Operadores disponíveis para consultas * em webservices * @author albuquerque * */ public enum Operator { EQUALS("="),GREATER(">"),LESS("<"),GREATER_EQUAL(">="),LESS_EQUAL("<="),UNEQUAL("!="),NOT_IN("not in"); private final String valor; Operator(String valor){ this.valor=valor; } public String getValor() { return valor; } }
[ "cesar.consultorjr@gmail.com" ]
cesar.consultorjr@gmail.com
c594628c640a201a6fb80b4744bee5fc6020243a
b7c149c0c92ce304bb11d0932e816e2a9a2f0a15
/src/com/wb/vote/domain/VoteOption.java
ee51d38a5d8a5790529cfd6ba3b0d937ec5e1669
[]
no_license
helloworld0118/oa
6f76419883dac7c69caa364970a254f4e00691ec
c86de0a06387c4f4a61ccb149b57d1984f0adb6c
refs/heads/main
2023-03-13T01:02:55.339429
2021-03-06T10:27:56
2021-03-06T10:27:56
345,034,420
0
0
null
null
null
null
UTF-8
Java
false
false
2,061
java
package com.wb.vote.domain; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; /** * VoteOption entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "vote_option", catalog = "super_oa") public class VoteOption implements java.io.Serializable { // Fields private Integer voId; private VoteSubject voteSubject; private String voOption; private Set<VoteItem> voteItems = new HashSet<VoteItem>(0); // Constructors /** default constructor */ public VoteOption() { } /** full constructor */ public VoteOption(VoteSubject voteSubject, String voOption, Set<VoteItem> voteItems) { this.voteSubject = voteSubject; this.voOption = voOption; this.voteItems = voteItems; } // Property accessors @GenericGenerator(name = "generator", strategy = "increment") @Id @GeneratedValue(generator = "generator") @Column(name = "vo_id", unique = true, nullable = false) public Integer getVoId() { return this.voId; } public void setVoId(Integer voId) { this.voId = voId; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "vs_id") public VoteSubject getVoteSubject() { return this.voteSubject; } public void setVoteSubject(VoteSubject voteSubject) { this.voteSubject = voteSubject; } @Column(name = "vo_option", length = 350) public String getVoOption() { return this.voOption; } public void setVoOption(String voOption) { this.voOption = voOption; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "voteOption") public Set<VoteItem> getVoteItems() { return this.voteItems; } public void setVoteItems(Set<VoteItem> voteItems) { this.voteItems = voteItems; } }
[ "helloworld0118@qq.com" ]
helloworld0118@qq.com
5d7f0a737a6707d66ef33b14a5a1c3bc22b08ccb
a2a900fc001b39dcf18ad061d49c52884f0b4e20
/src/main/java/com/webapp/payload/request/CreateWordRequest.java
5df488229dee14d08d258c9d34784ebe5b6df219
[]
no_license
Khrustal/coursework-backend
df476f183bda68e412990b65b80bd3d3fb11afb3
6b426d184a9e17083e2c1b10bdaaaf44a822f2dd
refs/heads/master
2023-02-06T18:04:28.198340
2020-12-21T15:57:35
2020-12-21T15:57:35
316,899,498
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package com.webapp.payload.request; import javax.validation.constraints.NotBlank; public class CreateWordRequest { @NotBlank private String original; @NotBlank private String translation; @NotBlank private Long userId; public String getOriginal() { return original; } public void setOriginal(String original) { this.original = original; } public String getTranslation() { return translation; } public void setTranslation(String translation) { this.translation = translation; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } }
[ "artemkhrustal@gmail.com" ]
artemkhrustal@gmail.com
f72de893426b70721292c9802be9cacad5ea0dc3
97969f71979a52b559c8a446202a86c4995f2876
/AIML/machineLearning-jar/src/main/java/pt/mleiria/numericalAnalysis/nonLinearEquation/rootFinder/NewtonRootFinder.java
ae3a7b5105ca024c3bf4c2e1fa639e9886295e89
[]
no_license
glacierck/aiml
3815a66d205d64fc09f7fb51f4f21377e5c6cf28
a1d02d3006a737a6747bea730b8c313ee124e3db
refs/heads/master
2021-01-12T06:31:49.437499
2016-08-05T11:49:32
2016-08-05T11:49:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,949
java
/** * */ package pt.mleiria.numericalAnalysis.nonLinearEquation.rootFinder; import pt.mleiria.machinelearning.interfaces.OneVarFunctionDerivative; import pt.mleiria.numericalAnalysis.exception.InvalidIntervalException; import pt.mleiria.numericalAnalysis.exception.IterationCountExceededException; import pt.mleiria.numericalAnalysis.utils.DataAccumulator; import pt.mleiria.numericalAnalysis.utils.Epsilon; import pt.mleiria.numericalAnalysis.utils.Utils; /** * @author Manuel * */ public final class NewtonRootFinder extends AbstractRootFinder { private double am; private double bm; private double xm, xm1; /** * @param df * @param maxIters * @param comparisonTollerance limite de erro admissivel. A iteraccao para * quando o valor encontrado for menor ou igual comparisonTollerance * @param a coordenada x do limite inferior do intervalo * @param b coordenada x do limite superior do intervalo * @param x_0 * @throws pt.mleiria.numericalAnalysis.exception.InvalidIntervalException */ public NewtonRootFinder(OneVarFunctionDerivative df, int maxIters, double comparisonTollerance, double a, double b, double x_0) throws InvalidIntervalException { super(df, maxIters, comparisonTollerance); checkInterval(a, b); // Inicializacao this.xm = x_0; } /** * @param f a funcao a encontrar o zero * @param maxIters o numero maximo de iteraccoes permitidas * @param a coordenada x do limite inferior do intervalo * @param b coordenada x do limite superior do intervalo * @param x_0 * @throws InvalidIntervalException */ public NewtonRootFinder(OneVarFunctionDerivative f, int maxIters, double a, double b, double x_0) throws InvalidIntervalException { super(f, maxIters, Epsilon.doubleValue()); checkInterval(a, b, x_0); // Inicializacao this.xm = x_0; } public void checkInterval(double a, double b, double x_0) throws InvalidIntervalException { if (x_0 > b || x_0 < a) { throw new InvalidIntervalException(); } } /* * (non-Javadoc) * * @see mleiria.nonLinearEquation.rootFinder.AbstractRootFinder#computeNextPosition() */ @Override public void computeNextPosition() { xm1 = xm - f.value(xm) / df.derivative(xm); } /* * (non-Javadoc) * * @see mleiria.nonLinearEquation.rootFinder.AbstractRootFinder#findRoot() */ @Override public void findRoot() throws IterationCountExceededException { // Start Logger String[][] data = new String[][]{ {String.valueOf(getIterationCount()), "5"}, {Utils.formataNumero(xm1, "##0.00000000"), "20"}, { Utils.formataNumero(f.value(xm1), "##0.00000000"), "20"}, { Utils.formataNumero(1.41421356 - xm1, "##0.00000000"), "20"}}; DataAccumulator.feedAccumulator(data); Utils.print(String.valueOf(getIterationCount()), 5); Utils.print(Utils.formataNumero(xm1, "##0.00000000"), 20); Utils.print(Utils.formataNumero(f .value(xm1), "##0.00000000"), 20); Utils.print(Utils.formataNumero( 1.41421356 - xm1, "##0.00000000"), 20); Utils.println(); // End Logger checkIterationCount(); computeNextPosition(); n++; if (hasConverged()) { // Start Logger data = new String[][]{ {String.valueOf(getIterationCount()), "5"}, {Utils.formataNumero(xm1, "##0.00000000"), "20"}, { Utils.formataNumero(f.value(xm1), "##0.00000000"), "20"}, { Utils.formataNumero(1.41421356 - xm1, "##0.00000000"), "20"}}; DataAccumulator.feedAccumulator(data); Utils.clearFile("Newton.txt"); Utils.appendToFile("Newton.txt", true, DataAccumulator.getData()); DataAccumulator.reset(); // End Logger reset(); } else { xm = xm1; findRoot(); } } /* * (non-Javadoc) * * @see mleiria.nonLinearEquation.rootFinder.AbstractRootFinder#hasConverged() */ @Override public boolean hasConverged() { if ((Math.abs(xm1 - xm) <= comparisonTollerance) || (f.value(xm1) <= comparisonTollerance && f.value(xm1) >= -comparisonTollerance)) { return true; } else { return false; } } }
[ "manuel@manuel-nb13712" ]
manuel@manuel-nb13712
fcdc845610cc93a9c3bb2768a4decf9e8b3e9686
1cf622453c50d777ac8dc61bb5d5cea56c23f3da
/broadbean-starter/broadbean-starter-cache/src/main/java/com/yp/starter/cache/redis/RedisOperator.java
74785dfd6557dc35b0bf58b28553226c1c729c3a
[]
no_license
ypxf369/Broadbean
d857e8dd8547b11a1b62d6770620f8d972dfc6e4
3682454de256e6d3f1f6b3ab56697f0874501aff
refs/heads/master
2020-04-06T23:45:45.781636
2018-11-17T13:04:14
2018-11-17T13:04:14
157,880,603
1
1
null
null
null
null
UTF-8
Java
false
false
4,719
java
package com.yp.starter.cache.redis; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.core.*; import org.springframework.stereotype.Component; import java.util.Collection; import java.util.Date; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Redis 操作工具 * Created by yepeng on 2018/11/16. */ @Component public class RedisOperator { @Autowired private RedisTemplate<String, Object> redisTemplate; @Autowired private ValueOperations<String, String> valueOperation; @Autowired private HashOperations<String, String, Object> hashOperation; @Autowired private ListOperations<String, Object> listOperation; @Autowired private SetOperations<String, Object> setOperation; @Autowired private ZSetOperations<String, Object> zSetOperation; /** * 默认过期时长,单位:秒 */ public final static long DEFAULT_EXPIRE = 60 * 60 * 24; /** * 不设置过期时长 */ public final static long NOT_EXPIRE = -1; /** * Redis的根操作路径 */ @Value("${redis.root:broadbean}") private String category; public RedisOperator setCategory(String category) { this.category = category; return this; } /** * 获取Key的全路径 * * @param key * @return full key */ public String getFullKey(String key) { return this.category + ":" + key; } public RedisTemplate<String, Object> getRedisTemplate() { return redisTemplate; } public ValueOperations<String, String> getValueOperation() { return valueOperation; } public HashOperations<String, String, Object> getHashOperation() { return hashOperation; } public ListOperations<String, Object> getListOperation() { return listOperation; } public SetOperations<String, Object> getSetOperation() { return setOperation; } public ZSetOperations<String, Object> getzSetOperation() { return zSetOperation; } // // key // ------------------------------------------- /** * 判断key是否存在 */ public boolean existsKey(String key) { return redisTemplate.hasKey(getFullKey(key)); } /** * 判断key存储的值的类型 * * @return DataType[string、list、set、zset、hash] */ public DataType typeKey(String key) { return redisTemplate.type(getFullKey(key)); } /** * 重命名key。如果newKey已经存在,则newKey的原值被覆盖 */ public void renameKey(String oldKey, String newKey) { redisTemplate.rename(getFullKey(oldKey), getFullKey(newKey)); } /** * newKey不存在时才重命名 * * @param oldKey * @param newKey * @return 修改成功返回true */ public boolean renameKeyIfAbsent(String oldKey, String newKey) { return redisTemplate.renameIfAbsent(oldKey, newKey); } /** * 删除key */ public void deleteKey(String key) { redisTemplate.delete(key); } /** * 删除多个key */ public void deleteKey(String... keys) { Set<String> ks = Stream.of(keys).map(k -> getFullKey(k)).collect(Collectors.toSet()); redisTemplate.delete(ks); } /** * 批量删除key */ public void deleteKey(Collection<String> keys) { Set<String> ks = keys.stream().map(k -> getFullKey(k)).collect(Collectors.toSet()); redisTemplate.delete(ks); } /** * 设置key的生命周期,单位秒 * * @param key * @param time 时间数 * @param timeUnit TimeUnit 时间单位 */ public void expireKey(String key, long time, TimeUnit timeUnit) { redisTemplate.expire(key, time, timeUnit); } /** * 设置key在指定的日期过期 * * @param key * @param date 指定日期 */ public void expireKeyAt(String key, Date date) { redisTemplate.expireAt(key, date); } /** * 查询key的生命周期 * * @param key * @param timeUnit TimeUnit 时间单位 * @return 指定时间单位的时间数 */ public long getKeyExpire(String key, TimeUnit timeUnit) { return redisTemplate.getExpire(key, timeUnit); } /** * 将key设置为永久有限 */ public void persistKey(String key) { redisTemplate.persist(key); } }
[ "ypxf369@163.com" ]
ypxf369@163.com
1cdc2d1cf2c200f417e0131401eb164c80cce277
c4786689a901e50078b48dfe1337ab40e30cf005
/src/CIMS/Modules/Questionnaires/CIMS_Language_Study_Module.java
d61dc831a0a569fc5f4dc2290587c67557f566fb
[]
no_license
atulsapa/CIMS
25e0435c27325762fcd9a9f05aadd7bc5c88733e
5d306703990c4b632f5e3a597dc40b76f043f9d5
refs/heads/master
2021-01-20T18:36:14.097911
2016-08-03T16:26:56
2016-08-03T16:26:56
63,275,735
0
0
null
null
null
null
UTF-8
Java
false
false
16,768
java
package CIMS.Modules.Questionnaires; import java.awt.AWTException; import java.awt.Robot; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; import java.util.concurrent.TimeUnit; import listner.ErrorUtil; import org.apache.commons.lang3.RandomStringUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.testng.ITestResult; import org.testng.Reporter; import CIMS.CIMS_MainProject; import util.UtilFunction; public class CIMS_Language_Study_Module { private static final String Counter = null; private WebDriver webdriver; // Will be Provide by Calling Class. private UtilFunction utilfunc; // Will be Provide by Calling Class. //Veriables------------- public static String ErrorMessage=""; public static String ErrorMessage1=""; public static String ErrorMessage2=""; public static String URLwithID=""; public static String testcaseid=""; public static String scenerio=""; public static String description=""; //Constructor---------- public CIMS_Language_Study_Module(WebDriver driver,UtilFunction utilfunc) { this.webdriver =driver; this.utilfunc=utilfunc; // TODO Auto-generated constructor stub } public boolean Language_Study_info(int ColumnCounter,String mode) throws AWTException, InterruptedException { //Excel sheet Data collection String TestcaseID=UtilFunction.getCellData("Test Data.xls", "Language_Study", 0, ColumnCounter); String Language_StudyScenerio=UtilFunction.getCellData("Test Data.xls", "Language_Study", 2, ColumnCounter); String Language_StudyTestcaseDescription=UtilFunction.getCellData("Test Data.xls", "Language_Study", 3, ColumnCounter); String Language_StudyPageURL=UtilFunction.getCellData("Test Data.xls", "Language_Study", 4, ColumnCounter); String Language_StudyID=UtilFunction.getCellData("Test Data.xls", "Language_Study", 5, ColumnCounter); String LanguageName=UtilFunction.getCellData("Test Data.xls", "Language_Study", 6, ColumnCounter); String School=UtilFunction.getCellData("Test Data.xls", "Language_Study", 7, ColumnCounter); String StudyCity=UtilFunction.getCellData("Test Data.xls", "Language_Study", 8, ColumnCounter); String StudyCountry=UtilFunction.getCellData("Test Data.xls", "Language_Study", 9, ColumnCounter); String Course=UtilFunction.getCellData("Test Data.xls", "Language_Study", 10, ColumnCounter); String Grade=UtilFunction.getCellData("Test Data.xls", "Language_Study", 11, ColumnCounter); String DatesStudyfrom=UtilFunction.getCellData("Test Data.xls", "Language_Study", 12, ColumnCounter); String DatesStudyTo=UtilFunction.getCellData("Test Data.xls", "Language_Study", 13, ColumnCounter); String StudyYears=UtilFunction.getCellData("Test Data.xls", "Language_Study", 14, ColumnCounter); String StudyHours=UtilFunction.getCellData("Test Data.xls", "Language_Study", 15, ColumnCounter); String Fileupload=UtilFunction.getCellData("Test Data.xls", "Language_Study", 16, ColumnCounter); String ExpectedErrorMessage=UtilFunction.getCellData("Test Data.xls", "Language_Study", 17, ColumnCounter); String showbuttonxpath=".//*[@id='btnShowDocUpload']"; String uploadbuttonxpath=".//*[@id='DocUploadModal']//*[@class='modal-body']//button"; String fileuploadpath=""; if(CIMS_MainProject.os.contains("Linux")){ fileuploadpath=System.getProperty("user.dir")+"/testuploadsheet.xlsx"; }else if(CIMS_MainProject.os.contains("Windows")){ fileuploadpath="c:\\JavaWorkspace\\testuploadsheet.xlsx"; } String fileuploadbutton=".//*[@id='btnUploadDocuments']"; String addditionalinfoxpath=".//*[@class='form-horizontal']//*[@class='control-group']//../h4//../div[xx]//*[@id]"; String addditionalinfocounterxpath=".//*[@class='form-horizontal']//*[@class='control-group']//../h4//../div//*[@id]"; String Language_Study_attributeFiledXpath=".//*[@class='question-group']//*[@class='control-group'][xx]//*[@id]"; String Language_StudyCounterXpath=".//*[@class='question-group']//*[@class='control-group']//*[@id]"; String DatesofStudyfrom=".//*[@class='control-group field-group-inline']//*[@class='controls'][1]//*[@id]"; String DatesofStudyTo=".//*[@class='control-group field-group-inline']//*[@class='controls'][2]//*[@id]"; /////////////////////////////////URL FETCH/////////////////////////////////// String QuestionarieName="Language Study"; //String URLwithID=UtilFunction.geturl(QuestionarieName); URLwithID=utilfunc.geturldirect(QuestionarieName); boolean Flag =false; testcaseid=TestcaseID; scenerio=Language_StudyScenerio; description=Language_StudyTestcaseDescription; String ACTION="New"; String ACTION1="Edit"; String ACTION2="Delete"; if(URLwithID.equals("")){ utilfunc.closesidebar(); Flag=false; }else{ if(mode.equals(ACTION)){ try{ /*String Language_StudyURLwithID=Language_StudyPageURL+Language_StudyID; utilfunc.NavigatetoURL(Language_StudyURLwithID);*/ utilfunc.NavigatetoURL(URLwithID); Thread.sleep(5000); utilfunc.ServerErrorHandler(); String AddbuttonXpath="//*[@class='btn']"; try { utilfunc.MakeElement(AddbuttonXpath).click(); webdriver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS); } catch (Exception e1) { } int ObjCount=utilfunc.GetObjectCount(Language_StudyCounterXpath); for(int count=1; count<=ObjCount; count++) { String NewXpath=Language_Study_attributeFiledXpath.replace("xx", Integer.toString(count)); try{ String AttributeName=utilfunc.MakeElement(NewXpath).getAttribute("id"); System.out.println("Attribute name "+count+"is : "+AttributeName); if(AttributeName.equals("LanguageName")){ try { utilfunc.MakeElement(NewXpath).sendKeys(LanguageName); } catch (Exception e) { } } else if(AttributeName.equals("School")){ try { utilfunc.MakeElement(NewXpath).sendKeys(School); } catch (Exception e) { } } else if(AttributeName.equals("StudyCity")){ String newpath1=NewXpath.replace("//*[@id]", "//*[@class='controls'][1]//*[@id]"); String newpath2=NewXpath.replace("//*[@id]", "//*[@class='controls'][2]//*[@id]"); try { utilfunc.MakeElement(newpath1).sendKeys(StudyCity); } catch (Exception e) { } try { Thread.sleep(1000); utilfunc.Selectdropdownvaluebyvalue(newpath2, StudyCountry); } catch (Exception e) { } } else if(AttributeName.equals("Course")){ try { utilfunc.MakeElement(NewXpath).sendKeys(Course); } catch (Exception e) { } } else if(AttributeName.equals("Grade")){ try { utilfunc.MakeElement(NewXpath).sendKeys(Grade); } catch (Exception e) { } } else if(AttributeName.equals("StudyYears")){ try { utilfunc.MakeElement(NewXpath).sendKeys(StudyYears); } catch (Exception e) { } } else if(AttributeName.equals("StudyHours")){ try { utilfunc.MakeElement(NewXpath).sendKeys(StudyHours); } catch (Exception e) { } } else if(AttributeName.contains("LanguageStudyDocumentId")){ if(Fileupload.equals("Yes")){ try { Thread.sleep(1000); utilfunc.MakeElement(showbuttonxpath).click(); } catch (Exception e) { } try { Thread.sleep(2000); utilfunc.MakeElement(uploadbuttonxpath).click(); Thread.sleep(1000); } catch (Exception e) { } try { utilfunc.uploadfile(fileuploadpath); } catch (Exception e) { } Thread.sleep(5000); try { utilfunc.MakeElement(fileuploadbutton).click(); } catch (Exception e) { } } } }catch(Exception e){ } } ////////////////////////DatesofStudy////////////////////////////////////// try{ utilfunc.MakeElement(DatesofStudyfrom).clear(); utilfunc.MakeElement(DatesofStudyTo).clear(); utilfunc.MakeElement(DatesofStudyfrom).sendKeys(DatesStudyfrom); utilfunc.MakeElement(DatesofStudyTo).sendKeys(DatesStudyTo); }catch(Exception e){ } //////////////////////Additional info handle/////////////////////////////// try { Thread.sleep(1000); utilfunc.dynamic_data(addditionalinfocounterxpath, addditionalinfoxpath); } catch (Exception e) { } try { Thread.sleep(1000); utilfunc.savebutton(); } catch (Exception e) { } String error_flag=utilfunc.ErrorMessagehandlerExperiment(); if (error_flag.equals(ExpectedErrorMessage)){ Flag=true; utilfunc.TakeScreenshot(); }else if (error_flag.equals("")){ Flag=true; }else if(error_flag.equals("Server Error in '/' Application.")){ Flag=false; webdriver.navigate().back(); }else{ Flag=false; utilfunc.TakeScreenshot(); } }catch(Exception e){ utilfunc.NavigatetoURL(URLwithID); } }else if(mode.equals(ACTION1)){ try{ /* String Language_StudyURLwithID=Language_StudyPageURL+Language_StudyID; utilfunc.NavigatetoURL(Language_StudyURLwithID);*/ utilfunc.NavigatetoURL(URLwithID); utilfunc.ServerErrorHandler(); String EditbuttonXpath=".//*[@class='table table-item-list']//tr[1]//*[@class='icon-edit']"; utilfunc.MakeElement(EditbuttonXpath).click(); webdriver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS); int ObjCount=utilfunc.GetObjectCount(Language_StudyCounterXpath); for(int count=1; count<=ObjCount; count++) { String NewXpath=Language_Study_attributeFiledXpath.replace("xx", Integer.toString(count)); try{ String AttributeName=utilfunc.MakeElement(NewXpath).getAttribute("id"); System.out.println("Attribute name "+count+"is : "+AttributeName); if(AttributeName.equals("LanguageName")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(LanguageName); } catch (Exception e) { } } else if(AttributeName.equals("School")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(School); } catch (Exception e) { } } else if(AttributeName.equals("StudyCity")){ String newpath1=NewXpath.replace("//*[@id]", "//*[@class='controls'][1]//*[@id]"); String newpath2=NewXpath.replace("//*[@id]", "//*[@class='controls'][2]//*[@id]"); utilfunc.MakeElement(newpath1).clear(); try { utilfunc.MakeElement(newpath1).sendKeys(StudyCity); } catch (Exception e) { } try { utilfunc.Selectdropdownvaluebyvalue(newpath2, StudyCountry); } catch (Exception e) { } } else if(AttributeName.equals("Course")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(Course); } catch (Exception e) { } } else if(AttributeName.equals("Grade")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(Grade); } catch (Exception e) { } } else if(AttributeName.equals("StudyYears")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(StudyYears); } catch (Exception e) { } } else if(AttributeName.equals("StudyHours")){ utilfunc.MakeElement(NewXpath).clear(); try { utilfunc.MakeElement(NewXpath).sendKeys(StudyHours); } catch (Exception e) { } } else if(AttributeName.contains("LanguageStudyDocumentId")){ if(Fileupload.equals("Yes")){ try { Thread.sleep(1000); utilfunc.MakeElement(showbuttonxpath).click(); } catch (Exception e) { } Thread.sleep(2000); try { utilfunc.MakeElement(uploadbuttonxpath).click(); } catch (Exception e) { } Thread.sleep(1000); try { utilfunc.uploadfile(fileuploadpath); } catch (Exception e) { } Thread.sleep(5000); try { utilfunc.MakeElement(fileuploadbutton).click(); } catch (Exception e) { } } } }catch(Exception e){ } } ////////////////////////DatesofStudy////////////////////////////////////// try{ utilfunc.MakeElement(DatesofStudyfrom).clear(); utilfunc.MakeElement(DatesofStudyTo).clear(); utilfunc.MakeElement(DatesofStudyfrom).sendKeys(DatesStudyfrom); utilfunc.MakeElement(DatesofStudyTo).sendKeys(DatesStudyTo); }catch(Exception e){ } //////////////////////Additional info handle/////////////////////////////// try { Thread.sleep(1000); utilfunc.dynamic_data(addditionalinfocounterxpath, addditionalinfoxpath); } catch (Exception e) { } try { Thread.sleep(1000); utilfunc.savebutton(); } catch (Exception e) { } String error_flag=utilfunc.ErrorMessagehandlerExperiment(); if (error_flag.equals(ExpectedErrorMessage)){ Flag=true; utilfunc.TakeScreenshot(); }else if (error_flag.equals("")){ Flag=true; }else if(error_flag.equals("Server Error in '/' Application.")){ Flag=false; webdriver.navigate().back(); }else{ Flag=false; utilfunc.TakeScreenshot(); } }catch(Exception e){ utilfunc.ErrorMessage=""; utilfunc.ErrorMessage1=""; utilfunc.ErrorMessage4=""; utilfunc.ErrorMessage5=""; utilfunc.ErrorMessage2="No Records Found to Edit"; Flag=false; utilfunc.TakeScreenshot(); utilfunc.NavigatetoURL(URLwithID); } }else if(mode.equals(ACTION2)){ try{ /*String Language_StudyURLwithID=Language_StudyPageURL+Language_StudyID; utilfunc.NavigatetoURL(Language_StudyURLwithID);*/ utilfunc.ErrorMessage=""; utilfunc.ErrorMessage1=""; utilfunc.ErrorMessage4=""; utilfunc.ErrorMessage5=""; testcaseid="TC001"; scenerio="Positive"; description="Verify that If Click on Delete Button Expected Result-Successfully Deleted"; try { utilfunc.NavigatetoURL(URLwithID); utilfunc.ServerErrorHandler(); String DeletebuttonXpath=".//*[@class='table table-item-list']//tr[1]//*[@class='icon-trash']"; try { utilfunc.MakeElement(DeletebuttonXpath).click(); } catch (Exception e) { } Thread.sleep(10000); utilfunc.isAlertPresent(); boolean error_flag=utilfunc.ErrorMessagehandler(); if (error_flag){ Flag=true; }else{ Flag=false; } } catch (Exception e) { } }catch(Exception e){ utilfunc.ErrorMessage=""; utilfunc.ErrorMessage1=""; utilfunc.ErrorMessage4=""; utilfunc.ErrorMessage5=""; testcaseid="TC001"; scenerio="Positive"; description="Verify that If Click on Delete Button Expected Result-Successfully Deleted"; utilfunc.ErrorMessage2="No Records Found to Delete"; Flag=false; utilfunc.TakeScreenshot(); } } }///////////url ckeck end return Flag; } }
[ "atul@daxima.com" ]
atul@daxima.com
f83934e876699df9f47e5572db0984f35e72b80b
0c2421ece042eb7adbfca6f46a331f239e8bab69
/app/src/main/java/com/example/number_to_words_rabin_gurung/MainActivity.java
d2ff8710e36208c8ea056751e65da29e979fcf06
[]
no_license
rabinGurung/Number_To_WORDS_Rabin_Gurung
31fdbd43e7213e5ce3a6e8347f4ff32fc56b470f
d0ca5a9df355a99ce44ca64da9f1be5752520128
refs/heads/master
2020-05-09T10:30:15.860124
2019-04-12T16:28:00
2019-04-12T16:28:00
181,044,976
0
0
null
null
null
null
UTF-8
Java
false
false
1,152
java
package com.example.number_to_words_rabin_gurung; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.example.number_to_words_rabin_gurung.Presenter.Presenter; public class MainActivity extends AppCompatActivity { private Button btnsubmit; private TextView tv; private EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnsubmit =findViewById(R.id.btnsubmit); tv = findViewById(R.id.tv); et = findViewById(R.id.et); new Presenter(this, btnsubmit); } public Boolean CheckForInput(){ if(TextUtils.isEmpty(et.getText())){ et.setError("Please Enter Number"); return false; } return true; } public int getNumber(){ return Integer.parseInt(et.getText().toString()); } public void SetResult(String result){ tv.setText(result); } }
[ "leongurung029@gmail.com" ]
leongurung029@gmail.com
5522f7ddf7367d8bffda21d1df90ea47ccb9b6c9
3e50c1da4b7c2beb15bd1cc7d4396f06aa39548b
/HttpSessionServlet/src/com/ashutosh/AddServlet.java
7c08a521109e8e04b8a32d46e990c703816c37ef
[]
no_license
imashutoshchaudhary/Advance-Java-Servlet-and-JSP
747e40fb2c739ba73fab3793dee3da982e3b5074
65b036b24b69b7fabaae75994fd6fcfb37441c53
refs/heads/master
2022-07-21T10:54:39.033827
2019-08-22T05:25:31
2019-08-22T05:25:31
203,719,964
0
0
null
2022-06-21T01:43:09
2019-08-22T05:23:06
Java
UTF-8
Java
false
false
728
java
package com.ashutosh; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class AddServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { int i = Integer.parseInt(req.getParameter("num1")); int j = Integer.parseInt(req.getParameter("num2")); int k = i+j; HttpSession session = req.getSession(); session.setAttribute("k", k); res.sendRedirect("sq"); } }
[ "imashutoshchaudhary@gmail.com" ]
imashutoshchaudhary@gmail.com
0477d8adc8190991234d02be8c4565784c0ee965
7b4fb542ff108099b048338ee77267fdb771d838
/src/main/groovy/com/epages/dslimport/Address.java
4d878ebff78b6af46daf3da983c2bd816315b93e
[ "Apache-2.0" ]
permissive
otrosien/gradle-dslimport
7d5aa50d65c79c58f3ee2fc53674252531b18c92
6aa12f516a0d1a052c840898a6a6ee781c3fce4b
refs/heads/master
2021-01-21T13:34:16.472282
2016-05-09T09:23:01
2016-05-09T09:23:01
55,615,103
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package com.epages.dslimport; import org.gradle.model.Managed; @Managed interface Address { String getStreet(); void setStreet(String street); String getCity(); void setCity(String city); default Boolean isEmpty() { return Boolean.valueOf(getStreet() == null && getCity() == null); } }
[ "otrosien@epages.com" ]
otrosien@epages.com
8fda9a18688a7a4c36ddafd10de3662632cffbad
642694cc9555063edb2b9fd45fde994915a33234
/src/com/game/loot/VirtualGame.java
9a40cd9327edb0b982be8a874181d2d3932b7a94
[]
no_license
derekparham/Loot
eec6a0809669fa4d6dfa777be01576a9e8ba0345
cdcac787e2befbe33f22e705831eb532a73e83bb
refs/heads/master
2020-12-27T04:37:09.162512
2013-12-05T21:31:53
2013-12-05T21:31:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.game.loot; import java.util.ArrayList; import java.util.List; public class VirtualGame { public static void main(String[] args){ Player p1 = new VirtualPlayer("Henry"); Player p2 = new VirtualPlayer("Aseem"); List<Player> players = new ArrayList<Player>(); players.add(p1); players.add(p2); GameState gameState = new GameState(players); CardSet deck = CardSet.addFullDeck(); GamePlay gamePlay = new VirtualGamePlay(gameState, deck); LootEngine engine = new LootEngine(players, gamePlay, gameState); engine.play(); } }
[ "dparham@gmail.com" ]
dparham@gmail.com
e5837efbc0a2974e7dbf94f37dc582b89d668310
a8b664a15e0b969bd04c78102bbaee464449c778
/src/main/java/com/example/Beginnerproject/Alien.java
24f84e12c9fe57e8a1d8b2a92c29763e76ab08f8
[]
no_license
Neel12-coder/Spring-Basics
7113f70f87d49c8929eb22de07db6efea9b38852
24e47cf6bac90a0647a9bbd68badaf466cd4b2bf
refs/heads/main
2023-07-26T02:40:43.335717
2021-08-31T05:13:44
2021-08-31T05:13:44
401,361,474
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
package com.example.Beginnerproject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Component //means create obj of class Alien in Spring Container // @Scope(value = "prototype") // to create multiple objs public class Alien { private int aid; private String aname; private String tech; @Autowired //means inject dependency: Alien class has dependency of Laptop - search by type // @Qualifier("lapi1") //search by name lapi1 private Laptop laptop; public Alien(){ super(); System.out.println("object created"); } public int getAid() { return aid; } public void setAid(int aid) { this.aid = aid; } public String getAname() { return aname; } public void setAname(String aname) { this.aname = aname; } public String getTech() { return tech; } public void setTech(String tech) { this.tech = tech; } public void show(){ laptop.compile(); System.out.println("in show.."); } }
[ "somaineelam@gmail.com" ]
somaineelam@gmail.com
492f5e3300bee08b54a3d810aea3ab8aa39704d6
3d848a3ba3558b362c65c7b69c11fbb5e0b4ca02
/winnie-cart/src/main/java/com/winnie/cart/controller/CartController.java
f5f7fee1cccf285c4ee8048fe5b54cd6bfe9d202
[]
no_license
mmichael255/winnieshop
23a8e481676c8ba000236e488f46918479a84e33
9c214aabfc9ab345bf1aa2a4445caf6232a694c4
refs/heads/master
2022-12-03T20:12:07.180228
2020-02-28T02:44:20
2020-02-28T02:44:20
242,636,882
0
0
null
2022-11-16T12:25:16
2020-02-24T03:19:43
Java
UTF-8
Java
false
false
1,214
java
package com.winnie.cart.controller; import com.winnie.cart.pojo.Cart; import com.winnie.cart.service.CartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController public class CartController { @Autowired private CartService cartService; @PostMapping public ResponseEntity<Void> addCart(@RequestBody Cart cart){ cartService.addCart(cart); return ResponseEntity.status(HttpStatus.CREATED).build(); } @GetMapping("/list") public ResponseEntity<List<Cart>> queryCarts(){ List<Cart> carts = cartService.queryCarts(); return ResponseEntity.ok(carts); } @PostMapping("/list") public ResponseEntity<Void> addCarts(@RequestBody List<Cart> carts){ cartService.addCarts(carts); return ResponseEntity.status(HttpStatus.CREATED).build(); } }
[ "cby371@gmail.com" ]
cby371@gmail.com