blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
7507eadf9c6ebac2c7e6625798017ea8a5619b4f
d2984ba2b5ff607687aac9c65ccefa1bd6e41ede
/src/net/datenwerke/security/service/usermanager/UserManagerModule.java
1956447ff1885fe94e07d72be7c10c780571d946
[]
no_license
bireports/ReportServer
da979eaf472b3e199e6fbd52b3031f0e819bff14
0f9b9dca75136c2bfc20aa611ebbc7dc24cfde62
refs/heads/master
2020-04-18T10:18:56.181123
2019-01-25T00:45:14
2019-01-25T00:45:14
167,463,795
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
/* * ReportServer * Copyright (c) 2018 InfoFabrik GmbH * http://reportserver.net/ * * * This file is part of ReportServer. * * ReportServer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.datenwerke.security.service.usermanager; import net.datenwerke.security.service.genrights.usermanager.GenRightsUserManagerModule; import com.google.inject.AbstractModule; import com.google.inject.Scopes; /** * * */ public class UserManagerModule extends AbstractModule { public static String USER_PROPERTY_USER_LOCALE = "user:locale"; @Override protected void configure() { bind(UserManagerService.class).to(UserManagerServiceImpl.class).in(Scopes.SINGLETON); bind(UserPropertiesService.class).to(UserPropertiesServiceImpl.class); bind(UserManagerStartup.class).asEagerSingleton(); /* submodules */ install(new GenRightsUserManagerModule()); } }
[ "srbala@gmail.com" ]
srbala@gmail.com
7c481d896df3964fe735ee68d77070254cf8087c
7f61e625e3898bacc90140039873782866088df4
/src/main/java/br/com/froli/bookstore/models/Book.java
ba2d5fdd07c11f8cc374d7bf902338c917346416
[]
no_license
delley/bookstore
e0d2f36ddd07f92d9534e7ff1f6d9e6aafd534bd
aa2bb669a6c0d7105af979bee7e9e5299a14882f
refs/heads/master
2021-01-01T04:59:34.549366
2017-07-15T02:34:07
2017-07-15T02:34:07
97,287,205
0
0
null
null
null
null
UTF-8
Java
false
false
1,579
java
package br.com.froli.bookstore.models; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; @Entity public class Book { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String title; private String description; private int numberOfPages; private BigDecimal price; @ManyToMany private List<Author> authors; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getNumberOfPages() { return numberOfPages; } public void setNumberOfPages(int numberOfPages) { this.numberOfPages = numberOfPages; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public List<Author> getAuthors() { return authors; } public void add(Author author) { if (authors == null) { authors = new ArrayList<>(); } authors.add(author); } @Override public String toString() { return "Book [id=" + id + ", title=" + title + ", description=" + description + ", numberOfPages=" + numberOfPages + ", price=" + price + "]"; } }
[ "delley.fx@gmail.com" ]
delley.fx@gmail.com
f5d25255979fe951d576b998da9c7dfef66c4fb8
a65ac909fe0ae007e7e265c0e30d88169b427f7a
/app/src/main/java/com/digitaljalebi/searchmymasjid/MapsActivity.java
0a5fda104a8c8912bed819fd0a99dd1c70de5cfb
[]
no_license
dipesh-shah/SearchMyMasjid
2a2033a4cfe2110e00f93aec590938f939a81766
462629a56376d1875b003e9bb654d86efdcaa729
refs/heads/master
2021-01-21T08:05:25.977790
2017-08-31T02:37:56
2017-08-31T02:37:56
101,951,084
0
0
null
null
null
null
UTF-8
Java
false
false
37,897
java
package com.digitaljalebi.searchmymasjid; import android.Manifest; import android.app.Activity; import android.app.ProgressDialog; import android.app.TimePickerDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender; import android.content.pm.PackageManager; import android.location.Location; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.NavigationView; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.widget.TimePicker; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyLog; import com.android.volley.error.VolleyError; import com.android.volley.request.JsonArrayRequest; import com.bluelinelabs.logansquare.LoganSquare; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.location.LocationSettingsRequest; import com.google.android.gms.location.LocationSettingsResult; import com.google.android.gms.location.LocationSettingsStates; import com.google.android.gms.location.LocationSettingsStatusCodes; import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.Places; import com.google.android.gms.location.places.ui.PlaceAutocomplete; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import org.json.JSONArray; import java.io.IOException; import java.math.RoundingMode; import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import static com.google.android.gms.location.LocationServices.FusedLocationApi; public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("HH:mm"); private final int PERMISSION_REQUEST_CODE = 1345; private final int PLACE_AUTOCOMPLETE_REQUEST_CODE = 1346; private GoogleMap mMap; private GoogleApiClient mGoogleApiClient; private Location mCurrentLocation; private List<MasjidsModel> mData; private TextView mName; private TextView mDistance; private TextView mTime1; private TextView mTime2; private TextView mTime3; private TextView mTime4; private TextView mTime5; private TextView mTime6; private TextView mAmpm1; private TextView mAmpm2; private TextView mAmpm3; private TextView mAmpm4; private TextView mAmpm5; private TextView mAmpm6; private ProgressDialog pDialog; private Button mRoute; private Button mMore; private int mCurrentSelected = 0; private CameraPosition mCameraPosition; protected static final int REQUEST_CHECK_SETTINGS = 0x1; private TextView mLocationSearch; private Location mSelectedLocation; private boolean mLocationRequestForResult = false; private NavigationView mNavView; private DrawerLayout mDrawerLayout; private AlertDialog mAlertDialog; private String[] timing = new String[6]; private TimePickerDialog mTimePickerDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(R.string.app_name); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); pDialog = new ProgressDialog(this); findViewById(R.id.btn_update_timings).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mData == null || mData.size() == 0) { Toast.makeText(MapsActivity.this, "No masjid data found!", Toast.LENGTH_LONG).show(); return; } // show dialog if (mAlertDialog != null && mAlertDialog.isShowing()) { return; } mAlertDialog = getAlertDialog(MapsActivity.this, mData.get(mCurrentSelected)); mAlertDialog.show(); } }); mName = (TextView) findViewById(R.id.masjid_name); mDistance = (TextView) findViewById(R.id.distance); mTime1 = (TextView) findViewById(R.id.time1); mTime2 = (TextView) findViewById(R.id.time2); mTime3 = (TextView) findViewById(R.id.time3); mTime4 = (TextView) findViewById(R.id.time4); mTime5 = (TextView) findViewById(R.id.time5); mTime6 = (TextView) findViewById(R.id.time6); mAmpm1 = (TextView) findViewById(R.id.ampm1); mAmpm2 = (TextView) findViewById(R.id.ampm2); mAmpm3 = (TextView) findViewById(R.id.ampm3); mAmpm4 = (TextView) findViewById(R.id.ampm4); mAmpm5 = (TextView) findViewById(R.id.ampm5); mAmpm6 = (TextView) findViewById(R.id.ampm6); mMore = (Button) findViewById(R.id.more); mNavView = (NavigationView) findViewById(R.id.navgiation_view); mLocationSearch = (TextView) findViewById(R.id.place_autocomplete); mLocationSearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AutocompleteFilter typeFilter = new AutocompleteFilter.Builder() .setTypeFilter(AutocompleteFilter.TYPE_FILTER_ADDRESS) .build(); try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .setFilter(typeFilter) .setBoundsBias(new LatLngBounds( new LatLng(12.58, 77.34), new LatLng(12.79, 77.58))) .build(MapsActivity.this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException e) { // TODO: Handle the error. } catch (GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } } }); mMore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mCurrentLocation != null) { Intent intent = new Intent(MapsActivity.this, CityActivity.class); startActivity(intent); } else { Toast.makeText(MapsActivity.this, "Location not available. Please try again after sometime.", Toast.LENGTH_LONG).show(); } } }); ImageButton currentLocation = (ImageButton) findViewById(R.id.current_location); currentLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mSelectedLocation != null) { mSelectedLocation = mCurrentLocation; mLocationSearch.setText(getString(R.string.search_location)); updateMapLocations(mCurrentLocation); } else { updateCameraPosition(); } } }); mRoute = (Button) findViewById(R.id.route); mRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mData == null || mData.size() == 0) { return; } MasjidsModel model = mData.get(mCurrentSelected); Location location = mCurrentLocation; if (mSelectedLocation != null) { location = mSelectedLocation; } String uri = "http://maps.google.com/maps?f=d&hl=en&saddr=" + location.getLatitude() + "," + location.getLongitude() + "&daddr=" + model.geometry.location.lat + "," + model.geometry.location.lng; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); } }); // Create an instance of GoogleAPIClient. if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .addApi(Places.GEO_DATA_API) .addApi(Places.PLACE_DETECTION_API) .build(); mGoogleApiClient.connect(); } // Initializing Drawer Layout and ActionBarToggle mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.app_name, R.string.app_name) { @Override public void onDrawerClosed(View drawerView) { // Code here will be triggered once the drawer closes as we dont want anything to happen so we leave this blank super.onDrawerClosed(drawerView); } @Override public void onDrawerOpened(View drawerView) { // Code here will be triggered once the drawer open as we dont want anything to happen so we leave this blank super.onDrawerOpened(drawerView); } }; //Setting the actionbarToggle to drawer layout mDrawerLayout.addDrawerListener(actionBarDrawerToggle); //calling sync state is necessay or else your hamburger icon wont show up actionBarDrawerToggle.syncState(); mNavView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { onItemSelected(item); mDrawerLayout.closeDrawers(); return true; } }); } private void onItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about_us: showAboutUs(); break; case R.id.rate_us: showRatingDialog(this); break; case R.id.share: shareApp(); break; } } private void shareApp() { try { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, "Search my masjid"); String sAux = "\nLet me recommend you this application\n\n"; sAux = sAux + "https://play.google.com/store/apps/details?id=com.digitaljalebi.searchmymasjid \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(Intent.createChooser(i, "Send it to a friend")); } catch(Exception e) { } } private void showAboutUs() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle("Digital Jalebi"); dialogBuilder.setMessage("Digital Jalebi is a young and multidisciplinary team of Interaction Designers, New Media Artists, Programmers, Computer and Electronics Engineers, Animators and Game Designers who work together to create memorable interactive experiences.\n" + "We are based in India but cater to our clients throughout the world.\n\n" + "To add your city contact us:\n" + " searchmymasjid@gmail.com\n"); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); mAlertDialog = dialogBuilder.create(); mAlertDialog.show(); } private void checkForLocation() { LocationRequest mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(10000); mLocationRequest.setFastestInterval(5000); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder() .addLocationRequest(mLocationRequest).setAlwaysShow(true); PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build()); result.setResultCallback(new ResultCallback<LocationSettingsResult>() { @Override public void onResult(LocationSettingsResult locationSettingsResult) { final Status status = locationSettingsResult.getStatus(); final LocationSettingsStates LS_state = locationSettingsResult.getLocationSettingsStates(); switch (status.getStatusCode()) { case LocationSettingsStatusCodes.SUCCESS: // All location settings are satisfied. The client can initialize location // requests here. mGoogleApiClient.connect(); break; case LocationSettingsStatusCodes.RESOLUTION_REQUIRED: // Location settings are not satisfied. But could be fixed by showing the user // a dialog. try { // Show the dialog by calling startResolutionForResult(), // and check the result in onActivityResult(). status.startResolutionForResult(MapsActivity.this, REQUEST_CHECK_SETTINGS); } catch (IntentSender.SendIntentException e) { // Ignore the error. } break; case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE: // Location settings are not satisfied. However, we have no way to fix the // settings so we won't show the dialog. break; } } }); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { int tag = (int) marker.getTag(); mCurrentSelected = Integer.valueOf(tag); if (mCurrentSelected >= 0) { updateSelectedMasjidData(mData.get(mCurrentSelected)); } return false; } }); updateMapLocations(mCurrentLocation); } @Override public void onResume() { super.onResume(); if (mSelectedLocation == null) { checkForLocation(); } } @Override public void onConnected(@Nullable Bundle bundle) { if (areAllPermissionsGranted()) { getUpdatedLocation(); updateMapLocations(mCurrentLocation); } } private void updateMapLocations(Location location) { updateCurrentLocationOnMap(location); makeRequestForSearch(location); } private boolean areAllPermissionsGranted() { int fineLocationCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION); int approxLocationCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION); if (fineLocationCheck != PackageManager.PERMISSION_GRANTED) { if (approxLocationCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_REQUEST_CODE); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_REQUEST_CODE); } } else if (approxLocationCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_REQUEST_CODE); } else { return true; } return false; } private void getUpdatedLocation() { try { mCurrentLocation = FusedLocationApi.getLastLocation(mGoogleApiClient); mSelectedLocation = mCurrentLocation; } catch (SecurityException e) { } } private void updateCurrentLocationOnMap(Location location) { if (location != null) { if (mMap != null) { mMap.clear(); BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.current_location_marker); LatLng currentLocation = new LatLng(location.getLatitude(), location.getLongitude()); mCameraPosition = new CameraPosition.Builder() .target(currentLocation) .zoom(15).build(); mMap.addMarker(new MarkerOptions().position(currentLocation).title(getString(R.string.current_location)).icon(icon).snippet("current location")).setTag(-1); //Zoom in and animate the camera. mMap.animateCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition)); // make volley request. } } } private void updateCameraPosition() { if (mMap != null) { if (mCurrentLocation != null) { mMap.animateCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition)); } } } @Override public void onConnectionSuspended(int i) { } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } protected void onStart() { mGoogleApiClient.connect(); super.onStart(); } protected void onStop() { if (!mLocationRequestForResult) { mGoogleApiClient.disconnect(); } super.onStop(); } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case PERMISSION_REQUEST_CODE: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { try { mCurrentLocation = FusedLocationApi.getLastLocation(mGoogleApiClient); updateMapLocations(mCurrentLocation); } catch (SecurityException e) { //handle permission denied case } } else { // permission denied, boo! Disable the // functionality that depends on this permission. } return; } default: { // don't know what to do } } } private void makeRequestForSearch(Location location) { if (location == null) { return; } pDialog.setMessage("Loading..."); pDialog.show(); String url = "http://ec2-18-220-53-7.us-east-2.compute.amazonaws.com/nearestmosques?location=" + location.getLatitude() + "," + location.getLongitude() + "&" + "count?=3"; JsonArrayRequest jsonObjReq = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d(MapsActivity.class.getSimpleName(), response.toString()); pDialog.dismiss(); try { List<MasjidsModel> data = LoganSquare.parseList(response.toString(), MasjidsModel.class); Log.d(MapsActivity.class.getSimpleName(), "" + data.size()); updateUi(data); } catch (IOException e) { } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(MapsActivity.class.getSimpleName(), "Error: " + error.getMessage()); // hide the progress dialog pDialog.dismiss(); } }); jsonObjReq.setShouldCache(false); SearchApplication.sInstance.getRequestQueue().add(jsonObjReq); } private void updateUi(List<MasjidsModel> data) { if (mSelectedLocation != null) { mData = data; int i = 0; NumberFormat formatter = NumberFormat.getInstance(Locale.US); formatter.setMaximumFractionDigits(2); formatter.setMinimumFractionDigits(2); formatter.setRoundingMode(RoundingMode.HALF_UP); BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.masjid_marker); MasjidsModel minDistanceModel = null; for (MasjidsModel model : data) { LatLng location = new LatLng(model.geometry.location.lat, model.geometry.location.lng); mMap.addMarker(new MarkerOptions().position(location).title(model.name).icon(icon).snippet(getNextNamazTiming(model))).setTag(i); float[] results = new float[1]; if (mSelectedLocation != null) { Location.distanceBetween(mSelectedLocation.getLatitude(), mSelectedLocation.getLongitude(), model.geometry.location.lat, model.geometry.location.lng, results); } else if (mCurrentLocation != null) { Location.distanceBetween(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude(), model.geometry.location.lat, model.geometry.location.lng, results); } Location mosqueLocation = new Location(""); mosqueLocation.setLatitude(model.geometry.location.lat); mosqueLocation.setLongitude(model.geometry.location.lng); String value = formatter.format(mSelectedLocation.distanceTo(mosqueLocation) / 1000); String[] splitValue = value.split(","); value = ""; for (String v : splitValue) { value += v; } model.distanceFromCurrentLocation = Float.valueOf(value); if (i == 0) { minDistanceModel = model; mCurrentSelected = i; } i++; } icon = BitmapDescriptorFactory.fromResource(R.mipmap.current_selected_marker); if (minDistanceModel != null) { updateSelectedMasjidData(minDistanceModel); LatLng location = new LatLng(minDistanceModel.geometry.location.lat, minDistanceModel.geometry.location.lng); mMap.addMarker(new MarkerOptions().position(location).title(minDistanceModel.name).icon(icon).snippet(getNextNamazTiming(minDistanceModel))).setTag(mCurrentSelected); } } } private String getNextNamazTiming(MasjidsModel model) { Calendar calendar = Calendar.getInstance(); int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); if (model.timings != null && model.timings.length > 0) { for (String timing : model.timings) { if (!TextUtils.isEmpty(timing)) { try { Date date = SIMPLE_DATE_FORMAT.parse(timing); calendar.setTime(date); int hour = calendar.get(Calendar.HOUR_OF_DAY); if (hour >= hourOfDay) { return timing; } } catch (ParseException e) { e.printStackTrace(); } } } } return getString(R.string.no_timing_available); } private void updateSelectedMasjidData(MasjidsModel model) { mName.setText(model.name); String na = "n/a"; if (model.timings != null) { Utils.populateMasjidDisplayTimings(model); for (int i=0; i<6; i++) { setTimeText(i, model.displayTimings[i], model.amPmArray[i]); } } else { for (int i=0; i<6; i++) { setTimeText(i, "n/a", "n/a"); } } mDistance.setText(String.format(getString(R.string.distance_value), model.distanceFromCurrentLocation)); } private void setTimeText(int timeSlot, String timing, String ampm) { switch (timeSlot) { case 0: mTime1.setText(timing); mAmpm1.setText(ampm); break; case 1: mTime2.setText(timing); mAmpm2.setText(ampm); break; case 2: mTime3.setText(timing); mAmpm3.setText(ampm); break; case 3: mTime4.setText(timing); mAmpm4.setText(ampm); break; case 4: mTime5.setText(timing); mAmpm5.setText(ampm); break; case 5: mTime6.setText(timing); mAmpm6.setText(ampm); break; } } public void onDestroy() { if (pDialog != null && pDialog.isShowing()) { pDialog.dismiss(); } if (mTimePickerDialog != null && mTimePickerDialog.isShowing()) { mTimePickerDialog.dismiss(); } if (mAlertDialog != null && mAlertDialog.isShowing()) { mAlertDialog.dismiss(); } super.onDestroy(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { final LocationSettingsStates states = LocationSettingsStates.fromIntent(data); switch (requestCode) { case REQUEST_CHECK_SETTINGS: switch (resultCode) { case Activity.RESULT_OK: mGoogleApiClient.disconnect(); mGoogleApiClient.connect(); mLocationRequestForResult = true; new Handler().postDelayed(new Runnable() { @Override public void run() { mLocationRequestForResult = false; getUpdatedLocation(); updateMapLocations(mCurrentLocation); } }, 2000); // All required changes were successfully made //GetUserLocation();//FINALLY YOUR OWN METHOD TO GET YOUR USER LOCATION HERE break; case Activity.RESULT_CANCELED: // The user was asked to change settings, but chose not to Toast.makeText(this, "Location information not available!", Toast.LENGTH_LONG).show(); break; default: break; } break; case PLACE_AUTOCOMPLETE_REQUEST_CODE: { if (resultCode == RESULT_OK) { Place place = PlaceAutocomplete.getPlace(this, data); mLocationSearch.setText(place.getName()); mSelectedLocation = new Location(""); mSelectedLocation.setLatitude(place.getLatLng().latitude); mSelectedLocation.setLongitude(place.getLatLng().longitude); updateMapLocations(mSelectedLocation); } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) { Status status = PlaceAutocomplete.getStatus(this, data); Log.i(MapsActivity.class.getSimpleName(), status.getStatusMessage()); } else if (resultCode == RESULT_CANCELED) { // The user canceled the operation. } } } } private void showRatingDialog(final Activity context) { AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle("Rate application") .setMessage("If you want to give us feedback, do rate our app.") .setPositiveButton("RATE", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (context != null && !context.isFinishing()) { String link = "market://details?id="; try { // play market available context.getPackageManager() .getPackageInfo("com.digitaljalebi.searchmymasjid", 0); // not available } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); // should use browser link = "https://play.google.com/store/apps/details?id="; } // starts external action context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link + context.getPackageName()))); } dialog.dismiss(); } }) .setNegativeButton("CANCEL", null); builder.show(); } public AlertDialog getAlertDialog(final Context context, final MasjidsModel model) { timing = new String[6]; AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); LayoutInflater inflater = LayoutInflater.from(context); View dialogView = inflater.inflate(R.layout.alertdialog_layout, null); dialogBuilder.setView(dialogView); Button mTime1 = (Button) dialogView.findViewById(R.id.spinner_time1); mTime1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showTimePickerDialog(context, v, 0); } }); Button mTime2 = (Button) dialogView.findViewById(R.id.spinner_time2); mTime2.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { showTimePickerDialog(context, v, 1); } }); Button mTime3 = (Button) dialogView.findViewById(R.id.spinner_time3); mTime3.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { showTimePickerDialog(context, v, 2); } }); Button mTime4 = (Button) dialogView.findViewById(R.id.spinner_time4); mTime4.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { showTimePickerDialog(context, v, 3); } }); Button mTime5 = (Button) dialogView.findViewById(R.id.spinner_time5); mTime5.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { showTimePickerDialog(context, v, 4); } }); Button mTime6 = (Button) dialogView.findViewById(R.id.spinner_time6); mTime6.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { showTimePickerDialog(context, v, 5); } }); if (model.timings != null) { Utils.populateMasjidDisplayTimings(model); mTime1.setText(model.displayTimings[0]+ " " + model.amPmArray[0]); mTime2.setText(model.displayTimings[1]+ " " + model.amPmArray[1]); mTime3.setText(model.displayTimings[2]+ " " + model.amPmArray[2]); mTime4.setText(model.displayTimings[3]+ " " + model.amPmArray[3]); mTime5.setText(model.displayTimings[4]+ " " + model.amPmArray[4]); mTime6.setText(model.displayTimings[5]+ " " + model.amPmArray[5]); } AlertDialog alertDialog = dialogBuilder.create(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(alertDialog.getWindow().getAttributes()); lp.height = WindowManager.LayoutParams.WRAP_CONTENT; alertDialog.getWindow().setAttributes(lp); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Save", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { model.timings = timing; model.saveTimings(); dialog.dismiss(); // make a call to udpate the timings } }); alertDialog.setTitle(model.name); return alertDialog; } private void showTimePickerDialog(Context context, final View v, final int position) { if (mTimePickerDialog != null && mTimePickerDialog.isShowing()) { return; } Calendar mcurrentTime = Calendar.getInstance(); int hour = mcurrentTime.get(Calendar.HOUR); int minute = mcurrentTime.get(Calendar.MINUTE); mTimePickerDialog = new TimePickerDialog(context, new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) { timing[position] = selectedHour + ":" + (selectedMinute < 10 ? "0" + selectedMinute : selectedMinute); ((Button)v).setText((selectedHour <=12 ? selectedHour : selectedHour - 12) + ":" + (selectedMinute < 10 ? "0" + selectedMinute : selectedMinute)+ " " + (selectedHour >=12 ? "PM" : "AM")); } }, hour, minute, false);//Yes 24 hour time mTimePickerDialog.setTitle("Select Time"); mTimePickerDialog.show(); } }
[ "dipesh.shah@practo.com" ]
dipesh.shah@practo.com
472abbb75f73980c3c6e3eefe4114d5403e107c1
18a61694dd83ef06906e7c18bc6ed57fc0d0b2c5
/JavaLiang/src/Loops/Millis.java
7bfb7b8d7b0a9d2301931591834e69ebd18bd403
[]
no_license
XIAOLONGLII/Java-Liang-10th-Practice
ca357256a028e97c124e4951f9a548d2a61723e9
bfa350af6f78979a566dd338974fffcd31ce3fa9
refs/heads/master
2022-03-28T21:05:40.661527
2020-01-23T20:52:00
2020-01-23T20:52:00
116,670,964
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package Loops; public class Millis { public static String convertMillis(long millis) { long seconds = millis / 1000; long minutes = seconds / 60; long hours = minutes / 60; //System.out.println("Seconds is " + seconds); String s = Integer.toString((int) seconds); String m = Integer.toString((int) minutes); String h = Integer.toString((int) hours); //System.out.println("Seconds IS " + seconds); String st = ""; if( seconds < 60) { seconds = millis / 1000; minutes = 0; hours = 0; st = "0:0:" + s; } else if( seconds > 60 && seconds < 3600) { minutes = seconds / 60; seconds = seconds % 60; hours = 0; st = "0:" + minutes+ ":" + seconds; } else { hours = seconds / 3600; if((seconds % 3600) >= 60) { minutes = (seconds % 3600) / 60; seconds = (seconds % 3600) % 60; st = h + ":" + minutes + ":" + seconds; } else { minutes = 0; seconds = seconds % 3600; st = h + ":0" + ":" + s; } } //System.out.println("S is " + s); return st; } public static void main(String[] args) { System.out.println(convertMillis(5500)); System.out.println(convertMillis(100000)); System.out.println(convertMillis(555550000)); } }
[ "Your Actual Email" ]
Your Actual Email
fc8baa8002760d0debf532fed7740bf2d1c334f3
d12fa5e7c6cb321666b9f9690b01a1ea5d0b1daf
/app/QRCode/CreateQR.java
764af53aa9da13ec1ee7649194ff4ac25ec967f7
[]
no_license
AlefEmannuel/siteQRFrequency
2694c2c994bcc6f9684a6c68bd27ee2aab9fac49
a7f0bf4ca5a55db36548f571e13b250e3a6d0db8
refs/heads/master
2020-06-15T23:27:38.334396
2019-07-05T14:48:19
2019-07-05T14:48:19
195,420,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package QRCode; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import play.db.jpa.Blob; public class CreateQR{ public static Blob generateQrCodeBlob(String conteudo) { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); String charset = "UTF-8"; String qrCodeData = conteudo; Map < EncodeHintType, ErrorCorrectionLevel > hintMap = new HashMap < EncodeHintType, ErrorCorrectionLevel > (); hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); BitMatrix matrix = new MultiFormatWriter().encode( new String(qrCodeData.getBytes(charset), charset), BarcodeFormat.QR_CODE, 400, 400, hintMap); MatrixToImageWriter.writeToStream(matrix, "PNG", stream); Blob qrCodeBlob = null; InputStream is = new ByteArrayInputStream(stream.toByteArray()); qrCodeBlob = new Blob(); qrCodeBlob.set(is, "PNG"); return qrCodeBlob; } catch (IOException | WriterException e) { // Given that this operation is entirely in memory, any such exceptions are indicative of bad input. throw new IllegalArgumentException("Invalid URI", e); } } }
[ "alefemannuelifrn@gmail.com" ]
alefemannuelifrn@gmail.com
31316718116683f2be15331e3c159616ff7c56bf
fef6598313fbfa0948d74dda87b2523e3abc7418
/developing/FindLover-AppEngine/src/com/vmcop/simplethird/findlover/ProfileInfoEndpoint.java
7697d7577239ece4e3fe5a350b27849c800e04bb
[]
no_license
aslongassun/resource-code
f547ca6b6a5fdb20879483e3b379d1a781a866eb
a2dff01233a89e93ab68702c99fbc6ecd91c0a39
refs/heads/master
2016-09-16T00:02:32.501765
2015-11-13T11:13:06
2015-11-13T11:13:06
37,507,519
0
0
null
null
null
null
UTF-8
Java
false
false
6,153
java
package com.vmcop.simplethird.findlover; import com.vmcop.simplethird.findlover.EMF; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import com.google.api.server.spi.response.CollectionResponse; import com.google.appengine.api.datastore.Cursor; import com.google.appengine.datanucleus.query.JPACursorHelper; import java.util.List; import java.util.logging.Logger; import javax.annotation.Nullable; import javax.inject.Named; import javax.persistence.EntityNotFoundException; import javax.persistence.EntityManager; import javax.persistence.Query; @Api(name = "profileinfoendpoint", namespace = @ApiNamespace(ownerDomain = "vmcop.com", ownerName = "vmcop.com", packagePath = "simplethird.findlover")) public class ProfileInfoEndpoint { private static final Logger log = Logger.getLogger(ProfileInfoEndpoint.class.getName()); /** * This method lists all the entities inserted in datastore. * It uses HTTP GET method and paging support. * * @return A CollectionResponse class containing the list of all entities * persisted and a cursor to the next page. */ @SuppressWarnings({ "unchecked", "unused" }) @ApiMethod(name = "listProfileInfo") public CollectionResponse<ProfileInfo> listProfileInfo( @Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit, @Nullable @Named("sextype") String sexType, @Nullable @Named("randomNum") Integer randomNum ) { EntityManager mgr = null; Cursor cursor = null; List<ProfileInfo> execute = null; Integer maxResults = 0; try { mgr = getEntityManager(); /* // Dem so luong record thoa dk Query countQuery = mgr .createQuery("SELECT COUNT(ProfileInfo) FROM ProfileInfo as ProfileInfo " + " WHERE ProfileInfo.userSex = :sexType " + " AND ProfileInfo.bornYear >= :fromYear " + " AND ProfileInfo.bornYear <= :toYear" + " AND ProfileInfo.randomNum <= :randomNum"); countQuery.setParameter(0, sexType); countQuery.setParameter(1, fromYear); countQuery.setParameter(2, toYear); countQuery.setParameter(3, randomNum); maxResults = ((Long)countQuery.getSingleResult()).intValue(); log.info("==maxResults==" + maxResults); */ Query query = mgr .createQuery("SELECT ProfileInfo FROM ProfileInfo as ProfileInfo " + " WHERE ProfileInfo.userSex = :sexType " + " AND ProfileInfo.randomNum >= :randomNum "); log.info("==randomNum==" + randomNum); //log.info("==query==" + query); if (cursorString != null && cursorString != "") { cursor = Cursor.fromWebSafeString(cursorString); query.setHint(JPACursorHelper.CURSOR_HINT, cursor); } if (limit != null) { query.setParameter(0, sexType); query.setParameter(1, randomNum); query.setFirstResult(0); query.setMaxResults(limit); } execute = (List<ProfileInfo>) query.getResultList(); cursor = JPACursorHelper.getCursor(execute); if (cursor != null){ cursorString = cursor.toWebSafeString(); } // for lazy fetch. for (ProfileInfo obj : execute); } finally { mgr.close(); } return CollectionResponse.<ProfileInfo> builder().setItems(execute) .setNextPageToken(cursorString).build(); } // Random Integer /* private static int randInt(int min, int max) { if(max <= 0){ return 0; } Random rand = new Random(); int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } */ /** * This method gets the entity having primary key id. It uses HTTP GET method. * * @param id the primary key of the java bean. * @return The entity with primary key id. */ @ApiMethod(name = "getProfileInfo") public ProfileInfo getProfileInfo(@Named("id") Long id) { EntityManager mgr = getEntityManager(); ProfileInfo profileinfo = null; try { profileinfo = mgr.find(ProfileInfo.class, id); } finally { mgr.close(); } return profileinfo; } /** * This inserts a new entity into App Engine datastore. If the entity already * exists in the datastore, an exception is thrown. * It uses HTTP POST method. * * @param profileinfo the entity to be inserted. * @return The inserted entity. */ @ApiMethod(name = "insertProfileInfo") public ProfileInfo insertProfileInfo(ProfileInfo profileinfo) { EntityManager mgr = getEntityManager(); try { /* if (containsProfileInfo(profileinfo)) { throw new EntityExistsException("Object already exists"); } */ mgr.persist(profileinfo); } finally { mgr.close(); } return profileinfo; } /** * This method is used for updating an existing entity. If the entity does not * exist in the datastore, an exception is thrown. * It uses HTTP PUT method. * * @param profileinfo the entity to be updated. * @return The updated entity. */ @ApiMethod(name = "updateProfileInfo") public ProfileInfo updateProfileInfo(ProfileInfo profileinfo) { EntityManager mgr = getEntityManager(); try { if (!containsProfileInfo(profileinfo)) { throw new EntityNotFoundException("Object does not exist"); } mgr.persist(profileinfo); } finally { mgr.close(); } return profileinfo; } /** * This method removes the entity with primary key id. * It uses HTTP DELETE method. * * @param id the primary key of the entity to be deleted. */ @ApiMethod(name = "removeProfileInfo") public void removeProfileInfo(@Named("id") Long id) { EntityManager mgr = getEntityManager(); try { ProfileInfo profileinfo = mgr.find(ProfileInfo.class, id); mgr.remove(profileinfo); } finally { mgr.close(); } } private boolean containsProfileInfo(ProfileInfo profileinfo) { EntityManager mgr = getEntityManager(); boolean contains = true; try { ProfileInfo item = mgr .find(ProfileInfo.class, profileinfo.getKey()); if (item == null) { contains = false; } } finally { mgr.close(); } return contains; } private static EntityManager getEntityManager() { return EMF.get().createEntityManager(); } }
[ "huaquocvinh@gmail.com" ]
huaquocvinh@gmail.com
61068f38acbb5df473b9ee78313c066a659b3d84
e8db24041fde9bb634582ba2e42270178f5f6327
/src/com/mpc/gui/Gui.java
041f5a65f01c1b68f6beb4361e551d8e758eaf52
[]
no_license
izzyreal/vmpc-java
7bdf40f40fc2bc93fb1315f38af95b38167bf018
87b51bc7fe44edfc397d178ef0fda27bc5f56f20
refs/heads/master
2020-12-02T06:42:42.751065
2017-07-11T11:18:47
2017-07-11T11:18:47
96,884,968
1
0
null
null
null
null
UTF-8
Java
false
false
21,939
java
package com.mpc.gui; import java.awt.event.KeyAdapter; import java.util.LinkedHashMap; import java.util.Map; import com.mpc.Mpc; import com.mpc.controls.AbstractControls; import com.mpc.controls.Controls; import com.mpc.controls.KbMouseController; import com.mpc.controls.disk.FormatControls; import com.mpc.controls.disk.LoadControls; import com.mpc.controls.disk.SaveControls; import com.mpc.controls.disk.SetupControls; import com.mpc.controls.disk.dialog.CantFindFileControls; import com.mpc.controls.disk.dialog.DeleteAllFilesControls; import com.mpc.controls.disk.dialog.DeleteFileControls; import com.mpc.controls.disk.dialog.DeleteFolderControls; import com.mpc.controls.disk.dialog.FileAlreadyExistsControls; import com.mpc.controls.disk.window.DirectoryControls; import com.mpc.controls.disk.window.LoadAProgramControls; import com.mpc.controls.disk.window.LoadASequenceControls; import com.mpc.controls.disk.window.LoadASequenceFromAllControls; import com.mpc.controls.disk.window.LoadASoundControls; import com.mpc.controls.disk.window.LoadApsFileControls; import com.mpc.controls.disk.window.MPC2000XLAllFileControls; import com.mpc.controls.disk.window.SaveAProgramControls; import com.mpc.controls.disk.window.SaveASequenceControls; import com.mpc.controls.disk.window.SaveASoundControls; import com.mpc.controls.disk.window.SaveAllFileControls; import com.mpc.controls.disk.window.SaveApsFileControls; import com.mpc.controls.midisync.SyncControls; import com.mpc.controls.misc.PunchControls; import com.mpc.controls.misc.SecondSeqControls; import com.mpc.controls.misc.TransControls; import com.mpc.controls.mixer.MixerControls; import com.mpc.controls.mixer.MixerSetupControls; import com.mpc.controls.mixer.SelectDrumMixerControls; import com.mpc.controls.mixer.window.ChannelSettingsControls; import com.mpc.controls.other.InitControls; import com.mpc.controls.other.OthersControls; import com.mpc.controls.other.VerControls; import com.mpc.controls.other.dialog.NameControls; import com.mpc.controls.sampler.DrumControls; import com.mpc.controls.sampler.InitPadAssignControls; import com.mpc.controls.sampler.LoopControls; import com.mpc.controls.sampler.PgmAssignControls; import com.mpc.controls.sampler.PgmParamsControls; import com.mpc.controls.sampler.PurgeControls; import com.mpc.controls.sampler.SampleControls; import com.mpc.controls.sampler.SelectDrumControls; import com.mpc.controls.sampler.SndParamsControls; import com.mpc.controls.sampler.TrimControls; import com.mpc.controls.sampler.ZoneControls; import com.mpc.controls.sampler.dialog.ConvertSoundControls; import com.mpc.controls.sampler.dialog.CopyProgramControls; import com.mpc.controls.sampler.dialog.CopySoundControls; import com.mpc.controls.sampler.dialog.CreateNewProgramControls; import com.mpc.controls.sampler.dialog.DeleteAllProgramsControls; import com.mpc.controls.sampler.dialog.DeleteAllSoundControls; import com.mpc.controls.sampler.dialog.DeleteProgramControls; import com.mpc.controls.sampler.dialog.DeleteSoundControls; import com.mpc.controls.sampler.dialog.MonoToStereoControls; import com.mpc.controls.sampler.dialog.ResampleControls; import com.mpc.controls.sampler.dialog.StereoToMonoControls; import com.mpc.controls.sampler.window.AssignmentViewControls; import com.mpc.controls.sampler.window.AutoChromaticAssignmentControls; import com.mpc.controls.sampler.window.CopyNoteParametersControls; import com.mpc.controls.sampler.window.EditSoundControls; import com.mpc.controls.sampler.window.KeepOrRetryControls; import com.mpc.controls.sampler.window.MuteAssignControls; import com.mpc.controls.sampler.window.NumberOfZonesControls; import com.mpc.controls.sampler.window.ProgramControls; import com.mpc.controls.sampler.window.SoundControls; import com.mpc.controls.sampler.window.VeloEnvFilterControls; import com.mpc.controls.sampler.window.VeloPitchControls; import com.mpc.controls.sampler.window.VelocityModulationControls; import com.mpc.controls.sampler.window.ZoomControls; import com.mpc.controls.sequencer.AssignControls; import com.mpc.controls.sequencer.BarCopyControls; import com.mpc.controls.sequencer.EditSequenceControls; import com.mpc.controls.sequencer.EraseAllOffTracksControls; import com.mpc.controls.sequencer.NextSeqControls; import com.mpc.controls.sequencer.NextSeqPadControls; import com.mpc.controls.sequencer.SequencerControls; import com.mpc.controls.sequencer.SongControls; import com.mpc.controls.sequencer.StepEditorControls; import com.mpc.controls.sequencer.TrMoveControls; import com.mpc.controls.sequencer.TrMuteControls; import com.mpc.controls.sequencer.UserDefaultsControls; import com.mpc.controls.sequencer.dialog.CopySequenceControls; import com.mpc.controls.sequencer.dialog.CopyTrackControls; import com.mpc.controls.sequencer.dialog.DeleteAllSequencesControls; import com.mpc.controls.sequencer.dialog.DeleteAllTracksControls; import com.mpc.controls.sequencer.dialog.DeleteSequenceControls; import com.mpc.controls.sequencer.dialog.DeleteTrackControls; import com.mpc.controls.sequencer.dialog.MetronomeSoundControls; import com.mpc.controls.sequencer.window.Assign16LevelsControls; import com.mpc.controls.sequencer.window.ChangeBars2Controls; import com.mpc.controls.sequencer.window.ChangeBarsControls; import com.mpc.controls.sequencer.window.ChangeTsigControls; import com.mpc.controls.sequencer.window.CountMetronomeControls; import com.mpc.controls.sequencer.window.EditMultipleControls; import com.mpc.controls.sequencer.window.EditVelocityControls; import com.mpc.controls.sequencer.window.EraseControls; import com.mpc.controls.sequencer.window.InsertEventControls; import com.mpc.controls.sequencer.window.LoopBarsWindow; import com.mpc.controls.sequencer.window.MidiInputControls; import com.mpc.controls.sequencer.window.MidiMonitorControls; import com.mpc.controls.sequencer.window.MidiOutputControls; import com.mpc.controls.sequencer.window.MultiRecordingSetupControls; import com.mpc.controls.sequencer.window.PasteEventControls; import com.mpc.controls.sequencer.window.SequenceControls; import com.mpc.controls.sequencer.window.TempoChangeControls; import com.mpc.controls.sequencer.window.TimeDisplayControls; import com.mpc.controls.sequencer.window.TimingCorrectControls; import com.mpc.controls.sequencer.window.TrackControls; import com.mpc.controls.sequencer.window.TransmitProgramChangesControls; import com.mpc.controls.vmpc.AudioControls; import com.mpc.controls.vmpc.AudioMidiDisabledControls; import com.mpc.controls.vmpc.BufferSizeControls; import com.mpc.controls.vmpc.DirectToDiskRecorderControls; import com.mpc.controls.vmpc.MidiControls; import com.mpc.controls.vmpc.RecordJamControls; import com.mpc.controls.vmpc.RecordingFinishedControls; import com.mpc.controls.vmpc.VmpcDiskControls; import com.mpc.gui.disk.DiskGui; import com.mpc.gui.disk.window.DirectoryGui; import com.mpc.gui.disk.window.DiskWindowGui; import com.mpc.gui.midisync.MidiSyncGui; import com.mpc.gui.misc.PunchGui; import com.mpc.gui.misc.SecondSeqGui; import com.mpc.gui.misc.TransGui; import com.mpc.gui.other.OthersGui; import com.mpc.gui.sampler.MixerGui; import com.mpc.gui.sampler.MixerSetupGui; import com.mpc.gui.sampler.SamplerGui; import com.mpc.gui.sampler.SoundGui; import com.mpc.gui.sampler.window.EditSoundGui; import com.mpc.gui.sampler.window.SamplerWindowGui; import com.mpc.gui.sampler.window.ZoomGui; import com.mpc.gui.sequencer.BarCopyGui; import com.mpc.gui.sequencer.EditSequenceGui; import com.mpc.gui.sequencer.SequencerGui; import com.mpc.gui.sequencer.SongGui; import com.mpc.gui.sequencer.StepEditorGui; import com.mpc.gui.sequencer.TrMoveGui; import com.mpc.gui.sequencer.window.EraseGui; import com.mpc.gui.sequencer.window.SequencerWindowGui; import com.mpc.gui.vmpc.AudioGui; import com.mpc.gui.vmpc.DeviceGui; import com.mpc.gui.vmpc.DirectToDiskRecorderGui; import com.mpc.gui.vmpc.MidiGui; public class Gui { public static String[] noteNames = new String[128]; private String[] someNoteNames = { "C.", "C#", "D.", "D#", "E.", "F.", "F#", "G.", "G#", "A.", "A#", "B." }; private Map<String, Controls> controls = new LinkedHashMap<String, Controls>(); private int previousKeyStroke; private Mpc mpc; private MainFrame mainFrame; private EditSequenceGui editSequenceGui; private SequencerWindowGui sequencerWindowGui; private StepEditorGui stepEditorGui; private BarCopyGui barCopyGui; private TrMoveGui trMoveGui; private SamplerGui samplerGui; private SamplerWindowGui samplerWindowGui; private MixerGui mixerGui; private EditSoundGui editSoundGui; private SoundGui soundGui; private ZoomGui zoomGui; private DirectoryGui directoryGui; private DiskGui diskGui; private DiskWindowGui diskWindowGui; private MidiSyncGui midiSyncGui; private NameGui nameGui; private KbMouseController kbmc; private DeviceGui deviceGui; private SongGui songGui; private MixerSetupGui mixer; private SequencerGui sequencerGui; private EraseGui eraseGui; private OthersGui othersGui; private MidiGui midiGui; private AudioGui audioGui; private DirectToDiskRecorderGui d2dRecorderGui; private PunchGui punchGui; private SecondSeqGui secondSeqGui; private TransGui transGui; public static String[] samplerWindowNames = { "program", "deleteprogram", "deleteallprograms", "createnewprogram", "copyprogram", "assignmentview", "initpadassign", "copynoteparameters", "velocitymodulation", "veloenvfilter", "velopitch", "autochromaticassignment", "keeporretry" }; public static String[] seqWindowNames = { "copysequence", "copytrack", "countmetronome", "timedisplay", "tempochange", "timingcorrect", "changetsig", "changebars", "changebars2", "eraseallofftracks", "transmitprogramchanges", "multirecordingsetup", "midiinput", "midioutput", "editvelocity", "sequence", "deletesequence", "track", "deletetrack", "deleteallsequences", "deletealltracks", "loopbarswindow" }; static String[] diskNames = { "load", "save", "format", "setup", "device", "deleteallfiles", "loadaprogram", "saveaprogram", "loadasound", "saveasound", "cantfindfile", "filealreadyexists", "loadasequence", "saveasequence", "saveapsfile" }; public static String[] soundNames = { "sound", "deletesound", "deleteallsound", "convertsound", "resample", "stereotomono", "monotostereo", "copysound" }; public static String[] soundGuiNames = { "trim", "loop", "zone" }; public Gui(Mpc mpc) { int octave = -2; int noteCounter = 0; for (int j = 0; j < 128; j++) { String octaveString = "" + octave; if (octave == -2) octaveString = "\u00D2"; if (octave == -1) octaveString = "\u00D3"; noteNames[j] = someNoteNames[noteCounter] + octaveString; noteCounter++; if (noteCounter == 12) { noteCounter = 0; octave++; } } this.mpc = mpc; try { mainFrame = new MainFrame(mpc, this); mainFrame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } sequencerGui = new SequencerGui(); stepEditorGui = new StepEditorGui(mainFrame); editSequenceGui = new EditSequenceGui(); sequencerWindowGui = new SequencerWindowGui(mainFrame); mpc.getSequencer().init(sequencerWindowGui); barCopyGui = new BarCopyGui(); trMoveGui = new TrMoveGui(); samplerGui = new SamplerGui(); samplerWindowGui = new SamplerWindowGui(); mixerGui = new MixerGui(); editSoundGui = new EditSoundGui(); soundGui = new SoundGui(); zoomGui = new ZoomGui(); diskGui = new DiskGui(mpc); directoryGui = new DirectoryGui(mpc, diskGui); diskWindowGui = new DiskWindowGui(); midiSyncGui = new MidiSyncGui(); nameGui = new NameGui(); eraseGui = new EraseGui(); midiGui = new MidiGui(); audioGui = new AudioGui(); d2dRecorderGui = new DirectToDiskRecorderGui(); punchGui = new PunchGui(); transGui = new TransGui(); secondSeqGui = new SecondSeqGui(); kbmc = new KbMouseController(); mainFrame.addMouseListener(kbmc); mainFrame.addMouseMotionListener(kbmc); mainFrame.addMouseWheelListener(mainFrame.getControlPanel().getDataWheel()); mainFrame.addMouseWheelListener(mainFrame.getControlPanel().getSlider()); deviceGui = new DeviceGui(); songGui = new SongGui(); mixer = new MixerSetupGui(); othersGui = new OthersGui(); controls.put("punch", new PunchControls()); controls.put("trans", new TransControls()); controls.put("2ndseq", new SecondSeqControls()); controls.put("trim", new TrimControls()); controls.put("loop", new LoopControls()); controls.put("zone", new ZoneControls()); controls.put("numberofzones", new NumberOfZonesControls()); controls.put("params", new SndParamsControls()); controls.put("barcopy", new BarCopyControls()); controls.put("channelsettings", new ChannelSettingsControls()); controls.put("mixer", new MixerControls()); controls.put("mixersetup", new MixerSetupControls()); controls.put("drum", new DrumControls()); controls.put("purge", new PurgeControls()); controls.put("directory", new DirectoryControls()); controls.put("deleteallfiles", new DeleteAllFilesControls()); controls.put("deletefile", new DeleteFileControls()); controls.put("deletefolder", new DeleteFolderControls()); controls.put("load", new LoadControls()); controls.put("loadasequence", new LoadASequenceControls()); controls.put("cantfindfile", new CantFindFileControls()); controls.put("save", new SaveControls()); controls.put("saveasound", new SaveASoundControls()); controls.put("format", new FormatControls()); controls.put("disk", new VmpcDiskControls()); controls.put("setup", new SetupControls()); controls.put("loadaprogram", new LoadAProgramControls()); controls.put("filealreadyexists", new FileAlreadyExistsControls()); controls.put("saveasequence", new SaveASequenceControls()); controls.put("saveaprogram", new SaveAProgramControls()); controls.put("saveapsfile", new SaveApsFileControls()); controls.put("loadasound", new LoadASoundControls()); controls.put("edit", new EditSequenceControls()); controls.put("editsound", new EditSoundControls()); controls.put("name", new NameControls()); controls.put("nextseq", new NextSeqControls()); controls.put("nextseqpad", new NextSeqPadControls()); controls.put("programassign", new PgmAssignControls()); controls.put("programparams", new PgmParamsControls()); controls.put("sample", new SampleControls()); controls.put("keeporretry", new KeepOrRetryControls()); controls.put("program", new ProgramControls()); controls.put("createnewprogram", new CreateNewProgramControls()); controls.put("copyprogram", new CopyProgramControls()); controls.put("assignmentview", new AssignmentViewControls()); controls.put("initpadassign", new InitPadAssignControls()); controls.put("copynoteparameters", new CopyNoteParametersControls()); controls.put("veloenvfilter", new VeloEnvFilterControls()); controls.put("muteassign", new MuteAssignControls()); controls.put("velopitch", new VeloPitchControls()); controls.put("velocitymodulation", new VelocityModulationControls()); controls.put("autochromaticassignment", new AutoChromaticAssignmentControls()); controls.put("deleteallprograms", new DeleteAllProgramsControls()); controls.put("deleteprogram", new DeleteProgramControls()); controls.put("sequencer", new SequencerControls()); controls.put("sequence", new SequenceControls()); controls.put("timedisplay", new TimeDisplayControls()); controls.put("tempochange", new TempoChangeControls()); controls.put("timingcorrect", new TimingCorrectControls()); controls.put("loopbarswindow", new LoopBarsWindow()); controls.put("copytrack", new CopyTrackControls()); controls.put("copysequence", new CopySequenceControls()); controls.put("deletealltracks", new DeleteAllTracksControls()); controls.put("deleteallsequences", new DeleteAllSequencesControls()); controls.put("deletetrack", new DeleteTrackControls()); controls.put("deletesequence", new DeleteSequenceControls()); controls.put("editvelocity", new EditVelocityControls()); controls.put("midioutput", new MidiOutputControls()); controls.put("midiinput", new MidiInputControls()); controls.put("multirecordingsetup", new MultiRecordingSetupControls()); controls.put("transmitprogramchanges", new TransmitProgramChangesControls()); controls.put("eraseallofftracks", new EraseAllOffTracksControls()); controls.put("track", new TrackControls()); controls.put("changebars", new ChangeBarsControls()); controls.put("changebars2", new ChangeBars2Controls()); controls.put("countmetronome", new CountMetronomeControls()); controls.put("changetsig", new ChangeTsigControls()); controls.put("song", new SongControls()); controls.put("sound", new SoundControls()); controls.put("deletesound", new DeleteSoundControls()); controls.put("deleteallsound", new DeleteAllSoundControls()); controls.put("convertsound", new ConvertSoundControls()); controls.put("monotostereo", new MonoToStereoControls()); controls.put("copysound", new CopySoundControls()); controls.put("resample", new ResampleControls()); controls.put("stereotomono", new StereoToMonoControls()); controls.put("editmultiple", new EditMultipleControls()); controls.put("insertevent", new InsertEventControls()); controls.put("pasteevent", new PasteEventControls()); controls.put("sequencer_step", new StepEditorControls()); controls.put("trmove", new TrMoveControls()); controls.put("trackmute", new TrMuteControls()); controls.put("user", new UserDefaultsControls()); ZoomControls zc = new ZoomControls(); controls.put("startfine", zc); controls.put("endfine", zc); controls.put("looptofine", zc); controls.put("loopendfine", zc); controls.put("mpc2000xlallfile", new MPC2000XLAllFileControls()); controls.put("loadasequencefromall", new LoadASequenceFromAllControls()); controls.put("selectdrum", new SelectDrumControls()); controls.put("selectdrum_mixer", new SelectDrumMixerControls()); controls.put("loadapsfile", new LoadApsFileControls()); controls.put("saveallfile", new SaveAllFileControls()); controls.put("metronomesound", new MetronomeSoundControls()); controls.put("assign16levels", new Assign16LevelsControls()); controls.put("assign", new AssignControls()); controls.put("sync", new SyncControls()); MidiMonitorControls mmc = new MidiMonitorControls(); controls.put("midiinputmonitor", mmc); controls.put("midioutputmonitor", mmc); controls.put("erase", new EraseControls()); controls.put("others", new OthersControls()); controls.put("init", new InitControls()); controls.put("ver", new VerControls()); controls.put("midi", new MidiControls()); controls.put("audio", new AudioControls()); controls.put("buffersize", new BufferSizeControls()); controls.put("audiomididisabled", new AudioMidiDisabledControls()); controls.put("directtodiskrecorder", new DirectToDiskRecorderControls()); controls.put("recordjam", new RecordJamControls()); controls.put("recordingfinished", new RecordingFinishedControls()); // JmeGui app = new JmeGui(); // AppSettings settings = new AppSettings(true); // settings.setFrameRate(30); // app.setSettings(settings); // app.start(); } public Mpc getMpc() { return mpc; } public MainFrame getMainFrame() { return mainFrame; } public StepEditorGui getStepEditorGui() { return stepEditorGui; } public MixerGui getMixerGui() { return mixerGui; } public EditSequenceGui getEditSequenceGui() { return editSequenceGui; } public SequencerWindowGui getSequencerWindowGui() { return sequencerWindowGui; } public void setPreviousKeyStroke(int i) { previousKeyStroke = i; } public MidiSyncGui getMidiSyncGui() { return midiSyncGui; } public BarCopyGui getBarCopyGui() { return barCopyGui; } public TrMoveGui getTrMoveGui() { return trMoveGui; } public EditSoundGui getEditSoundGui() { return editSoundGui; } public SoundGui getSoundGui() { return soundGui; } public int getPreviousKeyStroke() { return previousKeyStroke; } public ZoomGui getZoomGui() { return zoomGui; } public DirectoryGui getDirectoryGui() { return directoryGui; } public DiskGui getDiskGui() { return diskGui; } public DiskWindowGui getDirectoryWindowGui() { return diskWindowGui; } public SamplerGui getSamplerGui() { return samplerGui; } public SamplerWindowGui getSamplerWindowGui() { return samplerWindowGui; } public NameGui getNameGui() { return nameGui; } public KeyAdapter getKb() { return kbmc; } public DeviceGui getDeviceGui() { return deviceGui; } public SongGui getSongGui() { return songGui; } public MixerSetupGui getMixerSetupGui() { return mixer; } public AbstractControls getControls(String s) { return (AbstractControls) controls.get(s); } public SequencerGui getSequencerGui() { return sequencerGui; } public EraseGui getEraseGui() { return eraseGui; } public OthersGui getOthersGui() { return othersGui; } public AudioGui getAudioGui() { return audioGui; } public MidiGui getMidiGui() { return midiGui; } public DirectToDiskRecorderGui getD2DRecorderGui() { return d2dRecorderGui; } public PunchGui getPunchGui() { return punchGui; } public SecondSeqGui getSecondSeqGui() { return secondSeqGui; } public TransGui getTransGui() { return transGui; } }
[ "izmaelverhage@gmail.com" ]
izmaelverhage@gmail.com
044eb0970c680e10ec5a59fdcc50885cca60e38e
9b38efc742ed9692f252a4de55edd7a0a4e1d699
/src/by/it/group573601/horuzhenko/lesson1/FiboC.java
495fa0f79322ecb15113f05554ac3050ff31d152
[]
no_license
menchytskys/RPPZL2017-09-02
24bfaf5f314743672cdf8a0b9a57b332701aaeba
a8201bd8b09a6b75eca69078e2ba00a2d02f12e5
refs/heads/master
2021-07-20T15:17:54.350210
2017-10-27T20:36:24
2017-10-27T20:36:24
108,955,210
0
1
null
2017-10-31T06:33:35
2017-10-31T06:33:35
null
UTF-8
Java
false
false
1,011
java
package by.it.group573601.horuzhenko.lesson1; /* * Даны целые числа 1<=n<=1E18 и 2<=m<=1E5, * необходимо найти остаток от деления n-го числа Фибоначчи на m. * время расчета должно быть не более 2 секунд */ public class FiboC { private long startTime = System.currentTimeMillis(); private long time() { return System.currentTimeMillis() - startTime; } public static void main(String[] args) { FiboC fibo = new FiboC(); int n = 10; int m = 2; System.out.printf("fasterC(%d)=%d \n\t time=%d \n\n", n, fibo.fasterC(n, m), fibo.time()); } long fasterC(long n, int m) { //решение практически невозможно найти интуитивно //вам потребуется дополнительный поиск информации //см. период Пизано return 0L; } }
[ "rivulet798@gmail.com" ]
rivulet798@gmail.com
5bc51f89145802bdc973d9bd50df5e915023f0d0
6ca24c002fec7d826dd753a528614ea34bef2b1d
/src/main/java/com/saituo/order/service/variable/SystemVariableService.java
7387226dade870f17841f1642ad03414c27c8ce0
[ "Apache-2.0" ]
permissive
ycykkj/order
544d68873facbb26a2eab0d0a31579feb95823d2
04f1a292cf8abf399509d8e657f2c40fa6beff69
refs/heads/master
2021-01-15T23:12:38.233590
2015-05-17T15:48:17
2015-05-17T15:48:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,640
java
package com.saituo.order.service.variable; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.springframework.beans.factory.annotation.Autowired; import com.google.common.collect.Maps; import com.saituo.order.commons.VariableUtils; import com.saituo.order.commons.enumeration.entity.ShowType; import com.saituo.order.commons.utils.StringUtils; import com.saituo.order.dao.account.AreaDao; import com.saituo.order.dao.account.GroupDao; import com.saituo.order.dao.account.UserDao; import com.saituo.order.dao.order.SupplyDao; import com.saituo.order.entity.order.Supply; import com.saituo.order.service.ehcache.OrderCacheService; /** * 系统静态变量Id与名称对应关系 * * @author maurice */ @SuppressWarnings("unchecked") public class SystemVariableService { @Autowired private AreaDao areaDao; @Autowired private GroupDao groupDao; @Autowired private UserDao userDao; @Autowired private SupplyDao supplyDao; @Autowired private OrderCacheService orderCacheService; private static final String UNDEFINE = "未知姓名"; private static final String AREA_TO_OFFICE_ID_NAME_CACHE = "officeToUserIdAndNameCache"; private static final String AREA_TO_USER_ID_NAME_CACHE = "areaToUserIdAndNameCache"; public void init() { initUserByOfficeIdData(); // initUserByAreaIdData(); } public Map<String, String> getAreaIdAndName() { Map<String, String> mapData = Maps.newHashMap(); List<Map<String, String>> list = areaDao.getAreaIdAndName(); for (Map<String, String> mapDataTemp : list) { mapData.put(String.valueOf(mapDataTemp.get("id")), mapDataTemp.get("name")); } return mapData; } public Map<String, String> getSupplyIdAndName() { Map<String, String> mapData = Maps.newHashMap(); Map<String, Object> filter = Maps.newHashMap(); List<Supply> supplyList = supplyDao.getSupplyListByIdAndDelFlag(filter); for (Supply supply : supplyList) { mapData.put(supply.getSupplierId(), supply.getSupplierName()); } return mapData; } public Map<String, String> getUserIdAndName() { Map<String, String> mapData = Maps.newHashMap(); List<Map<String, String>> list = userDao.getAllofUser(); for (Map<String, String> mapDataTemp : list) { mapData.put(String.valueOf(mapDataTemp.get("id")), mapDataTemp.get("name")); } return mapData; } public String getAreaIdAndNameData(String areaId) { return (String) areaDao.getAreaNameById(areaId); } public Map<String, Object> getGroupNameByAreaIdAndGroupIdDataToShow(Integer areaId) { List<Map<String, Object>> groupList = groupDao.get(areaId, ShowType.SHOW.getValue()); Map<String, Object> officeIdAndNameMap = Maps.newHashMap(); for (Map<String, Object> mapData : groupList) { officeIdAndNameMap.put(String.valueOf(mapData.get("id")), mapData.get("name")); } return officeIdAndNameMap; } /** * 通过groupId 获取所在本地市的所有用户信息 * * @param areaId * @return */ private void initUserByOfficeIdData() { Map<String, String> mapCond = Maps.newConcurrentMap(); List<Map<String, Object>> userList = userDao.findAllofUserByOfficeId(mapCond); Map<String, Map<String, String>> mapRes = Maps.newHashMap(); for (Map<String, Object> mapData : userList) { String officeId = String.valueOf(mapData.get("officeId")); Map<String, String> mapInternalData = mapRes.get(officeId); if (mapInternalData == null) { mapInternalData = Maps.newHashMap(); } mapInternalData.put(String.valueOf(mapData.get("id")), String.valueOf(mapData.get("name"))); mapRes.put(officeId, mapInternalData); } for (Entry<String, Map<String, String>> entry : mapRes.entrySet()) { orderCacheService.put(AREA_TO_OFFICE_ID_NAME_CACHE, entry.getKey(), entry.getValue()); } } public Map<String, String> getUserMapsDataByOfficeId(String officeId) { Map<String, String> mapData = (Map<String, String>) orderCacheService.get(AREA_TO_OFFICE_ID_NAME_CACHE, officeId); return mapData; } public String getUserByOfficeIdData(String officeId, String userId) { Map<String, Object> mapData = (Map<String, Object>) orderCacheService.get(AREA_TO_OFFICE_ID_NAME_CACHE, String.valueOf(officeId)); if (mapData != null && StringUtils.isNotEmpty(VariableUtils.typeCast(mapData.get(userId), String.class))) { return String.valueOf(mapData.get(userId)); } Map<String, String> mapTemp = Maps.newHashMap(); mapTemp.put("officeId", String.valueOf(officeId)); mapTemp.put("userId", String.valueOf(userId)); List<Map<String, Object>> list = userDao.findAllofUserByOfficeId(mapTemp); if (list.size() > 0) { orderCacheService.put(AREA_TO_OFFICE_ID_NAME_CACHE, String.valueOf(officeId), list.get(0)); return String.valueOf(list.get(0).get("name")); } return UNDEFINE; } /** * 通过AreaId 获取所在本地市的所有用户信息 * * @param areaId * @return * * private void initUserByAreaIdData() { * * Map<String, String> mapCond = Maps.newConcurrentMap(); * List<Map<String, Object>> userList = * userDao.findAllofUserByAreaId(mapCond); * * Map<String, Map<String, String>> mapRes = Maps.newHashMap(); for * (Map<String, Object> mapData : userList) { String areaId = * String.valueOf(mapData.get("areaId")); Map<String, String> * mapInternalData = mapRes.get(areaId); if (mapInternalData == * null) { mapInternalData = Maps.newHashMap(); } * mapInternalData.put(String.valueOf(mapData.get("id")), * String.valueOf(mapData.get("name"))); mapRes.put(areaId, * mapInternalData); } * * for (Entry<String, Map<String, String>> entry : * mapRes.entrySet()) { * orderCacheService.put(AREA_TO_USER_ID_NAME_CACHE, entry.getKey(), * entry.getValue()); } } */ public String getUserByAreaIdData(String areaId, String userId) { // Map<String, Object> mapData = (Map<String, Object>) // orderCacheService.get(AREA_TO_USER_ID_NAME_CACHE, // String.valueOf(areaId)); // // if (mapData != null && // StringUtils.isNotEmpty(String.valueOf(mapData.get(userId)))) { // return String.valueOf(mapData.get(userId)); // } Map<String, String> mapTemp = Maps.newHashMap(); mapTemp.put("areaId", String.valueOf(areaId)); mapTemp.put("userId", String.valueOf(userId)); List<Map<String, Object>> list = userDao.findAllofUserByAreaId(mapTemp); if (list.size() > 0) { orderCacheService.put(AREA_TO_USER_ID_NAME_CACHE, String.valueOf(areaId), list.get(0)); return String.valueOf(list.get(0).get("name")); } return UNDEFINE; } }
[ "yangwn1116@gmail.com" ]
yangwn1116@gmail.com
ccd5e4a0c5334d2e82e87d50d146dfc944493c63
bf3a6d2b124bb108272b7aeaf50d1142af5e1d61
/Project3/Operators/src/UserInput.java
270f2f7934ad5ece771b02f06e22b13ddbb3cde5
[]
no_license
andraws/CS_DB2_WPI
c05a75bc3005736eacfc4b81de0b07b161cae93d
8d2ebf10bfde27951da2afa24f776bb3a5f17c0c
refs/heads/main
2023-04-22T18:11:49.920115
2021-05-07T19:24:52
2021-05-07T19:24:52
365,332,777
0
0
null
null
null
null
UTF-8
Java
false
false
821
java
public class UserInput { Command cmd; private String input; private String[] inputList; public UserInput(String input) { this.input = input; this.inputList = input.split(" "); if (inputList.length == 12) cmd = Command.HASH_JOIN; else if (inputList.length == 9) cmd = Command.NEST_LOOP_JOIN; else if (inputList.length == 8) cmd = Command.HASH_AGGREGATION; else cmd = Command.INVALID; } public String[] getVariables(){ if (cmd.equals(Command.HASH_AGGREGATION)){ String[] cl = new String[2]; cl[0] = inputList[2]; cl[1] = inputList[4]; return cl; } return null; } public Command getCmd() { return cmd; } }
[ "andrewshanaj@gmail.com" ]
andrewshanaj@gmail.com
166a79b3ee911e453bc415b621bb90abaa3d10c6
c141629b4eb5f690d0edee9068bb3160689d036e
/approche-objet/src/sets/Pays.java
bff6f6b6bdacb0920f9423dcc14ee53c74083149
[]
no_license
miachella/approche-objet
838985e2bfd432d502292f738d6c5bbba0d6f38f
de86419707bbf7c7235abb934ebf13ba8beac9f0
refs/heads/master
2023-04-15T16:03:10.038058
2020-07-09T13:00:50
2020-07-09T13:00:50
274,863,464
0
0
null
2021-04-26T20:27:06
2020-06-25T08:16:48
Java
UTF-8
Java
false
false
1,041
java
package sets; import org.apache.commons.lang3.builder.EqualsBuilder; public class Pays { private String nom; private Integer nbHab; private Integer pib; public Pays(String nom, Integer nbHab, Integer pib) { this.nom = nom; this.nbHab = nbHab; this.pib = pib; } @Override public String toString() { return this.getNom() + ", " + this.getNbHab() + " habitants, PIB : " + this.getPib() + "$/hab."; } public boolean equals(Pays pays) { if (!(pays instanceof Pays)) { return false; } else if (pays == null) { return false; } Pays other = (Pays) pays; return new EqualsBuilder().append(nom, other.getNom()).append(nbHab, other.getNbHab()).append(pib, other.getPib()).isEquals(); } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public Integer getNbHab() { return nbHab; } public void setNbHab(Integer nbHab) { this.nbHab = nbHab; } public Integer getPib() { return pib; } public void setPib(Integer pib) { this.pib = pib; } }
[ "mathilde.iachella@gmail.com" ]
mathilde.iachella@gmail.com
0fc625647d73593239952918e3a8d1d6c94504c1
982978a60c82a92b7765fdff5ad0a2ccf7efbf74
/src/main/java/edu/erau/holdens/fouryearplanner/io/CourseListParser.java
dbb347d245d0b4a4b3fd0097ad52c2a5f83824b3
[ "MIT" ]
permissive
seanhold3n/ERAU-FourYearPlanner
6c3397e857c25e7751c64f06999bc633360bc75b
117b9dea5732e956886422905415452983e2f6bd
refs/heads/master
2021-05-09T05:38:27.277661
2018-01-29T02:56:15
2018-01-29T02:56:15
119,314,487
0
0
null
null
null
null
UTF-8
Java
false
false
3,756
java
package edu.erau.holdens.fouryearplanner.io; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import edu.erau.holdens.fouryearplanner.model.Course; import edu.erau.holdens.fouryearplanner.model.CourseList; /** * An XML parser for item lists * @author Adriana Strelow, Sean Holden<br> * {strelowa, holdens}@my.erau.edu */ public class CourseListParser { //use document builder class to build //parser for elements inside XML file private DocumentBuilder builder; /** Constructs a parser that can parse item lists. */ public CourseListParser() throws ParserConfigurationException { DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); builder = dbfactory.newDocumentBuilder(); } /** Parses an XML file containing an item list. @param fileName the name of the file @return an array list containing all items in the XML file */ public CourseList parse(String fileName) throws SAXException, IOException { CourseList items = new CourseList(); File f = new File(fileName); Document doc = builder.parse(f); // get list of item elements in the document NodeList courses = doc.getElementsByTagName("course"); // process each item element //System.out.println(courses.getLength()); for (int i = 0; i < courses.getLength(); i++) { // get the only id element in each compscicourse element Element courseElement = (Element) courses.item(i); String id = courseElement.getAttribute("id"); //System.out.println("ID: " + id); if(!id.equals("")){ // get the only title element in an course element Element titleElement = (Element) courseElement.getElementsByTagName("title").item(0); String title = titleElement.getTextContent(); //System.out.println(title); // get the only credits element in a course element Element creditsElement = (Element) courseElement.getElementsByTagName("credits").item(0); int credits = Integer.parseInt(creditsElement.getTextContent()); // get pre req element in a course element List<String> prereqs = new ArrayList<String>(); try{ Element prereqsElement = (Element) courseElement.getElementsByTagName("prereqs").item(0); // TODO For each courseid element in the prereqsElement NodeList prereqnodes = prereqsElement.getElementsByTagName("courseid"); for (int j = 0; j < prereqnodes.getLength(); j++) { // Get the id as an element Element courseIdElement = (Element) prereqnodes.item(j); // Find the course corresponding to that ID in items Course c = items.getCourseByID(courseIdElement.getTextContent()); if (c == null){ throw new IOException("Thing not found, guy!"); } // Add it to a temporary preReqs list prereqs.add(courseIdElement.getTextContent()); } // System.out.println("pre requisites: " + prereqs); } catch (Exception e){} // get when offered element in course element String whenoffered = null; try{ Element whenofferedElement = (Element) courseElement.getElementsByTagName("whenoffered").item(0); whenoffered = whenofferedElement.getTextContent(); } catch (Exception e){} //construct LineItem object Course course = new Course(id, prereqs, title, whenoffered, credits, ""); // add LineItem object to ArrayList that will be returned items.add(course); } } return items; } }
[ "seanhold3n+github@gmail.com" ]
seanhold3n+github@gmail.com
e89922d4750ac253388dd8092af3bad301616f4e
44424301f8fc2c1a9b677f0050bf191e8973f011
/services/mtwilson-setup/src/main/java/com/intel/mtwilson/setup/tasks/CreateMtWilsonPropertiesFile.java
b85f5b5b56e7a3c11c037c12ea9ac5cae3cb6616
[ "BSD-3-Clause" ]
permissive
start621/opencit
6713aee8bc92d84e1768645f4589e5da5fa937f4
e6f8714b60c3a2d8ca80623780e6eccba207acd6
refs/heads/master
2020-12-30T16:16:14.267848
2016-04-20T21:27:00
2016-04-20T21:27:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,714
java
/* * Copyright (C) 2013 Intel Corporation * All rights reserved. */ package com.intel.mtwilson.setup.tasks; import com.intel.mtwilson.My; import com.intel.mtwilson.setup.LocalSetupTask; import java.io.File; import java.io.FileOutputStream; import java.util.Properties; /** * Depends on ConfigureFilesystem. * @author jbuhacoff */ public class CreateMtWilsonPropertiesFile extends LocalSetupTask { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CreateMtWilsonPropertiesFile.class); private String mtwilsonConf; // optional input private transient File mtwilsonProperties; // not an input; path relative to mtwilsonConf is hard-coded @Override protected void configure() throws Exception { mtwilsonConf = My.filesystem().getConfigurationPath(); //My.configuration().getMtWilsonConf(); if (mtwilsonConf == null) { configuration("MTWILSON_CONF is not configured"); } // we don't store MTWILSON_CONF in the configuration because it's needed to load the configuration itself } @Override protected void validate() throws Exception { mtwilsonProperties = new File(mtwilsonConf + File.separator + "mtwilson.properties"); checkFileExists("MTWILSON_CONF", mtwilsonConf); checkFileExists("mtwilson.properties", mtwilsonProperties.getAbsolutePath()); } @Override protected void execute() throws Exception { try (FileOutputStream out = new FileOutputStream(mtwilsonProperties)) { Properties properties = new Properties(); properties.store(out, "automatically generated"); } } }
[ "zahedi.aquino@intel.com" ]
zahedi.aquino@intel.com
6bf10c804bfdb92e50e5088995371054a33595ca
03b2d84cf4d2b545d95332b1bd0018139645c4c5
/src/main/java/com/modelink/reservation/service/impl/FlowAreaServiceImpl.java
a07d20fe5f817eaf51ba3e64c6c45e397a2723be
[]
no_license
modelink/modelink-api
c77ba71de21cd8489336c38e4e8cf3902fd29a5a
6ded28d998eddf6282e0d85dfa56ae0de66b9284
refs/heads/master
2021-07-14T02:10:26.855615
2018-09-17T07:22:09
2018-09-17T07:22:09
134,708,377
0
0
null
null
null
null
UTF-8
Java
false
false
4,630
java
package com.modelink.reservation.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.modelink.reservation.bean.FlowArea; import com.modelink.reservation.mapper.FlowAreaMapper; import com.modelink.reservation.service.FlowAreaService; import com.modelink.reservation.vo.FlowAreaParamPagerVo; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import tk.mybatis.mapper.entity.Example; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; @Service public class FlowAreaServiceImpl implements FlowAreaService { @Resource private FlowAreaMapper flowAreaMapper; /** * 插入一条记录 * * @param flowArea * @return */ @Override public int insert(FlowArea flowArea) { return flowAreaMapper.insertSelective(flowArea); } /** * 更新一条记录 * * @param flowArea * @return */ @Override public int update(FlowArea flowArea) { return flowAreaMapper.updateByPrimaryKeySelective(flowArea); } /** * 查询符合条件的记录总数 * * @param flowArea * @return */ @Override public int countByParam(FlowArea flowArea) { return 0; } /** * 查询符合条件的记录 * @param flowArea * @return */ public FlowArea findOneByParam(FlowArea flowArea) { List<FlowArea> flowAreaList = flowAreaMapper.select(flowArea); if(flowAreaList != null && flowAreaList.size() > 0){ return flowAreaList.get(0); } return null; } /** * 查询符合条件的记录列表 * * @param paramPagerVo * @return */ @Override public List<FlowArea> findListByParam(FlowAreaParamPagerVo paramPagerVo) { Example example = new Example(FlowArea.class); Example.Criteria criteria = example.createCriteria(); String dateField = paramPagerVo.getDateField(); if(StringUtils.isEmpty(dateField)){ dateField = "date"; } if(!StringUtils.isEmpty(paramPagerVo.getChooseDate()) && paramPagerVo.getChooseDate().contains(" - ")){ String[] chooseDates = paramPagerVo.getChooseDate().split(" - "); criteria.andLessThanOrEqualTo(dateField, chooseDates[1]); criteria.andGreaterThanOrEqualTo(dateField, chooseDates[0]); } if(!StringUtils.isEmpty(paramPagerVo.getMerchantId())){ criteria.andEqualTo("merchantId", paramPagerVo.getMerchantId()); } if(StringUtils.hasText(paramPagerVo.getPlatformName())){ if("OTHER".equals(paramPagerVo.getPlatformName())) { List<String> list = new ArrayList<>(); list.add("PC"); list.add("WAP"); criteria.andNotIn("platformName", list); }else{ criteria.andEqualTo("platformName", paramPagerVo.getPlatformName()); } } if(StringUtils.hasText(paramPagerVo.getAdvertiseActive())){ criteria.andLike("advertiseActive", "%" + paramPagerVo.getAdvertiseActive() + "%"); } if(StringUtils.hasText(paramPagerVo.getSource())){ criteria.andEqualTo("source", paramPagerVo.getSource()); } List<FlowArea> flowAreaList = flowAreaMapper.selectByExample(example); return flowAreaList; } /** * 查询符合条件的记录列表(分页查询) * * @param paramPagerVo * @return */ @Override public PageInfo<FlowArea> findPagerByParam(FlowAreaParamPagerVo paramPagerVo) { PageHelper.startPage(paramPagerVo.getPageNo(), paramPagerVo.getPageSize()); Example example = new Example(FlowArea.class); Example.Criteria criteria = example.createCriteria(); if(StringUtils.hasText(paramPagerVo.getColumnFieldIds())) { example.selectProperties(paramPagerVo.getColumnFieldIds().split(",")); } if(!StringUtils.isEmpty(paramPagerVo.getChooseDate()) && paramPagerVo.getChooseDate().contains(" - ")){ String[] chooseDates = paramPagerVo.getChooseDate().split(" - "); criteria.andLessThanOrEqualTo("date", chooseDates[1]); criteria.andGreaterThanOrEqualTo("date", chooseDates[0]); } example.setOrderByClause("date desc"); List<FlowArea> flowAreaList = flowAreaMapper.selectByExample(example); PageInfo<FlowArea> pageInfo = new PageInfo<>(flowAreaList); return pageInfo; } }
[ "lijia901@163.com" ]
lijia901@163.com
81268ebd74ea86dbf68da6054e0025c78cbc93f1
39b7b0c2726d87f42275ffb834962ec33da7d553
/xstampp-spring/xstampp-service-auth/src/main/java/de/xstampp/service/auth/controller/AuthRestController.java
9168868fe6393dead50e01fd0f1a31cfc55f7908
[ "Apache-2.0" ]
permissive
duny31030/xstampp-4.0
90f1a253b95f2c8a4deecb3996ca1af443eefe09
b31e952bf98fc88ec579f0cb11a029769ef0e745
refs/heads/main
2023-03-22T02:30:26.493074
2021-03-09T10:39:16
2021-03-09T10:39:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,473
java
package de.xstampp.service.auth.controller; import java.io.IOException; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import de.xstampp.common.utils.DeserializationUtil; import de.xstampp.common.utils.SerializationUtil; import de.xstampp.service.auth.dto.LoginRequestDTO; import de.xstampp.service.auth.dto.ProjectTokenRequestDTO; import de.xstampp.service.auth.dto.RegisterRequestDTO; import de.xstampp.service.auth.service.AuthenticationService; @RestController @RequestMapping("/api/auth") public class AuthRestController { SerializationUtil ser = new SerializationUtil(); DeserializationUtil deSer = new DeserializationUtil(); @Autowired AuthenticationService service; @RequestMapping(value = "/register", method = RequestMethod.POST) public String register(HttpServletRequest request, HttpServletResponse response, @RequestBody String body) throws IOException { RegisterRequestDTO register = deSer.deserialize(body, RegisterRequestDTO.class); return ser.serialize(service.register(register)); } @RequestMapping(value = "/login", method = RequestMethod.POST) public String login(@RequestBody String body, @RequestHeader HttpHeaders headers) throws IOException { LoginRequestDTO login = deSer.deserialize(body, LoginRequestDTO.class); return ser.serialize(service.login(login)); } @RequestMapping(value = "/project-token", method = RequestMethod.POST) public String projectToken(@RequestBody String body, @RequestHeader HttpHeaders headers) throws IOException { ProjectTokenRequestDTO projectToken = deSer.deserialize(body, ProjectTokenRequestDTO.class); return ser.serialize(service.projectToken(projectToken)); } @RequestMapping(value = "/unlock/{userid}/{unlockToken}", method = RequestMethod.POST) public void unlockToken(@PathVariable("userid") String userid, @PathVariable UUID unlockToken) { service.unlockPermalockedUser(unlockToken, UUID.fromString(userid)); } }
[ "stefan.wagner@iste.uni-stuttgart.de" ]
stefan.wagner@iste.uni-stuttgart.de
14778269dbc8b02d31d9a5cddfcf194b51c5238c
951df3564890a73556de926738275682a16e5b89
/distribucion/Instancia.java
ad7322833b8dda9d2cd4ecb682a2c62bae156c80
[]
no_license
NatiMedina/MapaDistribucion
783b56385ad7eb97d5ffbe43f29f148079213cc4
4068d85de9d40a0a87faca9b5d26dd0e0407986e
refs/heads/main
2023-03-01T18:35:48.994173
2021-01-29T00:16:54
2021-01-29T00:16:54
333,991,313
0
0
null
null
null
null
UTF-8
Java
false
false
1,351
java
package distribucion; import java.util.ArrayList; public class Instancia { private ArrayList<Cliente> clientes; private ArrayList<CentroDistribucion> centros; private int k; public Instancia() { this.clientes = new ArrayList<Cliente>(); this.centros = new ArrayList<CentroDistribucion>(); this.k = 0; } public Instancia(ArrayList<Cliente> clientes, ArrayList<CentroDistribucion> centros, int k) { this.clientes = clientes; this.centros = centros; this.k = k; } @SuppressWarnings("unchecked") public ArrayList<CentroDistribucion> getCentros() { return (ArrayList<CentroDistribucion>) centros.clone(); } public int getK() { return k; } public ArrayList<Cliente> getClientes() { return clientes; } public void setClientes(ArrayList<Cliente> clientes) { this.clientes = clientes; for (CentroDistribucion centroDistribucion : this.centros) { centroDistribucion.distanciaMedia(clientes); } } public void setCentros(ArrayList<CentroDistribucion> centros) { this.centros = centros; for (CentroDistribucion centroDistribucion : this.centros) { centroDistribucion.distanciaMedia(clientes); } } public void setK(int k) { this.k = k; } public int getCantidadDeCentros() { if(this.centros == null || this.centros.isEmpty()) { return 0; } return this.centros.size(); } }
[ "natymedina0589@gmail.com" ]
natymedina0589@gmail.com
e0449ee930ccdf601d681a52f45c87b84d9b146d
59ca721ca1b2904fbdee2350cd002e1e5f17bd54
/aliyun-java-sdk-smartag-inner/src/main/java/com/aliyuncs/smartag_inner/transform/v20180313/InnerModifySmartAGStateResponseUnmarshaller.java
7701ef884f3f225289f4bfafd5d6b9abf9834d5e
[ "Apache-2.0" ]
permissive
longtx/aliyun-openapi-java-sdk
8fadfd08fbcf00c4c5c1d9067cfad20a14e42c9c
7a9ab9eb99566b9e335465a3358553869563e161
refs/heads/master
2020-04-26T02:00:35.360905
2019-02-28T13:47:08
2019-02-28T13:47:08
173,221,745
2
0
NOASSERTION
2019-03-01T02:33:35
2019-03-01T02:33:35
null
UTF-8
Java
false
false
1,135
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.smartag_inner.transform.v20180313; import com.aliyuncs.smartag_inner.model.v20180313.InnerModifySmartAGStateResponse; import com.aliyuncs.transform.UnmarshallerContext; public class InnerModifySmartAGStateResponseUnmarshaller { public static InnerModifySmartAGStateResponse unmarshall(InnerModifySmartAGStateResponse innerModifySmartAGStateResponse, UnmarshallerContext context) { innerModifySmartAGStateResponse.setRequestId(context.stringValue("InnerModifySmartAGStateResponse.RequestId")); return innerModifySmartAGStateResponse; } }
[ "yixiong.jxy@alibaba-inc.com" ]
yixiong.jxy@alibaba-inc.com
c0a919d797b2eb24a1d50957981b29a77ebfb52c
475a41231c1853cdd7210f5884dd03517cbbf6c6
/160-相交链表/src/main/java/Solution.java
0483008f96e702ffe931287d38adc40cbcbf4617
[]
no_license
ColdPepsi/Leetcode
dd349c1ddf3187ecbc32c0ddee9fff59e405ed89
1adac49f864bf57b0db41dbd6616d3b4cc5ebf19
refs/heads/master
2021-02-24T22:29:58.713247
2020-12-16T08:44:12
2020-12-16T08:44:12
245,442,512
9
6
null
null
null
null
UTF-8
Java
false
false
467
java
import entity.ListNode; /** * @author WuBiao * @date 2020/3/3 16:03 */ public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if (headA == null || headB == null) { return null; } ListNode p = headA; ListNode q = headB; while (p != q) { p = ((p == null) ? headB : p.next); q = ((q == null) ? headA : q.next); } return p; } }
[ "wubiao@mail.ustc.edu.cn" ]
wubiao@mail.ustc.edu.cn
2e79a6795364ea87d7715776a1892051536ae7d1
c29354ad2be896d9db55741c335007c38a80b4fa
/src/test/java/test/LoginTest.java
f834f7a761ae2221e29c0a0391de10ff18d08e00
[]
no_license
subramanian1611/selenium-datadriven
0ca418f14c59e2a8d45feeb3094d5deddd9579b5
d6fc901ec49b58046930d7bed7017898673a1add
refs/heads/master
2022-11-09T17:29:54.288338
2020-06-29T22:35:12
2020-06-29T22:35:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,030
java
package test; import static org.testng.Assert.assertTrue; import java.util.Map; import org.openqa.selenium.By; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import pom.Login; public class LoginTest extends BaseTest { String expectedEmailErrorHeader = "There was a problem"; String expectedEmailErrorMessage = "We cannot find an account with that email address"; String expectedPhoneErrorHeader = "Incorrect phone number"; String expectedPhoneErrorMessage = "We cannot find an account with that mobile number"; @Parameters({"invalidEmailId"}) @Test(description = "Test to validate login functionality with invalid email id") public void invalidEmailValidation(String emailId) { Login login = new Login(driver); Map<String, String> result = login.invalidLoginMessage(emailId); assert(expectedEmailErrorHeader.equals(result.get("errorHeader"))); assert(expectedEmailErrorMessage.equals(result.get("errorMessage"))); } @Parameters({"invalidPhoneNumber"}) @Test(description = "Test to validate login functionality with invalid mobile number") public void invalidPhoneValidation(String invalidPhoneNumber) { Login login = new Login(driver); Map<String, String> result = login.invalidLoginMessage(invalidPhoneNumber); assert(expectedPhoneErrorHeader.equals(result.get("errorHeader"))); assert(expectedPhoneErrorMessage.equals(result.get("errorMessage"))); } @Parameters({"validUsername", "validPassword"}) @Test(description = "Test to validate login functionality with valid username/password", enabled = false) public void validEmailLoginValidation(String username, String password) { String welcomeString = "Hi, Ramesh"; By welcomeMessage = By.xpath("//span[@class='nav-line-3']"); Login login = new Login(driver); login.successfulLogin(username, password); String actualWelcomeString = driver.findElement(welcomeMessage).getText(); System.out.println(actualWelcomeString); assertTrue(welcomeString.equals(welcomeString)); login.logout(); } }
[ "ramesharpu@gmail.com" ]
ramesharpu@gmail.com
82ed591caceaadbdf9f3c1a5e6a3362b2176f66b
8a0c96bc65072b224400b55788ae5d69ed5fc8ea
/Documents/workspaceMarouane/Reservation_ICC/src/main/java/icc/be/dao/LocalityRepository.java
9804908c0691c8213ba261f3456f9cc8f279f870
[]
no_license
MrOne11/R-servation
a3bb82bd3a6dc7d803c77a971c3530ce0c264cfa
715ef0e66307a03bb3ca5d2cc25c52263566a318
refs/heads/master
2020-03-27T20:36:20.871965
2018-09-11T12:10:46
2018-09-11T12:10:46
147,080,356
0
0
null
null
null
null
UTF-8
Java
false
false
642
java
package icc.be.dao; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import icc.be.entites.Locality; public interface LocalityRepository extends JpaRepository<Locality, Long>{ public Locality findByPostalCode(String postalCode); public Locality findByName(String name); @Query("select l from Locality l where l.name like :x") public Page<Locality> chercherLocality(@Param("x") String motcle, Pageable pageable); }
[ "Mohamed@192.168.1.23" ]
Mohamed@192.168.1.23
488a6ddca803749e06e417f01ea5a3fafb3ee90f
fa62a17b0858131efcb454cba1b642807e08f755
/src/org/step/inheritance/BaseCourse.java
44187e7b128e8aeecc99c6b12d10364f97c0aa3e
[]
no_license
vdanke/LectionTask
3c555fc09ba4b2d2d3731c35be045c344ef66599
e9d2615ad6f56b4539dceaa879212baa33a50847
refs/heads/master
2022-04-25T23:33:30.108174
2020-04-29T15:36:51
2020-04-29T15:36:51
259,966,861
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package org.step.inheritance; public class BaseCourse extends Course { private volatile String myString; public static String publicStr; transient final String defaultString = ""; public BaseCourse() { } public BaseCourse(String myString) { this.myString = myString; } @Override public void inject(String str) { } public static String getString(Integer integer) { return Integer.toString(integer); } }
[ "vielendanke1991@gmail.com" ]
vielendanke1991@gmail.com
148bdc116b0d276ea31598bf227d7e7a1bcef4ba
5ab3c1077003283aa1b92fea0f369a7f7b510399
/foreachdirectory/Test.java
f767fa2b0d2d9556832692c0da888d4944308bff
[]
no_license
grouphy/IO
2242b1a0835ba2c66d3a04c9fe02eb6ceebe5876
d16e07a92dc0cb35226c390d4367460d7196fa23
refs/heads/master
2022-11-12T01:19:57.181158
2019-05-17T15:27:03
2019-05-17T15:27:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,268
java
package dkc.foreachdirectory; import java.io.File; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; /** * Created With IntelliJ IDEA. * Descriptions: * User:Mr.Du * Date:2019-05-17 * Time:14:26 */ public class Test { static int i; public static void main(String[] args) throws IOException { Path start = FileSystems.getDefault().getPath("E:"+ File.separator+"前端代码"); Files.walk(start) .filter(path -> path.toFile().isFile()) .filter(path -> path.toString().endsWith(".html")) .forEach(System.out::println); System.out.println("============================="); printFile(new File("E:"+ File.separator+"前端代码")); System.out.println("ttssggs.jpg".endsWith(".html")); } public static void printFile(File file){ if(file.isDirectory()){ File[] file1 = file.listFiles(); for(File file2 : file1){ if(file2!=null){ printFile(file2); } } }else{ if(file.toString().endsWith(".html")){ System.out.println(++i+","+file); } } } }
[ "2822365215@qq.com" ]
2822365215@qq.com
6e4b295b88383339d6c9826217542eab3b5a1da1
6547c41c640021b5870255377e5c41ccd585107e
/279. PerfectSquares/Solution.java
977cf56589f015b54f2534e1c2e24da990ba3207
[]
no_license
malikKartik/my-leetcode-solutions
fff6815621010bda8eb46b7cc5d47cd0c6f35ded
ab0ac1f697052af611d5aa4e37b8d3ffba148ab0
refs/heads/master
2022-07-04T23:16:21.808414
2020-05-13T15:27:24
2020-05-13T15:27:24
263,343,118
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
class Solution { public int numSquares(int n) { int num = (int)Math.sqrt(n); int[] vals = new int[num]; for(int i = 1;i<=num;i++){ vals[i-1] = i*i; } int[] dp = new int[n+1]; Arrays.fill(dp,n+1); dp[0] = 0; for(int i = 1;i<=n;i++){ for(int j = 0;j<vals.length;j++){ if(i>=vals[j]){ dp[i] = Math.min(dp[i],1+dp[i-vals[j]]); } } // System.out.println(dp[i]); } return dp[n]>n?-1:dp[n]; } }
[ "kartikmalik019@gmail.com" ]
kartikmalik019@gmail.com
dac33fb3288231c823cb8903730ac7832c1a71c0
caa6c93c041d200c5ca39cc4eef239639bf3aa36
/gmall-api/src/main/java/com/atguigu/gmall/sms/service/FlashPromotionLogService.java
5afad748068c7baa5666e3e4e3c9f3f6afd575df
[]
no_license
JiangKcoder/gmall-1111
193897a3762b2d6e98edfba2fb66c093330919a6
82918f4b0e2a8f9368ea5af539dd4adfe89ce656
refs/heads/master
2022-07-17T19:26:23.610749
2020-02-24T12:38:11
2020-02-24T12:38:17
242,657,125
0
0
null
2022-06-21T02:51:20
2020-02-24T05:50:55
Java
UTF-8
Java
false
false
342
java
package com.atguigu.gmall.sms.service; import com.atguigu.gmall.sms.entity.FlashPromotionLog; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 限时购通知记录 服务类 * </p> * * @author 凯锅锅 * @since 2020-02-24 */ public interface FlashPromotionLogService extends IService<FlashPromotionLog> { }
[ "472506877@qq.com" ]
472506877@qq.com
57652e195269717aa889d9ba1befcd1411095747
f2a82dfdcce4cb798061fdc419c035dff0729666
/ast/java/ASTTypeBound.java
8245ffb5bbbe6c607668c5ca30aed2cbe6a04aab
[]
no_license
wls860707495/SSDM
dd5b32d17efdbb8dfa2aac20fc1235e1d421b38e
e3ea82037d9f003e5c2c6af964cdb1bb5216e305
refs/heads/main
2023-01-31T19:48:41.363097
2020-12-11T12:28:12
2020-12-11T12:28:12
320,559,122
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
/* Generated By:JJTree: Do not edit this line. ASTTypeBound.java */ package softtest.ast.java; public class ASTTypeBound extends SimpleJavaNode { public ASTTypeBound(int id) { super(id); } public ASTTypeBound(JavaParser p, int id) { super(p, id); } /** * Accept the visitor. * */ @Override public Object jjtAccept(JavaParserVisitor visitor, Object data) { return visitor.visit(this, data); } }
[ "noreply@github.com" ]
wls860707495.noreply@github.com
d9eb1525b0e85cb3e9f333aeb7c207035dcfb6c9
d14ccdcc21a01ca1ed819e2ecaea9947cf9d60b2
/app/src/test/java/com/example/mac/homework6/ExampleUnitTest.java
a1e858b88377f62d31692ae7b573702622fb9544
[]
no_license
fcu-d0440686/Android-HW6
6d3b8fd652a1badf42496bddcd61042688f3116d
cb9066a2babea7a8de82ddf0b8ee82675df3ca15
refs/heads/master
2021-01-20T15:19:48.718068
2017-05-09T17:11:05
2017-05-09T17:11:05
90,757,085
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.mac.homework6; 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); } }
[ "d0440686@fcu.edu.tw" ]
d0440686@fcu.edu.tw
6d1c87c941c8a270c30c5d038b4a71df80e5ad80
bfad723634e556bad74c221d4fe9dff5588fc33e
/ITtalents/OOP_Task_Targovci/src/Shops/MallShop.java
0e5c025b08da25a08c6d58adbbe2397e148b7a1d
[]
no_license
vinispasov/EclipseProjects
f808301475d1c992146847638760f254cf1e666c
f1d0becf1e249dedcf8df4abd32876fc2a75536b
refs/heads/master
2020-03-25T12:35:08.921258
2018-08-06T21:30:54
2018-08-06T21:30:54
143,783,459
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
package Shops; public class MallShop extends CommercialSite{ public MallShop(String addres, String workingHours, int area) { super(addres, workingHours, area); this.tax=150; } }
[ "vinchenco10@abv.bg" ]
vinchenco10@abv.bg
eee27b640a5d2b02ca5a7c79f197f4ab0c35a46d
3f9077e87884b498a1057fc981e68312c1c19081
/src/main/java/web/Model/User.java
b85323ca5cb0270a9e75d1f54ad2a12d551085cc
[]
no_license
kengyry/3.1.3_SpringREST_JS
6455af0a12b476e1d14fe74d33ec5d9872d2d19f
4b10f536329d1cb19ce6be519d3df95dd72c9789
refs/heads/master
2023-01-11T03:58:06.357619
2020-11-16T08:54:53
2020-11-16T08:54:53
313,240,910
0
0
null
null
null
null
UTF-8
Java
false
false
3,342
java
package web.Model; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import javax.persistence.*; import java.util.Collection; import java.util.HashSet; import java.util.Set; @Entity @Component @Table(name = "users") public class User implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "name") private String firstName; @Column(name = "last_name", unique = true) private String lastName; @Column private String email; @Column private String password; @ManyToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER) @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles = new HashSet<>(); public User() { } public void setRoles(String roles) { if (roles.contains("ADMIN")) { this.roles.add(new Role("ROLE_ADMIN")); } if (roles.contains("USER")) { this.roles.add(new Role("ROLE_USER")); } } public User(String firstName, String lastName, String email, String password, Set<Role> roles) { this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; this.roles = roles; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } 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 String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @JsonIgnore @Override public Collection<? extends GrantedAuthority> getAuthorities() { return roles; } @JsonIgnore @Override public String getPassword() { return password; } @JsonIgnore @Override public String getUsername() { return lastName; } @JsonIgnore @Override public boolean isAccountNonExpired() { return true; } @JsonIgnore @Override public boolean isAccountNonLocked() { return true; } @JsonIgnore @Override public boolean isCredentialsNonExpired() { return true; } @JsonIgnore @Override public boolean isEnabled() { return true; } public void setPassword(String password) { this.password = password; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } @Override public String toString() { return "User{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", password='" + password + '\'' + ", roles=" + roles + '}'; } }
[ "kengyry.ken@yandex.ru" ]
kengyry.ken@yandex.ru
85a43bcb54468a7b3da7144e2f8d734cb282e03a
5f76ba032cf659a143eca444c01a7d2ab2806561
/Assignment1/app/src/main/java/com/example/esc/assignment1/PostAdapter.java
1036c3cc9b46d6e63080293ffa29f10b84fcf59a
[]
no_license
mohamedveron/Udacity_Assignment2
5600b65f19549b31c730cd394d927e6afa6e14e8
c3a96d7b2c5bffef90f7a5490d00d7ce7c75d522
refs/heads/master
2021-01-20T20:57:20.759475
2016-08-04T16:23:10
2016-08-04T16:23:10
64,949,266
0
0
null
null
null
null
UTF-8
Java
false
false
2,058
java
package com.example.esc.assignment1; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; import java.util.zip.Inflater; /** * Created by ESC on 8/2/2016. */ public class PostAdapter extends ArrayAdapter<Post> { public List<Post> objects; private Context context; public PostAdapter(Context context, int resource, List<Post> objects) { super(context, resource, objects); this.objects = objects; this.context = context; } @Override public int getCount() { return objects.size(); } @Override public Post getItem(int position) { return objects.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent){ PostHolder holder = null; View view = convertView; if(view == null){ LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.post,parent,false); holder = new PostHolder(view); view.setTag(holder); } else{ holder = (PostHolder)view.getTag(); } Post post = objects.get(position); holder.comments1.setText(post.getComments()); holder.likes1.setText(post.getLikes()); holder.shares1.setText(post.getShares()); holder.userName.setText(post.getName()); holder.post1.setText(post.getContent()); Picasso.with(context).load(post.getProfile()) .resize(100,100).centerCrop() .into(holder.profile1); Picasso.with(context).load(post.getPostImage()) .resize(300,300).centerCrop() .into(holder.postImage); return view; } }
[ "mohamedveron23@gmail.com" ]
mohamedveron23@gmail.com
b3a4b7fea07172175444a3402d8f0e6238a90507
5d645048ede70e8ff8d8bf6caa4661399646aef4
/src/main/java/seedu/savenus/storage/purchase/JsonSerializablePurchaseHistory.java
3fd87db817c0b18bcb04ba27e1fc94e2a6bc4973
[ "MIT" ]
permissive
Raikonen/main
2ecba3ca92eba2ad4e66e8876bfa0c8d387d854b
b0103ca6ff963bb16e5605f290b6b589556c18a0
refs/heads/master
2020-07-25T12:30:13.417734
2019-11-11T14:49:26
2019-11-11T14:49:26
208,290,108
0
0
NOASSERTION
2019-09-19T16:15:50
2019-09-13T15:12:34
Java
UTF-8
Java
false
false
2,083
java
package seedu.savenus.storage.purchase; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import seedu.savenus.commons.exceptions.IllegalValueException; import seedu.savenus.model.purchase.Purchase; import seedu.savenus.model.purchase.PurchaseHistory; import seedu.savenus.model.purchase.ReadOnlyPurchaseHistory; //@@author raikonen /** * An Immutable Purchase History that is serializable to JSON format. */ @JsonRootName(value = "savenus-purchases") public class JsonSerializablePurchaseHistory { private final List<JsonAdaptedPurchase> purchases = new ArrayList<>(); /** * Constructs a {@code JsonSerializablePurchaseHistory} with the given recommendations. */ @JsonCreator public JsonSerializablePurchaseHistory(@JsonProperty("purchases") List<JsonAdaptedPurchase> purchases) { this.purchases.addAll(purchases); } /** * Converts a given {@code ReadOnlyPurchaseHistory} into this class for Jackson use. * * @param source future changes to this will not affect the created {@code JsonSerializablePurchaseHistory}. */ public JsonSerializablePurchaseHistory(ReadOnlyPurchaseHistory source) { purchases.addAll(source.getPurchaseHistoryList().stream() .map(JsonAdaptedPurchase::new).collect(Collectors.toList())); } /** * Converts this PurchaseHistory into the model's {@code PurchaseHistory} object. * * @throws IllegalValueException if there were any data constraints violated. */ public PurchaseHistory toModelType() throws IllegalValueException { PurchaseHistory purchaseHistory = new PurchaseHistory(); for (JsonAdaptedPurchase jsonAdaptedPurchase : purchases) { Purchase purchase = jsonAdaptedPurchase.toModelType(); purchaseHistory.addPurchase(purchase); } return purchaseHistory; } }
[ "choozeyuan97@gmail.com" ]
choozeyuan97@gmail.com
6996c214276bbd31ac5a135abdf02783c0d5989b
03a02ab73a4b9be1015ee3aaae0f5514959eca9a
/src/main/java/prjava01/prjava01.java
6993956bffad9561ab3ff3bc20edfe4703e267fc
[]
no_license
wexu2021daw/prjava01
0e6d7df4aca7f12daa6f617ae596d904b55a5736
b23734807802ebb7de66ba2764a1ea3838af03ab
refs/heads/master
2023-01-31T06:24:29.564213
2020-12-13T23:41:42
2020-12-13T23:41:42
321,182,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
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 prjava01; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; /** * * @author wendy */ public class prjava01 { /** * @param args the command line arguments */ public static void main(String[] args) { File f = new File("fitxer.html"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(f))) { bw.write("<html>");bw.newLine(); bw.write(" <head>");bw.newLine(); bw.write(" <title>");bw.newLine(); bw.write(" Nova p&agrave;gina web");bw.newLine(); bw.write(" </title>");bw.newLine(); bw.write(" </head>");bw.newLine(); bw.write(" <body>");bw.newLine(); bw.write(" <h1>DAW2 m08uf4eac1</h1>");bw.newLine(); bw.write(" Nova p&agrave;gina web");bw.newLine(); bw.write(" </body>");bw.newLine(); bw.write("</html>");bw.newLine(); bw.close(); } } }
[ "wexu2021daw@protonmaill.com" ]
wexu2021daw@protonmaill.com
5d42efd4938c4a1352b6b03da248a2ba698453a6
91dfca9e91f299c1036c37c98bffd1922447c4e7
/newBusinessServices/src/com/csc/fsg/nba/business/process/NbaProcAppHold.java
635a31bcf9f85c8f1c99f9b23066867745522d46
[]
no_license
gajendrasinghthakur/SpringBootnMicroservices
7a1d016d932b70b13706ad13224d52c9488b7008
96b42b1250fb25a0b78f4ca088015d6ef07f1dd6
refs/heads/master
2020-07-03T10:54:19.565991
2019-08-12T08:57:01
2019-08-12T08:57:01
201,883,128
0
0
null
null
null
null
UTF-8
Java
false
false
49,801
java
package com.csc.fsg.nba.business.process; /* * ************************************************************** <BR> * This program contains trade secrets and confidential information which<BR> * are proprietary to CSC Financial Services Group�. The use,<BR> * reproduction, distribution or disclosure of this program, in whole or in<BR> * part, without the express written permission of CSC Financial Services<BR> * Group is prohibited. This program is also an unpublished work protected<BR> * under the copyright laws of the United States of America and other<BR> * countries. If this program becomes published, the following notice shall<BR> * apply: * Property of Computer Sciences Corporation.<BR> * Confidential. Not for publication.<BR> * Copyright (c) 2002-2008 Computer Sciences Corporation. All Rights Reserved.<BR> * ************************************************************** <BR> */ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; import com.csc.fs.accel.ui.AxaStatusDefinitionLoader; import com.csc.fs.accel.util.SortingHelper; import com.csc.fs.accel.valueobject.Comment; import com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess; import com.csc.fsg.nba.datamanipulation.NbaOinkRequest; import com.csc.fsg.nba.exception.AxaErrorStatusException; import com.csc.fsg.nba.exception.NbaAWDLockedException; import com.csc.fsg.nba.exception.NbaBaseException; import com.csc.fsg.nba.exception.NbaRequirementInfoException; import com.csc.fsg.nba.foundation.AxaStatusDefinitionConstants; import com.csc.fsg.nba.foundation.NbaConstants; import com.csc.fsg.nba.foundation.NbaOliConstants; import com.csc.fsg.nba.foundation.NbaUtils; import com.csc.fsg.nba.vo.NbaAwdRetrieveOptionsVO; import com.csc.fsg.nba.vo.NbaConfiguration; import com.csc.fsg.nba.vo.NbaDst; import com.csc.fsg.nba.vo.NbaLob; import com.csc.fsg.nba.vo.NbaProcessingErrorComment; import com.csc.fsg.nba.vo.NbaSource; import com.csc.fsg.nba.vo.NbaSuspendVO; import com.csc.fsg.nba.vo.NbaTXLife; import com.csc.fsg.nba.vo.NbaTransaction; import com.csc.fsg.nba.vo.NbaUserVO; import com.csc.fsg.nba.vo.statusDefinitions.Status; import com.csc.fsg.nba.vo.txlife.ApplicationInfoExtension; import com.csc.fsg.nba.vo.txlife.Holding; import com.csc.fsg.nba.vo.txlife.Policy; import com.csc.fsg.nba.vo.txlife.PolicyExtension; import com.csc.fsg.nba.vo.txlife.RequirementInfo; import com.csc.fsg.nba.vo.txlife.SystemMessage; import com.csc.fsg.nba.vo.txlife.SystemMessageExtension; import com.csc.fsg.nba.vpms.NbaVpmsAdaptor; import com.csc.fsg.nba.vpms.NbaVpmsAppHoldData; import com.csc.fsg.nba.vpms.NbaVpmsConstants; import com.csc.fsg.nba.vpms.NbaVpmsWorkItem; /** * NbaProcAppHold is the class that processes nbAccelerator cases found * on the AWD Application Hold queue (NBAPPHLD). It reviews the data associated * with a case to determine if the case can be moved to the next queue or if it * fails the application hold process. It invokes the VP/MS Application Hold model * to retrieve information about sources and work items to assist in the decision * making process. * <p>The NbaProcAppHold class extends the NbaAutomatedProcess class. * Although this class may be instantiated by any module, the NBA polling class * will be the primary creator of objects of this type. * When the polling process finds a case on the Application Hold queue, * it will create an object of this instance and call the object's * executeProcess(NbaUserVO, NbaDst) method. This method will manage the steps * necessary to evaluate the case and determine the next step for a case. * <p> * <b>Modifications:</b><br> * <table border=0 cellspacing=5 cellpadding=5> * <thead> * <th align=left>Project</th><th align=left>Release</th><th align=left>Description</th> * </thead> * <tr><td>NBA001</td><td>Version 1</td><td>Initial Development</td></tr> * <tr><td>SPR1018</td><td>Version 2</td><td>JavaDoc, comments and minor source code changes.</td></tr> * <tr><td>NBA021</td><td>Version 2</td><td>Data Resolver</td></tr> * <tr><td>NBA020</td><td>Version 2</td><td>AWD Priority</td></tr> * <tr><td>NBA027</td><td>Version 3</td><td>Performance Tuning</td></tr> * <tr><td>NBA044</td><td>Version 3</td><td>Architecture Changes</td></tr> * <tr><td>NBA050</td><td>Version 3</td><td>Pending Database</td></tr> * <tr><td>NBA033</td><td>Version 3</td><td>Companion Case and HTML Indexing Views</td></tr> * <tr><td>NBA087</td><td>Version 3</td><td>Post Approval & Issue Requirements</td></tr> * <tr><td>NBA093</td><td>Version 3</td><td>Upgrade to ACORD 2.8</td></tr> * <tr><td>NBA077</td><td>Version 4</td><td>Reissues and Complex Change</td></tr> * <tr><td>SPR1961</td><td>Version 4</td><td>AppHold automated process should ignore overriden validation messages.</td></tr> * <tr><td>ACN012</td><td>Version 4</td><td>Architecture Changes</td></tr> * <tr><td>ACN010</td><td>Version 4</td><td>Evaluation Control Model</td></tr> * <tr><td>NBA103</td><td>Version 4</td><td>Logging</td></tr> * <tr><td>SPR2380</td><td>Version 5</td><td>Cleanup</td></tr> * <tr><td>NBA119</td><td>Version 5</td><td>Automated Process Suspend</td></tr> * <tr><td>NBA122</td><td>Version 5</td><td>Underwriter Workbench Rewrite</td></tr> * <tr><td>NBA128</td><td>Version 5</td><td>Workflow Changes Project</td></tr> * <tr><td>NBA130</td><td>Version 6</td><td>Requirement/Reinsurance Changes</td></tr> * <tr><td>SPR2670</td><td>Version 6</td><td>Correction needed in Companion Case VP/MS model </td></tr> * <tr><td>SPR3223</td><td>Version 6</td><td>Application Hold Not Finding application form source</td></tr> * <tr><td>SPR2638</td><td>Version 7</td><td>Application Hold Automated Process Should Not Review Errors on Contract</td></tr> * <tr><td>NBA213</td><td>Version 7</td><td>Unified User Interface</td></tr> * <tr><td>SPR3362</td><td>Version 7</td><td>Exceptions in Automated Processes and Logon Service Due to VP/MS Memory Leak</td></tr> * <tr><td>NBA208-1 </td><td>Version 7</td><td>Performance Tuning and Testing - Deferred History Retrieval</td></tr> * <tr><td>NBA208-32</td><td>Version 7</td><td>Workflow VO Convergence</td></tr> * <tr><td>SPR3290</td><td>Version 7</td><td>General source code clean up during version 7</td></tr> * <tr><td>ALS5135</td><td>AXA Life Phase 1</td><td>QC # 4301 - AWD Error received on Application WI in App </td></tr> * <tr><td>ALNA219</td><td>AXA Life Phase 2</td><td>PERF - AppHold Improvement</td></tr> * <tr><td>ALII1816</td><td>Discretionary</td><td>Business Optimization - AppHold Suspend - User Notification</td></tr> * </table> * <p> * @author CSC FSG Developer * @version 7.0.0 * @since New Business Accelerator - Version 1 * @see NbaAutomatedProcess */ public class NbaProcAppHold extends NbaAutomatedProcess { /** The suspend value object to send the require parameters to suspend a case */ public com.csc.fsg.nba.vo.NbaSuspendVO suspendVO; protected static final String UNRESOLVED_CONTACT_VALIDATION_ERRORS = "Unresolved Contract Validation errors are present"; //NBLXA-1954 /** The maximum severity constant */ public final static int APP_HOLD_SEVERITY_MAXIMUM = 1; /** The OINK data access object used to retrieve the values from NbaTXLife or NbaLob objects using predefined variable names */ private com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess oinkData; /** The Vpms adaptor object which is the interface to the VPMS system */ private com.csc.fsg.nba.vpms.NbaVpmsAdaptor vpmsProxy = null; //SPR2380 removed logger /** * This constructor calls the superclass constructor which will set * the appropriate statues for the process. */ public NbaProcAppHold() { super(); } /** * This method drives the application hold process. * <P>After obtaining a reference to the NbaNetServerAccessor EJB * and retrieving the statuses to be used for the process through * user of the superclass' initialize method, it retrieves the * Holding Inquiry for the case and updates the case's NbaLob. * The NbaLob is then used to instantiate the NbaVpmsVO object * that will be used for calls to the Application Hold VPMS model. * <P>The process verifies that the severity of the holding inquiry * does not exceed limits established for Application Hold. If it does * the case fails Application Hold and is routed to a fail queue. * <P>Next, it invokes the verifySources method to ensure that all * required sources for the case are present. If not, the case is * suspend for a specific number of days. * <P>The third check determines if work items present on the case * are in the correct status and/or have correct values. If not, * the case is again suspended. * After these checks are made and processed, an <code>NbaAutomatedProcessResult</code> * is created and populated with values used by the polling process to * determine the success or failure of the case. The case is then updated * to move it to the next queue and the result returned to the poller. * @param user the user for whom the work was retrieved, in this case APAPPHLD. * @param work the AWD case to be processed * @return NbaAutomatedProcessResult containing the results of the process * @throws NbaBaseException */ public NbaAutomatedProcessResult executeProcess(NbaUserVO user, NbaDst work) throws NbaBaseException { // NBA027 - logging code deleted if (!initialize(user, work)) { return getResult(); // NBA050 } try { //SPR2638 code deleted NbaAwdRetrieveOptionsVO retOpt = new NbaAwdRetrieveOptionsVO(); retOpt.setWorkItem(getWork().getID(), true); retOpt.requestTransactionAsChild(); retOpt.requestSources(); //NBA208-1 code deleted retOpt.setLockWorkItem(); setWork(retrieveWorkItem(getUser(), retOpt)); //NBA213 if(getNbaTxLife().getPolicy().getPolicyStatus() != NbaOliConstants.OLI_POLSTAT_ISSUED) { //ALII2017 sendUserNotificationWork(); //ALII1816 } //ALII2017 if(result == null) { //ALII1816 oinkData = new NbaOinkDataAccess(getWork().getNbaLob()); oinkData.setContractSource(nbaTxLife); //NBA050 //NBA077 code deleted // Begin NBA130 try { if (!verifySources() || !verifyWorkItems()) { return result; } } catch (NbaRequirementInfoException nrie) { addComment(nrie.getMessage()); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.FAILED, "Application Hold Failed", getHostErrorStatus())); changeStatus(getResult().getStatus()); doUpdateWorkItem(); return result; } // End NBA130 //begin NBA033 NbaCompanionCaseRules rules = new NbaCompanionCaseRules(user, getWork()); if (rules.isSuspendNeeded(NbaVpmsConstants.APPLICATION_HOLD)) { //SPR2670 if(rules.isSuspendDurationWithinLimits()){ addComment("Work Item suspended: Waiting for other companion cases"); setSuspendVO(rules.getSuspendVO()); updateForSuspend(); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Suspended", "SUSPENDED")); } else { addComment("Suspend limit exceeded."); changeStatus(getFailStatus()); doUpdateWorkItem(); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Error", getFailStatus())); } } else { //end NBA033 changeStatus(getPassStatus()); resetLobFields(); getWork().getNbaLob().setAppHoldSuspDate(null); //NBA033 reset this LOB doUpdateWorkItem(); setPolicyStatus(); // NBLXA-1782 result = new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Successful", getPassStatus()); } } //ALII1816 return result; } catch (NbaAWDLockedException le) {//ALII1652 unlockWork(); throw le; } catch (NbaBaseException nbex) { //ALS5135 throw nbex; //ALS5135 } catch (Exception e) { NbaBaseException nbe = new NbaBaseException("An exception occured during Application Hold process", e); throw nbe; } } //NBLXA-1782 New Method protected void setPolicyStatus() throws NbaBaseException { NbaTXLife nbaTxLife = getNbaTxLife(); if (!NbaUtils.isBlankOrNull(nbaTxLife.getPolicy())) { PolicyExtension policyExtn = NbaUtils.getFirstPolicyExtension(nbaTxLife.getPolicy()); if (policyExtn != null) { long adminSysPolicyStatus = policyExtn.getAdminSysPolicyStatus(); if (adminSysPolicyStatus == NbaOliConstants.OLI_POLSTAT_ACTIVE && getPassStatus() != null && getPassStatus().equalsIgnoreCase(getWork().getNbaLob().getArchivedStatus())) { nbaTxLife.getPolicy().setPolicyStatus(NbaOliConstants.OLI_POLSTAT_ISSUED); nbaTxLife.getPolicy().setActionUpdate(); setContractAccess(UPDATE); doContractUpdate(); } } } } // APSL5370 New Method protected void routeWorkItem() { NbaTXLife nbaTxLife = getNbaTxLife(); if (!NbaUtils.isBlankOrNull(nbaTxLife.getPolicy())) { PolicyExtension policyExtn = NbaUtils.getFirstPolicyExtension(nbaTxLife.getPolicy()); if (policyExtn != null) { long adminSysPolicyStatus = policyExtn.getAdminSysPolicyStatus(); switch ((int) adminSysPolicyStatus) { case (int) NbaOliConstants.OLI_POLSTAT_TERMINATE: Status passStatus = AxaStatusDefinitionLoader.determinePassStatus("N2ISSUE", null); getWork().setStatus(passStatus.getStatusCode()); getWork().getNbaLob().setRouteReason(NbaUtils.getRouteReason(getWork(), getWork().getStatus())); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "", getWork().getStatus())); break; case (int) NbaOliConstants.OLI_POLSTAT_ACTIVE: getWork().setStatus(getWork().getNbaLob().getArchivedStatus()); getWork().getNbaLob().setRouteReason(NbaUtils.getRouteReason(getWork(), getWork().getStatus())); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "", getWork().getStatus())); break; default: System.out.println("Case Should not be suspended"); } } } } //ALII1998 New method public boolean existAllReqInENDQue() throws NbaBaseException { ListIterator li = getWork().getNbaTransactions().listIterator(); while (li.hasNext()) { NbaTransaction trans = (NbaTransaction) li.next(); if( A_WT_REQUIREMENT.equalsIgnoreCase(trans.getTransaction().getWorkType())) { if (!trans.getQueue().equalsIgnoreCase(END_QUEUE)) { return false; } } } return true; } //ALII1816 New method public void sendUserNotificationWork() throws NbaBaseException { NbaTXLife nbaTxLife = getNbaTxLife(); // ONLY Agent CV present, Verify if Agent Licence WI present on the case. If yes, pull the WI and route it to Agent Licence CM. If not, create // a WI and send it to the Agent LCM. if (isSevereAgentCVExists()) { createAgentLicWorkItem(); Map deOink = new HashMap(); deOink.put("A_AgentLicErrorPresent", "true"); NbaProcessStatusProvider statusProvider = new NbaProcessStatusProvider(getUser(), getWork(), nbaTxLife, deOink); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Agent CV present on case.", statusProvider.getPassStatus())); // Move // case // to // N2CMHLD changeStatus(getResult().getStatus()); addComment("Case sent to CM HOLD queue since Agent Licensing CV present on the case."); } // If (5002 CV and CWAAmt > 0) OR Any Severe. overridable CV present on the case (other than 5002 CV and Agent CV), // then Verify if Validation WI is present . If yes ,verify if it is aggregated to UWCM. If not, pull the WI and aggregate to UW. // if no Validation WI is present then create a new one and send it to UWCM . if (existAllReqInENDQue() && (isSevereNonAgentCVExists() && !only1778CVonCase())&& !checkCV1778forUnboundCase()) { // ALII1998 createValErrorWorkItem(); Map deOink = new HashMap(); deOink.put("A_ValidationErrorPresent", "true"); NbaProcessStatusProvider statusProvider = new NbaProcessStatusProvider(getUser(), getWork(), nbaTxLife, deOink); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Severe or Non-overridden CV present on case..", statusProvider.getPassStatus())); changeStatus(getResult().getStatus()); addComment("Case sent to CM HOLD queue since Validation CV present on the case."); }else if(checkCV1778forUnboundCase()){ suspendCaseForRegisterDate(); } // If Replacement Notification WI not in END queue and is in Replacement Hold queue- send it to RPCM with priority. b. If it is in ERROR // queue- keep it in same queue. NbaTransaction rplcNotifTrans = getRplcNotifNotInEnd(A_WT_REPL_NOTIFICATION); if (rplcNotifTrans != null) { // ALII1906 Code Cropped Map deOink = new HashMap(); deOink.put("A_RplcNotifNotInEND", "true"); NbaProcessWorkItemProvider workProvider = new NbaProcessWorkItemProvider(getUser(), getWork(), getNbaTxLife(), deOink); NbaAwdRetrieveOptionsVO retOpt = new NbaAwdRetrieveOptionsVO(); retOpt.setWorkItem(rplcNotifTrans.getID(), false); retOpt.setLockWorkItem(); NbaDst aWorkItem = retrieveWorkItem(getUser(), retOpt); if (rplcNotifTrans.getQueue().equalsIgnoreCase(PROC_REPL_PROCESSING)) { setPriorityandUpdate(aWorkItem, workProvider); // ALII1906 Redundant Code Moved to Method } else { // ALII1998 setPriorityOnly(aWorkItem, workProvider); // ALII1998 } NbaProcessStatusProvider statusProvider = new NbaProcessStatusProvider(getUser(), getWork(), nbaTxLife, deOink); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Replacement Notification WI not in END queue.", statusProvider.getPassStatus())); // Move case to N2CMHLD changeStatus(getResult().getStatus()); addComment("Case sent to CM HOLD queue since Replacement Notification workitem is not in END queue."); // deleted code - ALII1998 } // If Requirements in database are not in sync up with AWD status, move the case to NBERROR queue. if (isReqOutofSynch()) { // Code deleted for APSL3874 throw new AxaErrorStatusException(AxaStatusDefinitionConstants.VARIANCE_KEY_TECH_REQ_SYNCH); // APSL3874 } if (result != null) { doUpdateWorkItem(); } } //ALII1816 New method protected boolean isSevereAgentCVExists() { SystemMessage sysMessage; SystemMessageExtension systemMessageExtension; ArrayList messages = getNbaTxLife().getPrimaryHolding().getSystemMessage(); for (int i = 0; i < messages.size(); i++) { sysMessage = (SystemMessage) messages.get(i); if ((sysMessage.getMessageSeverityCode() == NbaOliConstants.OLI_MSGSEVERITY_SEVERE || sysMessage.getMessageSeverityCode() == NbaOliConstants.OLI_MSGSEVERITY_OVERIDABLE)//NBLXA-2280 && (sysMessage.getMessageCode() != MESSAGECODE_AGENTLIC_WI)){//APSL4234/QC15120 systemMessageExtension = NbaUtils.getFirstSystemMessageExtension(sysMessage); if (systemMessageExtension != null && systemMessageExtension.getMsgValidationType() == SUBSET_AGENT && !systemMessageExtension.getMsgOverrideInd()) { return true; } } } return false; } //ALII1816 New method protected boolean isSevereNonAgentCVExists() { SystemMessage sysMessage; SystemMessageExtension systemMessageExtension; ArrayList messages = getNbaTxLife().getPrimaryHolding().getSystemMessage(); for (int i = 0; i < messages.size(); i++) { sysMessage = (SystemMessage) messages.get(i); if (sysMessage.getMessageSeverityCode() == NbaOliConstants.OLI_MSGSEVERITY_SEVERE || sysMessage.getMessageSeverityCode() == NbaOliConstants.OLI_MSGSEVERITY_OVERIDABLE) { systemMessageExtension = NbaUtils.getFirstSystemMessageExtension(sysMessage); if (systemMessageExtension != null && systemMessageExtension.getMsgValidationType() != SUBSET_AGENT && !systemMessageExtension.getMsgOverrideInd() && getNbaTxLife().getPolicy().getApplicationInfo().getCWAAmt() > 0) { //ALII1909 return true; } } } return false; } //ALII1816 New method protected void createValErrorWorkItem() throws NbaBaseException { Map deOink = new HashMap(); deOink.put("A_ErrorSeverity", Long.toString(NbaOliConstants.OLI_MSGSEVERITY_SEVERE)); deOink.put("A_CreateValidationWI", "true"); NbaProcessWorkItemProvider workProvider = new NbaProcessWorkItemProvider(getUser(), getWork(), getNbaTxLife(), deOink); NbaTransaction validationTransaction = getTransaction(workProvider.getWorkType()); if(validationTransaction==null){ getWork().addTransaction(workProvider.getWorkType(), workProvider.getInitialStatus()); } else{ NbaAwdRetrieveOptionsVO retOpt = new NbaAwdRetrieveOptionsVO(); retOpt.setWorkItem(validationTransaction.getID(), false); retOpt.setLockWorkItem(); NbaDst aWorkItem = retrieveWorkItem(getUser(), retOpt); setPriorityandUpdate(aWorkItem,workProvider); //ALII1906 Redundant Code Moved to Method } } //ALII1816 New method protected void createAgentLicWorkItem() throws NbaBaseException { Map deOink = new HashMap(); // NBLXA-1337 -- Check For Licensing WI NbaTransaction nbaTrans =null; //NBLXA-1337 String appendRoutReason = NbaUtils.getAppendReason(getNbaTxLife()); retrieveLicWorkItem(getNbaTxLife()); if(licensingworkExists == false){ deOink.put("A_CreateAgentLicWI", "true"); NbaProcessWorkItemProvider workProvider = new NbaProcessWorkItemProvider(getUser(), getWork(), getNbaTxLife(), deOink); nbaTrans = getWork().addTransaction(workProvider.getWorkType(), workProvider.getInitialStatus()); if(nbaTrans !=null){ nbaTrans.getNbaLob().setRouteReason(nbaTrans.getNbaLob().getRouteReason()+" "+appendRoutReason); } }else if(licensingworkExists == true){ if(licensingworkInEndQueue == true && searchResultForLicWIVO !=null){ deOink.put("A_CreateAgentLicWIFromAppHold", "true"); retrieveExisitngLicensingWIFromEndQueue(getWork(),getNbaTxLife(),deOink); } } // NBLXA-1337 -- END /*if(agentLicTransaction==null){ NbaProcessWorkItemProvider workProvider = new NbaProcessWorkItemProvider(getUser(), getWork(), getNbaTxLife(), deOink); NbaTransaction agentLicTransaction = getTransaction(workProvider.getWorkType()); getWork().addTransaction(workProvider.getWorkType(), workProvider.getInitialStatus()); } else{ NbaAwdRetrieveOptionsVO retOpt = new NbaAwdRetrieveOptionsVO(); retOpt.setWorkItem(agentLicTransaction.getID(), false); retOpt.setLockWorkItem(); NbaDst aWorkItem = retrieveWorkItem(getUser(), retOpt); setPriorityandUpdate(aWorkItem,workProvider); //ALII1906 Redundant Code Moved to Method }*/ } //ALII1816 New method protected NbaTransaction getTransaction(String workType) throws NbaBaseException { List transactions = getWork().getNbaTransactions(); int count = transactions.size(); NbaTransaction nbaTransaction = null; for (int i = 0; i < count; i++) { nbaTransaction = (NbaTransaction) transactions.get(i); if (workType.equalsIgnoreCase(nbaTransaction.getWorkType())) { return nbaTransaction; } } return null; } //ALII1816 New method protected NbaTransaction getRplcNotifNotInEnd(String workType) throws NbaBaseException { List transactions = getWork().getNbaTransactions(); int count = transactions.size(); NbaTransaction nbaTransaction = null; for (int i = 0; i < count; i++) { nbaTransaction = (NbaTransaction) transactions.get(i); if (workType.equalsIgnoreCase(nbaTransaction.getWorkType()) && !nbaTransaction.isInEndQueue()) { return nbaTransaction; } } return null; } //ALII1816 New method public boolean isReqOutofSynch() throws NbaBaseException { int reqCount = 0; ListIterator li = getWork().getNbaTransactions().listIterator(); RequirementInfo reqInfo = null; while (li.hasNext()) { NbaTransaction trans = (NbaTransaction) li.next(); if( A_WT_REQUIREMENT.equalsIgnoreCase(trans.getTransaction().getWorkType())) { reqInfo = getNbaTxLife().getRequirementInfo(trans.getNbaLob().getReqUniqueID()); if (null == reqInfo) { return true; } reqCount++; } } if(reqCount != getNbaTxLife().getPolicy().getRequirementInfoCount()) { return true; } return false; } ///NBA103 - removed method /** * Insert the method's description here. * @return com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess */ public com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess getOinkData() { return oinkData; } /** * Answers the NbaSuspendVO created for the case. * @return NbaSuspendVO a populated suspend value object */ public NbaSuspendVO getSuspendVO() { return suspendVO; } /** * This method resets certain LOB fields to default values when * a case successfully passes the Application Hold process. * @throws NbaBaseException */ public void resetLobFields() throws NbaBaseException { if (getWork().getNbaLob().getNeedApplication() == true) { getWork().getNbaLob().setNeedApplication(false); } if (getWork().getNbaLob().getNeedCompWorkItem() == true) { getWork().getNbaLob().setNeedCompWorkItem(false); } if (getWork().getNbaLob().getNeedCwa() == true) { getWork().getNbaLob().setNeedCwa(false); } } /** * Insert the method's description here. * @param newOinkData com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess */ public void setOinkData(com.csc.fsg.nba.datamanipulation.NbaOinkDataAccess newOinkData) { oinkData = newOinkData; } /** * Sets the Nba suspend value object. * @param newSuspendVO */ public void setSuspendVO(NbaSuspendVO newSuspendVO) { suspendVO = newSuspendVO; } /** * This method will determine if the activate date time is exceeding allowable suspend time (i.e. * Initial suspend date in APHL LOB and the maximun suspend date from SXSD LOB). If activate date * time exceed this time than workitem routed to error queue else it is suspended for the given time. * It checks if SXSD LOB is not null if it is null than it will set it with maxSuspendDays. * It also checks whether APHL LOB is initialized or not, if not initialzed it with the currect date. * @param activateDateTime the activate date time * @param reason the reason the case is being suspended * @param maxAllowableDays the maximum allowable suspend days * @throws NbaBaseException */ //NBA119 added new parameter maxAllowableDays. Also changed type of activateDateTime //NBLXA-1954 Method overloaded public void suspendCase(Date activateDateTime, String reason, int maxAllowableDays,NbaTransaction transaction) throws NbaBaseException {//NBA119 getLogger().logDebug("Starting suspendCase"); //NBA044 // begin NBA119 NbaLob lob = getWork().getNbaLob(); StringBuffer newReason = new StringBuffer(); newReason.append("Case suspended due to "); newReason.append(reason); if (isDifferentReason(newReason.toString())) { lob.setMaxNumSuspDays(maxAllowableDays); getWork().setUpdate(); } //end NBA119 Date appHoldSusDate = getWork().getNbaLob().getAppHoldSuspDate(); if (appHoldSusDate == null) { appHoldSusDate = new Date(); lob.setAppHoldSuspDate(appHoldSusDate); //NBA119 getWork().setUpdate(); } GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(appHoldSusDate); // begin NBA119 int maxSuspendDays = lob.getMaxNumSuspDays(); if (-1 == maxSuspendDays) { maxSuspendDays = maxAllowableDays; lob.setMaxNumSuspDays(maxSuspendDays); getWork().setUpdate(); } calendar.add(Calendar.DAY_OF_WEEK, maxSuspendDays); //NBA027 //end NBA119 Date maxSuspendDate = (calendar.getTime()); if (maxSuspendDate.before(new Date())) { //NBA119 addComment("Case cannot be suspended. Suspend limit exceeded."); //NBA119 lob.deleteAppHoldSuspDate(); //NBA119 changeStatus(getFailStatus()); doUpdateWorkItem(); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Error", getFailStatus())); return; } //NBA020 code deleted suspendVO = new NbaSuspendVO(); suspendVO.setCaseID(getWork().getID()); // NBA119 code deleted suspendVO.setActivationDate(adjustSuspendTime(activateDateTime)); //NBA119 addComment(newReason.toString()); //NBA119 setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Suspended", "SUSPENDED")); if (reason.equalsIgnoreCase(UNRESOLVED_CONTACT_VALIDATION_ERRORS)) { updateForSuspend(); } else { updateForSuspend(getTransactionDst(transaction)); // NBLXA-1954 } } public void suspendCase(Date activateDateTime, String reason, int maxAllowableDays) throws NbaBaseException {//NBA119 getLogger().logDebug("Starting suspendCase"); //NBA044 // begin NBA119 NbaLob lob = getWork().getNbaLob(); StringBuffer newReason = new StringBuffer(); newReason.append("Case suspended due to "); newReason.append(reason); if (isDifferentReason(newReason.toString())) { lob.setMaxNumSuspDays(maxAllowableDays); getWork().setUpdate(); } //end NBA119 Date appHoldSusDate = getWork().getNbaLob().getAppHoldSuspDate(); if (appHoldSusDate == null) { appHoldSusDate = new Date(); lob.setAppHoldSuspDate(appHoldSusDate); //NBA119 getWork().setUpdate(); } GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(appHoldSusDate); // begin NBA119 int maxSuspendDays = lob.getMaxNumSuspDays(); if (-1 == maxSuspendDays) { maxSuspendDays = maxAllowableDays; lob.setMaxNumSuspDays(maxSuspendDays); getWork().setUpdate(); } calendar.add(Calendar.DAY_OF_WEEK, maxSuspendDays); //NBA027 //end NBA119 Date maxSuspendDate = (calendar.getTime()); if (maxSuspendDate.before(new Date())) { //NBA119 addComment("Case cannot be suspended. Suspend limit exceeded."); //NBA119 lob.deleteAppHoldSuspDate(); //NBA119 changeStatus(getFailStatus()); doUpdateWorkItem(); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Error", getFailStatus())); return; } //NBA020 code deleted suspendVO = new NbaSuspendVO(); suspendVO.setCaseID(getWork().getID()); // NBA119 code deleted suspendVO.setActivationDate(adjustSuspendTime(activateDateTime)); //NBA119 addComment(newReason.toString()); //NBA119 setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Suspended", "SUSPENDED")); updateForSuspend(); } /** * Since the case must be suspended before it can be unlocked, this method * is used instead of the superclass method to update AWD. * <P>This method updates the case in the AWD system, suspends the * case using the supsendVO, and then unlocks the case. * @throws NbaBaseException */ public void updateForSuspend() throws NbaBaseException { getLogger().logDebug("Starting updateForSuspend");//NBA044 //begin NBA213 getWork().getWorkItem().setWorkItemChildren(new ArrayList());//ALNA219 updateWork(getUser(), getWork()); suspendWork(getUser(), getSuspendVO()); unlockWork(getUser(), getWork()); //end NBA213 } //Begin NBLXA-1954 Method overloaded public void updateForSuspend(NbaDst transaction) throws NbaBaseException { getLogger().logDebug("Starting updateForSuspend transaction");//NBA044 //begin NBA213 getWork().getWorkItem().setWorkItemChildren(new ArrayList());//ALNA219 updateWork(getUser(), transaction); updateWork(getUser(), getWork()); suspendWork(getUser(), getSuspendVO()); unlockWork(getUser(), getWork()); //end NBA213 } // End NBLXA-1954 // Change suspend duration for paid re-issue/Issued policies QC16262 public Date adjustSuspendTime(Date activateDateTime) { boolean isPaidReissue = getNbaTxLife().isPaidReIssue(); ApplicationInfoExtension appInfoExt = NbaUtils.getFirstApplicationInfoExtension(getNbaTxLife().getPolicy().getApplicationInfo()); if(isPaidReissue || (appInfoExt!= null && appInfoExt.getIssuedToAdminSysInd() ) ) { Calendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); calendar.add(Calendar.HOUR,12); return calendar.getTime(); } else { return activateDateTime; } } //SPR2638 code deleted /** * This method verifies that the source(s) required for an application * are present within the AWD system. If not, then the case will be * suspended for a set number of days. * @return boolean true indicates sources present and verified; false indicates * failure and that the case should be suspended * @throws NbaBaseException */ public boolean verifySources() throws NbaBaseException { getLogger().logDebug("Starting verifySources"); //NBA044 // get the sources needed from VPMS try { vpmsProxy = new NbaVpmsAdaptor(oinkData, NbaVpmsAdaptor.APPLICATION_HOLD); // NBA077 vpmsProxy.setVpmsEntryPoint(NbaVpmsAdaptor.EP_GET_SOURCES); //Begin ACN010 Map deOinkMap = new HashMap(); deOinkMap.put("A_INSTALLATION", getInstallationType()); deOinkMap.put(A_UNDERWRITER_WORKBENCH_APPLET, Boolean.toString(NbaConfiguration.getInstance().isUnderwriterWorkbenchApplet())); //NBA122 vpmsProxy.setSkipAttributesMap(deOinkMap); //End ACN010 NbaVpmsAppHoldData data = new NbaVpmsAppHoldData(vpmsProxy.getResults()); // data contains the required sources for an application // if a source is not present in the list of Nba Sources, then it fails and we // suspend for the set number of days. for (int i = 0; i < data.getWorkItems().size(); i++) { boolean sourcePresent = false; NbaVpmsWorkItem vpmsItem = (NbaVpmsWorkItem) data.getWorkItems().get(i); //NBA119 // for each work item, see if it is present in the list of sources for this List sources = getWork().getNbaCase().getAllNbaSources(); //SPR3223 for (int j = 0; j < sources.size(); j++) { NbaSource aSource = (NbaSource) sources.get(j); if (aSource.getSource().getSourceType().equals(vpmsItem.getSource())) { //NBA119, NBA128, SPR3290 sourcePresent = true; break; } } if (!sourcePresent) { getWork().getNbaLob().setNeedApplication(true); //ALII1816 // If Application Source is not present, Aggregate Contract WI will be created and sent to UWCM. if(vpmsItem.getSource() != null && vpmsItem.getSource().equalsIgnoreCase(A_ST_APPLICATION)){ //ALII1816 if (getLogger().isDebugEnabled()) { getLogger().logDebug("Case aggregated for UWCM since Application Source was not present."); } Map deOink = new HashMap(); deOink.put("A_AppSourceMissing", "true"); NbaProcessStatusProvider statusProvider = new NbaProcessStatusProvider(getUser(), getWork(), nbaTxLife, deOink); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Application Source is missing.", statusProvider.getPassStatus())); addComment("Case aggregated for UWCM since Application Source was not present."); changeStatus(statusProvider.getPassStatus()); getWork().setUpdate(); update(getWork()); } else { //ALII1816 if (getLogger().isDebugEnabled()) { // NBA027 getLogger().logDebug("Suspend for " + vpmsItem.getActivateDateTime()); //NBA119 } // NBA027 suspendCase(vpmsItem.getActivateDateTime(), vpmsItem.getSource() + " not present", vpmsItem.getMaxSuspendDays()); //NBA119, NBA128 //SPR3362 code deleted } return false; } } //begin NBA077 ListIterator li = getWork().getNbaTransactions().listIterator(); while (li.hasNext()) { NbaTransaction trans = (NbaTransaction) li.next(); oinkData = new NbaOinkDataAccess(trans.getNbaLob()); vpmsProxy.setOinkSurrogate(oinkData); data = new NbaVpmsAppHoldData(vpmsProxy.getResults()); if (data.wasSuccessful()) { for (int i = 0; i < data.getWorkItems().size(); i++) { boolean sourcePresent = false; NbaVpmsWorkItem vpmsItem = (NbaVpmsWorkItem) data.getWorkItems().get(i); //NBA119 // for each work item, see if it is present in the list of sources for this List sources = trans.getNbaSources(); String source = ((NbaVpmsWorkItem) data.getWorkItems().get(i)).getSource(); //NBA119 SPR3290 for (int j = 0; j < sources.size(); j++) { NbaSource aSource = (NbaSource) sources.get(j); if (aSource.getSource().getSourceType().equals(source)) { sourcePresent = true; break; } } if (!sourcePresent) { //If case is Reissue case and Contract Change Source is not present, Aggregate Contract WI will be created and sent to PCCM. if(vpmsItem.getSource() != null && vpmsItem.getSource().equalsIgnoreCase(A_ST_CHANGE_FORM)){ //ALII1816 if (getLogger().isDebugEnabled()) { getLogger().logDebug("Case sent to PCCM since Contract Change Form Source was not present."); //ALII1816 } Map deOink = new HashMap(); deOink.put("A_CntChgSourceMissing", "true"); NbaProcessStatusProvider statusProvider = new NbaProcessStatusProvider(getUser(), getWork(), nbaTxLife, deOink); setResult(new NbaAutomatedProcessResult(NbaAutomatedProcessResult.SUCCESSFUL, "Contract Change Form Source is missing.", statusProvider.getPassStatus())); addComment("Case sent to PCCM since Contract Change Form Source was not present."); //ALII1816 changeStatus(statusProvider.getPassStatus()); getWork().setUpdate(); update(getWork()); } else { //ALII1816 if (getLogger().isDebugEnabled()) { // NBA027 getLogger().logDebug("Suspend for " + ((NbaVpmsWorkItem) data.getWorkItems().get(i)).getActivateDateTime()); }// NBA027 suspendCase(vpmsItem.getActivateDateTime(), vpmsItem.getWorkItem() + " not present", vpmsItem.getMaxSuspendDays()); //NBA119 //SPR3362 code deleted } return false; } // APSL4813 :: START -- APP WI should not move and suspend until CWA is not END Queue if( A_WT_CWA.equalsIgnoreCase(trans.getTransaction().getWorkType())) { if (!END_QUEUE.equalsIgnoreCase(trans.getQueue())) { suspendCase(vpmsItem.getActivateDateTime(), trans.getTransaction().getWorkType(), vpmsItem.getMaxSuspendDays(),trans); //NBA119,NBLXA-1954 return false; } } // APSL4813 :: END } } } //SPR3362 code deleted //end NBA077 return true; } catch (Exception e) { NbaBaseException nbe = new NbaBaseException("AppHold problem", e); throw nbe; } catch (Throwable t) { throw new NbaBaseException("AppHold problem", t); //SPR3362 code deleted } finally { try { if (vpmsProxy != null) { vpmsProxy.remove(); } } catch (Exception e) { getLogger().logError(NbaBaseException.VPMS_REMOVAL_FAILED); //Ignoring the exception SPR3362 } } //end SPR3362 } /** * This method verifies that the workitem(s) required for an application * are present within the AWD system. If not, then the case will be * suspended for a set number of days. * @return boolean true indicates work item(s) present and verified; false indicates * failure and that the case should be suspended * @throws NbaBaseException */ public boolean verifyWorkItems() throws NbaBaseException { getLogger().logDebug("Starting verifyWorkItems"); //NBA044 try { ListIterator li = getWork().getNbaTransactions().listIterator(); vpmsProxy = new NbaVpmsAdaptor(oinkData, NbaVpmsAdaptor.APPLICATION_HOLD); // NBA077 //begin NBA087 Map deOinkMap = new HashMap(); deOinkMap.put("A_CaseStatusLOB", getWork().getStatus()); deOinkMap.put("A_INSTALLATION", getInstallationType());//ACN010 deOinkMap.put(A_UNDERWRITER_WORKBENCH_APPLET, Boolean.toString(NbaConfiguration.getInstance().isUnderwriterWorkbenchApplet())); //NBA122 //Begin QC9347/ALII1411 deOinkMap.put("A_CaseFinalDispstnLOB", Integer.toString(getWork().getNbaLob().getCaseFinalDispstn())); NbaOinkRequest oinkRequest = new NbaOinkRequest(); oinkData.setContractSource(getNbaTxLife()); oinkRequest.setVariable("Exchange1035Ind"); String exchange1035Ind = oinkData.getStringValueFor(oinkRequest); deOinkMap.put("A_Exchange1035Ind", exchange1035Ind); //End QC9347/ALII1411 vpmsProxy.setSkipAttributesMap(deOinkMap); //end NBA087 vpmsProxy.setVpmsEntryPoint(NbaVpmsAdaptor.EP_GET_WORKITEMS); NbaVpmsAppHoldData data = null; //Begin NBA130 RequirementInfo reqInfo = null; vpmsProxy.setANbaOinkRequest(oinkRequest); //End NBA130 List contractPrintWIsList= new java.util.ArrayList(); //APSL221 while (li.hasNext()) { NbaTransaction trans = (NbaTransaction) li.next(); if(A_WT_CONT_PRINT_EXTRACT.equalsIgnoreCase(trans.getTransaction().getWorkType())) { //APSL221 contractPrintWIsList.add(trans);//APSL221 } else { //APSL221 oinkData = new NbaOinkDataAccess(trans.getNbaLob()); // NBA021 //Begin NBA130 if( A_WT_REQUIREMENT.equalsIgnoreCase(trans.getTransaction().getWorkType())) { reqInfo = getNbaTxLife().getRequirementInfo(trans.getNbaLob().getReqUniqueID()); if (null == reqInfo) { throw new NbaRequirementInfoException("Unable to retrieve RequirementInfo for RequirementInfoUniqueId " + trans.getNbaLob().getReqUniqueID()); } oinkRequest.setRequirementIdFilter(reqInfo.getId()); oinkData.setContractSource(getNbaTxLife()); } else { oinkRequest.setRequirementIdFilter(null); } //End NBA130 vpmsProxy.setOinkSurrogate(oinkData); // NBA021 data = new NbaVpmsAppHoldData(vpmsProxy.getResults()); if ((data.wasSuccessful()&& !only1778CVonCase()) && !checkCV1778forUnboundCase()) { //NBLXA-1317 -- Check if CV1778 present on case getWork().getNbaLob().setNeedCompWorkItem(true); NbaVpmsWorkItem vpmsItem = (NbaVpmsWorkItem) data.getWorkItems().get(0); //NBA119 if (A_WT_CWA.equals(vpmsItem.getWorkItem()) || A_WT_CwA1035.equals(vpmsItem.getWorkItem())) { //NBA119 getWork().getNbaLob().setNeedCwa(true); } if (!(A_WT_CWA.equals(vpmsItem.getWorkItem()) || A_WT_CwA1035.equals(vpmsItem.getWorkItem()))) { //APSL1540 QC#7611 suspendCase(vpmsItem.getActivateDateTime(), vpmsItem.getWorkItem(), vpmsItem.getMaxSuspendDays(),trans); //NBA119 NBLXA-1954 //SPR3362 code deleted return false; } }else if(checkCV1778forUnboundCase()){ //NBLXA-1317 -- Check if CV1778 present on case suspendCaseForRegisterDate(); } }// APSL5370 Begin if (A_ST_INFORCE_UPDATE.equalsIgnoreCase(trans.getTransaction().getWorkType()) && !trans.getNbaLob().getQueue().equalsIgnoreCase(END_QUEUE)) { PolicyExtension policyExt = NbaUtils.getFirstPolicyExtension(getNbaTxLife().getPolicy()); if (policyExt != null) { if (policyExt.getAdminSysPolicyStatus() == NbaOliConstants.OLI_POLSTAT_0) { deOinkMap.put("A_IsInforceEvaluation", "true"); } else { deOinkMap.put("A_IsInforceEvaluation", "false"); } } oinkData = new NbaOinkDataAccess(getNbaTxLife()); oinkData.setContractSource(getNbaTxLife()); oinkData.setLobSource(getWork().getNbaLob()); vpmsProxy.setOinkSurrogate(oinkData); vpmsProxy.setSkipAttributesMap(deOinkMap); data = new NbaVpmsAppHoldData(vpmsProxy.getResults()); if ((data.wasSuccessful() && !only1778CVonCase()) && !checkCV1778forUnboundCase()) { //NBLXA-1317 -- Check if CV1778 present on case NbaVpmsWorkItem vpmsItem = (NbaVpmsWorkItem) data.getWorkItems().get(0); suspendCase(vpmsItem.getActivateDateTime(), vpmsItem.getWorkItem(), vpmsItem.getMaxSuspendDays(),trans); //NBLXA-1954 return false; }else if(checkCV1778forUnboundCase()){ //NBLXA-1317 -- Check if CV1778 present on case suspendCaseForRegisterDate(); } } // APSL5370 End } //begin APSL221 if (contractPrintWIsList.size() > 0) { SortingHelper.sortData(contractPrintWIsList, true, SORT_BY_CREATEDATE); NbaTransaction trans = (NbaTransaction)contractPrintWIsList.get(contractPrintWIsList.size() - 1); //Get the NBPRTEXT WI latest by CRDA oinkData = new NbaOinkDataAccess(trans.getNbaLob()); oinkRequest.setRequirementIdFilter(null); vpmsProxy.setOinkSurrogate(oinkData); data = new NbaVpmsAppHoldData(vpmsProxy.getResults()); if ((data.wasSuccessful() && !only1778CVonCase()) && !checkCV1778forUnboundCase()) { //NBLXA-1317 -- Check if CV1778 present on case getWork().getNbaLob().setNeedCompWorkItem(true); NbaVpmsWorkItem vpmsItem = (NbaVpmsWorkItem) data.getWorkItems().get(0); suspendCase(vpmsItem.getActivateDateTime(), vpmsItem.getWorkItem(), vpmsItem.getMaxSuspendDays(),trans); return false; }else if(checkCV1778forUnboundCase()){ //NBLXA-1317 -- Check if CV1778 present on case suspendCaseForRegisterDate(); } } //end APSL221 //SPR3362 code deleted return true; } catch (Exception e) { NbaBaseException nbe = new NbaBaseException("AppHold problem", e); throw nbe; } catch (Throwable t) { throw new NbaBaseException("AppHold problem", t); //begin SPR3362 } finally { try { if (null != vpmsProxy) { vpmsProxy.remove(); } } catch (Exception e) { getLogger().logError(NbaBaseException.VPMS_REMOVAL_FAILED); } } //end SPR3362 } /** * Returns false if new suspend reason matches with the most recent reason on the workitem for this process. * @param newReason the new suspend reason string * @return false if new suspend reason matches with the most recent reason on the workitem else return true */ //NBA119 New Method protected boolean isDifferentReason(String newReason) { //begin NBA208-1 if (!getWork().isHistoryRetrieved()) { try { setWork(retrieveComments(getWork())); //SPRNBA-376 } catch (NbaBaseException e) { return true; //No history } } List comments = getWork().getManualComments(); //end NBA208-1 //NBA208-32 Comment comment = null; String commentText = null; String type = null; String typeString = null; NbaProcessingErrorComment errorComments = null; String userId = getUser().getUserID(); for (int i = comments.size() - 1; i >= 0; i--) { //NBA208-32 comment = (Comment) comments.get(i); commentText = comment.getText(); type = commentText.length() >= 6 ? commentText.substring(0, 6) : "";//APSL649 if ("type~|".equals(type)) { typeString = commentText.substring(type.length(), commentText.indexOf("|~")); if (NbaProcessingErrorComment.type.equalsIgnoreCase(typeString)) { errorComments = new NbaProcessingErrorComment(comment); //if matches user id and the reason text if (userId.equalsIgnoreCase(errorComments.getProcess()) && newReason.equalsIgnoreCase(errorComments.getText())) { return false; } } } } return true; } //ALII1906 New Method protected void setPriorityandUpdate(NbaDst aWorkItem, NbaProcessWorkItemProvider workProvider) throws NbaBaseException { if (workProvider.getWIPriority() != null) { aWorkItem.increasePriority(workProvider.getWIAction(), workProvider.getWIPriority()); } changeStatus(aWorkItem, workProvider.getInitialStatus()); aWorkItem.setUpdate(); update(aWorkItem); unlockWork(aWorkItem); } //ALII1998 New Method protected void setPriorityOnly(NbaDst aWorkItem, NbaProcessWorkItemProvider workProvider) throws NbaBaseException { if (workProvider.getWIPriority() != null) { aWorkItem.increasePriority(workProvider.getWIAction(), workProvider.getWIPriority()); } aWorkItem.setUpdate(); update(aWorkItem); unlockWork(aWorkItem); } // New Method -- NBLXA-1317 -- Check CV for Unbound L70 Cases with Effective Date,when Effective is future Date. protected boolean checkCV1778forUnboundCase() { int com = 0; if (!NbaUtils.isBlankOrNull(getNbaTxLife().getPolicy())) { Policy policy = getNbaTxLife().getPolicy(); PolicyExtension policyExtn = NbaUtils.getFirstPolicyExtension(getNbaTxLife().getPolicy()); if (policyExtn != null) { if (policyExtn.hasUnboundInd() && policyExtn.getUnboundInd() && SYST_LIFE70.equals(getNbaTxLife().getBackendSystem())) { if (only1778CVonCase()) { if (policy.getEffDate() != null) { com = NbaUtils.compare(policy.getEffDate(), new Date()); } } } } } if (com > 0) { return true; } return false; } // New Method -- NBLXA-1317 -- When Only 1778 CV exist on case protected boolean only1778CVonCase() { SystemMessage systemMessage; Holding holding = getNbaTxLife().getPrimaryHolding(); int count = holding.getSystemMessageCount(); boolean isCVPresent = false; int severeCVCount = 0; for (int i = 0; i < count; i++) { systemMessage = holding.getSystemMessageAt(i); if (!systemMessage.isActionDelete()) { if (NbaOliConstants.OLI_MSGSEVERITY_SEVERE == systemMessage.getMessageSeverityCode()) { severeCVCount++; if (systemMessage.getMessageCode() == CV_1778) { isCVPresent = true; } } } } if(isCVPresent && severeCVCount==1){ return true; } return false; } // NBLXA-1317 -- END //NBLXA-1317 -- Case should not move from APPHLD if CV1778 exist and it will suspend till Future Date. protected void suspendCaseForRegisterDate()throws NbaBaseException { int com = 0; Date activateDateTime=null; if (!NbaUtils.isBlankOrNull(getNbaTxLife().getPolicy())) { Policy policy = getNbaTxLife().getPolicy(); if (policy.getEffDate() != null) { com = NbaUtils.compare(policy.getEffDate(), new Date()); activateDateTime = policy.getEffDate(); } } if (com > 0 && activateDateTime !=null) { String str = "Advanced Register Date CV Exist"; suspendCase(activateDateTime,str ,55); //NBA119 } // return false; } // Begin NBLXA-1954 public NbaDst getTransactionDst(NbaTransaction transaction) throws NbaBaseException { NbaAwdRetrieveOptionsVO retOpt = new NbaAwdRetrieveOptionsVO(); retOpt.setWorkItem(transaction.getID(), true); retOpt.setLockWorkItem(); NbaDst nbadst = retrieveWorkItem(getUser(), retOpt); nbadst.setUpdate(); nbadst.getNbaLob().setUnsuspendWorkItem(getWork().getID()); return nbadst; } // End NBLXA-1954 }
[ "gthakur3@dxc.com" ]
gthakur3@dxc.com
ef08e53cba1f4f17d2a48d9bbf559581500ef5d1
cdd34915b4f0c89359b923ad6051068c078759ef
/GateWayService/src/main/java/com/zgy/handle/gateway/config/Config.java
bcdb7daa36502be82f7113d654408f5f93424b15
[]
no_license
zgy520/HandleSystem
4d8b760df0c8e3953dc99a66ed466d2d28c48103
109f25c34efbe795554d784e1d80c1473df96569
refs/heads/master
2022-07-29T16:10:59.638475
2020-03-08T02:27:44
2020-03-08T02:27:44
230,713,967
0
0
null
2022-06-21T02:56:19
2019-12-29T06:46:54
Java
UTF-8
Java
false
false
68
java
package com.zgy.handle.gateway.config; public interface Config { }
[ "a442391947@gmail.com" ]
a442391947@gmail.com
70f68ac95b756763e4278e12e53fce07776660f7
ce42c6c035dcf35ccdbbca990ed06f612756da18
/sources/okhttp3/JavaNetAuthenticator.java
7571a28a8aa328e2e89302bc890f735ad533c5fa
[]
no_license
chelovekula/NizNov-City17-shit
263e5cef0d7a85025e9a8e8e7ee6b4b47d498263
ab8c38769e0de6ae42ccd2b7f5488d7f94967527
refs/heads/master
2021-05-20T21:46:44.764375
2020-04-02T10:54:31
2020-04-02T10:54:31
252,427,414
2
0
null
null
null
null
UTF-8
Java
false
false
2,349
java
package okhttp3; import java.io.IOException; import java.net.Authenticator; import java.net.Authenticator.RequestorType; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.PasswordAuthentication; import java.net.Proxy; import java.net.Proxy.Type; import java.util.List; import okhttp3.internal.annotations.EverythingIsNonNull; @EverythingIsNonNull public final class JavaNetAuthenticator implements Authenticator { public Request authenticate(Route route, C1069Response response) throws IOException { PasswordAuthentication passwordAuthentication; List challenges = response.challenges(); Request request = response.request(); HttpUrl url = request.url(); boolean z = response.code() == 407; Proxy proxy = route.proxy(); int size = challenges.size(); for (int i = 0; i < size; i++) { Challenge challenge = (Challenge) challenges.get(i); if ("Basic".equalsIgnoreCase(challenge.scheme())) { if (z) { InetSocketAddress inetSocketAddress = (InetSocketAddress) proxy.address(); passwordAuthentication = Authenticator.requestPasswordAuthentication(inetSocketAddress.getHostName(), getConnectToInetAddress(proxy, url), inetSocketAddress.getPort(), url.scheme(), challenge.realm(), challenge.scheme(), url.url(), RequestorType.PROXY); } else { passwordAuthentication = Authenticator.requestPasswordAuthentication(url.host(), getConnectToInetAddress(proxy, url), url.port(), url.scheme(), challenge.realm(), challenge.scheme(), url.url(), RequestorType.SERVER); } if (passwordAuthentication != null) { return request.newBuilder().header(z ? "Proxy-Authorization" : "Authorization", Credentials.basic(passwordAuthentication.getUserName(), new String(passwordAuthentication.getPassword()), challenge.charset())).build(); } } } return null; } private InetAddress getConnectToInetAddress(Proxy proxy, HttpUrl httpUrl) throws IOException { if (proxy == null || proxy.type() == Type.DIRECT) { return InetAddress.getByName(httpUrl.host()); } return ((InetSocketAddress) proxy.address()).getAddress(); } }
[ "chelovekula88@gmail.com" ]
chelovekula88@gmail.com
6bcd45ff30dcb822a3b0057cec07c93b7495fdc9
652d8a831c51a702da53a9181b02228f53f37593
/src/Manager.java
86d58454fb0063ec614990b50646505b1c239ab5
[]
no_license
nayunhwan/Find_News_to_Excel
751af038d07a19c37b4036634b16cda184baf29c
655396c1730d229914e07f8b175508705e931b5c
refs/heads/master
2021-06-01T15:01:03.047941
2016-07-18T07:49:45
2016-07-18T07:49:45
46,439,580
0
1
null
null
null
null
UTF-8
Java
false
false
1,867
java
import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.*; public class Manager extends JFrame{ public static JFileChooser fileChooser = new JFileChooser(); Manager(){ JLabel title = new JLabel("검색어를 입력해 주세요.",JLabel.CENTER); JLabel save_title = new JLabel("결과물 몇 백개를 뽑을까요?",JLabel.CENTER); JButton btn_apply = new JButton("확인"); JButton btn_cancle = new JButton("취소"); JTextField input_search = new JTextField(); JTextField input_savename = new JTextField(); setTitle("Search Program"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLayout(new BorderLayout()); JPanel btnGroup = new JPanel(new GridLayout(1, 2)); JPanel pan_north = new JPanel(new GridLayout(2, 2)); btnGroup.add(btn_apply); btnGroup.add(btn_cancle); pan_north.add(title); pan_north.add(input_search); pan_north.add(save_title); pan_north.add(input_savename); add(pan_north, "Center"); add(btnGroup, "South"); Main m = new Main(); btn_apply.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fileChooser.setDialogTitle("Save file"); fileChooser.addChoosableFileFilter(new MyFilter("xlsx", "Excel File")); int userSelection = fileChooser.showSaveDialog(null); if(userSelection == JFileChooser.APPROVE_OPTION) { String query = input_search.getText(); String count = input_savename.getText(); m.naverStart(query, count, fileChooser); } } }); setSize(500,200); setVisible(true); } public static void main(String[] args) { Manager manager = new Manager(); } }
[ "kbk9288@gmail.com" ]
kbk9288@gmail.com
34fa42b7bed547037b74238e712af433efad67be
62018aafd8b854aedbffc34e1ea37686aeb6e425
/day07-code/src/jia/dong/day07/demo02/Demo01Anonymous.java
e83705b71ff6a9838d961a5ae3a9b372f5783550
[]
no_license
D-Li-Ang/basic-code
b61e960fc99311d320085e95d57d1f7ab341fb15
8320dc69f446ecbc5673a8c486e963832e03754c
refs/heads/master
2023-08-25T15:01:36.239633
2020-10-24T07:34:26
2020-10-24T07:34:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package jia.dong.day07.demo02; /* * 创建对象的标准格式 * 类名称 对象名=new 类名称() * * 匿名对象就是只有右边的对象 没有左边的名字和赋值运算符 * new 类名称 * * 注意事项:匿名对象只能使用唯一的一次 下次再用不得不创建一个新对象 * 使用建议:如果确定有一个对象只需要使用唯一的一次 就可以用匿名对象*/ public class Demo01Anonymous { public static void main(String[] args) { Person one =new Person(); one.name="张三"; one.showName(); System.out.println("=============="); //匿名对象 new Person().name="李四"; new Person().showName(); //我叫:null } }
[ "1911900673@qq.com" ]
1911900673@qq.com
5ae2e8c7eb69abbe90601b1c50307ac5e1766a67
414770d25f59cee8c8cc7970e1cf4722d4f38005
/rabbitmq/src/main/java/com/cml/learning/rabbitmq/spring/service/MailServiceImpl.java
68f50dab7a1ec0fd8584f5acf0b9653e7b5463d2
[]
no_license
ZSCDumin/SpringBootLearning
499f53c6ba5ecbab8b8be872280ac1b96d8be190
99c52891ce0dba045f2371ba110caa55125f2a89
refs/heads/master
2020-03-09T11:01:05.651180
2018-02-03T14:01:45
2018-02-03T14:01:45
128,751,166
1
0
null
2018-04-09T09:57:22
2018-04-09T09:57:21
null
UTF-8
Java
false
false
1,493
java
package com.cml.learning.rabbitmq.spring.service; import org.springframework.amqp.core.AmqpTemplate; import com.cml.learning.rabbitmq.spring.model.EmailModel; public class MailServiceImpl implements MailService { private AmqpTemplate template; private String topicExchange; private String directExchange; private String fanoutExchange; public MailServiceImpl(AmqpTemplate template) { super(); this.template = template; } @Override public void sendTopicEmail(String routeKey, EmailModel model) { template.convertAndSend(topicExchange, routeKey, model); } @Override public void sendDirectEmail(String routeKey, EmailModel model) { template.convertAndSend(directExchange, routeKey, model); } @Override public void sendFanoutEmail(String routeKey, EmailModel model) { template.convertAndSend(fanoutExchange, routeKey, model); } public AmqpTemplate getTemplate() { return template; } public void setTemplate(AmqpTemplate template) { this.template = template; } public String getTopicExchange() { return topicExchange; } public void setTopicExchange(String topicExchange) { this.topicExchange = topicExchange; } public String getFanoutExchange() { return fanoutExchange; } public void setFanoutExchange(String fanoutExchange) { this.fanoutExchange = fanoutExchange; } public String getDirectExchange() { return directExchange; } public void setDirectExchange(String directExchange) { this.directExchange = directExchange; } }
[ "menglin.chen" ]
menglin.chen
fd986366be4dceb3b4fe6cef3135a81378ecd6ca
66db98ef824ff04f441b6905f1b73760413a588a
/core/branches/v1_03/src/main/java/org/openimmunizationsoftware/dqa/quality/QualityCollector.java
8dcbe8e22dc243d01efe20385341b7fc852e9b5c
[]
no_license
nathanbunker/ois-dqa
7d90d27444027aa2659130d5910e10f6102b7684
f09ccf2c9ae66b7d5f7a4fc6dabf319016606677
refs/heads/master
2021-01-10T07:00:21.298651
2017-10-05T23:42:32
2017-10-05T23:42:32
54,055,730
0
0
null
null
null
null
UTF-8
Java
false
false
21,923
java
package org.openimmunizationsoftware.dqa.quality; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openimmunizationsoftware.dqa.db.model.BatchCodeReceived; import org.openimmunizationsoftware.dqa.db.model.BatchIssues; import org.openimmunizationsoftware.dqa.db.model.BatchReport; import org.openimmunizationsoftware.dqa.db.model.BatchType; import org.openimmunizationsoftware.dqa.db.model.BatchVaccineCvx; import org.openimmunizationsoftware.dqa.db.model.CodeReceived; import org.openimmunizationsoftware.dqa.db.model.MessageHeader; import org.openimmunizationsoftware.dqa.db.model.IssueFound; import org.openimmunizationsoftware.dqa.db.model.MessageBatch; import org.openimmunizationsoftware.dqa.db.model.MessageReceived; import org.openimmunizationsoftware.dqa.db.model.PotentialIssue; import org.openimmunizationsoftware.dqa.db.model.PotentialIssueStatus; import org.openimmunizationsoftware.dqa.db.model.SubmitterProfile; import org.openimmunizationsoftware.dqa.db.model.VaccineCvx; import org.openimmunizationsoftware.dqa.db.model.VaccineGroup; import org.openimmunizationsoftware.dqa.db.model.received.Vaccination; import org.openimmunizationsoftware.dqa.manager.VaccineGroupManager; import org.openimmunizationsoftware.dqa.quality.model.ModelFactory; import org.openimmunizationsoftware.dqa.quality.model.ModelForm; import org.openimmunizationsoftware.dqa.quality.model.ModelSection; public class QualityCollector { private Set<String> patientIds = new HashSet<String>(); private Set<String> vaccinationIds = new HashSet<String>(); private MessageBatch messageBatch = null; private BatchReport report = null; private SubmitterProfile profile = null; private List<BatchIssues> errorIssues = new ArrayList<BatchIssues>(); private List<BatchIssues> warnIssues = new ArrayList<BatchIssues>(); private List<BatchIssues> skipIssues = new ArrayList<BatchIssues>(); private Date vaccinationAdminDateEarliest = null; private Date vaccinationAdminDateLatest = null; private int numeratorVaccinationAdminDateAge = 0; private QualityScoring scoring = null; private ModelForm modelForm = null; private MessageHeader exampleHeader = null; public void setExampleHeader(MessageHeader exampleHeader) { this.exampleHeader = exampleHeader; } public MessageHeader getExampleHeader() { return exampleHeader; } public ModelForm getModelForm() { return modelForm; } public int getVaccineCvxCount(VaccineCvx vaccineCvx) { BatchVaccineCvx batchVaccineCvx = messageBatch.getBatchVaccineCvxMap().get(vaccineCvx); if (batchVaccineCvx == null) { return 0; } return batchVaccineCvx.getReceivedCount(); } public QualityScoring getCompletenessScoring() { return scoring; } private static final long AS_THE_DAY_IS_LONG = 24 * 60 * 60 * 1000; public MessageBatch getMessageBatch() { return messageBatch; } public QualityCollector(String title, BatchType batchType, SubmitterProfile profile) { messageBatch = new MessageBatch(); messageBatch.setBatchTitle(title); messageBatch.setStartDate(new Date()); messageBatch.setEndDate(new Date()); messageBatch.setBatchType(batchType); messageBatch.setProfile(profile); this.profile = profile; modelForm = ModelFactory.createModelForm(profile); report = messageBatch.getBatchReport(); } public void registerCodeReceived(CodeReceived codeReceived) { messageBatch.getBatchCodeReceived(codeReceived).incReceivedCount(); } public void registerProcessedMessage(MessageReceived messageReceived) { if (exampleHeader == null) { exampleHeader = messageReceived.getMessageHeader(); } report.incMessageCount(); String patientId = messageReceived.getPatient().getIdSubmitter().getNumber(); if (patientId == null || patientId.equals("")) { patientId = "MESSAGE#" + report.getMessageCount(); } if (!patientIds.contains(patientId)) { patientIds.add(patientId); } else { // TODO register issue, can't do here, too late } report.incPatientCount(); if (messageReceived.getPatient().getBirthDate() != null) { boolean underage = isUnderage(messageReceived); if (underage) { report.incPatientUnderageCount(); } } messageBatch.incBatchActionCount(messageReceived.getIssueAction()); for (IssueFound issueFound : messageReceived.getIssuesFound()) { messageBatch.incBatchIssueCount(issueFound.getIssue()); } report.incNextOfKinCount(messageReceived.getNextOfKins().size()); int vacPos = 0; long timelinessGap = Long.MAX_VALUE; Date latestAdmin = null; boolean hadAdmin = false; for (Vaccination vaccination : messageReceived.getVaccinations()) { vacPos++; String vaccinationId = vaccination.getIdSubmitter(); if (vaccinationId == null || vaccinationId.equals("")) { if (vaccination.getAdminCode() != null && !vaccination.getAdminCode().equals("") && vaccination.getAdminDate() != null) { vaccinationId = vaccination.getAdminCode() + "-" + vaccination.getAdminDate().getTime(); } else { vaccinationId = "VACCINATION#" + vacPos; } vaccinationId = patientId + "-" + vaccinationId; } if (!vaccinationIds.contains(vaccinationId)) { vaccinationIds.add(vaccinationId); } else { // TODO register issue } if (vaccination.isActionDelete()) { report.incVaccinationDeleteCount(); } else if (vaccination.isCompletionNotAdministered() || vaccination.isCompletionPartiallyAdministered() || vaccination.isCompletionRefused()) { report.incVaccinationNotAdministeredCount(); } else if (vaccination.isInformationSourceAdmin()) { report.incVaccinationAdministeredCount(); hadAdmin = true; if (vaccination.getAdminDate() != null) { long diff = messageReceived.getReceivedDate().getTime() - vaccination.getAdminDate().getTime(); if (diff >= 0 && diff < timelinessGap) { timelinessGap = diff; latestAdmin = vaccination.getAdminDate(); } } if (vaccination.getVaccineCvx() != null) { messageBatch.getBatchVaccineCvx(vaccination.getVaccineCvx()).incReceivedCount(); } } else { report.incVaccinationHistoricalCount(); } } if (hadAdmin) { report.incMessageWithAdminCount(); if (timelinessGap < Long.MAX_VALUE) { numeratorVaccinationAdminDateAge += (timelinessGap / AS_THE_DAY_IS_LONG); } if (latestAdmin != null) { if (vaccinationAdminDateEarliest == null || latestAdmin.before(vaccinationAdminDateEarliest)) { vaccinationAdminDateEarliest = latestAdmin; } if (vaccinationAdminDateLatest == null || latestAdmin.after(vaccinationAdminDateLatest)) { vaccinationAdminDateLatest = latestAdmin; } } int dayEarly = modelForm.getModelSection("timeliness.early").getDays(); int dayOnTime = modelForm.getModelSection("timeliness.onTime").getDays(); int dayLate = modelForm.getModelSection("timeliness.late").getDays(); int dayVeryLate = modelForm.getModelSection("timeliness.veryLate").getDays(); if (timelinessGap < (AS_THE_DAY_IS_LONG * dayEarly)) { report.incTimelinessCountEarly(); } else if (timelinessGap < (AS_THE_DAY_IS_LONG * dayOnTime)) { report.incTimelinessCountOnTime(); } else if (timelinessGap < (AS_THE_DAY_IS_LONG * dayLate)) { report.incTimelinessCountLate(); } else if (timelinessGap < (AS_THE_DAY_IS_LONG * dayVeryLate)) { report.incTimelinessCountVeryLate(); } else { report.incTimelinessCountOldData(); } } } private boolean isUnderage(MessageReceived messageReceived) { Calendar cal = Calendar.getInstance(); cal.setTime(messageReceived.getReceivedDate()); cal.add(Calendar.YEAR, -18); boolean underage = cal.getTime().before(messageReceived.getPatient().getBirthDate()); return underage; } public void score() { scoreTimeliness(); scoreQuality(); scoreCompleteness(); int overallScore = (int) (modelForm.getWeight("timeliness") * report.getTimelinessScore() + modelForm.getWeight("quality") * report.getQualityScore() + modelForm.getWeight("completeness") * report.getCompletenessScore() + 0.5); report.setOverallScore(overallScore); } private void scoreCompleteness() { scoring = new QualityScoring(modelForm); Map<PotentialIssue, BatchIssues> batchIssuesMap = messageBatch.getBatchIssuesMap(); ScoringSet patientExpected = scoring.getScoringSet(QualityScoring.PATIENT_EXPECTED); ScoringSet patientOptional = scoring.getScoringSet(QualityScoring.PATIENT_OPTIONAL); ScoringSet patientRecommended = scoring.getScoringSet(QualityScoring.PATIENT_RECOMMENDED); ScoringSet patientRequired = scoring.getScoringSet(QualityScoring.PATIENT_REQUIRED); ScoringSet vaccinationExpected = scoring.getScoringSet(QualityScoring.VACCINATION_EXPECTED); ScoringSet vaccinationOptional = scoring.getScoringSet(QualityScoring.VACCINATION_OPTIONAL); ScoringSet vaccinationRecommended = scoring.getScoringSet(QualityScoring.VACCINATION_RECOMMENDED); ScoringSet vaccinationRequired = scoring.getScoringSet(QualityScoring.VACCINATION_REQUIRED); score(batchIssuesMap, patientExpected); score(batchIssuesMap, patientOptional); score(batchIssuesMap, patientRecommended); score(batchIssuesMap, patientRequired); score(batchIssuesMap, vaccinationExpected); score(batchIssuesMap, vaccinationOptional); score(batchIssuesMap, vaccinationRecommended); score(batchIssuesMap, vaccinationRequired); double patientScore = patientExpected.getWeightedScore() + patientOptional.getWeightedScore() + patientRecommended.getWeightedScore() + patientRequired.getWeightedScore(); double vaccinationScore = vaccinationExpected.getWeightedScore() + vaccinationOptional.getWeightedScore() + vaccinationRecommended.getWeightedScore() + vaccinationRequired.getWeightedScore(); double vaccineGroupScore = scoreVaccineGroupScore(); int completenessScore = (int) (100.0 * patientScore * modelForm.getWeight("completeness.patient") + 100.0 * vaccinationScore * modelForm.getWeight("completeness.vaccination") + 100.0 * vaccineGroupScore * modelForm.getWeight("completeness.vaccineGroup") + 0.5); report.setCompletenessPatientScore((int) (patientScore * 100 + 0.5)); report.setCompletenessVaccinationScore((int) (vaccinationScore * 100 + 0.5)); report.setCompletenessVaccineGroupScore((int) (vaccineGroupScore * 100 + 0.5)); report.setCompletenessScore(completenessScore); } private double scoreVaccineGroupScore() { VaccineGroupManager vaccineGroupManager = VaccineGroupManager.getVaccineGroupManager(); double score = 0.0; score = scoreVaccineGroup(vaccineGroupManager, modelForm.getModelSection("completeness.vaccineGroup.expected")); score = score + scoreVaccineGroup(vaccineGroupManager, modelForm.getModelSection("completeness.vaccineGroup.recommended")); score = score + scoreVaccineGroup(vaccineGroupManager, modelForm.getModelSection("completeness.vaccineGroup.unexpected")); if (score < 0) { score = 0; } return score; } private double scoreVaccineGroup(VaccineGroupManager vaccineGroupManager, ModelSection vgsection) { float score = 0; float denominator = 0; for (ModelSection section : vgsection.getSections()) { denominator += section.getWeight(); VaccineGroup vaccineGroup = vaccineGroupManager.getVaccineGroup(section.getName()); if (vaccineGroup == null) { throw new IllegalArgumentException("Invalid vaccine group name '" + section.getName() + "'"); } for (VaccineCvx vaccineCvx : vaccineGroup.getVaccineCvxList()) { if (getVaccineCvxCount(vaccineCvx) > 0) { score += section.getWeight(); break; } } } return (denominator > 0 ? score / denominator : 0) * vgsection.getWeight(); } private void score(Map<PotentialIssue, BatchIssues> batchIssuesMap, ScoringSet scoringSet) { List<CompletenessRow> completenessRows = scoringSet.getCompletenessRow(); double overallScore = 0.0; double overallWeight = 0; for (CompletenessRow completenessRow : completenessRows) { PotentialIssue potentialIssue = completenessRow.getPotentialIssue(); int numerator = 0; numerator = getNumerator(batchIssuesMap, potentialIssue, numerator); int denominator = getDenominator(completenessRow); if (denominator > 0) { if (completenessRow.isInvert()) { numerator = invertNumerator(completenessRow, numerator, denominator); } double score = completenessRow.getScoreWeight() * numerator / (double) denominator; completenessRow.setScore(score); completenessRow.setCount(numerator); completenessRow.setDenominator(denominator); overallScore += score; } if (completenessRow.getScoreWeight() > 0) { overallWeight += completenessRow.getScoreWeight(); } } scoringSet.setOverallWeight(overallWeight); double overallPercent = overallWeight > 0 ? overallScore / overallWeight : 0; if (overallPercent < 0) { overallPercent = 0; } else if (overallPercent > 1) { overallPercent = 1; } scoringSet.setScore(overallPercent); scoringSet.setWeightedScore(overallPercent * scoringSet.getWeight()); } private int invertNumerator(CompletenessRow completenessRow, int numerator, int denominator) { // Most issues are inverted, for example if there are 100 patients and 10 // have 'missing first name' // then the inverse is 90 patients are NOT missing first name if (completenessRow.isInvert()) { if (numerator > denominator) { numerator = denominator; } numerator = denominator - numerator; } return numerator; } private int getNumerator(Map<PotentialIssue, BatchIssues> batchIssuesMap, PotentialIssue potentialIssue, int numerator) { BatchIssues batchIssues = batchIssuesMap.get(potentialIssue); if (batchIssues != null) { numerator = batchIssues.getIssueCount(); } return numerator; } private int getDenominator(CompletenessRow completenessRow) { int denominator = 0; if (completenessRow.getReportDenominator() == ReportDenominator.MESSAGE_COUNT) { denominator = report.getMessageCount(); } else if (completenessRow.getReportDenominator() == ReportDenominator.NEXTOFKIN_COUNT) { denominator = report.getNextOfKinCount(); } else if (completenessRow.getReportDenominator() == ReportDenominator.OBSERVATION_COUNT) { denominator = 0; } else if (completenessRow.getReportDenominator() == ReportDenominator.PATIENT_COUNT) { denominator = report.getPatientCount(); } else if (completenessRow.getReportDenominator() == ReportDenominator.PATIENT_UNDERAGE_COUNT) { denominator = report.getPatientUnderageCount(); } else if (completenessRow.getReportDenominator() == ReportDenominator.VACCINATION_COUNT) { denominator = report.getVaccinationCount(); } else if (completenessRow.getReportDenominator() == ReportDenominator.VACCINATION_ADMIN_COUNT) { denominator = report.getVaccinationAdministeredCount(); } return denominator; } private void scoreQuality() { int errorCount = 0; int warningCount = 0; Map<PotentialIssue, BatchIssues> batchIssuesMap = messageBatch.getBatchIssuesMap(); for (PotentialIssueStatus potentialIssueStatus : profile.getPotentialIssueStatusMap().values()) { PotentialIssue potentialIssue = potentialIssueStatus.getIssue(); BatchIssues batchIssues = batchIssuesMap.get(potentialIssue); if (batchIssues != null && batchIssues.getIssueCount() > 0) { if (potentialIssueStatus.getAction().isError()) { errorIssues.add(batchIssues); errorCount += batchIssues.getIssueCount(); } else if (potentialIssueStatus.getAction().isWarn()) { warnIssues.add(batchIssues); warningCount += batchIssues.getIssueCount(); } else if (potentialIssueStatus.getAction().isSkip()) { skipIssues.add(batchIssues); } } } int denominator = report.getMessageCount() + report.getVaccinationCount(); // If there are more than 10% errors then the score is 0. double denominatorScaled = 0.03 * denominator; double qualityErrorScore; if (errorCount > denominatorScaled) { qualityErrorScore = 0; } else { qualityErrorScore = 1.0 - (1.0 * errorCount / denominatorScaled); } if (qualityErrorScore < 0) { qualityErrorScore = 0; } denominatorScaled = 0.3 * denominator; double qualityWarnScore; if (warningCount > denominatorScaled) { qualityWarnScore = 0; } else { qualityWarnScore = 1.0 - (1.0 * warningCount / denominatorScaled); } if (qualityWarnScore < 0) { qualityWarnScore = 0; } report.setQualityWarnScore((int) (100.0 * qualityWarnScore + 0.5)); report.setQualityErrorScore((int) (100.0 * qualityErrorScore + 0.5)); report.setQualityScore((int) (100.0 * qualityErrorScore * modelForm.getWeight("quality.errors") + 100.0 * qualityWarnScore * modelForm.getWeight("quality.warnings") + 0.5)); } private void scoreTimeliness() { double scoreEarly = 0; double scoreOnTime = 0; double scoreLate = 0; double scoreVeryLate = 0; double timelinessAverage = 0; if (report.getMessageWithAdminCount() > 0) { scoreEarly = report.getTimelinessCountEarly() / report.getMessageWithAdminCount(); scoreOnTime = report.getTimelinessCountOnTime() / report.getMessageWithAdminCount(); scoreLate = report.getTimelinessCountLate() / report.getMessageWithAdminCount(); scoreVeryLate = report.getTimelinessCountVeryLate() / report.getMessageWithAdminCount(); timelinessAverage = numeratorVaccinationAdminDateAge / (double) report.getMessageWithAdminCount(); } int timeliness = (int) (100.0 * (modelForm.getWeight("timeliness.early") * scoreEarly + modelForm.getWeight("timeliness.onTime") * scoreOnTime + modelForm.getWeight("timeliness.late") * scoreLate + modelForm .getWeight("timeliness.veryLate") * scoreVeryLate) + 0.5); if (timeliness > 100) { timeliness = 100; } if (timeliness < 0) { timeliness = 0; } report.setTimelinessScore(timeliness); report.setTimelinessScoreEarly((int) (100.0 * scoreEarly + 0.5)); report.setTimelinessScoreOnTime((int) (100.0 * scoreOnTime + 0.5)); report.setTimelinessScoreLate((int) (100.0 * scoreLate + 0.5)); report.setTimelinessScoreVeryLate((int) (100.0 * scoreVeryLate + 0.5)); // Set values if they have not already been set if (report.getTimelinessAverage() == 0.0) { report.setTimelinessAverage(timelinessAverage); } if (report.getTimelinessDateFirst() == null) { report.setTimelinessDateFirst(vaccinationAdminDateEarliest); } if (report.getTimelinessDateLast() == null) { report.setTimelinessDateLast(vaccinationAdminDateLatest); } } public void close() { messageBatch.setEndDate(new Date()); } public List<BatchIssues> getErrorIssues() { return errorIssues; } public List<BatchIssues> getWarnIssues() { return warnIssues; } public List<BatchIssues> getSkipIssues() { return skipIssues; } public Set<CodeReceived> getInvalidCodes() { Set<CodeReceived> codes = new HashSet<CodeReceived>(); for (BatchCodeReceived batchCode : messageBatch.getBatchCodeReceivedMap().values()) { if (batchCode.getCodeReceived().getCodeStatus().isInvalid()) { codes.add(batchCode.getCodeReceived()); } } return codes; } public Set<CodeReceived> getUnrecognizedCodes() { Set<CodeReceived> codes = new HashSet<CodeReceived>(); for (BatchCodeReceived batchCode : messageBatch.getBatchCodeReceivedMap().values()) { if (batchCode.getCodeReceived().getCodeStatus().isUnrecognized()) { codes.add(batchCode.getCodeReceived()); } } return codes; } public Set<CodeReceived> getDeprecatedCodes() { Set<CodeReceived> codes = new HashSet<CodeReceived>(); for (BatchCodeReceived batchCode : messageBatch.getBatchCodeReceivedMap().values()) { if (batchCode.getCodeReceived().getCodeStatus().isDeprecated()) { codes.add(batchCode.getCodeReceived()); } } return codes; } }
[ "nathanbunker@users.noreply.github.com" ]
nathanbunker@users.noreply.github.com
a848d1b8fce84eb272a2561795f6d2325068c3ba
523966d76c929a84042ecfb7e51e1b834f9120c6
/IceSoap/src/com/alexgilleran/icesoap/request/impl/HUCSOAPRequester.java
022398e85dcba60a8b6550006ea17071015cd1c5
[ "Apache-2.0" ]
permissive
medonja/IceSoap
09b9114f442536c58fc33700199ff956f3bb72e3
370f3a52be9dc7bd619aa751aedceb2a5703a072
refs/heads/master
2020-09-06T15:41:04.150059
2016-04-21T13:56:43
2016-04-21T13:56:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,002
java
package com.alexgilleran.icesoap.request.impl; import com.alexgilleran.icesoap.envelope.SOAPEnvelope; import com.alexgilleran.icesoap.request.Response; import com.alexgilleran.icesoap.request.SOAPRequester; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; /** * Implementation of {@link SOAPRequester} that uses {@link HttpURLConnection} */ public class HUCSOAPRequester implements SOAPRequester, HTTPDefaults { private static final String POST_NAME = "POST"; private int connTimeout = DEFAULT_CONN_TIMEOUT; private int socketTimeout = DEFAULT_SOCKET_TIMEOUT; @Override public Response doSoapRequest(SOAPEnvelope envelope, String targetUrl) throws IOException { return doSoapRequest(envelope, targetUrl, BLANK_SOAP_ACTION); } @Override public Response doSoapRequest(SOAPEnvelope envelope, String targetUrl, String soapAction) throws IOException { final URL url = new URL(targetUrl); final HttpURLConnection conn = buildHttpUrlConnection(url); final String envelopeStr = envelope.toString(); try { byte[] envBytes = envelopeStr.getBytes(envelope.getEncoding()); conn.setDoOutput(true); conn.setDoInput(true); conn.setFixedLengthStreamingMode(envBytes.length); conn.setRequestMethod(POST_NAME); conn.setRequestProperty(CONTENT_TYPE_LABEL, String.format(XML_CONTENT_TYPE_FORMAT, envelope.getMimeType(), envelope.getEncoding())); conn.setRequestProperty(HEADER_KEY_SOAP_ACTION, soapAction); conn.setConnectTimeout(connTimeout); conn.setReadTimeout(socketTimeout); OutputStream out = conn.getOutputStream(); out.write(envBytes); out.flush(); out.close(); InputStream stream; if (conn.getResponseCode() == 200) { stream = conn.getInputStream(); } else { stream = conn.getErrorStream(); } return new HttpResponse(stream, conn.getResponseCode(), new HttpResponse.Connection() { @Override public void close() { conn.disconnect(); } }); } catch (IOException e) { conn.disconnect(); throw e; } } /** * Builds an {@link HttpURLConnection} from the required URL. By default simply uses {@link URL#openConnection} and * and casts to HttpURLConnection. Override this method in order to perform more advanced operations like casting * to {@link javax.net.ssl.HttpsURLConnection} and providing your own socket factories to accept self-signed * certificates, or only accept pinned certificates. * * @param url The URL to open a connection for. * @return The opened connection. * @throws IOException If some kind of I/O error happens while establishing the connection. */ protected HttpURLConnection buildHttpUrlConnection(URL url) throws IOException { return (HttpURLConnection) url.openConnection(); } @Override public void setConnectionTimeout(int timeout) { connTimeout = timeout; } @Override public void setSocketTimeout(int timeout) { socketTimeout = timeout; } }
[ "alex@alexgilleran.com" ]
alex@alexgilleran.com
7de04cb9125b6dcbbf78179526a41597a933ea87
0f9242fbc82705331a2a8332dfa3282e1ae95b14
/src/main/java/io/ambpro/service/deplacement/api/IDeplacement.java
a5cba140a8e0922fe57a089e20edcda9f15b5b1a
[]
no_license
ambpro/tondeuse-gazon
b4e07c4f24facfc7ec73eed0c87ca4fc82ed3b20
27506f27b248fb14c26b0972af7c53a6b7cd49a4
refs/heads/master
2021-04-18T04:39:17.968056
2020-03-30T12:47:56
2020-03-30T12:47:56
249,505,372
0
0
null
2020-03-30T12:47:58
2020-03-23T17:58:14
HTML
UTF-8
Java
false
false
312
java
package io.ambpro.service.deplacement.api; import io.ambpro.service.machine.api.IMachine; import io.ambpro.service.machine.data.Surface; public interface IDeplacement { void avancer(Surface gazon, IMachine machine); void tournerAGauche(IMachine machine); void tournerADroite(IMachine machine); }
[ "aminboudeffa@gmail.com" ]
aminboudeffa@gmail.com
f1ba021ecd818dfe0c05d4d836c602fb8bd26609
eb16dfa9714e4bfc36892dc17fff7769813e2932
/yaswanth/matrices/MagicSquareMatrix.java
e02a91feb693a55d675a6171619516ef5c8e1511
[]
no_license
scriptbees-pvt-ltd/Java-Programs
1482dbde0a031fa4a20af0c43d2ef13062bff8c1
414c20bc3600862b4bceb9d107708122498d7131
refs/heads/master
2020-05-17T22:32:10.926729
2019-05-21T06:27:15
2019-05-21T06:27:15
184,004,876
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
package org.jsp.matrices; import java.util.Scanner; public class MagicSquareMatrix { public static void main(String[] args) { int rows,columns,sum1,sum2,sum3,sum4; sum1 = 0; sum2=0; sum3=0; sum4=0; Scanner scr = new Scanner(System.in); System.out.print("Enter the"+"\n"+"rows: "); rows = scr.nextInt(); System.out.print("columns: "); columns = scr.nextInt(); System.out.println("Enter the elements of matrix: "); int matrix[][] = new int[rows][columns]; for(int count=0;count<rows;count++) { for(int value=0;value<columns;value++) { System.out.print("row ["+count+"] coloumn ["+value+"]: "); matrix[count][value] = scr.nextInt(); } System.out.println(); } //Finding the sum of diagonals; //Diagonal 1: for(int count=0;count<rows;count++) sum1 = sum1+matrix[count][count]; //Diagonal 2: for(int count=0;count<rows;count++) { sum2 = sum2+matrix[count][rows-1-count]; } //Validating the diagonals sum; if(sum2 != sum1) System.out.println("The given matrix is not a MAGIC SQUARE"); else { //Finding the sum of rows; for(int count=0;count<rows;count++) { for(int value=0;value<columns;value++) { sum3 = sum3+matrix[count][value]; } if(sum3 != sum1) System.out.println("The given matrix is not a MAGIC SQUARE"); else { //Finding the sum of columns; for(int digit=0;digit<rows;digit++) { for(int value=0;value<columns;value++) { sum4 = sum4+matrix[value][digit]; } } } } if(sum4 == sum1) System.out.println("The given matrix is an MAGIC SQUARE"); } } }
[ "you@example.com" ]
you@example.com
0c25767756cb85e6f51cfa8db4e32beb37f069e2
e1df994a2b19762eb5cfa2430f0114e7a5823c60
/UKSelenium/src/qsp/P11.java
ea4b3359ba8e5cc17f471e935776f962eb176d5d
[]
no_license
Rupeshkumard/UKSelenium
4c50b9055438d4039bd8ea69622e74504b221260
159e75db85e86b9716e606840b291f883e5a4c65
refs/heads/master
2023-03-22T16:50:48.221929
2021-03-14T14:05:26
2021-03-14T14:05:26
347,648,669
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
package qsp; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class P11 { static { System.setProperty("webdriver.chrome.driver", "./driver/chromedriver.exe"); } public static void main(String[] args) throws InterruptedException { WebDriver driver = new ChromeDriver(); driver.get("http://www.skillrary.com"); driver.manage().window().maximize(); Thread.sleep(3000); driver.findElement(By.cssSelector("input[type='search']")).sendKeys("java"); Thread.sleep(3000); driver.close(); } }
[ "admin@DESKTOP-R4959BB" ]
admin@DESKTOP-R4959BB
02920361aca6c4621322c321d7b99a7ff70c401f
3ef55e152decb43bdd90e3de821ffea1a2ec8f75
/large/third-party/other/external-module-0061/src/java/external_module_0061/a/Foo0.java
e5de36b97ddecffea870e504a4e3985f148e362c
[ "BSD-3-Clause" ]
permissive
salesforce/bazel-ls-demo-project
5cc6ef749d65d6626080f3a94239b6a509ef145a
948ed278f87338edd7e40af68b8690ae4f73ebf0
refs/heads/master
2023-06-24T08:06:06.084651
2023-03-14T11:54:29
2023-03-14T11:54:29
241,489,944
0
5
BSD-3-Clause
2023-03-27T11:28:14
2020-02-18T23:30:47
Java
UTF-8
Java
false
false
1,304
java
package external_module_0061.a; import javax.net.ssl.*; import javax.rmi.ssl.*; import java.awt.datatransfer.*; /** * Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut * labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. * Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. * * @see javax.management.Attribute * @see javax.naming.directory.DirContext * @see javax.net.ssl.ExtendedSSLSession */ @SuppressWarnings("all") public abstract class Foo0<I> implements external_module_0061.a.IFoo0<I> { javax.rmi.ssl.SslRMIClientSocketFactory f0 = null; java.awt.datatransfer.DataFlavor f1 = null; java.beans.beancontext.BeanContext f2 = null; public I element; public static Foo0 instance; public static Foo0 getInstance() { return instance; } public static <T> T create(java.util.List<T> input) { return null; } public String getName() { return element.toString(); } public void setName(String string) { return; } public I get() { return element; } public void set(Object element) { this.element = (I)element; } public I call() throws Exception { return (I)getInstance().call(); } }
[ "gwagenknecht@salesforce.com" ]
gwagenknecht@salesforce.com
d93736b1a7e618c72adf0c6670e998e837ceeb0e
e012b62187a1416d863c9240aaf0e35da96db011
/src/main/java/com/company/task/AppRunner.java
6490e810a0dc1ede85259667aacc1a7da88f467b
[]
no_license
yolch-yolchyan/fighter
7e94c91b0491430ea45e0e55d3d3951dae34ea68
71f32d9e00e25ba02d8691368792fa80b9ae6049
refs/heads/master
2020-03-26T15:24:57.811620
2018-08-17T06:27:07
2018-08-17T06:27:07
144,678,220
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package com.company.task; import com.company.task.common.io.InputReader; import com.company.task.common.io.ScannerReaderImpl; import com.company.task.common.model.GameData; import com.company.task.module.GameStartingModule; /** * contains main method for running the game */ public class AppRunner { /** * main method to run the game * * @param args */ public static void main(String[] args) { InputReader reader = new ScannerReaderImpl(); GameStartingModule gameRunner = new GameStartingModule(new GameData()); gameRunner.run(reader); } }
[ "artur.yolchyan.1990@gmail.com" ]
artur.yolchyan.1990@gmail.com
e2eca8520ec6530acbddde1c4bcdaf9c808918da
3862d28446c79f08e2ed81d171d8a8f9f8e37e63
/src/main/java/video/netty/protocol/MyServerInitialiaer.java
6c82e7df0608cb0e43282ebe72dc18b7df7a9ee7
[]
no_license
Asituyasi/MyStudy
7339cfeeef0e5384a5395008410fdffc9baa70f5
50ed8505a54e0f2e09c162747140b2f8fe808210
refs/heads/master
2020-04-26T07:46:42.963183
2019-03-02T04:39:20
2019-03-02T04:39:20
173,403,686
1
0
null
null
null
null
UTF-8
Java
false
false
528
java
package video.netty.protocol; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; public class MyServerInitialiaer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new MyPersonDecoder()); pipeline.addLast(new MyPersonEncoder()); pipeline.addLast(new MyServerHandler()); } }
[ "269544167@qq.com" ]
269544167@qq.com
1bc384432d7e9d628a51760f0a81c72ace935a1d
6b2975101d1fec85dba63e7898be2681918815e6
/concurrent_prac/src/concurrent_prac/BlockingQueueSample.java
2aa1dfa43f6d123afbc6a3b6f78cbb882f5c81de
[]
no_license
JulyKikuAkita/JavaPrac
dae0e25995d4399c586d6efd48ebb8aac4782425
1de3d4e8c6b40b001f98ea8caf70ce5752af9344
refs/heads/master
2021-01-21T16:48:22.322766
2017-05-20T17:15:05
2017-05-20T17:15:05
91,906,667
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package concurrent_prac; import java.util.LinkedList; import java.util.List; // http://tutorials.jenkov.com/java-concurrency/blocking-queues.html public class BlockingQueueSample { private List queue = new LinkedList(); private int limit = 10; public BlockingQueueSample(int limit){ this.limit = limit; } public synchronized void enqueue(Object item) throws InterruptedException { while(this.queue.size() == this.limit) { wait(); } if(this.queue.size() == 0) { notifyAll(); } this.queue.add(item); } public synchronized Object dequeue() throws InterruptedException{ while(this.queue.size() == 0){ wait(); } if(this.queue.size() == this.limit){ notifyAll(); } return this.queue.remove(0); } }
[ "b92701105@gmail.com" ]
b92701105@gmail.com
64c5915b1c34a4c3fef2323d2a323867cb4eb323
9df1e6cd396e87704e5d3491a56a820dd4c5d2d9
/11_annotations/src/children/Example.java
9bf7e83f2848d542f0fd7f73cf91fee518aab089
[]
no_license
ITWorks4U/Java-Tutorial
b65c7ffe36e9e6723f385791c70fc6e166b7d228
f0639de67dc73854776c601fbec8a1cf6f80142d
refs/heads/master
2022-12-22T09:40:40.501512
2020-10-03T11:45:57
2020-10-03T11:45:57
282,119,436
0
0
null
null
null
null
UTF-8
Java
false
false
2,298
java
/** * How to use annotation classes with our own defined class. * * @author ITWorks4U */ package children; import java.lang.annotation.Annotation; import annotations.AnnotationExample; import annotations.CustomAnnotation; import enumerations.EnumExample; public class Example { @SuppressWarnings({ "deprecation", "incomplete-switch" }) public static void main(String[] args) { Cube cube = new Cube(3, 6, 9); Pyramid pyramid = new Pyramid(10, 10, 22); // outputs for Cube System.out.println("\n ***** CUBE *****\n"); System.out.println("area = " + cube.calculateArea()); System.out.println("volume = " + cube.calculateVolume()); System.out.println("circumference = " + cube.calculateCircumference()); System.out.println("geometric object's is a = " + cube.getTypeOfGeometricObject()); System.out.println("cube width: " + cube.getWidth()); System.out.println("cube height: " + cube.getHeight()); System.out.println("cube depth: " + cube.getDepth()); // outputs for Pyramid System.out.println("\n ***** PYRAMID *****\n"); System.out.println("area = " + pyramid.calculateArea()); System.out.println("volume = " + pyramid.calculateVolume()); System.out.println("geometric object's is a = " + pyramid.getTypeOfGeometricObject()); // get the children of the class System.out.println("\n ***** COMPARING SOMETHING *****\n"); System.out.println("Is \"go\" a part of GeometricObject? → " + EnumExample.isPartOfBaseClass(GeometricObject.class)); System.out.println("Is \"cube\" a part of GeometricObject? → " + EnumExample.isPartOfBaseClass(Cube.class)); System.out.println("Is \"pyramid\" a part of GeometricObject? → " + EnumExample.isPartOfBaseClass(Pyramid.class)); System.out.println("Is \"Example\" a part of GeometricObject? → " + EnumExample.isPartOfBaseClass(Example.class)); System.out.println("\n **********\n"); EnumExample ex = EnumExample.UNKNOWN; switch (ex) { } Class<AnnotationExample> object = AnnotationExample.class; Annotation annotation = object.getAnnotation(CustomAnnotation.class); CustomAnnotation ca = (CustomAnnotation) annotation; System.out.println(ca.author()); System.out.println(ca.value()); for (String tmp : ca.tags()) { System.out.println(tmp); } } }
[ "noreply@github.com" ]
ITWorks4U.noreply@github.com
04693929e0cfd2e7c93fae99109bab15e79b9633
19079c088fc306ac773d4a6f7e85715a3fc8cc9d
/android/libui/src/com/wonderingwall/container/HorizontalListView.java
1a7ca7fe1c1c283c1b9d310fb4edf52fdc21f503
[ "Apache-2.0" ]
permissive
davidzou/WonderingWall
75929193af4852675209b21dd544cb8b60da5fa5
1060f6501c432510e164578d4af60a49cd5ed681
refs/heads/master
2022-11-03T22:33:12.340125
2022-10-14T08:12:14
2022-10-14T08:12:14
5,868,257
4
0
null
null
null
null
UTF-8
Java
false
false
10,495
java
/* * HorizontalListView.java v1.5 * * * The MIT License * Copyright (c) 2011 Paul Soucy (<a href="\"mailto:paul@dev-smart.com\"">paul@dev-smart.com</a>) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ package com.wonderingwall.container; import android.content.Context; import android.database.DataSetObserver; import android.graphics.Rect; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.GestureDetector.OnGestureListener; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.Scroller; import java.util.LinkedList; import java.util.Queue; /** * 水平滚动的ListView实现,只能用于手机。不能用于TV,没有键盘监听和focus的操作 */ public class HorizontalListView extends AdapterView<ListAdapter> { public boolean mAlwaysOverrideTouch = true; protected ListAdapter mAdapter; private int mLeftViewIndex = -1; private int mRightViewIndex = 0; protected int mCurrentX; protected int mNextX; private int mMaxX = Integer.MAX_VALUE; private int mDisplayOffset = 0; protected Scroller mScroller; private GestureDetector mGesture; private Queue<View> mRemovedViewQueue = new LinkedList<View>(); private OnItemSelectedListener mOnItemSelected; private OnItemClickListener mOnItemClicked; private OnItemLongClickListener mOnItemLongClicked; private boolean mDataChanged = false; public HorizontalListView(Context context, AttributeSet attrs) { super(context, attrs); initView(); } private synchronized void initView() { mLeftViewIndex = -1; mRightViewIndex = 0; mDisplayOffset = 0; mCurrentX = 0; mNextX = 0; mMaxX = Integer.MAX_VALUE; mScroller = new Scroller(getContext()); mGesture = new GestureDetector(getContext(), mOnGesture); setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { Log.e("HorizontalListView", "" + keyCode); return false; } }); requestFocus(); } @Override public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener) { mOnItemSelected = listener; } @Override public void setOnItemClickListener(AdapterView.OnItemClickListener listener) { mOnItemClicked = listener; } @Override public void setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener) { mOnItemLongClicked = listener; } private DataSetObserver mDataObserver = new DataSetObserver() { @Override public void onChanged() { synchronized (HorizontalListView.this) { mDataChanged = true; } invalidate(); requestLayout(); } @Override public void onInvalidated() { reset(); invalidate(); requestLayout(); } }; @Override public ListAdapter getAdapter() { return mAdapter; } @Override public View getSelectedView() { // TODO: implement return null; } @Override public void setAdapter(ListAdapter adapter) { if (mAdapter != null) { mAdapter.unregisterDataSetObserver(mDataObserver); } mAdapter = adapter; mAdapter.registerDataSetObserver(mDataObserver); reset(); } private synchronized void reset() { initView(); removeAllViewsInLayout(); requestLayout(); } @Override public void setSelection(int position) { // TODO: implement } private void addAndMeasureChild(final View child, int viewPos) { LayoutParams params = child.getLayoutParams(); if (params == null) { params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } addViewInLayout(child, viewPos, params, true); child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); } @Override protected synchronized void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mAdapter == null) { return; } if (mDataChanged) { int oldCurrentX = mCurrentX; initView(); removeAllViewsInLayout(); mNextX = oldCurrentX; mDataChanged = false; } if (mScroller.computeScrollOffset()) { int scrollx = mScroller.getCurrX(); mNextX = scrollx; } if (mNextX <= 0) { mNextX = 0; mScroller.forceFinished(true); } if (mNextX >= mMaxX) { mNextX = mMaxX; mScroller.forceFinished(true); } int dx = mCurrentX - mNextX; removeNonVisibleItems(dx); fillList(dx); positionItems(dx); mCurrentX = mNextX; if (!mScroller.isFinished()) { post(new Runnable() { @Override public void run() { requestLayout(); } }); } } private void fillList(final int dx) { int edge = 0; View child = getChildAt(getChildCount() - 1); if (child != null) { edge = child.getRight(); } fillListRight(edge, dx); edge = 0; child = getChildAt(0); if (child != null) { edge = child.getLeft(); } fillListLeft(edge, dx); } private void fillListRight(int rightEdge, final int dx) { while (rightEdge + dx < getWidth() && mRightViewIndex < mAdapter.getCount()) { View child = mAdapter.getView(mRightViewIndex, mRemovedViewQueue.poll(), this); addAndMeasureChild(child, -1); rightEdge += child.getMeasuredWidth(); if (mRightViewIndex == mAdapter.getCount() - 1) { mMaxX = mCurrentX + rightEdge - getWidth(); } if (mMaxX < 0) { mMaxX = 0; } mRightViewIndex++; } } private void fillListLeft(int leftEdge, final int dx) { while (leftEdge + dx > 0 && mLeftViewIndex >= 0) { View child = mAdapter.getView(mLeftViewIndex, mRemovedViewQueue.poll(), this); addAndMeasureChild(child, 0); leftEdge -= child.getMeasuredWidth(); mLeftViewIndex--; mDisplayOffset -= child.getMeasuredWidth(); } } private void removeNonVisibleItems(final int dx) { View child = getChildAt(0); while (child != null && child.getRight() + dx <= 0) { mDisplayOffset += child.getMeasuredWidth(); mRemovedViewQueue.offer(child); removeViewInLayout(child); mLeftViewIndex++; child = getChildAt(0); } child = getChildAt(getChildCount() - 1); while (child != null && child.getLeft() + dx >= getWidth()) { mRemovedViewQueue.offer(child); removeViewInLayout(child); mRightViewIndex--; child = getChildAt(getChildCount() - 1); } } private void positionItems(final int dx) { if (getChildCount() > 0) { mDisplayOffset += dx; int left = mDisplayOffset; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); int childWidth = child.getMeasuredWidth(); child.layout(left, 0, left + childWidth, child.getMeasuredHeight()); left += childWidth + child.getPaddingRight(); } } } public synchronized void scrollTo(int x) { mScroller.startScroll(mNextX, 0, x - mNextX, 0); requestLayout(); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { boolean handled = super.dispatchTouchEvent(ev); handled |= mGesture.onTouchEvent(ev); return handled; } protected boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { synchronized (HorizontalListView.this) { mScroller.fling(mNextX, 0, (int) -velocityX, 0, 0, mMaxX, 0, 0); } requestLayout(); return true; } protected boolean onDown(MotionEvent e) { mScroller.forceFinished(true); return true; } private OnGestureListener mOnGesture = new GestureDetector.SimpleOnGestureListener() { @Override public boolean onDown(MotionEvent e) { return HorizontalListView.this.onDown(e); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return HorizontalListView.this.onFling(e1, e2, velocityX, velocityY); } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { synchronized (HorizontalListView.this) { mNextX += (int) distanceX; } requestLayout(); return true; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (isEventWithinView(e, child)) { if (mOnItemClicked != null) { mOnItemClicked.onItemClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i)); } if (mOnItemSelected != null) { mOnItemSelected.onItemSelected(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i)); } break; } } return true; } @Override public void onLongPress(MotionEvent e) { int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); if (isEventWithinView(e, child)) { if (mOnItemLongClicked != null) { mOnItemLongClicked.onItemLongClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i)); } break; } } } private boolean isEventWithinView(MotionEvent e, View child) { Rect viewRect = new Rect(); int[] childPosition = new int[2]; child.getLocationOnScreen(childPosition); int left = childPosition[0]; int right = left + child.getWidth(); int top = childPosition[1]; int bottom = top + child.getHeight(); viewRect.set(left, top, right, bottom); return viewRect.contains((int) e.getRawX(), (int) e.getRawY()); } }; }
[ "spt_genius@hotmail.com" ]
spt_genius@hotmail.com
5ad4e93f35dc7223d8ad8bc2632e723804a384e3
e63e4e91a885d5d5338f5d4dc29878ae8beb7d8f
/api/src/main/java/com/lijingyao/gateway/consul/api/assemblers/UserCenterAssembler.java
c0dfe78450c2e4de8eee4add36207ae11e8d68b6
[]
no_license
lijingyao/gateway_consul
c92846c08482ba4dfde1fbf05db27a1f51744269
2105e0b38e5eb104d9c8a381a1ac73970319fa31
refs/heads/master
2023-01-30T15:30:22.979157
2020-12-09T10:25:11
2020-12-09T10:25:11
319,807,098
0
0
null
null
null
null
UTF-8
Java
false
false
2,225
java
package com.lijingyao.gateway.consul.api.assemblers; import com.lijingyao.gateway.consul.api.models.OrderDetailModel; import com.lijingyao.gateway.consul.api.models.UserCenterModel; import com.lijingyao.gateway.consul.api.models.UserSimpleOrderModel; import com.lijingyao.microservice.coffee.template.trade.OrderDTO; import com.lijingyao.microservice.coffee.template.trade.OrderDetailDTO; import com.lijingyao.microservice.coffee.template.users.UserDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cglib.beans.BeanCopier; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * Created by lijingyao on 2018/7/9 16:50. */ @Component public class UserCenterAssembler { @Autowired private OrderAssembler orderAssembler; private BeanCopier userDTOCopier = BeanCopier.create(UserDTO.class, UserCenterModel.class, false); public UserCenterModel wrapUserModel(UserDTO userDTO, List<OrderDTO> orderDTOS, List<OrderDetailDTO> detailDTOS) { UserCenterModel model = new UserCenterModel(); userDTOCopier.copy(userDTO, model, null); if (!CollectionUtils.isEmpty(orderDTOS)) { Map<String, OrderDetailDTO> detailDTOMap = detailDTOS.stream().collect(Collectors.toMap(x -> x.getMainOrderId(), x -> x)); List<UserSimpleOrderModel> orderModels = orderDTOS.stream().map(o -> assembleSimpleOrder(o, detailDTOMap)).collect(Collectors.toList()); model.setOrderModels(orderModels); } return model; } private UserSimpleOrderModel assembleSimpleOrder(OrderDTO o, Map<String, OrderDetailDTO> detailDTOMap) { UserSimpleOrderModel model = new UserSimpleOrderModel(); model.setCreateTime(o.getCreateTime()); model.setOrderId(o.getOrderId()); model.setOrderPrice(o.getTotalPrice()); if (detailDTOMap.get(o.getOrderId()) != null) { OrderDetailModel detailModel = orderAssembler.wrapDetailOrderModel(detailDTOMap.get(o.getOrderId())); model.setDetail(detailModel); } return model; } }
[ "weiwen@zb100.com" ]
weiwen@zb100.com
f44a94d097f646cd20fa28a048a39039cfffb028
e6341ee38043e093795fa2cf2ab70563c8f1fec2
/src/com/lewky/bean/CourseSelection.java
5aff80f15b7e6ed513aea593781c9e9547025e10
[]
no_license
yiwuxia/graduationProject
723af85907a49a7b1ce65ff9770519d8252c44f3
ef8e34310d01e8233648ac26c4560b5f80ce3af8
refs/heads/master
2021-09-03T16:45:03.585301
2018-01-10T14:45:57
2018-01-10T14:45:57
117,815,953
1
0
null
2018-01-17T09:41:08
2018-01-17T09:41:07
null
UTF-8
Java
false
false
2,325
java
package com.lewky.bean; import java.io.Serializable; public class CourseSelection implements Serializable{ private String studentNum; private String studentName; private String courseNum; private String courseName; private String teacherNum; private String teacherName; private String regularGrade; //平时成绩 private String midtermGrade; //期中成绩 private String finalExamGrade; //期末成绩 private String grade; //综合成绩 public String getStudentNum() { return studentNum; } public void setStudentNum(String studentNum) { this.studentNum = studentNum; } public String getCourseNum() { return courseNum; } public void setCourseNum(String courseNum) { this.courseNum = courseNum; } public String getTeacherNum() { return teacherNum; } public void setTeacherNum(String teacherNum) { this.teacherNum = teacherNum; } public String getGrade() { return grade; } public void setGrade(String grade) { this.grade = grade; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public String getTeacherName() { return teacherName; } public void setTeacherName(String teacherName) { this.teacherName = teacherName; } public String getRegularGrade() { return regularGrade; } public void setRegularGrade(String regularGrade) { this.regularGrade = regularGrade; } public String getMidtermGrade() { return midtermGrade; } public void setMidtermGrade(String midtermGrade) { this.midtermGrade = midtermGrade; } public String getFinalExamGrade() { return finalExamGrade; } public void setFinalExamGrade(String finalExamGrade) { this.finalExamGrade = finalExamGrade; } @Override public String toString() { return "CourseSelection [studentNum=" + studentNum + ", studentName=" + studentName + ", courseNum=" + courseNum + ", courseName=" + courseName + ", teacherNum=" + teacherNum + ", teacherName=" + teacherName + ", regularGrade=" + regularGrade + ", midtermGrade=" + midtermGrade + ", finalExamGrade=" + finalExamGrade + ", grade=" + grade + "]"; } }
[ "1019175915@qq.com" ]
1019175915@qq.com
a9ab7fa45551b11038ffda01ea6eaf23d0caa232
21b736028889a32f1dcba96e8236f80cc9973df5
/src/com/microsoft/schemas/crm/_2011/contracts/impl/ArrayOfArrayOfFaultTypeImpl.java
e8778bba83106d175554f88dd5cb36cbe2830683
[]
no_license
nbuddharaju/Java2CRMCRUD
3cfcf487ce9fe9c8791484387f32da2e83ccef15
aaba26757df088dda780aa6fe873c7d8356f4d56
refs/heads/master
2021-01-19T04:07:07.528318
2016-05-28T08:52:28
2016-05-28T08:52:28
59,885,531
0
2
null
null
null
null
UTF-8
Java
false
false
6,086
java
/* * XML Type: ArrayOfArrayOfFaultType * Namespace: http://schemas.microsoft.com/crm/2011/Contracts * Java type: com.microsoft.schemas.crm._2011.contracts.ArrayOfArrayOfFaultType * * Automatically generated - do not modify. */ package com.microsoft.schemas.crm._2011.contracts.impl; /** * An XML ArrayOfArrayOfFaultType(@http://schemas.microsoft.com/crm/2011/Contracts). * * This is a complex type. */ public class ArrayOfArrayOfFaultTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.microsoft.schemas.crm._2011.contracts.ArrayOfArrayOfFaultType { private static final long serialVersionUID = 1L; public ArrayOfArrayOfFaultTypeImpl(org.apache.xmlbeans.SchemaType sType) { super(sType); } private static final javax.xml.namespace.QName ARRAYOFFAULTTYPE$0 = new javax.xml.namespace.QName("http://schemas.microsoft.com/crm/2011/Contracts", "ArrayOfFaultType"); /** * Gets array of all "ArrayOfFaultType" elements */ public com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType[] getArrayOfFaultTypeArray() { synchronized (monitor()) { check_orphaned(); java.util.List targetList = new java.util.ArrayList(); get_store().find_all_element_users(ARRAYOFFAULTTYPE$0, targetList); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType[] result = new com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType[targetList.size()]; targetList.toArray(result); return result; } } /** * Gets ith "ArrayOfFaultType" element */ public com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType getArrayOfFaultTypeArray(int i) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().find_element_user(ARRAYOFFAULTTYPE$0, i); if (target == null) { throw new IndexOutOfBoundsException(); } return target; } } /** * Tests for nil ith "ArrayOfFaultType" element */ public boolean isNilArrayOfFaultTypeArray(int i) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().find_element_user(ARRAYOFFAULTTYPE$0, i); if (target == null) { throw new IndexOutOfBoundsException(); } return target.isNil(); } } /** * Returns number of "ArrayOfFaultType" element */ public int sizeOfArrayOfFaultTypeArray() { synchronized (monitor()) { check_orphaned(); return get_store().count_elements(ARRAYOFFAULTTYPE$0); } } /** * Sets array of all "ArrayOfFaultType" element WARNING: This method is not atomicaly synchronized. */ public void setArrayOfFaultTypeArray(com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType[] arrayOfFaultTypeArray) { check_orphaned(); arraySetterHelper(arrayOfFaultTypeArray, ARRAYOFFAULTTYPE$0); } /** * Sets ith "ArrayOfFaultType" element */ public void setArrayOfFaultTypeArray(int i, com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType arrayOfFaultType) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().find_element_user(ARRAYOFFAULTTYPE$0, i); if (target == null) { throw new IndexOutOfBoundsException(); } target.set(arrayOfFaultType); } } /** * Nils the ith "ArrayOfFaultType" element */ public void setNilArrayOfFaultTypeArray(int i) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().find_element_user(ARRAYOFFAULTTYPE$0, i); if (target == null) { throw new IndexOutOfBoundsException(); } target.setNil(); } } /** * Inserts and returns a new empty value (as xml) as the ith "ArrayOfFaultType" element */ public com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType insertNewArrayOfFaultType(int i) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().insert_element_user(ARRAYOFFAULTTYPE$0, i); return target; } } /** * Appends and returns a new empty value (as xml) as the last "ArrayOfFaultType" element */ public com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType addNewArrayOfFaultType() { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType target = null; target = (com.microsoft.schemas.crm._2011.contracts.ArrayOfFaultType)get_store().add_element_user(ARRAYOFFAULTTYPE$0); return target; } } /** * Removes the ith "ArrayOfFaultType" element */ public void removeArrayOfFaultType(int i) { synchronized (monitor()) { check_orphaned(); get_store().remove_element(ARRAYOFFAULTTYPE$0, i); } } }
[ "ravi.buddharaju@aviso.com" ]
ravi.buddharaju@aviso.com
c185d956706d34f41ea35db037530dbb3f558f7d
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Lang/41/org/apache/commons/lang/math/FloatRange_getMinimumFloat_228.java
d0286cd6d36fbab6e1d9ca5fb15800fc34c14f83
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
666
java
org apach common lang math code float rang floatrang code repres inclus rang code code author stephen colebourn version float rang floatrang rang serializ minimum number rang code code minimum number rang overrid minimum float getminimumfloat min
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
680fe562cedc8d65ab4f39f72acb0eae9a0d0383
d95ad0bfc3329a98af180464b1fe56a99cc45775
/src/LogisticsManager/Orders/package-info.java
b2f07a01a896582c7e7f363516f2f0e8e20ae690
[]
no_license
plutztom/LogisticsApplication
658ab5eb6345ee3f456c11c4ad2bfc2cb41d01c4
2e3c14dfd9169d32ed89552115d2824b7e18a8ae
refs/heads/master
2021-01-19T23:52:43.827556
2017-04-22T04:43:02
2017-04-22T04:43:02
89,044,402
0
0
null
null
null
null
UTF-8
Java
false
false
200
java
/** * */ /** * @author Soxluvr23 * */ package LogisticsManager.Orders; /*The Order Package takes order XML files, creates them as Order Objects and then puts them in an Order Manager*/
[ "noreply@github.com" ]
plutztom.noreply@github.com
301179d20d31cbf938ca3ceb3ca9df17b9bf20ab
9f44eb3719ad931ab6f451b7107631cdb16cc677
/app/src/main/java/com/example/kantai/androidexampledemo/Ch11Activity.java
b825deeb1e88d234b33aaf4ce47174befbc74691
[]
no_license
Kantai235/Mon-says-dinners-waiting-for-Android-Tutorial
dd3a5cc5a7c52293c6276a9f1ae3659aac853d20
f31ec216c580f37db0f27dfa45710295849826c2
refs/heads/master
2021-01-24T11:27:48.938240
2016-10-13T09:31:57
2016-10-13T09:31:57
70,234,019
1
0
null
null
null
null
UTF-8
Java
false
false
1,777
java
package com.example.kantai.androidexampledemo; import android.app.ActivityOptions; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.transition.Transition; import android.transition.TransitionInflater; import android.view.KeyEvent; import android.view.Window; import com.beardedhen.androidbootstrap.TypefaceProvider; public class Ch11Activity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_ch11); Transition explode = TransitionInflater.from(this).inflateTransition(R.transition.explode); //退出時使用 getWindow().setExitTransition(explode); //第一次進入時使用 getWindow().setEnterTransition(explode); //再次進入時使用 getWindow().setReenterTransition(explode); // You should also override your application class with the following. TypefaceProvider.registerDefaultIconSets(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(Ch11Activity.this, MainActivity.class); startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle()); overridePendingTransition(R.transition.zoomin, R.transition.zoomout); return true; } return super.onKeyDown(keyCode, event); } @Override protected void onStop() { super.onStop(); finish(); } }
[ "huevo235@gmail.com" ]
huevo235@gmail.com
de60a4f78382eca1fda8c57d7b66ad79f8addc66
36898748c4beb5dfc5165621a41a6843d0c952ba
/fastrpc-protocol/fastrpc-protocol-api/src/main/java/com/fast/fastrpc/protocol/AbstractExporter.java
0a6323e941627b01dd4c527f8a70696ddf2b5036
[ "Apache-2.0" ]
permissive
zhengyuefeng/fastrpc
28b56e9cfc7cafd68bb319a34ec194df5acba24e
55a750fdc9154fd95f1da2cf81338c23a0f58d8e
refs/heads/master
2022-12-24T22:53:06.967962
2020-09-19T09:18:53
2020-09-19T09:18:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.fast.fastrpc.protocol; import com.fast.fastrpc.Exporter; import com.fast.fastrpc.Invoker; import java.util.concurrent.atomic.AtomicBoolean; /** * @author yiji * @version : AbstractExporter.java, v 0.1 2020-07-30 */ public abstract class AbstractExporter<T> implements Exporter<T> { protected AtomicBoolean destroyed; protected Invoker<T> invoker; public AbstractExporter(Invoker<T> invoker) { if (invoker == null) throw new IllegalStateException("service invoker is required."); this.invoker = invoker; this.destroyed = new AtomicBoolean(); } @Override public Invoker<T> getInvoker() { return invoker; } @Override public void destroy() { if (destroyed.compareAndSet(false, true)) { getInvoker().destroy(); } } }
[ "yiji@apache.org" ]
yiji@apache.org
e41ba1ad6c389df6b9212de21de2dc90ef81fef1
27627e778e5180c17dde44721147a630be8c3daa
/src/main/java/de/l3s/eumssi/action/second_screenAction.java
5f3d2119774fbbd3ff05808768c7bb53628a9974
[]
no_license
EUMSSI/EumssiEventExplorer
d6af46420ee1005fa027088c80f7e4ee22370756
7803da680623cdb16f3a24bbc2ce2e9e5e8076a1
refs/heads/master
2021-01-24T06:25:14.241474
2017-03-24T11:22:02
2017-03-24T11:22:02
43,751,047
0
2
null
2016-01-22T13:51:28
2015-10-06T13:05:13
JavaScript
UTF-8
Java
false
false
2,408
java
package de.l3s.eumssi.action; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.io.FilenameUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.ServletRequestAware; public class second_screenAction implements ServletRequestAware{ public String userId=null; public String subtitleName; public Map<String,String> videoMap=new HashMap<String,String>(); HttpServletRequest request; public String execute() throws Exception { //check for user session HttpSession session = request.getSession(false); userId=request.getParameter("userId"); if (session==null ||session.getAttribute("userId") == null) { if(userId==null){ System.out.println("no user id"); return "login"; } else{ session = request.getSession(true); session.setAttribute("userId", userId); System.out.println(session.getAttribute("userId")); // videoListCreator(); return "success"; } } else{ userId=(String) session.getAttribute("userId"); return "success"; } } /* private void videoListCreator(){ List fileList =new ArrayList(); ServletContext context = request.getServletContext(); String path = context.getRealPath("/"); String sCurrentLine; // File[] files = new File(path + File.separator + "video_state").listFiles((dir, name) -> !name.equals(".DS_Store")); // If this pathname does not denote a directory, then listFiles() // returns null. // ; for (File file : files) { if (file.isFile()) { fileList.add(file.getName()); } } System.out.println(fileList); System.out.println(userId); for(int i=0;i<fileList.size();i++){ String fileName=(String) fileList.get(i); fileName = FilenameUtils.removeExtension(fileName); String[] splitedNames=fileName.split("&&"); if(splitedNames[0].equals(userId)){ String mapValue=splitedNames[1].replaceAll("_", " "); videoMap.put(splitedNames[1],mapValue); } } System.out.println("videomap"+videoMap); } */ @Override public void setServletRequest(HttpServletRequest request) { this.request = request; } }
[ "quraishimainul@gmail.com" ]
quraishimainul@gmail.com
52859abe758d0582e36da6860c1bd55b5cc7fcc1
d13deaa2b8dc1134edb8bbaa7f5addbe047ad0c4
/app/src/main/java/tv/kuainiu/ui/liveold/adapter/MyReplayQAListViewAdapter.java
3697cc506903b2d189e9e8c110266d32ef856f0e
[]
no_license
shitou9999/livedemo
57bd477915a9e174827cafffc041fa94cf278b41
ac6c1b89510fbc00da26dc01053f19f9dc7fb98b
refs/heads/master
2020-05-23T10:21:11.291930
2016-11-25T10:37:05
2016-11-25T10:37:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,671
java
package tv.kuainiu.ui.liveold.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.bokecc.sdk.mobile.live.replay.pojo.ReplayAnswerMsg; import com.bokecc.sdk.mobile.live.replay.pojo.ReplayQAMsg; import com.bokecc.sdk.mobile.live.replay.pojo.ReplayQuestionMsg; import java.util.ArrayList; import java.util.List; import java.util.TreeSet; import tv.kuainiu.R; public class MyReplayQAListViewAdapter extends BaseAdapter { private Context context; private List<ReplayQAMsg> qaMsgs; public MyReplayQAListViewAdapter(Context context, TreeSet<ReplayQAMsg> qaMsgs) { this.context = context; this.qaMsgs = new ArrayList<ReplayQAMsg>(qaMsgs); } @Override public boolean areAllItemsEnabled() { return false; } @Override public boolean isEnabled(int position) { return false; } @Override public int getCount() { return qaMsgs.size(); } @Override public Object getItem(int position) { return qaMsgs.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { viewHolder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.lv_qa_view, parent, false); viewHolder.answer = (TextView) convertView.findViewById(R.id.tv_answer); viewHolder.question = (TextView) convertView.findViewById(R.id.tv_question); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } ReplayQAMsg qaMsg = qaMsgs.get(position); ReplayQuestionMsg question = qaMsg.getReplayQuestionMsg(); viewHolder.question.setText(question.getQuestionUserName() + "问:" + question.getContent()); TreeSet<ReplayAnswerMsg> answers = qaMsg.getReplayAnswerMsgs(); if (answers.size() < 1) { viewHolder.question.setVisibility(View.GONE); viewHolder.answer.setVisibility(View.GONE); return convertView; } StringBuilder sb = new StringBuilder(); for (ReplayAnswerMsg answer: answers) { sb.append(answer.getUserName() + "答:" + answer.getContent() + "\n"); } if (sb.length() > 2) { viewHolder.answer.setText(sb.substring(0, sb.length() - 1)); } else { viewHolder.answer.setText(""); } viewHolder.question.setVisibility(View.VISIBLE); viewHolder.answer.setVisibility(View.VISIBLE); return convertView; } private class ViewHolder { public TextView question; public TextView answer; } }
[ "yangBAO123456" ]
yangBAO123456
9fe28b4d52e5e8ab8c6269f7a8cc7480eb4e2009
fae82924cc0ad05790567385b736008362964beb
/casetudy-module-4/src/main/java/com/example/dto/ServiceDto.java
32389aa36c5c72b536aecbbd70b4d5db61de16e9
[]
no_license
hauhp94/C0321G1_HuynhPhuocHau_Module4
4167b6ab0b28fe7387f79018eca2d37c79e87dcc
d636275a934876ea578dad8e7537e10be01f489a
refs/heads/master
2023-07-03T21:52:13.330991
2021-08-12T17:25:20
2021-08-12T17:25:20
385,274,194
0
0
null
null
null
null
UTF-8
Java
false
false
1,562
java
package com.example.dto; import com.example.model.entity.RentType; import com.example.model.entity.ServiceType; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.validation.Errors; import org.springframework.validation.Validator; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class ServiceDto implements Validator { public int serviceId; public String serviceCode; @NotBlank public String serviceName; @Min(0) public int serviceArea; @Min(0) public double serviceCost; @Min(1) public int serviceMaxPeople; public RentType rentType; public ServiceType serviceType; @NotBlank public String standardRoom; @NotBlank public String descriptionOtherConvenience; @Min(10) public double poolArea; @Min(1) public int numberOfFloors; @NotBlank public String freeService; @Override public boolean supports(Class<?> clazz) { return false; } @Override public void validate(Object target, Errors errors) { ServiceDto serviceDto = (ServiceDto) target; String patternCode = "^DV-\\d{4}"; if (!java.util.regex.Pattern.matches(patternCode, serviceDto.serviceCode)) { errors.rejectValue("serviceCode", "serviceCode.matches"); } } }
[ "hauhpdn2015@gmail.com" ]
hauhpdn2015@gmail.com
e9dad4253e97acf82ac776334a5b536fa5fecf43
ba83ea71e11ea0b1a4b7b9775c2c75f76d8f13d2
/src/eveqt/operators/unary/LogOperator.java
3ed72509c5fb4389de1737e9629378a60d60971b
[ "MIT" ]
permissive
mcgreentn/eveqt
4403a96089710b4995b4aba7964b2bf673a361a5
257e18ce4fe96c5ca2ab38c42fa6db8caf87a3d6
refs/heads/master
2020-09-14T20:36:56.146884
2019-11-15T23:31:43
2019-11-15T23:31:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package eveqt.operators.unary; import java.util.HashMap; import eveqt.EquationNode; public class LogOperator extends UnaryOperator{ public LogOperator(EquationNode child) { super(child); } @Override public double evaluate(HashMap<String, Double> variables) { return Math.log(Math.abs(this.child.evaluate(variables))); } @Override public String toString() { return "ln(" + this.child.toString() + ")"; } }
[ "amidos2002@hotmail.com" ]
amidos2002@hotmail.com
621cb7728454a783acfdb0f0706d1053d9fa153d
b577c2599f7963ee91cecb86d7e65fb946cbe1aa
/Mxd_community/app/src/main/java/com/project/mxd/mxd_community/OrderManagerAdapter.java
b63dce7d2146258c49585f14f242072970c0ce64
[]
no_license
Max2872/mxd_community
9bbdb5ece33012124411384f3dcbbb81637c640a
b293c91f107b1b425be73b6758ce814da13dcc27
refs/heads/master
2021-05-01T21:48:14.416699
2018-05-19T01:57:41
2018-05-19T01:57:41
120,978,965
0
1
null
null
null
null
UTF-8
Java
false
false
3,350
java
package com.project.mxd.mxd_community; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import android.widget.ImageView; import java.util.LinkedList; /** * Created by mxd on 2018/3/5. */ public class OrderManagerAdapter extends BaseAdapter { private LinkedList<OrderManagerItem> itemData; private Context itemContext; private int index; public OrderManagerAdapter(LinkedList<OrderManagerItem>itemData,Context itemContext) { this.itemData = itemData; this.itemContext = itemContext; } @Override public int getCount() { return itemData.size(); } @Override public Object getItem(int position) { return itemData.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = LayoutInflater.from(itemContext).inflate(R.layout.order_manager_item,parent,false); TextView goods_name = (TextView) convertView.findViewById(R.id.goods_name); TextView price_num = (TextView) convertView.findViewById(R.id.price_num); TextView receiver_name = (TextView) convertView.findViewById(R.id.receiver_name); TextView logistics = (TextView) convertView.findViewById(R.id.logistics); TextView order_detail = (TextView) convertView.findViewById(R.id.order_detail); TextView order_service = (TextView) convertView.findViewById(R.id.order_service); goods_name.setText(itemData.get(position).getGoodsName()); price_num.setText(itemData.get(position).getGoodsPrice()); receiver_name.setText(itemData.get(position).getRecieverName()); index = position; logistics.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(itemContext,LogisticActivity.class); itemContext.startActivity(intent); } }); order_detail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(itemContext,OrderDetailActivity.class); intent.putExtra("goodsImageId",itemData.get(index).getGoodsImageId()); intent.putExtra("goodsName",itemData.get(index).getGoodsName()); intent.putExtra("goodsPrice",itemData.get(index).getGoodsPrice()); intent.putExtra("recieverName",itemData.get(index).getRecieverName()); intent.putExtra("recieverPhone",itemData.get(index).getRecieverPhone()); intent.putExtra("recieverAddress",itemData.get(index).getRecieverAddress()); itemContext.startActivity(intent); } }); order_service.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(itemContext,OrderServiceActivity.class); itemContext.startActivity(intent); } }); return convertView; } }
[ "1543292509@qq.com" ]
1543292509@qq.com
e314264a7cf6eb7e2f0657dcf678f6f3be3841b7
5b2bc09bc70d0b8a04d54c84940f2f18e99ee0bb
/Game Engine/src/fr/frozen/game/SoundManager.java
44535dc29b9f2f183ade317914b21e17873cdd59
[]
no_license
zlandorf/Frozen-Dust
442bcb1ec2ffa1e6ae15dd42364c33f74bfc640a
da1d544b5d7d4670ded2e607dd39b9b5a99f372f
refs/heads/master
2020-06-02T23:48:52.784864
2011-10-25T10:39:57
2011-10-25T10:39:57
1,552,135
1
2
null
null
null
null
UTF-8
Java
false
false
5,594
java
package fr.frozen.game; import java.io.IOException; import java.util.Hashtable; import org.apache.log4j.Logger; import org.lwjgl.openal.AL; import org.newdawn.slick.openal.Audio; import org.newdawn.slick.openal.AudioLoader; import org.newdawn.slick.openal.SoundStore; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import fr.frozen.util.XMLParser; public class SoundManager { private static final String SOUNDS_DIRECTORY = "sounds/"; private static SoundManager instance = null; public static SoundManager getInstance() { if (instance == null) { instance = new SoundManager(); } return instance; } protected Hashtable<String, Sound> audioClips; protected SoundManager() { SoundStore.get().init(); audioClips = new Hashtable<String, Sound>(); } public float getMusicVolume() { return SoundStore.get().getMusicVolume(); } public float getSoundVolume() { return SoundStore.get().getSoundVolume(); } public void setMusicVolume(float globalVolume) { SoundStore.get().setMusicVolume(globalVolume); } public void setSoundVolume(float globalVolume) { SoundStore.get().setSoundVolume(globalVolume); } public void setMusicPitch(float globalPitch) { SoundStore.get().setMusicPitch(globalPitch); } public void setMusicOn(boolean on) { SoundStore.get().setMusicOn(on); } public void setSoundsOn(boolean on) { SoundStore.get().setSoundsOn(on); } protected synchronized void addAudioClip(Audio audioClip, String name) { if (audioClip != null) { audioClips.put(name.replaceAll("\\..{3,4}",""), new Sound(audioClip)); Logger.getLogger(getClass()).debug("sound added : "+name); } } public void loadSound(String type, String filename) { try { Audio audioClip = AudioLoader.getAudio(type, getClass().getClassLoader().getResourceAsStream(SOUNDS_DIRECTORY+filename)); addAudioClip(audioClip, filename); } catch (IOException e) { Logger.getLogger(getClass()).error("filename could not be loaded"); } } public synchronized Sound getSound(String soundName) { Sound audioClip = audioClips.get(soundName); return audioClip; } public boolean loadSoundsFromXml(String filename) { return loadSoundsFromXml(new XMLParser(filename)); } public boolean loadSoundsFromXml(XMLParser parser) { Element soundsNode = parser.getElement("assets/sounds"); boolean success = true; if (soundsNode != null && soundsNode.hasChildNodes()) { for (int i = 0; i < soundsNode.getChildNodes().getLength(); i++) { if (soundsNode.getChildNodes().item(i).getNodeType() == Node.TEXT_NODE) continue; success &= getSoundFromNode(soundsNode.getChildNodes().item(i)); } } String soundsAdded = "sounds added = "; soundsAdded += getArrayStr(audioClips.keySet().toArray()); Logger.getLogger(getClass()).info(soundsAdded); if (success) { Logger.getLogger(getClass()).info("XML sound Loading success"); } else { Logger.getLogger(getClass()).error("XML sound Loading failure"); } return success; } protected String getArrayStr(Object[] array) { String str = "["; for (int i = 0; i < array.length; i++) { str += array[i]; if (i < array.length - 1) { str += ","; } } return str+"]"; } protected boolean getSoundFromNode(Node node) { if (node == null || !node.hasAttributes()) { return false; } String filename, name; NamedNodeMap attributes = node.getAttributes(); Node attrnode = attributes.getNamedItem("filename"); if (attrnode == null) { Logger.getLogger(getClass()).error("attribute not found : filename"); return false; } filename = attrnode.getNodeValue(); attrnode = attributes.getNamedItem("name"); if (attrnode == null) { Logger.getLogger(getClass()).error("attribute not found : name"); return false; } name = attrnode.getNodeValue(); if (filename == null || filename.equals("") || name == null || name.equals("")) { Logger.getLogger(getClass()).error("filename or name have a bad value in getSoundFromNode"); return false; } String type = filename.substring(filename.lastIndexOf(".") + 1); if (type == null || type.equals("")) { Logger.getLogger(getClass()).error("sound type not found in "+filename); return false; } type = type.toUpperCase(); Logger.getLogger(getClass()).debug("soundfile = "+filename+ " audio type = "+type+" name = "+name); try { Audio audioClip = AudioLoader.getAudio(type, getClass().getClassLoader().getResourceAsStream(SOUNDS_DIRECTORY+filename)); addAudioClip(audioClip, name); } catch (Exception e) { Logger.getLogger(getClass()).error("failed to load "+filename); e.printStackTrace(); return false; } return true; } public static void main(String []args) { SoundManager.getInstance().loadSound("OGG","sword.ogg"); //SoundManager.getInstance().getSound("sword").playAsSoundEffect(false); Sound sound = SoundManager.getInstance().getSound("sword"); //SoundManager.getInstance().seSoundsOn(false); for (int i = 0; i < 5; i++) { try { SoundManager.getInstance().setSoundVolume(0.0f); //SoundManager.getInstance().getSound("sword").playAsSoundEffect(false); //sound.setGain(0.5f); //sound.getAudioClip().playAsMusic(1.f,1.f,false); Thread.sleep(200); sound.setGain(1f); sound.playAsSoundEffect(false); sound.playAsSoundEffect(false); sound.playAsSoundEffect(false); sound.playAsSoundEffect(false); Thread.sleep(600); } catch (InterruptedException e) { e.printStackTrace(); } } AL.destroy(); } }
[ "paul.milian@hotmail.fr" ]
paul.milian@hotmail.fr
a818811d3004cbea3514391040130dcf1fcb6f74
f665e2b8731e503d08b1293cf845d3b1e8907d32
/src/main/java/com/management/task/repositories/UserDao.java
a43030781efb9bc9f87f3ed37da248144351b910
[]
no_license
hereistheusername/task
f52413311a5e817d443b0c16503c268f04b023df
522398feeca5671473f1e51e7956e46e65bed925
refs/heads/master
2022-06-22T01:47:42.479095
2019-10-26T10:45:56
2019-10-26T10:45:56
212,262,675
0
0
null
2022-06-17T02:33:22
2019-10-02T05:32:14
Java
UTF-8
Java
false
false
502
java
package com.management.task.repositories; import com.management.task.entities.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Repository; @Repository public interface UserDao extends JpaRepository<User,Integer>, JpaSpecificationExecutor<User> { /** * 通过工号查找用户 * @param workId * @return */ User findByWorkId(String workId); }
[ "extrae_mail@163.com" ]
extrae_mail@163.com
4f8df4f1f19985975c5e98dd2dffa840e9f53cea
9289ddce1ad59b7d2e4dafa30509f92af93a92db
/mcas/build/generated/source/apt/debug/com/haife/android/mcas/integration/ActivityLifecycle_MembersInjector.java
455500b8ba02387cf17d46f9fc140da98bf09aa4
[]
no_license
dy175785/MyWanAndroid
69ac1b45d8aee7f9282411ac196ed18a57889c56
0f59245670a27f72fa0fb0302012bb244b46df20
refs/heads/master
2023-01-08T21:31:37.053203
2020-11-06T12:02:47
2020-11-06T12:02:47
307,313,398
1
0
null
null
null
null
UTF-8
Java
false
false
3,526
java
package com.haife.android.mcas.integration; import android.app.Application; import androidx.fragment.app.FragmentManager; import com.haife.android.mcas.integration.cache.Cache; import dagger.Lazy; import dagger.MembersInjector; import dagger.internal.DoubleCheck; import java.util.List; import javax.annotation.Generated; import javax.inject.Provider; @Generated( value = "dagger.internal.codegen.ComponentProcessor", comments = "https://google.github.io/dagger" ) public final class ActivityLifecycle_MembersInjector implements MembersInjector<ActivityLifecycle> { private final Provider<AppManager> mAppManagerProvider; private final Provider<Application> mApplicationProvider; private final Provider<Cache<String, Object>> mExtrasProvider; private final Provider<FragmentManager.FragmentLifecycleCallbacks> mFragmentLifecycleProvider; private final Provider<List<FragmentManager.FragmentLifecycleCallbacks>> mFragmentLifecyclesProvider; public ActivityLifecycle_MembersInjector( Provider<AppManager> mAppManagerProvider, Provider<Application> mApplicationProvider, Provider<Cache<String, Object>> mExtrasProvider, Provider<FragmentManager.FragmentLifecycleCallbacks> mFragmentLifecycleProvider, Provider<List<FragmentManager.FragmentLifecycleCallbacks>> mFragmentLifecyclesProvider) { this.mAppManagerProvider = mAppManagerProvider; this.mApplicationProvider = mApplicationProvider; this.mExtrasProvider = mExtrasProvider; this.mFragmentLifecycleProvider = mFragmentLifecycleProvider; this.mFragmentLifecyclesProvider = mFragmentLifecyclesProvider; } public static MembersInjector<ActivityLifecycle> create( Provider<AppManager> mAppManagerProvider, Provider<Application> mApplicationProvider, Provider<Cache<String, Object>> mExtrasProvider, Provider<FragmentManager.FragmentLifecycleCallbacks> mFragmentLifecycleProvider, Provider<List<FragmentManager.FragmentLifecycleCallbacks>> mFragmentLifecyclesProvider) { return new ActivityLifecycle_MembersInjector( mAppManagerProvider, mApplicationProvider, mExtrasProvider, mFragmentLifecycleProvider, mFragmentLifecyclesProvider); } @Override public void injectMembers(ActivityLifecycle instance) { injectMAppManager(instance, mAppManagerProvider.get()); injectMApplication(instance, mApplicationProvider.get()); injectMExtras(instance, mExtrasProvider.get()); injectMFragmentLifecycle(instance, DoubleCheck.lazy(mFragmentLifecycleProvider)); injectMFragmentLifecycles(instance, DoubleCheck.lazy(mFragmentLifecyclesProvider)); } public static void injectMAppManager(ActivityLifecycle instance, AppManager mAppManager) { instance.mAppManager = mAppManager; } public static void injectMApplication(ActivityLifecycle instance, Application mApplication) { instance.mApplication = mApplication; } public static void injectMExtras(ActivityLifecycle instance, Cache<String, Object> mExtras) { instance.mExtras = mExtras; } public static void injectMFragmentLifecycle( ActivityLifecycle instance, Lazy<FragmentManager.FragmentLifecycleCallbacks> mFragmentLifecycle) { instance.mFragmentLifecycle = mFragmentLifecycle; } public static void injectMFragmentLifecycles( ActivityLifecycle instance, Lazy<List<FragmentManager.FragmentLifecycleCallbacks>> mFragmentLifecycles) { instance.mFragmentLifecycles = mFragmentLifecycles; } }
[ "1757857744@qq.com" ]
1757857744@qq.com
02cef41607b2e530c5deab3345a356298676bb7a
ad0c42a78aeacd30f50163a7608f467e9e289973
/src/ca/bcit/comp2522/code/exceptions/LostMessage.java
bf8943eed77b819c8884099d2f2c1693645fdbea
[]
no_license
Sepehrman/COMP-2522-Code
3fbd867f8b9350db40ec4efde75894695c5c4584
c24106d393138f8f9b70c545a58108e3fb6340d6
refs/heads/master
2023-01-08T06:12:50.322937
2020-11-12T06:05:18
2020-11-12T06:05:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
package ca.bcit.comp2522.code.exceptions; /** * A very important Exception. A Checked Exception. */ class VeryImportantException extends Exception { /** * Returns a String representation of this VeryImportantException. * @return representation as a String */ public String toString() { return "A very important exception!"; } } /** * A trivial Exception. A Checked Exception. */ class TrivialException extends Exception { /** * Returns a String representation of this TrivialException. * @return representation as a String */ public String toString() { return "A trivial exception"; } } /** * Demonstrates a lost exception. * * @author BCIT * @version 2020 */ public class LostMessage { /** * This function does very little. * @throws VeryImportantException all the time */ public void f() throws VeryImportantException { throw new VeryImportantException(); } /** * This function also does very little. * @throws TrivialException all the time */ void dispose() throws TrivialException { throw new TrivialException(); } /** * Drives the program. * @param args * @throws Exception (which will crash the program) */ public static void main(String[] args) throws Exception { LostMessage lostMessage = new LostMessage(); try { lostMessage.f(); } finally { lostMessage.dispose(); } } }
[ "cthompson98@bcit.ca" ]
cthompson98@bcit.ca
bb8ba95cc2c6b437590285c8baa9edea30d3448d
fe45c58b208f1f9dbfc451a8b3557ed93a413226
/rest-api/src/test/java/dev/inflearn/restapi/RestApiApplicationTests.java
07bc7d3d77b190897f215edaa6f4690c727808b2
[]
no_license
kimdahyeee/inflearn-code
c4d9f88c19a108fd03a98a1faf408122888dafdc
5fa4db7ea9e246e1adab490550031ff82ed86b4f
refs/heads/master
2022-06-25T10:16:40.588442
2022-06-09T15:30:02
2022-06-09T15:30:02
241,629,217
2
0
null
null
null
null
UTF-8
Java
false
false
222
java
package dev.inflearn.restapi; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class RestApiApplicationTests { @Test void contextLoads() { } }
[ "dahye432111@gmail.com" ]
dahye432111@gmail.com
3d0d2eeb8b717c22fdcb7f67291d6e54aa48d655
f0b3c441478a0a18aff481f3ddcab339e435739f
/src/main/java/com/neconico/neconicojpa/domain/notice/NoticeStatus.java
2b2b34aba649a0ab233e8a52ace5acc74e52bbc6
[]
no_license
hungrytech/neconicoJPA
cfed7345633ca190089ecedc5e98f43114355e9d
51fe098d5fcca3e046d1b21679f9342ac39fd113
refs/heads/master
2023-07-02T18:47:50.585102
2021-08-09T04:55:23
2021-08-09T04:55:23
389,705,746
1
0
null
null
null
null
UTF-8
Java
false
false
92
java
package com.neconico.neconicojpa.domain.notice; public enum NoticeStatus { ON, CLOSE }
[ "xorals9448@gmail.com" ]
xorals9448@gmail.com
2716c90c942c1a03726eff55ed4d60d93597ca61
94477125ccac872a9d1a06837be368af307cd82f
/src/main/java/br/com/contmatic/empresa/clienttemplate/loader/EnderecoLoader.java
3a919b28dd6af5db4906597b63095e31981a0638
[]
no_license
lysonjeada/prova3
b27f88afa23c6c6da794112585ba6277c234b2ab
375047c252585ace53fb02bd18d62e28ad683dbe
refs/heads/master
2022-12-16T02:17:38.891853
2020-09-15T18:53:51
2020-09-15T18:53:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package br.com.contmatic.empresa.clienttemplate.loader; import br.com.contmatic.empresa.Endereco; import br.com.six2six.fixturefactory.Fixture; import br.com.six2six.fixturefactory.Rule; import br.com.six2six.fixturefactory.loader.TemplateLoader; public class EnderecoLoader implements TemplateLoader { /** * Load. */ @Override public void load () { Fixture.of(Endereco.class).addTemplate("endereco", new Rule(){{ add("logradouro", "Rua Padre Estevão Pernet"); add("numero", "215"); add("cidade", "São Paulo"); add("pais", "Brasil"); add("cep", "03315-000"); }}); } }
[ "lyscalefi@gmail.com" ]
lyscalefi@gmail.com
6651e8087fec1aa06edf87ce2a97850e062ce7ef
a72e6f9cf3e49e3bcb756be20d1a61dc98edd3de
/Automation_PMM/src/test/java/Page_Object_Factory/package-info.java
0d88646979027b1757a39bce85f32cb0cf2c3d5b
[]
no_license
Ranjinibalusamy/PMM_Automation
bb9b33ad4a53e22bcae880a34f1f056e981285f0
d4ccb46d86abec83dfd1515d6b3eff1109685d1d
refs/heads/master
2020-06-08T00:39:48.778755
2019-06-21T16:18:26
2019-06-21T16:18:26
193,125,762
0
0
null
null
null
null
UTF-8
Java
false
false
78
java
/** * */ /** * @author ranjinib * */ package Page_Object_Factory;
[ "Administrator@172.31.2.28" ]
Administrator@172.31.2.28
0516df9ba4ab59e98a3170b50badb312e451f4f9
fe99b47a2867d704184adeb5c059c09a51a44cb8
/src/main/java/com/sys/pojo/RolePermissions.java
d733562c0382ef04daa49786f4ab774dd86eb9d3
[]
no_license
LightMoney/sys
87b40addc3034e8e87d563c9c00eb4f48bb582ad
7e1d91e9fe4413a43852855110487a85e22c74e7
refs/heads/master
2022-12-20T14:59:24.123450
2019-09-02T11:28:35
2019-09-02T11:28:35
205,818,547
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package com.sys.pojo; import java.io.Serializable; /** * Copyright (C),2017, Guangzhou ChangLing info. Co., Ltd. * @ClassName: RolePermissions * @Description: 角色权限关联表 * @author lao * @date 2017年12月27日上午10:17:04 * @version 1.00 */ public class RolePermissions implements Serializable { private static final long serialVersionUID = 1L; /** 外键表,指向角色表 */ private Long roleId; /** 外键表,指向权限表 */ private Long permissionId; public Long getRoleId() { return roleId; } public void setRoleId(Long roleId) { this.roleId = roleId; } public Long getPermissionId() { return permissionId; } public void setPermissionId(Long permissionId) { this.permissionId = permissionId; } public static long getSerialversionuid() { return serialVersionUID; } }
[ "fan85719223@outlook.com" ]
fan85719223@outlook.com
174c12869c930c56c128cbe89c3a98e9128083f0
43509d5a7998a82ec6084c6be81fc56e1a558ba3
/GuestBook-SpringMvc/src/main/java/com/bitcamp/guest/service/GetMessageListService.java
d5210d350d05865f9ce5f59ff98e71b7dc4cb116
[]
no_license
ryanYu0429/bitcamp
c2d822803a4fa6b66719720c1439090d3c906991
033fb39f6b03407338ba56851b1b5d97124d8b7f
refs/heads/master
2022-12-27T02:36:27.651040
2019-09-06T05:45:09
2019-09-06T05:45:09
188,927,360
0
0
null
2022-12-16T09:44:37
2019-05-28T00:48:04
Java
UTF-8
Java
false
false
2,086
java
package com.bitcamp.guest.service; import java.sql.Connection; import java.sql.SQLException; import java.util.Collections; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bitcamp.guest.dao.MessageDao; import com.bitcamp.guest.dao.MessageJdbcTemplateDao; import com.bitcamp.guest.domain.Message; import com.bitcamp.guest.domain.MessageListView; import com.bitcamp.guest.jdbc.ConnectionProvider; @Service("listService") public class GetMessageListService implements GuestBookService { //@Autowired //private MessageDao dao; @Autowired private MessageJdbcTemplateDao dao; // 1. 한페이지에 보여줄 게시글의 개수 private static final int MESSAGE_COUNT_PER_PAGE = 3; public MessageListView getMessageListView(int pageNumber) { // 2. 현재 페이지 번호 int currentPageNumber = pageNumber; //Connection conn; MessageListView view = null; //try { // Connection //conn = ConnectionProvider.getConnection(); // DAO //MessageDao dao = MessageDao.getInstance(); // 전체 게시물의 개수 //int messageTotalCount = dao.selectCount(conn); int messageTotalCount = dao.selectCount(); // 게시물 내용 리스트, DB 검색에 사용할 start_row, end_row List<Message> messageList = null; int firstRow = 0; int endRow = 0; if(messageTotalCount > 0) { firstRow = (pageNumber-1)*MESSAGE_COUNT_PER_PAGE + 1; endRow = firstRow + MESSAGE_COUNT_PER_PAGE -1; //messageList = dao.selectList(conn, firstRow, endRow); messageList = dao.selectList(firstRow, endRow); } else { currentPageNumber = 0; messageList = Collections.emptyList(); } view = new MessageListView( messageTotalCount, currentPageNumber, messageList, MESSAGE_COUNT_PER_PAGE, firstRow, endRow); //} catch (SQLException e) { // // TODO Auto-generated catch block // e.printStackTrace(); //} return view; } }
[ "noreply@github.com" ]
ryanYu0429.noreply@github.com
c01ea688c15d39fb34baafdb97661eb0a2cf3d6d
b0808f59008d844dec22fccea4114abecea58aa1
/src/main/java/ex15_santana.java
ecd5878f3b9a947e168f199ca1b25ae56dc8714a
[]
no_license
dereks7/Java1Santana
f0988eed5bec0a30dab46044ff7020d02d4babd1
fec735c1a1d589c7e3cfd0d664a57bd99a6c1b6a
refs/heads/master
2023-07-24T14:34:12.280353
2021-09-12T19:44:26
2021-09-12T19:44:26
404,810,174
0
0
null
null
null
null
UTF-8
Java
false
false
569
java
import java.util.Scanner; /* What is the password? 12345 I don't know you. What is the password? abc$123 Welcome! */ public class ex15_santana { public static void main( String[] args ) { String password="abc$123"; System.out.println("What is the password? "); Scanner in1 = new Scanner(System.in); String inppass = in1.nextLine(); if (inppass.equals(password)) { System.out.println("Welcome!"); } else { System.out.println("I don't know you."); } } }
[ "90410123+dereks7@users.noreply.github.com" ]
90410123+dereks7@users.noreply.github.com
79951549cd5342ac2567aa7dd941e3b94ce0797f
b643d5b615a13779ef51590d9b8f851315f28afb
/cloud2021/cloud-api-commons/src/main/java/com/sun/entity/Payment.java
d0a768e42ad930bf47cb6983696248c61eed4593
[]
no_license
s-gwei/studySpringcloud
1191cd816835213c1598e1cfd536099e64be7dd6
995cd5fe58a14e698e89fc6d1493c04ba2d0e9c1
refs/heads/master
2023-06-21T08:15:28.211071
2021-07-19T02:53:50
2021-07-19T02:53:50
326,900,002
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.sun.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; @Data @AllArgsConstructor //它是lombok中的注解,作用在类上; // 使用后添加一个构造函数,该构造函数含有所有已声明字段属性参数 @NoArgsConstructor //注解在类上,为类提供一个无参的构造方法。 public class Payment implements Serializable { private Long id; private String serial; }
[ "2277145603@qq.com" ]
2277145603@qq.com
459648614b3bc1c47ef341bbd0a46b3635ba42c0
0e148376d5bfea12ca64db5092bb441f6110690f
/q3/src/hashTable.java
1f5788a4b20021ba96bb0be05bf6b6c77bc4202d
[]
no_license
manthila1997/Hashtable
d7680c184851d6ca0dd2392e5d3ed296e0c3bc6d
166acbe10ef715b08e030acfc8446e2f519a25cc
refs/heads/main
2023-01-21T09:04:47.631829
2020-12-01T17:38:25
2020-12-01T17:38:25
315,522,779
1
2
null
null
null
null
UTF-8
Java
false
false
2,085
java
import java.util.Collection; import java.util.Collections; import java.util.LinkedList; public class hashTable { int tableSize = 10; LinkedList<Integer>[] hash = new LinkedList[tableSize]; public int calHash(int key) { int hash; hash = key/100000; return hash; } public void createhashTable(){ for (int i=0; i<tableSize ; i++){ hash[i] = new LinkedList(); } } public void addData(int data){ int position=calHash(data); for (int i=0; i<tableSize ; i++){ if(i==position){ if (hash[position].isEmpty()){ hash[i].addFirst(data); }else{ hash[position].add(data); } } } } public void print(){ for (int i=0; i<tableSize ; i++){ System.out.println(hash[i]); } } public void sort(){ for (int i=0; i<tableSize ; i++){ Collections.sort(hash[i]); } } public int findVal(int val){ int position=calHash(val); int x=0; int temp = 0; int c=0; for (int i=0; i<=position;i++){ for (int y=0; y<hash[i].size();y++){ int w = hash[i].get(y); temp = val - w; if (temp <= 0) { c=0; continue; }else{ x = calHash(temp); if (hash[x].contains(temp)){ c=1; break; } else { c=0; } } } } System.out.println(temp); return c; } }
[ "49613631+manthila1997@users.noreply.github.com" ]
49613631+manthila1997@users.noreply.github.com
d4eb5d4103e94ffdae62826b27361e07befad0cc
c0621073b8e8ba7a391a70c092ea170276b6e49a
/socket/app/src/main/java/com/example/socket/MainActivity.java
5853c31e856839ea7188390f4d4b75b46a78d6a0
[]
no_license
uithatran/Android
c844be51267add588655515b0b9b2208f32646d6
7815d887ea43f6cf2090fe696512cdda7de6cf46
refs/heads/master
2022-12-24T00:42:48.912645
2019-12-21T01:13:19
2019-12-21T01:13:19
225,258,258
0
0
null
2022-12-13T13:52:55
2019-12-02T01:19:57
Java
UTF-8
Java
false
false
9,151
java
package com.example.socket; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.net.URISyntaxException; import com.github.nkzawa.emitter.Emitter; import com.github.nkzawa.socketio.client.IO; import com.github.nkzawa.socketio.client.Socket; import org.json.JSONException; import org.json.JSONObject; import static com.example.socket.App.CHANNEL_1_ID; import static com.example.socket.App.CHANNEL_2_ID; public class MainActivity extends AppCompatActivity { private EditText editText, editText_receice; private Button btn_send, btn_rgbcolor; private Socket mSocket; private NotificationManagerCompat notificationManagerCompat; { try { mSocket = IO.socket("http://192.168.1.5:3000/"); } catch (URISyntaxException e) {} } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); notificationManagerCompat = NotificationManagerCompat.from(this); mSocket.connect(); msocket_ON(); msocket_Emit(); change_Color(); } /**------------------------------------------------------------------ * ------------------------------------------------------------------ * ------------------------------------------------------------------*/ // Hàm ánh xạ từ File Xml private void initView() { editText = findViewById(R.id.edt_send); btn_send = findViewById(R.id.btn_send); btn_rgbcolor = findViewById(R.id.btn_rgbcolor); editText_receice = findViewById(R.id.edt_receice); } private void msocket_Emit() { btn_send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String message = editText.getText().toString().trim(); if (TextUtils.isEmpty(message)) { return; } editText.setText(""); if(message.equals("notify")) mSocket.emit("turn on notify lock screen", message); else if(message.equals("notify 1")) mSocket.emit("turn on notify 1", message); else if(message.equals("notify 2")) mSocket.emit("turn on notify 2", message); else mSocket.emit("message",message); } }); } private void msocket_ON() { mSocket.on("e_Notification_screen", o_Notification_screen); mSocket.on("e_Notification1", o_Notification1); mSocket.on("e_Notification2", o_Notification2); mSocket.on("e_message", o_message); } private void change_Color() { btn_rgbcolor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, rgbcolorActivity.class); startActivity(intent); } }); } /** EMIT **/ private Emitter.Listener o_Notification_screen = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; String noidung; try { Log.d("test","123"); noidung = data.getString("noidung"); if(noidung.equals("notify")) { lock_screen_notification(); } editText_receice.setText(noidung); } catch (JSONException e) { return; } } }); } }; private Emitter.Listener o_Notification1 = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; String noidung; try { noidung = data.getString("noidung"); if(noidung.equals("notify1")) { notification1(); } editText_receice.setText(noidung); } catch (JSONException e) { return; } } }); } }; private Emitter.Listener o_Notification2 = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; String noidung; try { noidung = data.getString("noidung"); if(noidung.equals("notify2")) { notification2(); } editText_receice.setText(noidung); } catch (JSONException e) { return; } } }); } }; private Emitter.Listener o_message = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; String noidung; try { noidung = data.getString("noidung"); editText_receice.setText(noidung); } catch (JSONException e) { return; } } }); } }; public void notification1() { String title = "Title 1"; String message = "Message 1"; Notification notification = new NotificationCompat.Builder(MainActivity.this, CHANNEL_1_ID) .setSmallIcon(R.drawable.ic_one) .setContentText(message) .setContentTitle(title) .setPriority(NotificationCompat.PRIORITY_HIGH) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .build(); notificationManagerCompat.notify(1,notification); } public void notification2() { String title = "Title 2"; String message = "Message 2"; Notification notification = new NotificationCompat.Builder(MainActivity.this, CHANNEL_2_ID) .setSmallIcon(R.drawable.ic_two) .setContentText(message) .setContentTitle(title) .setPriority(NotificationCompat.PRIORITY_HIGH) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .build(); notificationManagerCompat.notify(2,notification); } public void lock_screen_notification() { String message = "This is a message notification example"; NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this, CHANNEL_1_ID) .setSmallIcon(R.drawable.ic_message) .setContentTitle("WARNING in lock screen!!!") .setContentText("content text") .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setAutoCancel(true); Intent intent = new Intent(MainActivity.this, NotificationActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("message", message); PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0,builder.build()); } }
[ "hachin2109@gmail.com" ]
hachin2109@gmail.com
f39d9d2484a244e41dcb96cd605d8cbf5c6708b7
25855c3093299068b25d239f121e064da74c98de
/ptr_lib/src/main/java/com/dhzq/ptr_lib/PtrFrameLayout.java
1c46fd12cb1341a6c399ba4bd0f23772acaa9994
[]
no_license
caprice/PullToRefreshDemo
a16dcf84a9d5244ccfc141fd6536b70c19955fd7
666bed30a0b51837bf6b45b47239bd6042b5cb4d
refs/heads/master
2016-08-11T18:49:31.509046
2015-11-04T15:13:29
2015-11-04T15:13:29
45,547,167
0
0
null
null
null
null
UTF-8
Java
false
false
37,890
java
package com.dhzq.ptr_lib; import android.content.Context; import android.content.res.TypedArray; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.GridView; import android.widget.Scroller; import android.widget.TextView; import com.dhzq.ptr_lib.indicator.PtrIndicator; import com.dhzq.ptr_lib.loadmore.DefaultLoadMoreViewFactory; import com.dhzq.ptr_lib.loadmore.GridViewHandler; import com.dhzq.ptr_lib.loadmore.ILoadViewMoreFactory; import com.dhzq.ptr_lib.loadmore.ListViewHandler; import com.dhzq.ptr_lib.loadmore.OnScrollBottomListener; import com.dhzq.ptr_lib.loadmore.RecyclerViewHandler; import com.dhzq.ptr_lib.utils.PtrCLog; /** * This layout view for "Pull to Refresh(Ptr)" support all of the view, you can contain everything you want. * support: pull to refresh / release to refresh / auto refresh / keep header view while refreshing / hide header view while refreshing * It defines {@link PtrUIHandler}, which allows you customize the UI easily. */ public class PtrFrameLayout extends ViewGroup { // status enum public final static byte PTR_STATUS_INIT = 1; public final static byte PTR_STATUS_PREPARE = 2; public final static byte PTR_STATUS_LOADING = 3; public final static byte PTR_STATUS_COMPLETE = 4; private static final boolean DEBUG_LAYOUT = true; public static boolean DEBUG = false; private static int ID = 1; // auto refresh status private static byte FLAG_AUTO_REFRESH_AT_ONCE = 0x01; private static byte FLAG_AUTO_REFRESH_BUT_LATER = 0x01 << 1; private static byte FLAG_ENABLE_NEXT_PTR_AT_ONCE = 0x01 << 2; private static byte FLAG_PIN_CONTENT = 0x01 << 3; private static byte MASK_AUTO_REFRESH = 0x03; protected final String LOG_TAG = "ptr-frame-" + ++ID; protected View mContent; // optional config for define header and content in xml file private int mHeaderId = 0; private int mContainerId = 0; // config private int mDurationToClose = 200; private int mDurationToCloseHeader = 1000; private boolean mKeepHeaderWhenRefresh = true; private boolean mPullToRefresh = false; private View mHeaderView; private PtrUIHandlerHolder mPtrUIHandlerHolder = PtrUIHandlerHolder.create(); private PtrHandler mPtrHandler; // working parameters private ScrollChecker mScrollChecker; private int mPagingTouchSlop; private int mHeaderHeight; private byte mStatus = PTR_STATUS_INIT; private boolean mDisableWhenHorizontalMove = false; private int mFlag = 0x00; // disable when detect moving horizontally private boolean mPreventForHorizontal = false; private MotionEvent mLastMoveEvent; private PtrUIHandlerHook mRefreshCompleteHook; private int mLoadingMinTime = 500; private long mLoadingStartTime = 0; private PtrIndicator mPtrIndicator; private boolean mHasSendCancelEvent = false; public PtrFrameLayout(Context context) { this(context, null); } public PtrFrameLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public PtrFrameLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mPtrIndicator = new PtrIndicator(); TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.PtrFrameLayout, 0, 0); if (arr != null) { mHeaderId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_header, mHeaderId); mContainerId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_content, mContainerId); mPtrIndicator.setResistance( arr.getFloat(R.styleable.PtrFrameLayout_ptr_resistance, mPtrIndicator.getResistance())); mDurationToClose = arr.getInt(R.styleable.PtrFrameLayout_ptr_duration_to_close, mDurationToClose); mDurationToCloseHeader = arr.getInt(R.styleable.PtrFrameLayout_ptr_duration_to_close_header, mDurationToCloseHeader); float ratio = mPtrIndicator.getRatioOfHeaderToHeightRefresh(); ratio = arr.getFloat(R.styleable.PtrFrameLayout_ptr_ratio_of_header_height_to_refresh, ratio); mPtrIndicator.setRatioOfHeaderHeightToRefresh(ratio); mKeepHeaderWhenRefresh = arr.getBoolean(R.styleable.PtrFrameLayout_ptr_keep_header_when_refresh, mKeepHeaderWhenRefresh); mPullToRefresh = arr.getBoolean(R.styleable.PtrFrameLayout_ptr_pull_to_fresh, mPullToRefresh); arr.recycle(); } mScrollChecker = new ScrollChecker(); final ViewConfiguration conf = ViewConfiguration.get(getContext()); mPagingTouchSlop = conf.getScaledTouchSlop() * 2; } @Override protected void onFinishInflate() { final int childCount = getChildCount(); if (childCount > 2) { throw new IllegalStateException("PtrFrameLayout only can host 2 elements"); } else if (childCount == 2) { if (mHeaderId != 0 && mHeaderView == null) { mHeaderView = findViewById(mHeaderId); } if (mContainerId != 0 && mContent == null) { mContent = findViewById(mContainerId); } // not specify header or content if (mContent == null || mHeaderView == null) { View child1 = getChildAt(0); View child2 = getChildAt(1); if (child1 instanceof PtrUIHandler) { mHeaderView = child1; mContent = child2; } else if (child2 instanceof PtrUIHandler) { mHeaderView = child2; mContent = child1; } else { // both are not specified if (mContent == null && mHeaderView == null) { mHeaderView = child1; mContent = child2; } // only one is specified else { if (mHeaderView == null) { mHeaderView = mContent == child1 ? child2 : child1; } else { mContent = mHeaderView == child1 ? child2 : child1; } } } } } else if (childCount == 1) { mContent = getChildAt(0); } else { TextView errorView = new TextView(getContext()); errorView.setClickable(true); errorView.setTextColor(0xffff6600); errorView.setGravity(Gravity.CENTER); errorView.setTextSize(20); errorView.setText("The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?"); mContent = errorView; addView(mContent); } if (mHeaderView != null) { mHeaderView.bringToFront(); } super.onFinishInflate(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (DEBUG && DEBUG_LAYOUT) { PtrCLog.d(LOG_TAG, "onMeasure frame: width: %s, height: %s, padding: %s %s %s %s", getMeasuredHeight(), getMeasuredWidth(), getPaddingLeft(), getPaddingRight(), getPaddingTop(), getPaddingBottom()); } if (mHeaderView != null) { measureChildWithMargins(mHeaderView, widthMeasureSpec, 0, heightMeasureSpec, 0); MarginLayoutParams lp = (MarginLayoutParams) mHeaderView.getLayoutParams(); mHeaderHeight = mHeaderView.getMeasuredHeight() + lp.topMargin + lp.bottomMargin; mPtrIndicator.setHeaderHeight(mHeaderHeight); } if (mContent != null) { measureContentView(mContent, widthMeasureSpec, heightMeasureSpec); if (DEBUG && DEBUG_LAYOUT) { MarginLayoutParams lp = (MarginLayoutParams) mContent.getLayoutParams(); PtrCLog.d(LOG_TAG, "onMeasure content, width: %s, height: %s, margin: %s %s %s %s", getMeasuredWidth(), getMeasuredHeight(), lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin); PtrCLog.d(LOG_TAG, "onMeasure, currentPos: %s, lastPos: %s, top: %s", mPtrIndicator.getCurrentPosY(), mPtrIndicator.getLastPosY(), mContent.getTop()); } } } private void measureContentView(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams(); final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight() + lp.leftMargin + lp.rightMargin, lp.width); final int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec, getPaddingTop() + getPaddingBottom() + lp.topMargin, lp.height); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); } @Override protected void onLayout(boolean flag, int i, int j, int k, int l) { layoutChildren(); } private void layoutChildren() { int offsetX = mPtrIndicator.getCurrentPosY(); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); if (mHeaderView != null) { MarginLayoutParams lp = (MarginLayoutParams) mHeaderView.getLayoutParams(); final int left = paddingLeft + lp.leftMargin; final int top = paddingTop + lp.topMargin + offsetX - mHeaderHeight; final int right = left + mHeaderView.getMeasuredWidth(); final int bottom = top + mHeaderView.getMeasuredHeight(); mHeaderView.layout(left, top, right, bottom); if (DEBUG && DEBUG_LAYOUT) { PtrCLog.d(LOG_TAG, "onLayout header: %s %s %s %s", left, top, right, bottom); } } if (mContent != null) { if (isPinContent()) { offsetX = 0; } MarginLayoutParams lp = (MarginLayoutParams) mContent.getLayoutParams(); final int left = paddingLeft + lp.leftMargin; final int top = paddingTop + lp.topMargin + offsetX; final int right = left + mContent.getMeasuredWidth(); final int bottom = top + mContent.getMeasuredHeight(); if (DEBUG && DEBUG_LAYOUT) { PtrCLog.d(LOG_TAG, "onLayout content: %s %s %s %s", left, top, right, bottom); } mContent.layout(left, top, right, bottom); } } public boolean dispatchTouchEventSupper(MotionEvent e) { return super.dispatchTouchEvent(e); } @Override public boolean dispatchTouchEvent(MotionEvent e) { if (!isEnabled() || mContent == null || mHeaderView == null) { return dispatchTouchEventSupper(e); } int action = e.getAction(); switch (action) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mPtrIndicator.onRelease(); if (mPtrIndicator.hasLeftStartPosition()) { if (DEBUG) { PtrCLog.d(LOG_TAG, "call onRelease when user release"); } onRelease(false); if (mPtrIndicator.hasMovedAfterPressedDown()) { sendCancelEvent(); return true; } return dispatchTouchEventSupper(e); } else { return dispatchTouchEventSupper(e); } case MotionEvent.ACTION_DOWN: mHasSendCancelEvent = false; mPtrIndicator.onPressDown(e.getX(), e.getY()); mScrollChecker.abortIfWorking(); mPreventForHorizontal = false; // The cancel event will be sent once the position is moved. // So let the event pass to children. // fix #93, #102 dispatchTouchEventSupper(e); return true; case MotionEvent.ACTION_MOVE: mLastMoveEvent = e; mPtrIndicator.onMove(e.getX(), e.getY()); float offsetX = mPtrIndicator.getOffsetX(); float offsetY = mPtrIndicator.getOffsetY(); if (mDisableWhenHorizontalMove && !mPreventForHorizontal && (Math.abs(offsetX) > mPagingTouchSlop && Math.abs(offsetX) > Math.abs(offsetY))) { if (mPtrIndicator.isInStartPosition()) { mPreventForHorizontal = true; } } if (mPreventForHorizontal) { return dispatchTouchEventSupper(e); } boolean moveDown = offsetY > 0; boolean moveUp = !moveDown; boolean canMoveUp = mPtrIndicator.hasLeftStartPosition(); if (DEBUG) { boolean canMoveDown = mPtrHandler != null && mPtrHandler.checkCanDoRefresh(this, mContent, mHeaderView); PtrCLog.v(LOG_TAG, "ACTION_MOVE: offsetY:%s, currentPos: %s, moveUp: %s, canMoveUp: %s, moveDown: %s: canMoveDown: %s", offsetY, mPtrIndicator.getCurrentPosY(), moveUp, canMoveUp, moveDown, canMoveDown); } // disable move when header not reach top if (moveDown && mPtrHandler != null && !mPtrHandler.checkCanDoRefresh(this, mContent, mHeaderView)) { return dispatchTouchEventSupper(e); } if ((moveUp && canMoveUp) || moveDown) { movePos(offsetY); return true; } } return dispatchTouchEventSupper(e); } /** * if deltaY > 0, move the content down * * @param deltaY */ private void movePos(float deltaY) { // has reached the top if ((deltaY < 0 && mPtrIndicator.isInStartPosition())) { if (DEBUG) { PtrCLog.e(LOG_TAG, String.format("has reached the top")); } return; } int to = mPtrIndicator.getCurrentPosY() + (int) deltaY; // over top if (mPtrIndicator.willOverTop(to)) { if (DEBUG) { PtrCLog.e(LOG_TAG, String.format("over top")); } to = PtrIndicator.POS_START; } mPtrIndicator.setCurrentPos(to); int change = to - mPtrIndicator.getLastPosY(); updatePos(change); } private void updatePos(int change) { if (change == 0) { return; } boolean isUnderTouch = mPtrIndicator.isUnderTouch(); // once moved, cancel event will be sent to child if (isUnderTouch && !mHasSendCancelEvent && mPtrIndicator.hasMovedAfterPressedDown()) { mHasSendCancelEvent = true; sendCancelEvent(); } // leave initiated position or just refresh complete if ((mPtrIndicator.hasJustLeftStartPosition() && mStatus == PTR_STATUS_INIT) || (mPtrIndicator.goDownCrossFinishPosition() && mStatus == PTR_STATUS_COMPLETE && isEnabledNextPtrAtOnce())) { mStatus = PTR_STATUS_PREPARE; mPtrUIHandlerHolder.onUIRefreshPrepare(this); if (DEBUG) { PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag); } } // back to initiated position if (mPtrIndicator.hasJustBackToStartPosition()) { tryToNotifyReset(); // recover event to children if (isUnderTouch) { sendDownEvent(); } } // Pull to Refresh if (mStatus == PTR_STATUS_PREPARE) { // reach fresh height while moving from top to bottom if (isUnderTouch && !isAutoRefresh() && mPullToRefresh && mPtrIndicator.crossRefreshLineFromTopToBottom()) { tryToPerformRefresh(); } // reach header height while auto refresh if (performAutoRefreshButLater() && mPtrIndicator.hasJustReachedHeaderHeightFromTopToBottom()) { tryToPerformRefresh(); } } if (DEBUG) { PtrCLog.v(LOG_TAG, "updatePos: change: %s, current: %s last: %s, top: %s, headerHeight: %s", change, mPtrIndicator.getCurrentPosY(), mPtrIndicator.getLastPosY(), mContent.getTop(), mHeaderHeight); } mHeaderView.offsetTopAndBottom(change); if (!isPinContent()) { mContent.offsetTopAndBottom(change); } invalidate(); if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIPositionChange(this, isUnderTouch, mStatus, mPtrIndicator); } onPositionChange(isUnderTouch, mStatus, mPtrIndicator); } protected void onPositionChange(boolean isInTouching, byte status, PtrIndicator mPtrIndicator) { } @SuppressWarnings("unused") public int getHeaderHeight() { return mHeaderHeight; } private void onRelease(boolean stayForLoading) { tryToPerformRefresh(); if (mStatus == PTR_STATUS_LOADING) { // keep header for fresh if (mKeepHeaderWhenRefresh) { // scroll header back if (mPtrIndicator.isOverOffsetToKeepHeaderWhileLoading() && !stayForLoading) { mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToKeepHeaderWhileLoading(), mDurationToClose); } else { // do nothing } } else { tryScrollBackToTopWhileLoading(); } } else { if (mStatus == PTR_STATUS_COMPLETE) { notifyUIRefreshComplete(false); } else { tryScrollBackToTopAbortRefresh(); } } } /** * please DO REMEMBER resume the hook * * @param hook */ public void setRefreshCompleteHook(PtrUIHandlerHook hook) { mRefreshCompleteHook = hook; hook.setResumeAction(new Runnable() { @Override public void run() { if (DEBUG) { PtrCLog.d(LOG_TAG, "mRefreshCompleteHook resume."); } notifyUIRefreshComplete(true); } }); } /** * Scroll back to to if is not under touch */ private void tryScrollBackToTop() { if (!mPtrIndicator.isUnderTouch()) { mScrollChecker.tryToScrollTo(PtrIndicator.POS_START, mDurationToCloseHeader); } } /** * just make easier to understand */ private void tryScrollBackToTopWhileLoading() { tryScrollBackToTop(); } /** * just make easier to understand */ private void tryScrollBackToTopAfterComplete() { tryScrollBackToTop(); } /** * just make easier to understand */ private void tryScrollBackToTopAbortRefresh() { tryScrollBackToTop(); } private boolean tryToPerformRefresh() { if (mStatus != PTR_STATUS_PREPARE) { return false; } // if ((mPtrIndicator.isOverOffsetToKeepHeaderWhileLoading() && isAutoRefresh()) || mPtrIndicator.isOverOffsetToRefresh()) { mStatus = PTR_STATUS_LOADING; performRefresh(); } return false; } private void performRefresh() { mLoadingStartTime = System.currentTimeMillis(); if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIRefreshBegin(this); if (DEBUG) { PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshBegin"); } } if (mPtrHandler != null) { mPtrHandler.onRefreshBegin(this); } } /** * If at the top and not in loading, reset */ private boolean tryToNotifyReset() { if ((mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE) && mPtrIndicator.isInStartPosition()) { if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIReset(this); if (DEBUG) { PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIReset"); } } mStatus = PTR_STATUS_INIT; clearFlag(); return true; } return false; } protected void onPtrScrollAbort() { if (mPtrIndicator.hasLeftStartPosition() && isAutoRefresh()) { if (DEBUG) { PtrCLog.d(LOG_TAG, "call onRelease after scroll abort"); } onRelease(true); } } protected void onPtrScrollFinish() { if (mPtrIndicator.hasLeftStartPosition() && isAutoRefresh()) { if (DEBUG) { PtrCLog.d(LOG_TAG, "call onRelease after scroll finish"); } onRelease(true); } } /** * Detect whether is refreshing. * * @return */ public boolean isRefreshing() { return mStatus == PTR_STATUS_LOADING; } /** * Call this when data is loaded. * The UI will perform complete at once or after a delay, depends on the time elapsed is greater then {@link #mLoadingMinTime} or not. */ final public void refreshComplete() { if (DEBUG) { PtrCLog.i(LOG_TAG, "refreshComplete"); } if (mRefreshCompleteHook != null) { mRefreshCompleteHook.reset(); } int delay = (int) (mLoadingMinTime - (System.currentTimeMillis() - mLoadingStartTime)); if (delay <= 0) { if (DEBUG) { PtrCLog.d(LOG_TAG, "performRefreshComplete at once"); } performRefreshComplete(); } else { postDelayed(new Runnable() { @Override public void run() { performRefreshComplete(); } }, delay); if (DEBUG) { PtrCLog.d(LOG_TAG, "performRefreshComplete after delay: %s", delay); } } } /** * Do refresh complete work when time elapsed is greater than {@link #mLoadingMinTime} */ private void performRefreshComplete() { mStatus = PTR_STATUS_COMPLETE; // if is auto refresh do nothing, wait scroller stop if (mScrollChecker.mIsRunning && isAutoRefresh()) { // do nothing if (DEBUG) { PtrCLog.d(LOG_TAG, "performRefreshComplete do nothing, scrolling: %s, auto refresh: %s", mScrollChecker.mIsRunning, mFlag); } return; } notifyUIRefreshComplete(false); } /** * Do real refresh work. If there is a hook, execute the hook first. * * @param ignoreHook */ private void notifyUIRefreshComplete(boolean ignoreHook) { /** * After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook. */ if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) { if (DEBUG) { PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run."); } mRefreshCompleteHook.takeOver(); return; } if (mPtrUIHandlerHolder.hasHandler()) { if (DEBUG) { PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete"); } mPtrUIHandlerHolder.onUIRefreshComplete(this); } mPtrIndicator.onUIRefreshComplete(); tryScrollBackToTopAfterComplete(); tryToNotifyReset(); } public void autoRefresh() { autoRefresh(true, mDurationToCloseHeader); } public void autoRefresh(boolean atOnce) { autoRefresh(atOnce, mDurationToCloseHeader); } private void clearFlag() { // remove auto fresh flag mFlag = mFlag & ~MASK_AUTO_REFRESH; } public void autoRefresh(boolean atOnce, int duration) { if (mStatus != PTR_STATUS_INIT) { return; } mFlag |= atOnce ? FLAG_AUTO_REFRESH_AT_ONCE : FLAG_AUTO_REFRESH_BUT_LATER; mStatus = PTR_STATUS_PREPARE; if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIRefreshPrepare(this); if (DEBUG) { PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag); } } mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToRefresh(), duration); if (atOnce) { mStatus = PTR_STATUS_LOADING; performRefresh(); } } public boolean isAutoRefresh() { return (mFlag & MASK_AUTO_REFRESH) > 0; } private boolean performAutoRefreshButLater() { return (mFlag & MASK_AUTO_REFRESH) == FLAG_AUTO_REFRESH_BUT_LATER; } /** * If @param enable has been set to true. The user can perform next PTR at once. * * @param enable */ public void setEnabledNextPtrAtOnce(boolean enable) { if (enable) { mFlag = mFlag | FLAG_ENABLE_NEXT_PTR_AT_ONCE; } else { mFlag = mFlag & ~FLAG_ENABLE_NEXT_PTR_AT_ONCE; } } public boolean isEnabledNextPtrAtOnce() { return (mFlag & FLAG_ENABLE_NEXT_PTR_AT_ONCE) > 0; } /** * The content view will now move when {@param pinContent} set to true. * * @param pinContent */ public void setPinContent(boolean pinContent) { if (pinContent) { mFlag = mFlag | FLAG_PIN_CONTENT; } else { mFlag = mFlag & ~FLAG_PIN_CONTENT; } } public boolean isPinContent() { return (mFlag & FLAG_PIN_CONTENT) > 0; } /** * It's useful when working with viewpager. * * @param disable */ public void disableWhenHorizontalMove(boolean disable) { mDisableWhenHorizontalMove = disable; } /** * loading will last at least for so long * * @param time */ public void setLoadingMinTime(int time) { mLoadingMinTime = time; } /** * Not necessary any longer. Once moved, cancel event will be sent to child. * * @param yes */ @Deprecated public void setInterceptEventWhileWorking(boolean yes) { } @SuppressWarnings({"unused"}) public View getContentView() { return mContent; } public void setPtrHandler(PtrHandler ptrHandler) { mPtrHandler = ptrHandler; } public void addPtrUIHandler(PtrUIHandler ptrUIHandler) { PtrUIHandlerHolder.addHandler(mPtrUIHandlerHolder, ptrUIHandler); } @SuppressWarnings({"unused"}) public void removePtrUIHandler(PtrUIHandler ptrUIHandler) { mPtrUIHandlerHolder = PtrUIHandlerHolder.removeHandler(mPtrUIHandlerHolder, ptrUIHandler); } public void setPtrIndicator(PtrIndicator slider) { if (mPtrIndicator != null && mPtrIndicator != slider) { slider.convertFrom(mPtrIndicator); } mPtrIndicator = slider; } @SuppressWarnings({"unused"}) public float getResistance() { return mPtrIndicator.getResistance(); } public void setResistance(float resistance) { mPtrIndicator.setResistance(resistance); } @SuppressWarnings({"unused"}) public float getDurationToClose() { return mDurationToClose; } /** * The duration to return back to the refresh position * * @param duration */ public void setDurationToClose(int duration) { mDurationToClose = duration; } @SuppressWarnings({"unused"}) public long getDurationToCloseHeader() { return mDurationToCloseHeader; } /** * The duration to close time * * @param duration */ public void setDurationToCloseHeader(int duration) { mDurationToCloseHeader = duration; } public void setRatioOfHeaderHeightToRefresh(float ratio) { mPtrIndicator.setRatioOfHeaderHeightToRefresh(ratio); } public int getOffsetToRefresh() { return mPtrIndicator.getOffsetToRefresh(); } @SuppressWarnings({"unused"}) public void setOffsetToRefresh(int offset) { mPtrIndicator.setOffsetToRefresh(offset); } @SuppressWarnings({"unused"}) public float getRatioOfHeaderToHeightRefresh() { return mPtrIndicator.getRatioOfHeaderToHeightRefresh(); } @SuppressWarnings({"unused"}) public void setOffsetToKeepHeaderWhileLoading(int offset) { mPtrIndicator.setOffsetToKeepHeaderWhileLoading(offset); } @SuppressWarnings({"unused"}) public int getOffsetToKeepHeaderWhileLoading() { return mPtrIndicator.getOffsetToKeepHeaderWhileLoading(); } @SuppressWarnings({"unused"}) public boolean isKeepHeaderWhenRefresh() { return mKeepHeaderWhenRefresh; } public void setKeepHeaderWhenRefresh(boolean keepOrNot) { mKeepHeaderWhenRefresh = keepOrNot; } public boolean isPullToRefresh() { return mPullToRefresh; } public void setPullToRefresh(boolean pullToRefresh) { mPullToRefresh = pullToRefresh; } @SuppressWarnings({"unused"}) public View getHeaderView() { return mHeaderView; } public void setHeaderView(View header) { if (mHeaderView != null && header != null && mHeaderView != header) { removeView(mHeaderView); } ViewGroup.LayoutParams lp = header.getLayoutParams(); if (lp == null) { lp = new LayoutParams(-1, -2); header.setLayoutParams(lp); } mHeaderView = header; addView(header); } @Override protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { return p != null && p instanceof LayoutParams; } @Override protected ViewGroup.LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } @Override protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return new LayoutParams(p); } @Override public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } private void sendCancelEvent() { if (DEBUG) { PtrCLog.d(LOG_TAG, "send cancel event"); } // The ScrollChecker will update position and lead to send cancel event when mLastMoveEvent is null. // fix #104, #80, #92 if (mLastMoveEvent == null) { return; } MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); dispatchTouchEventSupper(e); } private void sendDownEvent() { if (DEBUG) { PtrCLog.d(LOG_TAG, "send down event"); } final MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime(), MotionEvent.ACTION_DOWN, last.getX(), last.getY(), last.getMetaState()); dispatchTouchEventSupper(e); } public static class LayoutParams extends MarginLayoutParams { public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); } public LayoutParams(int width, int height) { super(width, height); } @SuppressWarnings({"unused"}) public LayoutParams(MarginLayoutParams source) { super(source); } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } class ScrollChecker implements Runnable { private int mLastFlingY; private Scroller mScroller; private boolean mIsRunning = false; private int mStart; private int mTo; public ScrollChecker() { mScroller = new Scroller(getContext()); } public void run() { boolean finish = !mScroller.computeScrollOffset() || mScroller.isFinished(); int curY = mScroller.getCurrY(); int deltaY = curY - mLastFlingY; if (DEBUG) { if (deltaY != 0) { PtrCLog.v(LOG_TAG, "scroll: %s, start: %s, to: %s, currentPos: %s, current :%s, last: %s, delta: %s", finish, mStart, mTo, mPtrIndicator.getCurrentPosY(), curY, mLastFlingY, deltaY); } } if (!finish) { mLastFlingY = curY; movePos(deltaY); post(this); } else { finish(); } } private void finish() { if (DEBUG) { PtrCLog.v(LOG_TAG, "finish, currentPos:%s", mPtrIndicator.getCurrentPosY()); } reset(); onPtrScrollFinish(); } private void reset() { mIsRunning = false; mLastFlingY = 0; removeCallbacks(this); } public void abortIfWorking() { if (mIsRunning) { if (!mScroller.isFinished()) { mScroller.forceFinished(true); } onPtrScrollAbort(); reset(); } } public void tryToScrollTo(int to, int duration) { if (mPtrIndicator.isAlreadyHere(to)) { return; } mStart = mPtrIndicator.getCurrentPosY(); mTo = to; int distance = to - mStart; if (DEBUG) { PtrCLog.d(LOG_TAG, "tryToScrollTo: start: %s, distance:%s, to:%s", mStart, distance, to); } removeCallbacks(this); mLastFlingY = 0; // fix #47: Scroller should be reused, https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh/issues/47 if (!mScroller.isFinished()) { mScroller.forceFinished(true); } mScroller.startScroll(0, 0, 0, distance, duration); post(this); mIsRunning = true; } } private boolean isLoading = false; private boolean isAutoLoadMore = true; private boolean isLoadMoreEnable = false; private boolean hasInitLoadMoreView = false; private ILoadViewMoreFactory loadViewFactory = new DefaultLoadMoreViewFactory(); private ListViewHandler listViewHandler = new ListViewHandler(); private RecyclerViewHandler recyclerViewHandler = new RecyclerViewHandler(); private GridViewHandler gridViewHandler = new GridViewHandler(); private View mContentView; private ILoadViewMoreFactory.ILoadMoreView mLoadMoreView; public void setLoadMoreEnable(boolean loadMoreEnable) { if (this.isLoadMoreEnable == loadMoreEnable) { return; } this.isLoadMoreEnable = loadMoreEnable; if (!hasInitLoadMoreView && isLoadMoreEnable) { mContentView = getContentView(); mLoadMoreView = loadViewFactory.madeLoadMoreView(); if (mContentView instanceof GridView) { hasInitLoadMoreView = gridViewHandler.handleSetAdapter(mContentView, mLoadMoreView, onClickLoadMoreListener); gridViewHandler.setOnScrollBottomListener(mContentView, onScrollBottomListener); return; } if (mContentView instanceof AbsListView) { hasInitLoadMoreView = listViewHandler.handleSetAdapter(mContentView, mLoadMoreView, onClickLoadMoreListener); listViewHandler.setOnScrollBottomListener(mContentView, onScrollBottomListener); } else if (mContentView instanceof RecyclerView) { hasInitLoadMoreView = recyclerViewHandler.handleSetAdapter(mContentView, mLoadMoreView, onClickLoadMoreListener); recyclerViewHandler.setOnScrollBottomListener(mContentView, onScrollBottomListener); } } } private OnScrollBottomListener onScrollBottomListener = new OnScrollBottomListener() { @Override public void onScorllBootom() { if (isAutoLoadMore && isLoadMoreEnable && !isLoading()) { // 此处可加入网络是否可用的判断 loadMore(); } } }; private OnClickListener onClickLoadMoreListener = new OnClickListener() { @Override public void onClick(View v) { loadMore(); } }; void loadMore(){ isLoading = true; mLoadMoreView.showLoading(); loadMoreHandler.loadMore(); } public void loadMoreComplete(boolean hasMore){ isLoading = false; if (hasMore) { mLoadMoreView.showNormal(); }else { setNoMoreData(); } } public boolean isLoading(){ return isLoading; } public void setNoMoreData(){ isLoadMoreEnable = false; mLoadMoreView.showNomore(); } LoadMoreHandler loadMoreHandler; public void setLoadMoreHandler(LoadMoreHandler loadMoreHandler) { this.loadMoreHandler = loadMoreHandler; } public static interface LoadMoreHandler{ public void loadMore(); } }
[ "liuweify@yeah.net" ]
liuweify@yeah.net
afd2ce32920f98228dc82755abb98a4569cdda2c
4e588d7d48254736c454c1a56aad4927c3e972f4
/src/main/java/com/yk/example/rabbitmq/workqueue/NewTask.java
08428bf163a463914b80eeb7e8acab48c4fca045
[]
no_license
292528867/study-java
98e7d8378df2ac4d5e6da07b5ae62e4644c752af
c3bd906296519c6e339b1d95e672e19f16dfa372
refs/heads/master
2021-01-17T00:19:00.931755
2016-11-22T07:18:58
2016-11-22T07:18:58
47,393,457
0
0
null
null
null
null
UTF-8
Java
false
false
1,617
java
package com.yk.example.rabbitmq.workqueue; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.MessageProperties; /** * Created by yk on 16/6/23. */ public class NewTask { public static final String TASK_QUEUE_NAME = "taskQueue"; public void newTask(String[] args) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); boolean durable = true;//RabbitMQ will never lose our queue. channel.queueDeclare(TASK_QUEUE_NAME, durable, false, false, null); for (int i = 0; i < 10; i++) { String message = getMessage(args) + " " + i; //持久化 rabbitmq重启后消息也不会丢失 channel.basicPublish("", TASK_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes()); System.out.println(" [x] send '" + message + "'"); } } private static String getMessage(String[] args) { if (args.length < 1) return "hello world"; return joinStrings(args, ""); } private static String joinStrings(String[] args, String delimiter) { int length = args.length; if (length == 0) return ""; StringBuilder words = new StringBuilder(args[0]); for (int i = 1; i < length; i++) { words.append(delimiter).append(args[i]); } return words.toString(); } }
[ "292528867@qq.com" ]
292528867@qq.com
e52529b4231b16c2e49c8f54ef467c969e93172a
a2cc40e406fe5d674bdc271d6c4c4ababcf181d2
/PipApp/build/generated/source/r/debug/com/galvanic/pipsdk/PipApp/R.java
4ea5a861613dabc819fb6165b63825a61f0f18ed
[]
no_license
DED8IRD/Pip-Stress-Framing
ab96f6da691d22ee5bcb40c81c63f90e611ecee4
1155b1e104058827319e7d092aeaccece3e6b3a3
refs/heads/master
2021-06-12T09:37:46.129792
2017-01-12T18:19:54
2017-01-12T18:19:54
72,688,541
0
0
null
null
null
null
UTF-8
Java
false
false
6,196
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.galvanic.pipsdk.PipApp; public final class R { public static final class attr { /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int metaButtonBarButtonStyle=0x7f010001; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int metaButtonBarStyle=0x7f010000; } public static final class color { public static final int black_overlay=0x7f060000; } public static final class dimen { public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int Connect=0x7f090006; public static final int Disconnect=0x7f090007; public static final int Discover=0x7f090005; public static final int Status=0x7f090004; public static final int action_settings=0x7f09000c; public static final int btnNext=0x7f090001; public static final int dynamic_color_block=0x7f090003; public static final int textView=0x7f090009; public static final int textView2=0x7f09000b; public static final int textView3=0x7f090000; public static final int tvPrevious=0x7f09000a; public static final int tvRaw=0x7f090008; public static final int txtParticipant=0x7f090002; } public static final class layout { public static final int activity_login=0x7f030000; public static final int activity_pipsdkexample=0x7f030001; } public static final class menu { public static final int activitylogin=0x7f080000; public static final int pipsdkexample=0x7f080001; } public static final class string { public static final int Disconnect=0x7f070000; public static final int ParticipantMessage=0x7f070001; public static final int action_settings=0x7f070002; public static final int app_name=0x7f070003; public static final int btnConnect=0x7f070004; public static final int btnDisconnectFullScreen=0x7f070005; public static final int btnDiscover=0x7f070006; public static final int btnNext=0x7f070007; public static final int dummy_button=0x7f070008; public static final int dummy_content=0x7f070009; public static final int hello_world=0x7f07000a; public static final int title_activity_fullscreen=0x7f07000b; public static final int title_activity_login=0x7f07000c; public static final int tvAccumulateInfo=0x7f07000d; public static final int tvAccumulatedInfo=0x7f07000e; public static final int tvPrevious=0x7f07000f; public static final int tvRaw=0x7f070010; public static final int tvStatus=0x7f070011; public static final int txtParticipant=0x7f070012; } public static final class style { /** API 11 theme customizations can go here. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f050000; public static final int ButtonBar=0x7f050003; public static final int ButtonBarButton=0x7f050004; public static final int FullscreenActionBarStyle=0x7f050001; public static final int FullscreenTheme=0x7f050002; } public static final class styleable { /** Attributes that can be used with a ButtonBarContainerTheme. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ButtonBarContainerTheme_metaButtonBarButtonStyle com.galvanic.pipsdk.PipApp:metaButtonBarButtonStyle}</code></td><td></td></tr> <tr><td><code>{@link #ButtonBarContainerTheme_metaButtonBarStyle com.galvanic.pipsdk.PipApp:metaButtonBarStyle}</code></td><td></td></tr> </table> @see #ButtonBarContainerTheme_metaButtonBarButtonStyle @see #ButtonBarContainerTheme_metaButtonBarStyle */ public static final int[] ButtonBarContainerTheme = { 0x7f010000, 0x7f010001 }; /** <p>This symbol is the offset where the {@link com.galvanic.pipsdk.PipApp.R.attr#metaButtonBarButtonStyle} attribute's value can be found in the {@link #ButtonBarContainerTheme} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.galvanic.pipsdk.PipApp:metaButtonBarButtonStyle */ public static final int ButtonBarContainerTheme_metaButtonBarButtonStyle = 1; /** <p>This symbol is the offset where the {@link com.galvanic.pipsdk.PipApp.R.attr#metaButtonBarStyle} attribute's value can be found in the {@link #ButtonBarContainerTheme} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.galvanic.pipsdk.PipApp:metaButtonBarStyle */ public static final int ButtonBarContainerTheme_metaButtonBarStyle = 0; }; }
[ "ecwu@ucsc.edu" ]
ecwu@ucsc.edu
46ac3ad15936f5d6c4343b330a86bf5e1ff1dd6a
74c073e602404a49d4a193bfdbbaf1d694446a49
/modules/digitalpathology/digitalpathology-api/src/main/java/at/graz/meduni/bibbox/digitalpathology/model/wsiSoap.java
3a2f30885bbd45405c3134e3d0ee62a8e2059293
[]
no_license
reihsr/bibbox-mdss
e478d39b1b8dd12169d33aa9eef7cf2e023fe51f
304eb37ae3e53a7218c1c266b64700c0f0ab48df
refs/heads/master
2021-04-15T12:24:34.613080
2019-01-05T17:01:26
2019-01-05T17:01:26
126,207,462
0
0
null
null
null
null
UTF-8
Java
false
false
5,474
java
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * 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. */ package at.graz.meduni.bibbox.digitalpathology.model; import aQute.bnd.annotation.ProviderType; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * This class is used by SOAP remote services, specifically {@link at.graz.meduni.bibbox.digitalpathology.service.http.wsiServiceSoap}. * * @author robert * @see at.graz.meduni.bibbox.digitalpathology.service.http.wsiServiceSoap * @generated */ @ProviderType public class wsiSoap implements Serializable { public static wsiSoap toSoapModel(wsi model) { wsiSoap soapModel = new wsiSoap(); soapModel.setUuid(model.getUuid()); soapModel.setWsiId(model.getWsiId()); soapModel.setGroupId(model.getGroupId()); soapModel.setCompanyId(model.getCompanyId()); soapModel.setUserId(model.getUserId()); soapModel.setUserName(model.getUserName()); soapModel.setCreateDate(model.getCreateDate()); soapModel.setModifiedDate(model.getModifiedDate()); soapModel.setStatus(model.getStatus()); soapModel.setStatusByUserId(model.getStatusByUserId()); soapModel.setStatusByUserName(model.getStatusByUserName()); soapModel.setStatusDate(model.getStatusDate()); soapModel.setFilename(model.getFilename()); soapModel.setHashmrxs(model.getHashmrxs()); soapModel.setScanstart(model.getScanstart()); soapModel.setScanduration(model.getScanduration()); return soapModel; } public static wsiSoap[] toSoapModels(wsi[] models) { wsiSoap[] soapModels = new wsiSoap[models.length]; for (int i = 0; i < models.length; i++) { soapModels[i] = toSoapModel(models[i]); } return soapModels; } public static wsiSoap[][] toSoapModels(wsi[][] models) { wsiSoap[][] soapModels = null; if (models.length > 0) { soapModels = new wsiSoap[models.length][models[0].length]; } else { soapModels = new wsiSoap[0][0]; } for (int i = 0; i < models.length; i++) { soapModels[i] = toSoapModels(models[i]); } return soapModels; } public static wsiSoap[] toSoapModels(List<wsi> models) { List<wsiSoap> soapModels = new ArrayList<wsiSoap>(models.size()); for (wsi model : models) { soapModels.add(toSoapModel(model)); } return soapModels.toArray(new wsiSoap[soapModels.size()]); } public wsiSoap() { } public long getPrimaryKey() { return _wsiId; } public void setPrimaryKey(long pk) { setWsiId(pk); } public String getUuid() { return _uuid; } public void setUuid(String uuid) { _uuid = uuid; } public long getWsiId() { return _wsiId; } public void setWsiId(long wsiId) { _wsiId = wsiId; } public long getGroupId() { return _groupId; } public void setGroupId(long groupId) { _groupId = groupId; } public long getCompanyId() { return _companyId; } public void setCompanyId(long companyId) { _companyId = companyId; } public long getUserId() { return _userId; } public void setUserId(long userId) { _userId = userId; } public String getUserName() { return _userName; } public void setUserName(String userName) { _userName = userName; } public Date getCreateDate() { return _createDate; } public void setCreateDate(Date createDate) { _createDate = createDate; } public Date getModifiedDate() { return _modifiedDate; } public void setModifiedDate(Date modifiedDate) { _modifiedDate = modifiedDate; } public int getStatus() { return _status; } public void setStatus(int status) { _status = status; } public long getStatusByUserId() { return _statusByUserId; } public void setStatusByUserId(long statusByUserId) { _statusByUserId = statusByUserId; } public String getStatusByUserName() { return _statusByUserName; } public void setStatusByUserName(String statusByUserName) { _statusByUserName = statusByUserName; } public Date getStatusDate() { return _statusDate; } public void setStatusDate(Date statusDate) { _statusDate = statusDate; } public String getFilename() { return _filename; } public void setFilename(String filename) { _filename = filename; } public String getHashmrxs() { return _hashmrxs; } public void setHashmrxs(String hashmrxs) { _hashmrxs = hashmrxs; } public Date getScanstart() { return _scanstart; } public void setScanstart(Date scanstart) { _scanstart = scanstart; } public long getScanduration() { return _scanduration; } public void setScanduration(long scanduration) { _scanduration = scanduration; } private String _uuid; private long _wsiId; private long _groupId; private long _companyId; private long _userId; private String _userName; private Date _createDate; private Date _modifiedDate; private int _status; private long _statusByUserId; private String _statusByUserName; private Date _statusDate; private String _filename; private String _hashmrxs; private Date _scanstart; private long _scanduration; }
[ "robert.reihs@medunigraz.at" ]
robert.reihs@medunigraz.at
6dcf29b194988b8527d46467bed85be0f99ea21d
03b55ed07b96a59429cf4a93f690a3dd47214141
/KiiAppLocker/src/com/kii/applocker/AppLocker.java
4f20e355271ae7ea4eb82e19b4b4936f787cef5c
[]
no_license
tallnato/KiiBook
a9d0ceb922aa4d6fd993f70505cc91413ee12426
22c98cbc5dbff40687d138a4b7afa9bacfb1154b
refs/heads/master
2021-05-28T17:10:45.637807
2012-10-21T15:21:01
2012-10-21T15:21:01
27,450,732
1
0
null
null
null
null
UTF-8
Java
false
false
5,157
java
package com.kii.applocker; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Messenger; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.CheckBox; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class AppLocker extends ListActivity { private PermissionsArrayAdapter mAdapter; final Messenger mMessenger = new Messenger(new IncomingHandler()); /*private Messenger mService = null; private final ServiceConnection mConnection = new AppLockerServiceConnection();*/ private final int PASSWORD_DIALOG = 0x01; @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate(savedInstanceState); SharedPreferences settings = getSharedPreferences(AppLockerService.PREFS_NAME, Context.MODE_MULTI_PROCESS); Set<String> temp = null; if (settings != null && settings.contains(AppLockerService.blockedAppsKey)) { temp = settings.getStringSet(AppLockerService.blockedAppsKey, null); } mAdapter = new PermissionsArrayAdapter(getApplicationContext(), 0, getInstalledApps(), temp); setListAdapter(mAdapter); getListView().setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick( AdapterView<?> arg0, View arg1, int arg2, long arg3 ) { PackagePermissions pp = mAdapter.getItem(arg2); pp.setBlocked(!pp.isBlocked()); CheckBox cb = (CheckBox) arg1.findViewById(R.id.checkBox); cb.setChecked(pp.isBlocked()); } }); startService(new Intent(this, AppLockerService.class)); } @Override protected void onActivityResult( int requestCode, int resultCode, Intent data ) { if (requestCode == PASSWORD_DIALOG) { if (resultCode == RESULT_CANCELED) { finish(); } } } @Override public void onStart() { super.onStart(); startActivityForResult(new Intent(getApplicationContext(), PasswordDialog.class), PASSWORD_DIALOG); } @Override public void onPause() { super.onPause(); SharedPreferences settings = getSharedPreferences(AppLockerService.PREFS_NAME, Context.MODE_MULTI_PROCESS); SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(AppLockerService.blockedAppsKey, new HashSet<String>(mAdapter.getBlockedApps())); editor.commit(); Intent intent = new Intent(); intent.setAction(AppLockerService.PARENTAL_BROADCAST); sendBroadcast(intent); } @Override public boolean onCreateOptionsMenu( Menu menu ) { getMenuInflater().inflate(R.menu.activity_app_locker, menu); return true; } @Override public boolean onOptionsItemSelected( MenuItem item ) { switch (item.getItemId()) { case R.id.menu_select_all: mAdapter.selectAll(); return true; case R.id.menu_unselect_all: mAdapter.unSelectAll(); return true; default: return super.onOptionsItemSelected(item); } } private List<PackagePermissions> getInstalledApps() { PackageManager pm = getPackageManager(); ArrayList<PackagePermissions> res = new ArrayList<PackagePermissions>(); Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> pkgAppsList = pm.queryIntentActivities(mainIntent, 0); for (ResolveInfo ri : pkgAppsList) { if (ri.loadLabel(pm).toString().contains("KiiLauncher") || ri.loadLabel(pm).toString().contains("AppLocker")) { continue; } PackagePermissions newInfo = new PackagePermissions(ri.loadLabel(pm).toString(), ri.activityInfo.packageName, ri.loadIcon(pm)); newInfo.setBlocked(true); res.add(newInfo); } Collections.sort(res); return res; } private class IncomingHandler extends Handler { @Override public void handleMessage( Message msg ) { switch (msg.what) { default: super.handleMessage(msg); } } } }
[ "renato.m.alm@gmail.com" ]
renato.m.alm@gmail.com
9bfc5854a35608cfb1eb6fc61f62c43921d7dae7
638e3eb8a3f1614dec7cc8efd3a3484cd2bd5a9f
/src/main/java/no/nav/eux/rina/admin/http/InboundHttpHeaders.java
f5153ad69dbca10790d6ec0a7a7f7354b139a7b4
[ "MIT" ]
permissive
navikt/eux-rina-irsync
80e6c8535534351590a81a4858caccaf5faa0729
24ab80ae26079b76e6b3338d79ff1a4046447018
refs/heads/master
2023-01-24T15:48:25.062709
2023-01-20T11:16:27
2023-01-20T11:16:27
231,565,659
3
0
MIT
2022-10-05T13:13:35
2020-01-03T10:32:57
Java
UTF-8
Java
false
false
1,783
java
package no.nav.eux.rina.admin.http; import lombok.AllArgsConstructor; import lombok.Data; import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; import javax.servlet.http.HttpServletRequest; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.Optional; @Component //@RequestScope //@SessionScope ... no, maybe we need ApplicationScope //@Scope (value= WebApplicationContext.SCOPE_SESSION, proxyMode= ScopedProxyMode.TARGET_CLASS) @Scope (value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) public class InboundHttpHeaders { private HttpServletRequest httpServletRequest; public InboundHttpHeaders(HttpServletRequest httpServletRequest) { this.httpServletRequest = httpServletRequest; } public String getHeader(String name){ return httpServletRequest.getHeader(name); } public Optional<BasicAuthCredentials> basicAuthCredentials(){ return Optional.ofNullable(getHeader(HttpHeaders.AUTHORIZATION)) .filter(s -> s.startsWith("Basic ")) .map(this::decodeHeader); } private BasicAuthCredentials decodeHeader(String header) { byte[] decoded = Base64.getDecoder().decode(header.substring(6)); String token = new String(decoded, StandardCharsets.UTF_8); String[] usernamePwd = token.split(":"); return usernamePwd.length == 2 ? new BasicAuthCredentials(usernamePwd[0], usernamePwd[1]) : null; } @Data @AllArgsConstructor public static class BasicAuthCredentials { private String username; private String password; } }
[ "Torsten.Kirschner@nav.no" ]
Torsten.Kirschner@nav.no
ff61cd280ac94567a8fb746f488d0236c5ac3b53
955e352a9d168d52fd1e0c5a18123e92094164b2
/service/src/main/java/com/wjl/service/ModelCreditCardMailReportService.java
0e79e1ddf6bc23654ed397140db6ec99cff3afc8
[]
no_license
liuasher/risk-management
2787e97e0c4f1665aa6943486e9bc46e104b5c97
69fab05f7a7a4f242aea2e842c25bdee13b345d8
refs/heads/master
2022-07-15T09:01:28.770675
2019-08-11T09:21:52
2019-08-11T09:21:52
201,424,436
0
1
null
2022-06-29T17:33:55
2019-08-09T08:21:17
Java
UTF-8
Java
false
false
253
java
package com.wjl.service; import com.wjl.model.mongo.CreditCardMailReportData; public interface ModelCreditCardMailReportService { public void saveByJsonArray(CreditCardMailReportData creditCardMailReportData,String identification,Long userId); }
[ "yaxiong.liu@aqara.com" ]
yaxiong.liu@aqara.com
9029c5a494e08c65d4cfbe0c4245be9fefe90ee0
61ea8f76c5230b6709bf56cfdec212aab1a4c521
/automatizacion/src/main/java/co/udem/automatizacion/page/ConsultaProcesosPage.java
2e90659a2be90b18d2c565874246f421e8d15efd
[]
no_license
correadaniel3/calidad-udem
949bfecea17beeda13958817fc7f8c5c5c8a9bda
7ae9dbe3ab675d691b8d21771a43161699f24b08
refs/heads/master
2020-09-01T21:18:55.811694
2019-11-07T03:03:08
2019-11-07T03:03:08
219,060,364
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package co.udem.automatizacion.page; import net.serenitybdd.core.annotations.findby.By; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.screenplay.targets.Target; public class ConsultaProcesosPage extends PageObject { public static final Target SEL_CIUDAD = Target.the("Select Box de ciudad").locatedBy("//*[@id=\"ddlCiudad\"]"); public static final Target SEL_ENTIDAD = Target.the("Select Box de entidad").locatedBy("//*[@id=\"ddlEntidadEspecialidad\"]"); public static final Target SEL_NRO_RADICADO = Target.the("Select Box de Entidad").located(By.xpath("//div[@id='divNumRadicacion']//tr[.//h1[contains(.,'Número de Radicación')]]/following-sibling::tr[1]//input")); public static final Target TEXT_BARRA = Target.the("Select Box de Entidad").located(By.id("ConsultarNum")); }
[ "daniel.correa@smith.co" ]
daniel.correa@smith.co
60bb6d585e2c17c845a603e1edf32618f9091a77
c8960b13d600dbb450884200cbe69d79464107b4
/Java/String 2/bobThere.java
33e27c1770958315d525a28d6c7de82b50eacd76
[]
no_license
saadbinmanjur/CodingBat-Codes
b7a88411586e0bcd7f823587156c1d9f8d14e9c8
ce5e6dd1651043d6919f5762ea878ec339531357
refs/heads/master
2023-05-26T11:56:55.735833
2021-05-29T05:33:44
2021-05-29T05:33:44
274,699,163
2
0
null
null
null
null
UTF-8
Java
false
false
330
java
/* Return true if the given string contains a "bob" string, but where the * middle 'o' char can be any char. */ public boolean bobThere(String str) { for(int i = 0; i < str.length() - 2; i++) { if(str.charAt(i) == 'b' && str.charAt(i + 2) == 'b') return true; } return false; }
[ "noreply@github.com" ]
saadbinmanjur.noreply@github.com
229cbfc17f039c3bec4946689b29bc4bea0367bf
9f1df1ea191b53ee30ee37a723e4fd9943493347
/src/TesteConsumidorFilaDLQ.java
5c367d10d24d8eab47f3b737fdcab1e84638f5b6
[]
no_license
robertondc/active-mq
eb61cec609b0155e33826d04249c894141cab704
9b78cfe5bb411321de159f8e07efff134bee6777
refs/heads/master
2021-01-10T04:21:44.832231
2016-01-19T00:57:30
2016-01-19T00:57:30
49,916,039
0
0
null
null
null
null
UTF-8
Java
false
false
1,194
java
import java.util.Scanner; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.ObjectMessage; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; import br.com.caelum.modelo.Pedido; public class TesteConsumidorFilaDLQ { public static void main(String[] args) throws Exception{ InitialContext context = new InitialContext(); ConnectionFactory factory = (ConnectionFactory) context.lookup("ConnectionFactory"); Connection connection = factory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination fila = (Destination) context.lookup("DLQ"); MessageConsumer consumer = session.createConsumer(fila); consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { System.out.println(message); } }); new Scanner(System.in).nextLine(); session.close(); connection.close(); context.close(); } }
[ "robertondc@gmail.com" ]
robertondc@gmail.com
edb82ab5cc3a61e9f4080de3bd4cb06575f07974
525245e28c3a329e89dff406a841a6ca70dac70d
/MySessionServlet.java
7e8ec305c9f439c6c1d954db64684317952ea7fa
[]
no_license
shravanvyawahare/cdac-juhu
0ae717346c8e47209a75ba443fbfbabdf339fea5
8e495a8a7f169818b1058a6907d313828d93e0a7
refs/heads/master
2020-05-30T04:26:25.665546
2019-05-30T13:06:54
2019-05-30T13:06:54
189,537,462
0
1
null
2019-05-31T06:08:39
2019-05-31T06:08:38
null
UTF-8
Java
false
false
1,139
java
/** * */ package com.cdac.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @author Smita B Kumar * */ public class MySessionServlet extends HttpServlet{ public MySessionServlet() { // TODO Auto-generated constructor stub } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(false); PrintWriter pw = resp.getWriter(); resp.setContentType("text/html"); if(session!=null) { pw.println("<h1>"+session.getId()+"<h1>"); }else { pw.println("<h1 style=color:red>Session Expired!!<h1>"); } pw.println("<a href='index.jsp'>Home Page</a>"); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub doGet(req, resp); } }
[ "noreply@github.com" ]
shravanvyawahare.noreply@github.com
e4137b9b6e5b7d3144ac5f1f8c4458f93b015ce4
52b69d726327a833a5fa0d6199d4d89277ad112f
/src/main/java/org/sid/stock/sb/web/FamilleController.java
36995c50ef6e257fef3dc704b95d8043df856a77
[]
no_license
dimkhaa/g_Pharmacie
4b51b977bba6759a041e2939b2d0b398931061b7
189f53b7195110db0c546832a9d7dce2b7e27a95
refs/heads/master
2023-03-14T10:49:38.266862
2021-02-26T22:30:47
2021-02-26T22:30:47
342,660,184
0
0
null
null
null
null
UTF-8
Java
false
false
1,773
java
package org.sid.stock.sb.web; import java.util.List; import org.sid.stock.sb.entities.Famille; import org.sid.stock.sb.service.FamilleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javassist.NotFoundException; @Controller public class FamilleController { @Autowired private FamilleService familleService; @RequestMapping(value = "/listfamille") public String famille(Model model) { List<Famille> famille = familleService.findAll(); model.addAttribute("Listfamille", famille); return "familles"; } @RequestMapping(value = "/Supfamille", method = RequestMethod.GET) public String delete(Long id) { familleService.removeById(id); return "redirect:/listfamille"; } @RequestMapping(value = "/ajoutfamille", method = RequestMethod.GET) public String ajuterFamille(Model model) { model.addAttribute("famille", new Famille()); return "Ajouterfamille"; } @RequestMapping(value = "/savefamille", method = RequestMethod.POST) public String enregistrerMedicament(Model model, Famille famille) { familleService.create(famille); return "redirect:/listfamille"; } @RequestMapping(value = "/editfamille", method = RequestMethod.GET) public String edit(Model model, Long id) { Famille famille; try { famille = familleService.findOne(id); model.addAttribute("famille", famille); model.addAttribute("medicaments", famille.getMedicaments()); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return "Editerfamille"; } }
[ "khadimkhouma01@gmail.com" ]
khadimkhouma01@gmail.com
e7daaa355544968d1637372f0d8746a371f632d2
17afcc3f70925b04e21ad214bdb1723adfb6405a
/LeetCodeOnlineJudge/BinaryTreeMaximumSumPath/Solution.java
2d2b390774f7670d8260f321b860ac35a7330880
[]
no_license
wonderli/Solutions
a848eeda6ceb86e3be0c47ab34b426dea0282343
56e6b90cd1e7bca06ec5ee69a1a8d3257f99ed29
refs/heads/master
2022-11-06T17:03:29.667413
2022-10-24T18:18:47
2022-10-24T18:18:47
3,465,559
11
4
null
null
null
null
UTF-8
Java
false
false
971
java
public class Solution{ public int maxPathSum(TreeNode root){ int currSum[] = new int[1]; currSum[0] = 0; int maxSum[] = new int[1]; maxSum[0] = Integer.MIN_VALUE; helper(root, currSum, maxSum); return maxSum[0]; } public void helper(TreeNode root, int[] currSum, int[] maxSum){ if(root == null){ currSum[0] = 0; return; } int[] leftSum = new int[1]; int[] rightSum = new int[1]; helper(root.left, leftSum, maxSum); helper(root.right, rightSum, maxSum); currSum[0] = Math.max(root.val, Math.max(leftSum[0] + root.val, rightSum[0] + root.val)); maxSum[0] = Math.max(maxSum[0], Math.max(currSum[0], leftSum[0] + root.val + rightSum[0])); } public static void main(String args[]){ Solution sol = new Solution(); TreeNode root = new TreeNode(0); System.out.println(sol.maxPathSum(root)); } }
[ "lixinyu2268@gmail.com" ]
lixinyu2268@gmail.com
fa1a55975860b869e2aaf162a7fb73784c84278b
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE134_Uncontrolled_Format_String/s02/CWE134_Uncontrolled_Format_String__URLConnection_format_22b.java
2c523847febe117f543128603876b2d7fb62bd94
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
3,518
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__URLConnection_format_22b.java Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-22b.tmpl.java */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: URLConnection Read data from a web server with URLConnection * GoodSource: A hardcoded string * Sinks: format * GoodSink: dynamic formatted stdout with string defined * BadSink : dynamic formatted stdout without validation * Flow Variant: 22 Control flow: Flow controlled by value of a public static variable. Sink functions are in a separate file from sources. * * */ package testcases.CWE134_Uncontrolled_Format_String.s02; import testcasesupport.*; public class CWE134_Uncontrolled_Format_String__URLConnection_format_22b { public void badSink(String data ) throws Throwable { if (CWE134_Uncontrolled_Format_String__URLConnection_format_22a.badPublicStatic) { if (data != null) { /* POTENTIAL FLAW: uncontrolled string formatting */ System.out.format(data); } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } } /* goodB2G1() - use badsource and goodsink by setting the static variable to false instead of true */ public void goodB2G1Sink(String data ) throws Throwable { if (CWE134_Uncontrolled_Format_String__URLConnection_format_22a.goodB2G1PublicStatic) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } else { if (data != null) { /* FIX: explicitly defined string formatting */ System.out.format("%s%n", data); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ public void goodB2G2Sink(String data ) throws Throwable { if (CWE134_Uncontrolled_Format_String__URLConnection_format_22a.goodB2G2PublicStatic) { if (data != null) { /* FIX: explicitly defined string formatting */ System.out.format("%s%n", data); } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(String data ) throws Throwable { if (CWE134_Uncontrolled_Format_String__URLConnection_format_22a.goodG2BPublicStatic) { if (data != null) { /* POTENTIAL FLAW: uncontrolled string formatting */ System.out.format(data); } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } } }
[ "bqcuong2212@gmail.com" ]
bqcuong2212@gmail.com
4d04c2ca2ab0d76e91bfad59fa9873ed4da38b82
dbf6dc80fe0bb37e30cd6121e062b0e36a47a975
/app/src/main/java/com/example/welcome/egrocers/User.java
bed70323bc9f23e07178cbb470987bf2185d0030
[]
no_license
HassanTariq1/Egrocers
935f2cd4def3b24aef3e17431fd4523d8ffedc05
9ed4d948887973f1ab6a39444a6ae8cde4fde0cd
refs/heads/master
2020-04-21T19:22:14.859707
2019-02-14T22:12:15
2019-02-14T22:12:15
169,803,922
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
package com.example.welcome.egrocers; /** * Created by WELCOME on 2/5/2019. */ public class User { private String Name; private String Password; public User() { } public User(String name, String password) { Name = name; Password = password; } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getPassword() { return Password; } public void setPassword(String password) { Password = password; } }
[ "mughalhassan467@gmail.om" ]
mughalhassan467@gmail.om
ef108b84580eaf0372883312cbb5b363b534aec7
9a106a7006ad2c6fd33699df0d87e8bb62034b0d
/app/src/main/java/net/skhu/feeder/LedActivity.java
6989272d651bff633f85ad112451776ad4c11d28
[]
no_license
kimdia200/AutoFeeder-IOT
32cd0be2f64a4f084c3263b4dbde18f8e415bb64
963aa1293c57d9fdee4f59ca4a8250df87e0451a
refs/heads/master
2022-09-07T03:12:05.697710
2020-06-01T08:40:33
2020-06-01T08:40:33
264,458,547
2
0
null
null
null
null
UTF-8
Java
false
false
8,474
java
package net.skhu.feeder; /* ColorPicker 라이브러리 참고URL : https://github.com/QuadFlask/colorpicker LED색상 8자리를 명도채도 배제하고 6자리로 전달함 */ import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.flask.colorpicker.ColorPickerView; import com.flask.colorpicker.OnColorChangedListener; import com.flask.colorpicker.OnColorSelectedListener; import org.eclipse.paho.client.mqttv3.IMqttMessageListener; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; public class LedActivity extends AppCompatActivity { ColorPickerView colorPickerView; Button button; Button button2; int selectColor; private MqttClient mqttClient; MqttConnectOptions options; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_led); //적용 버튼객체 생성 button = (Button)findViewById(R.id.btn_setColor); //LED OFF버튼 객체생성 button2 = (Button)findViewById(R.id.btn_offColor); //설정했던 색으로 버튼색 변경 (sharedPreferences 불러와서 사용) SharedPreferences feed = getSharedPreferences("feed", Activity.MODE_PRIVATE); //sharedPreferences에 설정해둔 값을 가져옴 selectColor = feed.getInt("setColor",0); //버튼의 색을 저장해두었던 색으로 변경 button.setBackgroundColor(selectColor); //ColorPickerView 객체 생성 colorPickerView = findViewById(R.id.color_picker_view); //손가락을 떼지않고 계속 드래그 하면서 선택해도 색깔마다 다 로그 적용되서 뜸 colorPickerView.addOnColorChangedListener(new OnColorChangedListener() { @Override public void onColorChanged(int selectedColor) { // Handle on color change Log.d("로그", "onColorChanged: 0x" + Integer.toHexString(selectedColor)); button.setBackgroundColor(selectedColor); } }); //손가락뗄때 최종 선택되는 반응을 캐치하는 리스너 colorPickerView.addOnColorSelectedListener(new OnColorSelectedListener() { @Override public void onColorSelected(int selectedColor) { Toast.makeText(LedActivity.this,"선택색상: " + Integer.toHexString(selectedColor).toUpperCase(),Toast.LENGTH_SHORT).show(); Log.d("로그", "onColorChanged: 0x" + Integer.toHexString(selectedColor).toUpperCase()); //변수 selectColor에 현재 colorPicker에서 선택된 색상값을 넣어줌 selectColor = selectedColor; } }); //클라이언트 url, id설정 및 mqtt연결 try { mqttClient = new MqttClient("tcp://tailor.cloudmqtt.com:14221","Feeder_led",new MemoryPersistence()); options = new MqttConnectOptions(); options.setAutomaticReconnect(true); options.setCleanSession(true); options.setUserName("tvtolaaa"); options.setPassword("mlbD5GoD8tV_".toCharArray()); // mqttClient.connect(options); // Toast.makeText(this, "mqtt연결됨", Toast.LENGTH_SHORT).show(); // mqttClient.subscribeWithResponse("test/toAndroid", 0, new IMqttMessageListener() { // @Override // public void messageArrived(String topic, MqttMessage message) throws Exception { // //전달받은값 표현해주는 로그 // Log.d("로그",topic+" : "+new String(message.getPayload())); // //이 액티비티는 전달받은 값으로 표현해줄게 없고 전송만 목적이므로 확인용으로만 둔다 // } // }); } catch (MqttException e) { Toast.makeText(this, "mqtt연결되지 않음1", Toast.LENGTH_SHORT).show(); e.printStackTrace(); Log.d("로그","오류"+e.toString()); } //색적용 버튼에 달아줄 리스너 작성 View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { //버튼 클릭시 버튼의 색을 선택된 색으로 변경해줌 button.setBackgroundColor(selectColor); //sharedPreferences에 값을 저장함 saveColor(selectColor); //액티비티 종료 finish(); } }; //버튼에 리스너 부착 button.setOnClickListener(listener); View.OnClickListener listener1 = new View.OnClickListener() { @Override public void onClick(View view) { //Led off함수 sendColorOff(); //액티비티 종료 finish(); } }; button2.setOnClickListener(listener1); } //sharedpreference에 색저장하는 함수 public void saveColor(int color){ SharedPreferences feed = getSharedPreferences("feed",Activity.MODE_PRIVATE); SharedPreferences.Editor edit = feed.edit(); edit.putInt("setColor",color); edit.commit(); sendColor(color); } public void sendColor(int color){ try { mqttClient.connect(options); Log.d("로그","mqtt연결됨"); } catch (MqttException e) { Log.d("로그","mqtt연결실패"); e.printStackTrace(); } //즉시급여 통신 구현 if(mqttClient.isConnected()==true){ try { String temp = Integer.toHexString(color).toUpperCase().substring(2,8); mqttClient.publish("test/toArduino", new MqttMessage(temp.getBytes())); Log.d("로그",temp+"컬러색상 mqtt통신으로 보내는데 성공함"); Toast.makeText(this, temp+"색으로 변경완료", Toast.LENGTH_SHORT).show(); mqttClient.disconnect(); Log.d("로그","mqtt연결 해제"); } catch (MqttException e) { Log.d("로그","컬러색상 mqtt통신으로 보내는데 실패함"); try { mqttClient.disconnect(); } catch (MqttException ex) { ex.printStackTrace(); } Log.d("로그","mqtt연결 해제"); e.printStackTrace(); } }else{ Log.d("로그","mqtt통신실패"); } } public void sendColorOff(){ try { mqttClient.connect(options); Log.d("로그","mqtt연결됨"); } catch (MqttException e) { Log.d("로그","mqtt연결실패"); e.printStackTrace(); } //즉시급여 통신 구현 if(mqttClient.isConnected()==true){ try { mqttClient.publish("test/toArduino", new MqttMessage("000000".getBytes())); Log.d("로그","Led Off메시지 mqtt통신으로 보내는데 성공함"); Toast.makeText(this, "Led Off로 변경완료", Toast.LENGTH_SHORT).show(); mqttClient.disconnect(); Log.d("로그","mqtt연결 해제"); } catch (MqttException e) { Log.d("로그","Led Off메시지 mqtt통신으로 보내는데 실패함"); try { mqttClient.disconnect(); } catch (MqttException ex) { ex.printStackTrace(); } Log.d("로그","mqtt연결 해제"); e.printStackTrace(); } }else{ Log.d("로그","mqtt통신실패"); } } }
[ "kimdia200@naver.com" ]
kimdia200@naver.com
987bb140ca2df3cfe6f77ff9386a75603fe3b46e
c970db663cd24ee01c82e22b6b3ad604617eba0a
/Design-Patterns/tch-study-factory/src/net/tch/java/func/TestClass.java
a0231eedc47ae168a8af044c155a725525f82992
[]
no_license
tongchenghao/studyRepository
4151df11f6ad6acc8e365ea3cd887b8ec988e3f6
d938e48a8a7715b70180f89bfacc11b110c54d41
refs/heads/master
2022-12-25T16:43:37.979467
2020-02-29T04:19:08
2020-02-29T04:19:08
228,629,918
0
0
null
null
null
null
UTF-8
Java
false
false
845
java
package func; import bean.Car; /** * @description:工厂方法测试类 * 优点:分离了业务逻辑,代码更便于维护 * 缺点:用户使用时却需要区分使用哪个工厂来获得需要的对象,不符合逻辑 * 因此需要引入抽象工厂,既分离业务逻辑,又不用用户区分使用哪个工厂 * @auth tongchenghao * @date 2019/12/26 */ public class TestClass { public static void main(String[] args) { AoDiFactory aoDiFactory = new AoDiFactory(); Car aodi = aoDiFactory.getCar(); aodi.descriptSelf(); BaoMaFacoty baoMaFacoty = new BaoMaFacoty(); Car baoma = baoMaFacoty.getCar(); baoma.descriptSelf(); BenChiFactory benChiFactory = new BenChiFactory(); Car benchi = benChiFactory.getCar(); benchi.descriptSelf(); } }
[ "462681358@qq.com" ]
462681358@qq.com
76f391eeabd7392e53122ae23f850c90d178ff0e
1e1b455bfd34e73f2610bb981a69317d12cedf7b
/RRJOKE.java
03d34e509619db25f7287ed5facf33b65aabfb30
[]
no_license
reyanshmishra/codechef-problems
920bffb3859cd1405761398ffd08a1ec8bd4006c
1218aa19f125466a3e3dc50190c7f4e00fff9f79
refs/heads/master
2021-07-13T16:09:00.704882
2020-11-09T10:21:36
2020-11-09T10:21:36
231,028,262
1
0
null
null
null
null
UTF-8
Java
false
false
220
java
import java.util.Scanner; class RRJOKE { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int T = scan.nextInt(); while (T > 0) { T--; } scan.close(); } }
[ "reyanshmishra@outlook.com" ]
reyanshmishra@outlook.com
cb4f1647466a792f74f137510f21a2dfd40287c5
82470eb022ddbdf98fc9338a876eee36c5ae07b6
/src/org/apache/http/client/utils/URIUtils.java
737a2f9afc253f4c7d34f50239e07bd8c580eb51
[ "Apache-2.0" ]
permissive
vuzzan/openclinic
eea5bc54a8b865fb843a291b2bebb89b3e0e8e51
3d4bbe9a03d93c6be94fa352f0415a1469e542cb
refs/heads/master
2021-09-05T05:46:14.797826
2018-01-24T14:25:43
2018-01-24T14:25:43
107,745,139
0
0
null
null
null
null
UTF-8
Java
false
false
16,522
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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.http.client.utils; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Locale; import java.util.Stack; import org.apache.http.HttpHost; import org.apache.http.annotation.Immutable; import org.apache.http.util.Args; import org.apache.http.util.TextUtils; /** * A collection of utilities for {@link URI URIs}, to workaround * bugs within the class or for ease-of-use features. * * @since 4.0 */ @Immutable public class URIUtils { /** * Constructs a {@link URI} using all the parameters. This should be * used instead of * {@link URI#URI(String, String, String, int, String, String, String)} * or any of the other URI multi-argument URI constructors. * * @param scheme * Scheme name * @param host * Host name * @param port * Port number * @param path * Path * @param query * Query * @param fragment * Fragment * * @throws URISyntaxException * If both a scheme and a path are given but the path is * relative, if the URI string constructed from the given * components violates RFC&nbsp;2396, or if the authority * component of the string is present but cannot be parsed * as a server-based authority * * @deprecated (4.2) use {@link URIBuilder}. */ @Deprecated public static URI createURI( final String scheme, final String host, final int port, final String path, final String query, final String fragment) throws URISyntaxException { final StringBuilder buffer = new StringBuilder(); if (host != null) { if (scheme != null) { buffer.append(scheme); buffer.append("://"); } buffer.append(host); if (port > 0) { buffer.append(':'); buffer.append(port); } } if (path == null || !path.startsWith("/")) { buffer.append('/'); } if (path != null) { buffer.append(path); } if (query != null) { buffer.append('?'); buffer.append(query); } if (fragment != null) { buffer.append('#'); buffer.append(fragment); } return new URI(buffer.toString()); } /** * A convenience method for creating a new {@link URI} whose scheme, host * and port are taken from the target host, but whose path, query and * fragment are taken from the existing URI. The fragment is only used if * dropFragment is false. The path is set to "/" if not explicitly specified. * * @param uri * Contains the path, query and fragment to use. * @param target * Contains the scheme, host and port to use. * @param dropFragment * True if the fragment should not be copied. * * @throws URISyntaxException * If the resulting URI is invalid. */ public static URI rewriteURI( final URI uri, final HttpHost target, final boolean dropFragment) throws URISyntaxException { Args.notNull(uri, "URI"); if (uri.isOpaque()) { return uri; } final URIBuilder uribuilder = new URIBuilder(uri); if (target != null) { uribuilder.setScheme(target.getSchemeName()); uribuilder.setHost(target.getHostName()); uribuilder.setPort(target.getPort()); } else { uribuilder.setScheme(null); uribuilder.setHost(null); uribuilder.setPort(-1); } if (dropFragment) { uribuilder.setFragment(null); } if (TextUtils.isEmpty(uribuilder.getPath())) { uribuilder.setPath("/"); } return uribuilder.build(); } /** * A convenience method for * {@link URIUtils#rewriteURI(URI, HttpHost, boolean)} that always keeps the * fragment. */ public static URI rewriteURI( final URI uri, final HttpHost target) throws URISyntaxException { return rewriteURI(uri, target, false); } /** * A convenience method that creates a new {@link URI} whose scheme, host, port, path, * query are taken from the existing URI, dropping any fragment or user-information. * The path is set to "/" if not explicitly specified. The existing URI is returned * unmodified if it has no fragment or user-information and has a path. * * @param uri * original URI. * @throws URISyntaxException * If the resulting URI is invalid. */ public static URI rewriteURI(final URI uri) throws URISyntaxException { Args.notNull(uri, "URI"); if (uri.isOpaque()) { return uri; } final URIBuilder uribuilder = new URIBuilder(uri); if (uribuilder.getUserInfo() != null) { uribuilder.setUserInfo(null); } if (TextUtils.isEmpty(uribuilder.getPath())) { uribuilder.setPath("/"); } if (uribuilder.getHost() != null) { uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ENGLISH)); } uribuilder.setFragment(null); return uribuilder.build(); } /** * Resolves a URI reference against a base URI. Work-around for bug in * java.net.URI (<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535>) * * @param baseURI the base URI * @param reference the URI reference * @return the resulting URI */ public static URI resolve(final URI baseURI, final String reference) { return URIUtils.resolve(baseURI, URI.create(reference)); } /** * Resolves a URI reference against a base URI. Work-around for bugs in * java.net.URI (e.g. <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535>) * * @param baseURI the base URI * @param reference the URI reference * @return the resulting URI */ public static URI resolve(final URI baseURI, final URI reference){ Args.notNull(baseURI, "Base URI"); Args.notNull(reference, "Reference URI"); URI ref = reference; final String s = ref.toString(); if (s.startsWith("?")) { return resolveReferenceStartingWithQueryString(baseURI, ref); } final boolean emptyReference = s.length() == 0; if (emptyReference) { ref = URI.create("#"); } URI resolved = baseURI.resolve(ref); if (emptyReference) { final String resolvedString = resolved.toString(); resolved = URI.create(resolvedString.substring(0, resolvedString.indexOf('#'))); } return normalizeSyntax(resolved); } /** * Resolves a reference starting with a query string. * * @param baseURI the base URI * @param reference the URI reference starting with a query string * @return the resulting URI */ private static URI resolveReferenceStartingWithQueryString( final URI baseURI, final URI reference) { String baseUri = baseURI.toString(); baseUri = baseUri.indexOf('?') > -1 ? baseUri.substring(0, baseUri.indexOf('?')) : baseUri; return URI.create(baseUri + reference.toString()); } /** * Removes dot segments according to RFC 3986, section 5.2.4 and * Syntax-Based Normalization according to RFC 3986, section 6.2.2. * * @param uri the original URI * @return the URI without dot segments */ private static URI normalizeSyntax(final URI uri) { if (uri.isOpaque() || uri.getAuthority() == null) { // opaque and file: URIs return uri; } Args.check(uri.isAbsolute(), "Base URI must be absolute"); final String path = uri.getPath() == null ? "" : uri.getPath(); final String[] inputSegments = path.split("/"); final Stack<String> outputSegments = new Stack<String>(); for (final String inputSegment : inputSegments) { if ((inputSegment.length() == 0) || (".".equals(inputSegment))) { // Do nothing } else if ("..".equals(inputSegment)) { if (!outputSegments.isEmpty()) { outputSegments.pop(); } } else { outputSegments.push(inputSegment); } } final StringBuilder outputBuffer = new StringBuilder(); for (final String outputSegment : outputSegments) { outputBuffer.append('/').append(outputSegment); } if (path.lastIndexOf('/') == path.length() - 1) { // path.endsWith("/") || path.equals("") outputBuffer.append('/'); } try { final String scheme = uri.getScheme().toLowerCase(); final String auth = uri.getAuthority().toLowerCase(); final URI ref = new URI(scheme, auth, outputBuffer.toString(), null, null); if (uri.getQuery() == null && uri.getFragment() == null) { return ref; } final StringBuilder normalized = new StringBuilder( ref.toASCIIString()); if (uri.getQuery() != null) { // query string passed through unchanged normalized.append('?').append(uri.getRawQuery()); } if (uri.getFragment() != null) { // fragment passed through unchanged normalized.append('#').append(uri.getRawFragment()); } return URI.create(normalized.toString()); } catch (final URISyntaxException e) { throw new IllegalArgumentException(e); } } /** * Extracts target host from the given {@link URI}. * * @param uri * @return the target host if the URI is absolute or <code>null</null> if the URI is * relative or does not contain a valid host name. * * @since 4.1 */ public static HttpHost extractHost(final URI uri) { if (uri == null) { return null; } HttpHost target = null; if (uri.isAbsolute()) { int port = uri.getPort(); // may be overridden later String host = uri.getHost(); if (host == null) { // normal parse failed; let's do it ourselves // authority does not seem to care about the valid character-set for host names host = uri.getAuthority(); if (host != null) { // Strip off any leading user credentials final int at = host.indexOf('@'); if (at >= 0) { if (host.length() > at+1 ) { host = host.substring(at+1); } else { host = null; // @ on its own } } // Extract the port suffix, if present if (host != null) { final int colon = host.indexOf(':'); if (colon >= 0) { final int pos = colon + 1; int len = 0; for (int i = pos; i < host.length(); i++) { if (Character.isDigit(host.charAt(i))) { len++; } else { break; } } if (len > 0) { try { port = Integer.parseInt(host.substring(pos, pos + len)); } catch (final NumberFormatException ex) { } } host = host.substring(0, colon); } } } } final String scheme = uri.getScheme(); if (host != null) { target = new HttpHost(host, port, scheme); } } return target; } /** * Derives the interpreted (absolute) URI that was used to generate the last * request. This is done by extracting the request-uri and target origin for * the last request and scanning all the redirect locations for the last * fragment identifier, then combining the result into a {@link URI}. * * @param originalURI * original request before any redirects * @param target * if the last URI is relative, it is resolved against this target, * or <code>null</code> if not available. * @param redirects * collection of redirect locations since the original request * or <code>null</code> if not available. * @return interpreted (absolute) URI */ public static URI resolve( final URI originalURI, final HttpHost target, final List<URI> redirects) throws URISyntaxException { Args.notNull(originalURI, "Request URI"); final URIBuilder uribuilder; if (redirects == null || redirects.isEmpty()) { uribuilder = new URIBuilder(originalURI); } else { uribuilder = new URIBuilder(redirects.get(redirects.size() - 1)); String frag = uribuilder.getFragment(); // read interpreted fragment identifier from redirect locations for (int i = redirects.size() - 1; frag == null && i >= 0; i--) { frag = redirects.get(i).getFragment(); } uribuilder.setFragment(frag); } // read interpreted fragment identifier from original request if (uribuilder.getFragment() == null) { uribuilder.setFragment(originalURI.getFragment()); } // last target origin if (target != null && !uribuilder.isAbsolute()) { uribuilder.setScheme(target.getSchemeName()); uribuilder.setHost(target.getHostName()); uribuilder.setPort(target.getPort()); } return uribuilder.build(); } /** * This class should not be instantiated. */ private URIUtils() { } }
[ "vuzzan@gmail.com" ]
vuzzan@gmail.com
0fd7fd7081ebd5d7d71f1f2b1db9f16f365ffd14
fdf0ae1822e66fe01b2ef791e04f7ca0b9a01303
/src/main/java/ms/html/IHTMLMapElement.java
81b3957e60f91b21a778f2dee6a894322f9add29
[]
no_license
wangguofeng1923/java-ie-webdriver
7da41509aa858fcd046630f6833d50b7c6cde756
d0f3cb8acf9be10220c4b85c526486aeb67b9b4f
refs/heads/master
2021-12-04T18:19:08.251841
2013-02-10T16:26:54
2013-02-10T16:26:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package ms.html ; import com4j.*; @IID("{3050F266-98B5-11CF-BB82-00AA00BDCE0B}") public interface IHTMLMapElement extends Com4jObject { // Methods: /** * <p> * Getter method for the COM property "areas" * </p> * @return Returns a value of type ms.html.IHTMLAreasCollection */ @DISPID(1002) //= 0x3ea. The runtime will prefer the VTID if present @VTID(7) ms.html.IHTMLAreasCollection areas(); @VTID(7) @ReturnValue(type=NativeType.Dispatch,defaultPropertyThrough={ms.html.IHTMLAreasCollection.class}) com4j.Com4jObject areas( @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object name, @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object index); /** * <p> * Setter method for the COM property "name" * </p> * @param p Mandatory java.lang.String parameter. */ @DISPID(-2147418112) //= 0x80010000. The runtime will prefer the VTID if present @VTID(8) void name( java.lang.String p); /** * <p> * Getter method for the COM property "name" * </p> * @return Returns a value of type java.lang.String */ @DISPID(-2147418112) //= 0x80010000. The runtime will prefer the VTID if present @VTID(9) java.lang.String name(); // Properties: }
[ "schneidh@gmail.com" ]
schneidh@gmail.com
54a3e9faba418cbff3251fcf4074ffcf411f1959
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/InventoryFilterMarshaller.java
0388cdb413429b144381cf1ee5838d5e4a2efa55
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
2,567
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.simplesystemsmanagement.model.transform; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.simplesystemsmanagement.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * InventoryFilterMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class InventoryFilterMarshaller { private static final MarshallingInfo<String> KEY_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("Key").build(); private static final MarshallingInfo<List> VALUES_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("Values").build(); private static final MarshallingInfo<String> TYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("Type").build(); private static final InventoryFilterMarshaller instance = new InventoryFilterMarshaller(); public static InventoryFilterMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(InventoryFilter inventoryFilter, ProtocolMarshaller protocolMarshaller) { if (inventoryFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inventoryFilter.getKey(), KEY_BINDING); protocolMarshaller.marshall(inventoryFilter.getValues(), VALUES_BINDING); protocolMarshaller.marshall(inventoryFilter.getType(), TYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
4ecc4bd1fd5e7b879f79a7f04d5c5031b62799bc
39b4c018eeb5fff58501283d9cc11f257a117a65
/app/src/main/java/com/hengchongkeji/constantcharge/base/BaseFragment.java
3649c278d28bec927e56bb8d673e141cefeebaae
[]
no_license
gopaychan/ConstantCharge
1032f6c71b843c541cc401384ee893a6fde2e27d
ae82384ecda1fa2635722fa3cf98c35d46a316b9
refs/heads/master
2021-01-23T01:34:21.653787
2017-05-20T04:16:01
2017-05-20T04:16:01
85,918,198
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package com.hengchongkeji.constantcharge.base; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import butterknife.ButterKnife; /** * Created by gopaychan on 2017/3/26. */ public abstract class BaseFragment extends Fragment { protected abstract @LayoutRes int getFragmentLayout(); protected void postOnCreateView(){ } protected View mRoot; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mRoot = inflater.inflate(getFragmentLayout(), container, false); ButterKnife.bind(this, mRoot); postOnCreateView(); return mRoot; } }
[ "gopaychan@gmial.com" ]
gopaychan@gmial.com
fdc074704c58425f16d1f6ebae1bd9ae3d0884b2
128148ccd272ac59495c6cbebcd520577c3641f2
/src/test/java/com/sb/soft/app/DepartmentsServiceApplicationTests.java
b2036add686de5747fd089d0e0a8f7771e7e0b8f
[]
no_license
saiprasadmukthapuram/springboot-exception-handling
4eb514265a0b8075f7f715b8c4691c8f150d2fac
4bd3dcb477cc2b9ebb67473d52ca3147b82875cf
refs/heads/main
2023-03-31T20:57:56.658974
2021-04-04T05:03:30
2021-04-04T05:03:30
354,458,615
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.sb.soft.app; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DepartmentsServiceApplicationTests { @Test void contextLoads() { } }
[ "sai.prasad-ext@bshg.com" ]
sai.prasad-ext@bshg.com
4f89d93c48c85419fb999db59b261c465e1910ef
087aa2842edc926bb9ddb9296486e00d23b02fae
/Commercialista/src/imprenditore.java
1f8d0c973ad8676899d243ddb684cfbbd3ea12b8
[]
no_license
Spank2580x/tsac-oojava
379ddec6c2908af6e78bc6646c8e9c1c82f00afb
0c1d997e1cc5d2b6f64b0ca44d8a50bb32433bcf
refs/heads/master
2021-06-10T11:43:43.442217
2016-02-16T11:53:55
2016-02-16T11:53:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
public class imprenditore extends cliente{ private String PIVA; private int numeroFatture; private String ragioneSociale; public imprenditore(String c ,String n ,String cf,String iva,int nf,String rs) { cognome=c; nome=n; CF=cf; PIVA=iva; numeroFatture=nf; ragioneSociale=rs; } public imprenditore(){ cognome="cog"; nome="maw"; CF="XXXXXXXXXX"; PIVA="01234556"; numeroFatture=0; ragioneSociale="nulla"; } public String getPIVA() { return PIVA; } public void setPIVA(String pIVA) { PIVA = pIVA; } public int getNumeroFatture() { return numeroFatture; } public void setNumeroFatture(int numeroFatture) { this.numeroFatture = numeroFatture; } public String getRagioneSociale() { return ragioneSociale; } public void setRagioneSociale(String ragioneSociale) { this.ragioneSociale = ragioneSociale; } @Override public int calcolaQuota(){ if(numeroFatture<=100) {return 50000;} else return 50000+(100*(numeroFatture-100)); } }
[ "Iulian Buf" ]
Iulian Buf
7b52bfd53f59179430a1273c73a862ea6a592a35
4ff88f067d0308b9378333cdfe3d0f2a830421aa
/TheWeather/app/src/main/java/techkids/mad3/theweather/WeatherService.java
7ad31109f7f48bbad46c40d28d9abc7c85f28b26
[]
no_license
trantrungnt/trungnt-android3-assignment14
1ae9d60dbbd5064930184d20eb34bd17cd69f055
b15c2f5ac14e29267cbd3ea520980bb193d05ba9
refs/heads/master
2021-01-20T19:00:24.734358
2016-06-02T04:55:03
2016-06-02T04:55:03
59,945,421
1
1
null
null
null
null
UTF-8
Java
false
false
8,022
java
package techkids.mad3.theweather; import android.app.AlarmManager; import android.app.IntentService; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ContentValues; import android.content.Intent; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.RemoteViews; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONObject; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; /** * An {@link IntentService} subclass for handling asynchronous task requests in * a service on a separate handler thread. * <p/> * TODO: Customize class - update intent actions, extra parameters and static * helper methods. */ public class WeatherService extends IntentService { private Bundle bundleAlarmStorageData; private Intent intentAlarm, intentAlarmStorageData; public WeatherService() { super("WeatherService"); } @Override protected void onHandleIntent(Intent intent) { URL url = null; try { url = new URL("http://api.openweathermap.org/data/2.5/weather?q=Hanoi&appid=688a892e665de9e2f5057f2b48e79ddd"); InputStreamReader reader = new InputStreamReader(url.openStream(),"UTF-8"); char[] buff = new char[64]; StringBuilder x = new StringBuilder(); int numRead = 0; while ((numRead = reader.read(buff)) >= 0) { x.append(new String(buff, 0, numRead)); } Log.d("TAGGG",x.toString()); String result = x.toString(); JSONObject resultObject = new JSONObject(result); JSONArray weatherArray = resultObject.getJSONArray("weather"); JSONObject description = weatherArray.getJSONObject(0); String weatherDescription = description.getString("description"); Log.d("Testtttt", weatherDescription); JSONObject main = resultObject.getJSONObject("main"); String strtempMin = main.getString("temp_min"); String strtempMax = main.getString("temp_max"); String strDisplayTempMin = String.valueOf(Float.parseFloat(strtempMin) - 273.15); String strDisplayTempMax = String.valueOf(Float.parseFloat(strtempMax) - 273.15); String strTemp = main.getString("temp"); String strDisplayMainTemp = String.valueOf(Float.parseFloat(strTemp) - 273.15); Log.d("min temp: ", strDisplayTempMin); // time at which alarm will be scheduled here alarm is scheduled at 1 day from current time, // we fetch the current time in milliseconds and added 1 day time // i.e. 24*60*60*1000= 86,400,000 milliseconds in a day //Long time = new GregorianCalendar().getTimeInMillis()+24*60*60*1000; //long time = SystemClock.elapsedRealtime() + 10000; intentAlarm = new Intent(WeatherService.this, NotificationInformation.class); intentAlarm.putExtra(NotificationInformation.NOTIFICATION_ID, 1); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT); intentAlarm.putExtra(NotificationInformation.NOTIFICATION, getNotification(weatherDescription,strDisplayMainTemp, strDisplayTempMin, strDisplayTempMax, pendingIntent)); // create the object AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); //set the alarm for particular time //alarmManager.set(AlarmManager.RTC_WAKEUP, time, PendingIntent.getBroadcast(this,0, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT)); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 17); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 1000 * 60 * 2, PendingIntent.getBroadcast(this,0, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT)); intentAlarmStorageData = new Intent(WeatherService.this, StorageDataBroadCastReceive.class); bundleAlarmStorageData = new Bundle(); bundleAlarmStorageData.putString("minTemp", strDisplayTempMin); bundleAlarmStorageData.putString("maxTemp", strDisplayTempMax); bundleAlarmStorageData.putString("mainTemp", strDisplayMainTemp); bundleAlarmStorageData.putString("descriptionTemp", weatherDescription); AlarmManager alarmManagerStorageData = (AlarmManager) getSystemService(Context.ALARM_SERVICE); intentAlarmStorageData.putExtras(bundleAlarmStorageData); PendingIntent pendingIntentStorageData = PendingIntent.getBroadcast(this, 8, intentAlarmStorageData, PendingIntent.FLAG_UPDATE_CURRENT); alarmManagerStorageData.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 1000 * 60 * 2, pendingIntentStorageData); //Toast.makeText(this, "Alarm Scheduled for Tommrrow", Toast.LENGTH_LONG).show(); //storage Data in SQLite //insertDataToSQLite(strDisplayTempMin, strDisplayTempMax, strDisplayMainTemp, weatherDescription); } catch (MalformedURLException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { System.out.println(e.toString()); } } private Notification getNotification(String tempDescription, String tempMain, String tempMin, String tempMax, PendingIntent pIntent ) { // Using RemoteViews to bind custom layouts into Notification RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.customnotification); NotificationCompat.Builder builder = new NotificationCompat.Builder(this) // Set Icon .setSmallIcon(R.drawable.sunny) // Set Ticker Message .setTicker(tempDescription + " in Ha Noi, Viet Nam") // Dismiss Notification .setAutoCancel(true) // Set PendingIntent into Notification .setContentIntent(pIntent) // Set RemoteViews into Notification .setContent(remoteViews); // Locate and set the Image into customnotificationtext.xml ImageViews remoteViews.setImageViewResource(R.id.imgTemp, R.drawable.sunny); // Locate and set the Text into customnotificationtext.xml TextViews remoteViews.setTextViewText(R.id.tvDescriptionTemp, tempDescription); remoteViews.setTextViewText(R.id.tvMinTemp, "Min: " + tempMin.substring(0, 5) + " " + (char) 0x00B0 + "C"); remoteViews.setTextViewText(R.id.tvMaxTemp, "Max: " + tempMax.substring(0, 5) + " " + (char) 0x00B0 + "C"); remoteViews.setTextViewText(R.id.tvMainTemp, tempMain.substring(0, 5) + (char) 0x00B0 + "C"); return builder.build(); } }
[ "nguyentrantrung1986@gmail.com" ]
nguyentrantrung1986@gmail.com
e475f1643a5d14dd09f1497ccac93aefd1fdfa06
70039b26a51aa582f2c32a48a3feea74cb0c45f9
/src/main/java/pl/harpi/logplus/TreeNodeRoot.java
557c598e29da6abdbcc4e98ba94a334aa3328006
[]
no_license
harpipl/logplus
0350e18aad1534158b892931c5a6acba0995e3c8
3398da8d92bba4936cbe862347eeb59d809ad177
refs/heads/master
2022-11-10T07:10:04.923141
2022-11-04T21:19:25
2022-11-04T21:19:25
217,884,922
1
1
null
2022-11-04T21:19:26
2019-10-27T16:40:29
Java
UTF-8
Java
false
false
386
java
package pl.harpi.logplus; import pl.harpi.logplus.services.LogItem; import java.util.ArrayList; import java.util.List; public class TreeNodeRoot extends TreeNode { @Override public String toString() { return "Files"; } @Override public List<LogItem> getItems() { return new ArrayList<>(); } @Override public void reload() { } }
[ "arkadiusz.adamczak@gmail.com" ]
arkadiusz.adamczak@gmail.com