blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
a46e1b58a222c7f35cea57c7e39c09ada53bc293
fb8e68ae162b11134bbc5fafafb2c9da1d9523eb
/Coletor/src/br/com/coletaTech/JPassWordFieldHint.java
13157b09ab83bded1189639ea5322b621805637a
[]
no_license
faiscask8/Raspberry_ColetaTech
6f3d8dedbcdd0d57735954d60073aa6f3a48f77c
1c574b9ef1e27c9aecd8a1ed708937b1b89b57ae
refs/heads/main
2023-03-30T15:51:56.649406
2021-03-27T18:44:51
2021-03-27T18:44:51
352,150,995
0
0
null
null
null
null
UTF-8
Java
false
false
3,373
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 br.com.coletaTech; /** * * @author wesley */ import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.Border; /** * * @author otavi */ public class JPassWordFieldHint extends JPasswordField implements FocusListener { private JTextField jtf; private Icon icon; private String hint; private Insets dummyInsets; public JPassWordFieldHint(JTextField jtf, String icon, String hint) { this.jtf = jtf; ImageIcon img1 = new ImageIcon("icons/" + icon + ".png"); setIcon(img1); this.hint = hint; Border border = UIManager.getBorder("TextField.border"); JTextField dummy = new JTextField(); this.dummyInsets = border.getBorderInsets(dummy); addFocusListener(this); } public void setIcon(ImageIcon imageIcon) { this.icon = imageIcon; } public void setIcon(Icon newIcon) { this.icon = newIcon; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int textX = 2; if (this.icon != null) { int iconWidth = icon.getIconWidth(); int iconHeight = icon.getIconHeight(); int x = dummyInsets.left + 5; textX = x + iconWidth + 2; int y = (this.getHeight() - iconHeight) / 2; icon.paintIcon(this, g, x, y); } setMargin(new Insets(2, textX, 2, 2)); if (this.getText().equals("")) { int width = this.getWidth(); int height = this.getHeight(); Font prev = g.getFont(); Font italic = prev.deriveFont(Font.ITALIC); Color prevColor = g.getColor(); g.setFont(italic); g.setColor(UIManager.getColor("textInactiveText")); int h = g.getFontMetrics().getHeight(); int textBottom = (height - h) / 2 + h - 4; int x = this.getInsets().left; Graphics2D g2d = (Graphics2D) g; RenderingHints hints = g2d.getRenderingHints(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.drawString(hint, x, textBottom); g2d.setRenderingHints(hints); g.setFont(prev); g.setColor(prevColor); } } protected ImageIcon createImageIcon(String path, String description) { java.net.URL imgURL = getClass().getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); } else { System.err.println("Couldn't find file: " + path); return null; } } @Override public void focusGained(FocusEvent arg0) { this.repaint(); } @Override public void focusLost(FocusEvent arg0) { this.repaint(); } }
[ "faiscask8@msn.com" ]
faiscask8@msn.com
1c6747389c7d435a0fd28e8d2d4e5ead6854073b
2a685c896f470d527b18bceee3415ec74f0a0a0c
/easy-annotation/src/main/java/com/chaoliu/easy/demo/TestSingleton.java
430b9ebd5a615cc844b5f77e37ec51c1a2e9885a
[]
no_license
yinlingchaoliu/DraggerDemo
8ee4f339118c4102327ff7bb5e80f7a5887769e8
428a5a40ba64fac89b2ebd800b4bbbd10a41e4e1
refs/heads/master
2020-04-29T02:36:06.031558
2019-03-18T09:56:29
2019-03-18T09:56:29
175,775,765
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.chaoliu.easy.demo; import com.chaoliu.easy.annotation.EasyProvides; class TestSingleton { private static final TestSingleton ourInstance = new TestSingleton(); private TestSingleton() { } @EasyProvides public static TestSingleton getInstance() { return ourInstance; } public void cutYourself(){ System.out.println("超级自宫大法"); } }
[ "chentong01@hexindai.com" ]
chentong01@hexindai.com
3b0525afd2db92b1d0079fa4eb100e205c27d918
6b91d07e708c1ebaf107b21c58fec29b90d97280
/interfaces/src/interfaces/MySqlCustomerDal.java
194e998b47419a8667c660a6b4bb4e4668cad54e
[]
no_license
uggurr/BtkJavaGiris
5b851eb2ee74053a6e00856cf4f2efd20375e4c4
d49ba08d77cf98ec334c54493530217f2d38abe1
refs/heads/master
2023-05-31T12:34:14.075186
2021-06-17T12:29:50
2021-06-17T12:29:50
375,347,971
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package interfaces; public class MySqlCustomerDal implements ICustomerDal { @Override public void add() { System.out.println("Mysql eklendi"); } }
[ "uggurryildiz@gmail.com" ]
uggurryildiz@gmail.com
4bec171bbdf936fddbb8037067f8004ef8589e60
180eb8fd5f3c2c8b8720da63cf2dfa297ad12997
/app/src/main/java/com/cofrem/transacciones/models/modelsWS/ApiWS.java
4987d0947db04798bc138bb06e8e48b5a9bf8ce0
[]
no_license
Ceindetec/ProyectoCofrem_Vilane
d25236baa5a3ce24e4fd5d0a3da5e71ca1fad971
3ede67a16f81e57aca18f2c45e460ee2c5bb6dc7
refs/heads/master
2021-09-17T21:53:01.854751
2018-07-05T17:18:57
2018-07-05T17:18:57
105,021,775
0
2
null
2017-10-24T22:09:52
2017-09-27T13:29:33
Java
UTF-8
Java
false
false
709
java
package com.cofrem.transacciones.models.modelsWS; /** * Created by luisp on 13/10/2017. */ public class ApiWS { public final static int CODIGO_CAMBIO_CLAVE = 0; public final static int CODIGO_TARJETA_INACTIVA = 1; public final static int CODIGO_TARJETA_NO_VALIDA = 2; public final static int CODIGO_TERMINAL_NO_EXISTE = 3; public final static int CODIGO_PASSWORD_INCORECTO = 4; public final static int CODIGO_DOCUMENTIO_INCORRECTO = 5; public final static int CODIGO_PASSWORD_DEBE_SER_NUM = 6; public final static int CODIGO_ERROR_EJECUCION = 7; public final static int CODIGO_TERMINAL_INACTIVA = 8; public final static int CODIGO_TRANSACCION_INSUFICIENTE = 9; }
[ "luis.pineda@ceindetec.org.co" ]
luis.pineda@ceindetec.org.co
5938495b1b571afedf8266726a76a6c3d01331dd
d0f84cc3769fa7713b4bd62fd9a80296ba847875
/app/src/main/java/com/yudahendriawan/ProjectTugasAkhir/MainActivity.java
3857d9925af8619ae487a27d6591de0a7b33b770
[]
no_license
yudahendriawan/DirectionMapBox
19041173899d6e5ae394c5265a8d311e752ba413
b030cc593b7472d36fa5af1932914a7fac361f8a
refs/heads/master
2023-01-22T23:33:13.330498
2020-11-19T09:21:27
2020-11-19T09:21:27
257,605,363
0
0
null
null
null
null
UTF-8
Java
false
false
47,285
java
package com.yudahendriawan.ProjectTugasAkhir; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.Toolbar; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.mapbox.android.core.permissions.PermissionsListener; import com.mapbox.android.core.permissions.PermissionsManager; import com.mapbox.api.directions.v5.DirectionsCriteria; import com.mapbox.api.directions.v5.MapboxDirections; import com.mapbox.api.directions.v5.models.DirectionsResponse; import com.mapbox.api.directions.v5.models.DirectionsRoute; import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; import com.mapbox.geojson.LineString; import com.mapbox.geojson.Point; //import com.mapbox.mapboxandroiddemo.R; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.location.LocationComponent; import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions; import com.mapbox.mapboxsdk.location.modes.CameraMode; import com.mapbox.mapboxsdk.location.modes.RenderMode; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.layers.LineLayer; import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.style.sources.Source; import com.yudahendriawan.ProjectTugasAkhir.model.Criteria; import com.yudahendriawan.ProjectTugasAkhir.model.Places; import com.yudahendriawan.ProjectTugasAkhir.resultmap.ResultMapActivity; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import timber.log.Timber; import static com.mapbox.core.constants.Constants.PRECISION_6; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOffset; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineCap; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineColor; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineJoin; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineWidth; /** * Use Mapbox Java Services to request directions from the Mapbox Directions API and setPriority the * route with a LineLayer. */ public class MainActivity extends AppCompatActivity implements /*OnMapReadyCallback,*/ PermissionsListener { private static final String ROUTE_LAYER_ID = "route-layer-id"; private static final String ROUTE_SOURCE_ID = "route-source-id"; private static final String ICON_LAYER_ID = "icon-layer-id"; private static final String ICON_SOURCE_ID = "icon-source-id"; private static final String RED_PIN_ICON_ID = "red-pin-icon-id"; private MapView mapView; private MapboxMap mapboxMap; private DirectionsRoute currentRoute; private MapboxDirections client; private Point origin; private Point destination; private PermissionsManager permissionsManager; //ProgressDialog progressDialog; Spinner spinner1, spinner2, spinner3; Spinner spinnerTime; private List<Point> pointList; //private List<Node> nodes = new ArrayList(); private String routeURL; String routePointList = ""; String origin_ = ""; String destination_ = ""; //public static Button getDataFromDB; public static Button setPriority; EditText inputSource, inputDest; public static FloatingActionButton getRoutes; FloatingActionButton switchBtn; FloatingActionButton getCurrentLocation; FloatingActionButton getListWisata; Button clearBtn; Button timeBtn; int vertices = 31; int getSource = 1000; int getDest = 1000; ProgressBar progressBar; Graph graph; Graph g = new Graph(); DepthFirstSearch dfs; /*= new DepthFirstSearch();*/ boolean repeat = false; Toolbar toolbar; AlertDialog.Builder dialog; LayoutInflater inflater; EditText inputBobotJarak, inputBobotWisata, inputBobotKepadatan; int spinnerSelected1 = 0; int spinnerSelected2 = 0; int spinnerSelected3 = 0; int spinnerTimeSelected = 0; int time_choosen = 0; int bobotJarak; int bobotWisata; int bobotKepadatan; AutoCompleteTextView acSource; AutoCompleteTextView acDest; public static ProgressBar cobaProgressBar; TextView randomPrior; double changeRoadDensity = 0; int[] pathResultFixInt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Mapbox access token is configured here. This needs to be called either in your application // object or in the same activity which contains the mapview. Mapbox.getInstance(this, getString(R.string.access_token)); // This contains the MapView in XML and needs to be called after the access token is configured. setContentView(R.layout.activity_main); getSupportActionBar().hide(); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //binding // getDataFromDB = findViewById(R.id.proses); setPriority = findViewById(R.id.show); getRoutes = findViewById(R.id.show_arrow); clearBtn = findViewById(R.id.clearBtn); switchBtn = findViewById(R.id.switchSourceDest); getCurrentLocation = findViewById(R.id.current_location); mapView = findViewById(R.id.mapView); progressBar = findViewById(R.id.progress_loader); //getListWisata = findViewById(R.id); getListWisata = findViewById(R.id.fab_listwisata); timeBtn = findViewById(R.id.btn_time); getRoutes.setVisibility(View.INVISIBLE); setPriority.setVisibility(View.INVISIBLE); acSource = findViewById(R.id.autocomplete_source); acDest = findViewById(R.id.autocomplete_dest); String[] acWisata = getResources().getStringArray(R.array.places_array); ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, acWisata); acSource.setAdapter(adapter); acDest.setAdapter(adapter); graph = new Graph(vertices, this); dfs = new DepthFirstSearch(); showMapStandard(); setPriority.setOnClickListener(v -> dialogForm()); getListWisata.setVisibility(View.GONE); graph.addEdgeDB(changeRoadDensity); Toast.makeText(this, "Get Data from DB", Toast.LENGTH_SHORT).show(); getRoutes.setOnClickListener(v -> { if (graph.adjacencyList != null && bobotJarak != 0 && bobotWisata != 0 && bobotKepadatan != 0 && !acSource.getText().toString().isEmpty() && !acDest.getText().toString().isEmpty()) { //untuk mengecek apakah lokasi yang diinput ada dalam database boolean sourceExist = false; boolean destExist = false; int ketemuSource = 0; int ketemuDest = 0; for (int k = 0; k < acWisata.length; k++) { if (acSource.getText().toString().equals(acWisata[k])) { sourceExist = true; } if (acDest.getText().toString().equals(acWisata[k])) { destExist = true; } } //mengambil source and destination dari inputan if (destExist && sourceExist) { for (int i = 0; i < graph.getWisataSourceDest().length; i++) { if (acSource.getText().toString().equals(graph.getWisataSourceDest()[i])) { getSource = Integer.parseInt(graph.getWisataSourceDest()[i - 1]); Log.d("getSource", String.valueOf(getSource)); } if (acDest.getText().toString().equals(graph.getWisataSourceDest()[i])) { getDest = Integer.parseInt((graph.getWisataSourceDest()[i - 1])); Log.d("getDest", String.valueOf(getDest)); } } sourceExist = false; destExist = false; } else { Toast.makeText(MainActivity.this, "Lokasi tidak terdata", Toast.LENGTH_SHORT).show(); } //untuk proses kedua if (getSource != 1000 && getDest != 1000) { getRoutes.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); dfs.getTemp().clear(); dfs.printAllPaths(graph, getSource, getDest); weightedProduct(); showMap(savedInstanceState); } else { Toast.makeText(MainActivity.this, "Priorities haven't been set", Toast.LENGTH_SHORT); } ketemuDest = 0; ketemuSource = 0; } else { if (bobotJarak == 0 || bobotWisata == 0 || bobotKepadatan == 0) { Toast.makeText(MainActivity.this, "Priorities haven't been set", Toast.LENGTH_LONG).show(); } if (acSource.getText().toString().isEmpty() || acDest.getText().toString().isEmpty()) { Toast.makeText(MainActivity.this, "Fill Source & Destination", Toast.LENGTH_LONG).show(); } } }); switchBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!acSource.getText().toString().isEmpty() && !acDest.getText().toString().isEmpty()) { String source = acSource.getText().toString(); String destination = acDest.getText().toString(); acDest.setText(source); acSource.setText(destination); } else { Toast.makeText(v.getContext(), "Fill Source & Destination", Toast.LENGTH_SHORT).show(); } } }); clearBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { acDest.setText(null); acSource.setText(null); Toast.makeText(v.getContext(), "Clear success", Toast.LENGTH_SHORT).show(); acSource.setFocusable(true); showMapStandard(); getListWisata.setVisibility(View.GONE); } }); getListWisata.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(v.getContext(), ResultMapActivity.class); intent.putExtra("pathResultFix", pathResultFixInt); startActivity(intent); } }); timeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogFormTime(); } }); } /** * Add the route and marker sources to the map */ private void initSource(@NonNull Style loadedMapStyle) { loadedMapStyle.addSource(new GeoJsonSource(ROUTE_SOURCE_ID)); GeoJsonSource iconGeoJsonSource = new GeoJsonSource(ICON_SOURCE_ID, FeatureCollection.fromFeatures(new Feature[]{ Feature.fromGeometry(Point.fromLngLat(origin.longitude(), origin.latitude())), Feature.fromGeometry(Point.fromLngLat(destination.longitude(), destination.latitude()))})); loadedMapStyle.addSource(iconGeoJsonSource); } /** * Add the route and marker icon layers to the map */ private void initLayers(@NonNull Style loadedMapStyle) { LineLayer routeLayer = new LineLayer(ROUTE_LAYER_ID, ROUTE_SOURCE_ID); // Add the LineLayer to the map. This layer will display the directions route. routeLayer.setProperties( lineCap(Property.LINE_CAP_ROUND), lineJoin(Property.LINE_JOIN_ROUND), lineWidth(5f), lineColor(Color.parseColor("#009688")) ); loadedMapStyle.addLayer(routeLayer); // Add the red marker icon image to the map // loadedMapStyle.addImage(RED_PIN_ICON_ID, BitmapUtils.getBitmapFromDrawable( // getResources().getDrawable(R.drawable.red_marker1))); // Add the red marker icon SymbolLayer to the map loadedMapStyle.addLayer(new SymbolLayer(ICON_LAYER_ID, ICON_SOURCE_ID).withProperties( iconImage(RED_PIN_ICON_ID), iconIgnorePlacement(true), iconAllowOverlap(true), iconOffset(new Float[]{0f, -9f}))); } /** * Make a request to the Mapbox Directions API. Once successful, pass the route to the * route layer. * * @param mapboxMap the Mapbox map object that the route will be drawn on * @param origin the starting point of the route * @param destination the desired finish point of the route */ private void getRoute(final MapboxMap mapboxMap, Point origin, List<Point> wayPoints, Point destination) { client = MapboxDirections.builder() .origin(origin) .waypoints(wayPoints) //to add point between origin and destination .destination(destination) .overview(DirectionsCriteria.OVERVIEW_FULL) .profile(DirectionsCriteria.PROFILE_DRIVING) .accessToken(getString(R.string.access_token)) .build(); client.enqueueCall(new Callback<DirectionsResponse>() { @SuppressLint("StringFormatInvalid") @Override public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) { // You can get the generic HTTP info about the response Timber.d("Response code: " + response.code()); if (response.body() == null) { Timber.e("No routes found, make sure you set the right user and access token."); return; } else if (response.body().routes().size() < 1) { Timber.e("No routes found"); return; } // Get the directions route currentRoute = response.body().routes().get(0); // Make a toast which displays the route's distance Toast.makeText(MainActivity.this, String.format( getString(R.string.directions_activity_toast_message), currentRoute.distance()), Toast.LENGTH_SHORT).show(); getRoutes.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); getListWisata.setVisibility(View.VISIBLE); if (mapboxMap != null) { mapboxMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { // Retrieve and update the source designated for showing the directions route GeoJsonSource source = style.getSourceAs(ROUTE_SOURCE_ID); // Create a LineString with the directions route's geometry and // reset the GeoJSON source for the route LineLayer source if (source != null) { source.setGeoJson(LineString.fromPolyline(currentRoute.geometry(), PRECISION_6)); } } }); } } @Override public void onFailure(Call<DirectionsResponse> call, Throwable throwable) { Timber.e("Error: Check internet connection.."); Toast.makeText(MainActivity.this, "Error: " + throwable.getMessage(), Toast.LENGTH_SHORT).show(); getRoutes.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); } }); } @Override public void onResume() { super.onResume(); showMapStandard(); getListWisata.setVisibility(View.GONE); boolean click = true; while (click) { if (bobotJarak != 0) { getRoutes.performClick(); } click = false; } // mapView.onResume(); } @Override protected void onStart() { super.onStart(); showMapStandard(); } @Override protected void onStop() { super.onStop(); mapView.onStop(); } @Override public void onPause() { super.onPause(); mapView.onPause(); } @Override protected void onDestroy() { super.onDestroy(); // Cancel the Directions API request if (client != null) { client.cancelCall(); } mapView.onDestroy(); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } public void weightedProduct() { if (dfs.getTemp().size() != 0) { origin_ = ""; destination_ = ""; routePointList = ""; //akan digunakan utk menampung criteria Double[][] data = new Double[dfs.getTemp().size()][3]; Log.d("tempSize", String.valueOf(dfs.getTemp().size())); // for(int i = 0 ; i <data.length; i ++){ // // } // if(dfs.getTemp().size() != 0) { // System.out.println("\n{Jarak, Jumlah Wisata, Kepadatan}"); for (int i = 0; i < dfs.getTemp().size(); i++) { // System.out.print("[C" + (i + 1) + "] {"); for (int j = 0; j < 3; j++) { data[i][j] = dfs.getTemp().get(i).get(j); } } //menyimpan data dalam bentuk arrayList ArrayList<Criteria> listCriteria = new ArrayList<>(); for (Double[] dataKu : data) { Criteria criteria = new Criteria(); criteria.setJarak(dataKu[0]); criteria.setWisata(dataKu[1]); criteria.setKepadatan(dataKu[2]); listCriteria.add(criteria); } //inisisasi bobot pada setiap kriteria double totalBobot = bobotJarak + bobotKepadatan + bobotWisata; //Penormalan Bobot double bobotNormalJarak = bobotJarak / totalBobot; double bobotNormalWisata = bobotWisata / totalBobot; double bobotNormalKepadatan = bobotKepadatan / totalBobot; //inisiasi array utk menyimpan vektor S //memangkatkan setiap kriteria dengan bobot //dengan pangkat bobot + utk kriteria benefit (wisata) dan - utk kriteria cost(kepadatan,jarak). double[] vektorS = new double[listCriteria.size()]; for (int i = 0; i < listCriteria.size(); i++) { vektorS[i] = Math.pow(listCriteria.get(i).getJarak(), -bobotNormalJarak) * Math.pow(listCriteria.get(i).getWisata(), bobotNormalWisata) * Math.pow(listCriteria.get(i).getKepadatan(), -bobotNormalKepadatan); } //menjumlahkan vektor S dan print vektor S double sigmaVektorS = 0; for (int k = 0; k < vektorS.length; k++) { sigmaVektorS = sigmaVektorS + vektorS[k]; } //hitung vektor V pada setiap alternatif Double[] vektorV = new Double[listCriteria.size()]; for (int i = 0; i < listCriteria.size(); i++) { vektorV[i] = vektorS[i] / sigmaVektorS; } //mengcopy vektor V utk membandingkan Double[] vektorVSortDesc = Arrays.copyOf(vektorV, vektorV.length); System.out.println("\nSorting Vektor V by Descending Sort"); Arrays.sort(vektorVSortDesc, Collections.reverseOrder()); //mencari peringkat pertama int rank1 = 0; // int rank2 = 0; // int rank3 = 0; for (int i = 0; i < vektorVSortDesc.length; i++) { if (vektorVSortDesc[0].equals(vektorV[i])) rank1 = i; } Double[] pathResult = new Double[dfs.getTemp().get(rank1).size()]; //copy element of arraylist in index rank1 to array 1 dim. for (int i = 0; i < pathResult.length; i++) { pathResult[i] = dfs.getTemp().get(rank1).get(i); } //to get just path, not include criteria Double[] pathResultFix = Arrays.copyOfRange(pathResult, 3, pathResult.length); //change double to int pathResultFixInt = new int[pathResultFix.length]; for (int i = 0; i < pathResultFixInt.length; i++) { pathResultFixInt[i] = pathResultFix[i].intValue(); } //log cat in debug list point String storePointList = "["; for (int i = 0; i < pathResultFixInt.length; i++) { storePointList = storePointList + pathResultFixInt[i]; if (i != pathResultFixInt.length - 1) { storePointList = storePointList + ","; } else { storePointList = storePointList + "]"; } } Log.d("PointList", storePointList); for (int i = 0; i < pathResultFixInt.length; i++) { for (int j = 0; j < graph.getLatLong().length; j++) { if (i > 0 && i < pathResultFixInt.length - 1) { if (String.valueOf(pathResultFixInt[i]).equals(graph.getLatLong()[j])) { routePointList = routePointList + graph.getLatLong()[j + 1]; if (i != pathResultFixInt.length - 2) { routePointList = routePointList + "/"; } } } if (i == 0) { if (String.valueOf(pathResultFixInt[i]).equals(graph.getLatLong()[j])) origin_ = origin_ + graph.getLatLong()[j + 1]; } if (i == pathResultFixInt.length - 1) { if (String.valueOf(pathResultFixInt[i]).equals(graph.getLatLong()[j])) destination_ = destination_ + graph.getLatLong()[j + 1]; } } } Double latitudeOrigin; Double longitudeOrigin; // for(String s : Arrays.asList(origin_.split(","))){ latitudeOrigin = Double.valueOf(origin_.split(",")[0]); longitudeOrigin = Double.valueOf(origin_.split(",")[1]); origin = Point.fromLngLat(longitudeOrigin, latitudeOrigin); // } Double latitudeDest; Double longitudeDest; // for(String s : Arrays.asList(destination_.split(","))){ latitudeDest = Double.valueOf(destination_.split(",")[0]); longitudeDest = Double.valueOf(destination_.split(",")[1]); destination = Point.fromLngLat(longitudeDest, latitudeDest); // } //klennteng sangar agung, pantai ria kenjeran routeURL = "-7.247226, 112.802257/-7.249400, 112.800501"; pointList = new ArrayList<>(); Double latitude; Double longitude; for (String s : Arrays.asList(routePointList.split("/"))) { latitude = Double.valueOf(s.split(",")[0]); longitude = Double.valueOf(s.split(",")[1]); pointList.add(Point.fromLngLat(longitude, latitude)); } } else { // Toast.makeText(MainActivity.this, "Check Internet Conn..", Toast.LENGTH_SHORT).setPriority(); } } public void showMap(Bundle savedInstanceState) { mapView.onCreate(savedInstanceState); mapView.onStart(); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { if (dfs.getTemp().size() != 0) { initSource(style); initLayers(style); // Get the directions route from the Mapbox Directions API getRoute(mapboxMap, origin, pointList, destination); } pointList.clear(); Log.d("pointList clear", pointList.toString()); //to hide compass getCurrentLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // enableLocationComponent(style); } }); mapboxMap.getUiSettings().setCompassEnabled(false); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.295, 112.802)) .title("Taman Harmoni")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.290, 112.796)) .title("Sakinah Supermarket")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.272280, 112.759526)) .title("Museum dan Pusat Kajian Etnografi UNAIR")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.250636, 112.753804)) .title("Museum WR. Soeptratman")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.311799, 112.782312)) .title("Museum Teknoform Undika")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.265257, 112.758042)) .title("Museum Pendidikan Kedokteran UNAIR Sby")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.247226, 112.802257)) .title("Klenteng Sanggar Agung")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.254267, 112.801853)) .title("Atlantis Land")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.249400, 112.800501)) .title("Pantai Ria Kenjeran")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.294329, 112.761751)) .title("Taman Flora")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.297431, 112.760045)) .title("Pasar Bunga Bratang")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.312360, 112.788902)) .title("Kebun Bibit Wonorejo")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.251590, 112.754599)) .title("Taman Mundu")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.318214, 112.784242)) .title("Taman Kunang-kunang")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.275934, 112.802721)) .title("Food Festival Pakuwon City")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.276591, 112.805451)) .title("East Cost Surabaya")); } }); } }); } public void kosong() { inputBobotKepadatan.setText(""); inputBobotWisata.setText(""); inputBobotJarak.setText(""); } public void dialogFormTime() { dialog = new AlertDialog.Builder(MainActivity.this); inflater = getLayoutInflater(); View dialogView = inflater.inflate(R.layout.form_time, null); dialog.setView(dialogView); dialog.setCancelable(true); spinnerTime = dialogView.findViewById(R.id.spinnerTime); ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(dialogView.getContext(), R.array.time, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerTime.setAdapter(adapter1); spinnerTime.setSelection(spinnerTimeSelected); graph = new Graph(vertices, this); dfs = new DepthFirstSearch(); dialog.setPositiveButton("OK", (dialog, which) -> { if (spinnerTime.getSelectedItemPosition() == 0) { Toast.makeText(dialogView.getContext(), "Time hasn't been set", Toast.LENGTH_SHORT).show(); dialogFormTime(); } else { if (spinnerTime.getSelectedItemPosition() == 0) { spinnerTimeSelected = 0; } else if (spinnerTime.getSelectedItemPosition() == 1) { changeRoadDensity = 1; spinnerTimeSelected = 1; } else if (spinnerTime.getSelectedItemPosition() == 2) { changeRoadDensity = -1; spinnerTimeSelected = 2; } else if (spinnerTime.getSelectedItemPosition() == 3) { changeRoadDensity = 0; spinnerTimeSelected = 3; } else if (spinnerTime.getSelectedItemPosition() == 4) { changeRoadDensity = 1; spinnerTimeSelected = 4; } graph.addEdgeDB(changeRoadDensity); } dialog.dismiss(); }); dialog.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss()); dialog.show(); } public void dialogForm() { dialog = new AlertDialog.Builder(MainActivity.this); inflater = getLayoutInflater(); View dialogView = inflater.inflate(R.layout.form_bobot, null); dialog.setView(dialogView); dialog.setCancelable(true); spinner1 = dialogView.findViewById(R.id.spinnerPriority1); spinner2 = dialogView.findViewById(R.id.spinnerPriority2); spinner3 = dialogView.findViewById(R.id.spinnerPriority3); randomPrior = dialogView.findViewById(R.id.randomPriority); ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(dialogView.getContext(), R.array.bobot1, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(adapter1); ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(dialogView.getContext(), R.array.bobot2, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner2.setAdapter(adapter2); ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(dialogView.getContext(), R.array.bobot3, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner3.setAdapter(adapter3); spinner1.setSelection(spinnerSelected1); spinner2.setSelection(spinnerSelected2); spinner3.setSelection(spinnerSelected3); randomPrior.setOnClickListener(v -> { boolean check = true; while (check) { int randomSpinner1 = (int) (Math.random() * 3 + 1); int randomSpinner2 = (int) (Math.random() * 3 + 1); int randomSpinnner3 = (int) (Math.random() * 3 + 1); Log.d("1-2-3 = ", randomSpinner1 + "," + randomSpinner2 + ", " + randomSpinnner3); if (randomSpinner1 != randomSpinner2 && randomSpinner1 != randomSpinnner3 && randomSpinner2 != randomSpinnner3) { spinner1.setSelection(randomSpinner1); spinner2.setSelection(randomSpinner2); spinner3.setSelection(randomSpinnner3); check = false; } } }); spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { //String text = parent.getItemAtPosition(position).toString(); int item = parent.getSelectedItemPosition(); if (item == 1) { bobotJarak = 36; spinnerSelected1 = 1; } else if (item == 2) { bobotWisata = 36; spinnerSelected1 = 2; } else if (item == 3) { bobotKepadatan = 36; spinnerSelected1 = 3; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int item = parent.getSelectedItemPosition(); if (item == 1) { bobotJarak = 6; spinnerSelected2 = 1; } else if (item == 2) { bobotWisata = 6; spinnerSelected2 = 2; } else if (item == 3) { bobotKepadatan = 6; spinnerSelected2 = 3; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); spinner3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int item = parent.getSelectedItemPosition(); if (item == 1) { bobotJarak = 1; spinnerSelected3 = 1; } else if (item == 2) { bobotWisata = 1; spinnerSelected3 = 2; } else if (item == 3) { bobotKepadatan = 1; spinnerSelected3 = 3; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); dialog.setPositiveButton("OK", (dialog, which) -> { if (spinner1.getSelectedItem().toString().equals(spinner2.getSelectedItem().toString())) { Toast.makeText(dialogView.getContext(), "Priorities must be different", Toast.LENGTH_SHORT).show(); dialogForm(); } else if (spinner2.getSelectedItem().toString().equals(spinner3.getSelectedItem().toString())) { Toast.makeText(dialogView.getContext(), "Priorities must be different", Toast.LENGTH_SHORT).show(); dialogForm(); } else if (spinner1.getSelectedItem().toString().equals(spinner3.getSelectedItem().toString())) { Toast.makeText(dialogView.getContext(), "Priorities must be different", Toast.LENGTH_SHORT).show(); dialogForm(); } else if (spinner1.getSelectedItem().equals("Choose Priority-1") || spinner2.getSelectedItem().equals("Choose Priority-2") || spinner3.getSelectedItem().equals("Choose Priority-3")) { Toast.makeText(dialogView.getContext(), "Priorities haven't been set", Toast.LENGTH_SHORT).show(); dialogForm(); } else { String bobot = "Jarak : " + bobotJarak + ", Wisata : " + bobotWisata + ", Kepadatan : " + bobotKepadatan; getRoutes.setVisibility(View.VISIBLE); Log.d("bobot", bobot); dialog.dismiss(); } }); dialog.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss()); dialog.show(); } void showMapStandard() { //mapView = findViewById(R.id.mapView); mapView.onStart(); mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { getCurrentLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // enableLocationComponent(style); } }); mapboxMap.getUiSettings().setCompassEnabled(false); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.295, 112.802)) .title("Taman Harmoni")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.290, 112.796)) .title("Sakinah Supermarket")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.272280, 112.759526)) .title("Museum dan Pusat Kajian Etnografi UNAIR")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.250636, 112.753804)) .title("Museum WR. Soeptratman")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.311799, 112.782312)) .title("Museum Teknoform Undika")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.265257, 112.758042)) .title("Museum Pendidikan Kedokteran UNAIR Sby")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.247226, 112.802257)) .title("Klenteng Sanggar Agung")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.254267, 112.801853)) .title("Atlantis Land")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.249400, 112.800501)) .title("Pantai Ria Kenjeran")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.294329, 112.761751)) .title("Taman Flora")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.297431, 112.760045)) .title("Pasar Bunga Bratang")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.312360, 112.788902)) .title("Kebun Bibit Wonorejo")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.251590, 112.754599)) .title("Taman Mundu")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.318214, 112.784242)) .title("Taman Kunang-kunang")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.275934, 112.802721)) .title("Food Festival Pakuwon City")); mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(-7.276591, 112.805451)) .title("East Cost Surabaya")); } })); } public void getRoutes() { if (bobotJarak != 0 && bobotWisata != 0 && bobotKepadatan != 0) { //mengambil source and destination dari inputan for (int i = 0; i < graph.getWisataSourceDest().length; i++) { if (acSource.getText().toString().equals(graph.getWisataSourceDest()[i])) { getSource = Integer.parseInt(graph.getWisataSourceDest()[i - 1]); Log.d("getSource", String.valueOf(getSource)); } if (acDest.getText().toString().equals(graph.getWisataSourceDest()[i])) { getDest = Integer.parseInt((graph.getWisataSourceDest()[i - 1])); Log.d("getDest", String.valueOf(getDest)); } } //untuk proses kedua if (getSource != 1000 && getDest != 1000) { dfs.getTemp().clear(); dfs.printAllPaths(graph, getSource, getDest); weightedProduct(); // showMap(savedInstanceState); } else { Toast.makeText(MainActivity.this, "Fill Source & Destination", Toast.LENGTH_SHORT); } } else { Toast.makeText(MainActivity.this, "Input Bobot", Toast.LENGTH_SHORT); Toast.makeText(MainActivity.this, "Input Source n Dest", Toast.LENGTH_LONG).show(); } } @Override public void onExplanationNeeded(List<String> permissionsToExplain) { // Toast.makeText(this, R.string.user_location_permission_explanation, Toast.LENGTH_LONG).show(); } @Override public void onPermissionResult(boolean granted) { if (granted) { mapboxMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { enableLocationComponent(style); } }); } else { // Toast.makeText(this, R.string.user_location_permission_not_granted, Toast.LENGTH_LONG).show(); finish(); } } @SuppressWarnings({"MissingPermission"}) private void enableLocationComponent(@NonNull Style loadedMapStyle) { // Check if permissions are enabled and if not request if (PermissionsManager.areLocationPermissionsGranted(this)) { // Get an instance of the component LocationComponent locationComponent = mapboxMap.getLocationComponent(); // Activate with options locationComponent.activateLocationComponent( LocationComponentActivationOptions.builder(this, loadedMapStyle).build()); // Enable to make component visible locationComponent.setLocationComponentEnabled(true); // Set the component's camera mode locationComponent.setCameraMode(CameraMode.TRACKING); // Set the component's render mode locationComponent.setRenderMode(RenderMode.COMPASS); } else { permissionsManager = new PermissionsManager(this); permissionsManager.requestLocationPermissions(this); } } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); //String myString = savedInstanceState.getString("MyString"); String getSourceSaved = savedInstanceState.getString("source"); String getDestinationSaved = savedInstanceState.getString("destination"); int getBobotJarakSaved = savedInstanceState.getInt("bobotJarak"); int getBobotWisataSaved = savedInstanceState.getInt("bobotWisata"); int getBobotKepadatanSaved = savedInstanceState.getInt("bobotKepadatan"); bobotJarak = getBobotJarakSaved; bobotKepadatan = getBobotKepadatanSaved; bobotWisata = getBobotWisataSaved; } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); String sourceSaved = acSource.getText().toString(); String destinationSaved = acDest.getText().toString(); outState.putString("source", sourceSaved); outState.putString("destination", destinationSaved); outState.putInt("bobotJarak", bobotJarak); outState.putInt("bobotKepadatan", bobotKepadatan); outState.putInt("bobotWisata", bobotWisata); } // @Override // public void onMapReady(@NonNull MapboxMap mapboxMap) { // MainActivity.this.mapboxMap = mapboxMap; // // mapboxMap.setStyle(Style.MAPBOX_STREETS, // new Style.OnStyleLoaded() { // @Override // public void onStyleLoaded(@NonNull Style style) { // enableLocationComponent(style); // } // }); // } }
[ "yudahendriawan007@gmail.com" ]
yudahendriawan007@gmail.com
5d4fd27b20e802c6553808429ed949c44e978309
240573ebbec82da37b3b72307326dbda202c4ed2
/java/com/bos/helper/SingletonInstanceHelper.java
a40558256fc4590a10314a11f16da9f6ecbbf26b
[]
no_license
rstevenson555/pulse
d575799e7037ca9eaac954d43b9ac340c4b308e5
e059e49c461847548ab321adbbda2f3ca3fc4495
refs/heads/master
2022-04-19T13:59:28.493776
2014-05-12T21:46:04
2014-05-12T21:46:04
256,604,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,498
java
package com.bos.helper; import java.util.concurrent.atomic.AtomicBoolean; /** * Created by i0360b6 on 2/19/14. */ abstract public class SingletonInstanceHelper<X> { protected X instance; private AtomicBoolean instanceInitialized = new AtomicBoolean(false); private AtomicBoolean instanceComplete = new AtomicBoolean(false); private Object objectLock = new Object(); private Class createClass = null; /** * constructor the singleton creator * * @param create */ public SingletonInstanceHelper(Class create) { this.createClass = create; } /** * override the createInstance method * * @return */ abstract public Object createInstance(); /** * ensure that only 1 instance gets created. * * @return */ public X getInstance() { if (instanceInitialized.compareAndSet(false, true)) { if (instance == null && !instanceComplete.get()) { instance = (X) createInstance(); instanceComplete.set(true); synchronized (objectLock) { objectLock.notify(); } } } if (!instanceComplete.get()) { synchronized (objectLock) { try { objectLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } return instance; } }
[ "bobstevenson@officemax.com" ]
bobstevenson@officemax.com
495d6da7380cb120a88d5c419d2327f0eb347821
fd002180e5a0d9363ffa6631b06677b2b7594599
/src/main/java/com/ecjtu/entity/Student.java
c6f753f6143557086a0c4151e45ea4a636d68aa1
[]
no_license
SnoopyXX/web
8895c736fedfd71f80c509d6bc31cad78d1d0c3d
ebf8968210d14512477abb45006311d6477ced9f
refs/heads/master
2020-03-21T04:25:12.245920
2018-06-21T02:16:34
2018-06-21T02:16:34
138,107,251
0
0
null
null
null
null
UTF-8
Java
false
false
1,629
java
package com.ecjtu.entity; import java.util.Date; import java.util.List; public class Student { private String id; private String name; private String sex; private Date birtday; private String password; private Clazz clazz; private List<Course> courseList; public List<Course> getCourseList() { return courseList; } public void setCourseList(List<Course> courseList) { this.courseList = courseList; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public Date getBirtday() { return birtday; } public void setBirtday(Date birtday) { this.birtday = birtday; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Clazz getClazz() { return clazz; } public void setClazz(Clazz clazz) { this.clazz = clazz; } @Override public String toString() { return "Student{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", sex='" + sex + '\'' + ", birtday=" + birtday + ", password='" + password + '\'' + ", course=" + courseList + '}'; } }
[ "elfprest@sina.com" ]
elfprest@sina.com
e4b5f97262ff25e8cc4c9e871c70d0b9476c75f0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_b3a495620423c90b037393fafcc09c551db904af/InitRank/2_b3a495620423c90b037393fafcc09c551db904af_InitRank_t.java
0d963fe98aa192229197ed7e07040f314d7fb3ec
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,749
java
package v2; import japa.parser.JavaParser; import japa.parser.ParseException; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.body.TypeDeclaration; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.GenericOptionsParser; import a2.Lookup; public class InitRank extends Configured implements Tool{ public static class Map extends Mapper<Text, Text, Text, CitationAggregator> { Text name = new Text(); CitationAggregator agg = new CitationAggregator(); public static enum MyCounter{ BAD_PARSE, NO_PACKAGE, WILD_CARD_IMPORTS, NO_IMPORTS, USEFUL, TOTAL }; @Override public void map(Text key, Text value, Context context) throws IOException, InterruptedException { CompilationUnit unit =null; ByteArrayInputStream b = null; context.getCounter(MyCounter.TOTAL).increment(1); try { b = new ByteArrayInputStream(value.toString().getBytes("UTF-8")); unit = JavaParser.parse(b); PackageDeclaration dec = unit.getPackage(); List<TypeDeclaration> types = unit.getTypes(); List<ImportDeclaration> imports = unit.getImports(); if(types!=null&&types.size()>0){ name.set(dec.getName().toString()+"."+types.get(0).getName()); if(imports != null){ for(ImportDeclaration declaration: imports){ String decName = declaration.getName().toString(); if(decName.contains("*")){ context.getCounter(MyCounter.WILD_CARD_IMPORTS).increment(1); }else{ agg.setCiter(Integer.parseInt(key.toString())); agg.setOwner(-1); context.write(new Text(decName), agg); } } }else{ context.getCounter(MyCounter.NO_IMPORTS).increment(1); } context.getCounter(MyCounter.USEFUL).increment(1); agg.setCiter(-1); agg.setOwner(Integer.parseInt(key.toString())); context.write(name, agg); }else{ context.getCounter(MyCounter.NO_PACKAGE).increment(1); } } catch (ParseException e) { context.getCounter(MyCounter.BAD_PARSE).increment(1); }catch (NullPointerException e){ context.getCounter(MyCounter.NO_PACKAGE).increment(1); }catch (Error e){ context.getCounter(MyCounter.BAD_PARSE).increment(1); } } @Override public void run (Context context) throws IOException, InterruptedException { setup(context); while (context.nextKeyValue()) { map(context.getCurrentKey(), context.getCurrentValue(), context); } cleanup(context); } } public static class Reduce extends Reducer<Text, CitationAggregator, Text, CitationAggregator> { private HashMap<Integer,Integer> map = Lookup.get(); public void reduce(Text key, Iterable<CitationAggregator> values, Context context) throws IOException, InterruptedException { ArrayList<CitationAggregator> citers = new ArrayList<CitationAggregator>(); int owner = -1; int count = 0; for(CitationAggregator agg: values){ if(agg.getOwner()!=-1 && (owner == -1 || map.get(agg.getOwner())>count)){ owner=agg.getOwner(); count=map.get(owner); } if(agg.getCiter()!=-1){ citers.add(agg); } } for(CitationAggregator agg: citers){ if(agg.getCiter()!=owner){ agg.setOwner(owner); if(agg.getCiter()!=-1) context.write(key,agg); } } CitationAggregator ret = new CitationAggregator(); ret.setCiter(owner); ret.setOwner(-1); context.write(key,ret); } } @Override public int run(String[] args) throws Exception { Job job = new Job(); Configuration conf = job.getConfiguration(); FileSystem fs = FileSystem.get(conf); FileStatus[] jarFiles = fs.listStatus(new Path("/libs")); for (FileStatus status : jarFiles) { Path disqualified = new Path(status.getPath().toUri().getPath()); DistributedCache.addFileToClassPath(disqualified, conf, fs); } job.setOutputKeyClass(Text.class); job.setOutputValueClass(CitationAggregator.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setJarByClass(InitRank.class); job.waitForCompletion(true); return 0; } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); ToolRunner.run(new InitRank(), otherArgs); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
150a3a3cc2dc16da9e7e80ddbd936117d35331b1
391064e1f99ca7976572ddf579861950145f1fd4
/AnimalIterator/Main.java
f7e88ce28dfdc183734a1bf26871412fd94d6e99
[]
no_license
pranavbapat/Freelancing-Projects
c8feeee4ffff3ed3eddfbc862ff2fedae7a7d4b8
8ffa806ee0995d4ec8c541e58e2e135fdb1540c1
refs/heads/master
2021-01-10T04:37:51.508118
2016-02-01T02:07:30
2016-02-01T02:07:30
50,804,615
0
0
null
null
null
null
UTF-8
Java
false
false
2,349
java
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; public class Main { //ArrayList to store array of Animal Objects static ArrayList<Animal> animalArrayList = new ArrayList<Animal>(); //Main method public static void main(String[] args) throws FileNotFoundException { //Method to Read the input text file ReadInputFile(); //Method to print the contents of the output file PrintOutput(); } //Method to Read Input text file public static void ReadInputFile() throws FileNotFoundException { //BufferedReader is used to read text files as input BufferedReader inputReader; //Name of the input file that we are reading String fileName = "inputFile.txt"; try { inputReader = new BufferedReader(new FileReader(fileName)); //myLine will contain one entire line of the input text file String myLine = inputReader.readLine(); //Looping through the entire input file until no new line is encountered while(myLine != null) { //String array to store each individual word //Split method splits the entire line seperated by a space " " String[] data = myLine.split(" "); //Adding a new Animal Object to the arrayList animalArrayList.add(new Animal(data[0],data[1],data[2],data[3])); //Reading the next line of the input file myLine = inputReader.readLine(); } } catch (IOException e) { e.printStackTrace(); } } //Method to print the output or the contents of the ArrayList animalArrayList public static void PrintOutput() { System.out.println("Name\tClass\t\tWeight\tHeight"); //Creating an object of Iterator to iterate through the ArrayList animalArrayList Iterator myIterator = animalArrayList.iterator(); //The iterator will loop through the entire ArrayList until there are no elements in the list while(myIterator.hasNext()) { //Iterator.next() returns an object //Type casting the object to Animal class Animal tempAnimal = (Animal)myIterator.next(); //Displaying the output using getter method System.out.println(tempAnimal.getAnimalName() + "\t" + tempAnimal.getAnimalClass() + "\t" + tempAnimal.getAnimalWeight() + "\t" + tempAnimal.getAnimalHeight()); } } }
[ "pranavrbapat@gmail.com" ]
pranavrbapat@gmail.com
c89eb7bff00f9726b04503c6fa921e48a2a3c46d
09a8689816547852cec71944cacbda85c1fc2f11
/file-server-representation-impl/src/main/java/org/cyk/system/file/server/representation/impl/FileRepresentationImpl.java
7bc49434647764b5b67016c828f945ac0acf019c
[]
no_license
devlopper/org.cyk.system.file.server
1f6b6e464f02fa21580c59cc095669684d403a1c
414721e8c08deb121a3ce9aedfb8e9db1ef18d9f
refs/heads/master
2022-02-09T09:28:05.050964
2021-04-11T13:56:44
2021-04-11T13:56:44
180,776,404
0
0
null
2022-01-21T23:49:38
2019-04-11T11:18:51
Java
UTF-8
Java
false
false
4,681
java
package org.cyk.system.file.server.representation.impl; import java.io.Serializable; import java.net.URI; import java.util.List; import javax.enterprise.context.ApplicationScoped; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Response.Status; import org.apache.commons.io.IOUtils; import org.cyk.system.file.server.business.api.FileBusiness; import org.cyk.system.file.server.business.api.FileBytesBusiness; import org.cyk.system.file.server.persistence.api.query.FileQuerier; import org.cyk.system.file.server.persistence.entities.File; import org.cyk.system.file.server.persistence.entities.FileBytes; import org.cyk.system.file.server.representation.api.FileRepresentation; import org.cyk.system.file.server.representation.entities.FileDto; import org.cyk.utility.__kernel__.collection.CollectionHelper; import org.cyk.utility.__kernel__.constant.ConstantString; import org.cyk.utility.__kernel__.file.FileHelper; import org.cyk.utility.__kernel__.number.NumberHelper; import org.cyk.utility.__kernel__.persistence.query.QueryExecutorArguments; import org.cyk.utility.__kernel__.representation.Arguments; import org.cyk.utility.__kernel__.representation.EntityReader; import org.cyk.utility.__kernel__.string.StringHelper; import org.cyk.utility.__kernel__.string.Strings; import org.cyk.utility.number.Intervals; import org.cyk.utility.server.representation.AbstractRepresentationEntityImpl; @ApplicationScoped public class FileRepresentationImpl extends AbstractRepresentationEntityImpl<FileDto> implements FileRepresentation,Serializable { private static final long serialVersionUID = 1L; @Override public Response createFromDirectories(List<String> directories,/*List<String> mimeTypeTypes,List<String> mimeTypeSubTypes,List<String> mimeTypes,*/List<String> extensions ,List<String> sizes,Integer batchSize,Integer count) { Intervals intervals = null; if(CollectionHelper.isNotEmpty(sizes)) { intervals = __inject__(Intervals.class); for(String index : sizes) { String[] extremities = index.split(";"); if(extremities.length == 2) { intervals.add(NumberHelper.getInteger(extremities[0]), NumberHelper.getInteger(extremities[1])); } } } __inject__(FileBusiness.class).createFromDirectories(__inject__(Strings.class).add(directories),null,null,null ,__inject__(Strings.class).add(extensions),intervals,batchSize,count == null || count == 0 ? null : count); return Response.ok("Files has been created from directories").build(); } @Override public Response getManyByGlobalFilter(Boolean isPageable, Long from, Long count, String fields,String globalFilter,Boolean loggableAsInfo) { Arguments arguments = new Arguments().setRepresentationEntityClass(FileDto.class); arguments.setQueryExecutorArguments(new QueryExecutorArguments.Dto().setQueryIdentifier(FileQuerier.QUERY_IDENTIFIER_READ_VIEW_01) .addFilterField(File.FIELD_NAME, globalFilter) .setFirstTupleIndex(NumberHelper.getInteger(from)) .setNumberOfTuples(NumberHelper.getInteger(count)) ).setCountable(Boolean.TRUE).setLoggableAsInfo(loggableAsInfo); return EntityReader.getInstance().read(arguments); //return getMany(null,isPageable, from, count, fields, new Filter.Dto().setValue(globalFilter)); } @Override public Response download(String identifier,String isInline) { File file = __inject__(FileBusiness.class).findBySystemIdentifier(identifier); if(file == null) return Response.status(Status.NOT_FOUND).build(); byte[] bytes = null; if(StringHelper.isBlank(file.getUniformResourceLocator())) { FileBytes fileBytes = __inject__(FileBytesBusiness.class).findByFile(file); bytes = fileBytes.getBytes(); }else { try { URI uri = new URI(file.getUniformResourceLocator()); bytes = IOUtils.toByteArray(uri.toURL()); } catch (Exception exception) { return Response.status(Status.INTERNAL_SERVER_ERROR).entity(exception.toString()).build(); } } ResponseBuilder response = Response.ok(bytes); response.header(HttpHeaders.CONTENT_TYPE, file.getMimeType()); String name = FileHelper.concatenateNameAndExtension(file.getName(), file.getExtension()); response.header(HttpHeaders.CONTENT_DISPOSITION, (Boolean.parseBoolean(isInline) ? ConstantString.INLINE : ConstantString.ATTACHMENT)+"; "+ConstantString.FILENAME +"="+name); Long size = file.getSize(); if(size!=null && size > 0) response.header(HttpHeaders.CONTENT_LENGTH, size); return response.build(); } }
[ "kycdev@gmail.com" ]
kycdev@gmail.com
393a3a49b19cbbf5eb945caee04d85d627291146
2845493c4d580783f6c208da0a62ba74e3528e3e
/src/recursion2/GroupSumClump.java
4be3a43493bcc27c4cae41c00e106c2ec315ae4b
[ "MIT" ]
permissive
Maximization/CodingBat
d791dac1455a1bd580df2a3399f356892e4ae874
3126df26dd0d1dc3ab4f99185fa07671436ea3bd
refs/heads/master
2020-04-01T07:00:30.952850
2014-11-20T20:17:07
2014-11-20T20:17:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
/** * created by Maxim Orlov on 19 Nov 2014 */ package recursion2; public class GroupSumClump { public boolean groupSumClump(int start, int[] nums, int target) { if (start >= nums.length) { return target == 0; } int substract = nums[start]; int count = 1; for (int i = start; i < nums.length - 1; i++) { if (nums[i] == nums[i + 1]) { substract += nums[i + 1]; count++; } else { break; } } if (groupSumClump(start + count, nums, target - substract)) { return true; } else if (groupSumClump(start + count, nums, target)) { return true; } return false; } }
[ "Maximization@users.noreply.github.com" ]
Maximization@users.noreply.github.com
189500b28edc7fd98c152246d2c4ee2c4c73579d
92072d9b83ff679cae10c8ccf626e574a67fb616
/CrowdAssist/app/src/main/java/th/ac/kmitl/it/crowdassist/viewmodel/HandleRequestStatusViewModel.java
954c32f18b98b7923e618577beadcf3ea7cd5789
[]
no_license
dsjin/Crowd-Assist
84fa0b7532beb0357ad6b98ef02eb5df41aa4c93
0028cededed67fde8372c64bc75d9e0fc06766a4
refs/heads/master
2020-03-22T23:04:16.963534
2019-01-08T10:56:23
2019-01-08T10:56:23
140,787,543
0
0
null
null
null
null
UTF-8
Java
false
false
1,447
java
package th.ac.kmitl.it.crowdassist.viewmodel; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.LiveData; import android.content.Context; import android.content.SharedPreferences; import android.support.annotation.NonNull; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import th.ac.kmitl.it.crowdassist.livedata.FirebaseValueEventLiveData; public class HandleRequestStatusViewModel extends AndroidViewModel { private final String SP_REQUEST = "request_information"; private Context ctx; private String requestUid; private String type; private Query REQUEST_STATUS_REF; private FirebaseValueEventLiveData liveData; public HandleRequestStatusViewModel(Application application){ super(application); ctx = application.getApplicationContext(); SharedPreferences sp = ctx.getSharedPreferences(SP_REQUEST, Context.MODE_PRIVATE); requestUid = sp.getString("request_uid", null); type = sp.getString("type", null); REQUEST_STATUS_REF = FirebaseDatabase.getInstance().getReference().child(type).child(requestUid).child("status"); liveData = new FirebaseValueEventLiveData(REQUEST_STATUS_REF); } @NonNull public LiveData<DataSnapshot> getDataSnapshotLiveData() { return liveData; } }
[ "57070053@kmitl.ac.th" ]
57070053@kmitl.ac.th
4b8ff54c68af21316fe02c79118d7927c84dee96
ef28638d8a8e3431aad834fe2e62c42d39b6ab24
/baselibrary/src/main/java/com/example/baselibrary/zh/callback/RefreshCallBack.java
8aa985d794dd5ec6e5dc1ddbe693be56a70abe06
[]
no_license
xinshangyu/demo2
46b0f2ecf81fd7d4795387dbe7a9dd1eb51528ec
aed138417799d1fc1b7d937822051aa21855458b
refs/heads/master
2020-07-07T06:11:02.509477
2019-12-19T07:00:49
2019-12-19T07:00:49
203,273,452
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package com.example.baselibrary.zh.callback; /** * 刷新的回调 */ public interface RefreshCallBack { /** * @param stat 1刷新 2加载更多 * @param page 当前页数 * @param count 当前count */ void getRefreshDate(int stat, int page, int count); }
[ "jiuyankeji2013" ]
jiuyankeji2013
ce04fe281974106801f6c03fd8c743af411cb6af
69a13bce55652c2f8c626ffe504fea15f4af4fd0
/src/main/java/org/mppproject/queries/QueriesJeevan.java
0c5b270ef34ae8ca9e5220160b2c782d3f8352b1
[]
no_license
jeevankacharya/MPPProject
cbe94e04e0f06143583a043e0b77295bb5a364a1
f27ec506864da9d0a369d260715a9ba310844b91
refs/heads/master
2020-08-22T02:27:45.555239
2019-10-24T05:53:07
2019-10-24T05:53:07
216,298,842
0
1
null
2019-10-23T05:57:52
2019-10-20T02:51:42
null
UTF-8
Java
false
false
2,870
java
package org.mppproject.queries; import org.mppproject.entity.*; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; import java.util.stream.Collectors; public class QueriesJeevan { //find the list of customers who appointed a salesman for their jobs who gets a commission from the company is more than 12% public static List<Customer> getListOfCustomer(List<Customer> customers, List<Salesman> salesmanList) { return salesmanList.parallelStream() .flatMap(salesman -> customers.stream(). filter(customer -> customer.getSalesman().getSalesmanId() == salesman.getSalesmanId() && salesman.getCommission() > 0.12)) .collect(Collectors.toList()); } //make a report with customer name, city, order number, order date, and order amount in ascending order // according to the order date to find that either any of the existing customers have placed no order or // placed one or more orders. // private static BiFunction<List<Customer>, List<Order>, List<CustomerOrder>> listBiFunction = (customers, orderList) -> { // List<CustomerOrder> list = new ArrayList<>(); // customers.parallelStream().forEach(customer -> orderList.parallelStream().forEach(order -> { // if (order.getCustomer().getCustomerId() == customer.getCustomerId()) { // list.add(new CustomerOrder(customer.getName(), customer.getCity(), order.getOrder_No(), order.getLocalDate(), // order.getOrderItems(), customer.getCustomerId(), customer.getSalesman().getSalesmanId())); // } // })); // return list; // }; //make a report with customer name, city, order no. order date, purchase amount for only those customers // // public static List<CustomerOrder> getCustomerOrderList(List<Customer> customerList, List<Order> orderList) { // return listBiFunction.apply(customerList, orderList); // } public static Map<String, Set<Double>> getListPriceByProductCategories(List<Customer> customerList, List<Order> orderList) { return ListPriceByProductCategories.apply(customerList, orderList); } //total sum price of all the orders public static double getTotalOrderItemPrice(List<Order> orderList) { return orderList.stream() .flatMap(order -> order.getOrderItems().stream()) .mapToDouble(Item::getPrice).sum(); } private static BiFunction<List<Customer>, List<Order>, Map<String, Set<Double>>> ListPriceByProductCategories = ((customerList, orderList) -> orderList.stream() .flatMap(order -> order.getOrderItems().stream()) .collect(Collectors.groupingBy(Item::getName, Collectors.mapping(Item::getPrice, Collectors.toSet()))) ); }
[ "gvancharya@gmail.com" ]
gvancharya@gmail.com
deaf40b4ce800cee08b8b4c5fcdfdeb4d49f9f6f
836a472834a36c7c6ce159ec95353e2698cc2b7c
/src/main/java/generals/ioIA/generals/ioIA/Bot.java
c2079e3fc632d9c850c624c71732c16c3771d7e9
[]
no_license
NatiyasATR/Generals.ioIA
0e16707a7fe5132a57954d65801660466d996217
1548bdeca2c73b9d36c3cae8e791ad756254d2b6
refs/heads/master
2022-11-23T20:22:40.136987
2019-07-08T13:26:21
2019-07-08T13:26:21
182,239,508
0
0
null
2022-11-16T07:23:04
2019-04-19T09:27:53
Java
UTF-8
Java
false
false
7,903
java
package generals.ioIA.generals.ioIA; import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.swing.JFrame; import javax.swing.JTextArea; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.fasterxml.jackson.databind.ObjectMapper; import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; public class Bot extends Thread{ private String botId; private String botName; private Socket socket; private String tipoPartida; private String partidaId; private boolean conectado; private boolean partidaFinalizada; private ModuloPercepcion moduloPercepcion; private ModuloDecision moduloDecision; private ModuloNavegacion moduloNavegacion; private Lock lock; private Condition condicionConectado; private Condition condicionFinalizada; private JFrame frame; private JTextArea ta; Bot(int numBot) throws URISyntaxException, InterruptedException, IOException{ botId = "ATR_bot_"+numBot; botName = "[Bot] ATR Bot "+numBot; socket = IO.socket("http://botws.generals.io"); conectado = false; moduloPercepcion = new ModuloPercepcion(this); moduloDecision = new MaquinaEstados(this);//MaquinaEstados o ArbolDecisiones moduloNavegacion = new ModuloNavegacion(this); lock = new ReentrantLock(); condicionConectado = lock.newCondition(); condicionFinalizada = lock.newCondition(); JFrame frame = new JFrame(botId); ta =new JTextArea(); frame.add( ta); ta.setText("Bot: "+botId+"\n"); frame.setVisible(true); frame.pack(); } public void setPartida(String tipoPartida,String partidaId) { this.tipoPartida=tipoPartida; this.partidaId=partidaId; } public void run(){ try { conectarse(); while(tipoPartida!=null) { if(tipoPartida=="Privada") unirsePartidaPersonalizada(partidaId); else if(tipoPartida=="FFA") unirseFFA(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void conectarse() throws InterruptedException { socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() { public void call(Object... args) { lock.lock(); try{ conectado = true;/*aqui*////////////// System.out.println(botName+" conectado"); condicionConectado.signalAll(); }finally { lock.unlock(); } } }); socket.on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { public void call(Object... args) { System.out.println(botName+" desconectado"); } }); socket.on("stars", new Emitter.Listener() { public void call(Object... args) { System.out.println(args[0]); } }); socket.on("game_start", new Emitter.Listener() { public void call(Object... args) { gameStart(args); } }); socket.on("game_update", new Emitter.Listener() { public void call(Object... args) { gameUpdate(args); } }); socket.on("game_lost", new Emitter.Listener() { public void call(Object... args) { lose(args); } }); socket.on("game_win", new Emitter.Listener() { public void call(Object... args) { win(args); } }); socket.on("chat_message",new Emitter.Listener() { public void call(Object... args) { JSONObject argsjson = (JSONObject) args[1]; try { System.out.println(argsjson.get("text")); socket.emit("set_force_start", true); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); socket.connect(); lock.lock(); try{ while(!conectado) { System.out.println("Todavia no esta conectado"); condicionConectado.await(); } }finally { lock.unlock(); } //socket.emit("set_username", botId, botName); socket.on("error_set_username", new Emitter.Listener() { public void call(Object... args) { System.out.println(args[0]); } }); } public void unirsePartidaPersonalizada(final String gameId) throws InterruptedException { partidaFinalizada = false; moduloDecision.resetearDatos(); moduloPercepcion.resetearDatos(); socket.emit("join_private", gameId, botId); System.out.println(botName + " joined custom game at http://bot.generals.io/games/" + Utilities.encodeURIComponent(gameId)); Thread.sleep(3000); socket.emit("set_force_start",gameId, true); lock.lock(); try{ while(!partidaFinalizada) { System.out.println("La partida se esta jugando"); condicionFinalizada.await(); } }finally { lock.unlock(); } } public void unirseFFA() throws InterruptedException { partidaFinalizada = false; moduloDecision.resetearDatos(); moduloPercepcion.resetearDatos(); socket.emit("play", botId); Thread.sleep(3000); socket.emit("set_force_start", true); lock.lock(); try{ while(!partidaFinalizada) { System.out.println("La partida se esta jugando"); condicionFinalizada.await(); } }finally { lock.unlock(); } } private void gameStart(Object... args) { JSONObject argsjson = (JSONObject) args[0]; moduloPercepcion.iniciarPartidaDatos(argsjson); String repeticionId = moduloPercepcion.getRepeticionId(); String text = ta.getText(); text+="\n\n"+"Comenzado partida. La repeticion estara disponible en: http://bot.generals.io/replays/" + Utilities.encodeURIComponent(repeticionId)+"\n"; ta.setText(text); frame.pack(); } private void gameUpdate(Object... args) { JSONObject argsjson = (JSONObject) args[0]; //System.out.println(argsjson); moduloPercepcion.actualizarPartidaDatos(argsjson); //Tomar decision y actuar if(moduloPercepcion.getAtaquesPendientes()==0) { Movimiento movimiento=moduloDecision.siguienteMovimiento(); if(movimiento!=null) { System.out.println("Ataque desde "+movimiento.origen+" hacia "+movimiento.destino); socket.emit("attack",movimiento.origen,movimiento.destino,movimiento.is50); }else System.out.println("No se ataca"); }else System.out.println("Ataques Pendientes"); } private void win(Object... args) { String text = ta.getText(); text+="Victorioso\n"; ta.setText(text); salirPartida(); try{ socket.emit("stars_and_rank", this.botId); partidaFinalizada = true; condicionFinalizada.signalAll(); }finally { lock.unlock(); } } private void lose(Object... args) { JSONObject argsjson = (JSONObject) args[0]; try { String text = ta.getText(); text+="Derrotado, asesino: "+ argsjson.getInt("killer"); ta.setText(text); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } salirPartida(); lock.lock(); try{ socket.emit("stars_and_rank", this.botId); partidaFinalizada = true; condicionFinalizada.signalAll(); }finally { lock.unlock(); } } public void rendirse() { socket.emit("surrender"); } public void salirPartida() { System.out.println("abandonando partida"); socket.emit("leave_game"); } public void desconectar() { socket.disconnect(); } public String getBotId() { return botId; } public String getBotName() { return botName; } public ModuloPercepcion getModuloPercepcion() { return moduloPercepcion; } public ModuloDecision getModuloDecision() { return moduloDecision; } public ModuloNavegacion getModuloNavegacion() { return moduloNavegacion; } }
[ "alvaro.torres.rubio@alumnos.upm.es" ]
alvaro.torres.rubio@alumnos.upm.es
e428ab00a39974bcea4d73c81c8f2e3649404a59
20272c0446a5fe9911287c83b4a12ff6ee6cdcbd
/src/com/carpool/thread/GetRequestHistoryThread.java
d0620243cdc1cd844136114f567647a974ab0d8b
[]
no_license
paragwaghela/CarPoolingGenetic
23f9c9c18b43c62d5b32f65831e3ca9d53f98c22
c186f2656bb6cf3bb43b63c2540c474b6946197d
refs/heads/develop
2021-01-19T14:30:21.761033
2017-08-24T10:30:26
2017-08-24T10:30:26
34,193,120
0
0
null
2017-08-24T10:30:27
2015-04-19T04:11:58
Java
UTF-8
Java
false
false
2,508
java
package com.carpool.thread; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONObject; import android.util.Log; import com.carpool.data.ReqData; import com.carpool.data.SharedData; import com.carpool.utils.HttpCalls; public class GetRequestHistoryThread extends Thread { private static String TAG="GetRequestHistory"; public interface GetRequestHistoryInterface { public void onGetRequestHistoryDataReturned(Boolean isSuccess,String msg); public void onGetRequestHistoryErrorReturned(); } private GetRequestHistoryInterface mGetRequestHistoryInterface; public GetRequestHistoryThread(GetRequestHistoryInterface n) { mGetRequestHistoryInterface=n; } @Override public void run() { super.run(); try { JSONObject obj=new JSONObject(); obj.put("user_id",SharedData.mMySharedPref.getUserId()); obj.put("role", SharedData.mMySharedPref.getUserType()); Log.i("Parameter :",obj.toString()); String urlParams = HttpCalls.GetUrlFormat(obj); final String result=HttpCalls.getPOSTResponseString(SharedData.SERVER_URL+"RequestHistoryServlet"+urlParams); //result={"result":true,"Data":"[{\"pname\":\"Ruta Londhe\",\"pdest\":\"Swargate Pune\",\"psource\":\"Fatima Nagar Pune\",\"pcontact\":\"8657736576\"},{\"pname\":\"Yamini Lele\",\"pdest\":\"Deccan Gymkhana Pune\",\"psource\":\"Shivajinagar Pune\",\"pcontact\":\"8657736578\"}]"}; obj=new JSONObject(result); boolean resultVal=obj.getBoolean("result"); String msg = null; if(resultVal) { //parse the data String Pdata = obj.getString("data"); JSONArray arr= new JSONArray(Pdata); if(arr.length()>0) { SharedData.mReqData=new ArrayList<ReqData>(); for(int i=0;i<arr.length();i++) { ReqData data=new ReqData(); JSONObject object=arr.getJSONObject(i); try { data.doParseJSONData(object); SharedData.mReqData.add(data); } catch(NullPointerException e) { e.printStackTrace(); } } mGetRequestHistoryInterface.onGetRequestHistoryDataReturned(resultVal,null); } else mGetRequestHistoryInterface.onGetRequestHistoryDataReturned(!resultVal,"No Req data available."); } else { msg=obj.getString("msg"); mGetRequestHistoryInterface.onGetRequestHistoryDataReturned(resultVal,msg); } } catch (Exception e) { e.printStackTrace(); mGetRequestHistoryInterface.onGetRequestHistoryErrorReturned(); } } }
[ "parag.waghela@gamil.com" ]
parag.waghela@gamil.com
8037de36ee63ef2e509f0e5ec6af1196256b272f
9a33f8d8e0a573bcea01c35e25f143be07d651fa
/src/main/java/com/cnic/core/ModelProcess.java
0578ac2311411ddf6aabdd7adc105e19e2fdc7f6
[]
no_license
superY-25/graphBased-QA
903b35a67c70d1beb431f595094353ec3a2ac0b7
b24678e8af97e427855d4fcf85d2080e3e65c859
refs/heads/master
2023-04-28T23:44:31.024020
2020-04-15T15:22:22
2020-04-15T15:22:22
255,954,206
0
0
null
2023-04-21T20:42:36
2020-04-15T15:10:27
Java
UTF-8
Java
false
false
11,160
java
package com.cnic.core; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.mllib.classification.NaiveBayes; import org.apache.spark.mllib.classification.NaiveBayesModel; import org.apache.spark.mllib.linalg.Vector; import org.apache.spark.mllib.linalg.Vectors; import org.apache.spark.mllib.regression.LabeledPoint; import com.hankcs.hanlp.HanLP; import com.hankcs.hanlp.seg.Segment; import com.hankcs.hanlp.seg.common.Term; /** * Spark贝叶斯分类器 + HanLP分词器 + 实现问题语句的抽象+模板匹配+关键性语句还原 */ public class ModelProcess { /** * 指定问题question及字典的txt模板所在的根目录 */ private String rootDirPath; /** * 分类标签号和问句模板对应表 */ Map<Double, String> questionsPattern; /** * Spark贝叶斯分类器 */ NaiveBayesModel nbModel; /** * 词语和下标的对应表 == 词汇表 */ Map<String, Integer> vocabulary; /** * 关键字与其词性的map键值对集合 == 句子抽象 */ Map<String, String> abstractMap; /** * 分类模板索引 */ int modelIndex = 0; public ModelProcess(String rootDirPath) throws Exception{ this.rootDirPath = rootDirPath+'/'; questionsPattern = loadQuestionsPattern(); vocabulary = loadVocabulary(); nbModel = loadClassifierModel(); } public ArrayList<String> analyQuery(String queryString) throws Exception { /** * 打印问句 */ System.out.println("原始句子:"+queryString); System.out.println("========HanLP开始分词========"); /** * 抽象句子,利用HanPL分词,将关键字进行词性抽象 */ String abstr = queryAbstract(queryString); System.out.println("句子抽象化结果:"+abstr);// nm 的 导演 是 谁 /** * 将抽象的句子与spark训练集中的模板进行匹配,拿到句子对应的模板 */ String strPatt = queryClassify(abstr); System.out.println("句子套用模板结果:"+strPatt); // nm 制作 导演列表 /** * 模板还原成句子,此时问题已转换为我们熟悉的操作 */ String finalPattern = queryExtension(strPatt); System.out.println("原始句子替换成系统可识别的结果:"+finalPattern);// 但丁密码 制作 导演列表 ArrayList<String> resultList = new ArrayList<>(); resultList.add(String.valueOf(modelIndex)); String[] finalPattArray = finalPattern.split(" "); for (String word : finalPattArray) resultList.add(word); return resultList; } public String queryAbstract(String querySentence) { // 句子抽象化 Segment segment = HanLP.newSegment().enableCustomDictionary(true); List<Term> terms = segment.seg(querySentence); String abstractQuery = ""; abstractMap = new HashMap<>(); for (Term term : terms) { String word = term.word; String termStr = term.toString(); System.out.println(termStr); if (termStr.contains("nc")) { //nc 公司名 abstractQuery += "nc "; abstractMap.put("nc", word); }else if (termStr.contains("ni")) { //ni 行业名 abstractQuery += "ni "; abstractMap.put("ni", word); }else if (termStr.contains("nm")) { //nm 材料名 abstractQuery += "nm "; abstractMap.put("nm", word); }else if (termStr.contains("np")) { //np 产品名 abstractQuery += "np "; abstractMap.put("np", word); }else { abstractQuery += word + " "; } } System.out.println("========HanLP分词结束========"); return abstractQuery; } public String queryExtension(String queryPattern) { // 句子还原 Set<String> set = abstractMap.keySet(); for (String key : set) { /** * 如果句子模板中含有抽象的词性 */ if (queryPattern.contains(key)) { /** * 则替换抽象词性为具体的值 */ String value = abstractMap.get(key); queryPattern = queryPattern.replace(key, value); } } String extendedQuery = queryPattern; /** * 当前句子处理完,抽象map清空释放空间并置空,等待下一个句子的处理 */ abstractMap.clear(); abstractMap = null; return extendedQuery; } /** * 加载词汇表 == 关键特征 == 与HanLP分词后的单词进行匹配 * @return */ public Map<String, Integer> loadVocabulary() { Map<String, Integer> vocabulary = new HashMap<String, Integer>(); File file = new File(rootDirPath + "question/vocabulary.txt"); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } String line; try { while ((line = br.readLine()) != null) { String[] tokens = line.split(":"); int index = Integer.parseInt(tokens[0]); String word = tokens[1]; vocabulary.put(word, index); } } catch (NumberFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return vocabulary; } /** * 加载文件,并读取内容返回 * @param filename * @return * @throws IOException */ public String loadFile(String filename) throws IOException { File file = new File(rootDirPath + filename); BufferedReader br = new BufferedReader(new FileReader(file)); String content = ""; String line; while ((line = br.readLine()) != null) { /** * 文本的换行符暂定用"`"代替 */ content += line + "`"; } /** * 关闭资源 */ br.close(); return content; } /** * 句子分词后与词汇表进行key匹配转换为double向量数组 * @param sentence * @return * @throws Exception */ public double[] sentenceToArrays(String sentence) throws Exception { double[] vector = new double[vocabulary.size()]; /** * 模板对照词汇表的大小进行初始化,全部为0.0 */ for (int i = 0; i < vocabulary.size(); i++) { vector[i] = 0; } /** * HanLP分词,拿分词的结果和词汇表里面的关键特征进行匹配 */ Segment segment = HanLP.newSegment(); List<Term> terms = segment.seg(sentence); for (Term term : terms) { String word = term.word; /** * 如果命中,0.0 改为 1.0 */ if (vocabulary.containsKey(word)) { int index = vocabulary.get(word); vector[index] = 1; } } return vector; } /** * Spark朴素贝叶斯(naiveBayes) * 对特定的模板进行加载并分类 * 欲了解Spark朴素贝叶斯,可参考地址:https://blog.csdn.net/cnic/article/details/80348912 * @return * @throws Exception */ public NaiveBayesModel loadClassifierModel() throws Exception { /** * 生成Spark对象 * 一、Spark程序是通过SparkContext发布到Spark集群的 * Spark程序的运行都是在SparkContext为核心的调度器的指挥下进行的 * Spark程序的结束是以SparkContext结束作为结束 * JavaSparkContext对象用来创建Spark的核心RDD的 * 注意:第一个RDD,一定是由SparkContext来创建的 * * 二、SparkContext的主构造器参数为 SparkConf * SparkConf必须设置appname和master,否则会报错 * spark.master 用于设置部署模式 * local[*] == 本地运行模式[也可以是集群的形式],如果需要多个线程执行,可以设置为local[2],表示2个线程 ,*表示多个 * spark.app.name 用于指定应用的程序名称 == */ SparkConf conf = new SparkConf().setAppName("NaiveBayesTest").setMaster("local[*]"); JavaSparkContext sc = new JavaSparkContext(conf); /** * 训练集生成 * labeled point 是一个局部向量,要么是密集型的要么是稀疏型的 * 用一个label/response进行关联。在MLlib里,labeled points 被用来监督学习算法 * 我们使用一个double数来存储一个label,因此我们能够使用labeled points进行回归和分类 */ List<LabeledPoint> train_list = new LinkedList<LabeledPoint>(); String[] sentences = null; String scoreQuestions = loadFile("question/【0】主营产品.txt"); sentences = scoreQuestions.split("`"); for (String sentence : sentences) { double[] array = sentenceToArrays(sentence); LabeledPoint train_one = new LabeledPoint(0.0, Vectors.dense(array)); train_list.add(train_one); } String timeQuestions = loadFile("question/【1】上游原材料.txt"); sentences = timeQuestions.split("`"); for (String sentence : sentences) { double[] array = sentenceToArrays(sentence); LabeledPoint train_one = new LabeledPoint(1.0, Vectors.dense(array)); train_list.add(train_one); } /** * SPARK的核心是RDD(弹性分布式数据集) * Spark是Scala写的,JavaRDD就是Spark为Java写的一套API * JavaSparkContext sc = new JavaSparkContext(sparkConf); //对应JavaRDD * SparkContext sc = new SparkContext(sparkConf) ; //对应RDD */ JavaRDD<LabeledPoint> trainingRDD = sc.parallelize(train_list); NaiveBayesModel nb_model = NaiveBayes.train(trainingRDD.rdd()); /** * 记得关闭资源 */ sc.close(); /** * 返回贝叶斯分类器 */ return nb_model; } /** * 加载问题模板 == 分类器标签 * @return */ public Map<Double, String> loadQuestionsPattern() { Map<Double, String> questionsPattern = new HashMap<Double, String>(); File file = new File(rootDirPath + "question/question_classification.txt"); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e1) { e1.printStackTrace(); } String line; try { while ((line = br.readLine()) != null) { String[] tokens = line.split(":"); double index = Double.valueOf(tokens[0]); String pattern = tokens[1]; questionsPattern.put(index, pattern); } } catch (NumberFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return questionsPattern; } /** * 贝叶斯分类器分类的结果,拿到匹配的分类标签号,并根据标签号返回问题的模板 * @param sentence * @return * @throws Exception */ public String queryClassify(String sentence) throws Exception { double[] testArray = sentenceToArrays(sentence); Vector v = Vectors.dense(testArray); /** * 对数据进行预测predict * 句子模板在 spark贝叶斯分类器中的索引【位置】 * 根据词汇使用的频率推断出句子对应哪一个模板 */ double index = nbModel.predict(v); modelIndex = (int)index; System.out.println("the model index is " + index); return questionsPattern.get(index); } public String getRootDirPath() { return rootDirPath; } public void setRootDirPath(String rootDirPath) { this.rootDirPath = rootDirPath; } public static void main(String[] agrs) throws Exception { System.out.println("Hello World !"); } }
[ "alonyoung@126.com" ]
alonyoung@126.com
b7f5fac8ff7c9018f2f4f3c82ccd253aa5899f4f
b52fa223f54b51cc271e1cbfc4c28aa76e734718
/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobVertexBackPressureHandlerTest.java
db0715a2b393a8901f0e0325aef9d0167626c68e
[ "ISC", "Apache-2.0", "BSD-3-Clause", "OFL-1.1" ]
permissive
itharavi/flink
1d0b7e711df93d3a13eae42da71a08dc45aaf71f
f0f9343a35ff21017e2406614b34a9b1f2712330
refs/heads/master
2023-08-03T02:53:12.278756
2020-01-08T05:58:54
2020-01-10T15:51:31
233,090,272
3
1
Apache-2.0
2023-07-23T02:28:35
2020-01-10T16:47:58
null
UTF-8
Java
false
false
6,442
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.runtime.rest.handler.job; import org.apache.flink.api.common.JobID; import org.apache.flink.api.common.time.Time; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.runtime.rest.handler.HandlerRequest; import org.apache.flink.runtime.rest.handler.legacy.backpressure.OperatorBackPressureStats; import org.apache.flink.runtime.rest.handler.legacy.backpressure.OperatorBackPressureStatsResponse; import org.apache.flink.runtime.rest.messages.EmptyRequestBody; import org.apache.flink.runtime.rest.messages.JobIDPathParameter; import org.apache.flink.runtime.rest.messages.JobVertexBackPressureHeaders; import org.apache.flink.runtime.rest.messages.JobVertexBackPressureInfo; import org.apache.flink.runtime.rest.messages.JobVertexBackPressureInfo.VertexBackPressureStatus; import org.apache.flink.runtime.rest.messages.JobVertexIdPathParameter; import org.apache.flink.runtime.rest.messages.JobVertexMessageParameters; import org.apache.flink.runtime.webmonitor.TestingRestfulGateway; import org.junit.Before; import org.junit.Test; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import static org.apache.flink.runtime.rest.messages.JobVertexBackPressureInfo.VertexBackPressureLevel.HIGH; import static org.apache.flink.runtime.rest.messages.JobVertexBackPressureInfo.VertexBackPressureLevel.LOW; import static org.apache.flink.runtime.rest.messages.JobVertexBackPressureInfo.VertexBackPressureLevel.OK; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; /** * Tests for {@link JobVertexBackPressureHandler}. */ public class JobVertexBackPressureHandlerTest { /** * Job ID for which {@link OperatorBackPressureStats} exist. */ private static final JobID TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE = new JobID(); /** * Job ID for which {@link OperatorBackPressureStats} are not available. */ private static final JobID TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT = new JobID(); private TestingRestfulGateway restfulGateway; private JobVertexBackPressureHandler jobVertexBackPressureHandler; @Before public void setUp() { restfulGateway = new TestingRestfulGateway.Builder().setRequestOperatorBackPressureStatsFunction( (jobId, jobVertexId) -> { if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE)) { return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(new OperatorBackPressureStats( 4711, Integer.MAX_VALUE, new double[]{1.0, 0.5, 0.1} ))); } else if (jobId.equals(TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT)) { return CompletableFuture.completedFuture(OperatorBackPressureStatsResponse.of(null)); } else { throw new AssertionError(); } } ).build(); jobVertexBackPressureHandler = new JobVertexBackPressureHandler( () -> CompletableFuture.completedFuture(restfulGateway), Time.seconds(10), Collections.emptyMap(), JobVertexBackPressureHeaders.getInstance() ); } @Test public void testGetBackPressure() throws Exception { final Map<String, String> pathParameters = new HashMap<>(); pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID_BACK_PRESSURE_STATS_AVAILABLE.toString()); pathParameters.put(JobVertexIdPathParameter.KEY, new JobVertexID().toString()); final HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), new JobVertexMessageParameters(), pathParameters, Collections.emptyMap()); final CompletableFuture<JobVertexBackPressureInfo> jobVertexBackPressureInfoCompletableFuture = jobVertexBackPressureHandler.handleRequest(request, restfulGateway); final JobVertexBackPressureInfo jobVertexBackPressureInfo = jobVertexBackPressureInfoCompletableFuture.get(); assertThat(jobVertexBackPressureInfo.getStatus(), equalTo(VertexBackPressureStatus.OK)); assertThat(jobVertexBackPressureInfo.getBackpressureLevel(), equalTo(HIGH)); assertThat(jobVertexBackPressureInfo.getSubtasks() .stream() .map(JobVertexBackPressureInfo.SubtaskBackPressureInfo::getRatio) .collect(Collectors.toList()), contains(1.0, 0.5, 0.1)); assertThat(jobVertexBackPressureInfo.getSubtasks() .stream() .map(JobVertexBackPressureInfo.SubtaskBackPressureInfo::getBackpressureLevel) .collect(Collectors.toList()), contains(HIGH, LOW, OK)); assertThat(jobVertexBackPressureInfo.getSubtasks() .stream() .map(JobVertexBackPressureInfo.SubtaskBackPressureInfo::getSubtask) .collect(Collectors.toList()), contains(0, 1, 2)); } @Test public void testAbsentBackPressure() throws Exception { final Map<String, String> pathParameters = new HashMap<>(); pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT.toString()); pathParameters.put(JobVertexIdPathParameter.KEY, new JobVertexID().toString()); final HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), new JobVertexMessageParameters(), pathParameters, Collections.emptyMap()); final CompletableFuture<JobVertexBackPressureInfo> jobVertexBackPressureInfoCompletableFuture = jobVertexBackPressureHandler.handleRequest(request, restfulGateway); final JobVertexBackPressureInfo jobVertexBackPressureInfo = jobVertexBackPressureInfoCompletableFuture.get(); assertThat(jobVertexBackPressureInfo.getStatus(), equalTo(VertexBackPressureStatus.DEPRECATED)); } }
[ "trohrmann@apache.org" ]
trohrmann@apache.org
f6e833f230ae17dc045de15f5dfd279c76411777
4b58ff789c9e3d1751ec54a85c37aaa9c8e4f815
/src/main/java/com/thinkgem/jeesite/modules/sys/entity/Attendance.java
88c60d12c9c1613c8c4b8725567fa06a2c5f2602
[ "Apache-2.0" ]
permissive
goodlearn/xsgl
e1fe094da2c1a0254c3c3265fb8bb630450fc0c8
c1ce9d0982f55316c0186f1f0bb8013b73ac314e
refs/heads/master
2020-03-28T06:13:45.010812
2018-10-27T13:00:44
2018-10-27T13:00:44
147,821,790
1
0
null
null
null
null
UTF-8
Java
false
false
2,657
java
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.modules.sys.entity; import org.hibernate.validator.constraints.Length; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import javax.validation.constraints.NotNull; import com.thinkgem.jeesite.common.persistence.DataEntity; import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField; /** * 考勤记录Entity * @author 王泽宇 * @version 2018-09-12 */ public class Attendance extends DataEntity<Attendance> { private static final long serialVersionUID = 1L; private String machineId; // 考勤编号 private String no; // 人员编号 private String name; // 名称 private Date recordDate; // 打卡时间 private Student student; //时间 private Date beginRecordDate; private Date endRecordDate; public Attendance() { super(); } public Attendance(String id){ super(id); } public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public Date getBeginRecordDate() { return beginRecordDate; } public void setBeginRecordDate(Date beginRecordDate) { this.beginRecordDate = beginRecordDate; } public Date getEndRecordDate() { return endRecordDate; } public void setEndRecordDate(Date endRecordDate) { this.endRecordDate = endRecordDate; } @Length(min=1, max=64, message="考勤编号长度必须介于 1 和 64 之间") @ExcelField(title="考勤编号", align=2, sort=1) public String getMachineId() { return machineId; } public void setMachineId(String machineId) { this.machineId = machineId; } @Length(min=1, max=64, message="人员编号长度必须介于 1 和 64 之间") @ExcelField(title="人员编号", align=2, sort=2) public String getNo() { return no; } public void setNo(String no) { this.no = no; } @Length(min=0, max=100, message="名称长度必须介于 0 和 100 之间") @ExcelField(title="名称", align=2, sort=3) public String getName() { return name; } public void setName(String name) { this.name = name; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title="打卡时间", align=2, sort=4) @NotNull(message="打卡时间不能为空") public Date getRecordDate() { return recordDate; } public void setRecordDate(Date recordDate) { this.recordDate = recordDate; } @Length(min=0, max=255) @ExcelField(title="备注", align=2, sort=5) public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } }
[ "764411352@qq.com" ]
764411352@qq.com
71d2adc98f7a09b80fbd9f450a369ef35db6714c
0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7
/JavaSource/dream/part/iss/emg/list/dao/oraImpl/MaPtIssEmgListDAOOraImpl.java
24b2973983ff7bef7b7871818aa538b691952eb1
[]
no_license
eMainTec-DREAM/DREAM
bbf928b5c50dd416e1d45db3722f6c9e35d8973c
05e3ea85f9adb6ad6cbe02f4af44d941400a1620
refs/heads/master
2020-12-22T20:44:44.387788
2020-01-29T06:47:47
2020-01-29T06:47:47
236,912,749
0
0
null
null
null
null
UHC
Java
false
false
11,967
java
package dream.part.iss.emg.list.dao.oraImpl; import java.util.List; import common.bean.User; import common.spring.BaseJdbcDaoSupportOra; import common.util.QueryBuffer; import dream.part.iss.emg.list.dao.MaPtIssEmgListDAO; import dream.part.iss.emg.list.dto.MaPtIssEmgCommonDTO; /** * 자재출고확정 - 목록 dao * @author ssong * @version $Id:$ * @since 1.0 * @spring.bean id="maPtIssEmgListDAOTarget" * @spring.txbn id="maPtIssEmgListDAO" * @spring.property name="dataSource" ref="dataSource" */ public class MaPtIssEmgListDAOOraImpl extends BaseJdbcDaoSupportOra implements MaPtIssEmgListDAO { /** * grid find * @author ssong * @version $Id:$ * @since 1.0 * * @param maPtIssEmgCommonDTO * @return List */ public List findPtIssEmgList(MaPtIssEmgCommonDTO maPtIssEmgCommonDTO, User user) { QueryBuffer query = new QueryBuffer(); String compNo = maPtIssEmgCommonDTO.getCompNo(); query.append("SELECT "); query.append(" '' seqNo "); query.append(" ,'' isDelCheck "); query.append(" ,ptemgisslist_id ptemgisslistId "); query.append(" ,(SELECT a.description "); query.append(" FROM TADEPT a "); query.append(" WHERE a.dept_id = x.issue_dept AND a.comp_no = x.comp_no) issueDept, "); query.getDate("issue_date", "issueDate,"); // query.append(" ,issue_date issueDate "); query.append(" y.part_no partNo "); query.append(" ,y.full_desc partDesc "); query.append(" ,x.part_grade partGrade "); query.append(" ,SFACODE_TO_DESC(x.part_grade,'PART_GRADE','SYS','','"+user.getLangId()+"') partGradeDesc "); query.append(" ,x.issue_qty issueQty "); query.append(" ,(SELECT emp_name "); query.append(" FROM TAEMP a "); query.append(" WHERE a.emp_id = rec_by AND a.comp_no = x.comp_no) recByName "); query.append(" ,ptemgiss_status ptemgissStatus "); query.append(" ,SFACODE_TO_DESC(x.ptemgiss_status,'PTEMGISS_STATUS','SYS','','"+user.getLangId()+"') ptemgissStatusDesc "); query.append(" ,ptemg_task_status ptemgTaskStatus "); query.append(" ,SFACODE_TO_DESC(x.ptemg_task_status,'PTEMG_TASK_STATUS','SYS','','"+user.getLangId()+"') ptemgTaskStatusDesc "); query.append(" ,(SELECT a.wo_no "); query.append(" FROM TAWORKORDER a "); query.append(" WHERE a.wkor_id = x.wkor_id AND a.comp_no = x.comp_no) woNo "); query.append(" ,(SELECT a.description "); query.append(" FROM TAWORKORDER a "); query.append(" WHERE a.wkor_id = x.wkor_id AND a.comp_no = x.comp_no) woDesc "); query.append(" ,x.remark "); query.append(" ,x.req_qty reqQty "); query.append(" ,(SELECT a.description "); query.append(" FROM TAEQUIPMENT a "); query.append(" WHERE a.equip_id = x.equip_id AND a.comp_no = x.comp_no) equipDesc "); query.append(" ,(SELECT a.full_desc "); query.append(" FROM TAEQLOC a "); query.append(" WHERE a.eqloc_id = (select aa.eqloc_id from taequipment aa where aa.equip_id=x.equip_id and aa.comp_no=a.comp_no) AND a.comp_no = x.comp_no) eqLocDesc "); query.append(" ,(SELECT a.full_desc "); query.append(" FROM TAEQASMB a "); query.append(" WHERE a.eqasmb_id = x.eqasmb_id AND a.comp_no = x.comp_no) eqAsmbDesc "); query.append(" ,x.req_date reqDate "); query.append(" ,(SELECT a.description "); query.append(" FROM TADEPT a "); query.append(" WHERE a.dept_id = x.req_dept AND a.comp_no = x.comp_no) reqDeptDesc "); query.append(" ,(SELECT a.emp_name "); query.append(" FROM TAEMP a "); query.append(" WHERE a.emp_id = x.req_by AND a.comp_no = x.comp_no) reqByName "); query.append(" ,(SELECT a.ptemgissreq_no "); query.append(" FROM TAPTEMGISSREQ a "); query.append(" WHERE a.ptemgissreq_id = x.ptemgissreq_id AND a.comp_no = x.comp_no) ptEmgIssReqNo "); query.append(" ,(SELECT wname "); query.append(" FROM TAWAREHOUSE a "); query.append(" WHERE a.wcode_id = x.wcode_id AND a.comp_no = x.comp_no) wname "); query.append(" ,(SELECT wname "); query.append(" FROM TAWAREHOUSE a "); query.append(" WHERE a.wcode_id = x.to_wcode_id AND a.comp_no = x.comp_no) toWname "); query.append(" ,(SELECT ctctr_no "); query.append(" FROM TACTCTR a "); query.append(" WHERE a.ctctr_id = x.ctctr_id AND a.comp_no = x.comp_no) ctCtrNo "); query.append(" ,(SELECT description "); query.append(" FROM TACTCTR a "); query.append(" WHERE a.ctctr_id = x.ctctr_id AND a.comp_no = x.comp_no) ctCtrDesc "); query.append("FROM TAPTEMGISSLIST x, TAPARTS y "); query.append("WHERE x.part_id = y.part_id "); query.append("AND x.comp_no = y.comp_no "); query.append(this.getWhere(maPtIssEmgCommonDTO, user)); query.append("ORDER BY ptemgisslist_id DESC "); return getJdbcTemplate().queryForList(query.toString(maPtIssEmgCommonDTO.getIsLoadMaxCount(), maPtIssEmgCommonDTO.getFirstRow())); } /** * Filter 조건 * @author ssong * @version $Id:$ * @since 1.0 * * @param maPtIssEmgCommonDTO * @return * @throws Exception */ private String getWhere(MaPtIssEmgCommonDTO maPtIssEmgCommonDTO, User user) { QueryBuffer query = new QueryBuffer(); query.getAndQuery("x.ptemgissreq_id", maPtIssEmgCommonDTO.getPtemgissreqId()); query.getAndQuery("x.comp_no", user.getCompNo()); if (!"".equals(maPtIssEmgCommonDTO.getPtemgisslistId())) { query.getAndQuery("x.ptemgisslist_id", maPtIssEmgCommonDTO.getPtemgisslistId()); return query.toString(); } query.getAndDateQuery("issue_date", maPtIssEmgCommonDTO.getIssueDateFrom(), maPtIssEmgCommonDTO.getIssueDateTo()); query.getCodeLikeQuery("x.ptemgiss_status", "SFACODE_TO_DESC(x.ptemgiss_status,'PTEMGISS_STATUS','SYS','','"+user.getLangId()+"')", maPtIssEmgCommonDTO.getPtemgissStatus(), maPtIssEmgCommonDTO.getPtemgissStatusDesc()); query.getCodeLikeQuery("x.issue_dept", "(SELECT a.description FROM TADEPT a WHERE a.dpet_id = x.issue_dept) ", maPtIssEmgCommonDTO.getIssueDept(), maPtIssEmgCommonDTO.getIssueDeptDesc()); query.getCodeLikeQuery("x.ptemg_task_status", "SFACODE_TO_DESC(x.ptemg_task_status,'PTEMG_TASK_STATUS','SYS','','"+user.getLangId()+"')", maPtIssEmgCommonDTO.getPtemgTaskStatus(), maPtIssEmgCommonDTO.getPtemgTaskStatusDesc()); query.getAndNumKeyQuery("x.ptemgisslist_id", maPtIssEmgCommonDTO.getFilterPtemgisslistId()); query.getLikeQuery("y.full_desc", maPtIssEmgCommonDTO.getPartDesc()); query.getCodeLikeQuery("x.rec_by", "(SELECT a.emp_name FROM TAEMP a WHERE a.emp_id = x.rec_by AND a.comp_no = x.comp_no)", maPtIssEmgCommonDTO.getRecBy(), maPtIssEmgCommonDTO.getRecByName()); //요청부서 query.getDeptLevelQuery("x.req_dept", maPtIssEmgCommonDTO.getFilterReqDeptId(), maPtIssEmgCommonDTO.getFilterReqDeptDesc(), user.getCompNo()); //요청일자 query.getAndDateQuery("x.req_date", maPtIssEmgCommonDTO.getFilterReqStartDate(), maPtIssEmgCommonDTO.getFilterReqEndDate()); //요청자 query.getCodeLikeQuery("x.req_by", "(SELECT a.emp_name FROM TAEMP a WHERE a.emp_id = x.req_by AND a.comp_no = x.comp_no)", maPtIssEmgCommonDTO.getFilterReqById(), maPtIssEmgCommonDTO.getFilterReqByDesc()); //공장코드 query.getCodeLikeQuery("x.plant", "(SELECT description FROM TAPLANT WHERE comp_no = x.comp_no AND plant = x.plant )", maPtIssEmgCommonDTO.getFilterPlantId(), maPtIssEmgCommonDTO.getFilterPlantDesc()); //코스트센터 query.getCodeLikeQuery("x.ctctr_id", "(SELECT '('+a.ctctr_no+')' + a.description FROM TACTCTR a WHERE a.comp_no = x.comp_no AND a.ctctr_id = x.ctctr_id )", maPtIssEmgCommonDTO.getFilterCtctrId(), maPtIssEmgCommonDTO.getFilterCtctrDesc()); return query.toString(); } public int deletePtIssEmg(String ptemgisslist_id, User user) { QueryBuffer query = new QueryBuffer(); query.append("DELETE FROM TAPTEMGISSLIST "); query.append("WHERE ptemgisslist_id = ? "); query.append(" and comp_no = ? "); Object[] objects = new Object[]{ ptemgisslist_id ,user }; return this.getJdbcTemplate().update(query.toString(), objects); } @Override public String findTotalCount(MaPtIssEmgCommonDTO maPtIssEmgCommonDTO, User user) { QueryBuffer query = new QueryBuffer(); query.append("SELECT "); query.append(" COUNT(1) "); query.append("FROM TAPTEMGISSLIST x, TAPARTS y "); query.append("WHERE x.part_id = y.part_id "); query.append("AND x.comp_no = y.comp_no "); query.append(this.getWhere(maPtIssEmgCommonDTO,user)); List resultList= getJdbcTemplate().queryForList(query.toString()); return QueryBuffer.listToString(resultList); } }
[ "HN4741@10.31.0.185" ]
HN4741@10.31.0.185
b2c912122266a11d6deef5cbc469448d7208690f
b95dbc699136d004b2ca85d8cacb5419d2a23cc5
/SlideToUnlockView/src/main/java/com/qdong/slide_to_unlock_view/CustomSlideToUnlockView.java
b99c122280a6ffb04521f82106319397189be65d
[]
no_license
TangfeiJi/SlideToUnlockProject
f04aa581d136f85c857ba2c7b3b2945ead33c97e
8b316219e008fbe9bc4520accd4d58fa8ab6704a
refs/heads/master
2020-08-11T13:23:25.224475
2019-10-12T03:28:50
2019-10-12T03:28:50
214,571,719
3
1
null
null
null
null
UTF-8
Java
false
false
14,512
java
package com.qdong.slide_to_unlock_view; import android.content.Context; import android.content.res.TypedArray; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.github.florent37.viewanimator.AnimationListener; import com.github.florent37.viewanimator.ViewAnimator; import com.nineoldandroids.view.ViewHelper; /** **/ public class CustomSlideToUnlockView extends RelativeLayout { private static final String TAG="CustomSlideToUnlockView"; private static final long DEAFULT_DURATIN_LONG = 200;//左弹回,动画时长 private static final long DEAFULT_DURATIN_SHORT = 100;//右弹,动画时长 private static final boolean LOG = true;//打印开关 private static int DISTANCE_LIMIT = 600;//滑动阈值 private static float THRESHOLD = 0.5F;//滑动阈值比例:默认是0.5,即滑动超过父容器宽度的一半再松手就会触发 protected Context mContext; private ImageView iv_slide;//滑块 private TextView tv_hint;//提示文本 private RelativeLayout rl_slide;//滑动view private RelativeLayout rl_root;//父容器 private boolean mIsUnLocked;//已经滑到最右边,将不再响应touch事件 private CallBack mCallBack;//回调 private int slideImageViewWidth;//滑块宽度 private int slideImageViewResId;//滑块资源 private int slideImageViewResIdAfter;//滑动到右边时,滑块资源id private int viewBackgroundResId;//root 背景 private String textHint;//文本 private int textSize;//单位是sp,只拿数值 private int textColorResId;//颜色,@color public CustomSlideToUnlockView(Context mContext) { super(mContext); this.mContext = mContext; initView(); } public CustomSlideToUnlockView(Context mContext, AttributeSet attrs) { super(mContext, attrs); this.mContext = mContext; TypedArray mTypedArray = mContext.obtainStyledAttributes(attrs, R.styleable.SlideToUnlockView); init(mTypedArray); initView(); } public CustomSlideToUnlockView(Context mContext, AttributeSet attrs, int defStyleAttr) { super(mContext, attrs, defStyleAttr); this.mContext = mContext; TypedArray mTypedArray = mContext.obtainStyledAttributes(attrs, R.styleable.SlideToUnlockView); init(mTypedArray); initView(); } /** **/ private void init(TypedArray mTypedArray) { slideImageViewWidth= (int) mTypedArray.getDimension(R.styleable.SlideToUnlockView_slideImageViewWidth, DensityUtil.dp2px(getContext(), 50)); slideImageViewResId= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_slideImageViewResId, -1); slideImageViewResIdAfter= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_slideImageViewResIdAfter, -1); viewBackgroundResId= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_viewBackgroundResId, -1); textHint=mTypedArray.getString(R.styleable.SlideToUnlockView_textHint); textSize=mTypedArray.getInteger(R.styleable.SlideToUnlockView_textSize, 7); textColorResId= mTypedArray.getColor(R.styleable.SlideToUnlockView_textColorResId, getResources().getColor(android.R.color.white)); THRESHOLD=mTypedArray.getFloat(R.styleable.SlideToUnlockView_slideThreshold, 0.5f); mTypedArray.recycle(); } private int mActionDownX, mLastX, mSlidedDistance; /** * 初始化界面布局 */ protected void initView() { LayoutInflater.from(mContext).inflate(R.layout.layout_view_slide_to_unlock, this, true); rl_root = (RelativeLayout) findViewById(R.id.rl_root); rl_slide = (RelativeLayout) findViewById(R.id.rl_slide); iv_slide = (ImageView) findViewById(R.id.iv_slide); tv_hint = (TextView) findViewById(R.id.tv_hint); LayoutParams params= (LayoutParams) iv_slide .getLayoutParams(); //获取当前控件的布局对象 params.width= slideImageViewWidth;//设置当前控件布局的高度 iv_slide.setLayoutParams(params);//将设置好的布局参数应用到控件中 setImageDefault(); if(viewBackgroundResId>0){ // rl_slide.setBackgroundResource(viewBackgroundResId);//rootView设置背景 } MarginLayoutParams tvParams = (MarginLayoutParams) tv_hint.getLayoutParams(); tvParams.setMargins(0, 0, slideImageViewWidth, 0);//textview的marginRight设置为和滑块的宽度一致 tv_hint.setLayoutParams(tvParams); tv_hint.setTextSize(DensityUtil.sp2px(getContext(), textSize)); tv_hint.setTextColor(textColorResId); tv_hint.setText(TextUtils.isEmpty(textHint)? mContext.getString(R.string.hint):textHint); //添加滑动监听 rl_slide.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { DISTANCE_LIMIT= (int) (CustomSlideToUnlockView.this.getWidth()*THRESHOLD);//默认阈值是控件宽度的一半 switch (event.getAction()) { case MotionEvent.ACTION_DOWN://按下时记录纵坐标 if(mIsUnLocked){//滑块已经在最右边则不处理touch return false; } mLastX = (int) event.getRawX();//最后一个action时x值 mActionDownX = (int) event.getRawX();//按下的瞬间x logI(TAG, mLastX + "X,=============================ACTION_DOWN"); break; case MotionEvent.ACTION_MOVE://上滑才处理,如果用户一开始就下滑,则过掉不处理 logI(TAG, "=============================ACTION_MOVE"); logI(TAG, "event.getRawX()============================="+event.getRawX()); int dX = (int) event.getRawX() - mLastX; logI(TAG, "dX============================="+dX); mSlidedDistance = (int) event.getRawX() - mActionDownX; logI(TAG, "mSlidedDistance============================="+ mSlidedDistance); final MarginLayoutParams params = (MarginLayoutParams) v.getLayoutParams(); int left = params.leftMargin; int top = params.topMargin; int right = params.rightMargin; int bottom = params.bottomMargin; logI(TAG, "left:"+left+",top:"+top+",right:"+right+",bottom"+bottom); int leftNew = left + dX; int rightNew =right - dX; if (mSlidedDistance > 0) {//直接通过margin实现滑动 params.setMargins(leftNew, top, rightNew, bottom); logI(TAG, leftNew + "=============================MOVE"); v.setLayoutParams(params); resetTextViewAlpha(mSlidedDistance); //回调 if(mCallBack!=null){ mCallBack.onSlide(mSlidedDistance); } mLastX = (int) event.getRawX(); } else { return true; } break; case MotionEvent.ACTION_UP: logI(TAG, "MotionEvent.ACTION_UP,之前移动的偏移值:" + ViewHelper.getTranslationY(v)); if (Math.abs(mSlidedDistance) > DISTANCE_LIMIT) { scrollToRight(v);//右边 // scrollToLeft(v);//左边 } else { scrollToLeft(v);//左边 } break; case MotionEvent.ACTION_CANCEL: // try { // if (vTracker != null) { // vTracker.recycle(); // vTracker = null; // } // vTracker.recycle(); // } catch (Exception e) { // e.printStackTrace(); // } break; } return true; } }); } private void logI(String tag,String content){ if(LOG){ Log.i(tag,content); } } /** * @method name:resetTextViewAlpha * @des: 重置提示文本的透明度 * @param :[mSlidedDistance] * @return type:void * @date 创建时间:2017/5/24 * @author Chuck **/ private void resetTextViewAlpha(int distance) { if(Math.abs(distance)>=Math.abs(DISTANCE_LIMIT)){ tv_hint.setAlpha(0.0f); } else{ tv_hint.setAlpha(1.0f-Math.abs(distance)*1.0f/Math.abs(DISTANCE_LIMIT)); } } /** * @method name:scrollToLeft * @des: 滑动未到阈值时松开手指,弹回到最左边 * @param :[v] * @return type:void * @date 创建时间:2017/5/24 * @author Chuck **/ private void scrollToLeft(final View v) { final MarginLayoutParams params1 = (MarginLayoutParams) v.getLayoutParams(); logI(TAG, "scrollToLeft,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v)); logI(TAG, "scrollToLeft,params1.leftMargin:" + params1.leftMargin); logI(TAG, "scrollToLeft, params1.rightMargin:" + params1.rightMargin); ViewAnimator .animate( rl_slide) .translationX(ViewHelper.getTranslationX(v), -params1.leftMargin+15) .interpolator(new AccelerateInterpolator()) .duration(DEAFULT_DURATIN_LONG) .onStop(new AnimationListener.Stop() { @Override public void onStop() { MarginLayoutParams para = (MarginLayoutParams) v.getLayoutParams(); logI(TAG, "scrollToLeft动画结束para.leftMargin:" + para.leftMargin); logI(TAG, "scrollToLeft动画结束para.rightMargin:" + para.rightMargin); logI(TAG, "scrollToLeft动画结束,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v)); mSlidedDistance = 0; tv_hint.setAlpha(1.0f); mIsUnLocked=false; if(mCallBack!=null){ mCallBack.onSlide(mSlidedDistance); } setImageDefault(); } }) .start(); } /** * @method name:scrollToRight * @des:滑动到右边,并触发回调 * @param :[v] * @return type:void * @date 创建时间:2017/5/24 * @author Chuck **/ private void scrollToRight(final View v) { final MarginLayoutParams params1 = (MarginLayoutParams) v.getLayoutParams(); logI(TAG, "scrollToRight,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v)); logI(TAG, "scrollToRight,params1.leftMargin:" + params1.leftMargin); logI(TAG, "scrollToRight, params1.rightMargin:" + params1.rightMargin); //移动到最右端 移动的距离是 父容器宽度-leftMargin ViewAnimator .animate( rl_slide) //.translationX(ViewHelper.getTranslationX(v), ViewHelper.getTranslationX(v)+100) .translationX(ViewHelper.getTranslationX(v), -params1.leftMargin+15) // .translationX(ViewHelper.getTranslationX(v), ( rl_slide.getWidth() - params1.leftMargin-slideImageViewWidth)) //.translationX(params1.leftMargin, ( rl_slide.getWidth() - params1.leftMargin-100)) .interpolator(new AccelerateInterpolator()) .duration(DEAFULT_DURATIN_SHORT) .onStop(new AnimationListener.Stop() { @Override public void onStop() { MarginLayoutParams para = (MarginLayoutParams) v.getLayoutParams(); logI(TAG, "scrollToRight动画结束para.leftMargin:" + para.leftMargin); logI(TAG, "scrollToRight动画结束para.rightMargin:" + para.rightMargin); logI(TAG, "scrollToRight动画结束,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v)); mSlidedDistance = 0; tv_hint.setAlpha(1.0f); mIsUnLocked=false; // if(slideImageViewResIdAfter>0){ // iv_slide.setImageResource(slideImageViewResIdAfter);//滑块imagview设置资源 // } //回调 if(mCallBack!=null){ mCallBack.onUnlocked(); } } }) .start(); } public void resetView(){ mIsUnLocked=false; setImageDefault(); scrollToLeft(rl_slide); } private void setImageDefault() { /** * @method name:setImageDefault * @des: 设置默认图片 * @param :[] * @return type:void * @date 创建时间:2017/5/25 * @author Chuck **/ if(slideImageViewResId>0){ iv_slide.setImageResource(slideImageViewResId);//滑块imagview设置资源 } } public interface CallBack{ void onSlide(int distance);//右滑距离回调 void onUnlocked();//滑动到了右边,事件回调 } public CallBack getmCallBack() { return mCallBack; } public void setmCallBack(CallBack mCallBack) { this.mCallBack = mCallBack; } }
[ "1009112964@qq.com" ]
1009112964@qq.com
04aa50fd0d2d93c50841821309c2b519ee6fcc9b
4d6c00789d5eb8118e6df6fc5bcd0f671bbcdd2d
/src/main/java/com/alipay/api/response/AlipayAcquireCreateandpayResponse.java
1d5cce4189d6ef89638a328a0360e14563b9ec17
[ "Apache-2.0" ]
permissive
weizai118/payment-alipay
042898e172ce7f1162a69c1dc445e69e53a1899c
e3c1ad17d96524e5f1c4ba6d0af5b9e8fce97ac1
refs/heads/master
2020-04-05T06:29:57.113650
2018-11-06T11:03:05
2018-11-06T11:03:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,396
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.acquire.createandpay response. * * @author auto create * @since 1.0, 2018-08-24 17:34:55 */ public class AlipayAcquireCreateandpayResponse extends AlipayResponse { private static final long serialVersionUID = 4754928525878159587L; /** * 买家支付宝账号,可以为email或者手机号。对部分信息进行了隐藏。 */ @ApiField("buyer_logon_id") private String buyerLogonId; /** * 买家支付宝账号对应的支付宝唯一用户号。 以2088开头的纯16位数字。 */ @ApiField("buyer_user_id") private String buyerUserId; /** * 对返回响应码进行原因说明,请参见“10.2 业务错误码”。 当result_code响应码为ORDER_SUCCESS_PAY_SUCCESS时,不返回该参数。 */ @ApiField("detail_error_code") private String detailErrorCode; /** * 对详细错误码进行文字说明。 当result_code响应码为ORDER_SUCCESS_PAY_SUCCESS时,不返回该参数。 */ @ApiField("detail_error_des") private String detailErrorDes; /** * 支付后返回的其他信息,如预付卡金额,key值mcard_fee,以Json格式返回。 */ @ApiField("extend_info") private String extendInfo; /** * 7085502131376415 */ @ApiField("out_trade_no") private String outTradeNo; /** * 下单并支付处理结果响应码,请参见“10.1 业务响应码”。 */ @ApiField("result_code") private String resultCode; /** * 该交易在支付宝系统中的交易流水号。 最短16位,最长64位。 */ @ApiField("trade_no") private String tradeNo; /** * Sets buyer logon id. * * @param buyerLogonId the buyer logon id */ public void setBuyerLogonId(String buyerLogonId) { this.buyerLogonId = buyerLogonId; } /** * Gets buyer logon id. * * @return the buyer logon id */ public String getBuyerLogonId( ) { return this.buyerLogonId; } /** * Sets buyer user id. * * @param buyerUserId the buyer user id */ public void setBuyerUserId(String buyerUserId) { this.buyerUserId = buyerUserId; } /** * Gets buyer user id. * * @return the buyer user id */ public String getBuyerUserId( ) { return this.buyerUserId; } /** * Sets detail error code. * * @param detailErrorCode the detail error code */ public void setDetailErrorCode(String detailErrorCode) { this.detailErrorCode = detailErrorCode; } /** * Gets detail error code. * * @return the detail error code */ public String getDetailErrorCode( ) { return this.detailErrorCode; } /** * Sets detail error des. * * @param detailErrorDes the detail error des */ public void setDetailErrorDes(String detailErrorDes) { this.detailErrorDes = detailErrorDes; } /** * Gets detail error des. * * @return the detail error des */ public String getDetailErrorDes( ) { return this.detailErrorDes; } /** * Sets extend info. * * @param extendInfo the extend info */ public void setExtendInfo(String extendInfo) { this.extendInfo = extendInfo; } /** * Gets extend info. * * @return the extend info */ public String getExtendInfo( ) { return this.extendInfo; } /** * Sets out trade no. * * @param outTradeNo the out trade no */ public void setOutTradeNo(String outTradeNo) { this.outTradeNo = outTradeNo; } /** * Gets out trade no. * * @return the out trade no */ public String getOutTradeNo( ) { return this.outTradeNo; } /** * Sets result code. * * @param resultCode the result code */ public void setResultCode(String resultCode) { this.resultCode = resultCode; } /** * Gets result code. * * @return the result code */ public String getResultCode( ) { return this.resultCode; } /** * Sets trade no. * * @param tradeNo the trade no */ public void setTradeNo(String tradeNo) { this.tradeNo = tradeNo; } /** * Gets trade no. * * @return the trade no */ public String getTradeNo( ) { return this.tradeNo; } }
[ "hanley@thlws.com" ]
hanley@thlws.com
57a2706c324e1b457756f5330c26f614925d2b6d
d57fb91f27e4c00963ff8617296f28864f5daf55
/Editor_Server/src/server/connect/Connect.java
9313a4315126f462a8b58d3044e081a7491e4eb5
[]
no_license
helbertmoreirapinto/Editor_Texto_Colaborativo
a00f36407cb3e117b9e0e607d95f27a50a2dad30
830a5db207eb27648881a48e5b1578bcba7e4bf4
refs/heads/master
2020-07-31T19:11:25.251169
2019-11-29T15:56:14
2019-11-29T15:56:14
210,719,365
0
0
null
null
null
null
UTF-8
Java
false
false
1,388
java
package server.connect; /** * * @author helbert */ public abstract class Connect { public static final int PORT_USUARIO = 6060; public static final int PORT_FILE = 6160; public static final int PORT_EDIT_FILE = 6260; protected final String SEP_CAMPOS = "!!"; protected final String SEP_REGS = "!_!"; protected final String COMAND_STATUS = "00"; protected final String FILE_DUPLICADO = "01"; protected final String COMAND_FILELIST = "11"; protected final String COMAND_GET_FILE = "12"; protected final String COMAND_NEW_FILE = "13"; protected final String COMAND_REPLACE_FILE = "14"; protected final String COMAND_FILE_DATA_UPD = "15"; protected final String COMAND_RENAME_FILE = "16"; protected final String COMANDO_LOGAR = "21"; protected final String COMAND_USERLIST = "22"; protected final String COMAND_GET_USER = "23"; protected final String COMAND_SAVE_USER = "24"; protected final String COMAND_UPD_USER = "25"; protected final String COMAND_SEND_TEXT = "31"; protected final String COMAND_GET_TEXT = "32"; protected final String COMAND_USER_ONLINE = "33"; protected final String COMAND_EXIT = "34"; /** * * @param delay * @throws InterruptedException */ protected void delay(int delay) throws InterruptedException { Thread.sleep(delay); } }
[ "helbert.tec.info@gmail.com" ]
helbert.tec.info@gmail.com
87f271f86778ded25baf05cf2983afb0801972f4
b22e58f1f58bac2099e1339d0c3c94897e1ac3b1
/app/src/test/java/pk/gexton/chatappfirebase/ExampleUnitTest.java
82e8530cc2a70eb1a268149a52df991cb5c140c4
[]
no_license
MuhammadHusnain007/Chat-APP-With-Firebase
9bff6a67e574ce9654b5e6b024381c47792352d7
be8f05d876601ba653a79fac2c5fad38e4bda273
refs/heads/master
2021-01-04T17:23:03.957183
2020-02-15T10:12:54
2020-02-15T10:12:54
240,683,437
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package pk.gexton.chatappfirebase; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "muhammadhusnain16777@gmail.com" ]
muhammadhusnain16777@gmail.com
d80825f1287859f018ec135ac10e585b6835a08b
e36f288270ebb9596c59066541c7e8e8687adf5a
/src/chapter19/SetDemo.java
e586aeec033fff3f4bcf9d8a83be455b1662880c
[]
no_license
mrthetkhine/JavaSE2Batch
6110c0e2b397b17d4b70d6adc9baf26dc4a73957
7bc4e3c75fdfd1fb8b58589692ff35d9c74b1123
refs/heads/master
2020-05-24T16:07:45.533311
2019-07-14T12:59:33
2019-07-14T12:59:33
187,349,275
9
5
null
null
null
null
UTF-8
Java
false
false
461
java
package chapter19; import java.util.HashSet; import java.util.Set; public class SetDemo { public static void main(String[]args) { Set<String> hashSet = new HashSet<String>(); hashSet.add("One"); hashSet.add("Two"); hashSet.add("One"); hashSet.add("Three"); System.out.println("Size "+ hashSet.size()); System.out.println("Contain three "+hashSet.contains("Three")); for(String s : hashSet) { System.out.println(s); } } }
[ "mrthetkhine@gmail.com" ]
mrthetkhine@gmail.com
4bd8fc7b45448f61fa194b59295c67658fd5140c
2372881317e394121039ef82f384827a0f331086
/src/main/java/study/spring/hellospring/MailController.java
e415027870f0d4563b20daff5a43fe49e4405db8
[]
no_license
yogurtaa3/StudentAPI
35d81fb3f33b3174dda52841537b65b0a2a08a1e
1c83dba90452e98d7fb1b5481fe8afd3f4405ed7
refs/heads/master
2020-05-17T05:35:25.922428
2019-04-26T05:21:32
2019-04-26T05:21:32
183,538,874
0
0
null
null
null
null
UTF-8
Java
false
false
2,378
java
package study.spring.hellospring; import java.util.Locale; import javax.mail.MessagingException; 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 org.springframework.web.servlet.ModelAndView; import study.spring.helper.MailHelper; import study.spring.helper.RegexHelper; import study.spring.helper.WebHelper; @Controller public class MailController { /* 객체 주입 설정 */ @Autowired WebHelper web; @Autowired RegexHelper regex; @Autowired MailHelper mail; /** 메일 작성 폼을 구현하기 위한 컨트롤러 */ @RequestMapping(value="/mail/write.do", method=RequestMethod.GET) public ModelAndView write(Locale locale, Model model) { web.init(); return new ModelAndView("mail/write"); } /** 메일 발송처리를 구현할 컨트롤러 */ @RequestMapping(value="/mail/mail_ok.do", method=RequestMethod.POST) public ModelAndView mailOK(Locale locale, Model model) { // Webhelper 초기화 처리 web.init(); /** 파라미터 받기 */ String sender = web.getString("sender"); String receiver = web.getString("receiver"); String subject = web.getString("subject"); String content = web.getString("content"); // 입력여부 검사 후, 입력되지 않은 경우 이전 페이지로 보내기 if (!regex.isEmail(sender)) { return web.redirect(null, "보내는 사람의 주소가 맞지 않습니다."); } if (!regex.isEmail(receiver)) { return web.redirect(null, "받는 사람의 주소가 맞지 않습니다."); } if (!regex.isValue(subject)) { return web.redirect(null, "메일 제목을 입력하세요."); } if (!regex.isValue(content)) { return web.redirect(null, "메일의 내용을 입력하세요."); } /** 메일 발송 처리 */ try { mail.sendMail(sender, receiver, subject, content); } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); } // 페이지 이동을 WebHelper를 사용해서 처리 가능하다. // --> Webhelper 사용시 메시지 표시 후 이동이 가능하다. return web.redirect("write.do", "메일이 발송되었습니다."); } }
[ "47968957+yogurtaa3@users.noreply.github.com" ]
47968957+yogurtaa3@users.noreply.github.com
a327f2bf6eb35839b4529c322c1756bd25c3dd6d
87af9f62fcf4156ad1faf071769376346930414f
/spring-gateway/src/main/java/com/hq/SpringGatewayApplication.java
e52efd1b08723bb8f3c973358df37e1c1cceb407
[]
no_license
hq0819/springcloud-alibaba
75c53e33f57e05b9ece48f3fcb2d23f2f0676a1f
05e2b552ed9afa6373b97c18aa82167663eeb2f8
refs/heads/master
2023-05-30T14:24:55.603853
2021-06-11T09:54:23
2021-06-11T09:54:23
367,231,867
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package com.hq; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class SpringGatewayApplication { public static void main(String[] args) { SpringApplication.run(SpringGatewayApplication.class, args); } }
[ "422446213@qq.com" ]
422446213@qq.com
d9b027cd280d1e98708c4fa7770eb191bb608c79
2766d931c59982bb66ee897b12a200724aecf6a7
/src/advent16.java
845732c233bc45c10dc5846b1fa7d3749f03597d
[]
no_license
ElaineMou/advent-of-code-2016
85b356a0e8d113db75ca7041af23d0d7619422dd
53ce6bbcf15217e1a44ebb34e099cdef09620faf
refs/heads/master
2021-01-19T08:44:59.368664
2017-04-08T22:28:23
2017-04-08T22:28:23
87,667,928
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
/** * Created by Elaine on 12/20/2016. */ public class advent16 { public static void main(String[] args) { String INPUT = "10011111011011001"; int MAX_LENGTH = 35651584; StringBuffer sb = new StringBuffer(); sb.append(INPUT); while(sb.length() < MAX_LENGTH) { String a = sb.toString(); StringBuffer sb2 = new StringBuffer(a); char[] b = sb2.reverse().toString().toCharArray(); for(int i=0;i<b.length;i++) { if (b[i] == '0') { b[i] = '1'; } else { b[i] = '0'; } } sb.append('0' + new String(b)); } StringBuffer checksum = new StringBuffer(); String data = sb.toString().substring(0,MAX_LENGTH); while(checksum.length()%2 != 1) { checksum = new StringBuffer(); for (int i = 0; i < data.length();i+= 2) { checksum.append((data.charAt(i) == data.charAt(i+1)) ? '1' : '0'); } data = checksum.toString(); } System.out.println(checksum.toString()); } }
[ "elaine-mou@uiowa.edu" ]
elaine-mou@uiowa.edu
3f122fce8928f32a6ddcbf348a513ca82b6b9fd1
43c55843b76363355f7c45d2dd3c3117b145d8e1
/src/Aph/DAO/Impl/UI/signInUI.java
a4c355367cf03a8cbc8d570a985896590511197a
[]
no_license
rmedard/Rwandaform-Stock-Manager
90cbfff703f5f36434d1ba4b184bd70b66d5d85a
48d0653ba9e3bc21deb554ad430b5479e501c33a
refs/heads/master
2021-01-20T01:03:10.823612
2013-06-23T20:52:46
2013-06-23T20:52:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,451
java
package Aph.DAO.Impl.UI; import Aph.DAO.ConnectionInit; import Aph.User; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.JPasswordField; /* * signInUI.java * * Created on Dec 18, 2010, 12:01:23 PM */ /** * * @author Medard */ public class signInUI extends javax.swing.JFrame { private String nomUtilisateur; private String motDePasse, status; private Statement stmt; private UsersUI usersUI; private Gestion_Citerne gestionCiterne; private Gestion_Produit gestionProduit; private Gestion_blocks gestionBlocks; private ConnectionInit connectionInit; private Connection con = null; private DAOS daos; /** Creates new form signInUI */ public signInUI() { initComponents(); connectionInit = new ConnectionInit(); gestionCiterne = new Gestion_Citerne(); gestionProduit = new Gestion_Produit(); gestionBlocks = new Gestion_blocks(); usersUI = new UsersUI(); gestionCiterne.setDefaultCloseOperation(DISPOSE_ON_CLOSE); gestionProduit.setDefaultCloseOperation(DISPOSE_ON_CLOSE); gestionBlocks.setDefaultCloseOperation(DISPOSE_ON_CLOSE); usersUI.setDefaultCloseOperation(DISPOSE_ON_CLOSE); con = connectionInit.getCon(); this.setTitle("Login"); daos = new DAOS(); } public DAOS getDaos() { return daos; } public JPasswordField getPswdMotDePasse() { return pswdMotDePasse; } public void setPswdMotDePasse(JPasswordField pswdMotDePasse) { this.pswdMotDePasse = pswdMotDePasse; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { brownSugar1 = new com.jgoodies.looks.plastic.theme.BrownSugar(); desertBlue1 = new com.jgoodies.looks.plastic.theme.DesertBlue(); desertBlue2 = new com.jgoodies.looks.plastic.theme.DesertBlue(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtUtilisateur = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); cbxStatus = new javax.swing.JCheckBox(); btnLogin = new javax.swing.JButton(); btnAnnuler = new javax.swing.JButton(); pswdMotDePasse = new javax.swing.JPasswordField(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Colonna MT", 3, 24)); jLabel1.setText("Nouvelle session "); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); jLabel2.setText("Nom d'utilisateur"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); jLabel3.setText("Mot de passe"); cbxStatus.setText("Rester connecté"); cbxStatus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbxStatusActionPerformed(evt); } }); btnLogin.setBackground(java.awt.Color.lightGray); btnLogin.setFont(new java.awt.Font("Tahoma", 1, 10)); btnLogin.setText("Connecter"); btnLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLoginActionPerformed(evt); } }); btnAnnuler.setBackground(java.awt.Color.lightGray); btnAnnuler.setFont(new java.awt.Font("Tahoma", 1, 10)); btnAnnuler.setText("Annuler"); btnAnnuler.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAnnulerActionPerformed(evt); } }); jMenu1.setText("File"); jMenuItem1.setText("Login"); jMenu1.add(jMenuItem1); jMenuItem2.setText("Cancel"); jMenu1.add(jMenuItem2); jMenuBar1.add(jMenu1); jMenu2.setText("Help"); jMenuItem3.setText("About"); jMenu2.add(jMenuItem3); jMenuItem4.setText("Help"); jMenu2.add(jMenuItem4); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(97, 97, 97) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(pswdMotDePasse) .addComponent(txtUtilisateur, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) .addComponent(cbxStatus, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnAnnuler, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtUtilisateur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnLogin)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(btnAnnuler) .addComponent(pswdMotDePasse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cbxStatus) .addContainerGap(11, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed nomUtilisateur = txtUtilisateur.getText(); motDePasse = new String(pswdMotDePasse.getPassword()); String userName = null; String passWord = null; String grade = null; try { if (nomUtilisateur.length() == 0) { JOptionPane.showMessageDialog(null, "Veuillez entrer votre nom d'utilisateur", "Halte", JOptionPane.ERROR_MESSAGE); txtUtilisateur.requestFocus(); } else if (motDePasse.length() == 0) { JOptionPane.showMessageDialog(null, "Veuillez entrer votre mot de passe", "Halte", JOptionPane.ERROR_MESSAGE); pswdMotDePasse.requestFocus(); } else { try { stmt = con.createStatement(); String sql = "SELECT username,password FROM aphrodis.user WHERE username = '" + nomUtilisateur + "'"; ResultSet rs = stmt.executeQuery(sql); rs.next(); userName = rs.getString("username"); passWord = rs.getString("password"); if (userName == null || passWord == null) { JOptionPane.showMessageDialog(null, "Nom d'utilisateur n'existe pas. Veuillez réessayer" + userName + passWord, "Halte", JOptionPane.ERROR_MESSAGE); } else { User user = getDaos().getUserDAO().getUserByUsername(userName); if (user.getPassword().equals(motDePasse)) { String logger = "SELECT grade FROM aphrodis.user WHERE username = \'" + userName + "\'"; ResultSet rsLogger = stmt.executeQuery(logger); while (rsLogger.next()) { grade = rsLogger.getString("grade"); if (grade.equals("admin")) { usersUI.setVisible(true); } else if (grade.equals("citerne")) { gestionCiterne.setVisible(true); } else if (grade.equals("mat_prm")) { gestionProduit.setVisible(true); } else if (grade.equals("prod_sfini")) { gestionBlocks.setVisible(true); gestionBlocks.setSignIn(this); } } } else { JOptionPane.showMessageDialog(null, "Nom d'utilisateur ou mot de passe érroné", "Halte", JOptionPane.ERROR_MESSAGE); } } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Connection échouée, vérifiez vos paramètres de connectivité", "Erreur", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Erreur de connectivité", "Erreur", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_btnLoginActionPerformed private void btnAnnulerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnnulerActionPerformed int i = JOptionPane.showConfirmDialog(null, "Voulez-vous quitter l'application?", "Confirmer", JOptionPane.YES_NO_CANCEL_OPTION); if (i == JOptionPane.YES_OPTION) { System.exit(0); } }//GEN-LAST:event_btnAnnulerActionPerformed private void cbxStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxStatusActionPerformed if (cbxStatus.isSelected()) { status = "on"; } else { status = "off"; } }//GEN-LAST:event_cbxStatusActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new signInUI().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private com.jgoodies.looks.plastic.theme.BrownSugar brownSugar1; private javax.swing.JButton btnAnnuler; private javax.swing.JButton btnLogin; private javax.swing.JCheckBox cbxStatus; private com.jgoodies.looks.plastic.theme.DesertBlue desertBlue1; private com.jgoodies.looks.plastic.theme.DesertBlue desertBlue2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; public javax.swing.JPasswordField pswdMotDePasse; private javax.swing.JTextField txtUtilisateur; // End of variables declaration//GEN-END:variables }
[ "rmedard5@gmail.com" ]
rmedard5@gmail.com
08bb8d1ccdc02ea17597c23a88bc1d7e0c805077
a36f9131c8cbcc08f175dcd0bb1eef58893f3bd6
/Maven-Project-Hibernate-Relations-Console/src/main/java/com/fjcuervas/util/Util.java
e5882ae4e13495973cb5368fbab700cf24c729a6
[]
no_license
fjcuervas/JavaEE
7b67435d5d0ae5f7798cb496b4b217ab9c1f1ebc
17dc8e8d327475bd5a899049379262163751ce64
refs/heads/master
2022-07-02T13:08:38.526500
2019-10-07T10:11:07
2019-10-07T10:11:07
208,599,854
0
0
null
2022-06-21T04:04:30
2019-09-15T13:40:57
Java
UTF-8
Java
false
false
3,301
java
package com.fjcuervas.util; import java.sql.Date; import java.time.LocalDate; import com.fjcuervas.entity.AreaGeografica; import com.fjcuervas.entity.Automovil; import com.fjcuervas.entity.AutomovilPK; import com.fjcuervas.entity.Direccion; import com.fjcuervas.entity.Empresa; import com.fjcuervas.entity.Mascota; import com.fjcuervas.entity.NombreCompleto; import com.fjcuervas.entity.Parking; import com.fjcuervas.entity.Persona; import com.fjcuervas.entity.TipoMascota; public class Util { public static Persona crearPersonaSimple() { NombreCompleto nombreCompleto = new NombreCompleto("Esperanza", "", "Cuervas", "Muñoz"); return new Persona("34343434Q", Date.valueOf(LocalDate.of(1980, 7, 19)), nombreCompleto); } public static Persona crearPersona() { Direccion direccion = crearDireccion(); NombreCompleto nombreCompleto = crearNombreCompleto(); return new Persona("93270546Q", Date.valueOf(LocalDate.of(1982, 1, 15)), nombreCompleto, direccion); } public static Persona crearPersona2() { Direccion direccion = crearDireccion2(); NombreCompleto nombreCompleto = crearNombreCompleto2(); return new Persona("25465455Q", Date.valueOf(LocalDate.of(1975, 3, 20)), nombreCompleto, direccion); } public static Automovil crearAutomovil() { return new Automovil(new AutomovilPK("SE-5341","ESP"),"Opel","Corsa","2017","Rojo","14000"); } public static Persona insertarParking(Persona persona) { persona.setParking(new Parking("Castelao", "S-1", persona)); return persona; } public static Persona insertarParking2(Persona persona) { persona.setParking(new Parking("Alavera", "S-2", persona)); return persona; } public static Parking crearParking() { return new Parking("Castelao", "S-1"); } public static NombreCompleto crearNombreCompleto() { return new NombreCompleto("Francisco", "Javier", "Cuervas", "Muñoz"); } public static NombreCompleto crearNombreCompleto2() { return new NombreCompleto("Julio", "Alberto", "Moo", "Fernandez"); } public static Direccion crearDireccion() { return new Direccion("El Bus", 41927); } public static Direccion crearDireccion2() { return new Direccion("Alero de Sevilla", 41927); } public static Persona insertarMascotas(Persona persona) { persona.getMascotas().add(new Mascota("Yaki", TipoMascota.PERRO, persona)); persona.getMascotas().add(new Mascota("Lulu", TipoMascota.GATO, persona)); persona.getMascotas().add(new Mascota("Yasmin", TipoMascota.CONEJO, persona)); return persona; } public static Persona insertarMascotas2(Persona persona) { persona.getMascotas().add(new Mascota("Nemo", TipoMascota.PERRO, persona)); persona.getMascotas().add(new Mascota("Sira", TipoMascota.PERRO, persona)); return persona; } private Util() { } public static Automovil insertarEmpresa(Automovil automovil) { automovil.getPatrocinadores().add(new Empresa("A1234567", "Red Bull", "Bebida energética S.A.",automovil)); automovil.getPatrocinadores().add(new Empresa("B3453241", "Telefónica", "Red de telefonía S.A.",automovil)); automovil.getPatrocinadores().add(new Empresa("C9367933", "Gas Natural", "Red suministro energético S.A.",automovil)); return automovil; } }
[ "jcuervas@AT-6GHC4Q2.atsistemas.lan" ]
jcuervas@AT-6GHC4Q2.atsistemas.lan
777ce04869cf4b3c75296e472c65ff23fd4b1298
154147743038e4100911ebe07c9404ba5f75e464
/dora-uicomponent/src/main/java/dora/widget/panel/IMenu.java
9cd4e0f3079e3a3e0175ca53081725b049150ccf
[ "Apache-2.0" ]
permissive
wuguanjun/dora
9cb5343428aa05ed37d6452f30313ace19762438
b7e34bdc48434a72b16bea58e2d6ee72c7131a86
refs/heads/master
2023-02-03T12:22:41.190851
2020-12-14T16:58:58
2020-12-14T16:58:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package dora.widget.panel; public interface IMenu { String getMenuName(); }
[ "dora924666990@gmail.com" ]
dora924666990@gmail.com
7b67c8baffd0b942eeedc7a16af6f64c8bc5c98b
8a6ebf9a2bd0870fa216a188a140be220d72a093
/src/Solution1338.java
e563497c68fa0e0b903a2f201bd7e65f6ecc92b3
[]
no_license
rafaelcrvmachado/leetcode
c8f0d684d97140b9f70687f9958f85010d1e278a
c89e86ca97156e4baa2c1bf2872c6bc274b80ce2
refs/heads/master
2023-06-17T13:05:24.786580
2021-07-13T11:24:45
2021-07-13T11:24:45
384,660,652
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
import java.util.HashMap; import java.util.Set; public class Solution1338 { public int minSetSize(int[] arr) { HashMap<Integer, Integer> occurrences = new HashMap<>(); for (int e : arr) { occurrences.merge(e, 1, Integer::sum); } int l = arr.length/2; int count = 0; int n = 0; while (n < l) { Set<Integer> keySet = occurrences.keySet(); int maxKey=keySet.stream().findFirst().get(); int maxValue = occurrences.get(maxKey); for (Integer e : keySet) { int value = occurrences.get(e); if (value > maxValue){ maxKey = e; maxValue = value; } } count++; n += maxValue; occurrences.remove(maxKey); } return count; } }
[ "rafaelcrvmachado@gmail.com" ]
rafaelcrvmachado@gmail.com
d3fac46b012c468cb97071c9fd25deb0384080e5
508e3cd2dcb909baa703c651fa1f35079b791738
/src/Utils/Kernel32.java
92914be276ca33cc0a0e61355004be7dbbfb5ecb
[]
no_license
Emil-ADA/CSCI2304-TermProject-EasyMetro
1792b052e0558eef49476e9e4d05b326dd176ecf
b22211435b34cdb8119804be98256f7bd3b86b8b
refs/heads/master
2022-09-17T02:36:57.837036
2020-05-29T23:36:41
2020-05-29T23:37:23
255,817,692
2
1
null
null
null
null
UTF-8
Java
false
false
3,238
java
package Utils; import java.util.ArrayList; import java.util.List; import com.sun.jna.Native; import com.sun.jna.Structure; import com.sun.jna.win32.StdCallLibrary; public interface Kernel32 extends StdCallLibrary { public Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("Kernel32", Kernel32.class); /** * @see "http://msdn2.microsoft.com/en-us/library/aa373232.aspx" */ public class SYSTEM_POWER_STATUS extends Structure { public byte ACLineStatus; public byte BatteryFlag; public byte BatteryLifePercent; public byte Reserved1; public int BatteryLifeTime; public int BatteryFullLifeTime; @Override protected List<String> getFieldOrder() { ArrayList<String> fields = new ArrayList<String>(); fields.add("ACLineStatus"); fields.add("BatteryFlag"); fields.add("BatteryLifePercent"); fields.add("Reserved1"); fields.add("BatteryLifeTime"); fields.add("BatteryFullLifeTime"); return fields; } /** * The AC power status */ public String getACLineStatusString() { switch (ACLineStatus) { case (0): return "Offline"; case (1): return "Online"; default: return "Unknown"; } } /** * The battery charge status */ public String getBatteryFlagString() { switch (BatteryFlag) { case (1): return "High, more than 66 percent"; case (2): return "Low, less than 33 percent"; case (4): return "Critical, less than five percent"; case (8): return "Charging"; case ((byte) 128): return "No system battery"; default: return "Unknown"; } } /** * The percentage of full battery charge remaining */ public String getBatteryLifePercent() { return (BatteryLifePercent == (byte) 255) ? "Unknown" : BatteryLifePercent + "%"; } /** * The number of seconds of battery life remaining */ public String getBatteryLifeTime() { return (BatteryLifeTime == -1) ? "Unknown" : BatteryLifeTime + " seconds"; } /** * The number of seconds of battery life when at full charge */ public String getBatteryFullLifeTime() { return (BatteryFullLifeTime == -1) ? "Unknown" : BatteryFullLifeTime + " seconds"; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ACLineStatus: " + getACLineStatusString() + "\n"); sb.append("Battery Flag: " + getBatteryFlagString() + "\n"); sb.append("Battery Life: " + getBatteryLifePercent() + "\n"); sb.append("Battery Left: " + getBatteryLifeTime() + "\n"); sb.append("Battery Full: " + getBatteryFullLifeTime() + "\n"); return sb.toString(); } } /** * Fill the structure. */ public int GetSystemPowerStatus(SYSTEM_POWER_STATUS result); }
[ "sadigaxund@gmail.com" ]
sadigaxund@gmail.com
28e1af3682917c167309cceb0ac9a608c79be6b0
8addfb8d5ae1d04ce5a554f08fbaaaed3abf89e1
/src/popups/Child_Popup.java
58351c8ea6048e48516cef43cb5b5ccc626f8e87
[]
no_license
DnyaneshwarKathole/Web
5b85a69b4272f0e997139c3086076d68cd7e4e39
c20ddc600ab3975f26881fe364cbbfbc9f3e8c14
refs/heads/master
2023-02-02T02:51:17.564198
2020-12-11T19:33:46
2020-12-11T19:33:46
319,631,726
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package popups; import java.util.ArrayList; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Child_Popup { public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver","G:\\Program\\chromeDriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("https://yourportico.com"); driver.findElement(By.xpath("//a[contains(text(),'Login')]")).click(); Set<String> st = driver.getWindowHandles(); //5463579558 ArrayList<String> al=new ArrayList<String>(st); driver.switchTo().window(al.get(1)); Thread.sleep(5000); driver.findElement(By.xpath("//input[@type='text']")).sendKeys("Loft"); driver.findElement(By.xpath("(//input[@type='text'])[2]")).sendKeys("Dnyaneshwar.kathole@atidiv.com"); driver.findElement(By.xpath("(//input[@type='password'])")).sendKeys("India@123"); driver.findElement(By.xpath("//img[@src='images/showPass.png']")).click(); driver.findElement(By.xpath("//input[@type='submit']")).click(); } }
[ "Sai@DESKTOP-CBA7UQ0" ]
Sai@DESKTOP-CBA7UQ0
f3e92900dfd71e5b757b4ca9638c662022e13136
6a0cc425b4096e55b086d953578a7686001a3f56
/rongcheng-print/src/test/java/test/AddressCarrierAllocation/TestAddressCarrierAllocationService.java
c47d8719d3bdf549896ea34e8e39f24a196facba
[]
no_license
apeed/workspace
20c5ebf588e4ec955074809a51b6c416774bb76b
1bb5796c1f0e5bdec38925b1f179ed16e9a16e39
refs/heads/master
2021-01-16T06:34:00.465083
2017-08-14T02:49:17
2017-08-14T02:49:17
99,989,919
0
0
null
null
null
null
UTF-8
Java
false
false
2,961
java
package test.AddressCarrierAllocation; import java.math.BigInteger; import java.util.List; import org.junit.Before; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.rongcheng.print.entity.CarrierInfo; import com.rongcheng.print.service.AddressCarrierAllocation.AddressCarrierAllocationService; import com.rongcheng.print.entity.AddressCarrierAllocation; public class TestAddressCarrierAllocationService { private AddressCarrierAllocationService service; @Before public void init(){ String[] conf={"conf/spring-mvc.xml", "conf/spring-mybatis.xml"}; ApplicationContext context= new ClassPathXmlApplicationContext(conf); service=context.getBean("addressCarrierAllocationService", AddressCarrierAllocationService.class); } @Test public void test01(){//findByRegionCode AddressCarrierAllocation list=service.findByRegionCode(new Integer("120000")); System.out.println(list); } @Test public void test1(){//findRegionByPage List<AddressCarrierAllocation> list =service.findRegionByPage(0, 2); System.out.println(list); } @Test public void test2(){//findRegionCount String n =service.findRegionCount(); System.out.println(n); } @Test public void test4(){//modifyRegionArea service.modifyRegionArea(new Integer("120000"), new BigInteger("19"),"9"); } @Test public void test5(){//modifyRegionList service.modifyRegionList(new Integer("1301"), new BigInteger("1"), "8"); } @Test public void test7(){ CarrierInfo n=service.findByRegionCarrierId(new BigInteger("20")); System.out.println(n); } @Test public void test9(){ List<AddressCarrierAllocation> aca=service.findAddressCarrierAllocation("1305", "", new BigInteger("1")); System.out.println(aca.size()); } @Test public void test10(){ List<AddressCarrierAllocation> aca=service.findAddressCarrierAllocationArea("1305",new BigInteger("2")); System.out.println(aca.size()); } @Test public void test13(){//modifyRegionArea3 String s=""; service.modifyRegionArea3("13", "00", new BigInteger(s)); } @Test public void test14(){//modifyProvince service.modifyProvince(new Integer("130000"), new BigInteger("9")); } /*@Test public void test10(){ List<AddressCarrierAllocation> aca=service.findAddressCarrierAllocationArea(new BigInteger("6"), new BigInteger("4")); System.out.println(aca); }*/ /*@Test public void test11(){//modifyRegionArea1 service.modifyRegionArea1(new BigInteger("2"),new BigInteger("1"),""); } @Test public void test12(){//modifyRegionArea2 service.modifyRegionArea2(new BigInteger("2"), "55"); }*/ /*@Test public void test8(){ int n=service.modifyRegionReserved1(new Double(2), "xxoo"); System.out.println(n); }*/ /*@Test public void test6(){ BigInteger[] d = {new BigInteger("3"),new BigInteger("4")}; service.modifyRegions(d, new BigInteger("47")); }*/ }
[ "1774104516@qq.com" ]
1774104516@qq.com
4a60a262f3c60509e4d80b2d3f4dc8bd9292e169
60062e583dd41927656c43bc38d087a213f711a8
/src/project1029/IORank.java
0e4d219d2f2bd710e88d55165391aadf8bb75b47
[]
no_license
kimyunyeong0006/CloudLaundry
667461f490bbabd844e263e5a1d3d88e384216cf
09b81fa696cb2d2eb349ff9393fdb152fa80d0a5
refs/heads/master
2021-07-25T13:15:39.593812
2017-10-29T00:06:51
2017-10-29T00:06:51
108,692,800
0
0
null
null
null
null
UHC
Java
false
false
4,751
java
package project1029; import java.awt.Color; import java.awt.Cursor; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.StringTokenizer; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JButton; class IORank extends JPanel { private ImageIcon start_btn = new ImageIcon(Main1029.class.getResource("../image/start_btn.png")); private ImageIcon entered_btn = new ImageIcon(Main1029.class.getResource("../image/entered_btn.png")); private ImageIcon main_btn = new ImageIcon(Main1029.class.getResource("../image/main_btn.png")); Image background = null; String user; private JLabel rank_view[] = new JLabel[5]; ; int length, num=0; String[] name; int[] score ,rank; String addname; int addscore; int n; //유입경로 .. ? private Main1029 main; public IORank(Main1029 main, String fname){ background = new ImageIcon(Main1029.class.getResource("../image/rank_bg.png")).getImage(); this.setLayout(null); this.main = main; input_data(fname); sort_data(); output_data(); setSize(1010,710); JButton btn_start = new JButton(); btn_start.setIcon(start_btn); btn_start.setBounds(272,546, 200, 63); btn_start.setBorderPainted(false); btn_start.setContentAreaFilled(false); add(btn_start); btn_start.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e){ btn_start.setCursor(new Cursor(Cursor.HAND_CURSOR)); btn_start.setIcon(entered_btn); } public void mouseExited(MouseEvent e){ btn_start.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); btn_start.setIcon(start_btn); } @Override public void mousePressed(MouseEvent e) { user = JOptionPane.showInputDialog(null,"닉네임을 입력해주세요!"); if(user == null){ System.out.println(user); return; } else{ System.out.println(user); main.setUser(user); main.change("gamePage"); } } }); JButton btn_main = new JButton(); btn_main.setIcon(main_btn); btn_main.setBounds(528, 546, 200, 63); btn_main.setBorderPainted(false); btn_main.setContentAreaFilled(false); add(btn_main); btn_main.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e){ btn_main.setCursor(new Cursor(Cursor.HAND_CURSOR)); btn_main.setIcon(entered_btn); } public void mouseExited(MouseEvent e){ btn_main.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); btn_main.setIcon(main_btn); } @Override public void mousePressed(MouseEvent e) { main.change("indexPage"); } }); } public void input_data(String fname) { try { FileReader fr = new FileReader(new File(fname)); BufferedReader br = new BufferedReader(fr); process(br); } catch (IOException e) { System.err.println(e); } } public void process(BufferedReader br) { //버퍼 전달! String csvStr = ""; String tmpStr = ""; do { try { tmpStr = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (tmpStr != null) { csvStr += tmpStr + "\t"; } } while (tmpStr != null); StringTokenizer parse = new StringTokenizer(csvStr, "\t"); //length = parse.countTokens() / 3; length = 5; name = new String[length]; score = new int[length]; rank = new int[length]; for (int j = 0; j < length; j++) { parse.nextToken(); rank[j] = 0; name[j] = parse.nextToken(); score[j] = Integer.parseInt(parse.nextToken()); } } public void sort_data() { for(int i=0;i<length;i++){ for(int j=0;j<length;j++){ if(score[i]>score[j]){ rank[j]++; } } } } public void output_data() { String str; setBackground(Color.white); JLabel rank_title = new JLabel("순위 이름 점수"); rank_title.setFont(new Font("함초롬돋움", Font.PLAIN, 16)); rank_title.setBounds(407, 165,280,30); add(rank_title); for (int i = 0; i <= length; i++) { for(int j = 0; j < length ; j++){ if(i==rank[j]){ str = (i+1)+" "+name[j]+" "+score[j]+"점"; rank_view[i] = new JLabel(str); //레이블 출력 rank_view[i].setBounds(407,110+(i+2)*55,280,30); rank_view[i].setFont(new Font("함초롬돋움", Font.PLAIN, 17)); add(rank_view[i]); } } } } public void paintComponent(Graphics g) { g.drawImage(background, 0, 0, null); setOpaque(false); super.paintComponent(g); } }
[ "iuki1@e-mirim.hs.kr" ]
iuki1@e-mirim.hs.kr
f3bdd50491b22c9e5dc441064d602eb1b750c8d8
6e2e383a00778d826c451a4d9274fc49e0cff41c
/hackerrank/src/Leecode/Prob_986.java
df4c8edfcf52503e443d4ec917cfa5ce7382c50e
[]
no_license
kenvifire/AlgorithmPractice
d875df9d13a76a02bce9ce0b90a8fad5ba90f832
e16315ca2ad0476f65f087f608cc9424710e0812
refs/heads/master
2022-12-17T23:45:37.784637
2020-09-22T14:45:46
2020-09-22T14:45:46
58,105,208
0
0
null
null
null
null
UTF-8
Java
false
false
1,739
java
package Leecode; import lib.Interval; import utils.AssertUtils; import utils.IntervalUtils; import java.util.ArrayList; import java.util.List; public class Prob_986 { public Interval[] intervalIntersection(Interval[] A, Interval[] B) { List<Interval> temp = new ArrayList<>(); int a = 0, b = 0; while (a < A.length && b < B.length) { Interval intelA = A[a]; Interval intelB = B[b]; Interval intersect = getIntersect(intelA, intelB); if(intersect == null) { if(intelA.end < intelB.start) { a++; } else { b++; } } else { temp.add(intersect); if(intelA.end < intelB.end) { a++; } else if (intelB.end < intelA.end){ b++; } else { a++; b++; } } } Interval[] result = new Interval[temp.size()]; temp.toArray(result); return result; } private Interval getIntersect(Interval A, Interval B) { int start = Math.max(A.start, B.start); int end = Math.min(A.end, B.end); if(start <= end) return new Interval(start, end); return null; } public static void main(String[] args) { Prob_986 prob = new Prob_986(); AssertUtils.equals("[[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]]", IntervalUtils.toString(prob.intervalIntersection(IntervalUtils.fromString("[[0,2],[5,10],[13,23],[24,25]]"), IntervalUtils.fromString("[[1,5],[8,12],[15,24],[25,26]]")))); } }
[ "mrwhite@163.com" ]
mrwhite@163.com
22127f56ed216cf5343dc40daf69a1d638beeae9
db7edb648e289b95be4bf3ff25985226e128a3fe
/Shoes/src/Shoes/WalkingShoe.java
826cecbc42dee2ba2080993a0fc4368543eb00f6
[]
no_license
novaelis/JavaAlex
3831201dbc563d6d37fa80fcd975c2b8754f5e0f
124cdf2def574a5e49d15649bd153032d6422378
refs/heads/master
2023-01-09T15:32:29.168118
2020-10-27T22:46:48
2020-10-27T22:46:48
307,845,438
0
0
null
null
null
null
UTF-8
Java
false
false
263
java
package Shoes; public class WalkingShoe extends Shoe{ public final boolean goreTex; public WalkingShoe(String brand, double size, boolean goreTex) { super(brand,size); this.goreTex = goreTex; // TODO Auto-generated constructor stub } }
[ "dejan.jovanovic89@gmail.com" ]
dejan.jovanovic89@gmail.com
62cd119f6b04eb18b8db778abd918207cbbebac5
ef7c846fd866bbc748a2e8719358c55b73f6fc96
/library/weiui/src/main/java/vip/kuaifan/weiui/extend/view/loading/spinkit/style/Circle.java
6c8b403a1eb72df07774837cf4dc86a9d8f88827
[ "MIT" ]
permissive
shaibaoj/weiui
9e876fa3797537faecccca74a0c9206dba67e444
131a8e3a6ecad245f421f039d2bedc8a0362879d
refs/heads/master
2020-03-17T22:45:52.855193
2018-07-02T01:56:51
2018-07-02T01:56:51
134,017,696
0
0
null
2018-07-02T01:56:52
2018-05-19T01:01:44
Java
UTF-8
Java
false
false
1,404
java
package vip.kuaifan.weiui.extend.view.loading.spinkit.style; import android.animation.ValueAnimator; import android.os.Build; import vip.kuaifan.weiui.extend.view.loading.spinkit.animation.SpriteAnimatorBuilder; import vip.kuaifan.weiui.extend.view.loading.spinkit.sprite.CircleSprite; import vip.kuaifan.weiui.extend.view.loading.spinkit.sprite.CircleLayoutContainer; import vip.kuaifan.weiui.extend.view.loading.spinkit.sprite.Sprite; /** * Created by ybq. */ public class Circle extends CircleLayoutContainer { @Override public Sprite[] onCreateChild() { Dot[] dots = new Dot[12]; for (int i = 0; i < dots.length; i++) { dots[i] = new Dot(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { dots[i].setAnimationDelay(1200 / 12 * i); } else { dots[i].setAnimationDelay(1200 / 12 * i + -1200); } } return dots; } private class Dot extends CircleSprite { Dot() { setScale(0f); } @Override public ValueAnimator onCreateAnimation() { float fractions[] = new float[]{0f, 0.5f, 1f}; return new SpriteAnimatorBuilder(this). scale(fractions, 0f, 1f, 0f). duration(1200). easeInOut(fractions) .build(); } } }
[ "342210020@qq.com" ]
342210020@qq.com
7f7309299437236dadc4e31f95b3b3391f10caee
b718f70c89a8df8e26290aa07c0c353211fd9926
/src/main/java/server/repository/schedule/CourseRepository.java
42ec18f49005169f449f58bb89e76af94cfd6d1b
[]
no_license
usmetanina/Server
fa5cc0e43ab2b41bd9af694ac83204babaaeaf10
12501fb65e66f8cb8402322065031032336f40de
refs/heads/master
2021-05-03T13:26:44.905258
2016-12-25T16:48:33
2016-12-25T16:48:33
72,191,316
0
1
null
2016-12-25T16:48:34
2016-10-28T08:56:48
JavaScript
UTF-8
Java
false
false
216
java
package server.repository.schedule; import org.springframework.data.jpa.repository.JpaRepository; import server.entity.schedule.Course; public interface CourseRepository extends JpaRepository<Course, Integer> { }
[ "usmetanina96@mail.ru" ]
usmetanina96@mail.ru
ae56d1aafa5ef90a567f6a3b63844e3596248d3c
544cfadc742536618168fc80a5bd81a35a5f2c99
/packages/apps/DocumentsUI/src/com/android/documentsui/roots/ProvidersCache.java
f35d05e2f6512c46bd89115daafe32b47088d7a2
[]
no_license
ZYHGOD-1/Aosp11
0400619993b559bf4380db2da0addfa9cccd698d
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
refs/heads/main
2023-04-21T20:13:54.629813
2021-05-22T05:28:21
2021-05-22T05:28:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,952
java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.documentsui.roots; import static android.provider.DocumentsContract.QUERY_ARG_MIME_TYPES; import static androidx.core.util.Preconditions.checkNotNull; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.SharedMinimal.VERBOSE; import android.content.BroadcastReceiver.PendingResult; import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; import android.database.ContentObserver; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.FileUtils; import android.os.Handler; import android.os.Looper; import android.os.SystemClock; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Root; import android.util.Log; import androidx.annotation.GuardedBy; import androidx.annotation.Nullable; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.android.documentsui.DocumentsApplication; import com.android.documentsui.R; import com.android.documentsui.UserIdManager; import com.android.documentsui.UserPackage; import com.android.documentsui.archives.ArchivesProvider; import com.android.documentsui.base.LookupApplicationName; import com.android.documentsui.base.Providers; import com.android.documentsui.base.RootInfo; import com.android.documentsui.base.State; import com.android.documentsui.base.UserId; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; /** * Cache of known storage backends and their roots. */ public class ProvidersCache implements ProvidersAccess, LookupApplicationName { private static final String TAG = "ProvidersCache"; // Not all providers are equally well written. If a provider returns // empty results we don't cache them...unless they're in this magical list // of beloved providers. private static final List<String> PERMIT_EMPTY_CACHE = new ArrayList<String>() {{ // MTP provider commonly returns no roots (if no devices are attached). add(Providers.AUTHORITY_MTP); // ArchivesProvider doesn't support any roots. add(ArchivesProvider.AUTHORITY); }}; private final Context mContext; @GuardedBy("mRootsChangedObservers") private final Map<UserId, RootsChangedObserver> mRootsChangedObservers = new HashMap<>(); @GuardedBy("mRecentsRoots") private final Map<UserId, RootInfo> mRecentsRoots = new HashMap<>(); private final Object mLock = new Object(); private final CountDownLatch mFirstLoad = new CountDownLatch(1); @GuardedBy("mLock") private boolean mFirstLoadDone; @GuardedBy("mLock") private PendingResult mBootCompletedResult; @GuardedBy("mLock") private Multimap<UserAuthority, RootInfo> mRoots = ArrayListMultimap.create(); @GuardedBy("mLock") private HashSet<UserAuthority> mStoppedAuthorities = new HashSet<>(); @GuardedBy("mObservedAuthoritiesDetails") private final Map<UserAuthority, PackageDetails> mObservedAuthoritiesDetails = new HashMap<>(); private final UserIdManager mUserIdManager; public ProvidersCache(Context context, UserIdManager userIdManager) { mContext = context; mUserIdManager = userIdManager; } private RootInfo generateRecentsRoot(UserId rootUserId) { return new RootInfo() {{ // Special root for recents userId = rootUserId; derivedIcon = R.drawable.ic_root_recent; derivedType = RootInfo.TYPE_RECENTS; flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_SEARCH; queryArgs = QUERY_ARG_MIME_TYPES; title = mContext.getString(R.string.root_recent); availableBytes = -1; }}; } private RootInfo createOrGetRecentsRoot(UserId userId) { return createOrGetByUserId(mRecentsRoots, userId, user -> generateRecentsRoot(user)); } private RootsChangedObserver createOrGetRootsChangedObserver(UserId userId) { return createOrGetByUserId(mRootsChangedObservers, userId, user -> new RootsChangedObserver(user)); } private static <T> T createOrGetByUserId(Map<UserId, T> map, UserId userId, Function<UserId, T> supplier) { synchronized (map) { if (!map.containsKey(userId)) { map.put(userId, supplier.apply(userId)); } } return map.get(userId); } private class RootsChangedObserver extends ContentObserver { private final UserId mUserId; RootsChangedObserver(UserId userId) { super(new Handler(Looper.getMainLooper())); mUserId = userId; } @Override public void onChange(boolean selfChange, Uri uri) { if (uri == null) { Log.w(TAG, "Received onChange event for null uri. Skipping."); return; } if (DEBUG) { Log.i(TAG, "Updating roots due to change on user " + mUserId + "at " + uri); } updateAuthorityAsync(mUserId, uri.getAuthority()); } } @Override public String getApplicationName(UserId userId, String authority) { return mObservedAuthoritiesDetails.get( new UserAuthority(userId, authority)).applicationName; } @Override public String getPackageName(UserId userId, String authority) { return mObservedAuthoritiesDetails.get(new UserAuthority(userId, authority)).packageName; } public void updateAsync(boolean forceRefreshAll, @Nullable Runnable callback) { // NOTE: This method is called when the UI language changes. // For that reason we update our RecentsRoot to reflect // the current language. final String title = mContext.getString(R.string.root_recent); for (UserId userId : mUserIdManager.getUserIds()) { RootInfo recentRoot = createOrGetRecentsRoot(userId); recentRoot.title = title; // Nothing else about the root should ever change. assert (recentRoot.authority == null); assert (recentRoot.rootId == null); assert (recentRoot.derivedIcon == R.drawable.ic_root_recent); assert (recentRoot.derivedType == RootInfo.TYPE_RECENTS); assert (recentRoot.flags == (Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD)); assert (recentRoot.availableBytes == -1); } new UpdateTask(forceRefreshAll, null, callback).executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR); } public void updatePackageAsync(UserId userId, String packageName) { new UpdateTask(false, new UserPackage(userId, packageName), /* callback= */ null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public void updateAuthorityAsync(UserId userId, String authority) { final ProviderInfo info = userId.getPackageManager(mContext).resolveContentProvider( authority, 0); if (info != null) { updatePackageAsync(userId, info.packageName); } } void setBootCompletedResult(PendingResult result) { synchronized (mLock) { // Quickly check if we've already finished loading, otherwise hang // out until first pass is finished. if (mFirstLoadDone) { result.finish(); } else { mBootCompletedResult = result; } } } /** * Block until the first {@link UpdateTask} pass has finished. * * @return {@code true} if cached roots is ready to roll, otherwise * {@code false} if we timed out while waiting. */ private boolean waitForFirstLoad() { boolean success = false; try { success = mFirstLoad.await(15, TimeUnit.SECONDS); } catch (InterruptedException e) { } if (!success) { Log.w(TAG, "Timeout waiting for first update"); } return success; } /** * Load roots from authorities that are in stopped state. Normal * {@link UpdateTask} passes ignore stopped applications. */ private void loadStoppedAuthorities() { synchronized (mLock) { for (UserAuthority userAuthority : mStoppedAuthorities) { mRoots.replaceValues(userAuthority, loadRootsForAuthority(userAuthority, true)); } mStoppedAuthorities.clear(); } } /** * Load roots from a stopped authority. Normal {@link UpdateTask} passes * ignore stopped applications. */ private void loadStoppedAuthority(UserAuthority userAuthority) { synchronized (mLock) { if (!mStoppedAuthorities.contains(userAuthority)) { return; } if (DEBUG) { Log.d(TAG, "Loading stopped authority " + userAuthority); } mRoots.replaceValues(userAuthority, loadRootsForAuthority(userAuthority, true)); mStoppedAuthorities.remove(userAuthority); } } /** * Bring up requested provider and query for all active roots. Will consult cached * roots if not forceRefresh. Will query when cached roots is empty (which should never happen). */ private Collection<RootInfo> loadRootsForAuthority(UserAuthority userAuthority, boolean forceRefresh) { UserId userId = userAuthority.userId; String authority = userAuthority.authority; if (VERBOSE) Log.v(TAG, "Loading roots on user " + userId + " for " + authority); ContentResolver resolver = userId.getContentResolver(mContext); final ArrayList<RootInfo> roots = new ArrayList<>(); final PackageManager pm = userId.getPackageManager(mContext); ProviderInfo provider = pm.resolveContentProvider( authority, PackageManager.GET_META_DATA); if (provider == null) { Log.w(TAG, "Failed to get provider info for " + authority); return roots; } if (!provider.exported) { Log.w(TAG, "Provider is not exported. Failed to load roots for " + authority); return roots; } if (!provider.grantUriPermissions) { Log.w(TAG, "Provider doesn't grantUriPermissions. Failed to load roots for " + authority); return roots; } if (!android.Manifest.permission.MANAGE_DOCUMENTS.equals(provider.readPermission) || !android.Manifest.permission.MANAGE_DOCUMENTS.equals(provider.writePermission)) { Log.w(TAG, "Provider is not protected by MANAGE_DOCUMENTS. Failed to load roots for " + authority); return roots; } synchronized (mObservedAuthoritiesDetails) { if (!mObservedAuthoritiesDetails.containsKey(userAuthority)) { CharSequence appName = pm.getApplicationLabel(provider.applicationInfo); String packageName = provider.applicationInfo.packageName; mObservedAuthoritiesDetails.put( userAuthority, new PackageDetails(appName.toString(), packageName)); // Watch for any future updates final Uri rootsUri = DocumentsContract.buildRootsUri(authority); resolver.registerContentObserver(rootsUri, true, createOrGetRootsChangedObserver(userId)); } } final Uri rootsUri = DocumentsContract.buildRootsUri(authority); if (!forceRefresh) { // Look for roots data that we might have cached for ourselves in the // long-lived system process. final Bundle systemCache = resolver.getCache(rootsUri); if (systemCache != null) { ArrayList<RootInfo> cachedRoots = systemCache.getParcelableArrayList(TAG); assert (cachedRoots != null); if (!cachedRoots.isEmpty() || PERMIT_EMPTY_CACHE.contains(authority)) { if (VERBOSE) Log.v(TAG, "System cache hit for " + authority); return cachedRoots; } else { Log.w(TAG, "Ignoring empty system cache hit for " + authority); } } } ContentProviderClient client = null; Cursor cursor = null; try { client = DocumentsApplication.acquireUnstableProviderOrThrow(resolver, authority); cursor = client.query(rootsUri, null, null, null, null); while (cursor.moveToNext()) { final RootInfo root = RootInfo.fromRootsCursor(userId, authority, cursor); roots.add(root); } } catch (Exception e) { Log.w(TAG, "Failed to load some roots from " + authority, e); // We didn't load every root from the provider. Don't put it to // system cache so that we'll try loading them again next time even // if forceRefresh is false. return roots; } finally { FileUtils.closeQuietly(cursor); FileUtils.closeQuietly(client); } // Cache these freshly parsed roots over in the long-lived system // process, in case our process goes away. The system takes care of // invalidating the cache if the package or Uri changes. final Bundle systemCache = new Bundle(); if (roots.isEmpty() && !PERMIT_EMPTY_CACHE.contains(authority)) { Log.i(TAG, "Provider returned no roots. Possibly naughty: " + authority); } else { systemCache.putParcelableArrayList(TAG, roots); resolver.putCache(rootsUri, systemCache); } return roots; } @Override public RootInfo getRootOneshot(UserId userId, String authority, String rootId) { return getRootOneshot(userId, authority, rootId, false); } public RootInfo getRootOneshot(UserId userId, String authority, String rootId, boolean forceRefresh) { synchronized (mLock) { UserAuthority userAuthority = new UserAuthority(userId, authority); RootInfo root = forceRefresh ? null : getRootLocked(userAuthority, rootId); if (root == null) { mRoots.replaceValues(userAuthority, loadRootsForAuthority(userAuthority, forceRefresh)); root = getRootLocked(userAuthority, rootId); } return root; } } public RootInfo getRootBlocking(UserId userId, String authority, String rootId) { waitForFirstLoad(); loadStoppedAuthorities(); synchronized (mLock) { return getRootLocked(new UserAuthority(userId, authority), rootId); } } private RootInfo getRootLocked(UserAuthority userAuthority, String rootId) { for (RootInfo root : mRoots.get(userAuthority)) { if (Objects.equals(root.rootId, rootId)) { return root; } } return null; } @Override public RootInfo getRecentsRoot(UserId userId) { return createOrGetRecentsRoot(userId); } public boolean isRecentsRoot(RootInfo root) { return mRecentsRoots.containsValue(root); } @Override public Collection<RootInfo> getRootsBlocking() { waitForFirstLoad(); loadStoppedAuthorities(); synchronized (mLock) { return mRoots.values(); } } @Override public Collection<RootInfo> getMatchingRootsBlocking(State state) { waitForFirstLoad(); loadStoppedAuthorities(); synchronized (mLock) { return ProvidersAccess.getMatchingRoots(mRoots.values(), state); } } @Override public Collection<RootInfo> getRootsForAuthorityBlocking(UserId userId, String authority) { waitForFirstLoad(); UserAuthority userAuthority = new UserAuthority(userId, authority); loadStoppedAuthority(userAuthority); synchronized (mLock) { final Collection<RootInfo> roots = mRoots.get(userAuthority); return roots != null ? roots : Collections.<RootInfo>emptyList(); } } @Override public RootInfo getDefaultRootBlocking(State state) { RootInfo root = ProvidersAccess.getDefaultRoot(getRootsBlocking(), state); return root != null ? root : createOrGetRecentsRoot(UserId.CURRENT_USER); } public void logCache() { StringBuilder output = new StringBuilder(); for (UserAuthority userAuthority : mObservedAuthoritiesDetails.keySet()) { List<String> roots = new ArrayList<>(); Uri rootsUri = DocumentsContract.buildRootsUri(userAuthority.authority); Bundle systemCache = userAuthority.userId.getContentResolver(mContext).getCache( rootsUri); if (systemCache != null) { ArrayList<RootInfo> cachedRoots = systemCache.getParcelableArrayList(TAG); for (RootInfo root : cachedRoots) { roots.add(root.toDebugString()); } } output.append((output.length() == 0) ? "System cache: " : ", "); output.append(userAuthority).append("=").append(roots); } Log.i(TAG, output.toString()); } private class UpdateTask extends AsyncTask<Void, Void, Void> { private final boolean mForceRefreshAll; @Nullable private final UserPackage mForceRefreshUserPackage; @Nullable private final Runnable mCallback; private final Multimap<UserAuthority, RootInfo> mTaskRoots = ArrayListMultimap.create(); private final HashSet<UserAuthority> mTaskStoppedAuthorities = new HashSet<>(); /** * Create task to update roots cache. * * @param forceRefreshAll when true, all previously cached values for * all packages should be ignored. * @param forceRefreshUserPackage when non-null, all previously cached * values for this specific user package should be ignored. * @param callback when non-null, it will be invoked after the task is executed. */ UpdateTask(boolean forceRefreshAll, @Nullable UserPackage forceRefreshUserPackage, @Nullable Runnable callback) { mForceRefreshAll = forceRefreshAll; mForceRefreshUserPackage = forceRefreshUserPackage; mCallback = callback; } @Override protected Void doInBackground(Void... params) { final long start = SystemClock.elapsedRealtime(); for (UserId userId : mUserIdManager.getUserIds()) { final RootInfo recents = createOrGetRecentsRoot(userId); mTaskRoots.put(new UserAuthority(recents.userId, recents.authority), recents); final PackageManager pm = userId.getPackageManager(mContext); // Pick up provider with action string final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE); final List<ResolveInfo> providers = pm.queryIntentContentProviders(intent, 0); for (ResolveInfo info : providers) { ProviderInfo providerInfo = info.providerInfo; if (providerInfo.authority != null) { handleDocumentsProvider(providerInfo, userId); } } } final long delta = SystemClock.elapsedRealtime() - start; if (VERBOSE) Log.v(TAG, "Update found " + mTaskRoots.size() + " roots in " + delta + "ms"); synchronized (mLock) { mFirstLoadDone = true; if (mBootCompletedResult != null) { mBootCompletedResult.finish(); mBootCompletedResult = null; } mRoots = mTaskRoots; mStoppedAuthorities = mTaskStoppedAuthorities; } mFirstLoad.countDown(); LocalBroadcastManager.getInstance(mContext).sendBroadcast(new Intent(BROADCAST_ACTION)); return null; } @Override protected void onPostExecute(Void aVoid) { if (mCallback != null) { mCallback.run(); } } private void handleDocumentsProvider(ProviderInfo info, UserId userId) { UserAuthority userAuthority = new UserAuthority(userId, info.authority); // Ignore stopped packages for now; we might query them // later during UI interaction. if ((info.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) { if (VERBOSE) { Log.v(TAG, "Ignoring stopped authority " + info.authority + ", user " + userId); } mTaskStoppedAuthorities.add(userAuthority); return; } final boolean forceRefresh = mForceRefreshAll || Objects.equals(new UserPackage(userId, info.packageName), mForceRefreshUserPackage); mTaskRoots.putAll(userAuthority, loadRootsForAuthority(userAuthority, forceRefresh)); } } private static class UserAuthority { private final UserId userId; @Nullable private final String authority; private UserAuthority(UserId userId, @Nullable String authority) { this.userId = checkNotNull(userId); this.authority = authority; } @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof UserAuthority) { UserAuthority other = (UserAuthority) o; return Objects.equals(userId, other.userId) && Objects.equals(authority, other.authority); } return false; } @Override public int hashCode() { return Objects.hash(userId, authority); } } private static class PackageDetails { private String applicationName; private String packageName; public PackageDetails(String appName, String pckgName) { applicationName = appName; packageName = pckgName; } } }
[ "rick_tan@qq.com" ]
rick_tan@qq.com
45cea186fac792347b97df7973a13baf3639dda3
9a1d648603e9d73b87826ac7ba3aa51d9e70a103
/Modulo 5 Desarrollo De Aplicaciones Jee Con Spring Framework/Evaluacion Modulo 5/src/main/java/cl/cabrera/grupal6modelo/Contacto.java
b1122c23d0c98117d7aad2ae001ba8b391952c5e
[]
no_license
armcabrera/Repositorio-Curso-Full-Stack-Java-Trainee
dfb1ebef07029421bc92947386826187d09020e8
af53a253b73944f872490ac4bf70a43989515929
refs/heads/main
2023-02-25T07:17:21.603034
2021-01-28T02:07:52
2021-01-28T02:07:52
318,004,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
package cl.cabrera.grupal6modelo; public class Contacto { private int idcontacto; private String nombre; private String email; private String telefono; private String tipousuario; private String comentarios; public Contacto() { super(); } public Contacto(int idcontacto, String nombre, String email, String telefono, String tipousuario, String comentarios) { super(); this.idcontacto = idcontacto; this.nombre = nombre; this.email = email; this.telefono = telefono; this.tipousuario = tipousuario; this.comentarios = comentarios; } public int getIdcontacto() { return idcontacto; } public String getNombre() { return nombre; } public String getEmail() { return email; } public String getTelefono() { return telefono; } public String getTipousuario() { return tipousuario; } public String getComentarios() { return comentarios; } public void setIdcontacto(int idcontacto) { this.idcontacto = idcontacto; } public void setNombre(String nombre) { this.nombre = nombre; } public void setEmail(String email) { this.email = email; } public void setTelefono(String telefono) { this.telefono = telefono; } public void setTipousuario(String tipousuario) { this.tipousuario = tipousuario; } public void setComentarios(String comentarios) { this.comentarios = comentarios; } @Override public String toString() { return "Contacto [idcontacto=" + idcontacto + ", nombre=" + nombre + ", email=" + email + ", telefono=" + telefono + ", tipousuario=" + tipousuario + ", comentarios=" + comentarios + "]"; } }
[ "armcabrera.cornejo@gmail.com" ]
armcabrera.cornejo@gmail.com
c6b71715f79c96b59307f4eb3a1b200e8fcb1eae
6c11222b10f89def81dec2094fe5c9bdb40d6164
/src/main/java/com/laravelshao/common/test/job/MySimpleJob.java
43277545ae4e3a7019b3ec01a00511b18aeffaff
[]
no_license
laravelshao/common-test
245a5be1ada3f40b724c912457b555316b416432
bda837ad455c3e87e41f7293a0bdcef233c42752
refs/heads/master
2023-08-03T07:20:06.740130
2023-07-28T10:26:16
2023-07-28T10:26:16
212,835,684
0
0
null
2023-07-28T10:26:17
2019-10-04T14:37:14
Java
UTF-8
Java
false
false
738
java
package com.laravelshao.common.test.job; import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.simple.SimpleJob; import com.laravelshao.common.core.annotations.ElasticSimpleJob; import lombok.extern.slf4j.Slf4j; /** * 自定义 simple job 任务 * * @author qinghua.shao * @date 2019/10/4 * @since 1.0.0 */ @Slf4j //@ElasticSimpleJob(jobName = "mySimpleJob", cron = "0/5 * * * * ?", shardingTotalCount = 2, overwrite = true) public class MySimpleJob implements SimpleJob { @Override public void execute(ShardingContext shardingContext) { log.info("当前分片为:{}, 总分片数为:{}", shardingContext.getShardingItem(), shardingContext.getShardingTotalCount()); } }
[ "qinghua.shao@weimob.com" ]
qinghua.shao@weimob.com
8585cc8ab5ba093ff6762b6b2fe99bd65a860dde
f4075623a701d16170be2f6f9b738f485e5b1a42
/sources/Android/sdk/src/main/java/com/lua/mobile/sdk/engine/register/RegisterClassManager.java
120c49a7246c63516a8f0133f30a755bf351c31d
[ "MIT" ]
permissive
arnozhang/LuaMobileSdk
3e67f5f82f7b1f3500dd83f8df76f6899853c60a
1ffa7742a9f2dc776e61a7bcd698e74da775d04a
refs/heads/master
2020-03-10T11:56:21.991197
2018-04-13T07:55:46
2018-04-13T07:55:46
109,638,551
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
/** * Android LuaMobileSdk for Android framework project. * * Copyright 2016 Arno Zhang <zyfgood12@163.com> * * 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.lua.mobile.sdk.engine.register; public interface RegisterClassManager { void addBridgedClass(Class<?> clazz, String bridgedClassName); String getBridgedClassName(Class<?> clazz); }
[ "zyfgood12@gmail.com" ]
zyfgood12@gmail.com
d54969e2a75d2c7325a478bb8887bc66872509a4
5b47ec8e8d758c1fde449c39d686971f57dcdd37
/src/main/java/com/workshop/springiocdemo/ClientImport.java
62b2fc5b0d92ff340eeb10a2e3f69ece9a5a423a
[]
no_license
pratyushranjansahu/springiocdemo
955440039c140d08a518a7acd8b21988c1d7e745
353154e18e3d905ea02f47cc0322a13b2da2cb48
refs/heads/master
2022-10-12T06:49:17.772926
2020-06-07T07:14:56
2020-06-07T07:14:56
263,532,984
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package com.workshop.springiocdemo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import com.workshop.springiocdemo.beans.ImportABean; import com.workshop.springiocdemo.beans.ImportBBean; import com.workshop.springiocdemo.config.ImportOneConfiguration; public class ClientImport { public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(ImportOneConfiguration.class); ctx.refresh(); ImportABean a = (ImportABean) ctx.getBean("a"); ImportBBean b = (ImportBBean) ctx.getBean("b"); a.doWork(); b.doWork(); ctx.registerShutdownHook(); } }
[ "bicky633@gmail.com" ]
bicky633@gmail.com
1a5f33ce36b421f0ac93c1777f893eea0a7718b7
8cd6ded4696820e7a79fe91efcee72e8ac0bb7ae
/EjerciciosIntefaces/src/Ejercicio2/CuentaBancaria.java
0c3709990b60131a757168d30b15ecf912cf7b2b
[]
no_license
gitDGM/ejercicios-clase
00dec0ee62a327cf10780e349f7716482ba0a5f7
f05f7b01be8ffeadb9da009b217459179849eec1
refs/heads/master
2023-05-05T11:54:49.122657
2021-06-01T18:36:34
2021-06-01T18:36:34
331,340,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,547
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 Ejercicio2; /** * * @author alumno */ public abstract class CuentaBancaria { private final String iban; private double saldo; private double interesAnualBasico = 2.5; public CuentaBancaria(String iban, double saldo) { this.iban = iban; this.saldo = saldo; } public String getIban() { return iban; } public double getSaldo() { return saldo; } public double getInteresAnualBasico() { return interesAnualBasico; } public void setSaldo(double saldo) { this.saldo = saldo; } public void setInteresAnualBasico(double interesAnualBasico) { this.interesAnualBasico = interesAnualBasico; } public void ingresar(double cantidadIngresada) { saldo += cantidadIngresada; } public void retirar(double cantidadRetirada) { saldo -= cantidadRetirada; } public void traspasar(CuentaBancaria cuentaAjena, double saldoTraspasado) { retirar(saldoTraspasado); cuentaAjena.ingresar(saldoTraspasado); } public void mostrar() { System.out.println("\nIBAN: " + iban); System.out.println("Saldo: " + saldo); System.out.println("Interes Anual Básico: " + interesAnualBasico + "\n"); } public abstract void calcularIntereses(); }
[ "dgomezmo99@gmail.com" ]
dgomezmo99@gmail.com
7582c6074f99d67dcd85eeae95844d4a3f9ea25a
4feb2b7d208b5608b853d8ed85520a7e91e67600
/app/src/main/java/com/example/gears/gameObjects/Message.java
608a34e5b5f4b4df32f6b05485430bc0ae73ea2c
[]
no_license
JaneKirillova/Gears
fd39c00ff9f2b5a6783049995f146bccdc54ab10
a700e614de6c9966b5666d4f33898afbfb8331d3
refs/heads/main
2023-06-24T18:34:00.058497
2021-06-17T23:49:07
2021-06-17T23:49:07
347,331,784
4
0
null
null
null
null
UTF-8
Java
false
false
441
java
package com.example.gears.gameObjects; public class Message { public enum MessageType { FIRSTTYPE, SECONDTYPE, THIRDTYPE, FOURTHTYPE } private MessageType message; public Message(MessageType message) { this.message = message; } public Message() { } public void setMessage(MessageType message) { this.message = message; } public MessageType getMessage() { return message; } }
[ "grindevald666@gmail.com" ]
grindevald666@gmail.com
025f256c5c80f957a1fda57be79b29eff5f796e7
f8cb6ba0fb47ae01b2620b4603504f14fddab0b7
/ibator/src/org/mybatis/generator/api/DAOMethodNameCalculator.java
38ebced817d10407e7cff3437f910819a7cf741f
[]
no_license
shijiyu/mybatis-tool
3a4015c9370f7ba471a3932e28f7acf3722cd2d6
1cef575358489ded82293d488418365a0978a928
refs/heads/master
2020-04-05T02:32:31.686876
2018-11-08T02:56:08
2018-11-08T02:56:08
156,480,967
0
0
null
null
null
null
UTF-8
Java
false
false
1,860
java
package org.mybatis.generator.api; import org.apache.ibatis.session.RowBounds; public abstract interface DAOMethodNameCalculator { public abstract String getInsertMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getInsertSelectiveMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByPrimaryKeyWithoutBLOBsMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByPrimaryKeyWithBLOBsMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByPrimaryKeySelectiveMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getSelectByPrimaryKeyMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getSelectByExampleWithoutBLOBsMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getSelectByExampleWithoutBLOBsMethodName(IntrospectedTable paramIntrospectedTable, RowBounds paramRowBounds); public abstract String getSelectByExampleWithBLOBsMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getSelectByExampleWithBLOBsMethodName(IntrospectedTable paramIntrospectedTable, RowBounds paramRowBounds); public abstract String getDeleteByPrimaryKeyMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getDeleteByExampleMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getCountByExampleMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByExampleSelectiveMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByExampleWithBLOBsMethodName(IntrospectedTable paramIntrospectedTable); public abstract String getUpdateByExampleWithoutBLOBsMethodName(IntrospectedTable paramIntrospectedTable); }
[ "shijy2@Lenovo.com" ]
shijy2@Lenovo.com
64d17bd2fde26e3875404908b9fc120483c49388
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/transform/AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller.java
ff013d0393dbf7b57fa04e4bf56b08e353c3b7dc
[ "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
4,262
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.securityhub.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.securityhub.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller { private static final MarshallingInfo<Boolean> CLOUDWATCHENCRYPTIONENABLED_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("CloudWatchEncryptionEnabled").build(); private static final MarshallingInfo<String> CLOUDWATCHLOGGROUPNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("CloudWatchLogGroupName").build(); private static final MarshallingInfo<String> S3BUCKETNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("S3BucketName").build(); private static final MarshallingInfo<Boolean> S3ENCRYPTIONENABLED_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("S3EncryptionEnabled").build(); private static final MarshallingInfo<String> S3KEYPREFIX_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("S3KeyPrefix").build(); private static final AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller instance = new AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller(); public static AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetailsMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall( AwsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails, ProtocolMarshaller protocolMarshaller) { if (awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails.getCloudWatchEncryptionEnabled(), CLOUDWATCHENCRYPTIONENABLED_BINDING); protocolMarshaller.marshall(awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails.getCloudWatchLogGroupName(), CLOUDWATCHLOGGROUPNAME_BINDING); protocolMarshaller.marshall(awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails.getS3BucketName(), S3BUCKETNAME_BINDING); protocolMarshaller.marshall(awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails.getS3EncryptionEnabled(), S3ENCRYPTIONENABLED_BINDING); protocolMarshaller.marshall(awsEcsClusterConfigurationExecuteCommandConfigurationLogConfigurationDetails.getS3KeyPrefix(), S3KEYPREFIX_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
3d63092198131e7dd89da37d7c2e6476bff23671
f0e7e1ad500381110535fe3356ba7b5178479acd
/kpoll-jpa/src/com/karmelos/kpoll/model/KeywordOption.java
00bb33760d04ee904b0ea8c4c8543fb6f1c746d0
[]
no_license
karmelosng/kpoll-jpa
a2d8030861a6b9f7a20bae7905edbf08ebc1f70b
548c8b90005dcb911d8764759ee9f09aee8de218
refs/heads/master
2020-05-30T14:15:15.930207
2014-11-19T11:55:20
2014-11-19T11:55:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.karmelos.kpoll.model; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class KeywordOption { private String id; private String description; @Id public String getId() { return id; } public void setId(String id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "fatimehindare@gmail.com" ]
fatimehindare@gmail.com
ee48454359635eb3f45ef053f189396be904c037
5a93fc138710cfaf87721ded08c25daa8bb777d8
/bitcamp/src/main/java/com/bitcamp/web/board/BoardService.java
95af6aff597cbf22c4f79734d84c84085ee1a923
[]
no_license
youjin813/eGovFrameDev
c9a81f65ed8c1cc2019a273a3ccd9eb67b5cee5d
373b529c00c7b160dab9106c4afa3d72355879f4
refs/heads/master
2020-03-08T17:59:40.895757
2018-04-06T03:53:15
2018-04-06T03:53:15
128,283,698
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package com.bitcamp.web.board; public class BoardService { }
[ "youjin813@naver.com" ]
youjin813@naver.com
d2bd4bd6ece37615359800a42eff9c1a49e2a97d
90619e40ed55e5db66e33f602a4e53a848bc3bd0
/CSIS3475/src/TreePackage/BinaryTreeInterface.java
0f054b84961b585ce90d5fd5464660ad4415eab0
[]
no_license
jasonn0118/DataStructure_Basic
3709f142ed2dd8f1bbfae142bcabf84a92e5bf17
52f8b0f858a647119828e5b1c246eed793a47729
refs/heads/master
2020-11-28T13:36:45.246670
2019-12-23T22:43:45
2019-12-23T22:43:45
229,832,339
0
0
null
null
null
null
UTF-8
Java
false
false
765
java
package TreePackage; /** * An interface for the ADT binary tree. * * @author Frank M. Carrano * @author Timothy M. Henry * @version 5.0 */ public interface BinaryTreeInterface<T> extends TreeInterface<T>, TreeIteratorInterface<T> { /** * Sets the data in the root of this binary tree. * * @param rootData The object that is the data for the tree's root. */ public void setRootData(T rootData); /** * Sets this binary tree to a new binary tree. * * @param rootData The object that is the data for the new tree's root. * @param leftTree The left subtree of the new tree. * @param rightTree The right subtree of the new tree. */ public void setTree(T rootData, BinaryTreeInterface<T> leftTree, BinaryTreeInterface<T> rightTree); }
[ "tlswoals2006@gmail.com" ]
tlswoals2006@gmail.com
280f5b991a7a1cff91e050b3c8ad2b64e778f7e2
ea718a60b9f4ff765fe94b72479e35d12440342a
/src/main/java/br/com/facilita/autenticacao/service/impl/PerfilServiceImpl.java
410e035a0d210d165fa74a667dc7b1a8b2d67dbb
[]
no_license
Bleenho/autenticacao-sistemas
8b00436800aefd7a7dccbcfae11c1790330787da
fca24a47d72a3ea54c563549c8e0199b1f2387cc
refs/heads/master
2020-03-26T15:40:55.610895
2019-05-05T15:41:09
2019-05-05T15:41:09
145,058,054
1
0
null
null
null
null
UTF-8
Java
false
false
3,472
java
package br.com.facilita.autenticacao.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import br.com.facilita.autenticacao.api.request.AcaoModuloPerfil; import br.com.facilita.autenticacao.api.request.ModuleIntoPerfilRequest; import br.com.facilita.autenticacao.api.request.PerfilRegisterRequest; import br.com.facilita.autenticacao.exception.BadRequestException; import br.com.facilita.autenticacao.model.Modulo; import br.com.facilita.autenticacao.model.ModuloPerfil; import br.com.facilita.autenticacao.model.Perfil; import br.com.facilita.autenticacao.repository.ModuleRepository; import br.com.facilita.autenticacao.repository.ModuloPerfilRepository; import br.com.facilita.autenticacao.repository.PerfilRepository; import br.com.facilita.autenticacao.service.PerfilService; @Service @Transactional public class PerfilServiceImpl implements PerfilService { private PerfilRepository perfilRepository; private ModuloPerfilRepository moduloPerfilRepository; private ModuleRepository moduleRepository; @Autowired public PerfilServiceImpl(PerfilRepository perfilRepository, ModuloPerfilRepository moduloPerfilRepository, ModuleRepository moduleRepository) { this.perfilRepository = perfilRepository; this.moduloPerfilRepository = moduloPerfilRepository; this.moduleRepository = moduleRepository; } @Override public Long createPerfil(PerfilRegisterRequest perfilRegisterRequest) { Perfil perfil = perfilRepository.save(Perfil.builder().dsPerfil(perfilRegisterRequest.getDescribePerfil()).build()); addModuloToPerfil(perfil, perfilRegisterRequest.getIdsModulo()); return perfil.getIdPerfil(); } @Override public void alterModulesIntoPerfil(ModuleIntoPerfilRequest moduleIntoPerfilRequest) { Perfil perfil = perfilRepository.findOne(moduleIntoPerfilRequest.getIdPerfil()); if(ObjectUtils.isEmpty(perfil)) { throw new BadRequestException("Perfil de id: " + moduleIntoPerfilRequest.getIdPerfil()); } if(AcaoModuloPerfil.ADD.equals(moduleIntoPerfilRequest.getAcao())) { addModuloToPerfil(perfil, moduleIntoPerfilRequest.getIdsModulo()); return ; } removeModuloToPerfil(perfil, moduleIntoPerfilRequest.getIdsModulo()); } @Override public List<Perfil> allPerfis() { return perfilRepository.findAll(); } @Override public Perfil findOne(Long idPerfil) { return perfilRepository.findOne(idPerfil); } private void addModuloToPerfil(Perfil perfil, List<Long> idsModulo) { idsModulo.stream().forEach(idModulo -> { Modulo modulo = moduleRepository.findOne(idModulo); if(ObjectUtils.isEmpty(modulo)) { throw new BadRequestException("Modulo de id: " + idModulo); } moduloPerfilRepository.save( ModuloPerfil.builder() .perfil(perfil) .modulo(modulo) .build()); }); } private void removeModuloToPerfil(Perfil perfil, List<Long> idsModulo) { idsModulo.stream().forEach(idModulo -> { Modulo modulo = moduleRepository.findOne(idModulo); if(ObjectUtils.isEmpty(modulo)) { throw new BadRequestException("Modulo de id: " + idModulo); } moduloPerfilRepository.findByModuloIdModuloAndPerfilIdPerfil(idModulo, perfil.getIdPerfil()) .stream().forEach(moduloPerfil -> { moduloPerfilRepository.delete(moduloPerfil.getIdModuloPerfil()); }); }); } }
[ "pableeenho@gmail.com" ]
pableeenho@gmail.com
6e6fe6c7540d67ffd8561bfa341d63bf17300729
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-iotevents/src/main/java/com/amazonaws/services/iotevents/model/transform/NotificationActionMarshaller.java
270f523e5a96fe3c7d42c2cb86827ebce4681c63
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,696
java
/* * Copyright 2018-2023 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.iotevents.model.transform; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.iotevents.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * NotificationActionMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class NotificationActionMarshaller { private static final MarshallingInfo<StructuredPojo> ACTION_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("action").build(); private static final MarshallingInfo<List> SMSCONFIGURATIONS_BINDING = MarshallingInfo.builder(MarshallingType.LIST) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("smsConfigurations").build(); private static final MarshallingInfo<List> EMAILCONFIGURATIONS_BINDING = MarshallingInfo.builder(MarshallingType.LIST) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("emailConfigurations").build(); private static final NotificationActionMarshaller instance = new NotificationActionMarshaller(); public static NotificationActionMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(NotificationAction notificationAction, ProtocolMarshaller protocolMarshaller) { if (notificationAction == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(notificationAction.getAction(), ACTION_BINDING); protocolMarshaller.marshall(notificationAction.getSmsConfigurations(), SMSCONFIGURATIONS_BINDING); protocolMarshaller.marshall(notificationAction.getEmailConfigurations(), EMAILCONFIGURATIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
db45f576168e406b3f05b480ceee8f6ddf2a4ac1
171957f24568800a3b83a90cafa83a3517a653b3
/KWoBox/src/com/custom/kwobox/service/CustomDynamicPasswordService.java
22a4156e36910a0748b68ef8997e9ed5bef0843e
[]
no_license
vip23h59m60s/GitRepo
9380ed59d015af48a08dd36e17f910560fd5e50c
295ef7f23ff3a2ba3737baa74fa10798f6b04ead
refs/heads/master
2020-04-04T01:57:42.185690
2018-11-01T08:31:27
2018-11-01T08:31:27
155,683,893
0
0
null
null
null
null
UTF-8
Java
false
false
4,178
java
package com.custom.kwobox.service; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import net.sf.json.JSONObject; import com.chinapalms.kwobox.javabean.Boxes; import com.chinapalms.kwobox.javabean.Customer; import com.chinapalms.kwobox.javabean.DynamicPasswordCallback; import com.chinapalms.kwobox.service.BoxesService; import com.chinapalms.kwobox.service.CustomerService; import com.chinapalms.kwobox.service.DynamicPasswordCallbackService; import com.chinapalms.kwobox.utils.HttpUtil; import com.chinapalms.kwobox.utils.ResponseStatus; public class CustomDynamicPasswordService { Log log = LogFactory.getLog(CustomDynamicPasswordService.class); // 获取动态密码商户回调Url public String getCustomerDynamicPasswordCallbackUrl(String boxId) { BoxesService boxesService = new BoxesService(); Boxes boxes = boxesService.findBoxesByBoxId(boxId); if (boxes != null) { // 根据商户ID查询商户合作模式 CustomerService customerService = new CustomerService(); Customer customer = customerService.findCustomerByCustomerId(boxes .getCustomerId()); // 判断是否是小e或Yoho服务器对接模式 if (customer != null) { DynamicPasswordCallbackService dynamicPasswordCallbackService = new DynamicPasswordCallbackService(); DynamicPasswordCallback dynamicPasswordCallback = dynamicPasswordCallbackService .findDynamicPasswordCallbackByCustomerId(boxes .getCustomerId()); int cooperationMode = customer.getCooperationMode(); if (dynamicPasswordCallback != null) { // 判断是否是小e服务器堆积或Yoho代理模式 if (cooperationMode == ResponseStatus.COOPERATIONMODE_THIRD_INTERFACE || cooperationMode == ResponseStatus.COOPERATIONMODE_AGENT) { // 如果是小e或Yoho模式将url和urlType成Json风格返回 JSONObject jsonObject = new JSONObject(); jsonObject.put("urlType", cooperationMode); jsonObject.put("url", dynamicPasswordCallback .getDynamicPasswordCallbackUrl()); return jsonObject.toString(); } else { // 如果不是小e或Yoho模式,直接返回FAIL return ResponseStatus.FAIL; } } else { // 如果不是小e或Yoho模式,直接返回FAIL return ResponseStatus.FAIL; } // 如果不是小e服务器对接模式,直接返回FAIL } else { return ResponseStatus.FAIL; } } else { return ResponseStatus.FAIL; } } /** * 将动态密码信息回调给商户服务器进行校验 * * @param dynamicPasswordCallbackUrlObject * @param boxId * @param dynamicPassword * @return */ public String notifyCustomerServerToCheckDynamicPassword( String dynamicPasswordCallbackUrlObject, String boxId, String dynamicPassword) { CustomResponseService customResponseService = new CustomResponseService(); JSONObject jsonObject = new JSONObject(); jsonObject.put("boxId", boxId); jsonObject.put("dynamicPassword", dynamicPassword); String responseToCustom = customResponseService .getReturnSuccessAndResultSuccessResponse(jsonObject.toString()); String dynamicPasswordCallbackUrl = JSONObject.fromObject( dynamicPasswordCallbackUrlObject).getString("url"); String checkResult = HttpUtil.sendCallbackResultMsg( dynamicPasswordCallbackUrl, JSONObject.fromObject(responseToCustom)); log.info("notifyCustomerServerToCheckDynamicPassword checkResult=" + checkResult); return checkResult; } }
[ "32049212+vip23h59m60s@users.noreply.github.com" ]
32049212+vip23h59m60s@users.noreply.github.com
eace9132408d11c772116ec35ab6990a1d28c60e
4fe46c0de9ee605208229794cdce7a11c9e91d4a
/src/main/java/com/puc/dsiapi/resource/PacienteResource.java
156e153e7aa2bf3a8253f1d798e1f0acf2d9e4b9
[]
no_license
lmfrocha/trabalho-dsi-java
6390893bcb38fc68b2a63b1f5fbdfeb1e044befb
78b1c003c7b5e226779054c2c682441632e7c1f4
refs/heads/master
2020-04-24T05:56:27.318963
2019-03-19T11:30:31
2019-03-19T11:30:31
171,748,133
0
0
null
null
null
null
UTF-8
Java
false
false
2,689
java
package com.puc.dsiapi.resource; import java.util.List; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.puc.dsiapi.event.RecursoCriadoEvent; import com.puc.dsiapi.model.Paciente; import com.puc.dsiapi.repository.PacienteRepository; import com.puc.dsiapi.service.PacienteService; @RestController @RequestMapping("/paciente") public class PacienteResource { @Autowired private PacienteRepository pacienteRepository; @Autowired private PacienteService pacienteService; @GetMapping //Listar public List<Paciente> listar() { return pacienteRepository.findAll(); } @Autowired private ApplicationEventPublisher publisher; @PostMapping //criar public ResponseEntity<Paciente> criar(@Valid @RequestBody Paciente paciente, HttpServletResponse response) { Paciente pacienteSalvo = pacienteRepository.save(paciente); publisher.publishEvent(new RecursoCriadoEvent(this, response, pacienteSalvo.getId())); return ResponseEntity.status(HttpStatus.CREATED).body(pacienteSalvo); } @GetMapping("/{id}") //buscar public ResponseEntity<Paciente> buscarPeloPaciente (@PathVariable Long id) { Paciente paciente = pacienteRepository.getOne(id); return paciente != null ? ResponseEntity.ok(paciente) : ResponseEntity.notFound().build(); } @DeleteMapping("/{id}") //deletar @ResponseStatus(HttpStatus.NO_CONTENT) public void remover(@PathVariable Long id) { Paciente pacienteExist = pacienteRepository.getOne(id); if(pacienteExist == null) { throw new EmptyResultDataAccessException(1); } pacienteRepository.deleteById(id); } @PutMapping("/{id}") //atualizar public ResponseEntity<Paciente> atualizar(@PathVariable Long id, @RequestBody Paciente paciente){ Paciente pacienteSalva = pacienteService.atualizar(id, paciente); return ResponseEntity.ok(pacienteSalva); } }
[ "lucas.frocha@vli-logistica.com.br" ]
lucas.frocha@vli-logistica.com.br
768c7cad84d1e96881aef70e9ce29e48bca017ac
fdaa44551df28b58bd0a30a047c8a51ded23ddfb
/src/ex10/Three.java
1fc7302e8fe9998789ec20a37b2f180c3fb16293
[]
no_license
BlackBlastRavenSub/ProgrammingClass
8a3e65ffd9366c50089717a8c6af4487b2a98c22
8d28b8de9e0fd85aafd7cfb55f1605ba3b848f3a
refs/heads/master
2021-09-17T15:06:45.613183
2018-07-03T06:45:55
2018-07-03T06:45:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package ex10; public class Three extends Two { public int result2(){ return result1(); } public int result3(){ return super.test(); } }
[ "smallbear0608@gmail.com" ]
smallbear0608@gmail.com
860e80d43a397335ec43d560c8c7148a6a022d24
9d5e7f81192dfd6ec541dc4f2b34208885e9ed0a
/app/src/main/java/com/gaoyy/learningcustomview/view/CouponView.java
f22144aae4dbb1a99ecda27de0685626c21a3131
[ "Apache-2.0" ]
permissive
gaoyuyu/LearningCustomView
d73ede5f35b6ee1e671b1e15f78f6461402dfe04
de6be47c147b732bbfaa2229b5cf3eb5b0de7107
refs/heads/master
2021-01-11T22:52:14.135780
2019-01-09T09:01:06
2019-01-09T09:01:06
78,510,079
0
0
null
null
null
null
UTF-8
Java
false
false
10,890
java
package com.gaoyy.learningcustomview.view; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.DashPathEffect; import android.graphics.Paint; import android.graphics.PaintFlagsDrawFilter; import android.graphics.Path; import android.graphics.RectF; import android.os.Build; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import com.gaoyy.learningcustomview.R; public class CouponView extends View { private static final String TAG = CouponView.class.getSimpleName(); public static final int ACTIVE = 1; public static final int INACTIVE = 2; private static final int DASH_LINE_TOP = 1; private static final int DASH_LINE_BOTTOM = 2; private PaintFlagsDrawFilter pfd; private int mWidth; private int mHeight; private int mMode; private boolean mLeftTop, mLeftBottom, mRightTop, mRightBottom; private int mBgColor, mLineColor; private int mLineWidth, mCornerCircleRadius, mRectCornerRadius, mMidDashLineWidth; private int mMidDashLinePosition; private Paint mRectPaint, mCirclePaint, mWhitePaint, mWhiteDashPaint, mMidLineDashPaint; private Path mPath; public CouponView(Context context) { this(context, null); } public CouponView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, -1); } public CouponView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initParams(context, attrs); initPaint(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public CouponView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); initParams(context, attrs); initPaint(); } private void initParams(Context context, AttributeSet attrs) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.CouponView); mMode = ta.getInt(R.styleable.CouponView_mode, 2); mLeftTop = ta.getBoolean(R.styleable.CouponView_leftTop, false); mLeftBottom = ta.getBoolean(R.styleable.CouponView_leftBottom, false); mRightTop = ta.getBoolean(R.styleable.CouponView_rightTop, false); mRightBottom = ta.getBoolean(R.styleable.CouponView_rightBottom, false); mBgColor = ta.getColor(R.styleable.CouponView_bgColor, Color.parseColor("#FFBE23")); mLineColor = ta.getColor(R.styleable.CouponView_lineColor, Color.parseColor("#949494")); mLineWidth = ta.getDimensionPixelSize(R.styleable.CouponView_lineWidth, mLineWidth); mCornerCircleRadius = ta.getDimensionPixelSize(R.styleable.CouponView_cornerCircleRadius, mCornerCircleRadius); mRectCornerRadius = ta.getDimensionPixelSize(R.styleable.CouponView_rectCornerRadius, mRectCornerRadius); mMidDashLinePosition = ta.getInt(R.styleable.CouponView_midDashLinePosition, 0); mMidDashLineWidth = ta.getDimensionPixelSize(R.styleable.CouponView_midDashLineWidth, mMidDashLineWidth); ta.recycle(); } private void initPaint() { pfd = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mCirclePaint = new Paint(); mCirclePaint.setAntiAlias(true); mWhitePaint = new Paint(); mWhitePaint.setAntiAlias(true); mWhitePaint.setColor(Color.WHITE); mWhitePaint.setStyle(Paint.Style.FILL_AND_STROKE); //白色虚线画笔,画虚线必须用path mWhiteDashPaint = new Paint(); mWhiteDashPaint.setAntiAlias(true); mWhiteDashPaint.setColor(Color.WHITE); mWhiteDashPaint.setStyle(Paint.Style.STROKE); mWhiteDashPaint.setStrokeWidth(mMidDashLineWidth); mWhiteDashPaint.setPathEffect(new DashPathEffect(new float[]{15, 10}, 0)); //gray虚线画笔 mMidLineDashPaint = new Paint(); mMidLineDashPaint.setAntiAlias(true); mMidLineDashPaint.setColor(mLineColor); mMidLineDashPaint.setStyle(Paint.Style.STROKE); mMidLineDashPaint.setStrokeWidth(mMidDashLineWidth); mMidLineDashPaint.setPathEffect(new DashPathEffect(new float[]{15, 10}, 0)); mPath = new Path(); } @SuppressLint("DrawAllocation") @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.setDrawFilter(pfd); if (mMode == ACTIVE) { mRectPaint.setColor(mBgColor); mRectPaint.setStyle(Paint.Style.FILL_AND_STROKE); RectF rectF = new RectF(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rectF, mRectCornerRadius, mRectCornerRadius, mRectPaint); mCirclePaint.setColor(Color.WHITE); mCirclePaint.setStyle(Paint.Style.FILL_AND_STROKE); if (mMidDashLinePosition == DASH_LINE_TOP) { mPath.reset(); mPath.moveTo(0, 0); mPath.lineTo(getMeasuredWidth(), 0); canvas.drawPath(mPath, mWhiteDashPaint); } else if (mMidDashLinePosition == DASH_LINE_BOTTOM) { mPath.reset(); mPath.moveTo(0, getMeasuredHeight()); mPath.lineTo(getMeasuredWidth(), getMeasuredHeight()); canvas.drawPath(mPath, mWhiteDashPaint); } } else if (mMode == INACTIVE) { mRectPaint.setColor(mLineColor); mRectPaint.setStyle(Paint.Style.FILL); RectF rectF = new RectF(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRoundRect(rectF, mRectCornerRadius, mRectCornerRadius, mRectPaint); RectF whiteRectF = new RectF(mLineWidth, mLineWidth, getMeasuredWidth()-mLineWidth, getMeasuredHeight()-mLineWidth); canvas.drawRoundRect(whiteRectF, mRectCornerRadius, mRectCornerRadius, mWhitePaint); mCirclePaint.setColor(mLineColor); mCirclePaint.setStyle(Paint.Style.FILL_AND_STROKE); if (mMidDashLinePosition == DASH_LINE_TOP) { //覆盖实线 Paint tmpPaint = new Paint(); tmpPaint.setStrokeWidth(10); tmpPaint.setColor(Color.WHITE); canvas.drawLine(0, 0, getMeasuredWidth(), 0, tmpPaint); mPath.reset(); mPath.moveTo(0, 0); mPath.lineTo(getMeasuredWidth(), 0); canvas.drawPath(mPath, mMidLineDashPaint); } else if (mMidDashLinePosition == DASH_LINE_BOTTOM) { //覆盖实线 Paint tmpPaint = new Paint(); tmpPaint.setStrokeWidth(10); tmpPaint.setColor(Color.WHITE); canvas.drawLine(0, getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight(), tmpPaint); mPath.reset(); mPath.moveTo(0, getMeasuredHeight()); mPath.lineTo(getMeasuredWidth(), getMeasuredHeight()); canvas.drawPath(mPath, mMidLineDashPaint); } } drawCornerCircle(canvas); } /** * 绘制四个角的圆形 * * @param canvas */ private void drawCornerCircle(Canvas canvas) { if (mLeftTop) { canvas.drawCircle(0, 0, mCornerCircleRadius, mCirclePaint); canvas.drawCircle(0, 0, mCornerCircleRadius - mLineWidth, mWhitePaint); } if (mLeftBottom) { canvas.drawCircle(0, getMeasuredHeight(), mCornerCircleRadius, mCirclePaint); canvas.drawCircle(0, getMeasuredHeight(), mCornerCircleRadius - mLineWidth, mWhitePaint); } if (mRightTop) { canvas.drawCircle(getMeasuredWidth(), 0, mCornerCircleRadius, mCirclePaint); canvas.drawCircle(getMeasuredWidth(), 0, mCornerCircleRadius - mLineWidth, mWhitePaint); } if (mRightBottom) { canvas.drawCircle(getMeasuredWidth(), getMeasuredHeight(), mCornerCircleRadius, mCirclePaint); canvas.drawCircle(getMeasuredWidth(), getMeasuredHeight(), mCornerCircleRadius - mLineWidth, mWhitePaint); } } public void setMode(int mMode) { this.mMode = mMode; invalidate(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec)); Log.i(TAG, "onMeasure" + getMeasuredWidth() + "_______" + getMeasuredHeight()); } private int measureWidth(int widthMeasureSpec) { int result = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()); int specMode = MeasureSpec.getMode(widthMeasureSpec); int specSize = MeasureSpec.getSize(widthMeasureSpec); switch (specMode) { case MeasureSpec.EXACTLY: Log.i(TAG, "width MeasureSpec.EXACTLY"); result = specSize; break; case MeasureSpec.UNSPECIFIED: Log.i(TAG, "width MeasureSpec.UNSPECIFIED"); break; case MeasureSpec.AT_MOST: Log.i(TAG, "width MeasureSpec.AT_MOST"); break; } mWidth = result; return result; } private int measureHeight(int heightMeasureSpec) { int result = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()); int specMode = MeasureSpec.getMode(heightMeasureSpec); int specSize = MeasureSpec.getSize(heightMeasureSpec); switch (specMode) { case MeasureSpec.EXACTLY: Log.i(TAG, "height MeasureSpec.EXACTLY"); result = specSize; break; case MeasureSpec.UNSPECIFIED: Log.i(TAG, "height MeasureSpec.UNSPECIFIED"); break; case MeasureSpec.AT_MOST: Log.i(TAG, "height MeasureSpec.AT_MOST"); //wrap_content下默认为200dp break; } mHeight = result; return result; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mWidth = w; mHeight = h; } }
[ "740514999@qq.com" ]
740514999@qq.com
6796d9588deb0901ec894174bcb52869ba18fefb
8978ee4cdbe13815f22b2500db1d13bf8b5b59fb
/src/main/java/source/config/SwaggerConfig.java
ccfe5d7028b638cf98440037f5419b6eb8332e43
[]
no_license
milano95a/kasper
cf5f204786996b5827e70ddf2ba819d93967319c
268f37a82ac9ec2eefe636d61be9ad4d03df509d
refs/heads/master
2020-03-17T14:27:17.177313
2018-05-16T13:49:06
2018-05-16T13:49:06
133,672,714
0
0
null
null
null
null
UTF-8
Java
false
false
2,188
java
package source.config; import com.google.common.base.Predicates; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.RequestMethod; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.ResponseMessageBuilder; import springfox.documentation.schema.ModelRef; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static com.google.common.collect.Lists.newArrayList; @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket productApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(Predicates.not(PathSelectors.regex("/error.*"))) .paths(Predicates.not(PathSelectors.regex("/docs.*"))) // .paths(Predicates.not(PathSelectors.regex("/api/user.*"))) .build() .apiInfo(metaData()) .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.GET, newArrayList(response404.build())) .globalResponseMessage(RequestMethod.POST, newArrayList(response404.build())) ; } private ApiInfo metaData() { ApiInfo apiInfo = new ApiInfo( "Spring Boot REST API", "Spring Boot REST API for Kasper", "1.0", "Terms of service", new Contact("Abdurakhmon Jamoliddinov", null, null), null, null); return apiInfo; } ResponseMessageBuilder response404 = new ResponseMessageBuilder() .code(404) .message("Not Found") .responseModel(new ModelRef("Error")); }
[ "milano95j@gmail.com" ]
milano95j@gmail.com
9dc98043c734f0a8edc4039998ecdf65320df458
a111eb3d9464b25fdac9ed89d8f93a61bb0dd067
/src/main/java/com/dsp/web/service/system/SysMenuService.java
2669422a3a6cd8d98a78196eb9432216daab70b6
[]
no_license
wtuliumeng/dspservice
3f4ba1ec9a68c941543ee7bfc385aef0fd087e23
1280ecdd6b0fca7bd00b9c776fc215d536ecd106
refs/heads/master
2022-02-27T06:31:51.187762
2020-04-22T13:12:22
2020-04-22T13:12:22
247,897,332
0
0
null
2022-02-09T22:36:38
2020-03-17T06:37:21
Java
UTF-8
Java
false
false
521
java
package com.dsp.web.service.system; import com.dsp.web.model.system.SysMenuParam; import com.dsp.web.model.system.SysMenuVo; import com.dsp.web.model.system.TreeNodeVo; import com.dsp.web.model.vo.ResponseResult; import java.util.List; public interface SysMenuService { ResponseResult<SysMenuVo> querySysMenuByPrimaryKey(Long ID); List<SysMenuVo> querySysMenuList(SysMenuParam sysMenuParam); Long updateSysMenu(SysMenuVo vo); Long insertSysMenu(SysMenuVo vo); void deleteSysMenu(String ids); }
[ "13527876435@qq.com" ]
13527876435@qq.com
946ee46e50f9ef29f2c291e90f15f748e8e0334a
f8e10059feffe9d8a9b531d078bf99eed9af33af
/SpringSample/src/main/java/com/atmecs/Details.java
2b889f5af47abc79755f8dea2acbf3d30692fc30
[]
no_license
unnamalaisenthilnathan/Assignment1
39d22fa723a446b11a4c195915c2054b283741c6
ead510b4d46cf472176a1620381614a807d75c88
refs/heads/master
2022-12-21T11:58:30.921368
2019-08-26T08:09:38
2019-08-26T08:09:38
190,428,117
0
0
null
2022-12-16T05:00:20
2019-06-05T16:15:16
Rich Text Format
UTF-8
Java
false
false
675
java
package com.atmecs; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; public class Details { public static void main(String[] args) { Employee eRef= new Employee(); eRef.setEmployeeid(1020); eRef.setEmployeename("joe"); eRef.setEmployeeaddress("India"); System.out.println(eRef); Resource resource =new ClassPathResource("applicationContext.xml"); BeanFactory factory=new XmlBeanFactory(resource); Employee e1 = factory.getBean("Emp",Employee.class); System.out.println("Employee Details:"+e1); } }
[ "unnamalai.senthilnathan@atmecs.com" ]
unnamalai.senthilnathan@atmecs.com
c6152aeb627596a7e3c022ea80330fd6ff44b7fc
fe2f45d5bf11c00a8fdecc8e30164b89218c3f45
/src/Enc.java
0d3da26fb756af0c4a01abddfa2aa6cd482d385e
[]
no_license
AnjithaSuresh/Biometric-Authentication-using-PHE
dce68c59d9473d36df73fc69ef1b0e38503a4041
9be83e2d7171b0b327d62db9c61efd0dddbc7a1f
refs/heads/master
2022-11-22T01:59:49.034508
2020-07-20T10:02:01
2020-07-20T10:02:01
273,227,857
1
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
import java.math.BigInteger; import java.security.SecureRandom; import java.util.*; public class Enc { public static BigInteger[][] encrypt(String msg) { SecureRandom random = new SecureRandom(); BigInteger z = BigInteger.valueOf(573744); BigInteger N = BigInteger.valueOf(577021); BigInteger x = uniformX(N, random); char charr[]= msg.toCharArray(); byte[] message= charArrayToByteArray(charr); // String ct=""; BigInteger[][] enmsg= new BigInteger[msg.length()][8]; for(int i=0; i<message.length; ++i) { int k = message[i]; //System.out.print(k+" "); for (int bit = 7, j=0; bit >= 0; --bit, ++j) { int b = (k >>> bit) & 1; //System.out.print(b+" "); BigInteger m= BigInteger.valueOf(b); BigInteger c = (z.modPow(m, N).multiply(x.modPow(BigInteger.TWO, N))).mod(N); //ct=ct+c.toString()+" "; enmsg[i][j]= c; } } return enmsg; } public static BigInteger uniformX(BigInteger N, SecureRandom random) { BigInteger x = BigInteger.ZERO; do { x = new BigInteger(N.bitLength(), random); } while ((x.compareTo(BigInteger.ZERO) == -1) || (x.compareTo(N) == 1)); return x; } public static byte[] charArrayToByteArray(char[] chars) { byte[] bytes = new byte[chars.length]; for(int i=0;i<chars.length;i++) { bytes[i] = (byte) chars[i]; } return bytes; } }
[ "35233616+AnjithaSuresh@users.noreply.github.com" ]
35233616+AnjithaSuresh@users.noreply.github.com
a231130a78e989ffff399d0ef4befcf0a9b63989
2e0d191d704c0b6638567cb700a6e05a55a964cf
/app/src/main/java/com/example/android/inventoryapp/data/ProductContract.java
886736d0777dc7a2fde4ba7cf31e3c9d95bbec6c
[]
no_license
alejandra-gonzalez/InventoryApp
d1608ecbee992c77385a89d749ea87f6cd30afd5
8a771d6d1357bebdbc32856ddc3b24167d42f62c
refs/heads/master
2020-03-26T17:49:32.287401
2018-10-08T03:56:53
2018-10-08T03:56:53
145,183,136
0
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
package com.example.android.inventoryapp.data; import android.net.Uri; import android.provider.BaseColumns; public final class ProductContract { public static final String CONTENT_AUTHORITY = "com.example.android.inventory"; public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); public static final String PATH_INVENTORY = "inventory"; /** * Suppress the constructor, since this class should not be instantiated. */ private ProductContract() { } /** * Inner class for Inventory table. */ public static final class ProductEntry implements BaseColumns { public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, PATH_INVENTORY); public static final String TABLE_NAME = "inventory"; public static final String _ID = BaseColumns._ID; public static final String COLUMN_PRODUCT_NAME = "product_name"; public static final String COLUMN_PRODUCT_PRICE = "price"; public static final String COLUMN_PRODUCT_QUANTITY = "quantity"; public static final String COLUMN_SUPPLIER_NAME = "supplier_name"; public static final String COLUMN_SUPPLIER_PHONE_NUMBER = "supplier_phone_number"; } }
[ "gonzalez.alejandra.013@gmail.com" ]
gonzalez.alejandra.013@gmail.com
f2fb938f20122c0176f92837d4feddaa5492d493
33776e54cbbfcc3b457d9ef03a50a00e54211007
/mvpmodel/src/main/java/com/bwie/android/mvpmodel/contract/a.java
d72c6e3570d10b014841141ada335e02311ef337
[]
no_license
Zhangyaozhong/MyApplication4
8a076f40ffa69ee1fcd6caca4520a0363521ffd2
497464e98fc713dfcc6086a9d4ec3bb6f22c4b92
refs/heads/master
2020-04-13T14:21:39.791008
2018-12-30T01:42:28
2018-12-30T01:42:28
163,260,381
1
0
null
null
null
null
UTF-8
Java
false
false
64
java
package com.bwie.android.mvpmodel.contract; public class a { }
[ "749903998@qq.com" ]
749903998@qq.com
493154a272d49300c7e20415ecaf9100b953a72c
24a563a6cf0a78be8c73fd369dabf4833e42e1b8
/UshiLibrary/src/com/ushi/lib/android/fragment/BaseFragmentCompat.java
e930031dd311ed94d9bef949270c7a958fbc2ac3
[]
no_license
ushi3/Test-Repository
ec896a312b7a3649b445fba3b52a4f19d43fea04
405a8ebb0c3a534d94ee3a15c67ddb0130c1f583
refs/heads/master
2016-09-05T09:40:37.294124
2012-09-25T16:32:58
2012-09-25T16:32:58
5,952,350
0
1
null
null
null
null
UTF-8
Java
false
false
6,042
java
package com.ushi.lib.android.fragment; import android.app.Activity; import android.content.Context; import android.support.v4.app.Fragment; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import android.widget.AdapterView; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; /** * 便利メソッドをまとめただけ。 * * @author Ushi */ public class BaseFragmentCompat extends Fragment { private Context mContext; @Override public void onAttach(Activity activity) { super.onAttach(activity); mContext = activity.getApplicationContext(); } protected Context getApplicationContext() { return mContext; } /** * 指定したViewのテキストを設定します。 * * @param view * 検索対象のView * @param resId * リソースID * @param text * テキスト */ protected void setTextToView(View view, int resId, CharSequence text) { if (view == null) { view = getView(); } TextView textView = (TextView) view.findViewById(resId); textView.setText(text); } protected void setTextToView(int resId, CharSequence text) { setTextToView(null, resId, text); } /** * 指定したViewに設定されているテキストを取得します。 * * @param view * 検索対象のView * @param resId * リソースID * @return 設定されているテキスト */ protected String getTextByView(View view, int resId) { if (view == null) { view = getView(); } TextView textView = (TextView) view.findViewById(resId); return textView.getText().toString(); } protected String getTextByView(int resId) { return getTextByView(null, resId); } /** * 指定したViewにクリックリスナーをセットします。 * * @param view * 検索対象のView * @param resId * リソースID * @param listener * セットするリスナー */ protected void setOnClickListener(View view, int resId, OnClickListener listener) { if (view == null) { view = getView(); } view.findViewById(resId).setOnClickListener(listener); } protected void setOnClickListener(int resId, OnClickListener listener) { setOnClickListener(null, resId, listener); } /** * 指定したViewにロングクリックリスナーをセットします。 * * @param view * 検索対象のView * @param resId * リソースID * @param listener * セットするリスナー */ protected void setOnLongClickListener(View view, int resId, OnLongClickListener listener) { if (view == null) { view = getView(); } view.findViewById(resId).setOnLongClickListener(listener); } protected void setOnLongClickListener(int resId, OnLongClickListener listener) { setOnLongClickListener(null, resId, listener); } /** * 指定したViewにタッチリスナーをセットします。 * * @param view * 検索対象のView * @param resId * リソースID * @param listener * セットするリスナー */ protected void setOnTouchListener(View view, int resId, OnTouchListener listener) { if (view == null) { view = getView(); } view.findViewById(resId).setOnTouchListener(listener); } protected void setOnTouchListener(int resId, OnTouchListener listener) { setOnTouchListener(null, resId, listener); } /** * 指定したViewにシークチェンジリスナーをセットします。 * * @param view * 検索対象のView * @param resId * リソースID * @param listener * セットするリスナー */ protected void setOnSeekBarChangeListener(View view, int resId, OnSeekBarChangeListener listener) { if (view == null) { view = getView(); } ((SeekBar) view.findViewById(resId)).setOnSeekBarChangeListener(listener); } protected void setOnSeekBarChangeListener(int resId, OnSeekBarChangeListener listener) { setOnSeekBarChangeListener(null, resId, listener); } /** * 指定したSeekBarの値を増加します。 * * @param view * 検索対象のView * @param resId * リソースID * @param add * 増分値 (0~SeekBarのMaxに丸められます。) */ protected void addSeek(View view, int resId, int add) { if (view == null) { view = getView(); } SeekBar seekBar = (SeekBar) view.findViewById(resId); seekBar.setProgress(Math.min(seekBar.getMax(), Math.max(0, seekBar.getProgress() + add))); } /** * 指定したシークバーの現在のプログレスを返します。 * * @param view * 検索対象のView * @param resId * リソースID * @return シークバーのプログレス */ protected int getSeekProgress(View view, int resId) { if (view == null) { view = getView(); } SeekBar seekBar = (SeekBar) view.findViewById(resId); return seekBar.getProgress(); } protected int getSeekProgress(int resId) { return getSeekProgress(null, resId); } /** * 指定したAdapterViewの現在選択されているObjectを返します。 * * @param view * 検索対象のView * @param resId * リソースID * @return 選択されている AdapterのgetItem()の返却値 */ protected Object getSelectedItem(View view, int resId) { if (view == null) { view = getView(); } AdapterView<?> adapterView = (AdapterView<?>) view.findViewById(resId); return adapterView.getSelectedItem(); } protected Object getSelectedItem(int resId) { return getSelectedItem(null, resId); } }
[ "ushi3.jp@gmail.com" ]
ushi3.jp@gmail.com
5d7208ab3c54dfb48397eac6f81230405b25cd4c
f4dc98194091d07ee728ea9a8696f98126bc2d09
/app/src/main/java/com/gta/zssx/fun/adjustCourse/view/page/v2/ConfirmInnerFragment.java
8136024558e2b872f1cca15ae658a44c66da042f
[]
no_license
ecenllen/ZSSX_V2.0
1c58e7c24ed27c80c5952663e355f8540f37636b
02640fb16aa39d985d6832e942a3fde6eb87ca66
refs/heads/master
2021-01-16T21:14:46.649616
2017-08-14T07:45:24
2017-08-14T07:45:24
100,223,879
0
0
null
null
null
null
UTF-8
Java
false
false
3,862
java
package com.gta.zssx.fun.adjustCourse.view.page.v2; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.View; import com.chad.library.adapter.base.BaseQuickAdapter; import com.gta.zssx.fun.adjustCourse.model.bean.ApplyConfirmBean; import com.gta.zssx.fun.adjustCourse.presenter.ConfirmInnerPresenter; import com.gta.zssx.fun.adjustCourse.view.ConfirmInnerView; import com.gta.zssx.fun.adjustCourse.view.adapter.MyConfirmAdapter; import com.gta.zssx.fun.adjustCourse.view.base.BaseRecyclerViewFragment; import com.gta.zssx.fun.adjustCourse.view.base.Constant; import com.gta.zssx.pub.util.LogUtil; import com.gta.zssx.pub.util.RxBus; /** * [Description] * <p> * [How to use] * <p> * [Tips] * * @author Created by Zhimin.Huang on 2017/3/20. * @since 1.0.0 */ public class ConfirmInnerFragment extends BaseRecyclerViewFragment <ConfirmInnerView, ConfirmInnerPresenter, ApplyConfirmBean.ListBean> implements ConfirmInnerView { public static String FRAGMENT_TYPE = "type"; //0代表我的确认列表,1代表我的审核列表 public int mType; public static final int CONFIRM = 0; public static final int AUDIT = 1; private String mStatus; @Override protected BaseQuickAdapter getRecyclerAdapter() { return new MyConfirmAdapter(mStatus); } @NonNull @Override public ConfirmInnerPresenter createPresenter() { return new ConfirmInnerPresenter(); } @Override protected void initData() { super.initData(); mStatus = getArguments().getString(MyApplyInnerFragment.STATUS); mType = getArguments().getInt(FRAGMENT_TYPE); } @Override protected void initView(View view) { super.initView(view); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); presenter.mCompositeSubscription.add(RxBus.getDefault().toObserverable(Constant.ConfirmSuccess.class) .subscribe(confirmSuccess -> { onRefresh(); }, throwable -> { LogUtil.Log(ConfirmInnerFragment.class.getSimpleName(), "确认返回刷新出错"); })); presenter.mCompositeSubscription.add(RxBus.getDefault().toObserverable(Constant.AuditSuccess.class) .subscribe(auditSuccess -> { onRefresh(); }, throwable -> { LogUtil.Log(ConfirmInnerFragment.class.getSimpleName(), "审核返回刷新出错"); })); } @Override protected void requestData() { super.requestData(); presenter.getApplyConfirm(mPage, mType, mStatus); } @Override protected void itemClick(ApplyConfirmBean.ListBean confirmBean, int position) { super.itemClick(confirmBean, position); if (mType == AUDIT) { if (mStatus.equals(Constant.AUDIT_STATUS_N)) { DetailActivity.start(mActivity, Constant.DETAIL_TYPE_AUDIT, confirmBean.getTransferApplyId(), Constant.PAGE_THREE); } else { DetailActivity.start(mActivity, Constant.DETAIL_TYPE_CHECK, confirmBean.getTransferApplyId(), Constant.PAGE_THREE); } } else { if (mStatus.equals(Constant.AUDIT_STATUS_N)) { DetailActivity.start(mActivity, Constant.DETAIL_TYPE_CONFIRM, confirmBean.getTransferApplyId(), Constant.PAGE_TOW); } else { DetailActivity.start(mActivity, Constant.DETAIL_TYPE_CHECK, confirmBean.getTransferApplyId(), Constant.PAGE_TOW); } } } @Override public void getResultData(ApplyConfirmBean confirmBean) { update(confirmBean.getList()); } }
[ "weiye.chen@gtadata.com" ]
weiye.chen@gtadata.com
fd181c9874f1cfa8114900d3d5729af72e856bb9
1d6a59cbafd658e68bd353466c73cb0c8e2dd700
/src/homeworks/HW/write_read/write/Writer.java
dafe56a49f368737a06f643037acef8b4a553e50
[]
no_license
tantmut/Console
59eaecb0a3f47c1a680b88d5577828ce0b8b7096
73cba13f74ead18263d3c1cd808f94f9576b6469
refs/heads/master
2021-01-19T19:25:19.443526
2017-04-23T12:53:21
2017-04-23T12:53:21
88,416,259
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package homeworks.HW.write_read.write; public abstract class Writer implements Writable { public String modifyText(String text) { return "I'm ready for writting to file " + text; } }
[ "ynazar123@gmail.com" ]
ynazar123@gmail.com
b02f289ebd922f349782e147baba643e0e3320dd
80d0d9d750fef2978b2986375a45e9253bdc7013
/src/com/floppyinfant/android/Tabs.java
1af3017f730dcc42787748e0a4699fd985421aa5
[]
no_license
floppyinfant/AndroidApp
069726ba4f36fc7f88bbeddccadc7e6759676d21
9d4614fcb65a30ea7cd332998d24f2a1d8814b8a
refs/heads/master
2021-01-10T11:39:56.949590
2013-01-29T08:58:03
2013-01-29T08:58:03
44,705,647
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package com.floppyinfant.android; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; /** * * @author TM * @see http://developer.android.com/resources/tutorials/views/hello-tabwidget.html * */ public class Tabs extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabs); TabHost tabHost = getTabHost(); TabHost.TabSpec spec; Intent intent; // do foreach Tab... intent = new Intent().setClass(this, Tab1.class); spec = tabHost.newTabSpec("1") .setIndicator("Hello", getResources().getDrawable(R.drawable.ic_tab_1)) .setContent(intent); tabHost.addTab(spec); // Tab 2 intent = new Intent().setClass(this, Tab2.class); spec = tabHost.newTabSpec("2") .setIndicator("Tabs", getResources().getDrawable(R.drawable.ic_tab_2)) .setContent(intent); tabHost.addTab(spec); // Tab 3 MapView intent = new Intent().setClass(this, Maps.class); spec = tabHost.newTabSpec("3") .setIndicator("Maps", getResources().getDrawable(R.drawable.ic_tab_1)) .setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); } }
[ "TM@.(none)" ]
TM@.(none)
e6064a9e2c1616e6fa44da9f927061003fadd5ce
6d0e45cf2ad0672b40711ba1158b77b16a2fa272
/ly-cart/src/main/java/com/leyou/cart/pojo/Cart.java
3961dc8b937b89e1d865a1798064dc24488c4ae0
[ "Apache-2.0" ]
permissive
imxushuai/leyou
e27e878ad929be2e1e520dc363aea2e8227104b5
f7b984f68b64ba05e16ae2ea05dae6a9dd2464b1
refs/heads/master
2022-12-14T10:37:09.988984
2020-06-17T08:22:40
2020-06-17T08:22:40
161,927,242
7
4
Apache-2.0
2022-12-08T16:17:07
2018-12-15T17:15:25
Java
UTF-8
Java
false
false
394
java
package com.leyou.cart.pojo; import lombok.Data; /** * 购物车实体类 */ @Data public class Cart { private Long userId;// 用户id private Long skuId;// 商品id private String title;// 标题 private String image;// 图片 private Long price;// 加入购物车时的价格 private Integer num;// 购买数量 private String ownSpec;// 商品规格参数 }
[ "xs_fight@163.com" ]
xs_fight@163.com
f043e0ba0e97b71f2429ce11ba21a024ac73fc8d
e1f29e9c40db18a283bb46c1204ec72e226cb219
/TicTacToeCore/src/main/java/it/unifi/interfaces/NPC.java
ebf03c9fafebc07edf044b621627ed36cd0ad67a
[ "Apache-2.0" ]
permissive
iskorini/APT-Project
a28951e5c6c9d41b073f86ae5ed9477b6b1d7e4b
621c141090062b40ef6479ad1e8b100e0eddca19
refs/heads/master
2021-01-01T04:14:46.386322
2017-08-04T17:10:24
2017-08-05T09:42:28
97,150,297
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package it.unifi.interfaces; import it.unifi.gameutility.Board; public interface NPC { public Board doMove(Board b); }
[ "iskorini@gmail.com" ]
iskorini@gmail.com
8afaff9d9cf96296cd599bb8fc2573eab0b956bd
39c9a605fb35aebd06fc4ad0f49f945848ab2582
/src/main/java/com/prime/task/prime/common/mappers/ProjectMapper.java
4b7a6b760ee42ce52f1fe8e0c9a30b96b1ff7f57
[]
no_license
endritsheholliAltima/Prime
e1d49f1f8109bdc25f755099212dd67507ce0f95
17bf8f4b32801e4dd5d9c92ad3b6a50c9d72072b
refs/heads/master
2023-04-17T12:12:30.184485
2021-04-20T20:01:42
2021-04-20T20:01:42
358,727,944
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
package com.prime.task.prime.common.mappers; import com.prime.task.prime.dto.ProjectDTO; import com.prime.task.prime.model.Project; import org.modelmapper.ModelMapper; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; public class ProjectMapper { public static ProjectDTO toProjectDTO(Project project) { ModelMapper modelMapper = new ModelMapper(); return modelMapper.map(project, ProjectDTO.class); } public static Project toProject(ProjectDTO projectDTO) { ModelMapper modelMapper = new ModelMapper(); return modelMapper.map(projectDTO, Project.class); } public static Function<Project, Set<ProjectDTO>> findSiblings = person -> person.getParent().getChildren().stream() .map(p -> ProjectDTO.builder().id(p.getId()).name(p.getName()).build()).collect(Collectors.toSet()); public static Function<Project, ProjectDTO> mapToProjectDTO = p -> ProjectDTO.builder().id(p.getId()).name(p.getName()).parent(p.getParent()).children(p.getChildren()).build(); }
[ "59924661+endritsheholliAltima@users.noreply.github.com" ]
59924661+endritsheholliAltima@users.noreply.github.com
977715ad89fe02202a696279e7836076133a0101
45ff924de64ae9eb263a30b48d7f92e1466b7d1a
/zabbix-service/src/main/java/az/ldap/zabbix/repository/HostInterfaceRepository.java
89ba477d25d0a57746c1fffbc169a1b6417da501
[]
no_license
ibrahimazn/cnct
0b883c566184a1fe178a25f22d8cd44aff70765c
27b02048e17b434290d6d453bf5a144802c6e514
refs/heads/master
2020-03-25T23:45:09.099571
2018-08-18T13:42:46
2018-08-18T13:42:46
144,290,859
1
0
null
null
null
null
UTF-8
Java
false
false
697
java
package az.ldap.zabbix.repository; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; import org.springframework.stereotype.Repository; import az.ldap.zabbix.entity.HostInterface; /** MongoDB repository for Host interface. */ @Repository public interface HostInterfaceRepository extends MongoRepository<HostInterface, String> { @Query("{interfaceId : ?0}") HostInterface findByInterfaceId(String interfaceId); @Query("{hostId : ?0}") List<HostInterface> findByHostId(String hostId); @Query("{port : ?0, ipAddress : ?1}") List<HostInterface> findByPortAndIP(String port, String ip); }
[ "ibrahim@assistanz.com" ]
ibrahim@assistanz.com
a976134f86e327fb836aac47155aac7a1ef890bb
b4db8f5f994b4f0711a78cae4847459220e55a25
/src/main/java/models/EnglishDeck.java
781a66ca94c1c07b4c1b4f1364a8e0e098190618
[]
no_license
cs361-W16/Group13-2
3aa59268f6a1c2b81d9d37507e2947078acc9304
b72ca4a8cab9b29db4f2358de0b6d063d9b6dfe8
refs/heads/master
2016-08-11T14:40:08.150380
2016-02-20T08:04:50
2016-02-20T08:04:50
50,548,712
0
4
null
2016-02-20T08:04:51
2016-01-28T02:38:25
HTML
UTF-8
Java
false
false
390
java
package models; public class EnglishDeck extends Deck { public EnglishDeck(){} public void build(){ for(int i = 2; i < 15; i++){ deck.add(new Card(i,Suit.Clubs)); deck.add(new Card(i,Suit.Hearts)); deck.add(new Card(i,Suit.Diamonds)); deck.add(new Card(i,Suit.Spades)); } } }
[ "user.email" ]
user.email
0788ab2843c62d11fda0ee1a1482fd4d3cfdab18
6a922e840b33f11ab3d0f154afa0b33cff272676
/src/xlsx4j/java/org/xlsx4j/sml/CTCalculatedMember.java
f0d5a798ced92650f87d1aa917065ea176170bb6
[ "Apache-2.0" ]
permissive
baochanghong/docx4j
912fc146cb5605e6f7869c4839379a83a8b4afd8
4c83d8999c9396067dd583b82a6fc892469a3919
refs/heads/master
2021-01-12T15:30:26.971311
2016-10-20T00:44:25
2016-10-20T00:44:25
71,792,895
3
0
null
2016-10-24T13:39:57
2016-10-24T13:39:57
null
UTF-8
Java
false
false
8,104
java
/* * Copyright 2010-2013, Plutext Pty Ltd. * * This file is part of xlsx4j, a component of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.xlsx4j.sml; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jvnet.jaxb2_commons.ppp.Child; /** * <p>Java class for CT_CalculatedMember complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="CT_CalculatedMember"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence minOccurs="0"> * &lt;element name="extLst" type="{http://schemas.openxmlformats.org/spreadsheetml/2006/main}CT_ExtensionList" minOccurs="0"/> * &lt;/sequence> * &lt;attribute name="name" use="required" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" /> * &lt;attribute name="mdx" use="required" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" /> * &lt;attribute name="memberName" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" /> * &lt;attribute name="hierarchy" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" /> * &lt;attribute name="parent" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" /> * &lt;attribute name="solveOrder" type="{http://www.w3.org/2001/XMLSchema}int" default="0" /> * &lt;attribute name="set" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CT_CalculatedMember", propOrder = { "extLst" }) public class CTCalculatedMember implements Child { protected CTExtensionList extLst; @XmlAttribute(name = "name", required = true) protected String name; @XmlAttribute(name = "mdx", required = true) protected String mdx; @XmlAttribute(name = "memberName") protected String memberName; @XmlAttribute(name = "hierarchy") protected String hierarchy; @XmlAttribute(name = "parent") protected String parent; @XmlAttribute(name = "solveOrder") protected Integer solveOrder; @XmlAttribute(name = "set") protected Boolean set; @XmlTransient private Object parentObj; /** * Gets the value of the extLst property. * * @return * possible object is * {@link CTExtensionList } * */ public CTExtensionList getExtLst() { return extLst; } /** * Sets the value of the extLst property. * * @param value * allowed object is * {@link CTExtensionList } * */ public void setExtLst(CTExtensionList value) { this.extLst = value; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the mdx property. * * @return * possible object is * {@link String } * */ public String getMdx() { return mdx; } /** * Sets the value of the mdx property. * * @param value * allowed object is * {@link String } * */ public void setMdx(String value) { this.mdx = value; } /** * Gets the value of the memberName property. * * @return * possible object is * {@link String } * */ public String getMemberName() { return memberName; } /** * Sets the value of the memberName property. * * @param value * allowed object is * {@link String } * */ public void setMemberName(String value) { this.memberName = value; } /** * Gets the value of the hierarchy property. * * @return * possible object is * {@link String } * */ public String getHierarchy() { return hierarchy; } /** * Sets the value of the hierarchy property. * * @param value * allowed object is * {@link String } * */ public void setHierarchy(String value) { this.hierarchy = value; } /** * Gets the value of the parent property. * * @return * possible object is * {@link String } * */ public String getParentAttr() { return parent; } /** * Sets the value of the parent property. * * @param value * allowed object is * {@link String } * */ public void setParent(String value) { this.parent = value; } /** * Gets the value of the solveOrder property. * * @return * possible object is * {@link Integer } * */ public int getSolveOrder() { if (solveOrder == null) { return 0; } else { return solveOrder; } } /** * Sets the value of the solveOrder property. * * @param value * allowed object is * {@link Integer } * */ public void setSolveOrder(Integer value) { this.solveOrder = value; } /** * Gets the value of the set property. * * @return * possible object is * {@link Boolean } * */ public boolean isSet() { if (set == null) { return false; } else { return set; } } /** * Sets the value of the set property. * * @param value * allowed object is * {@link Boolean } * */ public void setSet(Boolean value) { this.set = value; } /** * Gets the parent object in the object tree representing the unmarshalled xml document. * * @return * The parent object. */ public Object getParent() { return this.parentObj; } public void setParent(Object parent) { this.parentObj = parent; } /** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); } }
[ "jason@plutext.org" ]
jason@plutext.org
73e48e49b7cc10b52af98fc53a94c78340f07370
6dac76f33cfbd45bd44b74ed322dd9b6ee7cb2b4
/src/main/java/com/datangliang/app/web/rest/EnterpriseInfoResource.java
d5ef7fd4bdf275bc4e33eaf878163fe2bab4a3f4
[]
no_license
ouyangshixiong/dtl-app-mock
2ebb4755b7d03330838462918a49be099f662ec3
f90e6621411d24f7d15064801a7396bc4cb43124
refs/heads/master
2021-07-01T06:37:35.956464
2019-01-15T06:50:59
2019-01-15T06:50:59
165,581,779
0
1
null
2020-09-18T10:53:42
2019-01-14T02:25:15
Java
UTF-8
Java
false
false
5,000
java
package com.datangliang.app.web.rest; import com.codahale.metrics.annotation.Timed; import com.datangliang.app.domain.EnterpriseInfo; import com.datangliang.app.service.EnterpriseInfoService; import com.datangliang.app.web.rest.errors.BadRequestAlertException; import com.datangliang.app.web.rest.util.HeaderUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing EnterpriseInfo. */ @RestController @RequestMapping("/api") public class EnterpriseInfoResource { private final Logger log = LoggerFactory.getLogger(EnterpriseInfoResource.class); private static final String ENTITY_NAME = "enterpriseInfo"; private final EnterpriseInfoService enterpriseInfoService; public EnterpriseInfoResource(EnterpriseInfoService enterpriseInfoService) { this.enterpriseInfoService = enterpriseInfoService; } /** * POST /enterprise-infos : Create a new enterpriseInfo. * * @param enterpriseInfo the enterpriseInfo to create * @return the ResponseEntity with status 201 (Created) and with body the new enterpriseInfo, or with status 400 (Bad Request) if the enterpriseInfo has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/enterprise-infos") @Timed public ResponseEntity<EnterpriseInfo> createEnterpriseInfo(@RequestBody EnterpriseInfo enterpriseInfo) throws URISyntaxException { log.debug("REST request to save EnterpriseInfo : {}", enterpriseInfo); if (enterpriseInfo.getId() != null) { throw new BadRequestAlertException("A new enterpriseInfo cannot already have an ID", ENTITY_NAME, "idexists"); } EnterpriseInfo result = enterpriseInfoService.save(enterpriseInfo); return ResponseEntity.created(new URI("/api/enterprise-infos/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /enterprise-infos : Updates an existing enterpriseInfo. * * @param enterpriseInfo the enterpriseInfo to update * @return the ResponseEntity with status 200 (OK) and with body the updated enterpriseInfo, * or with status 400 (Bad Request) if the enterpriseInfo is not valid, * or with status 500 (Internal Server Error) if the enterpriseInfo couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/enterprise-infos") @Timed public ResponseEntity<EnterpriseInfo> updateEnterpriseInfo(@RequestBody EnterpriseInfo enterpriseInfo) throws URISyntaxException { log.debug("REST request to update EnterpriseInfo : {}", enterpriseInfo); if (enterpriseInfo.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } EnterpriseInfo result = enterpriseInfoService.save(enterpriseInfo); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, enterpriseInfo.getId().toString())) .body(result); } /** * GET /enterprise-infos : get all the enterpriseInfos. * * @return the ResponseEntity with status 200 (OK) and the list of enterpriseInfos in body */ @GetMapping("/enterprise-infos") @Timed public List<EnterpriseInfo> getAllEnterpriseInfos() { log.debug("REST request to get all EnterpriseInfos"); return enterpriseInfoService.findAll(); } /** * GET /enterprise-infos/:id : get the "id" enterpriseInfo. * * @param id the id of the enterpriseInfo to retrieve * @return the ResponseEntity with status 200 (OK) and with body the enterpriseInfo, or with status 404 (Not Found) */ @GetMapping("/enterprise-infos/{id}") @Timed public ResponseEntity<EnterpriseInfo> getEnterpriseInfo(@PathVariable Long id) { log.debug("REST request to get EnterpriseInfo : {}", id); Optional<EnterpriseInfo> enterpriseInfo = enterpriseInfoService.findOne(id); return ResponseUtil.wrapOrNotFound(enterpriseInfo); } /** * DELETE /enterprise-infos/:id : delete the "id" enterpriseInfo. * * @param id the id of the enterpriseInfo to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/enterprise-infos/{id}") @Timed public ResponseEntity<Void> deleteEnterpriseInfo(@PathVariable Long id) { log.debug("REST request to delete EnterpriseInfo : {}", id); enterpriseInfoService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
da28e12a28d46082021083c24ee7655029b52871
644dbd428086bbe0b8686846a980136122dfcd16
/src/main/java/de/thatsich/core/guice/IPostInit.java
b3d9517ee708c020572ed04df8ea2e1a83d32989
[]
no_license
thatsIch/OpenFX
e9deb7adbd012ac208082c361966242d1a9d5dd1
2674d47fd22d65ea43cbac0de90e20f7bf2d2999
refs/heads/master
2021-01-21T21:39:49.456425
2016-03-13T12:14:14
2016-03-13T12:14:14
12,842,210
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
package de.thatsich.core.guice; public interface IPostInit { void init(); }
[ "badhard@arcor.de" ]
badhard@arcor.de
5cf900768b8f43c9ddef8fda403c390375726d08
157d84f8aafc76ba9ea0dbbf08ede744966b4250
/code/iaas/model/src/main/java/io/cattle/platform/core/dao/ProcessSummaryDao.java
8e343e476fef2510ba269804253a158938c61135
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
rancher/cattle
81d165a0339a41950561fe534c7529ec74203c56
82d154a53f4089fecfb9f320caad826bb4f6055f
refs/heads/v1.6
2023-08-27T20:19:31.989806
2020-05-01T18:15:55
2020-05-01T20:11:28
18,023,059
487
233
Apache-2.0
2022-01-03T18:07:33
2014-03-23T00:19:52
Java
UTF-8
Java
false
false
203
java
package io.cattle.platform.core.dao; import io.cattle.platform.core.addon.ProcessSummary; import java.util.List; public interface ProcessSummaryDao { List<ProcessSummary> getProcessSummary(); }
[ "darren@rancher.com" ]
darren@rancher.com
b11e7ae647c17656a5699c66f7299d64a17142d6
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_141/Testnull_14093.java
3684bd3914c80784a0e6c9b0882f8ec5e3cccf57
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_141; import static org.junit.Assert.*; public class Testnull_14093 { private final Productionnull_14093 production = new Productionnull_14093("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
9741886046c3e7268b0faa2d467ab7a533d51778
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_76a649e94d12c18eee86f114d4fa2ae3eaaad0b6/HomeController/2_76a649e94d12c18eee86f114d4fa2ae3eaaad0b6_HomeController_s.java
37b3d68ae5b245df5416bbc4cfdb668f90636bfc
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,411
java
/* * #%L * debox-photos * %% * Copyright (C) 2012 Debox * %% * This program 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 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/>. * #L% */ package org.debox.photo.action; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.debox.photo.model.Configuration; import org.debox.photo.model.User; import org.debox.photo.server.ApplicationContext; import org.debux.webmotion.server.render.Render; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Corentin Guy <corentin.guy@debox.fr> */ public class HomeController extends DeboxController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); public Render index() { User user = (User) SecurityUtils.getSubject().getPrincipal(); String username = "null"; if (user != null) { username = "\"" + StringEscapeUtils.escapeHtml4(user.getUsername()) + "\""; } Configuration configuration = ApplicationContext.getInstance().getConfiguration(); String title = configuration.get(Configuration.Key.TITLE); title = "\"" + StringEscapeUtils.escapeHtml4(title) + "\""; return renderView("index.jsp", "title", title, "username", username); } public Render getTemplates() { Map<String, Object> templates = new HashMap<>(); try { URL templatesDirectoryUrl = this.getClass().getClassLoader().getResource("templates"); URI templatesURI = templatesDirectoryUrl.toURI(); File templatesDirectory = new File(templatesURI); if (templatesDirectory != null && templatesDirectory.isDirectory()) { for (File child : templatesDirectory.listFiles()) { try (FileInputStream fis = new FileInputStream(child)) { String filename = StringUtils.substringBeforeLast(child.getName(), "."); String content = IOUtils.toString(fis); templates.put(filename, content); } catch (IOException ex) { logger.error("Unable to load template " + child.getAbsolutePath(), ex); } } } } catch (URISyntaxException ex) { logger.error("Unable to load templates", ex); } return renderJSON(templates); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
6eae8fdc61e94db18fe5ebd00fae19ff56b28a28
fccd5805e92854fa860530b212b99695f9f2cc1c
/src/main/java/com/digitalfeonix/hydrogel/block/HydroGelBlock.java
60652d802b5d651f75b589e8c3b6f7720357f2e6
[]
no_license
Shadows-of-Fire/HydroGel
c650c38dee4538ed3b163ed87e4200a0d7fe94a8
f5a4f2a8d3b633280bb210a091b770df643ee015
refs/heads/master
2023-02-17T07:15:47.392000
2021-01-18T19:28:41
2021-01-18T19:28:41
114,837,729
1
1
null
2021-01-18T19:21:33
2017-12-20T03:17:34
Java
UTF-8
Java
false
false
1,684
java
package com.digitalfeonix.hydrogel.block; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.block.ILiquidContainer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.PushReaction; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; public class HydroGelBlock extends Block implements ILiquidContainer { public static final IntegerProperty LEVEL = FlowingFluidBlock.LEVEL; public HydroGelBlock() { super(Block.Properties.create(Material.WATER).hardnessAndResistance(1).sound(SoundType.SLIME)); } @Override protected void fillStateContainer(Builder<Block, BlockState> builder) { builder.add(LEVEL); } @Override public boolean isReplaceable(BlockState state, BlockItemUseContext ctx) { return false; } @Override public PushReaction getPushReaction(BlockState state) { return PushReaction.NORMAL; } @Override public FluidState getFluidState(BlockState p_204507_1_) { return Fluids.WATER.getDefaultState(); } @Override public boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) { return false; } @Override public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, FluidState fluidStateIn) { return false; } }
[ "Bward7864@gmail.com" ]
Bward7864@gmail.com
e94ee3136c1b89d0a3f03ca043970a851bcdfa2d
78663f79712c4db4b77c5bdaf6f246c0948cd498
/app/src/main/java/com/codedwar/edwar/mascotas/MainActivity.java
23bf6a0675534462311f771960f26142729c2f46
[]
no_license
edwarsare/MascotasActualizado
1ebd46bb909e69cb3f7a29a504bd9ff0d546cb8b
a576dc3adfd5611762bc91c0824e301a94c6bd1c
refs/heads/master
2021-06-01T22:01:29.663492
2016-09-14T04:03:52
2016-09-14T04:03:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,617
java
package com.codedwar.edwar.mascotas; import android.content.Intent; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import com.codedwar.edwar.mascotas.Adapter.PageAdapter; import com.codedwar.edwar.mascotas.Fragments.DetalleFragment; import com.codedwar.edwar.mascotas.Fragments.MascotasFragment; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar)findViewById(R.id.appBar); tabLayout = (TabLayout) findViewById(R.id.tabLayout); viewPager = (ViewPager) findViewById(R.id.viewPager); if(toolbar != null) { setSupportActionBar(toolbar); } setUpViewPager(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.mContacto: Intent intent = new Intent(this,Contactos.class); startActivity(intent); break; case R.id.mAcercaDe: Intent intent2 = new Intent(this,AcercaDe.class); startActivity(intent2); break; case R.id.avFavoritos: Intent intent3 = new Intent(this,MascotasFavoritas.class); startActivity(intent3); break; } return super.onOptionsItemSelected(item); } public ArrayList<Fragment> agregarFragments(){ ArrayList<Fragment> lista = new ArrayList<>(); lista.add(new MascotasFragment()); lista.add(new DetalleFragment()); return lista; } public void setUpViewPager(){ viewPager.setAdapter(new PageAdapter(getSupportFragmentManager(),agregarFragments())); tabLayout.setupWithViewPager(viewPager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_action_house); tabLayout.getTabAt(1).setIcon(R.drawable.ic_action_dog); } }
[ "edwarsare@hotmail.com" ]
edwarsare@hotmail.com
f5ed75057a1c34afbd451de28bbed410f2dcdab7
f46badd9fe1f73c2eca86c947d782d3db42924b2
/src/com/servlet/AddrServlet.java
1e440f1dfcc47fd58c922850458b59b75601032d
[]
no_license
kyutaeks/Exam
ee3e39153e0754bee7a56d7fa32337aa190500eb
e94fa010d679e29dfc4c44e66b6710f5f3c61396
refs/heads/master
2022-08-17T03:59:09.767186
2019-04-19T08:45:51
2019-04-19T08:45:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,661
java
package com.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import java.util.Map; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.common.Common; import com.service.AddrService; import com.service.impl.AddrServiceImpl; @WebServlet(urlPatterns = { "/addr/list", "/addr/one" }) public class AddrServlet extends HttpServlet { private static final long serialVersionUID = 1L; private AddrService as = new AddrServiceImpl(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter pw = response.getWriter(); String cmd = Common.getCmd(request); String url = "/views/addr/" + cmd; if ("list".equals(cmd)) { Map<String, String> addr = Common.getSingleMap(request); List<Map<String, String>> addrList = as.selectAddrList(addr); request.setAttribute("list", addrList); } else if ("one".equals(cmd)) { Map<String, String> addr = Common.getSingleMap(request); Map<String, String> map = as.selectAddr(addr); request.setAttribute("view", map); } RequestDispatcher rd = request.getRequestDispatcher(url); rd.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "lgt8879@gmail.com" ]
lgt8879@gmail.com
2a21cf35b359034024ac55ea1ff0833053b4566b
dc316cd4c8008c8a2651a9d95e9aacdd011c21dd
/commons-crypto/src/main/java/com/mizhousoft/commons/ecc/EccGenerator.java
9c029703d466a063380a37ce8afeede691d87546
[ "BSD-3-Clause" ]
permissive
63966367/mizhousoft-commons
5bc124f692daf44c7643d5a0ed527e774240979a
e6e1fa50b50031ee4e3d364c64178e3873d88993
refs/heads/main
2023-05-05T21:20:16.396637
2021-06-01T03:33:36
2021-06-01T03:33:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,044
java
package com.mizhousoft.commons.ecc; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import com.mizhousoft.commons.crypto.CryptoException; import com.mizhousoft.commons.lang.HexUtils; /** * ECC生成器 * * @version */ public abstract class EccGenerator { public static KeyPair genKeyPair() throws CryptoException { try { KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC", "BC"); keyPairGenerator.initialize(256, new SecureRandom()); return keyPairGenerator.generateKeyPair(); } catch (Exception e) { throw new CryptoException("Generate key pair failed."); } } public static String encodePublicKey(PublicKey publicKey) { return HexUtils.encodeHexString(publicKey.getEncoded(), false); } public static String encodePrivateKey(PrivateKey privateKey) { return HexUtils.encodeHexString(privateKey.getEncoded(), false); } public static PublicKey decodePublicKey(String keyStr) throws CryptoException { try { byte[] keyBytes = HexUtils.decodeHex(keyStr); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("EC", "BC"); return keyFactory.generatePublic(keySpec); } catch (Exception e) { throw new CryptoException("Decode public key failed."); } } public static PrivateKey decodePrivateKey(String keyStr) throws CryptoException { try { byte[] keyBytes = HexUtils.decodeHex(keyStr); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("EC", "BC"); return keyFactory.generatePrivate(keySpec); } catch (Exception e) { throw new CryptoException("Decode private key failed."); } } }
[ "lsp_lishuiping@qq.com" ]
lsp_lishuiping@qq.com
c6c29be38c375fe29d1e78e46533b91ab32f954e
2941f2e847d36c2e4ed58a28296ff79635857372
/src/cafeteria/ui/users/CustomerLoginDialog.java
35b7fea4a9f35ca6fec05c84fc8a259e0735e0b3
[]
no_license
yatharthk2/OOP_Mninprojec-master
52e55fb35936000a016bb0ac083170d7a2549518
78a2d735463c64b6ae6959d198816af9913e75c8
refs/heads/master
2023-05-20T01:02:28.226026
2021-06-09T16:54:29
2021-06-09T16:54:29
373,394,809
0
0
null
null
null
null
UTF-8
Java
false
false
5,454
java
package cafeteria.ui.users; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import cafeteria.core.Customer; import cafeteria.dao.CustomerDAO; import cafeteria.dao.FoodDAO; import cafeteria.dao.OrderDAO; import cafeteria.ui.BillingApp; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.sql.SQLException; import java.awt.event.ActionEvent; import javax.swing.JPasswordField; @SuppressWarnings("serial") public class CustomerLoginDialog extends JDialog { private FoodDAO foodDAO; private CustomerDAO customerDAO; private OrderDAO orderDAO; private final JPanel contentPanel = new JPanel(); private JLabel lblWelcomeToCafeteria; private JPanel credentialpanel; private JTextField emailTextField; private JPasswordField passwordField; public CustomerLoginDialog(CustomerDAO customerDAO, FoodDAO foodDAO, OrderDAO orderDAO){ this(); this.customerDAO = customerDAO; this.foodDAO = foodDAO; this.orderDAO = orderDAO; addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { int PromptResult = JOptionPane.showConfirmDialog(null, "Exit application ?", "Confirm exit", JOptionPane.OK_CANCEL_OPTION); if(PromptResult== JOptionPane.OK_OPTION) { System.exit(0); } } }); } public CustomerLoginDialog() { //this.setResizable(false); setTitle("MIT WPU Cafeteria - Log In"); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JPanel lblpanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) lblpanel.getLayout(); flowLayout.setVgap(10); contentPanel.add(lblpanel, BorderLayout.NORTH); { lblWelcomeToCafeteria = new JLabel("Welcome to Cafeteria Billing System"); lblWelcomeToCafeteria.setFont(new Font("Sylfaen", Font.BOLD, 16)); lblpanel.add(lblWelcomeToCafeteria); } } { credentialpanel = new JPanel(); contentPanel.add(credentialpanel, BorderLayout.CENTER); credentialpanel.setLayout(null); JLabel lblEmail = new JLabel("E-mail"); lblEmail.setFont(new Font("Sylfaen", Font.PLAIN, 15)); lblEmail.setBounds(21, 19, 46, 14); credentialpanel.add(lblEmail); emailTextField = new JTextField(); emailTextField.setBounds(86, 16, 180, 20); credentialpanel.add(emailTextField); emailTextField.setColumns(30); JLabel lblPassword = new JLabel("Password"); lblPassword.setFont(new Font("Sylfaen", Font.PLAIN, 15)); lblPassword.setBounds(10, 50, 70, 14); credentialpanel.add(lblPassword); JButton btnLogIn = new JButton("Log in"); btnLogIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { performLogin(); } }); btnLogIn.setBounds(177, 78, 89, 23); credentialpanel.add(btnLogIn); JLabel lblNewUser = new JLabel("New user ?"); lblNewUser.setFont(new Font("Sylfaen", Font.PLAIN, 15)); lblNewUser.setBounds(34, 121, 80, 14); credentialpanel.add(lblNewUser); JButton btnSignUp = new JButton("Sign up"); btnSignUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CustomerSignUpDialog dialog = new CustomerSignUpDialog(CustomerLoginDialog.this, customerDAO); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); //dissolve current dialog and create new dialog dispose(); //setVisible(false); can use this also but dispose() is preferred to release memory dialog.setVisible(true); } }); btnSignUp.setBounds(110, 117, 89, 23); credentialpanel.add(btnSignUp); passwordField = new JPasswordField(); passwordField.setBounds(86, 47, 180, 20); credentialpanel.add(passwordField); } } private void performLogin(){ String email = emailTextField.getText(); String plainTextPassword = new String(passwordField.getPassword()); try { Customer customer = customerDAO.searchCustomer(email); //if not NULL, customer records found in database if(customer == null){ JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Customer not found", "OOPS!", JOptionPane.INFORMATION_MESSAGE); return; } //Authentication check boolean check = customerDAO.authenticate(plainTextPassword, customer); if(check){ System.out.println("Customer authenticated"); emailTextField.setText(""); passwordField.setText(""); BillingApp frame = new BillingApp(CustomerLoginDialog.this, orderDAO, foodDAO, customer); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);; dispose(); frame.setVisible(true); } else{ JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Invalid password!", "Invalid login", JOptionPane.ERROR_MESSAGE); return; } } catch (SQLException e) { JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Error logging in: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } }
[ "yatharth.kapadia.1702@gmail.com" ]
yatharth.kapadia.1702@gmail.com
80536c6e3c430e3bf156848a3fd6541211e9f178
69a52bf241d2ed0286d73755a617db044b404e9c
/VisitorDesignPattern/test/src/edu/umb/cs/cs680/hw10/VisitorsTest.java
fff4f2214cde858abae22ffba56302de1cb762de
[]
no_license
SunayanShaik/Object-Oriented-Design-Programming
2df102b9de634fcd2de6f6724f54fa1c1e35b03b
dd63264edaea3a1885daa15b424e0964efb0e525
refs/heads/master
2020-03-18T20:21:36.478245
2018-05-28T21:41:45
2018-05-28T21:41:45
135,210,489
0
0
null
null
null
null
UTF-8
Java
false
false
9,214
java
package edu.umb.cs.cs680.hw10; import static org.junit.Assert.*; import java.util.Date; import org.junit.After; import org.junit.Before; import org.junit.Test; import edu.umb.cs.cs68.hw10.CountingVisitor; import edu.umb.cs.cs68.hw10.Directory; import edu.umb.cs.cs68.hw10.File; import edu.umb.cs.cs68.hw10.FileSearchVisitor; import edu.umb.cs.cs68.hw10.FileSystem; import edu.umb.cs.cs68.hw10.Link; import edu.umb.cs.cs68.hw10.VirusCheckingVisitor; public class VisitorsTest { private Directory rootDir, systemDir, homeDir, picturesDir; private File a, b, c, d, e, f; private Link x, y; private FileSearchVisitor fsVisitor1, fsVisitor2, fsVisitor3; private CountingVisitor countingVisitor1, countingVisitor2, countingVisitor3; @Before public void setUp() throws Exception { Date created = new Date(System.currentTimeMillis() - 3600 * 1000); Date modified = new java.util.Date(); rootDir = new Directory(null, "root", "sunayan", created, modified, 0, false); systemDir = new Directory(rootDir, "system", "sunayan", created, modified, 0, false); homeDir = new Directory(rootDir, "home", "sunayan", created, modified, 0, false); picturesDir = new Directory(homeDir, "pictures", "sunayan", created, modified, 0, false); rootDir.appendChild(systemDir); rootDir.appendChild(homeDir); a = new File(systemDir, "a.txt", "sunayan", created, modified, 10, true); b = new File(systemDir, "b.txt", "sunayan", created, modified, 20, true); c = new File(systemDir, "c.pdf", "sunayan", created, modified, 30, true); systemDir.appendChild(a); systemDir.appendChild(b); systemDir.appendChild(c); d = new File(homeDir, "d.doc", "sunayan", created, modified, 40, true); x = new Link(homeDir, systemDir, "x", "sunayan", created, modified, 0, false); homeDir.appendChild(d); homeDir.appendChild(x); homeDir.appendChild(picturesDir); e = new File(picturesDir, "e.txt", "sunayan",created, modified, 50, true); f = new File(picturesDir, "f.pdf", "sunayan",created, modified, 60, true); y = new Link(picturesDir, e, "y", "sunayan",created, modified, 0, false); picturesDir.appendChild(e); picturesDir.appendChild(f); picturesDir.appendChild(y); a.setHasVirus(true); d.setHasVirus(true); f.setHasVirus(true); } @After public void tearDown() throws Exception { fsVisitor1 = null; fsVisitor2 = null; fsVisitor3 = null; countingVisitor1 = null; countingVisitor2 = null; countingVisitor3 = null; } @Test public void showAllElementsTest() { System.out.println("----------------------------------------------------------------------"); System.out.println("Tree Structure: "); System.out.println("----------------------------------------------------------------------"); FileSystem fileSystem = FileSystem.getFileSystem(rootDir); fileSystem.showAllElements(); } @Test public void testFileSearchVisitorOnRoot() { int expectedTxtFileSize = 3; int expectedPdfSize = 2; int expectedDocSize = 1; fsVisitor1 = new FileSearchVisitor(".txt"); fsVisitor2 = new FileSearchVisitor(".pdf"); fsVisitor3 = new FileSearchVisitor(".doc"); rootDir.accept(fsVisitor1); rootDir.accept(fsVisitor2); rootDir.accept(fsVisitor3); int actualTxtFieldSize = fsVisitor1.getFoundFiles().size(); int actualPdfSize = fsVisitor2.getFoundFiles().size(); int actualDocSize = fsVisitor3.getFoundFiles().size(); assertEquals(expectedTxtFileSize, actualTxtFieldSize); assertEquals(expectedPdfSize, actualPdfSize); assertEquals(expectedDocSize, actualDocSize); System.out.println("----------------------------------------------------------------------"); System.out.println("FileSearchVisitor sizes in a tree :"); System.out.println("----------------------------------------------------------------------"); System.out.println("For '.txt' files in rootDir : " +actualTxtFieldSize); System.out.println("For '.pdf' files in rootDir : " +actualPdfSize); System.out.println("For '.doc' files in rootDir : " +actualDocSize); } @Test public void testCountingVisitorOnDirNum() { int expectedRootDirCount = 4; int expectedHomeDirCount = 2; int expectedPicturesDirCount = 1; countingVisitor1 = new CountingVisitor(); countingVisitor2 = new CountingVisitor(); countingVisitor3 = new CountingVisitor(); rootDir.accept(countingVisitor1); homeDir.accept(countingVisitor2); picturesDir.accept(countingVisitor3); int actualRootDirCount = countingVisitor1.getDirNum(); int actualHomeDirCount = countingVisitor2.getDirNum(); int actualPicturesDirCount = countingVisitor3.getDirNum(); assertEquals(expectedRootDirCount, actualRootDirCount); assertEquals(expectedHomeDirCount, actualHomeDirCount); assertEquals(expectedPicturesDirCount, actualPicturesDirCount); System.out.println("----------------------------------------------------------------------"); System.out.println("Counting Number of Dir in a tree :"); System.out.println("----------------------------------------------------------------------"); System.out.println("On rootDir : " +actualRootDirCount); System.out.println("On homeDir : " +actualHomeDirCount); System.out.println("On picturesDir : " +actualPicturesDirCount); } @Test public void testCountingVisitorOnFileNum() { int expectedRootFilesCount = 6; int expectedHomeFilesCount = 3; int expectedPicturesFilesDirCount = 2; countingVisitor1 = new CountingVisitor(); countingVisitor2 = new CountingVisitor(); countingVisitor3 = new CountingVisitor(); rootDir.accept(countingVisitor1); homeDir.accept(countingVisitor2); picturesDir.accept(countingVisitor3); int actualRootFilesCount = countingVisitor1.getFileNum(); int actualHomeFilesCount = countingVisitor2.getFileNum(); int actualPicturesFilesCount = countingVisitor3.getFileNum(); assertEquals(expectedRootFilesCount, actualRootFilesCount); assertEquals(expectedHomeFilesCount, actualHomeFilesCount); assertEquals(expectedPicturesFilesDirCount, actualPicturesFilesCount); System.out.println("----------------------------------------------------------------------"); System.out.println("Counting Number of Files in a tree :"); System.out.println("----------------------------------------------------------------------"); System.out.println("On rootDir : " +actualRootFilesCount); System.out.println("On homeDir : " +actualHomeFilesCount); System.out.println("On picturesDir : " +actualPicturesFilesCount); } @Test public void testCountingVisitorOnLinksNum() { int expectedRootLinksCount = 2; int expectedHomeLinksCount = 2; int expectedPicturesLinksCount = 1; countingVisitor1 = new CountingVisitor(); countingVisitor2 = new CountingVisitor(); countingVisitor3 = new CountingVisitor(); rootDir.accept(countingVisitor1); homeDir.accept(countingVisitor2); picturesDir.accept(countingVisitor3); int actualRootLinksCount = countingVisitor1.getLinkNum(); int actualHomeLinksCount = countingVisitor2.getLinkNum(); int actualPicturesLinksCount = countingVisitor3.getLinkNum(); assertEquals(expectedRootLinksCount, actualRootLinksCount); assertEquals(expectedHomeLinksCount, actualHomeLinksCount); assertEquals(expectedPicturesLinksCount, actualPicturesLinksCount); System.out.println("----------------------------------------------------------------------"); System.out.println("Counting Number of Links in a tree :"); System.out.println("----------------------------------------------------------------------"); System.out.println("On rootDir : " +actualRootLinksCount); System.out.println("On homeDir : " +actualHomeLinksCount); System.out.println("On picturesDir : " +actualPicturesLinksCount); } @Test public void testVirusCheckingVisitor() { int expectedRootQuarantinedNum = 3; int expectedHomeQuarantinedNum = 2; int expectedPicturesQuarantinedNum = 1; VirusCheckingVisitor virusCheckVisitor1 , virusCheckVisitor2, virusCheckVisitor3; virusCheckVisitor1 = new VirusCheckingVisitor(); virusCheckVisitor2 = new VirusCheckingVisitor(); virusCheckVisitor3 = new VirusCheckingVisitor(); rootDir.accept(virusCheckVisitor1); homeDir.accept(virusCheckVisitor2); picturesDir.accept(virusCheckVisitor3); int actualRootQuarantinedNum = virusCheckVisitor1.getQuarantinedNum(); int actualHomeQuarantinedNum = virusCheckVisitor2.getQuarantinedNum(); int actualPicturesQuarantinedNum = virusCheckVisitor3.getQuarantinedNum(); assertEquals(expectedRootQuarantinedNum, actualRootQuarantinedNum); assertEquals(expectedHomeQuarantinedNum, actualHomeQuarantinedNum); assertEquals(expectedPicturesQuarantinedNum, actualPicturesQuarantinedNum); System.out.println("----------------------------------------------------------------------"); System.out.println("Checking Virus in tree :"); System.out.println("----------------------------------------------------------------------"); System.out.println("On rootDir : " +actualRootQuarantinedNum); System.out.println("On homeDir : " +actualHomeQuarantinedNum); System.out.println("On picturesDir : " +actualPicturesQuarantinedNum); } }
[ "sunayan.shaik.1215@gmail.com" ]
sunayan.shaik.1215@gmail.com
04272e95a2cd8b8cf4e7d065125c3e45c5a63afe
e964cddd911fd8116bda9820a1c6a1a0d5837f1c
/src/chatroom/GroupServer.java
9813fd89e58673fa75dd76260af995f9c6ef0109
[]
no_license
lwy123-wq/chatroom
8e4219e63ba5a99a938305e10698757038f54eb1
7f05d26447d2643d8b437e9be7d8fb20a7885d29
refs/heads/master
2023-04-17T05:10:38.753993
2021-05-10T08:23:08
2021-05-10T08:23:08
365,969,454
0
0
null
null
null
null
UTF-8
Java
false
false
3,227
java
package chatroom; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.*; import java.nio.charset.StandardCharsets; import java.util.Iterator; public class GroupServer { private Selector selector; private ServerSocketChannel listenChannel; private static final int PORT=5556; public GroupServer() { try { selector=Selector.open(); listenChannel=ServerSocketChannel.open(); listenChannel.socket().bind(new InetSocketAddress(PORT)); listenChannel.configureBlocking(false); listenChannel.register(selector, SelectionKey.OP_ACCEPT); } catch (IOException e) { e.printStackTrace(); } } public void listen(){ try { while (true){ int count=selector.select(2000); if(count>0){ Iterator<SelectionKey> iterator = selector.selectedKeys().iterator(); while(iterator.hasNext()){ SelectionKey key=iterator.next(); if(key.isAcceptable()){ SocketChannel sc=listenChannel.accept(); sc.configureBlocking(false); sc.register(selector,SelectionKey.OP_READ); System.out.println(sc.getRemoteAddress()+"high lines............"); } if(key.isReadable()){ readDate(key); } iterator.remove(); } }else { System.out.println("wait.................."); } } }catch (IOException e){ e.printStackTrace(); }finally { } } public void readDate(SelectionKey key){ SocketChannel channel=null; try { channel=(SocketChannel) key.channel(); ByteBuffer buffer=ByteBuffer.allocate(1024); int count=channel.read(buffer); if(count>0){ String a=new String(buffer.array()); System.out.println("from client"+a); sendToClient(a,channel); } } catch (IOException e) { try { System.out.println(channel.getRemoteAddress()+"offline"); key.channel(); channel.close(); }catch (IOException e1){ e1.printStackTrace(); } } } private void sendToClient(String a,SocketChannel self)throws IOException{ System.out.println("The server forwards the message"); for (SelectionKey key:selector.keys()){ Channel target=key.channel(); if(target instanceof SocketChannel && target!=self){ SocketChannel dest=(SocketChannel) target; ByteBuffer buffer=ByteBuffer.wrap(a.getBytes()); dest.write(buffer); } } } public static void main(String[] args) { GroupServer groupServer=new GroupServer(); groupServer.listen(); } }
[ "l2158223895@qq.com" ]
l2158223895@qq.com
6ba20c5237b6283de50c33c43d53d62cb8103416
6883c617e4439b8fa5497373f5c24152d843a1ba
/src/main/java/com/lothrazar/cyclicmagic/gui/component/GuiCheckboxTooltip.java
b013cfedc7a2dbd4dc802c39ed549b27d8a1a0f8
[ "MIT" ]
permissive
sandtechnology/Cyclic
b84c8ba00d9d3ec099bb15c24069e2289bd62844
a668cfe42db63c0c2d660d3e6abebc21ac7a50b4
refs/heads/develop
2021-08-18T00:01:12.701994
2019-12-31T05:30:04
2019-12-31T05:30:04
131,421,090
0
0
MIT
2019-06-09T10:32:57
2018-04-28T15:25:17
Java
UTF-8
Java
false
false
2,159
java
/******************************************************************************* * The MIT License (MIT) * * Copyright (C) 2014-2018 Sam Bassett (aka Lothrazar) * * 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.lothrazar.cyclicmagic.gui.component; import java.util.ArrayList; import java.util.List; import com.lothrazar.cyclicmagic.data.ITooltipButton; import com.lothrazar.cyclicmagic.util.UtilChat; import net.minecraftforge.fml.client.config.GuiCheckBox; public class GuiCheckboxTooltip extends GuiCheckBox implements ITooltipButton { public GuiCheckboxTooltip(int buttonId, int x, int y, String buttonText, boolean ch) { super(buttonId, x, y, buttonText, ch); } private List<String> tooltip = new ArrayList<String>(); @Override public List<String> getTooltips() { return tooltip; } public void setTooltips(List<String> t) { tooltip = t; } public void setTooltip(final String t) { List<String> remake = new ArrayList<String>(); remake.add(UtilChat.lang(t)); tooltip = remake; } }
[ "samson.bassett@gmail.com" ]
samson.bassett@gmail.com
b7dae0736a141b48e61ecd11b0353bd1e62d9fbd
d106cebc84ae90bbe36ab56409014abcde14278f
/src/main/java/cn/trasen/tsrelease/service/IndividualityService.java
312785da934cd82028b0910d1c45fa7346d82a61
[]
no_license
ts-imsi/ts-release
ed0441fa42d85fa00d6728569d997582554fd264
fa7993c4855a7910df46ae76ce490b8f1bee0c5d
refs/heads/master
2021-05-03T11:03:28.306188
2018-02-27T07:08:54
2018-02-27T07:08:54
120,544,281
1
1
null
null
null
null
UTF-8
Java
false
false
2,153
java
package cn.trasen.tsrelease.service; import cn.trasen.tsrelease.dao.TbIndividualityMapper; import cn.trasen.tsrelease.model.TbFile; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import cn.trasen.tsrelease.model.TbIndividuality; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** * @author luoyun * @ClassName: IntelliJ IDEA * @Description: 操作类型 * @date 2018/2/24 */ @Service public class IndividualityService { @Autowired TbIndividualityMapper tbIndividualityMapper; @Autowired FileService fileService; public PageInfo<TbIndividuality> getIndividualityList(Integer page,Integer rows,String hospitalName){ PageHelper.startPage(page,rows); List<TbIndividuality> tbIndividualities=tbIndividualityMapper.getIndividualityList(hospitalName); PageInfo<TbIndividuality> pagehelper = new PageInfo<TbIndividuality>(tbIndividualities); return pagehelper; } public void saveIndividuality(TbIndividuality tbIndividuality){ tbIndividualityMapper.saveIndividuality(tbIndividuality); } @Transactional(rollbackFor = Exception.class) public boolean saveFileAndInviduality(MultipartFile[] files,String type,TbIndividuality tbIndividuality){ boolean boo=false; String pkid=""; Long size=0L; if(files!=null){ for(MultipartFile file:files){ TbFile tbFile=fileService.saveFileOne(file,type); if(tbFile!=null){ pkid=pkid+tbFile.getPkid()+","; size=tbFile.getSize()+size; }else{ return boo; } } } tbIndividuality.setSize(size.intValue()); tbIndividuality.setFileId(pkid); //todo 鉴权 tbIndividuality.setOperator("system"); saveIndividuality(tbIndividuality); boo=true; return boo; } }
[ "sakfi102012@163.com" ]
sakfi102012@163.com
e58efd6f1d1c056441d6e6fba4a18373aef909d8
0e3c2253904a31d15300cdf76e83c5850a8e2f40
/java-core/challenges-mix/004-end-of-file/src/main/java/com/ivan/polovyi/challenges/EndOfFile.java
6eba812c519a4f7a7508e156c5abc23aa44a0b33
[]
no_license
polovyivan/challenges-mix
9db86ce7ffb92b96583f8896248b4eb29e77a846
266c4859a16b514136765ffb4fb705613a08ca55
refs/heads/master
2021-07-12T09:40:20.677903
2021-02-11T00:45:35
2021-02-11T00:45:35
231,290,205
1
0
null
2020-03-05T13:17:50
2020-01-02T02:05:49
Java
UTF-8
Java
false
false
360
java
package com.ivan.polovyi.challenges; import java.util.Scanner; public class EndOfFile { public static void main(String[] args) { Scanner s = new Scanner(System.in); int count = 1; while(s.hasNext()) { String ns = s.nextLine(); System.out.println(count + " " + ns); count++; } } }
[ "polovyiivan@gmail.com" ]
polovyiivan@gmail.com
0f73bf55c1fd09e5f364e1aaf4d55289a13308d4
34d55e0fd0ad83cd01b998c2e5f60e9e9fe67c57
/app/src/main/java/com/comment/tek/fragment/HomePageFragment.java
2ea752ca851f5bb3db040e96b199c81e13bf1948
[]
no_license
kevinStrange/app-android-comment
3f25b9cd3217b7e4101c4131cef739c300bc5fd0
a08895464a119b9ad89cef71a6fd6bc7b715cea6
refs/heads/master
2020-03-27T15:12:03.098401
2018-09-04T05:44:10
2018-09-04T05:44:10
146,703,898
0
0
null
null
null
null
UTF-8
Java
false
false
1,731
java
package com.comment.tek.fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.comment.banner.interfaces.IOnBannerListener; import com.comment.banner.util.BannerConfig; import com.comment.banner.view.Banner; import com.comment.tek.activity.R; import com.comment.tek.base.BaseApplication; import com.comment.tek.base.BaseFragment; import com.comment.tek.widget.GlideImageLoader; /** * Created by huanghongfa on 2018/8/24. * 首页 */ public class HomePageFragment extends BaseFragment implements View.OnClickListener, IOnBannerListener { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_home_page, null); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); initView(); } @Override public void initView() { super.initView(); Banner banner2 = findViewById(R.id.banner2); banner2.setImages(BaseApplication.banner_images) .setBannerTitles(BaseApplication.banner_titles) .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE) .setImageLoader(new GlideImageLoader()) .setOnBannerListener(this) .start(); } @Override public void onClick(View v) { switch (v.getId()) { } } @Override public void OnBannerClick(int position) { toast("点击了" + position); } }
[ "hongfahuang@snsshop.net" ]
hongfahuang@snsshop.net
9b0495de7ce387117bf74ca586d408cbbe6b82a5
4f95aee5f176e7c07fcb93636b4a849f79333800
/app/src/main/java/top/wzmyyj/zymk/view/fragment/F_1.java
6ce7575c6e5341019416886f8ee273e54cebcd14
[]
no_license
yinjunChic/ZYMK
b845ae80a75a8876e9c34f704cbb270a8e5c967f
8e4cd999393a9d8d06a7275164e6e0a73636798c
refs/heads/master
2020-03-27T00:43:41.362930
2018-08-21T09:16:17
2018-08-21T09:16:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,231
java
package top.wzmyyj.zymk.view.fragment; import android.view.View; import android.widget.FrameLayout; import android.widget.LinearLayout; import java.util.List; import butterknife.BindView; import butterknife.OnClick; import top.wzmyyj.wzm_sdk.tools.T; import top.wzmyyj.zymk.R; import top.wzmyyj.zymk.app.bean.FavorBean; import top.wzmyyj.zymk.common.utils.StatusBarUtil; import top.wzmyyj.zymk.presenter.HomePresenter; import top.wzmyyj.zymk.view.fragment.base.BaseFragment; import top.wzmyyj.zymk.view.iv.IF_1View; import top.wzmyyj.zymk.view.panel.HomeFavorPanel; import top.wzmyyj.zymk.view.panel.HomeNestedScrollPanel; /** * Created by yyj on 2018/06/28. email: 2209011667@qq.com */ public class F_1 extends BaseFragment<HomePresenter> implements IF_1View { @Override protected void initPresenter() { mPresenter = new HomePresenter(activity, this); } @Override protected int getLayoutId() { return R.layout.fragment_1; } @Override protected void initPanels() { super.initPanels(); addPanels(new HomeNestedScrollPanel(context, mPresenter)); addPanels(new HomeFavorPanel(context, mPresenter)); } @BindView(R.id.fl_panel) FrameLayout fl_panel; @OnClick(R.id.img_a) public void fff() { T.s("这是一个预留按钮>_<"); } @OnClick(R.id.img_search) public void search() { mPresenter.goSearch(); } @BindView(R.id.ll_top) LinearLayout ll_top; @BindView(R.id.v_top_0) View v0; @BindView(R.id.v_top_1) View v1; @BindView(R.id.v_top_2) View v2; @Override protected void initView() { super.initView(); StatusBarUtil.fitsStatusBarView(v0, v1, v2); fl_panel.addView(getPanelView(0)); fl_panel.addView(getPanelView(1)); getPanel(0).bingViews(ll_top); } @Override protected void initData() { super.initData(); mPresenter.loadData(); mPresenter.updateLoadFavor(); } @Override public void update(int w, Object... objs) { getPanel(0).f(w, objs); } @Override public void loadFavor(List<FavorBean> list) { getPanel(1).f(0, list); } }
[ "2209011667@qq.com" ]
2209011667@qq.com
0c12024c65a31d15cc799edb18f82230621e2019
1624de67cbed074dd130a1250b6e02965c399a2f
/JavaPhotoEditor/src/operations/BasicOperation11.java
9100485960367c6d35628fcd946852a4a1bdc5e3
[]
no_license
Ognjenjebot/PhotoEditor
445e7213af6b5374f6c432a802ff919a815f8af8
4ec7a5f684b60043222279eafdcbbb6918b36ac8
refs/heads/main
2023-07-04T00:48:13.693377
2021-07-22T15:20:37
2021-07-22T15:20:37
388,486,159
1
0
null
null
null
null
UTF-8
Java
false
false
1,100
java
package operations; import java.util.ArrayList; import gui.Layer; import gui.Selection; public class BasicOperation11 extends Operation { @Override public void execute(Layer i, int num) { Selection s = i.parent.getSelection(); ArrayList<Integer> indexes = s.pixelSelection(i.width, i.height); if (indexes.size() == 0) {//cela slika for (int j=0; j<i.pixels.size(); j++) { if(i.pixels.get(j).A < num) i.pixels.get(j).A = (byte) num; if(i.pixels.get(j).R < num) i.pixels.get(j).R = (byte) num; if(i.pixels.get(j).G < num) i.pixels.get(j).G = (byte) num; if(i.pixels.get(j).B < num) i.pixels.get(j).B = (byte) num; } } else { //selekcija for (int j=0; j<indexes.size(); j++) { int index = indexes.get(j).intValue(); if(i.pixels.get(index).A < num) i.pixels.get(index).A = (byte) num; if(i.pixels.get(index).R < num) i.pixels.get(index).R = (byte) num; if(i.pixels.get(index).G < num) i.pixels.get(index).G = (byte) num; if(i.pixels.get(index).B < num) i.pixels.get(index).B = (byte) num; } } } }
[ "ognjen.stanojevic321@gmail.com" ]
ognjen.stanojevic321@gmail.com
c274066367b0c475fb2089ab7424d0870572c272
e49213f91a2d4e6e89c49fdae5dd0239c03b9240
/src/main/java/com/mynegocio/app/service/InvalidPasswordException.java
991bf7442108ef8e8c401d02f0762be0af273c5b
[]
no_license
efacu/hjisterapp
576faaeffdb706c407fe90a0eb8e5de0baa559b4
7401cd995f61ea19cc55dfeff4c40d703b00b78a
refs/heads/master
2022-12-24T02:25:34.631939
2019-09-19T19:16:44
2019-09-19T19:16:44
209,631,139
0
0
null
2022-12-16T05:05:41
2019-09-19T19:16:28
Java
UTF-8
Java
false
false
188
java
package com.mynegocio.app.service; public class InvalidPasswordException extends RuntimeException { public InvalidPasswordException() { super("Incorrect password"); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
3f00ba40e6d1223894a6a27fd378b09faea80d62
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/kylin/testing/937/UserService.java
85c6c5148189bee09a6467e5faafe413b5f9cd13
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,613
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.kylin.rest.service; import java.io.IOException; import java.util.List; import org.apache.kylin.rest.security.ManagedUser; import org.springframework.security.provisioning.UserDetailsManager; public interface UserService extends UserDetailsManager { boolean isEvictCacheFlag(); void setEvictCacheFlag(boolean evictCacheFlag); List<ManagedUser> listUsers() throws IOException; List<String> listAdminUsers() throws IOException; //For performance consideration, list all users may be incomplete(eg. not load user's authorities until authorities has benn used). //So it's an extension point that can complete user's information latter. //loadUserByUsername() has guarantee that the return user is complete. void completeUserInfo(ManagedUser user); }
[ "bloriot97@gmail.com" ]
bloriot97@gmail.com
148f8528414984e97c4a1961f7cc410e0eba51ce
b0b4c1eeaf86989567dc7dc41ec8758c9b5d6442
/src/main/java/permissions/seeders/UserTableSeeder.java
f82c3f3bf991f5afc4b6158675b921af95e6ead9
[]
no_license
axmedbek/permission_control_system
066d5810bc37bd8bfec266d7b18fb9fa29383f43
cf09e5405836a74e190f003dbe5ab96d5fc2cbae
refs/heads/master
2022-12-21T07:39:40.394346
2019-07-30T14:04:39
2019-07-30T14:04:39
199,502,440
0
0
null
2022-12-16T00:38:56
2019-07-29T17:58:32
Java
UTF-8
Java
false
false
63
java
package permissions.seeders; public class UserTableSeeder { }
[ "axmed.memmedli.96@mail.ru" ]
axmed.memmedli.96@mail.ru
7a90fefc5e0a88d7409c8d5cb8199ed09ffd0311
610156b0ea12328faea46fc27954f959735af3e7
/AlgoritmosGeneticos/AlgoritmosGeneticos/src/PaqueteMochila/Poblacion.java
0e76c767984231f971ffb14c5d7610a5957c26a2
[]
no_license
Treicysg/Analisis_algoritmos
24cb6b86e9cdf24c9f8d4d4912f7e302980d8043
979a39dd6492c7da74cf3fd9d441fa2f1532d859
refs/heads/master
2021-03-12T23:56:58.297597
2014-11-21T05:02:12
2014-11-21T05:02:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package PaqueteMochila; import PaqueteMochila.Individuo; import java.util.ArrayList; public class Poblacion { Individuo[] individuos; public Poblacion (ArrayList<Individuo> x){ individuos = new Individuo [x.size()]; for (int i=0;i<x.size();i++){ almacenarIndividuo(i,x.get(i)); } } public Poblacion(int tamanoPoblacion,boolean inicializar){ individuos = new Individuo [tamanoPoblacion]; if (inicializar){ for (int i=0;i<tamanoPoblacion;i++){ Individuo nuevo = new Individuo(); nuevo.generarIndividuo(); almacenarIndividuo(i,nuevo); } } } public void almacenarIndividuo(int index,Individuo indiv){ individuos[index] = indiv; } public Individuo getIndividuo(int index){ return individuos[index]; } public Individuo getFittest(){ Individuo fittest = individuos[0]; for (int i=0;i<individuos.length;i++){ if (fittest.getFitness()<= getIndividuo(i).getFitness()){ fittest=getIndividuo(i); } } return fittest; } public Poblacion() { // TODO Auto-generated constructor stub } }
[ "treicysanchez.27@gmail.com" ]
treicysanchez.27@gmail.com
2958b5b4ba603368f8a62c4ddeeb75ee87714b3f
33f1285003506bc50c1b9abd4ef4ca047f6904c3
/app/src/main/java/skot92/hu/unideb/hu/kiadaskezelo/service/BalanceService.java
42c9483a681c43bc21c9be0339c40f8b6fe1e0e3
[]
no_license
skot92/KiadasKezelo
81e38a7fd80871402db413060d543fd8ebd1bdf0
bee409fe69dccac8dbd2fd5dc45c6545c3a4136d
refs/heads/master
2021-03-19T14:05:04.115379
2017-03-07T20:00:56
2017-03-07T20:00:56
43,171,582
0
0
null
null
null
null
UTF-8
Java
false
false
884
java
package skot92.hu.unideb.hu.kiadaskezelo.service; import android.content.Context; import skot92.hu.unideb.hu.kiadaskezelo.core.dao.BalanceDAO; import skot92.hu.unideb.hu.kiadaskezelo.core.entity.BalanceEntity; /** * Created by skot9 on 2015. 11. 12.. */ public class BalanceService { BalanceDAO balanceDAO; InComeService inComeService; ExpenseService expenseService; public BalanceService(Context context) { inComeService = new InComeService(context); expenseService = new ExpenseService(context); balanceDAO = new BalanceDAO(context); } public long save(BalanceEntity balance) { return balanceDAO.save(balance); } public int findBalance() { int income = inComeService.getSumAmount(); int expense = -1 * expenseService.getSumAmount(); int a = income - expense; return a; } }
[ "skot9212@gmail.com" ]
skot9212@gmail.com
a7059dbc521d0c25a6028d9bb518b0caddd244b2
8b76bd5e7139000d22734a200e998a273de5ab85
/src/main/java/com/spring/royallife/controller/AdminPageController.java
03fc8b1d174043d681f69d495de44c3db649023b
[]
no_license
jitumeher01/royallifeapi
24002dc280ce960912e5834940477fa648c79df0
33587f9059d0da6d86ac7e422a5769f2e2b88c48
refs/heads/master
2021-07-06T05:57:27.651969
2017-10-02T15:00:05
2017-10-02T15:00:05
104,493,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,852
java
//package com.spring.royallife.controller; // //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.http.HttpStatus; //import org.springframework.http.ResponseEntity; //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 com.spring.royallife.entity.AdminEntity; //import com.spring.royallife.facade.AdminFacade; //import com.spring.royallife.form.UserForm; //import com.spring.royallife.service.AdminService; // //@RestController("/api/rest/admin") //public class AdminPageController { // // @Autowired // private AdminFacade adminFacade; // // @Autowired // private AdminService adminService; // // @RequestMapping(value = "/adminlogin", method = RequestMethod.POST) // public ResponseEntity<?> register(@RequestBody UserForm userForm) { // // AdminEntity adminEntity = adminFacade.findByAdminIdAandPassword(userForm.getUserId(), userForm.getPassword()); // if (adminEntity != null) { // return ResponseEntity.status(HttpStatus.OK).body(adminEntity); // } else { // return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Invalid Admin Id/Password !"); // } // } // // @RequestMapping(value = "/allUser", method = RequestMethod.GET) // public ResponseEntity<?> getAllUser(@RequestHeader(value = "token") String token) { // AdminEntity adminEntity = adminService.verifyToken(token); // if (adminEntity != null) { // return ResponseEntity.status(HttpStatus.OK).body(adminFacade.findAllUser()); // } else { // return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !"); // } // } // // @RequestMapping(value = "/singleUser", method = RequestMethod.GET) // public ResponseEntity<?> getUserById(@RequestHeader(value = "token") String token,@RequestBody UserForm userForm) { // AdminEntity adminEntity = adminService.verifyToken(token); // if (adminEntity != null) { // return ResponseEntity.status(HttpStatus.OK).body(adminFacade.findUserById(userForm.getUserId())); // } else { // return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !"); // } // } // // @RequestMapping(value = "/updateUser", method = RequestMethod.GET) // public ResponseEntity<?> updateUser(@RequestHeader(value = "token") String token,@RequestBody UserForm userForm) { // AdminEntity adminEntity = adminService.verifyToken(token); // if (adminEntity != null) { // adminFacade.updateUser(userForm); // return ResponseEntity.status(HttpStatus.OK).body("User Data Updated !"); // } else { // return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !"); // } // } // //}
[ "jitumeher01@gmail.com" ]
jitumeher01@gmail.com
c1ff51a62fd967f87e340430a45cb59e222a335e
1f4c06ca5ea137c7d4566c5f514fbc2c2b13d45d
/src/main/java/com/gotofinal/messages/api/chat/component/ComponentBuilder.java
5fbf7f3bd2e1d64fb6c855cf3205bd337eeaa522
[]
no_license
GotoFinal/MessagesAPI
68070930d43bcc0251025ba100b710a40decf55b
898086fd9e3f2fd20428befc975f5066b24ad35e
refs/heads/master
2021-01-10T16:42:17.095135
2016-02-21T08:09:35
2016-02-21T08:09:35
51,719,200
0
0
null
null
null
null
UTF-8
Java
false
false
7,641
java
/* * The MIT License (MIT) * * Copyright (c) 2016. Diorite (by Bartłomiej Mazur (aka GotoFinal)) * * 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.gotofinal.messages.api.chat.component; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.gotofinal.messages.api.chat.ChatColor; /** * Builder class for easier building chat messages. */ public class ComponentBuilder { private final TextComponent parts = new TextComponent(""); private BaseComponent current; /** * Construct new ComponentBuilder as copy of old one. * * @param original ComponentBuilder to copy. */ protected ComponentBuilder(final ComponentBuilder original) { this.current = new TextComponent(original.current); original.parts.getExtra().stream().map(BaseComponent::duplicate).forEach(this.parts::addExtra); } /** * Construct new ComponentBuilder strating from given string ({@link TextComponent}). * * @param text first element of message. */ protected ComponentBuilder(final String text) { this.current = new TextComponent(text); } /** * Add previously edited component to other parts, and set given component as current one. * * @param component new component to edit and add. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder append(final BaseComponent component) { this.parts.addExtra(this.current); this.current = component; return this; } /** * Add previously edited component to other parts, and set given component as current one. * * @param text new component to edit and add as legacy string. {@link TextComponent#fromLegacyText(String)} * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder appendLegacy(final String text) { this.parts.addExtra(this.current); this.current = TextComponent.fromLegacyText(text); return this; } /** * Add previously edited component to other parts, and set given component as current one. * * @param text new component to edit and add as string. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder append(final String text) { this.parts.addExtra(this.current); this.current = new TextComponent(text); return this; } /** * Set color of current element to given one, may be null. * * @param color color to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder color(final ChatColor color) { this.current.setColor(color); return this; } /** * Set bold style flag of current element to given one, may be null. * * @param bold bold style flag to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder bold(final Boolean bold) { this.current.setBold(bold); return this; } /** * Set italic style flag of current element to given one, may be null. * * @param italic italic style flag to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder italic(final Boolean italic) { this.current.setItalic(italic); return this; } /** * Set underlined style flag of current element to given one, may be null. * * @param underlined underlined style flag to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder underlined(final Boolean underlined) { this.current.setUnderlined(underlined); return this; } /** * Set strikethrough style flag of current element to given one, may be null. * * @param strikethrough strikethrough style flag to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder strikethrough(final Boolean strikethrough) { this.current.setStrikethrough(strikethrough); return this; } /** * Set obfuscated style flag of current element to given one, may be null. * * @param obfuscated obfuscated style flag to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder obfuscated(final Boolean obfuscated) { this.current.setObfuscated(obfuscated); return this; } /** * Set click event of current element to given one, may be null. * * @param clickEvent click event to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder event(final ClickEvent clickEvent) { this.current.setClickEvent(clickEvent); return this; } /** * Set hover event of current element to given one, may be null. * * @param hoverEvent hover event to use, may be null. * * @return this same ComponentBuilder for method chains. */ public ComponentBuilder event(final HoverEvent hoverEvent) { this.current.setHoverEvent(hoverEvent); return this; } /** * Finish builder, and create {@link TextComponent} with all created parts. * * @return builded {@link TextComponent}. */ public TextComponent create() { this.parts.addExtra(this.current); return this.parts; } /** * Construct new ComponentBuilder strating from given string ({@link TextComponent}). * * @param text first element of message. * * @return new ComponentBuilder instance. */ public static ComponentBuilder start(final String text) { return new ComponentBuilder(text); } /** * Construct new ComponentBuilder as copy of old one. * * @param original ComponentBuilder to copy. * * @return new ComponentBuilder instance. */ public static ComponentBuilder start(final ComponentBuilder original) { return new ComponentBuilder(original); } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString()).append("parts", this.parts).append("current", this.current).toString(); } }
[ "bartlomiejkmazur@gmail.com" ]
bartlomiejkmazur@gmail.com
e0dbf4a9247b648a5f10cb6028aaf59cce9dd424
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/53/1613.java
581b01cccd103dc30a5a57953a680405edcbb12f
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
933
java
package <missing>; public class GlobalMembers { public static int Main() { int[] x = new int[300]; int[] y = new int[300]; int i; int j; int k = 0; int n; int sign; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { n = Integer.parseInt(tempVar); } for (i = 0;i < n;i++) { String tempVar2 = ConsoleInput.scanfRead(); if (tempVar2 != null) { x[i] = Integer.parseInt(tempVar2); } } for (i = 0;i < n;i++) { for (sign = 0,j = 0;j < i;j++) { if (x[i] == x[j]) { sign = 1; break; } } if (sign == 0) { y[k] = x[i]; k++; } } System.out.printf("%d",y[0]); for (i = 1;i < k;i++) { System.out.printf(",%d",y[i]); } String tempVar3 = ConsoleInput.scanfRead(); if (tempVar3 != null) { n = Integer.parseInt(tempVar3); } return 0; } }
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk