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
9ce93fc99c89dfc8fa47d47faa0d75e5a425fa69
4ab8090b6e01a211560b5e12f9b5a8e5bfaa6599
/src/main/java/com/appdeveloperblog/app/ws/io/repositories/AddressRepository.java
3481de25dc3b8c86e8db5352841e908dad917ee3
[]
no_license
sudhons/springboot-api
02823c7f19e1d72ef8db82b771121f17bc460cfe
2c6e557f93869622e2d823af849081efcc8ef35f
refs/heads/master
2020-12-26T09:01:53.011699
2020-01-31T15:27:50
2020-01-31T15:27:50
237,457,790
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.appdeveloperblog.app.ws.io.repositories; import com.appdeveloperblog.app.ws.io.entity.AddressEntity; import com.appdeveloperblog.app.ws.io.entity.UserEntity; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface AddressRepository extends CrudRepository<AddressEntity, Long> { AddressEntity findByAddressId(String addressId); Iterable<AddressEntity> findAllByUserDetails(UserEntity user); }
[ "sudhons@gmail.com" ]
sudhons@gmail.com
b7efda24f02f462e2f54b2490cf6bd3dc7c189b1
c1308d37420a6e1b71376208377bd983ef26b328
/src/main/java/cn/ncut/service/system/sequence/impl/SequenceServiceImpl.java
f506322bb7c68cedcf4d53c3f33be706f8d46def
[]
no_license
ncut-database-lab/dccm
ad830af13f1f99b43e4049f9286d6848a071a3cf
f8d5e523dee0363a735fe226a1e7d1c599504de5
refs/heads/master
2018-10-05T20:38:13.478844
2018-06-17T13:54:53
2018-06-17T13:54:53
117,047,610
1
1
null
2018-01-11T03:55:54
2018-01-11T03:55:54
null
UTF-8
Java
false
false
748
java
package cn.ncut.service.system.sequence.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import cn.ncut.dao.DaoSupport; import cn.ncut.entity.Sequence; import cn.ncut.service.system.sequence.SequenceService; @Service("sequenceService") public class SequenceServiceImpl implements SequenceService{ @Resource(name = "daoSupport") private DaoSupport dao; //查找一条记录 @Override public Sequence getSequenceByType(String type) throws Exception { return (Sequence) dao.findForObject("SequenceMapper.getSequenceByType",type); } //修改一条记录 @Override public void updateSequence(Sequence sequence) throws Exception { dao.update("SequenceMapper.updateSequence", sequence); } }
[ "690074384@qq.com" ]
690074384@qq.com
783b773d97d92829409b6ddc90fdc492b6cdef2c
d5c6f1640f3550f60365a0347b4a432f1037d3c5
/src/main/java/top/arexstorm/sharing/mapper/CustomerOrderMapper.java
f3c880b6f99fbcf77dbd22e4370632b37f14efc5
[]
no_license
sandiegoe/Sharing
137818f52f590e6d830a55afd74eabe353bcde4f
30e99744c399c392d3ca51d98e49d262804dfba7
refs/heads/master
2020-03-24T00:42:04.715017
2018-07-25T05:33:26
2018-07-25T05:33:26
142,303,563
0
2
null
null
null
null
UTF-8
Java
false
false
578
java
package top.arexstorm.sharing.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import top.arexstorm.sharing.bean.order.CustomerOrder; public interface CustomerOrderMapper { public CustomerOrder findOrderById(String orderid); public List<CustomerOrder> findAllOrder(CustomerOrder customerOrder); public CustomerOrder findOrderByBuyeridAndInformationid(CustomerOrder search); List<CustomerOrder> findAllInformaionTypeWithPage(@Param("status") Short status, @Param("searchKey") String searchKey, @Param("searchValue") String searchValue); }
[ "sandiegoe@126.com" ]
sandiegoe@126.com
96343a09e49b778fd841b2bb4a30b9c9a9ce62ec
60a3680ff989d406c4f6c81685f4c957b9c892f4
/mx/src/com/icsc/ms/test/msjcApiA01Test.java
c6291001f929a4e63aabd7cc23b584149abe38ac
[]
no_license
syusann/hello
2e61fa974ad1e1658c451a0eea0ad4f116caf2d3
4334cf8e03b96ce29341d71176419e3670114869
refs/heads/master
2020-04-15T04:43:57.246176
2019-10-20T07:52:12
2019-10-20T07:52:12
21,205,881
0
0
null
null
null
null
UTF-8
Java
false
false
3,400
java
package com.icsc.ms.test; import org.junit.Assert; import org.junit.Test; import org.junit.BeforeClass; import com.icsc.dpms.ds.dsjccom; import com.icsc.ms.api.msjcApiA01; /*************************************/ /**測試msjcApiA01 **/ /**可修改以下區段資料,測試某廠商資料的正確性 **/ /*************************************/ public class msjcApiA01Test { private static dsjccom dsCom = null; /**********若要測試某廠商,請修以下資料**********/ //compId private static String testCompId="0000"; //供應商編號 private static String testVendorNo="A0001AST"; //供應商名稱 private static String testVendorName="ALLIED BELLAMBI COLLIERIES PTY LIMITED"; //供應商簡稱 private static String testAbbrevName="ALLIED BEL"; //供應商國別 private static String testCountryId="AST"; //供應商是否存在 private static boolean testIsVendorExist=true; //供應商是否停權 private boolean testIsVendorReject=false; /**********若要測試某廠商,請修改以上資料**********/ @BeforeClass public static void init() throws Exception{ msjcMockDsjccom dsComObj = new msjcMockDsjccom(); dsCom = dsComObj.getMockDsjccomDB2(); testIsVendorExist = msjcApiA01.isVendorExist(dsCom, testCompId, testVendorNo); } @Test public void testIsVendorExist() { try { boolean str = msjcApiA01.isVendorExist(dsCom, testCompId, testVendorNo); System.out.print("IsVendorExist: " + str + "\n"); if(str==testIsVendorExist) Assert.assertTrue(true); else Assert.assertFalse(true); } catch (Exception e) { e.printStackTrace(); Assert.fail("test fail.."+e.getMessage()); } } @Test public void testIsVendorReject() { try { if(testIsVendorExist){ boolean str = msjcApiA01.isVendorReject(dsCom, testCompId, testVendorNo); System.out.print("IsVendorReject: " + str + "\n"); if(str==testIsVendorReject) Assert.assertTrue(true); else Assert.assertFalse(true); } } catch (Exception e) { e.printStackTrace(); Assert.fail("test fail.."+e.getMessage()); } } @Test public void testGetVendorName() { try { if(testIsVendorExist){ String str = msjcApiA01.getVendorName(dsCom, testCompId, testVendorNo); System.out.print("VendorName: " + str + "\n"); if(str.equals(testVendorName)) Assert.assertTrue(true); else Assert.assertFalse(true); } } catch (Exception e) { e.printStackTrace(); Assert.fail("test fail.."+e.getMessage()); } } @Test public void testGetVendorAbbrevName() { try { if(testIsVendorExist){ String str = msjcApiA01.getVendorAbbrevName(dsCom, testCompId, testVendorNo); System.out.print("AbbrevName: " + str + "\n"); if(str.equals(testAbbrevName)) Assert.assertTrue(true); else Assert.assertFalse(true); } } catch (Exception e) { e.printStackTrace(); Assert.fail("test fail.."+e.getMessage()); } } @Test public void testGetVendoContryId() { try { if(testIsVendorExist){ String str = msjcApiA01.getVendoContryId(dsCom, testCompId, testVendorNo); System.out.print("CountryId: " + str + "\n"); if(str.equals(testCountryId)) Assert.assertTrue(true); else Assert.assertFalse(true); } } catch (Exception e) { e.printStackTrace(); Assert.fail("test fail.."+e.getMessage()); } } }
[ "cmchu@icsc.com.tw" ]
cmchu@icsc.com.tw
872176fbef105abe2e2e497211b5e7ecf9a9faf2
3ade82e22c5dabd2b47f4090101a7d70fd9a3631
/app/src/main/java/com/ict3104/t10_idk_2020/ARActivity.java
4c455161f077e466aec11fa88c2cdff97226059a
[]
no_license
qiwen19/travelAR
e91c5711646f652d2df2618ffbf8a2e2dc1445ce
ab25483dc8b4c3ae23afea67bc7cc48e9789fccb
refs/heads/master
2023-09-01T19:16:29.734237
2021-10-08T04:29:01
2021-10-08T04:29:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
34,670
java
package com.ict3104.t10_idk_2020; import android.Manifest; import android.annotation.SuppressLint; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Camera; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.CircleOptions; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.ar.core.Anchor; import com.google.ar.core.HitResult; import com.google.ar.core.Plane; import com.google.ar.sceneform.AnchorNode; import com.google.ar.sceneform.math.Quaternion; import com.google.ar.sceneform.math.Vector3; import com.google.ar.sceneform.ux.BaseArFragment; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.QueryDocumentSnapshot; import com.google.firebase.firestore.QuerySnapshot; import com.google.maps.android.PolyUtil; import com.google.maps.android.SphericalUtil; import com.google.maps.android.ui.IconGenerator; import com.ict3104.t10_idk_2020.model.Weather; import com.ict3104.t10_idk_2020.repository.AsyncResponse; import com.squareup.picasso.Picasso; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import static com.google.ar.sceneform.math.Quaternion.lookRotation; public class ARActivity extends AppCompatActivity implements SensorEventListener, LocationListener{ //db private FirebaseFirestore db = FirebaseFirestore.getInstance(); private ARFragment arFragment; private SupportMapFragment mapFragment; private ImageView mdirectionPic; //Map private static final int DEFAULT_ZOOM = 18; GoogleMap map = null; // Location private FusedLocationProviderClient fusedLocationClient; private Location lastKnownLocation; private boolean locationPermissionGranted; private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 1; //Token Object AnchorNode anchorNode; List<PlaceToken> places = new ArrayList<PlaceToken>(); //for current location Location mCurrentLocation; String mLastUpdateTime; private GoogleApiClient googleApiClient; private Marker mCurrLocationMarker; private LocationRequest mLocationRequest; private ArrayList<LatLng> routePoints; private Polyline line; private LatLng c; private int nearestPointIndex; private LatLng origin; private LatLng dest; private Location location; //3d rotation private float centx; private float centy; //sensor private SensorManager manager; private Sensor orientationSensor; //store data for accelerometer private float[] accelerometerReading = new float[3]; //store date for magnetometer private float[] magnetometerReading = new float[3]; //data for the rotation matrix, store the combined magnetomer and accelerometer private final float[] rotationMatrix = new float[9]; //data for orientation angles, mainly used this private final float[] orientationAngles = new float[3]; private float fromDegrees; private double angleRotating; private TextView routeWeather; private int k; private int degreesx; private int degreesy; private int degreesz; //for route data List<HashMap<String, String>> listResult = null; ArrayList points2 = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ar); //get list data listResult = (List<HashMap<String, String>>) getIntent().getSerializableExtra("ResultList"); //get start and end location origin = new LatLng(Double.parseDouble(listResult.get(0).get("startlocationlat")),Double.parseDouble(listResult.get(0).get("startlocationlng"))); dest = new LatLng(Double.parseDouble(listResult.get(0).get("endlocationlat")),Double.parseDouble(listResult.get(0).get("endlocationlng"))); arFragment = (ARFragment) getSupportFragmentManager().findFragmentById(R.id.ar_fragment); mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.maps_fragment); mdirectionPic = (ImageView) findViewById(R.id.direction_pic); // Construct a FusedLocationProviderClient. fusedLocationClient = LocationServices.getFusedLocationProviderClient(this.getApplicationContext()); setUpPlaces(); setUpMaps(); setUpAr(); // android 6.0 or above auto granted, or set targetSdkVersion vto 23 or below if (ActivityCompat.checkSelfPermission(ARActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(ARActivity.this, new String[]{Manifest.permission.CAMERA}, 0); } //get LocationManager object from system LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); //get latest current location from GPS location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); c = new LatLng(location.getLatitude(), location.getLongitude()); //get nearest dot points2 = new ArrayList(); for (int j = 1; j < listResult.size(); j++) { HashMap<String, String> point = listResult.get(j); double lat = Double.parseDouble(point.get("lat")); double lng = Double.parseDouble(point.get("lng")); LatLng position = new LatLng(lat, lng); if ((j % 2) == 0) { points2.add(position); } } nearestPointIndex = findNearestPoint(c,points2); if(nearestPointIndex>0){ ArrayList p3 = new ArrayList(); for (int j = nearestPointIndex; j < points2.size(); j++) { LatLng point = (LatLng) points2.get(j); p3.add(point); } points2 = p3; //points2 = (ArrayList) points2.subList(nearestPointIndex, 4); } angleRotating = (float) angleFromCoordinate(c, (LatLng) points2.get(1)); //set get location interval to 1 second locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, //GPS定位提供者 2000, //更新数据时间为2秒 1, //位置间隔为1米 //位置监听器 new LocationListener() { //active when GPS data changed, used to update location info @Override public void onLocationChanged(Location location) { //update current lacation when the GPS changed c = new LatLng(location.getLatitude(), location.getLongitude()); updateCameraBearing(map, location.getBearing()); nearestPointIndex = findNearestPoint(c,points2); if(nearestPointIndex>0){ ArrayList p3 = new ArrayList(); for (int j = nearestPointIndex; j < points2.size(); j++) { LatLng point = (LatLng) points2.get(j); p3.add(point); } points2 = p3; DrawDots(listResult,points2); } } @Override //trigger when the location status changed public void onStatusChanged(String provider, int status, Bundle extras) { } @Override //triggered when the provider enabled public void onProviderEnabled(String provider) { } @Override //triggered when the provider disabled public void onProviderDisabled(String provider) { } }); // arrow rotation centx = mdirectionPic.getX() + mdirectionPic.getWidth() / 2; centy = mdirectionPic.getY() + mdirectionPic.getHeight() / 2; Matrix mMatrix = new Matrix(); Bitmap bmp = ((BitmapDrawable) getResources().getDrawable( R.drawable.myup2)).getBitmap(); Camera camera = new Camera(); camera.save(); //camera.rotateY(50f); camera.rotateX(80); camera.rotateZ((float) angleRotating); camera.getMatrix(mMatrix); camera.restore(); mMatrix.preTranslate(-centx, -centy); mMatrix.postTranslate(centx, centy); Bitmap bm = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mMatrix, true); mdirectionPic.setImageBitmap(bm); //for sensor manager = (SensorManager) this.getSystemService(SENSOR_SERVICE); //for wheather /* Retrieve weather from API */ ImageView wheatherIconimageView = (ImageView) findViewById(R.id.wheatherIconimageView); routeWeather = (TextView)findViewById(R.id.routeWeather); Picasso.with(this).load("http://openweathermap.org/img/wn/10d@2x.png").into(wheatherIconimageView); FetchWeather fetchWeather = new FetchWeather(new AsyncResponse() { @Override public void processFinish(Weather weather) { routeWeather.setText(weather.getWeather() + " " + weather.getTemp() + "°C"); } }); fetchWeather.execute(String.valueOf(origin.latitude), String.valueOf(origin.longitude)); // Singapore Lat & Long } private void setUpPlaces(){ //loop through database for places. db.collection("Tokens").get() .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { if (task.isSuccessful()) { for (QueryDocumentSnapshot document : task.getResult()) { String id = document.getId(); String name = document.get("name").toString(); String desc = document.get("description").toString(); String[] latLng = document.get("latlng").toString().split(","); double latitude = Double.parseDouble(latLng[0]); double longitude = Double.parseDouble(latLng[1]); places.add(new PlaceToken(id, name, desc, new LatLng(latitude, longitude))); } } } }); } private void setUpAr() { arFragment.setOnTapArPlaneListener(new BaseArFragment.OnTapArPlaneListener() { @Override public void onTapPlane(HitResult hitResult, Plane plane, MotionEvent motionEvent) { Anchor anchor = hitResult.createAnchor(); anchorNode = new AnchorNode(anchor); anchorNode.setParent(arFragment.getArSceneView().getScene()); addPlaces(anchorNode); } }); } private void setUpMaps() { mapFragment.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { map = googleMap; getLocationPermission(); getCurrentLocation(); updateLocationUI(); //zoom map map.moveCamera(CameraUpdateFactory.newLatLngZoom(c, DEFAULT_ZOOM)); //LatLng origin = new LatLng(1.37, 103.84); //LatLng dest = new LatLng(1.35, 103.94); //String bywhat = "walking"; //String[] origintemp = getIntent().getStringExtra("ORIGIN").split(","); //final LatLng origin = new LatLng(Double.parseDouble(origintemp[0]), Double.parseDouble(origintemp[1])); //String[] desttemp = getIntent().getStringExtra("DEST").split(","); //final LatLng dest = new LatLng(Double.parseDouble(desttemp[0]), Double.parseDouble(desttemp[1])); MarkerOptions options = new MarkerOptions(); // this is the start location marker in green options.position(origin); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); // the is the end location marker in red map.addMarker(options); options.position(dest); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); map.addMarker(options); //-------------------------------here is where we called google api--------------------- // Getting URL to the Google Directions API /*HashMap<String, String> tempv1 = new HashMap<String, String>() {{ put("lng", "103.84658"); put("lat", "1.37723"); }}; HashMap<String, String> tempv2 = new HashMap<String, String>() {{ put("lng", "103.84691"); put("lat", "1.37716"); }}; HashMap<String, String> tempv3 = new HashMap<String, String>() {{ put("lng", "103.84705"); put("lat", "1.37713"); }}; HashMap<String, String> tempv4 = new HashMap<String, String>() {{ put("lng", "103.84725"); put("lat", "1.37708"); }}; List<HashMap<String, String>> listResult = new ArrayList<HashMap<String, String>>() {{ add(tempv1); add(tempv2); add(tempv3); add(tempv4); }}; */ DrawDots(listResult,points2); // ------------------here is the end of calling api as well as drawing lines---- } }); } private int findNearestPoint(LatLng test, List<LatLng> target) { float distance = distanceTo(test, target.get(0)); int pointIndex = -1; //LatLng minimumDistancePoint = test; if (test == null || target == null) { return -1; } for (int i = 1; i < target.size(); i++) { LatLng point = target.get(i); int segmentPoint = i + 1; if (segmentPoint >= target.size()) { segmentPoint = 0; } float currentDistance = distanceTo(test, target.get(segmentPoint)); if (distance == -1 || currentDistance < distance) { distance = currentDistance; pointIndex = i; } } return pointIndex; } public float distanceTo (LatLng pa, LatLng pb) { float lat_a = (float) pa.latitude; float lng_a = (float) pa.longitude; float lat_b = (float) pb.latitude; float lng_b = (float) pb.longitude; double earthRadius = 3958.75; double latDiff = Math.toRadians(lat_b-lat_a); double lngDiff = Math.toRadians(lng_b-lng_a); double a = Math.sin(latDiff /2) * Math.sin(latDiff /2) + Math.cos(Math.toRadians(lat_a)) * Math.cos(Math.toRadians(lat_b)) * Math.sin(lngDiff /2) * Math.sin(lngDiff /2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double distance = earthRadius * c; int meterConversion = 1609; return new Float(distance * meterConversion).floatValue(); } private void updateCameraBearing(GoogleMap googleMap, float bearing) { if ( googleMap == null) return; CameraPosition camPos = CameraPosition .builder( googleMap.getCameraPosition() // current Camera ) .bearing(bearing) .build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(camPos)); } //for google map route private void DrawDots(List<HashMap<String, String>> result,ArrayList point2) { map.clear(); MarkerOptions options = new MarkerOptions(); // this is the start location marker in green options.position(origin); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); // the is the end location marker in red map.addMarker(options); options.position(dest); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); map.addMarker(options); ArrayList points = null; PolylineOptions lineOptions = null; MarkerOptions markerOptions = new MarkerOptions(); points = new ArrayList(); lineOptions = new PolylineOptions(); List<HashMap<String, String>> path = result; for (int j = 1; j < path.size(); j++) { HashMap<String, String> point = path.get(j); double lat = Double.parseDouble(point.get("lat")); double lng = Double.parseDouble(point.get("lng")); LatLng position = new LatLng(lat, lng); points.add(position); } lineOptions.addAll(points); lineOptions.width(12); lineOptions.color(Color.RED); lineOptions.geodesic(true); map.addPolyline(lineOptions); for (Object k : points2) { map.addCircle(new CircleOptions() .center((LatLng) k) .radius(3) .strokeColor(Color.BLUE) .fillColor(Color.BLUE)); } } //for 3D tags private void addPlaces(AnchorNode anchorNode) { if (lastKnownLocation == null) { return; } if (places == null) { return; } for (int i = 0; i < places.size(); i++) { PlaceToken place = places.get(i); double placeLat = place.latlng.latitude; double placeLng = place.latlng.longitude; LatLng startLatLng = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()); LatLng endLatLng = new LatLng(placeLat, placeLng); Double distance = SphericalUtil.computeDistanceBetween(startLatLng, endLatLng); //Only display tokens within 3KM away from current location if (distance < 3000){ PlaceNode placeNode = new PlaceNode(this, place); ObjNode objNode = new ObjNode(this, place); placeNode.setParent(anchorNode); objNode.setParent(anchorNode); Location tLocation = new Location("temp"); tLocation.setLatitude(place.latlng.latitude); tLocation.setLongitude(place.latlng.longitude); double latDiff = lastKnownLocation.getLatitude() - tLocation.getLatitude(); double lngDiff = lastKnownLocation.getLongitude() - tLocation.getLongitude(); int conversionFactor = 111000; float x = (float) latDiff * conversionFactor; float z = (float) lngDiff * conversionFactor; float y = 0.0F; placeNode.setWorldPosition(new Vector3(x, y, z)); objNode.setWorldPosition(new Vector3(x, 1, z)); Vector3 cameraPosition = arFragment.getArSceneView().getScene().getCamera().getWorldPosition(); Vector3 direction = Vector3.subtract(cameraPosition, placeNode.getWorldPosition()); Vector3 direction2 = Vector3.subtract(cameraPosition, placeNode.getWorldPosition()); Quaternion lookRotation = lookRotation(direction, Vector3.up()); Quaternion lookRotation2 = lookRotation(direction2, Vector3.up()); placeNode.setWorldRotation(lookRotation); objNode.setWorldRotation(lookRotation2); //placeNode.setLocalPosition(place.getPositionVector(orientationAngles[0], new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()))); placeNode.setOnTapListener((hitTestResult, motionEvent) -> { showInfoWindow(place); }); //Add the place in maps MarkerOptions options = new MarkerOptions(); options.title(place.name); options.position(place.latlng); map.addMarker(options); } } } private void showInfoWindow(PlaceToken place){ if(anchorNode == null){ return; } for(int i = 0; i < anchorNode.getChildren().size(); i++){ //Check if the node is not the Sphere Obj. if(anchorNode.getChildren().get(i).getClass() == ObjNode.class){ continue; } PlaceNode matchingPlaceNode = (PlaceNode)anchorNode.getChildren().get(i); if(matchingPlaceNode.place == place){ matchingPlaceNode.showInfoWindow(); } } } private void getCurrentLocation() { /* * Get the best and most recent location of the device, which may be null in rare * cases when a location is not available. */ try { if (locationPermissionGranted) { Task<Location> locationResult = fusedLocationClient.getLastLocation(); locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() { @Override public void onComplete(@NonNull Task<Location> task) { if (task.isSuccessful()) { // Set the map's camera position to the current location of the device. lastKnownLocation = task.getResult(); if (lastKnownLocation != null) { map.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()), DEFAULT_ZOOM)); updateCameraBearing(map, location.getBearing()); } } } }); } } catch (SecurityException e) { Log.e("Exception: %s", e.getMessage(), e); } } /** * Prompts the user for permission to use the device location. */ private void getLocationPermission() { /* * Request location permission, so that we can get the location of the * device. The result of the permission request is handled by a callback, * onRequestPermissionsResult. */ if (ContextCompat.checkSelfPermission(this.getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { locationPermissionGranted = true; } else { ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION); } } /** * Updates the map's UI settings based on whether the user has granted location permission. */ private void updateLocationUI() { if (map == null) { return; } try { if (locationPermissionGranted) { map.setMyLocationEnabled(true); map.getUiSettings().setMyLocationButtonEnabled(true); } else { map.setMyLocationEnabled(false); map.getUiSettings().setMyLocationButtonEnabled(false); lastKnownLocation = null; getLocationPermission(); } } catch (SecurityException e) { Log.e("Exception: %s", e.getMessage()); } } //for sensor @Override protected void onResume() { super.onResume(); if (orientationSensor != null) { manager.registerListener(this, orientationSensor, 600000); } Sensor accelerometer = manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); if (accelerometer != null) { manager.registerListener(this, accelerometer, 600000, 600000); } Sensor magneticField = manager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); if (magneticField != null) { manager.registerListener(this, magneticField, 600000, 600000); } } @Override protected void onPause() { super.onPause(); if (manager != null) { manager.unregisterListener(this); } } @Override public void onSensorChanged(SensorEvent event) { float[] values = event.values; float degree = event.values[0]; StringBuilder sb = new StringBuilder(); if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { // System.arraycopy(event.values, 0, accelerometerReading, // 0, accelerometerReading.length); accelerometerReading = event.values.clone(); } else if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { // System.arraycopy(event.values, 0, magnetometerReading, // 0, magnetometerReading.length); magnetometerReading = event.values.clone(); } updateOrientationAngles(); } private double angleFromCoordinate(LatLng tempStart, LatLng tempEnd) { double long1 = tempStart.longitude; double long2 = tempEnd.longitude; double lat1 = tempStart.latitude; double lat2 = tempEnd.latitude; double dLon = (long2 - long1); double y = Math.sin(dLon) * Math.cos(lat2); double x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon); double brng = Math.atan2(y, x); brng = Math.toDegrees(brng); brng = (brng + 360) % 360; brng = 360 - brng; // count degrees counter-clockwise - remove to make clockwise return brng; } @SuppressLint("WrongConstant") public void updateOrientationAngles() { // update rotation matrix. // var1:oritation // var2 :default is null, mag to gravrity // var3:accel // var4:magn SensorManager.getRotationMatrix(rotationMatrix, null, accelerometerReading, magnetometerReading); //calculate the device oritation based on the rotation matrix SensorManager.getOrientation(rotationMatrix, orientationAngles); if (orientationAngles.length >= 3) { if(k == 50){ //converts an angle measured in radians to an approximately equivalent angle measured in degrees. degreesx = degreesx/50; degreesy = degreesy/50; degreesz = degreesz/50; if(degreesy<-77 || Math.abs(degreesx)>175){ mdirectionPic.setVisibility(View.INVISIBLE); } else if (Math.abs(degreesz)>100 && degreesy<-0){ degreesx = degreesx - 180; mdirectionPic.setVisibility(View.VISIBLE); } else { mdirectionPic.setVisibility(View.VISIBLE); } // device clockwise is positive, therefore the img need to rotate anti-clockwise //rotate using the center of the object as center and save the current angle, next time start from this angle //RotateAnimation ra = new RotateAnimation(fromDegrees, -degrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); //set time of animation to 200 ms //ra.setDuration(200); //ra.setFillAfter(true); //fromDegrees = degrees; //permission check if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } if (points2.size() > 1) { angleRotating = angleFromCoordinate(c, (LatLng) points2.get(2)); } else { angleRotating = angleFromCoordinate(c, (LatLng) points2.get(1)); } //mdirectionPic.setRotation((float)(angleText-degrees)); Matrix mMatrix = new Matrix(); Bitmap bmp = ((BitmapDrawable) getResources().getDrawable( R.drawable.myup2)).getBitmap(); Camera camera = new Camera(); camera.save(); //camera.rotateY(50f); camera.rotateX(Math.abs(degreesy)); //camera.rotateZ((float)(degrees-angleRotating-10)); camera.rotateZ((float) (degreesx - angleRotating)); camera.getMatrix(mMatrix); camera.restore(); mMatrix.preTranslate(-centx, -centy); mMatrix.postTranslate(centx, centy); Bitmap bm = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mMatrix, true); mdirectionPic.setImageBitmap(bm); //routeWeather.setText("x: " + degreesx + " y: " + degreesy + " z: " + degreesz); k=0; } else{ if(Math.abs((int) Math.toDegrees(orientationAngles[0]))<5 || Math.abs((int) Math.toDegrees(orientationAngles[0]))>175){ k -=1; } else { degreesx += (int) Math.toDegrees(orientationAngles[0]); degreesy += (int) Math.toDegrees(orientationAngles[1]); degreesz += (int) Math.toDegrees(orientationAngles[2]); } k +=1; } } } @Override public void onAccuracyChanged(Sensor sensor, int i) { } @Override public void onLocationChanged(Location location) { if (mCurrLocationMarker != null) { mCurrLocationMarker.remove(); } mCurrentLocation = location; mLastUpdateTime = DateFormat.getTimeInstance().format(new Date()); addMarker(); } private void addMarker() { MarkerOptions options = new MarkerOptions(); IconGenerator iconFactory = new IconGenerator(this); iconFactory.setStyle(IconGenerator.STYLE_GREEN); options.icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(mLastUpdateTime))); options.anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV()); LatLng currentLatLng = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()); options.position(currentLatLng); mCurrLocationMarker = map.addMarker(options); long atTime = mCurrentLocation.getTime(); mLastUpdateTime = DateFormat.getTimeInstance().format(new Date(atTime)); mCurrLocationMarker.setTitle(mLastUpdateTime); map.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, DEFAULT_ZOOM)); map.animateCamera(CameraUpdateFactory.zoomTo(DEFAULT_ZOOM)); PolylineOptions pOptions = new PolylineOptions() .width(5) .color(Color.BLACK) .geodesic(true); for (int z = 0; z < routePoints.size(); z++) { LatLng point = routePoints.get(z); pOptions.add(point); } line = map.addPolyline(pOptions); routePoints.add(currentLatLng); } @Override public void onStatusChanged(String s, int i, Bundle bundle) { } @Override public void onProviderEnabled(String s) { } @Override public void onProviderDisabled(String s) { } }
[ "1802857@sit.singaporetech.edu.sg" ]
1802857@sit.singaporetech.edu.sg
3534da82ad6abc7ed53f22121196a94053e96ea2
798a87b82689f1f845a5dad752e62c7b8f225ccd
/src/Representations/nGrams.Predictors/src/com/kicorangel/repr/nGrams/Predictors/Eval/Eval.java
c4263014ff9bf7d4a6efb2b72a8cace52ad51911
[]
no_license
kicorangel/RD-Lab
10fa6346de47aa9337c5032bbdd754a5e28725c1
4ffa635db843c7579640ca885a553d34af42b086
refs/heads/master
2023-09-03T06:02:57.883875
2021-11-20T11:29:20
2021-11-20T11:29:20
31,957,294
2
3
null
null
null
null
UTF-8
Java
false
false
6,497
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 com.kicorangel.repr.nGrams.Predictors.Eval; import com.kicorangel.repr.base.Tools; import com.kicorangel.repr.common.Prediction; import com.kicorangel.repr.enumerations.NGRAMTYPE; import com.kicorangel.repr.enumerations.PreprocessingOptions; import com.kicorangel.repr.enumerations.SET; import com.kicorangel.repr.nGrams.Datasets.PAN19_bots; import com.kicorangel.repr.nGrams.Predictors.BotsPredictor; import com.kicorangel.repr.nGrams.Predictors.iPredictor; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Hashtable; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * * @author frangel */ public class Eval { // private static String NGRAMS_PATH = "C:\\mnt\\data\\PAN\\ngrams\\pan19\\tmp"; // private static String NGRAMS = "C:\\mnt\\data\\PAN\\ngrams\\pan19\\tmp\\bots.es.WORD.n1.t100.txt"; // private static String MODEL = "C:\\mnt\\data\\PAN\\ngrams\\pan19\\models\\bots.es.WORD.n1.t100.RandomForest.model"; // private static String TEST = "C:\\mnt\\data\\PAN\\datasets\\pan19\\dataset\\pan19-author-profiling-test-2019-04-29"; private static int INI = 1; private static int NTWEETS = 100; public static void SimpleTest(iPredictor predictor, String TEST, String LANG) throws Exception{ SimpleTest(predictor, TEST, LANG, ""); } public static void SimpleTest(iPredictor predictor, String TEST, String META, String LANG) throws Exception{ Hashtable<String, Info> oTruth = predictor.LoadTruth(TEST, LANG); Hashtable<String, String> oMetaValues = new Hashtable<String, String>(); if (!META.isEmpty()) { oMetaValues = predictor.LoadMeta(META); } System.out.print(SimpleTest(predictor, oTruth, 100, 0, TEST, LANG, oMetaValues)); } private static String SimpleTest(iPredictor predictor, Hashtable<String, Info> oTruth, int nTweets, int firstTweet, String TEST, String LANG, Hashtable<String, String> metaValues) throws Exception { File directory = new File(TEST + "/" + LANG); File []files = directory.listFiles(); if (files==null) { return ""; } double accuracy = 0; for (int iFile = 0; iFile < files.length; iFile++) { if (!files[iFile].getName().endsWith("xml")) { continue; } File fXmlFile = new File(TEST + "/" + LANG + "/" + files[iFile].getName()); if (fXmlFile.exists()) { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); String sId = files[iFile].getName().replace(".xml", ""); if (sId.equalsIgnoreCase("a7aa2cafc69fcafb77107ec7ff1a3b72")) { String stop = "stop"; } NodeList documents = doc.getDocumentElement().getElementsByTagName("document"); documents.getLength(); StringBuilder sb = new StringBuilder(); for (int i = firstTweet-1; i < firstTweet + nTweets - 1; i++) { try { Element element = (Element) documents.item(i); String sHtmlContent = element.getTextContent(); String sContent = com.kicorangel.repr.base.Tools.GetText(sHtmlContent); sContent = com.kicorangel.repr.base.Tools.Prepare(sContent); sb.append(sContent).append(" "); } catch (Exception ex) { } } String sToPredict = sb.toString(); String sClass = ""; if (oTruth.containsKey(sId)) { sClass = oTruth.get(sId).Type; ArrayList<String> oMetaValues = new ArrayList<String>(); Prediction oPrediction = new Prediction(); if (metaValues.containsKey(sId)) { String sData = (String)metaValues.get(sId); String []oData = sData.split("\t"); for (int iMD=3;iMD<oData.length;iMD++) { oMetaValues.add(oData[iMD]); } oPrediction = predictor.Predict(sToPredict, oMetaValues); } // System.out.println(sId + "->" + sClass); if (oPrediction.sPredictedClass.equalsIgnoreCase(sClass)) { accuracy++; } } } } accuracy = accuracy / oTruth.size(); return String.format("%.4f", accuracy); } public static void ComplexTest(String name, iPredictor predictor, String TEST, String META, String LANG) throws Exception { Hashtable<String, Info> oTruth = predictor.LoadTruth(TEST, LANG); Hashtable<String, String> oMetaValues = new Hashtable<String, String>(); if (!META.isEmpty()) { oMetaValues = predictor.LoadMeta(META); } for (int iTweets=INI;iTweets<=NTWEETS;iTweets++) { System.out.print(name + "_" + LANG + "_" + iTweets + " <- c("); for (int iPos=1;iPos<=NTWEETS-iTweets+1;iPos++) { if (iPos>1) { System.out.print(","); } System.out.print(SimpleTest(predictor, oTruth, iTweets, iPos, TEST, LANG, oMetaValues)); } System.out.println(")"); } } }
[ "kico.rangel@gmail.com" ]
kico.rangel@gmail.com
3aebbb1e3d534136a759f7914bedf8a5e5742f60
4b18eb5f7745b12231186af2097ef7c37ec5bc22
/src/org/dimigo/inheritance/Student.java
00dfa83e7ccffd41fd246d5419b48b51b863d6c4
[]
no_license
A-Why-not-fork-repositories-Good-Luck/hyunthree2-JavaClass
ec01ab7f3eda717e2361177d27316ad0ed2731a8
326086450be5a1cf0cdb4bc9ab2a272cf51e842d
refs/heads/master
2023-07-15T03:39:06.894643
2021-08-19T17:03:44
2021-08-19T17:03:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
package org.dimigo.inheritance; public class Student extends Person { private String studentId; public Student(String name, int age, int height, int weight, String studentId) { super(name, age, height, weight); // 무조건 super를 처음 해야 함 this.studentId = studentId; } public void exam() { System.out.println(getName() + "이 시험을 봅니다."); } public void study() { System.out.println(getName() + "이 공부를 합니다."); } @Override public String toString() { return "Student{" + "studentId='" + studentId + '\'' + super.toString(); } }
[ "42177358+hyunthree2@users.noreply.github.com" ]
42177358+hyunthree2@users.noreply.github.com
f766f32dadaf143b20fa7360a8ff36d87fb10367
c9e80ad1e112975629a0b3121f582bce0674ed77
/java/messaging/messaging-common/src/test/java/io/joynr/common/ExpiryDateUtilsTest.java
efb6aed0e6fa0c33fb550a992c3314ec47352af2
[ "Apache-2.0" ]
permissive
bmwcarit/joynr
5aac1602f129dc1d24312d79ac03c461cf125e56
87071d67af9e09ed4df48612de6e6f966c3491fc
refs/heads/master
2023-08-17T14:58:40.755743
2023-06-12T11:36:49
2023-06-12T11:36:49
13,447,706
187
75
Apache-2.0
2023-02-28T04:19:45
2013-10-09T16:36:30
Java
UTF-8
Java
false
false
1,560
java
/* * #%L * %% * Copyright (C) 2022 BMW Car IT GmbH * %% * 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. * #L% */ package io.joynr.common; import static org.junit.Assert.assertEquals; import org.junit.Test; public class ExpiryDateUtilsTest { @Test public void addAndLimitHappyPass() { assertEquals(30, ExpiryDateUtils.addAndLimit(10, 20)); } @Test public void addAndLimitReturnMaxAllowedValueIfOverflowOccurs() { assertEquals(ExpiryDateUtils.MAX_JS_INT, ExpiryDateUtils.addAndLimit(Long.MAX_VALUE - 10, 20)); } @Test public void addAndLimitReturnMaxAllowedValueIfSumExceedsIt() { assertEquals(ExpiryDateUtils.MAX_JS_INT, ExpiryDateUtils.addAndLimit(ExpiryDateUtils.MAX_JS_INT - 10, 20)); } @Test public void subtractHappyPass() { assertEquals(10, ExpiryDateUtils.subtract(30, 20)); } @Test public void subtractReturnsMinAllowedValueIffOverflowOccurs() { assertEquals(Long.MIN_VALUE, ExpiryDateUtils.subtract(Long.MIN_VALUE + 10, 20)); } }
[ "Dmytro.Baranov@partner.bmw.de" ]
Dmytro.Baranov@partner.bmw.de
76eb65191ea64933e689a7b6175c3404ef41adb9
c899358582158395a8b84439b51e9e1f0f987067
/ExampleFrame_06.java
8af8a3adc0ca0c8b71c0d8fa70242ca7ede111d2
[]
no_license
DingJiaying/JAVA_study
e49d182736a350405ec3d3e34220c21f7c333219
1587cd669f2229923a082b0559fd1f3323630d45
refs/heads/master
2021-01-20T22:51:41.149348
2017-09-25T14:08:13
2017-09-25T14:08:13
101,826,210
0
0
null
null
null
null
GB18030
Java
false
false
2,498
java
package demo20; /** * 练习弹出式菜单 * @author ding * */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ExampleFrame_06 extends JFrame{ public static void main(String args[]) { ExampleFrame_06 frame = new ExampleFrame_06(); frame.setVisible(true); } public ExampleFrame_06() { super(); setTitle("创建弹出式菜单"); setBounds(100, 100, 500, 375); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel label = new JLabel(); label.setText(" 请在窗口中单击鼠标右键!"); getContentPane().add(label, BorderLayout.CENTER); final JPopupMenu popupMenu = new JPopupMenu();// 创建弹出式菜单对象 // 为窗体的顶层容器添加鼠标事件监听器 getContentPane().addMouseListener(new MouseAdapter() { // 鼠标按键被释放时触发该方法 public void mouseReleased(MouseEvent e) { // 判断此次鼠标事件是否为该组件的弹出菜单触发事件 // 如果是则在释放鼠标的位置弹出菜单 if (e.isPopupTrigger()) popupMenu.show(e.getComponent(), e.getX(), e.getY()); } }); final JMenuItem cutItem = new JMenuItem("剪切"); cutItem.addActionListener(new ItemListener()); popupMenu.add(cutItem); final JMenuItem copyItem = new JMenuItem("复制"); copyItem.addActionListener(new ItemListener()); popupMenu.add(copyItem); final JMenuItem pastItem = new JMenuItem("粘贴"); pastItem.addActionListener(new ItemListener()); popupMenu.add(pastItem); final JMenu editMenu = new JMenu("编辑"); popupMenu.add(editMenu); final JMenuItem readItem = new JMenuItem("只读"); readItem.addActionListener(new ItemListener()); editMenu.add(readItem); final JMenuItem writeItem = new JMenuItem("可写"); writeItem.addActionListener(new ItemListener()); editMenu.add(writeItem); final JMenu fontMenu = new JMenu("字体"); editMenu.add(fontMenu); final JMenuItem boldfacedItem = new JMenuItem("加粗"); boldfacedItem.addActionListener(new ItemListener()); fontMenu.add(boldfacedItem); final JMenuItem italicItem = new JMenuItem("斜体"); italicItem.addActionListener(new ItemListener()); fontMenu.add(italicItem); // } private class ItemListener implements ActionListener { public void actionPerformed(ActionEvent e) { JMenuItem menuItem = (JMenuItem) e.getSource(); System.out.println("您单击的是菜单项:" + menuItem.getText()); } } }
[ "18305186709@163.com" ]
18305186709@163.com
9103f6e44cf2ea6a39d841f8314f00ada44c054e
bf23ab45f8011f7fda2abd68bc2e9e05e8551f25
/src/main/java/jp/co/systena/tigerscave/springtestdb/model/display/Warrior.java
f95944fbc45172f0a4ecfafbb516ce4a0ca6ac1a
[]
no_license
AdachiTaro/webjava_3
8389f1d7c0037999ce876a0db97bbdf75bd036ae
b7883603526e00b55ba47b75984a37dce89f2fb7
refs/heads/master
2021-01-05T17:02:34.416576
2020-03-08T14:17:13
2020-03-08T14:17:13
241,083,599
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package jp.co.systena.tigerscave.springtestdb.model.display; public class Warrior extends Job { // 戦士クラス @Override public String fight() { return "剣で攻撃した!"; } @Override public String heal() { return "やくそうで回復した!"; } }
[ "adachita@systena.co.jp" ]
adachita@systena.co.jp
f7c10adcb335b55f40809fd7ae4461ef05689495
279579f1683817446ddc18d4dccdc47b2aec028f
/src/uk/co/codefreak/rhythmmachine/object/Item.java
25f71c3d5faaab03fc1f95580da68a0afaf21c77
[]
no_license
BasketBandit/RhythmMachine
0d52912bdb2f1d6079f9594730df793b7ba47e3d
7e7a38643503873ceee7c6b3de62cb54db5aa9db
refs/heads/master
2021-09-05T22:29:07.935533
2018-01-31T11:12:34
2018-01-31T11:12:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package uk.co.codefreak.rhythmmachine.object; public class Item extends Entity { public static final Item KEY = new Item("key", 'k'); public Item() { } public Item(String name, char character) { setName(name); setCharacter(character); } public String toString() { return super.toString(); } }
[ "errorsfound@hotmail.co.jp" ]
errorsfound@hotmail.co.jp
87cad1d80b21d6f7ed47f025dca6bf40a8cb276a
29bc408e28386e1b317f61467a046c8f992849f1
/app/src/main/java/com/lisheny/mytab/widget/CommonTitle.java
844e30a3a16b649abdde742d07bcab683d799c0a
[ "Apache-2.0" ]
permissive
lisheny/MySimeple
a126e317b9a68a79ed02e385e2fcb94ee9a59c21
fb59af65f0d7e6bd00156fce1196bb4a2c906a0f
refs/heads/master
2021-01-23T11:04:39.177747
2017-08-07T02:21:37
2017-08-07T02:21:37
93,123,074
0
0
null
null
null
null
UTF-8
Java
false
false
1,575
java
package com.lisheny.mytab.widget; import android.app.Activity; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.lisheny.mytab.R; /** * <pre> *     author : lisheny *     e-mail : 1020044519@qq.com *     time   : 2017/04/07 *     desc   : 复用标题 *     version: 1.0 * </pre> */ public class CommonTitle extends LinearLayout { private TextView commonTitle; private ImageView btnBack; /** * 设置标题 * @param title */ public void setTitle(String title) { commonTitle.setText(title); } /** * 隐藏返回图标 * @param isGone */ public void setGone(boolean isGone){ if (isGone){ btnBack.setVisibility(GONE); }else { btnBack.setVisibility(VISIBLE); } } public CommonTitle(Context context) { super(context); } public CommonTitle(Context context, AttributeSet attrs) { super(context, attrs); LayoutInflater.from(context).inflate(R.layout.common_title, this); btnBack = (ImageView)findViewById(R.id.btn_back); commonTitle = (TextView)findViewById(R.id.common_title); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ((Activity)getContext()).finish(); } }); } }
[ "18875910364@136.com" ]
18875910364@136.com
11a73a0dd40704492cfc94b4ff5bd90d1985edf1
93153876e19770df0fd5d6efc62302a67ebb0052
/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/squid/DsmSerializer.java
ac364fd0607f3c6835759108d42002b5365270f8
[]
no_license
cotsog/sonar-cxx
dcda5702753c2f645a42353b9fa01f7cf662e4af
7671d6c48c1df53a0eda1834a946e336a4edf648
refs/heads/master
2021-01-09T07:47:45.942521
2014-12-08T08:48:28
2014-12-08T08:48:28
67,249,663
0
0
null
2016-09-02T19:34:21
2016-09-02T19:34:21
null
UTF-8
Java
false
false
2,895
java
/* * Sonar C++ Plugin (Community) * Copyright (C) 2010 Neticoa SAS France * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ package org.sonar.plugins.cxx.squid; import org.sonar.api.design.Dependency; import org.sonar.api.resources.Resource; import org.sonar.graph.Dsm; import org.sonar.graph.DsmCell; import org.sonar.graph.Edge; import java.util.HashMap; /** * Created by fferrand on 12/06/14. */ public class DsmSerializer { private Dsm<? extends Resource> dsm; HashMap<Edge, Dependency> dependencyIndex; private StringBuilder json; DsmSerializer(Dsm<? extends Resource> dsm, HashMap<Edge, Dependency> dependencyIndex) { this.dsm = dsm; this.dependencyIndex = dependencyIndex; this.json = new StringBuilder(); } private String serialize() { json.append('['); serializeRows(); json.append(']'); return json.toString(); } private void serializeRows() { for (int y = 0; y < dsm.getDimension(); y++) { if (y > 0) { json.append(','); } serializeRow(y); } } private void serializeRow(int y) { Resource sonarResource = dsm.getVertex(y); json.append("{"); if (sonarResource != null) { json.append("\"i\":"); json.append(sonarResource.getId()); json.append(",\"n\":\""); json.append(sonarResource.getName()); json.append("\",\"q\":\""); json.append(sonarResource.getQualifier()); json.append("\",\"v\":["); for (int x = 0; x < dsm.getDimension(); x++) { if (x > 0) { json.append(','); } serializeCell(y, x); } json.append("]"); } json.append("}"); } private void serializeCell(int y, int x) { DsmCell cell = dsm.getCell(x, y); json.append('{'); if (cell.getEdge() != null && cell.getWeight() > 0) { json.append("\"i\":"); json.append(dependencyIndex.get(cell.getEdge()).getId()); json.append(",\"w\":"); json.append(cell.getWeight()); } json.append('}'); } public static String serialize(Dsm<? extends Resource> dsm, HashMap<Edge, Dependency> dependencyIndex) { return new DsmSerializer(dsm, dependencyIndex).serialize(); } }
[ "thetypz@gmail.com" ]
thetypz@gmail.com
bd373ce00e28d31090215a5595a614116fc58aa9
9881d3848827cbf52796d3d5772628585cfacf71
/5_Java Programming Build a Recommendation System/Week4_Weighted Averages/StepOneStarterProgram/MovieRunnerSimilarRatings.java
c70b1d5d00fb1c40b82fc13b9693df8f4e7864f9
[ "MIT" ]
permissive
LegendaryKim/Coursera_Java_Programming_and_Software_Engineering_Fundamentals_Specialization
1774a473084a90876ba9868c9b80011803a51baf
832468e6d0ca428d8e8b755a3ad4c71687368227
refs/heads/master
2022-01-05T16:23:01.566215
2019-08-16T02:00:42
2019-08-16T02:00:42
198,266,817
0
0
null
null
null
null
UTF-8
Java
false
false
8,449
java
/** * Write a description of MovieRunnerSimilarRatings here. * * @author (your name) * @version (a version number or a date) */ import java.util.*; public class MovieRunnerSimilarRatings { private String moviesFilename; private String ratersFilename; public MovieRunnerSimilarRatings() { moviesFilename = "ratedmoviesfull.csv"; ratersFilename = "ratings.csv"; } public void printAverageRatings() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of movies and their average ratings int minimalRaters = 1; ArrayList<Rating> aveRatings = fRatings.getAverageRatings(minimalRaters); System.out.println("found " + aveRatings.size() + " movies"); Collections.sort(aveRatings); for (Rating rating: aveRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } public void printAverageRatingsByYearAfterAndGenre() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of filtered movies and their average ratings int minimalRaters = 1; String genre = "Romance"; YearAfterFilter yearFilter = new YearAfterFilter(1980); GenreFilter genreFilter = new GenreFilter(genre); AllFilters allFilters = new AllFilters(); allFilters.addFilter(yearFilter); allFilters.addFilter(genreFilter); ArrayList<Rating> aveRatings = fRatings.getAverageRatingsByFilter(minimalRaters, allFilters); System.out.println("found " + aveRatings.size() + " movies"); Collections.sort(aveRatings); for (Rating rating: aveRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getYear(rating.getItem()) + " " + MovieDatabase.getTitle(rating.getItem())); System.out.println("\t" + MovieDatabase.getGenres(rating.getItem())); } } public void printSimilarRatings() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); int minimalRaters = 5; int numSimilarRaters = 20; String raterID = "71"; ArrayList<Rating> similarRatings = fRatings.getSimilarRatings(raterID, numSimilarRaters, minimalRaters); System.out.println("similarRatings size: " + similarRatings.size()); for (Rating rating: similarRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } public void printSimilarRatingsByGenre() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of filtered movies and their average ratings int minimalRaters = 5; int numSimilarRaters = 20; String raterID = "964"; String genre = "Mystery"; GenreFilter genreFilter = new GenreFilter(genre); ArrayList<Rating> similarRatings = fRatings.getSimilarRatingsByFilters(raterID, numSimilarRaters, minimalRaters, genreFilter); System.out.println("similarRatings size: " + similarRatings.size()); for (Rating rating: similarRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } public void printSimilarRatingsByDirector() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of filtered movies and their average ratings int minimalRaters = 2; int numSimilarRaters = 10; String raterID = "120"; String directrors = "Clint Eastwood,J.J. Abrams,Alfred Hitchcock,Sydney Pollack,David Cronenberg,Oliver Stone,Mike Leigh"; DirectorsFilter directorsFilter = new DirectorsFilter(directrors); ArrayList<Rating> similarRatings = fRatings.getSimilarRatingsByFilters(raterID, numSimilarRaters, minimalRaters, directorsFilter); System.out.println("similarRatings size: " + similarRatings.size()); for (Rating rating: similarRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } public void printSimilarRatingsByGenreAndMinutes() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of filtered movies and their average ratings int minimalRaters = 3; int numSimilarRaters = 10; String raterID = "168"; String genre = "Drama"; GenreFilter genreFilter = new GenreFilter(genre); int minMinutes = 80; int maxMinutes = 160; MinutesFilter minutesFilter = new MinutesFilter(minMinutes, maxMinutes); AllFilters allFilters = new AllFilters(); allFilters.addFilter(genreFilter); allFilters.addFilter(minutesFilter); ArrayList<Rating> similarRatings = fRatings.getSimilarRatingsByFilters(raterID, numSimilarRaters, minimalRaters, allFilters); System.out.println("similarRatings size: " + similarRatings.size()); for (Rating rating: similarRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } public void printSimilarRatingsByYearAfterAndMinutes() { FourthRatings fRatings = new FourthRatings(); MovieDatabase.initialize(moviesFilename); RaterDatabase.initialize(ratersFilename); System.out.println("number of movies: " + MovieDatabase.size()); System.out.println("number of raters: " + RaterDatabase.size()); // print a list of filtered movies and their average ratings int minimalRaters = 5; int numSimilarRaters = 10; String raterID = "314"; int yearAfter = 1975; YearAfterFilter yearFilter = new YearAfterFilter(yearAfter); int minMinutes = 70; int maxMinutes = 200; MinutesFilter minutesFilter = new MinutesFilter(minMinutes, maxMinutes); AllFilters allFilters = new AllFilters(); allFilters.addFilter(yearFilter); allFilters.addFilter(minutesFilter); ArrayList<Rating> similarRatings = fRatings.getSimilarRatingsByFilters(raterID, numSimilarRaters, minimalRaters, allFilters); System.out.println("similarRatings size: " + similarRatings.size()); for (Rating rating: similarRatings) { System.out.println(rating.getValue() + " " + MovieDatabase.getTitle(rating.getItem())); } } }
[ "khwanpy1@jhu.edu" ]
khwanpy1@jhu.edu
a2f77a321ad3bcf3f326d2287608751e1d827aba
9bfd6349899f737a397ebba27b40986baf5f3d8d
/minitheatre-cdi/src/main/java/org/jboss/errai/demo/mobile/client/local/OrientationDetector.java
cb13e089a61f5becca6d648edbf19a5d968498aa
[]
no_license
csadilek/j1-demos
81c8089647e646406ec4efbf4e23038546107fa6
dc82a5a2476ff4f9a35959ab0ff874972677bd25
refs/heads/master
2021-01-19T12:31:06.305821
2013-05-29T15:35:00
2013-05-29T15:35:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,616
java
package org.jboss.errai.demo.mobile.client.local; import javax.enterprise.event.Event; import org.jboss.errai.demo.mobile.client.shared.OrientationEvent; public abstract class OrientationDetector { /** * Don't try to fire a CDI OrientationEvent event more than once every 250ms. * <p> * TODO we should remove this once the bus supports coalescing events! */ private long minEventInterval = 175; /** * The time we last fired an OrientationEvent. * <p> * TODO we should remove this once the bus supports coalescing events! */ private long lastEventFireTime; protected Event<OrientationEvent> orientationEventSource; /** * Should be set by the main application when the username is set or updated. */ private String clientId = "Anonymous"; /** * Stops the periodic firing of CDI OrientationEvents. If this detector was * already in the stopped state, calling this method has no effect. */ public abstract void stopFiringOrientationEvents(); /** * Starts the periodic firing of CDI OrientationEvents. If this detector was * already in the started state, calling this method has no effect. */ public abstract void startFiringOrientationEvents(); /** * Fires an {@link OrientationEvent} with the given parameters. This method is * meant to be called by the browser-specific logic that detects the device * orientation. */ protected void fireOrientationEvent(double x, double y, double z) { long now = System.currentTimeMillis(); if (now - lastEventFireTime < minEventInterval) { return; } lastEventFireTime = now; orientationEventSource.fire(new OrientationEvent(clientId, x, y, z)); } /** * The provider class that creates the detector calls this method to give us a * means of firing the event. */ void setOrientationEventSource(Event<OrientationEvent> orientationEventSource) { this.orientationEventSource = orientationEventSource; } /** * Sets the client ID (user name) that should be included with all orientation * events fired. * * @param clientId The client ID to use. Not null. */ public void setClientId(String clientId) { if (clientId == null) throw new NullPointerException(); this.clientId = clientId; } /** * Returns true if this detector can be started. Some detectors (for example, * PhoneGap) need to wait for subsystems to start before they can begin firing * orientation events. * <p> * TODO: we won't need this when client code can participate in Errai VoteForInit. */ public abstract boolean isReady(); }
[ "jfuerth@gmail.com" ]
jfuerth@gmail.com
7bd90d931a706730eb15453069d7ba36aa848f01
4ad17f7216a2838f6cfecf77e216a8a882ad7093
/clbs/src/main/java/com/zw/lkyw/controller/realtimeMonitor/LkywRealTimeMonitoringController.java
3cb7b0f26d1e65bc05e54e2ce346c89d147a6ff8
[ "MIT" ]
permissive
djingwu/hybrid-development
b3c5eed36331fe1f404042b1e1900a3c6a6948e5
784c5227a73d1e6609b701a42ef4cdfd6400d2b7
refs/heads/main
2023-08-06T22:34:07.359495
2021-09-29T02:10:11
2021-09-29T02:10:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,424
java
package com.zw.lkyw.controller.realtimeMonitor; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.zw.adas.utils.controller.AdasControllerTemplate; import com.zw.lkyw.domain.LocationForLkyw; import com.zw.lkyw.domain.SendMsgBasicInfo; import com.zw.lkyw.domain.SendMsgDetail; import com.zw.lkyw.domain.SendMsgMonitorInfo; import com.zw.lkyw.service.realTimeMonitoring.LkywRealTimeMonitoringService; import com.zw.lkyw.utils.sendMsgCache.SendMsgCache; import com.zw.platform.basic.dto.query.MonitorTreeReq; import com.zw.platform.basic.service.F3MessageService; import com.zw.platform.basic.service.MonitorTreeService; import com.zw.platform.basic.service.UserService; import com.zw.platform.commons.Auth; import com.zw.platform.commons.SystemHelper; import com.zw.platform.domain.enmu.ProtocolEnum; import com.zw.platform.service.realTimeVideo.RealTimeVideoService; import com.zw.platform.util.common.JsonResultBean; import com.zw.platform.util.common.ZipUtil; import com.zw.platform.util.spring.InitData; import com.zw.ws.entity.vehicle.VehiclePositionalInfo; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.util.Arrays; 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.Set; import java.util.stream.Collectors; @Controller @RequestMapping("/lkyw/v/monitoring") public class LkywRealTimeMonitoringController { /** * log日志记录 */ private static Logger log = LogManager.getLogger(LkywRealTimeMonitoringController.class); private static final String INDEX_PAGE = "vas/lkyw/monitoring/realTimeMonitoring"; private static final String SEND_TEXT_BY_BATCH_PAGE = "vas/lkyw/monitoring/batchSendTxtByRealTimeMonitoring"; @Autowired private LkywRealTimeMonitoringService lkywRealTimeMonitoringService; @Autowired private SendMsgCache sendMsgCache; @Autowired private RealTimeVideoService realTimeVideoService; @Autowired private InitData initData; @Value("${sys.error.msg}") private String sysErrorMsg; @Autowired private F3MessageService f3MessageService; @Autowired private UserService userService; @Autowired private MonitorTreeService monitorTreeService; @Value("${video.findlog.flag:true}") private boolean logFindFlag; @Auth @RequestMapping(value = { "/list" }, method = RequestMethod.GET) public ModelAndView index(String id) { ModelAndView mv = new ModelAndView(INDEX_PAGE); mv.addObject("logFlag", logFindFlag); mv.addObject("jumpId", id); return mv; } /** * 获取实时监控-全部车辆列表信息 * @param monitorIds 可视范围车辆id,逗号隔开(此参数为空时查询当前用户权限下所有监控对象状态信息) * @param userName 当前用户名 */ @RequestMapping(value = "/monitors", method = RequestMethod.POST) @ResponseBody public JsonResultBean getMonitorsLocation(String monitorIds, String userName) { try { Set<String> monitorIdSet; if (StringUtils.isBlank(monitorIds)) { monitorIdSet = userService.getMonitorIdsByUser(userName); } else { monitorIdSet = new HashSet<>(); Collections.addAll(monitorIdSet, monitorIds.split(",")); } // 此处通过调用新方法,实现中间结果(DTO列表)GC不可达,从而允许释放内存 final String resultStr = this.getLkywCacheLocationStr(monitorIdSet); return new JsonResultBean(ZipUtil.compress(resultStr)); } catch (Exception e) { e.printStackTrace(); return new JsonResultBean(JsonResultBean.FAULT); } } /** * 单独抽离是因为本方法可能耗费大量内存,序列化并返回后使大对象立即可被回收 */ private String getLkywCacheLocationStr(Collection<String> monitorIds) { return JSON.toJSONString(f3MessageService.getLkywCacheLocation(monitorIds, false)); } /** * 获取监控对象气泡信息 * @param monitorId * @return */ @RequestMapping(value = "/getMonitorBubble", method = RequestMethod.POST) @ResponseBody public JsonResultBean getMonitorBubble(String monitorId) { try { List<LocationForLkyw> locationForLkyws = f3MessageService.getLkywCacheLocation(Collections.singletonList(monitorId), true); LocationForLkyw result = locationForLkyws.isEmpty() ? null : locationForLkyws.get(0); return new JsonResultBean(result); } catch (Exception e) { e.printStackTrace(); return new JsonResultBean(JsonResultBean.FAULT); } } /** * 获取地图打点位置信息 * @param monitorIds 可视范围内监控对象ID * @return */ @ResponseBody @RequestMapping(value = "/getVehiclePositional", method = RequestMethod.POST) public JsonResultBean getVehiclePositional(String monitorIds) { try { if (StringUtils.isNotBlank(monitorIds)) { initData.updateVehiclePositional(monitorIds); } final List<VehiclePositionalInfo> vehiclePosInfos = userService.getCurrentUserMonitorIds().stream().map(InitData.vehiclePositionalInfo::get) .filter(Objects::nonNull).collect(Collectors.toList()); return new JsonResultBean(vehiclePosInfos); } catch (Exception e) { log.error("获取车辆位置信息失败", e); return new JsonResultBean(JsonResultBean.FAULT, "获取车辆位置信息失败"); } } @RequestMapping(value = { "/getUerReportMenu" }, method = RequestMethod.POST) @ResponseBody public JsonResultBean getUerReportMenu() { return AdasControllerTemplate .getResultBean(() -> lkywRealTimeMonitoringService.getUerReportMenu(), "查询用户两客一危报表菜单异常!"); } @RequestMapping(value = { "/putMsg" }, method = RequestMethod.POST) @ResponseBody public JsonResultBean putMsg(String monitorId, String monitorName, String groupName, String msgContent, Integer isUrgent, String playType, Integer sendType) { Long sendTime = System.currentTimeMillis(); String sendUserName = SystemHelper.getCurrentUsername(); return AdasControllerTemplate.getResultBean(() -> { SendMsgMonitorInfo monitorInfo = SendMsgMonitorInfo.getInstance(monitorId, monitorName, groupName); monitorInfo.assembelVehicleInfo(2, "其他车辆"); SendMsgBasicInfo sendMsgBasicInfo = SendMsgBasicInfo.getInstance(msgContent, isUrgent, playType, sendType, sendUserName, sendTime); SendMsgDetail sendMsg = SendMsgDetail.getSendMsg(monitorInfo, sendMsgBasicInfo); sendMsgCache.putMsgCache(sendMsg); }, "查询用户两客一危报表菜单异常!"); } @RequestMapping(value = { "/putStoreMsg" }, method = RequestMethod.POST) @ResponseBody public JsonResultBean putStoreMsg(String monitorId, String monitorName, String groupName, String msgContent, Integer isUrgent, String playType, Integer sendType) { Long sendTime = System.currentTimeMillis(); String sendUserName = SystemHelper.getCurrentUsername(); return AdasControllerTemplate.getResultBean(() -> { SendMsgMonitorInfo monitorInfo = SendMsgMonitorInfo.getInstance(monitorId, monitorName, groupName); monitorInfo.assembelVehicleInfo(2, "其他车辆"); SendMsgBasicInfo sendMsgBasicInfo = SendMsgBasicInfo.getInstance(msgContent, isUrgent, playType, sendType, sendUserName, sendTime); sendMsgBasicInfo.assembleSendResult(1, "终端离线"); SendMsgDetail sendMsg = SendMsgDetail.getSendMsg(monitorInfo, sendMsgBasicInfo); sendMsgCache.putStoreCache(sendMsg); }, "查询用户两客一危报表菜单异常!"); } @RequestMapping(value = { "/getSendMsgCacheInfo" }, method = RequestMethod.POST) @ResponseBody public JsonResultBean getSendMsgCacheInfo() { return AdasControllerTemplate.getResultBean(() -> sendMsgCache.getSendCacheInfo(), "查询用户两客一危报表菜单异常!"); } /** * 批量下发文本页面(实时监控页面) */ @RequestMapping(value = { "/getRealTimeMonitoringSendTextByBatchPage_{deviceType}" }, method = RequestMethod.GET) public ModelAndView getSendTextByBatchPage(@PathVariable("deviceType") String deviceType) { ModelAndView modelAndView = new ModelAndView(SEND_TEXT_BY_BATCH_PAGE); modelAndView.addObject("deviceType", deviceType); return modelAndView; } /** * 获得下发文本信息状态列表 */ @RequestMapping(value = { "/getSendTextStatusList" }, method = RequestMethod.POST) @ResponseBody public JsonResultBean getSendTextStatusList(String vehicleIds) { try { return realTimeVideoService.getSendTextStatusList(vehicleIds); } catch (Exception e) { log.error("获得下发文本信息状态列表异常", e); return new JsonResultBean(JsonResultBean.FAULT); } } /** * 查询报警记录 * @param latestTime 列表中最新的时间 * @param latestAlarmDataStr 列表中报警时间为最新时间的报警数据(监控对象id|报警类型|报警时间(毫秒),监控对象id|报警类型|报警时间(毫秒)) * @param oldestTime 列表中最老的时间 * @param oldestAlarmDataStr 列表中报警时间为最老时间的报警数据(监控对象id|报警类型|报警时间(毫秒),监控对象id|报警类型|报警时间(毫秒)) * @param alarmTypeStr 报警类型逗号分隔(不传就是查询所有需要展示的报警类型) * @param mark 页签标识 */ @RequestMapping(value = "/getTodayAlarmRecord", method = RequestMethod.POST) @ResponseBody public JsonResultBean getTodayAlarmRecord(String latestTime, String latestAlarmDataStr, String oldestTime, String oldestAlarmDataStr, String alarmTypeStr, String mark) { try { return lkywRealTimeMonitoringService .getTodayAlarmRecord(latestTime, latestAlarmDataStr, oldestTime, oldestAlarmDataStr, alarmTypeStr, mark); } catch (Exception e) { log.error("查询报警记录异常", e); return new JsonResultBean(JsonResultBean.FAULT, sysErrorMsg); } } /** * 查询当天报警次数 */ @RequestMapping(value = "/getTodayAlarmQuantity", method = RequestMethod.POST) @ResponseBody public JsonResultBean getTodayAlarmQuantity() { try { return lkywRealTimeMonitoringService.getTodayAlarmQuantity(); } catch (Exception e) { log.error("查询当天报警次数异常", e); return new JsonResultBean(JsonResultBean.FAULT, sysErrorMsg); } } /** * 进入页面初始化需要查询报警的监控对象id */ @RequestMapping(value = "/initNeedQueryAlarmMonitorIds", method = RequestMethod.POST) @ResponseBody public JsonResultBean initNeedQueryAlarmMonitorIds() { try { lkywRealTimeMonitoringService.initNeedQueryAlarmMonitorIds(); return new JsonResultBean(); } catch (Exception e) { log.error("初始化需要查询报警的监控对象id异常", e); return new JsonResultBean(JsonResultBean.FAULT, sysErrorMsg); } } /** * 根据组织id查询车辆(组装成树节点的格式) * @param groupId 企业ID * @return 分组-分组下的监控对象树集合Map */ @RequestMapping(value = "/putMonitorByGroup", method = RequestMethod.POST) @ResponseBody public JsonResultBean putMonitorByGroup(String groupId, boolean isChecked, String monitorType, String deviceType, Integer status) { try { MonitorTreeReq treeReq = new MonitorTreeReq(); treeReq.setChecked(isChecked); treeReq.setMonitorType(monitorType); if (StringUtils.isNotBlank(deviceType) && Objects.equals(monitorType, "vehicle")) { List<String> deviceTypes; if (Objects.equals(deviceType, String.valueOf(ProtocolEnum.ONE))) { deviceTypes = Arrays.asList(ProtocolEnum.PROTOCOL_TYPE_808_2011_2013_STR); } else { deviceTypes = Arrays.asList(ProtocolEnum.PROTOCOL_TYPE_808_2019_STR); } treeReq.setDeviceTypes(deviceTypes); } treeReq.setStatus(status); JSONArray treeNodes = monitorTreeService.getByOrgDn(groupId, treeReq); return new JsonResultBean(getGroupMonitorTreeMap(treeNodes)); } catch (Exception e) { log.error("获取车辆树信息异常", e); return null; } } private Map<String, JSONArray> getGroupMonitorTreeMap(JSONArray monitorTreeNodes) { Map<String, JSONArray> result = new HashMap<>(16); for (Object item : monitorTreeNodes) { JSONObject treeNode = (JSONObject) item; String assignmentId = treeNode.getString("pId"); JSONArray groupMonitors = result.getOrDefault(treeNode.getString("pId"), new JSONArray()); groupMonitors.add(treeNode); result.put(assignmentId, groupMonitors); } return result; } }
[ "wuxuetao@zwlbs.com" ]
wuxuetao@zwlbs.com
aca560d1b7e7702cdd5433096ac1c3fa7acbea19
679028129338a82f011d7ccd45f5e3daa93d0c9c
/taa-eurodollar-beans/EurosDollars/EurosDollars.Beans/src/test/java/org/EurosDollars/Beans/AppTest.java
4efee41998e15837c850f13a891b9e871e6f0e68
[]
no_license
npaolita/ISTIC_M2GL
69d317dfc3e76b235aeb359d0b37bf983a1786c3
a0aa993b00bedc5d2d04455e0ba8d4093c1e624b
refs/heads/master
2021-01-20T04:04:37.221445
2013-04-18T17:03:12
2013-04-18T17:03:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package org.EurosDollars.Beans; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "xiorcal@gmail.com" ]
xiorcal@gmail.com
ec6844a907f537ce43c965e83cf835a293cd8025
84ef720050d4845d99051197d55768ba5d2d0d70
/src/main/java/com/storyboard/proxy/SkippingModListProxy.java
9c193701a19da8e6faf3d4d48f29c86ea15073a7
[]
no_license
storycraft/mod-protector
aa78492fab9bc2c11468fa52b52507533fb41f36
f42933a97aa8661aae2cf3b4dfd32489db0ea766
refs/heads/master
2020-11-29T09:14:49.343106
2019-12-25T09:34:06
2019-12-25T09:34:06
230,078,227
2
0
null
null
null
null
UTF-8
Java
false
false
977
java
package com.storyboard.proxy; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.storyboard.ModProtector; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; public class SkippingModListProxy implements IModListProxy { private ModProtector mod; public SkippingModListProxy(ModProtector mod) { this.mod = mod; } @Override public List<ModContainer> getModList() { List<ModContainer> list = new ArrayList<>(); Iterator<ModContainer> modIter = Loader.instance().getModList().iterator(); while (modIter.hasNext()) { ModContainer container = modIter.next(); if ("mod-protector".equals(container.getModId())) { continue; } list.add(container); System.out.println("allow acessing " + container.getModId() + " to server"); } return list; } }
[ "storycraft@storyboard.ml" ]
storycraft@storyboard.ml
ed486ced0cab1d8e3d6bd5359e76693d4704447f
bd2139703c556050403c10857bde66f688cd9ee6
/valhalla/55/webrev.00/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java
53873a64eb1ee0082a45ef8575018c102ce3a661
[]
no_license
isabella232/cr-archive
d03427e6fbc708403dd5882d36371e1b660ec1ac
8a3c9ddcfacb32d1a65d7ca084921478362ec2d1
refs/heads/master
2023-02-01T17:33:44.383410
2020-12-17T13:47:48
2020-12-17T13:47:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
73,486
java
/* * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package compiler.valhalla.valuetypes; import jdk.test.lib.Asserts; import java.lang.invoke.*; import java.lang.reflect.Method; import java.util.Arrays; /* * @test * @summary Test value type arrays * @library /testlibrary /test/lib /compiler/whitebox / * @requires (os.simpleArch == "x64" | os.simpleArch == "aarch64") * @compile TestArrays.java * @run driver ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.Platform * @run main/othervm/timeout=300 -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions * -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI * compiler.valhalla.valuetypes.ValueTypeTest * compiler.valhalla.valuetypes.TestArrays */ public class TestArrays extends ValueTypeTest { // Unlike C2, C1 intrinsics never deoptimize System.arraycopy. Instead, we fall back to // a normal method invocation when encountering flattened arrays. private static void assertDeoptimizedByC2(Method m) { int CompLevel_none = 0, // Interpreter CompLevel_simple = 1, // C1 CompLevel_limited_profile = 2, // C1, invocation & backedge counters CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo CompLevel_full_optimization = 4; // C2 or JVMCI if (USE_COMPILER && !XCOMP && !STRESS_CC && WHITE_BOX.isMethodCompiled(m, false) && WHITE_BOX.getMethodCompilationLevel(m, false) >= CompLevel_full_optimization) { throw new RuntimeException("Type check should have caused it to deoptimize"); } } // Extra VM parameters for some test scenarios. See ValueTypeTest.getVMParameters() @Override public String[] getExtraVMParameters(int scenario) { switch (scenario) { case 2: return new String[] {"-XX:-MonomorphicArrayCheck", "-XX:-UncommonNullCast", "-XX:+StressArrayCopyMacroNode"}; case 3: return new String[] {"-XX:-MonomorphicArrayCheck", "-XX:ValueArrayElemMaxFlatSize=-1", "-XX:-UncommonNullCast"}; case 4: return new String[] {"-XX:-MonomorphicArrayCheck", "-XX:-UncommonNullCast"}; case 5: return new String[] {"-XX:-MonomorphicArrayCheck", "-XX:-UncommonNullCast", "-XX:+StressArrayCopyMacroNode"}; } return null; } public static void main(String[] args) throws Throwable { TestArrays test = new TestArrays(); test.run(args, MyValue1.class, MyValue2.class, MyValue2Inline.class); } // Helper methods protected long hash() { return hash(rI, rL); } protected long hash(int x, long y) { return MyValue1.createWithFieldsInline(x, y).hash(); } // Test value type array creation and initialization @Test(valid = ValueTypeArrayFlattenOn, match = { ALLOCA }, matchCount = { 1 }) @Test(valid = ValueTypeArrayFlattenOff, match = { ALLOCA }, matchCount = { 1 }, failOn = LOAD) public MyValue1[] test1(int len) { MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); } return va; } @DontCompile public void test1_verifier(boolean warmup) { int len = Math.abs(rI % 10); MyValue1[] va = test1(len); for (int i = 0; i < len; ++i) { Asserts.assertEQ(va[i].hash(), hash()); } } // Test creation of a value type array and element access // TODO 8227588 @Test(valid = ValueTypeArrayFlattenOn, failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) @Test(valid = ValueTypeArrayFlattenOff) public long test2() { MyValue1[] va = new MyValue1[1]; va[0] = MyValue1.createWithFieldsInline(rI, rL); return va[0].hash(); } @DontCompile public void test2_verifier(boolean warmup) { long result = test2(); Asserts.assertEQ(result, hash()); } // Test receiving a value type array from the interpreter, // updating its elements in a loop and computing a hash. @Test(failOn = ALLOCA) public long test3(MyValue1[] va) { long result = 0; for (int i = 0; i < 10; ++i) { result += va[i].hash(); va[i] = MyValue1.createWithFieldsInline(rI + 1, rL + 1); } return result; } @DontCompile public void test3_verifier(boolean warmup) { MyValue1[] va = new MyValue1[10]; long expected = 0; for (int i = 0; i < 10; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL + i); expected += va[i].hash(); } long result = test3(va); Asserts.assertEQ(expected, result); for (int i = 0; i < 10; ++i) { if (va[i].hash() != hash(rI + 1, rL + 1)) { Asserts.assertEQ(va[i].hash(), hash(rI + 1, rL + 1)); } } } // Test returning a value type array received from the interpreter @Test(failOn = ALLOC + ALLOCA + LOAD + STORE + LOOP + TRAP) public MyValue1[] test4(MyValue1[] va) { return va; } @DontCompile public void test4_verifier(boolean warmup) { MyValue1[] va = new MyValue1[10]; for (int i = 0; i < 10; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL + i); } va = test4(va); for (int i = 0; i < 10; ++i) { Asserts.assertEQ(va[i].hash(), hash(rI + i, rL + i)); } } // Merge value type arrays created from two branches @Test public MyValue1[] test5(boolean b) { MyValue1[] va; if (b) { va = new MyValue1[5]; for (int i = 0; i < 5; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } } else { va = new MyValue1[10]; for (int i = 0; i < 10; ++i) { va[i] = MyValue1.createWithFieldsInline(rI + i, rL + i); } } long sum = va[0].hashInterpreted(); if (b) { va[0] = MyValue1.createWithFieldsDontInline(rI, sum); } else { va[0] = MyValue1.createWithFieldsDontInline(rI + 1, sum + 1); } return va; } @DontCompile public void test5_verifier(boolean warmup) { MyValue1[] va = test5(true); Asserts.assertEQ(va.length, 5); Asserts.assertEQ(va[0].hash(), hash(rI, hash())); for (int i = 1; i < 5; ++i) { Asserts.assertEQ(va[i].hash(), hash()); } va = test5(false); Asserts.assertEQ(va.length, 10); Asserts.assertEQ(va[0].hash(), hash(rI + 1, hash(rI, rL) + 1)); for (int i = 1; i < 10; ++i) { Asserts.assertEQ(va[i].hash(), hash(rI + i, rL + i)); } } // Test creation of value type array with single element @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) public MyValue1 test6() { MyValue1[] va = new MyValue1[1]; return va[0]; } @DontCompile public void test6_verifier(boolean warmup) { MyValue1[] va = new MyValue1[1]; MyValue1 v = test6(); Asserts.assertEQ(v.hashPrimitive(), va[0].hashPrimitive()); } // Test default initialization of value type arrays @Test(failOn = LOAD) public MyValue1[] test7(int len) { return new MyValue1[len]; } @DontCompile public void test7_verifier(boolean warmup) { int len = Math.abs(rI % 10); MyValue1[] va = new MyValue1[len]; MyValue1[] var = test7(len); for (int i = 0; i < len; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // Test creation of value type array with zero length @Test(failOn = ALLOC + LOAD + STORE + LOOP + TRAP) public MyValue1[] test8() { return new MyValue1[0]; } @DontCompile public void test8_verifier(boolean warmup) { MyValue1[] va = test8(); Asserts.assertEQ(va.length, 0); } static MyValue1[] test9_va; // Test that value type array loaded from field has correct type @Test(failOn = LOOP) public long test9() { return test9_va[0].hash(); } @DontCompile public void test9_verifier(boolean warmup) { test9_va = new MyValue1[1]; test9_va[0] = MyValue1.createWithFieldsInline(rI, rL); long result = test9(); Asserts.assertEQ(result, hash()); } // Multi-dimensional arrays @Test public MyValue1[][][] test10(int len1, int len2, int len3) { MyValue1[][][] arr = new MyValue1[len1][len2][len3]; for (int i = 0; i < len1; i++) { for (int j = 0; j < len2; j++) { for (int k = 0; k < len3; k++) { arr[i][j][k] = MyValue1.createWithFieldsDontInline(rI + i , rL + j + k); } } } return arr; } @DontCompile public void test10_verifier(boolean warmup) { MyValue1[][][] arr = test10(2, 3, 4); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { Asserts.assertEQ(arr[i][j][k].hash(), MyValue1.createWithFieldsDontInline(rI + i , rL + j + k).hash()); } } } } @Test public void test11(MyValue1[][][] arr, long[] res) { int l = 0; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { for (int k = 0; k < arr[i][j].length; k++) { res[l] = arr[i][j][k].hash(); l++; } } } } @DontCompile public void test11_verifier(boolean warmup) { MyValue1[][][] arr = new MyValue1[2][3][4]; long[] res = new long[2*3*4]; long[] verif = new long[2*3*4]; int l = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { arr[i][j][k] = MyValue1.createWithFieldsDontInline(rI + i, rL + j + k); verif[l] = arr[i][j][k].hash(); l++; } } } test11(arr, res); for (int i = 0; i < verif.length; i++) { Asserts.assertEQ(res[i], verif[i]); } } // Array load out of bounds (upper bound) at compile time @Test public int test12() { int arraySize = Math.abs(rI) % 10;; MyValue1[] va = new MyValue1[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + 1, rL); } try { return va[arraySize + 1].x; } catch (ArrayIndexOutOfBoundsException e) { return rI; } } public void test12_verifier(boolean warmup) { Asserts.assertEQ(test12(), rI); } // Array load out of bounds (lower bound) at compile time @Test public int test13() { int arraySize = Math.abs(rI) % 10;; MyValue1[] va = new MyValue1[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL); } try { return va[-arraySize].x; } catch (ArrayIndexOutOfBoundsException e) { return rI; } } public void test13_verifier(boolean warmup) { Asserts.assertEQ(test13(), rI); } // Array load out of bound not known to compiler (both lower and upper bound) @Test public int test14(MyValue1[] va, int index) { return va[index].x; } public void test14_verifier(boolean warmup) { int arraySize = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); } int result; for (int i = -20; i < 20; i++) { try { result = test14(va, i); } catch (ArrayIndexOutOfBoundsException e) { result = rI; } Asserts.assertEQ(result, rI); } } // Array store out of bounds (upper bound) at compile time @Test public int test15() { int arraySize = Math.abs(rI) % 10;; MyValue1[] va = new MyValue1[arraySize]; try { for (int i = 0; i <= arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + 1, rL); } return rI - 1; } catch (ArrayIndexOutOfBoundsException e) { return rI; } } public void test15_verifier(boolean warmup) { Asserts.assertEQ(test15(), rI); } // Array store out of bounds (lower bound) at compile time @Test public int test16() { int arraySize = Math.abs(rI) % 10;; MyValue1[] va = new MyValue1[arraySize]; try { for (int i = -1; i <= arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + 1, rL); } return rI - 1; } catch (ArrayIndexOutOfBoundsException e) { return rI; } } public void test16_verifier(boolean warmup) { Asserts.assertEQ(test16(), rI); } // Array store out of bound not known to compiler (both lower and upper bound) @Test public int test17(MyValue1[] va, int index, MyValue1 vt) { va[index] = vt; return va[index].x; } @DontCompile public void test17_verifier(boolean warmup) { int arraySize = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); } MyValue1 vt = MyValue1.createWithFieldsDontInline(rI + 1, rL); int result; for (int i = -20; i < 20; i++) { try { result = test17(va, i, vt); } catch (ArrayIndexOutOfBoundsException e) { result = rI + 1; } Asserts.assertEQ(result, rI + 1); } for (int i = 0; i < arraySize; i++) { Asserts.assertEQ(va[i].x, rI + 1); } } // clone() as stub call @Test public MyValue1[] test18(MyValue1[] va) { return va.clone(); } @DontCompile public void test18_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = test18(va); for (int i = 0; i < len; ++i) { Asserts.assertEQ(result[i].hash(), va[i].hash()); } } // clone() as series of loads/stores static MyValue1[] test19_orig = null; @Test public MyValue1[] test19() { MyValue1[] va = new MyValue1[8]; for (int i = 0; i < va.length; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } test19_orig = va; return va.clone(); } @DontCompile public void test19_verifier(boolean warmup) { MyValue1[] result = test19(); for (int i = 0; i < test19_orig.length; ++i) { Asserts.assertEQ(result[i].hash(), test19_orig[i].hash()); } } // arraycopy() of value type array with oop fields @Test public void test20(MyValue1[] src, MyValue1[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test20_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] src = new MyValue1[len]; MyValue1[] dst = new MyValue1[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test20(src, dst); for (int i = 0; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // arraycopy() of value type array with no oop field @Test public void test21(MyValue2[] src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test21_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue2[] src = new MyValue2[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test21(src, dst); for (int i = 0; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // arraycopy() of value type array with oop field and tightly // coupled allocation as dest @Test public MyValue1[] test22(MyValue1[] src) { MyValue1[] dst = new MyValue1[src.length]; System.arraycopy(src, 0, dst, 0, src.length); return dst; } @DontCompile public void test22_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] src = new MyValue1[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] dst = test22(src); for (int i = 0; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // arraycopy() of value type array with oop fields and tightly // coupled allocation as dest @Test public MyValue1[] test23(MyValue1[] src) { MyValue1[] dst = new MyValue1[src.length + 10]; System.arraycopy(src, 0, dst, 5, src.length); return dst; } @DontCompile public void test23_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] src = new MyValue1[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] dst = test23(src); for (int i = 5; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // arraycopy() of value type array passed as Object @Test public void test24(MyValue1[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test24_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] src = new MyValue1[len]; MyValue1[] dst = new MyValue1[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test24(src, dst); for (int i = 0; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // short arraycopy() with no oop field @Test public void test25(MyValue2[] src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test25_verifier(boolean warmup) { MyValue2[] src = new MyValue2[8]; MyValue2[] dst = new MyValue2[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test25(src, dst); for (int i = 0; i < 8; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // short arraycopy() with oop fields @Test public void test26(MyValue1[] src, MyValue1[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test26_verifier(boolean warmup) { MyValue1[] src = new MyValue1[8]; MyValue1[] dst = new MyValue1[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test26(src, dst); for (int i = 0; i < 8; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } // short arraycopy() with oop fields and offsets @Test public void test27(MyValue1[] src, MyValue1[] dst) { System.arraycopy(src, 1, dst, 2, 6); } @DontCompile public void test27_verifier(boolean warmup) { MyValue1[] src = new MyValue1[8]; MyValue1[] dst = new MyValue1[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test27(src, dst); for (int i = 2; i < 8; ++i) { Asserts.assertEQ(src[i-1].hash(), dst[i].hash()); } } // non escaping allocations // TODO ZGC does not support the clone intrinsic, remove this once JDK-8232896 is fixed @Test(valid = ZGCOff, failOn = ALLOCA + LOOP + LOAD + TRAP) @Test(valid = ZGCOn) public MyValue2 test28() { MyValue2[] src = new MyValue2[10]; src[0] = MyValue2.createWithFieldsInline(rI, false); MyValue2[] dst = (MyValue2[])src.clone(); return dst[0]; } @DontCompile public void test28_verifier(boolean warmup) { MyValue2 v = MyValue2.createWithFieldsInline(rI, false); MyValue2 result = test28(); Asserts.assertEQ(result.hash(), v.hash()); } // non escaping allocations // TODO 8227588: shouldn't this have the same IR matching rules as test6? @Test(valid = ValueTypeArrayFlattenOn, failOn = ALLOCA + LOOP + LOAD + TRAP) @Test(valid = ValueTypeArrayFlattenOff) public MyValue2 test29(MyValue2[] src) { MyValue2[] dst = new MyValue2[10]; System.arraycopy(src, 0, dst, 0, 10); return dst[0]; } @DontCompile public void test29_verifier(boolean warmup) { MyValue2[] src = new MyValue2[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } MyValue2 v = test29(src); Asserts.assertEQ(src[0].hash(), v.hash()); } // non escaping allocation with uncommon trap that needs // eliminated value type array element as debug info @Test @Warmup(10000) public MyValue2 test30(MyValue2[] src, boolean flag) { MyValue2[] dst = new MyValue2[10]; System.arraycopy(src, 0, dst, 0, 10); if (flag) { } return dst[0]; } @DontCompile public void test30_verifier(boolean warmup) { MyValue2[] src = new MyValue2[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } MyValue2 v = test30(src, !warmup); Asserts.assertEQ(src[0].hash(), v.hash()); } // non escaping allocation with memory phi // TODO 8227588 @Test(valid = ValueTypeArrayFlattenOn, failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) @Test(valid = ValueTypeArrayFlattenOff) public long test31(boolean b, boolean deopt) { MyValue2[] src = new MyValue2[1]; if (b) { src[0] = MyValue2.createWithFieldsInline(rI, true); } else { src[0] = MyValue2.createWithFieldsInline(rI, false); } if (deopt) { // uncommon trap WHITE_BOX.deoptimizeMethod(tests.get(getClass().getSimpleName() + "::test31")); } return src[0].hash(); } @DontCompile public void test31_verifier(boolean warmup) { MyValue2 v1 = MyValue2.createWithFieldsInline(rI, true); long result1 = test31(true, !warmup); Asserts.assertEQ(result1, v1.hash()); MyValue2 v2 = MyValue2.createWithFieldsInline(rI, false); long result2 = test31(false, !warmup); Asserts.assertEQ(result2, v2.hash()); } // Tests with Object arrays and clone/arraycopy // clone() as stub call @Test public Object[] test32(Object[] va) { return va.clone(); } @DontCompile public void test32_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = (MyValue1[])test32(va); for (int i = 0; i < len; ++i) { Asserts.assertEQ(((MyValue1)result[i]).hash(), ((MyValue1)va[i]).hash()); } } @Test public Object[] test33(Object[] va) { return va.clone(); } @DontCompile public void test33_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] va = new Object[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } Object[] result = test33(va); for (int i = 0; i < len; ++i) { Asserts.assertEQ(((MyValue1)result[i]).hash(), ((MyValue1)va[i]).hash()); // Check that array has correct storage properties (null-ok) result[i] = null; } } // clone() as series of loads/stores static Object[] test34_orig = null; @ForceInline public Object[] test34_helper(boolean flag) { Object[] va = null; if (flag) { va = new MyValue1[8]; for (int i = 0; i < va.length; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); } } else { va = new Object[8]; } return va; } @Test public Object[] test34(boolean flag) { Object[] va = test34_helper(flag); test34_orig = va; return va.clone(); } @DontCompile public void test34_verifier(boolean warmup) { test34(false); for (int i = 0; i < 10; i++) { // make sure we do deopt Object[] result = test34(true); verify(test34_orig, result); // Check that array has correct storage properties (null-free) try { result[0] = null; throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test34")) { Object[] result = test34(true); verify(test34_orig, result); // Check that array has correct storage properties (null-free) try { result[0] = null; throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } static void verify(Object[] src, Object[] dst) { for (int i = 0; i < src.length; ++i) { Asserts.assertEQ(((MyInterface)src[i]).hash(), ((MyInterface)dst[i]).hash()); } } static void verify(MyValue1[] src, MyValue1[] dst) { for (int i = 0; i < src.length; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } static void verify(MyValue1[] src, Object[] dst) { for (int i = 0; i < src.length; ++i) { Asserts.assertEQ(src[i].hash(), ((MyInterface)dst[i]).hash()); } } static void verify(MyValue2[] src, MyValue2[] dst) { for (int i = 0; i < src.length; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } static void verify(MyValue2[] src, Object[] dst) { for (int i = 0; i < src.length; ++i) { Asserts.assertEQ(src[i].hash(), ((MyInterface)dst[i]).hash()); } } static boolean compile_and_run_again_if_deoptimized(boolean warmup, String test) { if (!warmup) { Method m = tests.get(test); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false)) { if (!ValueTypeArrayFlatten && !XCOMP && !STRESS_CC) { throw new RuntimeException("Unexpected deoptimization"); } enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); return true; } } return false; } // arraycopy() of value type array of unknown size @Test public void test35(Object src, Object dst, int len) { System.arraycopy(src, 0, dst, 0, len); } @DontCompile public void test35_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] src = new MyValue1[len]; MyValue1[] dst = new MyValue1[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test35(src, dst, src.length); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test35")) { test35(src, dst, src.length); verify(src, dst); } } @Test public void test36(Object src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, dst.length); } @DontCompile public void test36_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue2[] src = new MyValue2[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test36(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test36")) { test36(src, dst); verify(src, dst); } } @Test public void test37(MyValue2[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test37_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue2[] src = new MyValue2[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test37(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test37")) { test37(src, dst); verify(src, dst); } } @Test @Warmup(1) // Avoid early compilation public void test38(Object src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, dst.length); } @DontCompile public void test38_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] src = new Object[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test38(src, dst); verify(dst, src); if (!warmup) { Method m = tests.get("TestArrays::test38"); assertDeoptimizedByC2(m); enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); test38(src, dst); verify(dst, src); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } @Test public void test39(MyValue2[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test39_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue2[] src = new MyValue2[len]; Object[] dst = new Object[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test39(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test39")) { test39(src, dst); verify(src, dst); } } @Test @Warmup(1) // Avoid early compilation public void test40(Object[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test40_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] src = new Object[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test40(src, dst); verify(dst, src); if (!warmup) { Method m = tests.get("TestArrays::test40"); assertDeoptimizedByC2(m); enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); test40(src, dst); verify(dst, src); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } @Test public void test41(Object src, Object[] dst) { System.arraycopy(src, 0, dst, 0, dst.length); } @DontCompile public void test41_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue2[] src = new MyValue2[len]; Object[] dst = new Object[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test41(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test41")) { test41(src, dst); verify(src, dst); } } @Test public void test42(Object[] src, Object[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test42_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] src = new Object[len]; Object[] dst = new Object[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test42(src, dst); verify(src, dst); if (!warmup) { Method m = tests.get("TestArrays::test42"); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } // short arraycopy()'s @Test public void test43(Object src, Object dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test43_verifier(boolean warmup) { MyValue1[] src = new MyValue1[8]; MyValue1[] dst = new MyValue1[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue1.createWithFieldsInline(rI, rL); } test43(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test43")) { test43(src, dst); verify(src, dst); } } @Test public void test44(Object src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test44_verifier(boolean warmup) { MyValue2[] src = new MyValue2[8]; MyValue2[] dst = new MyValue2[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test44(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test44")) { test44(src, dst); verify(src, dst); } } @Test public void test45(MyValue2[] src, Object dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test45_verifier(boolean warmup) { MyValue2[] src = new MyValue2[8]; MyValue2[] dst = new MyValue2[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test45(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test45")) { test45(src, dst); verify(src, dst); } } @Test @Warmup(1) // Avoid early compilation public void test46(Object[] src, MyValue2[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test46_verifier(boolean warmup) { Object[] src = new Object[8]; MyValue2[] dst = new MyValue2[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test46(src, dst); verify(dst, src); if (!warmup) { Method m = tests.get("TestArrays::test46"); assertDeoptimizedByC2(m); enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); test46(src, dst); verify(dst, src); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } @Test public void test47(MyValue2[] src, Object[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test47_verifier(boolean warmup) { MyValue2[] src = new MyValue2[8]; Object[] dst = new Object[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test47(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test47")) { test47(src, dst); verify(src, dst); } } @Test @Warmup(1) // Avoid early compilation public void test48(Object[] src, Object dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test48_verifier(boolean warmup) { Object[] src = new Object[8]; MyValue2[] dst = new MyValue2[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test48(src, dst); verify(dst, src); if (!warmup) { Method m = tests.get("TestArrays::test48"); assertDeoptimizedByC2(m); enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); test48(src, dst); verify(dst, src); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } @Test public void test49(Object src, Object[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test49_verifier(boolean warmup) { MyValue2[] src = new MyValue2[8]; Object[] dst = new Object[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test49(src, dst); verify(src, dst); if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test49")) { test49(src, dst); verify(src, dst); } } @Test public void test50(Object[] src, Object[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test50_verifier(boolean warmup) { Object[] src = new Object[8]; Object[] dst = new Object[8]; for (int i = 0; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } test50(src, dst); verify(src, dst); if (!warmup) { Method m = tests.get("TestArrays::test50"); if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) { throw new RuntimeException("unexpected deoptimization"); } } } @Test public MyValue1[] test51(MyValue1[] va) { // TODO Remove cast as workaround once javac is fixed return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile public void test51_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = test51(va); verify(va, result); } static final MyValue1[] test52_va = new MyValue1[8]; @Test public MyValue1[] test52() { // TODO Remove cast as workaround once javac is fixed return (MyValue1[])Arrays.copyOf(test52_va, 8, MyValue1[].class); } @DontCompile public void test52_verifier(boolean warmup) { for (int i = 0; i < 8; ++i) { test52_va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = test52(); verify(test52_va, result); } @Test public MyValue1[] test53(Object[] va) { // TODO Remove cast as workaround once javac is fixed return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile public void test53_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = test53(va); verify(result, va); } @Test public Object[] test54(MyValue1[] va) { return Arrays.copyOf(va, va.length, Object[].class); } @DontCompile public void test54_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } Object[] result = test54(va); verify(va, result); } @Test public Object[] test55(Object[] va) { return Arrays.copyOf(va, va.length, Object[].class); } @DontCompile public void test55_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } Object[] result = test55(va); verify(va, result); } @Test public MyValue1[] test56(Object[] va) { // TODO Remove cast as workaround once javac is fixed return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile public void test56_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] va = new Object[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } MyValue1[] result = test56(va); verify(result, va); } @Test public Object[] test57(Object[] va, Class klass) { return Arrays.copyOf(va, va.length, klass); } @DontCompile public void test57_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } Object[] result = test57(va, MyValue1[].class); verify(va, result); } @Test public Object[] test58(MyValue1[] va, Class klass) { return Arrays.copyOf(va, va.length, klass); } @DontCompile public void test58_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } for (int i = 0; i < 10; i++) { Object[] result = test58(va, MyValue1[].class); verify(va, result); } if (compile_and_run_again_if_deoptimized(warmup, "TestArrays::test58")) { Object[] result = test58(va, MyValue1[].class); verify(va, result); } } @Test public Object[] test59(MyValue1[] va) { return Arrays.copyOf(va, va.length+1, MyValue1[].class); } @DontCompile public void test59_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; MyValue1[] verif = new MyValue1[len+1]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); verif[i] = va[i]; } Object[] result = test59(va); verify(verif, result); } @Test public Object[] test60(Object[] va, Class klass) { return Arrays.copyOf(va, va.length+1, klass); } @DontCompile public void test60_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; MyValue1[] verif = new MyValue1[len+1]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); verif[i] = (MyValue1)va[i]; } Object[] result = test60(va, MyValue1[].class); verify(verif, result); } @Test public Object[] test61(Object[] va, Class klass) { return Arrays.copyOf(va, va.length+1, klass); } @DontCompile public void test61_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] va = new Integer[len]; for (int i = 0; i < len; ++i) { va[i] = new Integer(rI); } Object[] result = test61(va, Integer[].class); for (int i = 0; i < va.length; ++i) { Asserts.assertEQ(va[i], result[i]); } } @ForceInline public Object[] test62_helper(int i, MyValue1[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = oa; } else { arr = va; } return arr; } @Test public Object[] test62(MyValue1[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); Object[] arr = test62_helper(i, va, oa); return Arrays.copyOf(arr, arr.length+1, arr.getClass()); } @DontCompile public void test62_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; Integer[] oa = new Integer[len]; for (int i = 0; i < len; ++i) { oa[i] = new Integer(rI); } test62_helper(42, va, oa); Object[] result = test62(va, oa); for (int i = 0; i < va.length; ++i) { Asserts.assertEQ(oa[i], result[i]); } } @ForceInline public Object[] test63_helper(int i, MyValue1[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = va; } else { arr = oa; } return arr; } @Test public Object[] test63(MyValue1[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); Object[] arr = test63_helper(i, va, oa); return Arrays.copyOf(arr, arr.length+1, arr.getClass()); } @DontCompile public void test63_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; MyValue1[] verif = new MyValue1[len+1]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); verif[i] = va[i]; } Integer[] oa = new Integer[len]; test63_helper(42, va, oa); Object[] result = test63(va, oa); verify(verif, result); } // Test default initialization of value type arrays: small array @Test public MyValue1[] test64() { return new MyValue1[8]; } @DontCompile public void test64_verifier(boolean warmup) { MyValue1[] va = new MyValue1[8]; MyValue1[] var = test64(); for (int i = 0; i < 8; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // Test default initialization of value type arrays: large array @Test public MyValue1[] test65() { return new MyValue1[32]; } @DontCompile public void test65_verifier(boolean warmup) { MyValue1[] va = new MyValue1[32]; MyValue1[] var = test65(); for (int i = 0; i < 32; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // Check init store elimination @Test(match = { ALLOCA }, matchCount = { 1 }) public MyValue1[] test66(MyValue1 vt) { MyValue1[] va = new MyValue1[1]; va[0] = vt; return va; } @DontCompile public void test66_verifier(boolean warmup) { MyValue1 vt = MyValue1.createWithFieldsDontInline(rI, rL); MyValue1[] va = test66(vt); Asserts.assertEQ(va[0].hashPrimitive(), vt.hashPrimitive()); } // Zeroing elimination and arraycopy @Test public MyValue1[] test67(MyValue1[] src) { MyValue1[] dst = new MyValue1[16]; System.arraycopy(src, 0, dst, 0, 13); return dst; } @DontCompile public void test67_verifier(boolean warmup) { MyValue1[] va = new MyValue1[16]; MyValue1[] var = test67(va); for (int i = 0; i < 16; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // A store with a default value can be eliminated @Test public MyValue1[] test68() { MyValue1[] va = new MyValue1[2]; va[0] = va[1]; return va; } @DontCompile public void test68_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; MyValue1[] var = test68(); for (int i = 0; i < 2; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // Requires individual stores to init array @Test public MyValue1[] test69(MyValue1 vt) { MyValue1[] va = new MyValue1[4]; va[0] = vt; va[3] = vt; return va; } @DontCompile public void test69_verifier(boolean warmup) { MyValue1 vt = MyValue1.createWithFieldsDontInline(rI, rL); MyValue1[] va = new MyValue1[4]; va[0] = vt; va[3] = vt; MyValue1[] var = test69(vt); for (int i = 0; i < va.length; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // A store with a default value can be eliminated: same as test68 // but store is farther away from allocation @Test public MyValue1[] test70(MyValue1[] other) { other[1] = other[0]; MyValue1[] va = new MyValue1[2]; other[0] = va[1]; va[0] = va[1]; return va; } @DontCompile public void test70_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; MyValue1[] var = test70(va); for (int i = 0; i < 2; ++i) { Asserts.assertEQ(va[i].hashPrimitive(), var[i].hashPrimitive()); } } // EA needs to consider oop fields in flattened arrays @Test public void test71() { int len = 10; MyValue2[] src = new MyValue2[len]; MyValue2[] dst = new MyValue2[len]; for (int i = 0; i < len; ++i) { src[i] = MyValue2.createWithFieldsDontInline(rI, (i % 2) == 0); } System.arraycopy(src, 0, dst, 0, src.length); for (int i = 0; i < len; ++i) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); } } @DontCompile public void test71_verifier(boolean warmup) { test71(); } // Test EA with leaf call to 'store_unknown_value' @Test public void test72(Object[] o, boolean b, Object element) { Object[] arr1 = new Object[10]; Object[] arr2 = new Object[10]; if (b) { arr1 = o; } arr1[0] = element; arr2[0] = element; } @DontCompile public void test72_verifier(boolean warmup) { Object[] arr = new Object[1]; Object elem = new Object(); test72(arr, true, elem); test72(arr, false, elem); } @Test public void test73(Object[] oa, MyValue1 v, Object o) { // TestLWorld.test38 use a C1 Phi node for the array. This test // adds the case where the stored value is a C1 Phi node. Object o2 = (o == null) ? v : o; oa[0] = v; // The stored value is known to be flattenable oa[1] = o; // The stored value may be flattenable oa[2] = o2; // The stored value may be flattenable (a C1 Phi node) oa[0] = oa; // The stored value is known to be not flattenable (an Object[]) } @DontCompile public void test73_verifier(boolean warmup) { MyValue1 v0 = MyValue1.createWithFieldsDontInline(rI, rL); MyValue1 v1 = MyValue1.createWithFieldsDontInline(rI+1, rL+1); MyValue1[] arr = new MyValue1[3]; try { test73(arr, v0, v1); throw new RuntimeException("ArrayStoreException expected"); } catch (ArrayStoreException t) { // expected } Asserts.assertEQ(arr[0].hash(), v0.hash()); Asserts.assertEQ(arr[1].hash(), v1.hash()); Asserts.assertEQ(arr[2].hash(), v1.hash()); } public static void test74Callee(MyValue1[] va) { } // Tests invoking unloaded method with value array in signature @Test @Warmup(0) public void test74(MethodHandle m, MyValue1[] va) throws Throwable { m.invoke(va); } @DontCompile public void test74_verifier(boolean warmup) throws Throwable { MethodHandle m = MethodHandles.lookup().findStatic(TestArrays.class, "test74Callee", MethodType.methodType(void.class, MyValue1[].class)); MyValue1[] va = new MyValue1[0]; test74(m, va); } // Some more array clone tests @ForceInline public Object[] test75_helper(int i, MyValue1[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = oa; } else { arr = va; } return arr; } @Test public Object[] test75(MyValue1[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); Object[] arr = test75_helper(i, va, oa); return arr.clone(); } @DontCompile public void test75_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; Integer[] oa = new Integer[len]; for (int i = 0; i < len; ++i) { oa[i] = new Integer(rI); } test75_helper(42, va, oa); Object[] result = test75(va, oa); for (int i = 0; i < va.length; ++i) { Asserts.assertEQ(oa[i], result[i]); // Check that array has correct storage properties (null-ok) result[i] = null; } } @ForceInline public Object[] test76_helper(int i, MyValue1[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = va; } else { arr = oa; } return arr; } @Test public Object[] test76(MyValue1[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); Object[] arr = test76_helper(i, va, oa); return arr.clone(); } @DontCompile public void test76_verifier(boolean warmup) { int len = Math.abs(rI) % 10; MyValue1[] va = new MyValue1[len]; MyValue1[] verif = new MyValue1[len]; for (int i = 0; i < len; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); verif[i] = va[i]; } Integer[] oa = new Integer[len]; test76_helper(42, va, oa); Object[] result = test76(va, oa); verify(verif, result); // Check that array has correct storage properties (null-free) if (len > 0) { try { result[0] = null; throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } @Test public void test77() { MyValue1 v0 = MyValue1.createWithFieldsDontInline(rI, rL); MyValue1 v1 = MyValue1.createWithFieldsDontInline(rI+1, rL+1); MyValue1[] arr = new MyValue1[1]; Object[] oa = arr; Object o1 = v1; Object o = (o1 == null) ? v0 : o1; oa[0] = o; // For C1, due to IfOp optimization, the declared_type of o becomes NULL. Asserts.assertEQ(arr[0].hash(), v1.hash()); } @DontCompile public void test77_verifier(boolean warmup) { test77(); } @Test public long test78(MyValue1 v, int n) { long x = 0; for (int i = 0; i<n; i++) { } MyValue1[] a = new MyValue1[n]; a[0] = v; for (int i = 0; i<n; i++) { x += a[i].hash(); // C1 PhiSimplifier changes "a" from a Phi node to a NewObjectArray node } return x; } @DontCompile public void test78_verifier(boolean warmup) { MyValue1 v = MyValue1.createWithFieldsInline(rI, rL); Asserts.assertEQ(test78(v, 1), v.hash()); } // Verify that casting an array element to a non-flattenable type marks the array as not-flat @Test(valid = ValueTypeArrayFlattenOn, match = { ALLOC_G, LOAD_UNKNOWN_VALUE }, matchCount = { 1, 1 }) @Test(valid = ValueTypeArrayFlattenOff, failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE) public Object test79(Object[] array, int i) { Integer i1 = (Integer)array[0]; Object o = array[1]; return array[i]; } @DontCompile public void test79_verifier(boolean warmup) { Integer i = new Integer(rI); Integer[] array = new Integer[2]; array[1] = i; Object result = test79(array, 1); Asserts.assertEquals(result, i); } inline static class NotFlattenable { private final Object o1 = null; private final Object o2 = null; private final Object o3 = null; private final Object o4 = null; private final Object o5 = null; private final Object o6 = null; } // Same as test79 but with not-flattenable inline type @Test(valid = ValueTypeArrayFlattenOn, match = { ALLOC_G, LOAD_UNKNOWN_VALUE }, matchCount = { 1, 1 }) @Test(valid = ValueTypeArrayFlattenOff, failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE) public Object test80(Object[] array, int i) { NotFlattenable vt = (NotFlattenable)array[0]; Object o = array[1]; return array[i]; } @DontCompile public void test80_verifier(boolean warmup) { NotFlattenable vt = new NotFlattenable(); NotFlattenable[] array = new NotFlattenable[2]; array[1] = vt; Object result = test80(array, 1); Asserts.assertEquals(result, vt); } // Verify that writing an object of a non-inline, non-null type to an array marks the array as not-null-free and not-flat @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE + VALUE_ARRAY_NULL_GUARD) public Object test81(Object[] array, Integer v, Object o, int i) { if (v == null) { return null; } array[0] = v; array[1] = array[0]; array[2] = o; return array[i]; } @DontCompile public void test81_verifier(boolean warmup) { Integer i = new Integer(rI); Integer[] array1 = new Integer[3]; Object[] array2 = new Object[3]; Object result = test81(array1, i, i, 0); Asserts.assertEquals(array1[0], i); Asserts.assertEquals(array1[1], i); Asserts.assertEquals(array1[2], i); Asserts.assertEquals(result, i); result = test81(array2, i, i, 1); Asserts.assertEquals(array2[0], i); Asserts.assertEquals(array2[1], i); Asserts.assertEquals(array2[2], i); Asserts.assertEquals(result, i); } // Verify that writing an object of a non-flattenable inline type to an array marks the array as not-flat @Test(valid = ValueTypePassFieldsAsArgsOn, failOn = ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE) @Test(valid = ValueTypePassFieldsAsArgsOff, failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE) public Object test82(Object[] array, NotFlattenable vt, Object o, int i) { array[0] = vt; array[1] = array[0]; array[2] = o; return array[i]; } @DontCompile public void test82_verifier(boolean warmup) { NotFlattenable vt = new NotFlattenable(); NotFlattenable[] array1 = new NotFlattenable[3]; Object[] array2 = new Object[3]; Object result = test82(array1, vt, vt, 0); Asserts.assertEquals(array1[0], vt); Asserts.assertEquals(array1[1], vt); Asserts.assertEquals(array1[2], vt); Asserts.assertEquals(result, vt); result = test82(array2, vt, vt, 1); Asserts.assertEquals(array2[0], vt); Asserts.assertEquals(array2[1], vt); Asserts.assertEquals(array2[2], vt); Asserts.assertEquals(result, vt); } // Verify that casting an array element to a non-inline type type marks the array as not-null-free and not-flat @Test(valid = ValueTypeArrayFlattenOn, match = { ALLOC_G, LOAD_UNKNOWN_VALUE }, matchCount = { 1, 1 }, failOn = ALLOCA_G + STORE_UNKNOWN_VALUE + VALUE_ARRAY_NULL_GUARD) @Test(valid = ValueTypeArrayFlattenOff, failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE + VALUE_ARRAY_NULL_GUARD) public void test83(Object[] array, Object o) { Integer i = (Integer)array[0]; array[1] = o; } @DontCompile public void test83_verifier(boolean warmup) { Integer i = new Integer(rI); Integer[] array1 = new Integer[2]; Object[] array2 = new Object[2]; test83(array1, i); Asserts.assertEquals(array1[1], i); test83(array2, null); Asserts.assertEquals(array2[1], null); } // Verify that writing constant null into an array marks the array as not-null-free and not-flat @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 1 }) public Object test84(Object[] array, int i) { array[0] = null; array[1] = null; return array[i]; } @DontCompile public void test84_verifier(boolean warmup) { NotFlattenable.ref[] array1 = new NotFlattenable.ref[2]; Object[] array2 = new Object[2]; Object result = test84(array1, 0); Asserts.assertEquals(array1[0], null); Asserts.assertEquals(result, null); result = test84(array2, 1); Asserts.assertEquals(array2[0], null); Asserts.assertEquals(result, null); if (!warmup) { NotFlattenable[] array3 = new NotFlattenable[2]; try { test84(array3, 1); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } // Same as test84 but with branches @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 2 }) public void test85(Object[] array, Object o, boolean b) { if (b) { array[0] = null; } else { array[1] = null; } array[1] = o; } @DontCompile public void test85_verifier(boolean warmup) { Integer i = new Integer(rI); Integer[] array1 = new Integer[2]; Object[] array2 = new Object[2]; test85(array1, i, true); Asserts.assertEquals(array1[1], i); test85(array1, null, false); Asserts.assertEquals(array1[1], null); test85(array2, i, true); Asserts.assertEquals(array2[1], i); test85(array2, null, false); Asserts.assertEquals(array2[1], null); if (!warmup) { NotFlattenable[] array3 = new NotFlattenable[2]; try { test85(array3, null, true); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } // Same as test85 but with not-flattenable inline type array @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 2 }) public void test86(NotFlattenable.ref[] array, NotFlattenable.ref o, boolean b) { if (b) { array[0] = null; } else { array[1] = null; } array[1] = o; } @DontCompile public void test86_verifier(boolean warmup) { NotFlattenable vt = new NotFlattenable(); NotFlattenable.ref[] array1 = new NotFlattenable.ref[2]; test86(array1, vt, true); Asserts.assertEquals(array1[1], vt); test86(array1, null, false); Asserts.assertEquals(array1[1], null); if (!warmup) { NotFlattenable[] array2 = new NotFlattenable[2]; try { test86(array2, null, true); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } // Same as test85 but with inline type array @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 2 }) public void test87(MyValue1.ref[] array, MyValue1.ref o, boolean b) { if (b) { array[0] = null; } else { array[1] = null; } array[1] = o; } @DontCompile public void test87_verifier(boolean warmup) { MyValue1 vt = MyValue1.createWithFieldsInline(rI, rL); MyValue1.ref[] array1 = new MyValue1.ref[2]; test87(array1, vt, true); Asserts.assertEquals(array1[1], vt); test87(array1, null, false); Asserts.assertEquals(array1[1], null); if (!warmup) { MyValue1[] array2 = new MyValue1[2]; try { test87(array2, null, true); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } // Additional correctness tests to make sure we have the required null checks @Test() public void test88(Object[] array, Integer v) { array[0] = v; } @DontCompile public void test88_verifier(boolean warmup) { Integer[] array1 = new Integer[1]; Object[] array2 = new Object[1]; test88(array1, null); Asserts.assertEquals(array1[0], null); test88(array2, null); Asserts.assertEquals(array2[0], null); if (!warmup) { MyValue1[] array3 = new MyValue1[1]; try { test88(array3, null); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } @Test() public void test89(MyValue1.ref[] array, Integer v) { Object o = v; array[0] = (MyValue1.ref)o; } @DontCompile public void test89_verifier(boolean warmup) { MyValue1.ref[] array1 = new MyValue1.ref[1]; test89(array1, null); Asserts.assertEquals(array1[0], null); if (!warmup) { MyValue1[] array2 = new MyValue1[1]; try { test89(array2, null); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException e) { // Expected } } } @Test public boolean test90() { boolean b = true; MyValue1[] qArray = new MyValue1[0]; MyValue1.ref[] lArray = new MyValue1.ref[0]; b = b && (qArray instanceof MyValue1[]); b = b && (lArray instanceof MyValue1.ref[]); MyValue1[][] qArray2 = new MyValue1[0][0]; MyValue1.ref[][] lArray2 = new MyValue1.ref[0][0]; b = b && (qArray2 instanceof MyValue1[][]); b = b && (lArray2 instanceof MyValue1.ref[][]); return b; } @DontCompile public void test90_verifier(boolean warmup) { Asserts.assertEQ(test90(), true); } inline static final class Test91Value { public final int f0; public final int f1; public final int f2; public final int f3; public final int f4; public final int f5; public Test91Value(int i) { this.f0 = i; this.f1 = i; this.f2 = i; this.f3 = i; this.f4 = i; this.f5 = i; } public void verify() { if ((f0 != f1) || (f1 != f2) || (f2 != f3) || (f3 != f4) || (f4 != f5)) { throw new RuntimeException("test91 failed"); } } } // Test anti-dependencies between loads and stores from flattened array @Test @Warmup(0) public int test91(Test91Value[] array, int lo, int val) { int i = 3; while (lo < i) { Test91Value tmp = array[lo]; array[lo++] = array[i]; array[i--] = tmp; } return val; } @DontCompile public void test91_verifier(boolean warmup) { Test91Value[] array = new Test91Value[5]; for (int i = 0; i < 5; ++i) { array[i] = new Test91Value(i); array[i].verify(); } Asserts.assertEQ(test91(array, 0, 5), 5); for (int i = 0; i < 5; ++i) { array[i].verify(); } } @Test public void test92(Object[] src, Object[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test92_verifier(boolean warmup) { MyValue1[] a = new MyValue1[1]; MyValue1[] b = new MyValue1[1]; try { test92(a, null); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException expected) {} try { test92(null, b); throw new RuntimeException("Should throw NullPointerException"); } catch (NullPointerException expected) {} a[0] = MyValue1.createWithFieldsInline(rI, rL); test92(a, b); verify(a, b); } // Same as test30 but accessing all elements of the non-escaping array @Test public long test93(MyValue2[] src, boolean flag) { MyValue2[] dst = new MyValue2[10]; System.arraycopy(src, 0, dst, 0, 10); if (flag) { } return dst[0].hash() + dst[1].hash() + dst[2].hash() + dst[3].hash() + dst[4].hash() + dst[5].hash() + dst[6].hash() + dst[7].hash() + dst[8].hash() + dst[9].hash(); } @DontCompile public void test93_verifier(boolean warmup) { MyValue2[] src = new MyValue2[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (rI % 2) == 0); } long res = test93(src, !warmup); long expected = 0; for (int i = 0; i < 10; ++i) { expected += src[i].hash(); } Asserts.assertEQ(res, expected); } // Same as test93 but with variable source array offset @Test public long test94(MyValue2[] src, int i, boolean flag) { MyValue2[] dst = new MyValue2[10]; System.arraycopy(src, i, dst, 0, 1); if (flag) { } return dst[0].hash() + dst[1].hash() + dst[2].hash() + dst[3].hash() + dst[4].hash() + dst[5].hash() + dst[6].hash() + dst[7].hash() + dst[8].hash() + dst[9].hash(); } @DontCompile public void test94_verifier(boolean warmup) { MyValue2[] src = new MyValue2[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(i, (i % 2) == 0); } for (int i = 0; i < 10; ++i) { long res = test94(src, i, !warmup); long expected = src[i].hash() + 9*MyValue2.default.hash(); Asserts.assertEQ(res, expected); } } }
[ "robin.westberg@oracle.com" ]
robin.westberg@oracle.com
346c70d91c97c6de21f368b657659cc50c94a8fc
bdfb31707b9bee2b271393884770ff1a8d77d8b6
/src/com/majdtalji/krankenhaus/db/vo/UserDetailsVo.java
1560b0c19fe71c8a1930b8ae82907febf89fecdc
[]
no_license
Majd-Talji/JavaFX-Krankenhaus-System
1144e8520cdc6c7e6014de7745b7eb2b5e317c5d
b3bb73d4566146b7f2be9863418a1c3de2ad70a8
refs/heads/master
2022-07-06T13:47:36.196582
2020-05-12T09:03:34
2020-05-12T09:03:34
263,275,416
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
package com.majdtalji.krankenhaus.db.vo; /** * * @author Majd Talji <en.majd.talji@gmail.com> */ public class UserDetailsVo { // ID USER_ID FIRST_NAME FATHER_NAME MOBILE IMAGE SPECIALIZATION private int id; private UsersVo usersVo; private String firstName; private String fatheName; private String mobile; private byte[] image; private String specialization; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getFatheName() { return fatheName; } public void setFatheName(String fatheName) { this.fatheName = fatheName; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public UsersVo getUsersVo() { return usersVo; } public void setUsersVo(UsersVo usersVo) { this.usersVo = usersVo; } public byte[] getImage() { return image; } public void setImage(byte[] image) { this.image = image; } public String getSpecialization() { return specialization; } public void setSpecialization(String specialization) { this.specialization = specialization; } }
[ "53352101+Majd-Talji@users.noreply.github.com" ]
53352101+Majd-Talji@users.noreply.github.com
631b0f4fdfc8afe857d1b9be28ec19e3f47520d7
884d7ae645f150c50efdf04f544d9e85298811b4
/src/advancedresoucemenaging/interfaceClasses/CleanupToolTab.java
181b3f6ff7fd68b2dee26895b447d40bf7d9ba8f
[]
no_license
palikar/AdvancedResouceMenaging
94f814d2d16059a9a8af00643a28c53dc9cdbbb2
169860d0eeab9d5fd8b2b56d20d88f95fe25f6cc
refs/heads/master
2021-01-18T08:06:57.883521
2020-02-05T22:00:07
2020-02-05T22:00:07
33,877,322
0
0
null
null
null
null
UTF-8
Java
false
false
14,689
java
/* * Copyright (C) 2014 Stanisalv * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 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 General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package advancedresoucemenaging.interfaceClasses; import advancedresoucemenaging.GUIClasses.Colors; import advancedresoucemenaging.GUIClasses.GUIElements; import advancedresoucemenaging.GUIClasses.GradientPanel; import advancedresoucemenaging.algStuff.SubjectPlaceHolder; import advancedresoucemenaging.dataHandling.GlobalSpace; import advancedresoucemenaging.dataHandling.GlobalStrings; import advancedresoucemenaging.dataHandling.ScheduleFabrik; import advancedresoucemenaging.tableSTuff.JLableCellRenderer; import advancedresoucemenaging.tableSTuff.StudentPlanTableModel; import advancedresoucemenaging.tableSTuff.SubjectCellRenderer; import advancedresoucemenaging.tableSTuff.WeekTable; import com.alee.laf.menu.WebCheckBoxMenuItem; import com.alee.laf.menu.WebMenu; import com.alee.laf.menu.WebMenuBar; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Point; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import javax.swing.DefaultListModel; import javax.swing.DefaultListSelectionModel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenuBar; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.event.TableModelEvent; import net.miginfocom.swing.MigLayout; /** * * @author Stanisalv */ public class CleanupToolTab extends GradientPanel { DefaultListModel<Object> classesModel; JList<Object> classes; JButton set, swap, remove, showFull, clear; WeekTable simpleTable; JLabel teacher, subject; JFrame newFrame; boolean fullOpened = false; private StudentPlanTableModel model = null; private JTable fullTable = null; public CleanupToolTab() { super(new MigLayout()); add(new JLabel(GlobalStrings.classesString), "gaptop 0.5cm, gapleft 0.5cm"); add(new JLabel(GlobalStrings.simpleTablePlanSting), "gapleft 0.5cm,wrap 0.25cm"); //add(new JLabel(GlobalStrings.parametarsString), "gapleft 0.5cm, wrap 0.25cm"); classesModel = new DefaultListModel<>(); classes = GUIElements.getList(classesModel); classes.addListSelectionListener(e -> { changeTables(); }); JScrollPane sp2 = new JScrollPane(classes); sp2.setPreferredSize(new Dimension(230, 400)); add(sp2, "gapleft 0.5cm,spany 5"); simpleTable = new WeekTable(); simpleTable.setToolTipText(GlobalStrings.simpleWeekTableDesc); add(simpleTable, "gapleft 0.5cm,wrap 0.25cm"); showFull = GUIElements.getButton("Покажи цяла"); showFull.addActionListener(e -> { showFullTable(); }); add(showFull, "gapleft 0.5cm,align left,aligny top,split 2"); clear = GUIElements.getButton("Изчисти"); clear.addActionListener((e) -> { simpleTable.unselectAll(); }); add(clear, "gapleft 0.5cm,align left,aligny top,wrap 0.5cm"); add(subject = new JLabel(GlobalStrings.subjectString), "gaptop 0.5cm, gapleft 0.5cm, wrap 0.25cm,aligny top"); add(teacher = new JLabel(GlobalStrings.teacherString), "gapleft 0.5cm,wrap 0.25cm,aligny top"); set = GUIElements.getButton("Постави"); set.addActionListener((e) -> { setSubject(); }); add(set, "gapleft 0.5cm,skip,split"); swap = GUIElements.getButton("Размени"); swap.addActionListener((e) -> { swapSubjects(); }); add(swap, "gapleft 0.5cm"); remove = GUIElements.getButton("Премахни"); remove.addActionListener((e) -> { removeSubject(); }); add(remove, "gapleft 0.5cm"); simpleTable.setValueChangeAction(() -> { changeLables(); }); refresh(); } private void changeTables() { simpleTable.unselectAll(); int index = classes.getSelectedIndex(); if (index == -1) { return; } advancedresoucemenaging.dataHandling.Class clas = GlobalSpace.classController.getClasses().get(classes.getSelectedValue()); if (fullOpened) { model.setSelected(clas.getName()); model.fireTableDataChanged(); } updateMistakes(clas.getName()); } private void updateMistakes(String clas) { simpleTable.resetColors(); if (ScheduleFabrik.holes.containsKey(clas)) { ArrayList<Point> holes = ScheduleFabrik.holes.get(clas); holes.forEach((Point p) -> { simpleTable.changeColor(p.x, p.y, Color.red); }); } if (ScheduleFabrik.loners.containsKey(clas)) { ArrayList<Point> loners = ScheduleFabrik.loners.get(clas); loners.forEach((Point p) -> { simpleTable.changeColor(p.x, p.y, Color.green); }); } } private void swapSubjects() { int index = classes.getSelectedIndex(); if (index == -1) { return; } advancedresoucemenaging.dataHandling.Class clas = GlobalSpace.classController.getClasses().get(classes.getSelectedValue()); ArrayList<Point> selection = simpleTable.getSelected(); if (selection.size() != 2) { simpleTable.unselectAll(); return; } GlobalSpace.classController.swap(clas, selection.get(0), selection.get(1)); if (fullOpened) { model.fireTableDataChanged(); } GlobalSpace.runMistakeChecker(); updateMistakes(classes.getSelectedValue().toString()); } private void changeLables() { int index = classes.getSelectedIndex(); if (index == -1) { return; } SubjectPlaceHolder sub = GlobalSpace.classController.getClasses().get(classes.getSelectedValue()) .getSchedule()[simpleTable.getLastSelected().x][simpleTable.getLastSelected().y]; if (sub.equals(SubjectPlaceHolder.empty)) { teacher.setText(GlobalStrings.teacherString); subject.setText(GlobalStrings.subjectString); } else { teacher.setText(GlobalStrings.teacherString + sub.getTeacher()); subject.setText(GlobalStrings.subjectString + sub.getSubject()); } if (fullOpened) { fullTable.changeSelection(simpleTable.getLastSelected().y, simpleTable.getLastSelected().x + 1, false, false); } } private void removeSubject() { int index = classes.getSelectedIndex(); if (index == -1) { return; } ArrayList<Point> selected = simpleTable.getSelected(); selected.forEach((Point p) -> { GlobalSpace.classController.getClasses().get(classes.getSelectedValue()) .getSchedule()[p.x][p.y] = SubjectPlaceHolder.empty; }); if (fullOpened) { model.fireTableDataChanged(); } teacher.setText(GlobalStrings.teacherString); subject.setText(GlobalStrings.subjectString); simpleTable.unselectAll(); GlobalSpace.runMistakeChecker(); updateMistakes(classes.getSelectedValue().toString()); } private void showFullTable() { if (fullOpened) { return; } int index = classes.getSelectedIndex(); if (index == -1) { return; } advancedresoucemenaging.dataHandling.Class clas = GlobalSpace.classController.getClasses().get(classes.getSelectedValue()); newFrame = new JFrame("Програма на " + clas.getName()); model = new StudentPlanTableModel(); model.setSelected(clas.getName()); fullTable = new JTable(model); fullTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fullTable.setRowSelectionAllowed(true); fullTable.setFillsViewportHeight(true); fullTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fullTable.setRowHeight(60); fullTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 17)); fullTable.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); fullTable.getTableHeader().setReorderingAllowed(false); fullTable.getTableHeader().setResizingAllowed(false); fullTable.setBorder(GUIElements.defaultBorder); fullTable.setGridColor(Colors.tableGridColor); fullTable.setSelectionBackground(Colors.tableSelectionBackGround); fullTable.getTableHeader().setForeground(Colors.tableHeaderColor); fullTable.setCellSelectionEnabled(true); fullTable.getColumnModel().getColumn(0).setPreferredWidth(45); fullTable.getColumnModel().getColumn(1).setPreferredWidth(137); fullTable.getColumnModel().getColumn(2).setPreferredWidth(138); fullTable.getColumnModel().getColumn(3).setPreferredWidth(138); fullTable.getColumnModel().getColumn(4).setPreferredWidth(138); fullTable.getColumnModel().getColumn(5).setPreferredWidth(138); fullTable.getColumnModel().getColumn(0).setCellRenderer(new JLableCellRenderer()); fullTable.getColumnModel().getColumn(1).setCellRenderer(new SubjectCellRenderer()); fullTable.getColumnModel().getColumn(2).setCellRenderer(new SubjectCellRenderer()); fullTable.getColumnModel().getColumn(3).setCellRenderer(new SubjectCellRenderer()); fullTable.getColumnModel().getColumn(4).setCellRenderer(new SubjectCellRenderer()); fullTable.getColumnModel().getColumn(5).setCellRenderer(new SubjectCellRenderer()); JScrollPane sp = new JScrollPane(fullTable); sp.setPreferredSize(new Dimension(736, 456)); newFrame.add(sp); newFrame.pack(); newFrame.setResizable(false); newFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JMenuBar bar = new WebMenuBar() //<editor-fold defaultstate="collapsed" desc="Dont look"> { { add(new WebMenu(GlobalStrings.settingsString) { { add(new WebCheckBoxMenuItem(GlobalStrings.alwaysOnTopString) { { setSelected(true); addActionListener((e) -> { newFrame.setAlwaysOnTop(this.isSelected()); }); } }); } }); } }; //</editor-fold> newFrame.setJMenuBar(bar); newFrame.setAlwaysOnTop(true); newFrame.setVisible(true); fullOpened = true; newFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { super.windowClosed(e); //To change body of generated methods, choose Tools | Templates. fullOpened = false; fullTable = null; model = null; } }); } private void setSubject() { int index = classes.getSelectedIndex(); if (index == -1) { return; } if (simpleTable.getSelected().isEmpty()) { return; } simpleTable.unselectAll(); simpleTable.select(simpleTable.getLastSelected()); SetSubjectFrame settingFrame = new SetSubjectFrame(GlobalSpace.classController.getClasses().get(classes.getSelectedValue()).getSubjects().toArray(), simpleTable.getLastSelected().x, simpleTable.getLastSelected().y, classes.getSelectedValue().toString()); settingFrame.overrideLimitations(); settingFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { super.windowClosed(e); //To change body of generated methods, choose Tools | Templates. SubjectPlaceHolder sub = GlobalSpace.classController.getClasses().get(classes.getSelectedValue()) .getSchedule()[simpleTable.getLastSelected().x][simpleTable.getLastSelected().y]; if (sub.equals(SubjectPlaceHolder.empty)) { teacher.setText(GlobalStrings.teacherString); subject.setText(GlobalStrings.subjectString); return; } teacher.setText(GlobalStrings.teacherString + sub.getTeacher()); subject.setText(GlobalStrings.subjectString + sub.getSubject()); if (fullOpened) { fullTable.tableChanged(new TableModelEvent(fullTable.getModel())); } GlobalSpace.runMistakeChecker(); updateMistakes(classes.getSelectedValue().toString()); } }); } void refresh() { classesModel.clear(); GlobalSpace.classController.getClasses().values().forEach((clas) -> { classesModel.addElement(clas.getName()); }); } }
[ "stanislav_ts@abv.bg" ]
stanislav_ts@abv.bg
44a1a50ee8f1b18b0aa36d703d5ec01fe1287c49
798768b4c78f627f9868c5272d5e361cd7f91af9
/src/main/java/CoinFactoryTest/Coin.java
aced94c9f49aa411815885467ff39119974f23f7
[]
no_license
alon-hoffman/CoinFactoryTest
120d2a61aa36be972475709ba3d2be6d50d9e667
3a5c569ef41c1acb149bc46fdf11e09b13783668
refs/heads/master
2022-12-10T11:11:25.094393
2020-09-10T11:49:16
2020-09-10T11:49:16
294,394,216
0
0
null
null
null
null
UTF-8
Java
false
false
818
java
package CoinFactoryTest; import CoinEnum.Coins; // base coin class uses interface to declare methods. accepts value from derived classes public abstract class Coin implements utils.iCalculate { private double Value= 0.0; // this is just a default Double value private Coins coinType; // no Default value for abstract class public void setValue(double newV) { // assuming REST API update at instantiation - must be a Set method to prevent access to a variable directly this.Value=newV; } public void setCoinType(Coins ct){ this.coinType=ct; } public double getValue() { return this.Value; } public Coins getCoinType() { return coinType; } @Override public double calculate(double sum) { return sum * this.getValue(); } }
[ "a.hoffman.lon@gmail.com" ]
a.hoffman.lon@gmail.com
4e458c647560d1bbf1305de2889d200cd5f2c8d7
876f235784598b631ea87f166f6eadc4ee3652f8
/lcr/finance-data/src/main/java/com/javacowboy/lcr/financedata/api/process/scrape/Driver.java
db20e33a1cebfca1646c298ad4489c5efb26f2c6
[]
no_license
javacowboy/projects
2543f7e818f0df790831aebe155ddae7518e89e2
6588e328be6ee9e5c45f14ed47e8690a254c8e24
refs/heads/master
2021-11-05T08:21:40.281360
2021-11-02T18:21:43
2021-11-02T18:21:43
12,801,713
1
0
null
null
null
null
UTF-8
Java
false
false
576
java
package com.javacowboy.lcr.financedata.api.process.scrape; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.springframework.stereotype.Component; @Component public class Driver { private WebDriver driver; public WebDriver getDriver() { if(driver == null) { initWebDriver(); } return driver; } private void initWebDriver() { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); this.driver = new RemoteWebDriver(capabilities); } }
[ "matthew.young@ldschurch.org" ]
matthew.young@ldschurch.org
032f73296a58b3555731cca130fc914de583dd32
167584594f25a20447694a038c902a368f8939a1
/ArrayChallenges/MaxValue/src/com/BryceLooyenga/MaxValue/MaxValue.java
be008668e901707001b90b3f3545178ecfdc29a1
[]
no_license
banthony79/JavaPracticeV2
3748406b7a73e3d993e33a121c6e0c5588f2ed79
ea76036b95c1cedf36c2e98a31cf19af06f5dfe3
refs/heads/master
2023-03-15T22:23:13.677691
2021-03-10T03:03:51
2021-03-10T03:03:51
328,844,720
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
package com.BryceLooyenga.MaxValue; import java.util.Scanner; public class MaxValue { public static Scanner scanner = new Scanner(System.in); public static int[] getIntegers(int number) { int[] numArray = new int[number]; System.out.println("Please enter " + number + " numbers"); for (int i = 0; i < numArray.length; i++) { numArray[i] = scanner.nextInt(); } return numArray; } public static int returnMax(int [] array) { int maxNumber = array[0]; for (int i = 0; i < array.length; i++) { if (array[i] > maxNumber) { maxNumber = array[i]; } } return maxNumber; } public static void main(String[] args) { System.out.println(returnMax(getIntegers(4))); } } /* public static int maxValue(int[] array) { for (int i = 0; i < array.length; i++) { if (array[i] < array[i + 1]) { } } //} }*/
[ "blooyeng@gmail.com" ]
blooyeng@gmail.com
e5be45e405a82d63aa4408564355da4d794f61e6
7c6afe0d4bc2cbb690eff45df3d8c6a1e7934f68
/c-service-ribbon-8764/src/main/java/cn/dawnland/serviceribbon/CServiceRibbonApplication.java
d85bfe9917b06d7a720539a95a838e873a86ed8d
[]
no_license
MaoZa/SpringCloudDemo
5e7b1611ffcecd34b0354404b863d93cf36a50ea
b41ab708c673859b64d1615b7e2583ac17a882af
refs/heads/master
2020-04-07T15:59:17.629071
2018-11-22T09:35:29
2018-11-22T09:35:29
158,509,252
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package cn.dawnland.serviceribbon; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableDiscoveryClient @EnableHystrix public class CServiceRibbonApplication { public static void main(String[] args) { SpringApplication.run(CServiceRibbonApplication.class, args); } @Bean @LoadBalanced RestTemplate restTemplate() { return new RestTemplate(); } }
[ "cap_sub@dawnland.cn" ]
cap_sub@dawnland.cn
96c89a253a1cacbe20f9f6da48d691794529023c
970791c62e43177f15504d4a36a12f93cf336c72
/tutorial.src/extra/jdbc/basics/RetrieveWarnings.java
e2060228952bc3515cc15de2d9a21332c295340b
[]
no_license
ywendy/JavaLearn
ab36ed915d90e55c06d2dc63d8465ba5787794f8
208645e37b7b583131a61204f911e77c3282115a
refs/heads/master
2021-05-26T19:48:34.295026
2013-03-06T17:22:17
2013-03-06T17:22:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,057
java
package extra.jdbc.basics; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; public class RetrieveWarnings { public static void main(String[] args) { Connection con = DriverManagerConnection.getConnection(); Statement stmt = null ; ResultSet rs = null; try{ stmt = con.createStatement(); rs = stmt.executeQuery("select COF_NAME from COFFEES"); while (rs.next()) { String coffeeName = rs.getString("COF_NAME"); System.out.println("Coffees available at the Coffee Break: "); System.out.println(" " + coffeeName); SQLWarning warning = stmt.getWarnings(); if (warning != null) { System.out.println("\n---Warning---\n"); while (warning != null) { System.out.println("Message: " + warning.getMessage()); System.out.println("SQLState: " + warning.getSQLState()); System.out.print("Vendor error code: "); System.out.println(warning.getErrorCode()); System.out.println(""); warning = warning.getNextWarning(); } } SQLWarning warn = rs.getWarnings(); if (warn != null) { System.out.println("\n---Warning---\n"); while (warn != null) { System.out.println("Message: " + warn.getMessage()); System.out.println("SQLState: " + warn.getSQLState()); System.out.print("Vendor error code: "); System.out.println(warn.getErrorCode()); System.out.println(""); warn = warn.getNextWarning(); } } } } catch(SQLException ex) { System.out.println("\n--- SQLException caught ---\n"); while (ex != null) { System.out.println("Message: " + ex.getMessage ()); System.out.println("SQLState: " + ex.getSQLState ()); System.out.println("ErrorCode: " + ex.getErrorCode ()); ex = ex.getNextException(); System.out.println(""); } } catch(Exception e){ e.printStackTrace(); } finally{ DriverManagerConnection.close(con, stmt, rs); } } }
[ "jxfzywm@163.com" ]
jxfzywm@163.com
7540a2a43b29e8db26b8752facfbdb6a3ed8c7f4
ab5e6199252af977c16f28d0f0d8bc78bdf03c82
/Database/src/edu/buffalo/cse562/JoinOperator.java
d7bfa87b38800babed50e9a303acfb26a0993508
[]
no_license
Davi09/Gas_station_tool
c19dc2150ecaf7ebf89d84b03d20f2c5c554f793
cb670c6d59b5323463fd90f4e7da94b0d79bce79
refs/heads/master
2020-04-15T03:49:03.389122
2019-01-07T01:26:25
2019-01-07T01:26:25
164,361,113
0
0
null
null
null
null
UTF-8
Java
false
false
17,846
java
package edu.buffalo.cse562; import java.beans.Visibility; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import net.sf.jsqlparser.expression.AllComparisonExpression; import net.sf.jsqlparser.expression.AnyComparisonExpression; import net.sf.jsqlparser.expression.CaseExpression; import net.sf.jsqlparser.expression.DateValue; import net.sf.jsqlparser.expression.DoubleValue; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.ExpressionVisitor; import net.sf.jsqlparser.expression.Function; import net.sf.jsqlparser.expression.InverseExpression; import net.sf.jsqlparser.expression.JdbcParameter; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.NullValue; import net.sf.jsqlparser.expression.Parenthesis; import net.sf.jsqlparser.expression.StringValue; import net.sf.jsqlparser.expression.TimeValue; import net.sf.jsqlparser.expression.TimestampValue; import net.sf.jsqlparser.expression.WhenClause; import net.sf.jsqlparser.expression.operators.arithmetic.Addition; import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseAnd; import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseOr; import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor; import net.sf.jsqlparser.expression.operators.arithmetic.Concat; import net.sf.jsqlparser.expression.operators.arithmetic.Division; import net.sf.jsqlparser.expression.operators.arithmetic.Multiplication; import net.sf.jsqlparser.expression.operators.arithmetic.Subtraction; import net.sf.jsqlparser.expression.operators.conditional.AndExpression; import net.sf.jsqlparser.expression.operators.conditional.OrExpression; import net.sf.jsqlparser.expression.operators.relational.Between; import net.sf.jsqlparser.expression.operators.relational.EqualsTo; import net.sf.jsqlparser.expression.operators.relational.ExistsExpression; import net.sf.jsqlparser.expression.operators.relational.ExpressionList; import net.sf.jsqlparser.expression.operators.relational.GreaterThan; import net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals; import net.sf.jsqlparser.expression.operators.relational.InExpression; import net.sf.jsqlparser.expression.operators.relational.IsNullExpression; import net.sf.jsqlparser.expression.operators.relational.ItemsListVisitor; import net.sf.jsqlparser.expression.operators.relational.LikeExpression; import net.sf.jsqlparser.expression.operators.relational.Matches; import net.sf.jsqlparser.expression.operators.relational.MinorThan; import net.sf.jsqlparser.expression.operators.relational.MinorThanEquals; import net.sf.jsqlparser.expression.operators.relational.NotEqualsTo; import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.Table; import net.sf.jsqlparser.statement.StatementVisitor; import net.sf.jsqlparser.statement.create.table.CreateTable; import net.sf.jsqlparser.statement.delete.Delete; import net.sf.jsqlparser.statement.drop.Drop; import net.sf.jsqlparser.statement.insert.Insert; import net.sf.jsqlparser.statement.replace.Replace; import net.sf.jsqlparser.statement.select.AllColumns; import net.sf.jsqlparser.statement.select.AllTableColumns; import net.sf.jsqlparser.statement.select.FromItem; import net.sf.jsqlparser.statement.select.FromItemVisitor; import net.sf.jsqlparser.statement.select.PlainSelect; import net.sf.jsqlparser.statement.select.Select; import net.sf.jsqlparser.statement.select.SelectExpressionItem; import net.sf.jsqlparser.statement.select.SelectItemVisitor; import net.sf.jsqlparser.statement.select.SelectVisitor; import net.sf.jsqlparser.statement.select.SubJoin; import net.sf.jsqlparser.statement.select.SubSelect; import net.sf.jsqlparser.statement.select.Union; import net.sf.jsqlparser.statement.truncate.Truncate; import net.sf.jsqlparser.statement.update.Update; import net.sf.jsqlparser.statement.select.Join; public class JoinOperator implements Operator, SelectVisitor, ExpressionVisitor, StatementVisitor, SelectItemVisitor, ItemsListVisitor, FromItemVisitor, FromItem{ Expression condition; HashMap<String, TableCreator> input; String simpleJoin; String simpleAlias; String fromTable; String colName; String colNameWithAlias; String onJoin; boolean leftSide; boolean rightSide; TableCreator joinedTable; public JoinOperator(){ } public JoinOperator(HashMap<String, TableCreator> input, Expression condition){ this.input = input; this.condition = condition; } @Override public void resetStream() { // TODO Auto-generated method stub } @Override public Tuple readOneTuple() { // TODO Auto-generated method stub return null; } @Override public boolean hasNext() { // TODO Auto-generated method stub return false; } @Override public LinkedList<Tuple> getTable() { // TODO Auto-generated method stub return null; } @Override public void visit(NullValue arg0) { // TODO Auto-generated method stub } @Override public void visit(Function arg0) { // TODO Auto-generated method stub } @Override public void visit(InverseExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(JdbcParameter arg0) { // TODO Auto-generated method stub } @Override public void visit(DoubleValue arg0) { // TODO Auto-generated method stub } @Override public void visit(LongValue arg0) { // TODO Auto-generated method stub } @Override public void visit(DateValue arg0) { // TODO Auto-generated method stub } @Override public void visit(TimeValue arg0) { // TODO Auto-generated method stub } @Override public void visit(TimestampValue arg0) { // TODO Auto-generated method stub } @Override public void visit(Parenthesis paren) { // TODO Auto-generated method stub //paren.accept(this); paren.getExpression().accept(this); } @Override public void visit(StringValue arg0) { // TODO Auto-generated method stub } @Override public void visit(Addition arg0) { // TODO Auto-generated method stub } @Override public void visit(Division arg0) { // TODO Auto-generated method stub } @Override public void visit(Multiplication arg0) { // TODO Auto-generated method stub } @Override public void visit(Subtraction arg0) { // TODO Auto-generated method stub } @Override public void visit(AndExpression and) { // TODO Auto-generated method stub boolean left = false; and.getLeftExpression().accept(this); if(left){ } and.getRightExpression().accept(this); } @Override public void visit(OrExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(Between arg0) { // TODO Auto-generated method stub } @Override public void visit(EqualsTo arg0) { // TODO Auto-generated method stub } @Override public void visit(GreaterThan gt) { String left; String right; // TODO Auto-generated method stub gt.getLeftExpression().accept(this); left = colName; gt.getRightExpression().accept(this); right = colName; } @Override public void visit(GreaterThanEquals arg0) { // TODO Auto-generated method stub } @Override public void visit(InExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(IsNullExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(LikeExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(MinorThan minor) { // TODO Auto-generated method stub String left, right; minor.getLeftExpression().accept(this); left = colName; minor.getRightExpression().accept(this); right = colName; //if((int)input.getTable().get(0).getValue(left) < (int)input.getTable().get(0).getValue(left)) // leftSide = true; System.out.println(leftSide); } @Override public void visit(MinorThanEquals arg0) { // TODO Auto-generated method stub } @Override public void visit(NotEqualsTo arg0) { // TODO Auto-generated method stub } @Override public void visit(Column col) { // TODO Auto-generated method stub System.out.println(col); colName = col.getColumnName(); colNameWithAlias = col.getWholeColumnName(); //System.out.println(colName); } @Override public void visit(SubSelect arg0) { // TODO Auto-generated method stub } @Override public void visit(CaseExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(WhenClause arg0) { // TODO Auto-generated method stub } @Override public void visit(ExistsExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(AllComparisonExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(AnyComparisonExpression arg0) { // TODO Auto-generated method stub } @Override public void visit(Concat arg0) { // TODO Auto-generated method stub } @Override public void visit(Matches arg0) { // TODO Auto-generated method stub } @Override public void visit(BitwiseAnd arg0) { // TODO Auto-generated method stub } @Override public void visit(BitwiseOr arg0) { // TODO Auto-generated method stub } @Override public void visit(BitwiseXor arg0) { // TODO Auto-generated method stub } @Override public void visit(PlainSelect plainSelect) { // TODO Auto-generated method stub //((AllComparisonExpression) plainSelect.getJoins().get(0)).accept(this); if(plainSelect.getFromItem() != null){ plainSelect.getFromItem().accept(this); fromTable = simpleJoin; } //if(plainSelect.getJoins().) if(plainSelect.getJoins() != null){ TableCreator newTable = new TableCreator(); //LinkedList<LinkedHashMap<Integer, Object>> joinTable = new LinkedList<LinkedHashMap<Integer, Object>>(); TableCreator joinTable = new TableCreator(); int counter = 0; for(int i = 0; i < plainSelect.getJoins().size();i++){ Join join = (Join) plainSelect.getJoins().get(i); if(join.getOnExpression() != null){ join.getOnExpression().accept(this); onJoin = "PLAYERS"; String tableName = onJoin; join.getRightItem().accept(this); TableCreator table = new TableCreator(); table = input.get(fromTable); if(onJoin.equals(tableName) ){ int count = 0; int counter2 = 0; System.out.println(count); //The loop String timeStamp1 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); System.out.println(timeStamp1); int season; int season2; int season3 = 0; int season4 = 0; int size = input.get(fromTable).getTable().size(); boolean jok; System.out.println(table.getSize()); int[] intArray = new int[size]; int[] intArray2 = new int[size]; TableCreator table1 = new TableCreator(); TableCreator table2 = new TableCreator(); TableCreator tmp = new TableCreator(); //table.printOut(); for(int j = 0; j < table.getSize(); j++){ for(int k = 0; k < table.getSize(); k++){ season = (int)table.getTable().get(j * table.getAttribues().size() + 3); //System.out.println(k * table.getAttribues().size() + 4); season2 = (int)table.getTable().get(k * table.getAttribues().size() + 3); season3 = (int)table.getTable().get(j * table.getAttribues().size() + 4); season4 = (int)table.getTable().get(k * table.getAttribues().size() + 4); if(season < season2 && season3 > season4){ count++; for(int l = 0; l < table.getAttribues().size(); l++){ tmp.getTable().put(counter2 , table.getTable().get(j * table.getAttribues().size() + l)); counter2++; } for(int l = 0; l < table.getAttribues().size(); l++){ tmp.getTable().put(counter2 , table.getTable().get(k * table.getAttribues().size() + l)); counter2++; } } } } System.out.println(count); System.out.println(counter2); tmp.setSize(counter2); String timeStamp2 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); System.out.println(timeStamp2); } } if(join.isNatural()){ System.out.println(join.getRightItem()); } if(join.isOuter()){ System.out.println(join.getRightItem()); } if(join.isInner()){ System.out.println(join.getRightItem()); } if(join.isFull()){ System.out.println(join.getRightItem()); } if(join.isLeft()){ System.out.println(join.getRightItem()); } if(join.isRight()){ System.out.println(join.getRightItem()); } if(join.isSimple()){ TableCreator table = new TableCreator(); table = input.get(fromTable); String tableName = simpleJoin; join.getRightItem().accept(this); if(simpleJoin.equals(tableName) ){ int count = 0; String timeStamp1 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); System.out.println(timeStamp1); for(int j = 0; j < table.getSize(); j++){ for(int k = 0; k < table.getSize(); k++){ } } String timeStamp2 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); System.out.println(timeStamp2); }else{ String timeStamp1 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); System.out.println(timeStamp1); TableCreator table1 = new TableCreator(); TableCreator table2 = new TableCreator(); TableCreator tmp = new TableCreator(); if(!newTable.isEmpty()) table1 = newTable; else table1 = input.get(fromTable); table2 = input.get(simpleJoin); LinkedHashMap<Integer, Object> tuple; int count = 0; LinkedHashMap<Integer, Object> tabless = new LinkedHashMap<Integer, Object>(); int table1attrsize = table1.getAttribues().size(); int table2attrsize = table2.getAttribues().size(); int table1size = table1.getSize(); int table2size = table2.getSize(); int simpleCount = 0; int blockSize = 0; if(simpleJoin.toString().equals("LINEITEM")) blockSize = 120; else blockSize = 1; for(int j = 0; j < table1size; j++){ int table1Pos = 0 * table1size + j; for(int k = 0; k < table2size/blockSize; k++){ int table2Pos = 0 * table2attrsize + k; for(int l = 0; l < table2attrsize; l++){ tmp.getTable().put(simpleCount, table2.getTable().get(table2Pos + l)); simpleCount++; } for(int l = 0; l < table1attrsize; l++){ tmp.getTable().put(simpleCount, table1.getTable().get(table1Pos + l)); simpleCount++; } //counter++; //tmp.getTable().put(counter, table1.getTable().get(olo2)); //tmp.getTable().put(counter, table2.getTable().get(olo)); //} //count++; //counter++; //System.out.println(counter); /* Total amount of free memory available to the JVM */ //System.out.println("Free memory (bytes): " + //Runtime.getRuntime().freeMemory()); } } //tmp.getTable().put(simpleCount, table2.getTable().get(1)); tmp.setSize(simpleCount); System.out.println(simpleCount); input.get(fromTable).getTable().clear(); input.get(simpleJoin).getTable().clear(); newTable = tmp; tmp = null; table1=null; table2= null; String timeStamp2 = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); } } } joinedTable = newTable; } System.out.println(joinedTable.getTable().get(1)); } @Override public void visit(Union arg0) { // TODO Auto-generated method stub } @Override public void visit(ExpressionList arg0) { // TODO Auto-generated method stub } @Override public void visit(AllColumns arg0) { // TODO Auto-generated method stub } @Override public void visit(AllTableColumns table) { // TODO Auto-generated method stub } @Override public void visit(SelectExpressionItem arg0) { // TODO Auto-generated method stub } @Override public void visit(Select arg0) { // TODO Auto-generated method stub } @Override public void visit(Delete arg0) { // TODO Auto-generated method stub } @Override public void visit(Update arg0) { // TODO Auto-generated method stub } @Override public void visit(Insert arg0) { // TODO Auto-generated method stub } @Override public void visit(Replace arg0) { // TODO Auto-generated method stub } @Override public void visit(Drop arg0) { // TODO Auto-generated method stub } @Override public void visit(Truncate arg0) { // TODO Auto-generated method stub } @Override public void visit(CreateTable arg0) { // TODO Auto-generated method stub } @Override public void visit(Table table) { // TODO Auto-generated method stub simpleJoin = table.getName(); if(table.getAlias() != null){ simpleAlias = table.getAlias(); } //System.out.println(table.get); } @Override public void visit(SubJoin join) { // TODO Auto-generated method stub System.out.println(join.getAlias()); } @Override public void accept(FromItemVisitor arg0) { // TODO Auto-generated method stub } @Override public String getAlias() { // TODO Auto-generated method stub return null; } @Override public void setAlias(String arg0) { // TODO Auto-generated method stub } public TableCreator getJoinedTable(){ return joinedTable; } }
[ "davindersandhu@Davinders-MBP.home" ]
davindersandhu@Davinders-MBP.home
f5b78bbaf1284c88bdb2f5cb59609435bfd92bdc
c7c702f9185b93b962b6163f6b317abc5c68d35b
/weka_6_1_ifc_filter/src/weka/classifiers/ParallelIteratedSingleClassifierEnhancer.java
2e4c36a8d4d4050196dd9ac39c771090d057f5c6
[]
no_license
bbrangeo/ifc-filter
4713464d841fe26327431071036384c01b228d45
c521cb7ff8fd16be0bfb6fa8a4ca02406e836d19
refs/heads/master
2020-07-05T21:37:17.618578
2017-09-25T16:32:58
2017-09-25T16:32:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,531
java
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * ParallelIteratedSingleClassifierEnhancer.java * Copyright (C) 2009 University of Waikato, Hamilton, New Zealand * */ package weka.classifiers; import java.util.Enumeration; import java.util.Vector; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import weka.core.Instances; import weka.core.Option; import weka.core.Utils; /** * Abstract utility class for handling settings common to * meta classifiers that build an ensemble in parallel from a single * base learner. * * @author Mark Hall (mhall{[at]}pentaho{[dot]}com) * @version $Revision: 6041 $ */ public abstract class ParallelIteratedSingleClassifierEnhancer extends IteratedSingleClassifierEnhancer { /** For serialization */ private static final long serialVersionUID = -5026378741833046436L; /** The number of threads to have executing at any one time */ protected int m_numExecutionSlots = 1; /** Pool of threads to train models with */ protected transient ThreadPoolExecutor m_executorPool; /** The number of classifiers completed so far */ protected int m_completed; /** * The number of classifiers that experienced a failure of some sort * during construction */ protected int m_failed; /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions() { Vector newVector = new Vector(2); newVector.addElement(new Option( "\tNumber of execution slots.\n" + "\t(default 1 - i.e. no parallelism)", "num-slots", 1, "-num-slots <num>")); Enumeration enu = super.listOptions(); while (enu.hasMoreElements()) { newVector.addElement(enu.nextElement()); } return newVector.elements(); } /** * Parses a given list of options. Valid options are:<p> * * -Z num <br> * Set the number of execution slots to use (default 1 - i.e. no parallelism). <p> * * Options after -- are passed to the designated classifier.<p> * * @param options the list of options as an array of strings * @exception Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { String iterations = Utils.getOption("num-slots", options); if (iterations.length() != 0) { setNumExecutionSlots(Integer.parseInt(iterations)); } else { setNumExecutionSlots(1); } super.setOptions(options); } /** * Gets the current settings of the classifier. * * @return an array of strings suitable for passing to setOptions */ public String [] getOptions() { String [] superOptions = super.getOptions(); String [] options = new String [superOptions.length + 2]; int current = 0; options[current++] = "-num-slots"; options[current++] = "" + getNumExecutionSlots(); System.arraycopy(superOptions, 0, options, current, superOptions.length); return options; } /** * Set the number of execution slots (threads) to use for building the * members of the ensemble. * * @param numSlots the number of slots to use. */ public void setNumExecutionSlots(int numSlots) { m_numExecutionSlots = numSlots; } /** * Get the number of execution slots (threads) to use for building * the members of the ensemble. * * @return the number of slots to use */ public int getNumExecutionSlots() { return m_numExecutionSlots; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String numExecutionSlotsTipText() { return "The number of execution slots (threads) to use for " + "constructing the ensemble."; } /** * Stump method for building the classifiers * * @param data the training data to be used for generating the ensemble * @exception Exception if the classifier could not be built successfully */ public void buildClassifier(Instances data) throws Exception { super.buildClassifier(data); if (m_numExecutionSlots < 1) { throw new Exception("Number of execution slots needs to be >= 1!"); } if (m_numExecutionSlots > 1) { startExecutorPool(); } m_completed = 0; m_failed = 0; } /** * Start the pool of execution threads */ protected void startExecutorPool() { if (m_executorPool != null) { m_executorPool.shutdownNow(); } m_executorPool = new ThreadPoolExecutor(m_numExecutionSlots, m_numExecutionSlots, 120, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); } private synchronized void block(boolean tf) { if (tf) { try { wait(); } catch (InterruptedException ex) { } } else { notifyAll(); } } /** * Does the actual construction of the ensemble * * @throws Exception if something goes wrong during the training * process */ protected synchronized void buildClassifiers() throws Exception { for (int i = 0; i < m_Classifiers.length; i++) { if (m_numExecutionSlots > 1) { final Classifier currentClassifier = m_Classifiers[i]; final int iteration = i; if (m_Debug) { System.out.print("Training classifier (" + (i +1) + ")"); } Runnable newTask = new Runnable() { public void run() { try { currentClassifier.buildClassifier(getTrainingSet(iteration)); completedClassifier(iteration, true); } catch (Exception ex) { ex.printStackTrace(); completedClassifier(iteration, false); } } }; // launch this task m_executorPool.execute(newTask); } else { m_Classifiers[i].buildClassifier(getTrainingSet(i)); } } if (m_numExecutionSlots > 1 && m_completed + m_failed < m_Classifiers.length) { block(true); } } /** * Records the completion of the training of a single classifier. Unblocks if * all classifiers have been trained. * * @param iteration the iteration that has completed * @param success whether the classifier trained successfully */ protected synchronized void completedClassifier(int iteration, boolean success) { m_completed++; if (!success) { m_failed++; if (m_Debug) { System.err.println("Iteration " + iteration + " failed!"); } } if (m_completed + m_failed == m_Classifiers.length) { if (m_failed > 0) { if (m_Debug) { System.err.println("Problem building classifiers - some iterations failed."); } } // have to shut the pool down or program executes as a server // and when running from the command line does not return to the // prompt m_executorPool.shutdown(); block(false); } } /** * Gets a training set for a particular iteration. Implementations need * to be careful with thread safety and should probably be synchronized * to be on the safe side. * * @param iteration the number of the iteration for the requested training set * @return the training set for the supplied iteration number * @throws Exception if something goes wrong. */ protected abstract Instances getTrainingSet(int iteration) throws Exception; }
[ "michael.kaufmann@windowslive.com" ]
michael.kaufmann@windowslive.com
81ecee9253beb102e561592fd281da91d121a5d0
465c7947786bc78c57a9fe12f94108925d843632
/src/com/sdsu/edu/main/HelpDialog.java
d3d68053f12b0214cdfbe32260dc82ed452f29c6
[]
no_license
vikclickz/charts-for-moj
aad9b2ccaa3f4d28d0f6a78405d2f9aa059c499f
a0af3fcafc52e384ece54692865feb342e1d9b8b
refs/heads/develop
2018-08-23T07:33:10.746487
2018-07-07T01:23:42
2018-07-07T01:23:42
115,228,844
0
0
null
2018-07-04T20:59:56
2017-12-23T23:53:46
Java
UTF-8
Java
false
false
772
java
package com.sdsu.edu.main; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import javax.swing.JDialog; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class HelpDialog extends JDialog { JTextArea helptextarea; public HelpDialog(String inputText) throws IOException { setBounds(70, 70, 460, 250); setTitle("Help"); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); } }); helptextarea = new JTextArea(inputText, 7, 40); JScrollPane scrollpane = new JScrollPane(helptextarea); helptextarea.setEditable(false); getContentPane().add(scrollpane, "Center"); } }
[ "mvikrant88@gmail.com" ]
mvikrant88@gmail.com
53f9f4ded7abcd338fc3312ed16f37f2c74b7581
21a4246fcd2995b737c83a12875cc18c8854a3b3
/Bridge/src/JetEngineBridge.java
13568b9950ee6a0df6b51f77995b03385a57f370
[]
no_license
jensmoes/JavaAircraftDesignPatternExamples
b297b5630ca371eacc5c4c312deb8f1f21836ff4
77e339208271c917cbaa5d1a4e732908d3ee5b7d
refs/heads/master
2016-09-16T10:07:20.308676
2014-11-13T16:59:41
2014-11-13T16:59:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
import Aircrafts.Power.Powerplant; public class JetEngineBridge extends PowerplantBridge { public JetEngineBridge(Powerplant aPowerPlantImp) { super(aPowerPlantImp); // TODO Auto-generated constructor stub } // public JetEngineBridge() { // // TODO Auto-generated constructor stub // } @Override public void start() { mEngine.start(); } }
[ "jens.troest@gmail.com" ]
jens.troest@gmail.com
8bb72f1c1256d210f76f6fe90bfacf3e4c61b524
b92133ac59f5a8d9dce209c66e907f759d92405c
/parcial 22/src/parcial/pkg22/Punto.java
1114d249a59200c405023a361d422806f001c2fe
[]
no_license
crirodriguezr/Parcial-2
0edf3294574122fcd9b74973fd45baf702a6a578
bf6ad6a6cb3b637e3b767adc81b737656af7845d
refs/heads/master
2020-03-18T14:57:33.629582
2018-05-25T16:57:43
2018-05-25T16:57:43
134,877,547
0
0
null
null
null
null
UTF-8
Java
false
false
818
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 parcial.pkg22; /** * * @author Estudiantes */ public class Punto { private int x; private int y; public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public int getX() { if (x<0){ System.out.println("Asegurate que los puntos se encuentren en el primer cuadrante"); } return x; } public int getY() { if (y<0){ System.out.println("Asegurate que los puntos se encuentren en el primer cuadrante"); } return y; } }
[ "Estudiantes@10.20.151.149" ]
Estudiantes@10.20.151.149
c62e06257e42a9105fb925beb0f4d2743edce7c5
1ba5ad6121750e8e7988d7d627e3163866a05d41
/app/src/main/java/com/example/aalizade/mbazar_base_app/adapters/recycler_adapters/gift/PaymentMethodAdapter1.java
4c204516f479a8ea38e5577102fa54200eede582
[]
no_license
A-M-Alizadeh/androidMarket
d2cfee487872b299b54d09e2f0a2ccc845124836
5d74ecf0a1a9ab845506c73a5de145ff4a598090
refs/heads/master
2020-05-22T03:41:05.477150
2019-05-12T05:54:04
2019-05-12T05:54:04
186,215,610
0
0
null
null
null
null
UTF-8
Java
false
false
2,390
java
package com.example.aalizade.mbazar_base_app.adapters.recycler_adapters.gift; import android.content.Context; import android.graphics.Color; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.aalizade.mbazar_base_app.R; import com.example.aalizade.mbazar_base_app.network.models.general.ComboResponseModel1; import java.util.ArrayList; import java.util.List; /** * Created by sajad on 2/26/18. */ public class PaymentMethodAdapter1 extends ArrayAdapter<ComboResponseModel1>{ private final LayoutInflater mInflater; private List<ComboResponseModel1> items = new ArrayList<>(); private Context activity; private final int mResource; public PaymentMethodAdapter1(Context activity, ArrayList<ComboResponseModel1> items, int mResource) { super(activity, 0, items); mInflater = LayoutInflater.from(activity); this.items = items; this.activity = activity; this.mResource = mResource; } @Override public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { return createItemView(position, convertView, parent); } @Override public ComboResponseModel1 getItem(int position) { return items.get(position); } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View view = convertView; if (view == null){ view = LayoutInflater.from(activity).inflate(R.layout.simple_textview,parent,false); } TextView textView = (TextView) view.findViewById(R.id.sample_textview); textView.setTextColor(Color.BLACK); textView.setText(items.get(position).getName()); return view; } private View createItemView(int position, View convertView, ViewGroup parent){ final View view = mInflater.inflate(mResource, parent, false); TextView satPosition = (TextView) view.findViewById(R.id.sample_textview); ComboResponseModel1 warehouse = items.get(position); satPosition.setText(warehouse.getName()); satPosition.setTextColor(Color.BLACK); return view; } }
[ "Mobile1@ICT.LOCAl" ]
Mobile1@ICT.LOCAl
d4d6e924c2112a7ab74cdf996ca36d6f92bdfa56
e476305a1ba7fda619bd7ebd420119c42572adc0
/Record.java
b3312849db2a84e1c5fa99bcdd38841a2b018fcc
[]
no_license
mustafatozluoglu/DoorAccessReportProgram
ee31e26e4e404ed826bb44b0b1247cd11d85e988
42046636233435ffb2e2f36cae7f2604a9e4206b
refs/heads/master
2022-04-28T09:59:49.264820
2019-11-04T08:26:04
2019-11-04T08:26:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,922
java
/** * created by mustafa.tozluoglu on 4.10.2019 */ public class Record { private String genTime; private String seqId; private String type; private String status; private String p; private String readerPointData; private String site; private String cardNumber; private String account; private String name; private String operator; private String message; public Record() { } public Record(String genTime, String seqId, String type, String status, String p, String readerPointData, String site, String cardNumber, String account, String name, String operator, String message) { this.genTime = genTime; this.seqId = seqId; this.type = type; this.status = status; this.p = p; this.readerPointData = readerPointData; this.site = site; this.cardNumber = cardNumber; this.account = account; this.name = name; this.operator = operator; this.message = message; } public String getGenTime() { return genTime; } public void setGenTime(String genTime) { this.genTime = genTime; } public String getSeqId() { return seqId; } public void setSeqId(String seqId) { this.seqId = seqId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getP() { return p; } public void setP(String p) { this.p = p; } public String getReaderPointData() { return readerPointData; } public void setReaderPointData(String readerPointData) { this.readerPointData = readerPointData; } public String getSite() { return site; } public void setSite(String site) { this.site = site; } public String getCardNumber() { return cardNumber; } public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String toString() { return genTime + " || " + readerPointData + " || " + site + " || " + cardNumber + " || " + name + " || " + "\n"; } }
[ "mustafa.tozluoglu@gama.com.tr" ]
mustafa.tozluoglu@gama.com.tr
38723ea7a17cca70cdbcd0dbb66453754a527227
7caa31be4d8be2f8ebd15a02b9e212685d7d06e8
/src/main/java/org/trams/hello/bean/jpa/UserPsychologicalFileEntity.java
edceef8eaa549fda7518b180d98c6dd310f5ba2a
[]
no_license
minajsaaa/hello_counselor
60b6d14f8061dacfdffa44a09892a778a6f4c024
869460f8279025c97a39e98324a28191e957b006
refs/heads/master
2023-05-26T05:19:23.079457
2017-12-25T09:51:10
2017-12-25T09:51:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,366
java
/* * Created on 12 Apr 2017 ( Time 16:10:42 ) * Generated by Telosys Tools Generator ( version 2.1.1 ) */ // This Bean has a basic Primary Key (not composite) package org.trams.hello.bean.jpa; import java.io.Serializable; //import javax.validation.constraints.* ; //import org.hibernate.validator.constraints.* ; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; /** * Persistent class for entity stored in table "user_psychological_file" * * @author Telosys Tools Generator * */ @Entity @Table(name="user_psychological_file", catalog="hello" ) // Define named queries here @NamedQueries ( { @NamedQuery ( name="UserPsychologicalFileEntity.countAll", query="SELECT COUNT(x) FROM UserPsychologicalFileEntity x" ) } ) @DynamicInsert @DynamicUpdate public class UserPsychologicalFileEntity implements Serializable { private static final long serialVersionUID = 1L; //---------------------------------------------------------------------- // ENTITY PRIMARY KEY ( BASED ON A SINGLE FIELD ) //---------------------------------------------------------------------- @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id", nullable=false) private Integer id ; //---------------------------------------------------------------------- // ENTITY DATA FIELDS //---------------------------------------------------------------------- @Column(name="file_name", length=500) private String fileName ; @Column(name="file_url", length=500) private String fileUrl ; @Temporal(TemporalType.TIMESTAMP) @Column(name="create_date") private Date createDate ; @Temporal(TemporalType.TIMESTAMP) @Column(name="update_date") private Date updateDate ; // "userPsychologicalId" (column "user_psychological_id") is not defined by itself because used as FK in a link //---------------------------------------------------------------------- // ENTITY LINKS ( RELATIONSHIP ) //---------------------------------------------------------------------- @ManyToOne @JoinColumn(name="user_psychological_id", referencedColumnName="id") private UserPsychologicalEntity userPsychological; //---------------------------------------------------------------------- // CONSTRUCTOR(S) //---------------------------------------------------------------------- public UserPsychologicalFileEntity() { super(); } //---------------------------------------------------------------------- // GETTER & SETTER FOR THE KEY FIELD //---------------------------------------------------------------------- public void setId( Integer id ) { this.id = id ; } public Integer getId() { return this.id; } //---------------------------------------------------------------------- // GETTERS & SETTERS FOR FIELDS //---------------------------------------------------------------------- //--- DATABASE MAPPING : file_name ( VARCHAR ) public void setFileName( String fileName ) { this.fileName = fileName; } public String getFileName() { return this.fileName; } //--- DATABASE MAPPING : file_url ( VARCHAR ) public void setFileUrl( String fileUrl ) { this.fileUrl = fileUrl; } public String getFileUrl() { return this.fileUrl; } //--- DATABASE MAPPING : create_date ( DATETIME ) public void setCreateDate( Date createDate ) { this.createDate = createDate; } public Date getCreateDate() { return this.createDate; } //--- DATABASE MAPPING : update_date ( DATETIME ) public void setUpdateDate( Date updateDate ) { this.updateDate = updateDate; } public Date getUpdateDate() { return this.updateDate; } //---------------------------------------------------------------------- // GETTERS & SETTERS FOR LINKS //---------------------------------------------------------------------- public void setUserPsychological( UserPsychologicalEntity userPsychological ) { this.userPsychological = userPsychological; } public UserPsychologicalEntity getUserPsychological() { return this.userPsychological; } //---------------------------------------------------------------------- // toString METHOD //---------------------------------------------------------------------- public String toString() { StringBuffer sb = new StringBuffer(); sb.append("["); sb.append(id); sb.append("]:"); sb.append(fileName); sb.append("|"); sb.append(fileUrl); sb.append("|"); sb.append(createDate); sb.append("|"); sb.append(updateDate); return sb.toString(); } }
[ "kennyphong2811@gmail.com" ]
kennyphong2811@gmail.com
6c8e53cd1d40ccbebf07f42cac8dd3655286e225
fd85136beceda093cce13f4838c2fd4c668b6de0
/TMDB/app/src/main/java/com/shenexample/tay/tmdb/Movies/MovieApi.java
bde83b49c9a3886b4cd790efc60cc41322c1b9af
[]
no_license
Mint3kool/TMDB
c8b3363ce4ec5a41b3ad74fefdb33d7e4f555eef
1384aa5877a82c47b5033fd0adb39b439c7f893b
refs/heads/master
2021-08-10T12:29:46.949662
2018-11-09T17:00:45
2018-11-09T17:00:45
142,704,378
0
0
null
null
null
null
UTF-8
Java
false
false
1,823
java
package com.shenexample.tay.tmdb.Movies; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.shenexample.tay.tmdb.Static; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Created by Tay on 4/26/2018. * Class that directly links to the api for getting information on various types of movies */ public class MovieApi implements Response.Listener<String>, Response.ErrorListener { private RequestQueue queue; private MovieFragment myMovieFragment; public MovieApi(MovieFragment frag) { myMovieFragment = frag; queue = Volley.newRequestQueue(myMovieFragment.getContext()); } public void getPopularMovies() { String requestString = "https://api.themoviedb.org/3/movie/popular?api_key="+ Static.apiKey +"&language=en-US&page=1"; StringRequest request = new StringRequest(Request.Method.GET, requestString, this, this); int retryCount = 5; request.setRetryPolicy(new DefaultRetryPolicy( DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, retryCount, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); queue.add(request); } @Override public void onErrorResponse(VolleyError error) { } @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); JSONArray jsonArray = jsonObject.getJSONArray("results"); myMovieFragment.storeMoviesInDatabase(jsonArray); } catch (JSONException e) { e.printStackTrace(); } } }
[ "stay9@vt.edu" ]
stay9@vt.edu
45b0c1c8e63dba3a4a090d80f25fa2f43b1e01e7
c64bd277b6850252399ce3384c38934ddf9b1327
/src/nl/saxion/cos/Compiler.java
e2fc3dc640c25a61242e66f0b7325f9bb96a119c
[]
no_license
IvoTasev/JavaPlusPlus
dad5586a552717f23478d8a8c7863d4dc3e0d14c
2ebe1811619dca01b4f0e660ab36fa9fa8d570d7
refs/heads/master
2022-12-08T23:52:56.562188
2020-09-06T23:03:15
2020-09-06T23:03:15
293,365,116
0
0
null
null
null
null
UTF-8
Java
false
false
8,283
java
package nl.saxion.cos; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.tree.ParseTree; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; /** * Compiles source code in a custom language into Jasmin and then assembles a * JVM-compatible .class file. * <p> * Check the TODO's. */ public class Compiler { private Checker checker; /** * The number of errors detected by the lexer and parser. */ private int errorCount = 0; /** * Compiles a complete source code file. * * @param inputPath Path to the source code to compile. * @param className Name of the class to create. * @throws IOException if files could not be read or written * @throws AssembleException if Jasmin code was not valid */ public JasminBytecode compileFile(String inputPath, String className) throws IOException, AssembleException { return compile(CharStreams.fromFileName(inputPath), className); } /** * Compiles a string. * * @param sourceCode The source code to compile. * @param className Name of the class to create. * @throws IOException if files could not be read or written * @throws AssembleException if Jasmin code was not valid */ public JasminBytecode compileString(String sourceCode, String className) throws IOException, AssembleException { return compile(CharStreams.fromString(sourceCode), className); } /** * Compiles a file. The source code is lexed (turned into tokens), parsed (a parse tree * created) then Jasmin code is generated and assembled into a class. * * @param input Stream to the source code input. * @param className Name of the class to create. */ private JasminBytecode compile(CharStream input, String className) { // Phase 1: Run the lexer CommonTokenStream tokens = runLexer(input); // Phase 2: Run the parser ParseTree parseTree = runParser(tokens); // ANTLR tries to do its best in creating a parse tree, even if the source code contains // errors. So, check if that is the case and bail out if so. if (errorCount > 0) return null; // Phase 3: Check the source code for semantic errors if (!runChecker(parseTree)) return null; // Phase 4: Generate code return generateCode(parseTree, className); } /** * Take the charater input and turn it into tokens according to the grammar. * * @param input The input. * @return A steam of tokens. */ private CommonTokenStream runLexer(CharStream input) { JavaplusplusLexer lexer = new JavaplusplusLexer(input); lexer.addErrorListener(getErrorListener()); return new CommonTokenStream(lexer); } /** * Tries to form a parse tree from the given tokens. In case of errors, the error listener is * called, but the parser still tries to create a parse tree. * * @param tokens The tokens returned from the lexer. * @return A Parse Tree. */ private ParseTree runParser(CommonTokenStream tokens) { JavaplusplusParser parser = new JavaplusplusParser(tokens); parser.addErrorListener(getErrorListener()); return parser.program(); } /** * Called to check if the source code was semantically correct. This method is only called when * there were no syntax errors. * * @param parseTree The parse tree generated by the parser * @return True if all code is semantically correct */ private boolean runChecker(ParseTree parseTree) { // TODO: Create your own checker that inherits from a BaseVisitor, e.g. ExampleLangBaseVisitor. // Call the visit() method with the parseTree as parameter. In that visitor, you check for // errors in the source code. Examples of errors you may want to check for: // - A variable is used before it was declared // - The user is trying to assign a value to a variable with a different type // - An if-statement has a condition that is not a boolean // - An expression mixes values of incompatible data types this.checker = new Checker(); this.checker.visit(parseTree); return true; } /** * Generate the Jasmin code for the source code. This method is only called after checking that * the code is syntactically and semantically correct, so you need not check for any errors. * * @param parseTree The parseTree to generate code for * @return All Jasmin code that is generated */ private JasminBytecode generateCode(ParseTree parseTree, String className) { JasminBytecode jasminBytecode = new JasminBytecode(className); // TODO: You will have to create a visitor that visits the parse tree and generates // code for the nodes in that tree. // In your case, you will probably want to supply that visitor with the PrintWriter // created above and emit lines of Jasmin code for the nodes in the parse tree. // For now, I'll just create a simple template that prints 'Hello world!' Generator generator = new Generator(jasminBytecode, this.checker); generator.visit(parseTree); return jasminBytecode; } /** * Creates and returns an error listener for use in the lexer and parser that just increases * the errorCount-attribute in this class so we can find out if the source code had a syntax * error. * * @return An error listener for use with lexer.addErrorListener() and parser.addErrorListener() */ private ANTLRErrorListener getErrorListener() { return new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errorCount++; } }; } /** * Main method. * * @param args Array of command line arguments. You can use this to supply the file name to * compile. */ public static void main(String[] args) { try { Compiler compiler = new Compiler(); // Check that the user supplied a name of the source file if (args.length == 0) { System.err.println("Usage: java Compiler <name of source>"); return; } // Split the file name // It first strips the extension, so that: tests/myFile.exlang becomes tests/myFile. // Then, it removes everything that seems a path, so we end up with just 'myFile' as // the class name. Path sourceCodePath = Paths.get(args[0]); String sourceFileName = sourceCodePath.getFileName().toString(); int dotIndex = sourceFileName.lastIndexOf('.'); String className = sourceFileName.substring(0, dotIndex == -1 ? sourceFileName.length() : dotIndex); // Read the file and compile it. JasminBytecode jasminBytecode = compiler.compileFile(sourceCodePath.toString(), className); if (jasminBytecode == null) { System.err.println("No Jasmin output"); return; } // Write Jasmin-code to a file String jasminFilename = sourceCodePath.getParent().resolve(className + ".j").toString(); jasminBytecode.writeJasminToFile(jasminFilename); // Try to assemble the Jasmin byte code and write that to a file AssembledClass assembledClass = AssembledClass.assemble(jasminBytecode); String classFilename = sourceCodePath.getParent().resolve(className + ".class").toString(); assembledClass.writeClassToFile(classFilename); } catch (IOException | AssembleException e) { System.err.println("Something went wrong: " + e.getMessage()); e.printStackTrace(); } } }
[ "469297@student.saxion.nl" ]
469297@student.saxion.nl
7ea1f949c291db1e947c735613743043e3c6ec2d
3f954c0b777cecfff80623c87bd4291292167afc
/src/workbench/db/importer/AbstractImportFileParser.java
49d8035738c5a29b8b63a8e391651ae6e8a32e81
[]
no_license
zippy1981/SqlWorkbenchJ
67ba4dca04fb9ee69ca0992032c6ddfb69614f60
7b246fb0dadd6b5c47900dcbb2298cc5f0143b77
refs/heads/master
2021-01-10T01:47:54.963813
2016-02-14T23:14:10
2016-02-14T23:14:10
45,090,119
0
0
null
null
null
null
UTF-8
Java
false
false
15,080
java
/* * AbstractImportFileParser.java * * This file is part of SQL Workbench/J, http://www.sql-workbench.net * * Copyright 2002-2016, Thomas Kellerer * * Licensed under a modified Apache License, Version 2.0 * that restricts the use for certain governments. * You may not use this file except in compliance with the License. * You may obtain a copy of the License at. * * http://sql-workbench.net/manual/license.html * * 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. * * To contact the author please send an email to: support@sql-workbench.net * */ package workbench.db.importer; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import workbench.interfaces.ImportFileParser; import workbench.interfaces.JobErrorHandler; import workbench.log.LogMgr; import workbench.resource.ResourceMgr; import workbench.resource.Settings; import workbench.db.ColumnIdentifier; import workbench.db.TableDefinition; import workbench.db.TableIdentifier; import workbench.db.WbConnection; import workbench.db.importer.modifier.ImportValueModifier; import workbench.storage.RowActionMonitor; import workbench.util.BlobDecoder; import workbench.util.MessageBuffer; import workbench.util.SqlUtil; import workbench.util.StringUtil; import workbench.util.ValueConverter; import workbench.util.WbFile; /** * * @author Thomas Kellerer */ public abstract class AbstractImportFileParser implements ImportFileParser { protected File inputFile; protected ImportFileLister sourceFiles; protected String tableName; protected String targetSchema; protected TableDefinition targetTable; protected String encoding; // this indicates an import of several files from a single // directory into one table protected boolean multiFileImport; protected boolean trimValues; protected List<ImportFileColumn> importColumns; protected volatile boolean cancelImport; protected boolean regularStop; protected DataReceiver receiver; protected boolean abortOnError; protected WbConnection connection; protected MessageBuffer messages = new MessageBuffer(); protected boolean sharedMessages; protected boolean hasErrors; protected boolean hasWarnings; protected ImportFileHandler fileHandler = new ImportFileHandler(); protected List<String> currentRowValues; protected ImportValueModifier valueModifier; protected ValueConverter converter = new ValueConverter(); protected JobErrorHandler errorHandler; protected List<File> filesProcessed = new ArrayList<>(25); protected BlobDecoder blobDecoder = new BlobDecoder(); protected RowActionMonitor rowMonitor; protected boolean ignoreMissingColumns; protected boolean clobsAreFilenames; public AbstractImportFileParser() { } public AbstractImportFileParser(File aFile) { this(); this.inputFile = aFile; } @Override public void setMessageBuffer(MessageBuffer buffer) { if (buffer != null) { messages = buffer; sharedMessages = true; } } @Override public void setIgnoreMissingColumns(boolean flag) { ignoreMissingColumns = flag; } @Override public void setRowMonitor(RowActionMonitor rowMonitor) { this.rowMonitor = rowMonitor; } @Override public List<File> getProcessedFiles() { return filesProcessed; } @Override public ImportFileHandler getFileHandler() { return this.fileHandler; } public ImportValueModifier getValueModifier() { return valueModifier; } @Override public void setValueModifier(ImportValueModifier mod) { this.valueModifier = mod; } @Override public void setTargetSchema(String schema) { this.targetSchema = schema; } @Override public void setReceiver(DataReceiver rec) { this.receiver = rec; } @Override public void setInputFile(File file) { this.sourceFiles = null; this.inputFile = file; } /** * Enables or disables multi-file import. If multi file * import is enabled, all files that are defined will be imported into the same * table defined by {@link #setTableName(java.lang.String) } * * @param flag * @see #setSourceFiles(workbench.db.importer.ImportFileLister) * @see #setTableName(java.lang.String) */ @Override public void setMultiFileImport(boolean flag) { this.multiFileImport = flag; } @Override public boolean isMultiFileImport() { return this.multiFileImport; } @Override public void setSourceFiles(ImportFileLister source) { this.inputFile = null; this.sourceFiles = source; } @Override public void setTableName(String aName) { this.tableName = aName; this.targetTable = null; this.importColumns = null; } @Override public boolean hasErrors() { return this.hasErrors; } @Override public boolean hasWarnings() { return this.hasWarnings; } @Override public String getSourceFilename() { if (this.inputFile == null) return null; if (this.fileHandler != null) { return fileHandler.getInputFilename(); } return this.inputFile.getAbsolutePath(); } @Override public String getLastRecord() { return null; } @Override public void setValueConverter(ValueConverter convert) { this.converter = convert; } @Override public abstract void setColumns(List<ColumnIdentifier> columnList) throws SQLException; /** * Defines the mapping from input to target columns in case no target table is available. * * This is used when importing from the clipboard (as the target is a datastore not a table) * * @param fileColumns the columns in the order as they appear in the file * @param targetColumns the columns in the order as they appear in the target. */ public void setColumnMap(List<ColumnIdentifier> fileColumns, List<ColumnIdentifier> targetColumns) { importColumns = ImportFileColumn.createList(); for (ColumnIdentifier sourceCol : fileColumns) { int index = targetColumns.indexOf(sourceCol); if (index > -1) { ColumnIdentifier col = targetColumns.get(index); ImportFileColumn importCol = new ImportFileColumn(col); importCol.setTargetIndex(index); importColumns.add(importCol); } else { importColumns.add(ImportFileColumn.SKIP_COLUMN); } } } protected TableIdentifier createTargetTableId() { TableIdentifier table = new TableIdentifier(this.tableName, this.connection); table.setPreserveQuotes(true); if (this.targetSchema != null) { table.setSchema(this.targetSchema); } if (this.connection != null) { table.adjustCase(this.connection); if (table.getSchema() == null) { table.setSchema(this.connection.getCurrentSchema()); } } return table; } protected TableDefinition getTargetTable() throws SQLException { if (this.tableName == null) return null; if (this.targetTable != null) return targetTable; // we can't verify the table without a connection // not having one isn't an error if we are importing the clipboard into a DataStore if (this.connection == null) return null; TableIdentifier table = createTargetTableId(); targetTable = connection.getMetadata().getTableDefinition(table, false); return targetTable; } @Override public void setConnection(WbConnection aConn) { this.connection = aConn; } @Override public String getEncoding() { return (this.encoding == null ? Settings.getInstance().getDefaultDataEncoding() : this.encoding); } public void setEncoding(String enc) { if (enc == null) return; this.encoding = enc; } @Override public MessageBuffer getMessages() { if (this.sharedMessages) return null; return this.messages; } @Override public void setAbortOnError(boolean flag) { this.abortOnError = flag; } /** * Stop processing the current input file. * * This is used by the DataImporter to signal that all selected rows * were imported (in case not all rows should be imported). * * This sets cancelImport to true, but to distinguish this * from a "normal" cancel, it also sets regularStop to true. */ @Override public void stop() { LogMgr.logDebug("AbstractImportFileParser.stop()", "Stopping import"); this.cancelImport = true; this.regularStop = true; } @Override public void cancel() { LogMgr.logDebug("AbstractImportFileParser.cancel()", "Cancelling import"); this.cancelImport = true; this.regularStop = false; } @Override public void start() throws Exception { this.receiver.setTableCount(-1); // clear multi-table flag in receiver this.receiver.setCurrentTable(-1); try { if (this.sourceFiles != null) { processDirectory(); } else { processOneFile(); } } finally { if (this.sourceFiles != null) { this.receiver.endMultiTable(); } if (this.cancelImport && !regularStop) { this.receiver.importCancelled(); } else { this.receiver.importFinished(); } try { this.fileHandler.done(); } catch (Throwable th) {} } } /** * Reset any variables that are needed to keep the status * for importing a single file. * * This will be called by processDirectory() before processing each file. */ protected void resetForFile() { this.cancelImport = false; this.regularStop = false; if (!sharedMessages) messages.clear(); if (!multiFileImport) tableName = null; } protected TablenameResolver getTableNameResolver() { return new DefaultTablenameResolver(); } protected void processDirectory() throws Exception { if (this.sourceFiles == null) throw new IllegalStateException("Cannot process source directory without FileNameSorter"); this.sourceFiles.setTableNameResolver(getTableNameResolver()); if (!sourceFiles.containsFiles()) { String msg = ResourceMgr.getFormattedString("ErrImpNoFiles", sourceFiles.getExtension(), sourceFiles.getDirectory()); this.messages.append(msg); this.hasErrors = true; throw new SQLException("No files with extension '" + sourceFiles.getExtension() + "' in directory " + sourceFiles.getDirectory()); } List<WbFile> toProcess = null; try { toProcess = sourceFiles.getFiles(); } catch (CycleErrorException e) { cancelImport = true; LogMgr.logError("AbstractImportFileParser.processDirectory()", "Error when checking dependencies", e); throw e; } // The receiver only needs to pre-process the full table list // if checkDependencies is turned on, otherwise a possible // table delete can be done during the single table import this.receiver.setTableList(sourceFiles.getTableList()); int count = toProcess == null ? 0 : toProcess.size(); if (count == 0) { String msg = ResourceMgr.getFormattedString("ErrImpNoMatch", sourceFiles.getDirectory()); this.messages.append(msg); this.hasErrors = true; throw new SQLException("No matching tables found for files in directory " + sourceFiles.getDirectory()); } this.receiver.setTableCount(count); if (!multiFileImport) { this.receiver.beginMultiTable(); } int currentFile = 0; for (WbFile sourceFile : toProcess) { if (this.cancelImport) break; try { currentFile++; resetForFile(); this.receiver.setCurrentTable(currentFile); if (!multiFileImport) { // Only reset the import columns and table if multiple files // are imported into multiple tables // if multifileimport is true, then all files are imported into the same table! TableIdentifier tbl = sourceFiles.getTableForFile(sourceFile); setTableName(tbl.getTableExpression()); } this.inputFile = sourceFile; this.processOneFile(); } catch (Exception e) { this.hasErrors = true; this.receiver.tableImportError(); if (this.abortOnError) throw e; } } } protected List<ColumnIdentifier> getColumnsToImport() { List<ColumnIdentifier> result = new ArrayList<>(); for (ImportFileColumn col : importColumns) { if (col.getTargetIndex() >= 0) { result.add(col.getColumn()); } } return result; } protected void setupFileHandler() throws IOException { this.fileHandler.setMainFile(this.inputFile, this.getEncoding()); } protected abstract void processOneFile() throws Exception; @Override public abstract Map<Integer, Object> getInputColumnValues(Collection<Integer> inputFileIndexes); /** * Returns the column list as a comma separated string * that can be used for the WbImport command */ @Override public String getColumns() { StringBuilder result = new StringBuilder(); int colCount = 0; for (ImportFileColumn col : importColumns) { if (colCount > 0) result.append(','); if (col != null && col.getTargetIndex() != -1) { result.append(col.getColumn().getColumnName()); } else { result.append(RowDataProducer.SKIP_INDICATOR); } colCount ++; } return result.toString(); } @Override public void setErrorHandler(JobErrorHandler handler) { this.errorHandler = handler; } @Override public void setTrimValues(boolean trim) { this.trimValues = trim; } protected boolean isColumnFiltered(int colIndex, String importValue) { if (importColumns == null) return false; if (colIndex < 0 || colIndex > importColumns.size()) return false; ImportFileColumn fileCol = importColumns.get(colIndex); if (fileCol.getColumnFilter() == null) return false; int type = fileCol.getColumn().getDataType(); if (SqlUtil.isBlobType(type)) return false; if (SqlUtil.isClobType(type) && clobsAreFilenames) return false; if (importValue == null) { return true; } Matcher m = fileCol.getColumnFilter().matcher(importValue); return !m.matches(); } /** * Return the index of the specified column * in the import file. * * @param colName the column to search for * @return the index of the named column or -1 if the column was not found */ protected int getColumnIndex(String colName) { if (colName == null) return -1; if (importColumns == null) return -1; return this.importColumns.indexOf(colName); } @Override public void addColumnFilter(String colname, String regex) { int index = this.getColumnIndex(colname); if (index == -1) return; try { Pattern p = Pattern.compile(regex); importColumns.get(index).setColumnFilter(p); } catch (Exception e) { LogMgr.logError("TextFileParser.addColumnFilter()", "Error compiling regular expression " + regex + " for column " + colname, e); String msg = ResourceMgr.getString("ErrImportBadRegex"); msg = StringUtil.replace(msg, "%regex%", regex); this.messages.append(msg); this.messages.appendNewLine(); this.hasWarnings = true; importColumns.get(index).setColumnFilter(null); } } }
[ "tkellerer@6c36a7f0-0884-4472-89c7-80b7fa7b7f28" ]
tkellerer@6c36a7f0-0884-4472-89c7-80b7fa7b7f28
732c662c9bffc154349835efc6bdd7e401373ee4
1aff9698a76ed8af7cda57f6a612cbaf159c62ea
/app/src/main/java/com/example/administrator/newmyskycar/ZhuCe2Activity.java
9821bb219ba2733f7a0c319c340d8d71d89ecff4
[]
no_license
silencefmz/NewMySkyCar
6bc8285118ca4bf8c4a50b61141ec9586393682b
46514f930703c39581eaac1ddf8b4a53793d7d3f
refs/heads/master
2021-07-17T12:48:00.024201
2017-10-25T07:57:12
2017-10-25T07:57:12
107,244,812
0
1
null
2017-10-17T09:47:19
2017-10-17T09:11:46
Java
UTF-8
Java
false
false
9,622
java
package com.example.administrator.newmyskycar; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.example.administrator.newmyskycar.MyData.MySet; import com.example.administrator.newmyskycar.MyData.SqlCarCargodata; import com.example.administrator.newmyskycar.MyData.SqlFrienddata; import com.example.administrator.newmyskycar.MyData.SqlMydata; import com.example.administrator.newmyskycar.SQLRun.Sql; import com.zhy.autolayout.AutoLayoutActivity; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class ZhuCe2Activity extends AutoLayoutActivity { @BindView(R.id.mZhuCe2Return) ImageView mZhuCe2Return; @BindView(R.id.mZhuCe) Button mZhuCe; @BindView(R.id.mUserName) EditText mUserName; @BindView(R.id.mPassWord) EditText mPassWord; @BindView(R.id.editText) EditText editText; @BindView(R.id.mNoPhoneText) EditText mNoPhoneText; @BindView(R.id.xieyi) CheckBox xieyi; private SqlMydata db; private SqlFrienddata db2; private SqlCarCargodata db3; private String Zhenshixingming = ""; private String Shenfenzhenghao = ""; private String Suozaishengshi = ""; private String Bangongdizhi = ""; private Sql dao = Sql.getInstance(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.linear_zhuce2); db = new SqlMydata(this); db2 = new SqlFrienddata(this); db3 = new SqlCarCargodata(this); ButterKnife.bind(this); } @OnClick({R.id.mZhuCe2Return, R.id.mZhuCe}) public void onViewClicked(View view) { Intent intent = new Intent(); switch (view.getId()) { case R.id.mZhuCe2Return: intent.setClass(this, ZhuCeActivity.class); startActivity(intent); finish(); break; case R.id.mZhuCe: Zhenshixingming = mUserName.getText().toString(); Shenfenzhenghao = mPassWord.getText().toString(); Suozaishengshi = editText.getText().toString(); Bangongdizhi = mNoPhoneText.getText().toString(); boolean kong = false; if (Zhenshixingming.equals("")) Toast.makeText(this, "真实姓名不能为空", Toast.LENGTH_SHORT).show(); else if (Shenfenzhenghao.equals("")) Toast.makeText(this, "身份证号不能为空", Toast.LENGTH_SHORT).show(); else if (Suozaishengshi.equals("")) Toast.makeText(this, "所在省市不能为空", Toast.LENGTH_SHORT).show(); else if (Bangongdizhi.equals("")) Toast.makeText(this, "办公地址不能为空", Toast.LENGTH_SHORT).show(); else kong = true; if (kong && !xieyi.isChecked()) { Toast.makeText(this, "请先确认同意协议", Toast.LENGTH_SHORT).show(); kong = false; } if (kong) { if(dao.CheckUserid(Shenfenzhenghao)){ MySet.AppUser_id = Shenfenzhenghao; MySet.AppUser_realname = Zhenshixingming; MySet.AppUser_city = Suozaishengshi; MySet.AppUser_address = Bangongdizhi; db.setServerAddress(MySet.AppUser_name, MySet.AppUser_password, MySet.AppUser_id, MySet.AppUser_phone, MySet.AppUser_realname , MySet.AppUser_city, MySet.AppUser_address); db.close(); db2.setServerAddress("付明振","11011011011",Shenfenzhenghao,"空闲"); dao.setFriendAddress("寇权","11211211111",Shenfenzhenghao,"空闲"); dao.setFriendAddress("吕国强","12321515684",Shenfenzhenghao,"空闲"); dao.setFriendAddress("李润发","15621568785",Shenfenzhenghao,"空闲"); dao.setFriendAddress("李宇同","12345678998",Shenfenzhenghao,"空闲"); db2.close(); db3.setServerAddress(Shenfenzhenghao,"北京-南京","2017-11-17 18:00—18:30","货车 4.2米 | 1500吨","4.2米","整车","No.000001","待报价","",""); db3.setServerAddress(Shenfenzhenghao,"南京-上海","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000002","待报价","",""); db3.setServerAddress(Shenfenzhenghao,"上海-广东","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000003","待报价","",""); db3.setServerAddress(Shenfenzhenghao,"广东-青岛","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000004","待报价","",""); db3.setServerAddress(Shenfenzhenghao,"青岛-北京","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000005","待报价","",""); db3.setServerAddress(Shenfenzhenghao,"北京-南京","2017-11-17 18:00—18:30","货车 4.2米 | 1500吨","4.2米","整车","No.000006","已中标","2000",""); db3.setServerAddress(Shenfenzhenghao,"南京-上海","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000007","已中标","4000",""); db3.setServerAddress(Shenfenzhenghao,"上海-广东","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000008","已中标","5000",""); db3.setServerAddress(Shenfenzhenghao,"广东-青岛","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000009","已中标","3000",""); db3.setServerAddress(Shenfenzhenghao,"青岛-北京","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000010","已中标","3500",""); db3.setServerAddress(Shenfenzhenghao,"北京-南京","2017-11-17 18:00—18:30","货车 4.2米 | 1500吨","4.2米","整车","No.000011","已报价","2000",""); db3.setServerAddress(Shenfenzhenghao,"南京-上海","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000012","已报价","4000",""); db3.setServerAddress(Shenfenzhenghao,"上海-广东","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000013","已报价","5000",""); db3.setServerAddress(Shenfenzhenghao,"广东-青岛","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000014","已报价","3000",""); db3.setServerAddress(Shenfenzhenghao,"青岛-北京","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000015","已报价","3500",""); db3.setServerAddress(Shenfenzhenghao,"北京-南京","2017-11-17 18:00—18:30","货车 4.2米 | 1500吨","4.2米","整车","No.000016","运输中","2000","付XX"); db3.setServerAddress(Shenfenzhenghao,"南京-上海","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000017","运输中","4000","付XX"); db3.setServerAddress(Shenfenzhenghao,"上海-广东","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000018","运输中","5000","付XX"); db3.setServerAddress(Shenfenzhenghao,"广东-青岛","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000019","运输中","3000","付XX"); db3.setServerAddress(Shenfenzhenghao,"青岛-北京","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000020","运输中","3500","付XX"); db3.setServerAddress(Shenfenzhenghao,"北京-南京","2017-11-17 18:00—18:30","货车 4.2米 | 1500吨","4.2米","整车","No.000021","已完成","2000","王XX"); db3.setServerAddress(Shenfenzhenghao,"南京-上海","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000022","已完成","4000","王XX"); db3.setServerAddress(Shenfenzhenghao,"上海-广东","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000023","已完成","5000","王XX"); db3.setServerAddress(Shenfenzhenghao,"广东-青岛","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","拼车","No.000024","已完成","3000","王XX"); db3.setServerAddress(Shenfenzhenghao,"青岛-北京","2017-11-17 18:00—18:30","中栏车 5.8米 | 2000吨","5.6米","整车","No.000025","已完成","3500","王XX"); db3.close(); Toast.makeText(this, "注册成功", Toast.LENGTH_LONG).show(); intent.setClass(this, MainActivity.class); startActivity(intent); finish(); }else{ Toast.makeText(this, "该身份证号已注册,请重新输入", Toast.LENGTH_SHORT).show(); } } break; } } }
[ "silencefmz@sina.com" ]
silencefmz@sina.com
9ab74ef5c220fb59237f2166f988c971359df4b7
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project435/src/main/java/org/gradle/test/performance/largejavamultiproject/project435/p2175/Production43512.java
3c3255015e2c4f385a4d9ccd541a42e30d80fc3e
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,971
java
package org.gradle.test.performance.largejavamultiproject.project435.p2175; public class Production43512 { private Production43503 property0; public Production43503 getProperty0() { return property0; } public void setProperty0(Production43503 value) { property0 = value; } private Production43507 property1; public Production43507 getProperty1() { return property1; } public void setProperty1(Production43507 value) { property1 = value; } private Production43511 property2; public Production43511 getProperty2() { return property2; } public void setProperty2(Production43511 value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
8c5f87958ad866c54398aa0f71e4bb465e02b205
d8185404df3cd4b055ffaa96ed4299ac0f7bce4f
/CouponProject/src/main/java/com/evicohen/JavaBeans/Company.java
7d8ea3437d93a8d23cf997b525cbfc1047836cc5
[]
no_license
eviCohen1/eCouponSystemPhase2
59c3493351ed0d8beea73665a18e5acf6c7605bc
5675dd3351758f4160a6905ffeeec95f0c32f29c
refs/heads/master
2023-08-09T06:00:55.380339
2019-08-10T08:38:00
2019-08-10T08:38:00
196,043,180
0
0
null
2023-07-22T10:25:36
2019-07-09T16:13:11
Java
UTF-8
Java
false
false
1,237
java
package com.evicohen.JavaBeans; import java.util.ArrayList; public class Company { // Attributes private long id; private String compName; private String password; private String email; ArrayList<Coupon> coupons = new ArrayList<Coupon>(); // Ctors public Company() { } public Company(long id, String compName, String password, String email) { this.compName = compName; this.password = password; this.email = email; this.id = id; } // Methods public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCompName() { return compName; } public void setCompName(String compName) { this.compName = compName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "Company [id=" + id + ", compName=" + compName + ", password=" + password + ", email=" + email + ", coupons=" + coupons + "]"; } }
[ "evi@adl.solutions" ]
evi@adl.solutions
bbb9f8ce1bfcb2499b8b7bc0e424a25a7d26a982
fa908ca90cbbfce7b3836f39235454d45c911b9f
/app/src/main/java/com/example/store_keeper/store_keeper/data/local/models/Supplier.java
1f1e0dd01de503697e4fe1cc10af7422fba4f3b5
[ "Apache-2.0", "CC-BY-3.0" ]
permissive
rajatgupta2018/store-keeper
14a58b1be96c117e4039fcf2b6aaca72ee705998
20a6e20edf4f51d0b2ae4bffb0bf8a31c709aed7
refs/heads/master
2023-01-12T11:47:55.203870
2020-11-13T14:52:08
2020-11-13T14:52:08
310,859,109
1
0
null
null
null
null
UTF-8
Java
false
false
9,521
java
/* * Created By Rajat Gupta And Harshita Joshi * * 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.example.store_keeper.store_keeper.data.local.models; import android.os.Parcel; import android.os.Parcelable; import java.util.ArrayList; /** * Parcelable Model class for storing and updating the details of the Supplier. * * @author Rajat Gupta And Harshita Joshi */ public class Supplier implements Parcelable { /** * Implementation of {@link android.os.Parcelable.Creator} interface * to generate instances of this Parcelable class {@link Supplier} from a {@link Parcel} */ public static final Creator<Supplier> CREATOR = new Creator<Supplier>() { /** * Creates an instance of this Parcelable class {@link Supplier} from * a given Parcel whose data had been previously written by #writeToParcel() method * * @param in The Parcel to read the object's data from. * @return Returns a new instance of this Parcelable class {@link Supplier} */ @Override public Supplier createFromParcel(Parcel in) { return new Supplier(in); } /** * Creates a new array of this Parcelable class {@link Supplier} * * @param size Size of the array * @return Returns an array of this Parcelable class {@link Supplier}, with every * entry initialized to null */ @Override public Supplier[] newArray(int size) { return new Supplier[size]; } }; //The Primary Key/ID of the Supplier private final int mId; //The Name of the Supplier private String mName; //The Unique Code of the Supplier private String mCode; //List of Supplier's Contacts private ArrayList<SupplierContact> mContacts; //List of Products with their Selling Price info private ArrayList<ProductSupplierInfo> mProductSupplierInfoList; /** * Private Constructor of {@link Supplier} * * @param id The Integer Primary Key/ID of the Supplier * @param name The Name of the Supplier * @param code The Unique Code of the Supplier * @param contacts {@link ArrayList} of Supplier's Contacts {@link SupplierContact} * @param productSupplierInfoList {@link ArrayList} of Products with their Selling Price info {@link ProductSupplierInfo} */ private Supplier(int id, String name, String code, ArrayList<SupplierContact> contacts, ArrayList<ProductSupplierInfo> productSupplierInfoList) { mId = id; mName = name; mCode = code; mContacts = contacts; mProductSupplierInfoList = productSupplierInfoList; } /** * Parcelable constructor that de-serializes the data from a Parcel {@code in} passed * * @param in The Instance of the Parcel class containing the serialized data */ protected Supplier(Parcel in) { mId = in.readInt(); mName = in.readString(); mCode = in.readString(); mContacts = in.createTypedArrayList(SupplierContact.CREATOR); mProductSupplierInfoList = in.createTypedArrayList(ProductSupplierInfo.CREATOR); } /** * Flattens/Serializes the object of {@link Supplier} into a Parcel * * @param dest The Parcel in which the object should be written * @param flags Additional flags about how the object should be written. * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mId); dest.writeString(mName); dest.writeString(mCode); dest.writeTypedList(mContacts); dest.writeTypedList(mProductSupplierInfoList); } /** * Describes the kinds of special objects contained in this Parcelable * instance's marshaled representation. * * @return a bitmask indicating the set of special object types marshaled * by this Parcelable object instance. */ @Override public int describeContents() { return 0; //Indicating with no mask } /** * Getter Method for Primary Key/ID of the Supplier * * @return The Integer Primary Key/ID of the Supplier */ public int getId() { return mId; } /** * Getter Method for the Name of the Supplier * * @return The Name of the Supplier */ public String getName() { return mName; } /** * Setter Method to set the Name of the Supplier * * @param name The Name of the Supplier */ public void setName(String name) { mName = name; } /** * Getter Method for the Code of the Supplier * * @return The Code of the Supplier */ public String getCode() { return mCode; } /** * Setter Method to set the Code of the Supplier * * @param code The Unique Code of the Supplier */ public void setCode(String code) { mCode = code; } /** * Getter Method for the List of Supplier's Contacts * * @return An {@link ArrayList} of Supplier's Contacts {@link SupplierContact} */ public ArrayList<SupplierContact> getContacts() { return mContacts; } /** * Setter Method to set the List of Supplier's Contacts * * @param contacts {@link ArrayList} of Supplier's Contacts {@link SupplierContact} */ public void setContacts(ArrayList<SupplierContact> contacts) { mContacts = contacts; } /** * Getter Method for the List of Products with their Selling Price info * * @return {@link ArrayList} of Products with their Selling Price info {@link ProductSupplierInfo} */ public ArrayList<ProductSupplierInfo> getProductSupplierInfoList() { return mProductSupplierInfoList; } /** * Setter Method to set the List of Products with their Selling Price info * * @param productSupplierInfoList {@link ArrayList} of Products with their Selling Price info {@link ProductSupplierInfo} */ public void setProductSupplierInfoList(ArrayList<ProductSupplierInfo> productSupplierInfoList) { mProductSupplierInfoList = productSupplierInfoList; } /** * Static Builder class that constructs {@link Supplier} */ public static class Builder { private int mId; private String mName; private String mCode; private ArrayList<SupplierContact> mContacts; private ArrayList<ProductSupplierInfo> mProductSupplierInfoList; /** * Setter for the Integer Primary Key/ID of the Supplier * * @param id Integer Primary Key/ID of the Supplier * @return Instance of {@link Builder} for chaining method calls. */ public Builder setId(int id) { mId = id; return this; } /** * Setter for the Name of the Supplier * * @param name The Name of the Supplier * @return Instance of {@link Builder} for chaining method calls. */ public Builder setName(String name) { mName = name; return this; } /** * Setter for the Code of the Supplier * * @param code The Unique Code of the Supplier * @return Instance of {@link Builder} for chaining method calls. */ public Builder setCode(String code) { mCode = code; return this; } /** * Setter for the List of Supplier's Contacts * * @param contacts {@link ArrayList} of Supplier's Contacts {@link SupplierContact} * @return Instance of {@link Builder} for chaining method calls. */ public Builder setContacts(ArrayList<SupplierContact> contacts) { mContacts = contacts; return this; } /** * Setter for the List of Products with their Selling Price info * * @param productSupplierInfoList {@link ArrayList} of Products with their Selling Price info {@link ProductSupplierInfo} * @return Instance of {@link Builder} for chaining method calls. */ public Builder setProductSupplierInfoList(ArrayList<ProductSupplierInfo> productSupplierInfoList) { mProductSupplierInfoList = productSupplierInfoList; return this; } /** * Terminal Method that constructs the {@link Supplier} * * @return Instance of {@link Supplier} built */ public Supplier createSupplier() { //Returning the instance built return new Supplier(mId, mName, mCode, mContacts, mProductSupplierInfoList); } } }
[ "rajatmanit2018@gmail.com" ]
rajatmanit2018@gmail.com
badc604b7268bb4676a76dda55edc1eb4c4165f3
abc619d55ca4d716c2909ace0ae923d27390220a
/quote-system-client/src/main/java/com.juran.quote/bean/enums/QuoteErrorEnum.java
1f2c843cd9fa277e841a3ab6c854fdad53fc37ef
[]
no_license
estbonc/ecnu-quote-system
6f7dfb755e9251aa12ab690d422a793c49971415
c93620804dbbd7511146cd5a6c1af59873fad07a
refs/heads/master
2023-08-03T23:10:49.656057
2022-03-05T10:09:06
2022-03-05T10:09:06
244,164,454
0
0
null
2023-07-23T07:18:23
2020-03-01T14:32:01
FreeMarker
UTF-8
Java
false
false
2,299
java
package com.juran.quote.bean.enums; public enum QuoteErrorEnum { INSERT_QUOTE_ERROR(110600001, "新建报价失败"), QUOTE_NOT_FOUND(110600002, "未找到相应报价"), PACKAGE_VERSION_NOT_FOUND(110600003,"未找到相应套餐版本"), QUOTE_HOUSE_TYPE_EMPTY(110600004, "报价-房型未设置"), QUOTE_HOUSE_ROOM_MAP_ERROR(110600005, "房型空间映射失败"), QUOTE_KEY_REQUIRED(110600006, "报价ID为空"), FIND_PACKAGE_PRICE_ERROR(110600007, "套餐价格信息不存在"), SEND_SMS_CODE_MOBILE_ERROR(110600008, "手机号格式不对"), EXECUTE_REQUIRED(110600009, "execute参数错误"), BUDGET_SMS_TOOFAST(110600010, "60s内只能获取一次短信验证码,请稍后再试"), BUDGET_AREA_ERROR(110600011, "建筑面积有误"), BUDGET_MOBILE_REQUIRED(110600012, "接收验证码短信的手机号为空"), BUDGET_SMS_CODE_REQUIRED(110600013, "验证码为空"), BUDGET_SMS_EXPIRED(110600014, "短信验证码已失效,请重新获取"), BUDGET_SMS_CODE_NOT_MATCH(110600015, "验证码不匹配"), BUDGET_PACKAGE_VERSION_NOT_FOUND(110600016, "套餐版本未找到"), BUDGET_PACKAGE_PRICE_NOT_FOUND(110600016, "套餐报价未找到"), PACKAGE_NOT_FOUND(1106000017,"未找到套餐"), PARAM_HOUSE_TYPE_ERROR(1106000017,"房型参数错误"), CUSTOMER_INFORMATION_NOT_FOUND(1106000018,"客户信息未找到"), QUOTE_ZERO(110600019, "材料数量不能为空"), DESIGN_NOT_FOUNT(110600020,"design is not exist") ; private final int errorCode; private final String errorMsg; QuoteErrorEnum(int errorCode, String errorMsg) { this.errorCode = errorCode; this.errorMsg = errorMsg; } public int getErrorCode() { return errorCode; } public String getErrorMsg() { return errorMsg; } public static QuoteErrorEnum valueOf(int errorCode) { for (QuoteErrorEnum eSpotsError : QuoteErrorEnum.values()) { if (eSpotsError.errorCode == errorCode) { return eSpotsError; } } throw new IllegalArgumentException("No matching constant for [" + errorCode + "]"); } @Override public String toString() { return Integer.toString(this.errorCode); } }
[ "liushuaishuai@gaodun.com" ]
liushuaishuai@gaodun.com
294dbf9f2ac7085463a25bccf7d7cf524a4d025d
3d735186899d41558b93bef2198f8af215b517eb
/app/src/main/java/com/geval6/praymate/Core/LaunchActivity.java
ded5639c929b6b1d78732565fc9723d19663d096
[]
no_license
pripriya/Praymate
d9e0e4aba0603a8f36f10b6ba19d0e3b47dc2a47
c2c0e3aeb6aef4a2f08a21585baac5d95b9e5f6a
refs/heads/master
2021-01-16T23:22:48.733781
2016-08-04T05:47:33
2016-08-04T05:47:33
64,904,876
0
0
null
null
null
null
UTF-8
Java
false
false
2,699
java
package com.geval6.praymate.Core; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; import com.geval6.praymate.R; public class LaunchActivity extends Activity { Boolean isInternetPresent; Button signInButton; Button signUpButton; /* renamed from: com.geval6.praymate.Core.LaunchActivity.1 */ class C02061 implements OnClickListener { final /* synthetic */ Context val$context; C02061(Context context) { this.val$context = context; } public void onClick(View arg0) { if (LaunchActivity.this.checkInternetConnection()) { LaunchActivity.this.startActivity(new Intent(this.val$context, SignInActivity.class)); return; } Toast.makeText(LaunchActivity.this, "Please check your Internet Connection", Toast.LENGTH_SHORT).show(); } } /* renamed from: com.geval6.praymate.Core.LaunchActivity.2 */ class C02072 implements OnClickListener { final /* synthetic */ Context val$context; C02072(Context context) { this.val$context = context; } public void onClick(View arg0) { if (LaunchActivity.this.checkInternetConnection()) { LaunchActivity.this.startActivity(new Intent(getApplicationContext(), SignUpActivity.class)); return; } Toast.makeText(LaunchActivity.this, "Please check your Internet Connection", Toast.LENGTH_SHORT).show(); } } public LaunchActivity() { this.isInternetPresent = Boolean.valueOf(false); } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launch); addListenerOnButton(); } public void addListenerOnButton() { this.signInButton = (Button) findViewById(R.id.signin_button); this.signInButton.setOnClickListener(new C02061(this)); this.signUpButton = (Button) findViewById(R.id.signup_button); this.signUpButton.setOnClickListener(new C02072(this)); } private boolean checkInternetConnection() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isAvailable() && cm.getActiveNetworkInfo().isConnected()) { return true; } return false; } }
[ "priya13thjan@.com" ]
priya13thjan@.com
d99a9853a139df77a5b610f17ea40747512b3bc7
ceeacb5157b67b43d40615daf5f017ae345816db
/generated/sdk/network/azure-resourcemanager-network-generated/src/main/java/com/azure/resourcemanager/network/generated/fluent/PrivateDnsZoneGroupsClient.java
13c28d8fbaf55cda98dcde9eeba3c1a70cf89848
[ "LicenseRef-scancode-generic-cla" ]
no_license
ChenTanyi/autorest.java
1dd9418566d6b932a407bf8db34b755fe536ed72
175f41c76955759ed42b1599241ecd876b87851f
refs/heads/ci
2021-12-25T20:39:30.473917
2021-11-07T17:23:04
2021-11-07T17:23:04
218,717,967
0
0
null
2020-11-18T14:14:34
2019-10-31T08:24:24
Java
UTF-8
Java
false
false
11,992
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.network.generated.fluent; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.generated.fluent.models.PrivateDnsZoneGroupInner; /** An instance of this class provides access to all the operations defined in PrivateDnsZoneGroupsClient. */ public interface PrivateDnsZoneGroupsClient { /** * Deletes the specified private dns zone group. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginDelete( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName); /** * Deletes the specified private dns zone group. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginDelete( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, Context context); /** * Deletes the specified private dns zone group. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName); /** * Deletes the specified private dns zone group. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, Context context); /** * Gets the private dns zone group resource by specified private dns zone group name. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private dns zone group resource by specified private dns zone group name. */ @ServiceMethod(returns = ReturnType.SINGLE) PrivateDnsZoneGroupInner get(String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName); /** * Gets the private dns zone group resource by specified private dns zone group name. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private dns zone group resource by specified private dns zone group name. */ @ServiceMethod(returns = ReturnType.SINGLE) Response<PrivateDnsZoneGroupInner> getWithResponse( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, Context context); /** * Creates or updates a private dns zone group in the specified private endpoint. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param parameters Parameters supplied to the create or update private dns zone group operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private dns zone group resource. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<PrivateDnsZoneGroupInner>, PrivateDnsZoneGroupInner> beginCreateOrUpdate( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, PrivateDnsZoneGroupInner parameters); /** * Creates or updates a private dns zone group in the specified private endpoint. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param parameters Parameters supplied to the create or update private dns zone group operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private dns zone group resource. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<PrivateDnsZoneGroupInner>, PrivateDnsZoneGroupInner> beginCreateOrUpdate( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, PrivateDnsZoneGroupInner parameters, Context context); /** * Creates or updates a private dns zone group in the specified private endpoint. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param parameters Parameters supplied to the create or update private dns zone group operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private dns zone group resource. */ @ServiceMethod(returns = ReturnType.SINGLE) PrivateDnsZoneGroupInner createOrUpdate( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, PrivateDnsZoneGroupInner parameters); /** * Creates or updates a private dns zone group in the specified private endpoint. * * @param resourceGroupName The name of the resource group. * @param privateEndpointName The name of the private endpoint. * @param privateDnsZoneGroupName The name of the private dns zone group. * @param parameters Parameters supplied to the create or update private dns zone group operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private dns zone group resource. */ @ServiceMethod(returns = ReturnType.SINGLE) PrivateDnsZoneGroupInner createOrUpdate( String resourceGroupName, String privateEndpointName, String privateDnsZoneGroupName, PrivateDnsZoneGroupInner parameters, Context context); /** * Gets all private dns zone groups in a private endpoint. * * @param privateEndpointName The name of the private endpoint. * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.network.generated.models.ErrorException thrown if the request is rejected by * server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private dns zone groups in a private endpoint. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<PrivateDnsZoneGroupInner> list(String privateEndpointName, String resourceGroupName); /** * Gets all private dns zone groups in a private endpoint. * * @param privateEndpointName The name of the private endpoint. * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.network.generated.models.ErrorException thrown if the request is rejected by * server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private dns zone groups in a private endpoint. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<PrivateDnsZoneGroupInner> list(String privateEndpointName, String resourceGroupName, Context context); }
[ "actions@github.com" ]
actions@github.com
71ea2549ee18ac6c16068040ee6287fbfc34fa75
bb34d1f3b4f4b8678c4f56b51e2b073adb156269
/Knockout/src/java/com/ifsp/edu/model/DAOFactory.java
de69140d5952b90c53ff3af195614e87706c1dc8
[]
no_license
danielfssz/sistemas-web-java
ca47e97fa9effb158014a38df76e6f6057c2b676
42eced30ede6327d73a63ee519cec147b8a42d2a
refs/heads/master
2021-07-18T21:11:29.498464
2018-12-08T18:33:26
2018-12-08T18:33:26
143,554,434
0
1
null
2018-08-18T16:52:06
2018-08-04T18:53:45
Java
UTF-8
Java
false
false
179
java
package com.ifsp.edu.model; public class DAOFactory { public static IProdutoDAO createProdutoDAO() throws ClassNotFoundException { return new ProdutoDAO(); } }
[ "daniel.souza@modalgr.com.br" ]
daniel.souza@modalgr.com.br
a2531b4a10ed2d32cb38e64bd23f89a7b2e9028d
05c4502432b1230ecb1c3dc231da4ad3c6df2c14
/src/main/java/com/mineiro/controleponto/model/Usuario.java
0874bc999ac2e90337605270946d5ed927437c33
[]
no_license
RVolpe/controleponto
f9f222fd02b588424de7e3208e96807ae5714bfa
0da9d8a4864cbce0bf23bfac727e30320428ef68
refs/heads/main
2023-06-22T14:46:24.621258
2021-07-22T23:53:41
2021-07-22T23:53:41
388,625,843
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.mineiro.controleponto.model; import lombok.*; import org.hibernate.envers.Audited; import javax.persistence.*; import java.math.BigDecimal; import java.time.LocalDateTime; @Getter @Setter @Entity @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode @Builder @Audited public class Usuario { @Id @GeneratedValue private long id; private String nome; @ManyToOne private CategoriaUsuario categoriaUsuario; @ManyToOne private Empresa empresa; @ManyToOne private NivelAcesso nivelAcesso; @ManyToOne private JornadaTrabalho jornadaTrabalho; private BigDecimal tolerancia; private LocalDateTime inicioJornada; private LocalDateTime finalJornada; }
[ "kild_ro@hotmail.com" ]
kild_ro@hotmail.com
aa222619ace8532ee92bfd8c8b8bde35b857b815
1e1e630cd6925050e444c8e358cf063c7d9d8bb6
/android/src/main/java/com/example/wechat_web_login_plugin/WechatWebLoginPlugin.java
6372af40ada0ad0453fab7f3fd2b43d14ed75427
[]
no_license
wslp0314/wechat_web_login_plugin
d271d6626aa2bc23f9716dad5efd044d87f4043d
5c9f71efed65647ab4fe66f1eb5ca94d69f495ba
refs/heads/master
2023-02-02T12:01:43.470993
2020-12-17T11:14:20
2020-12-17T11:14:20
321,368,858
0
0
null
null
null
null
UTF-8
Java
false
false
1,452
java
package com.example.wechat_web_login_plugin; import androidx.annotation.NonNull; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.PluginRegistry.Registrar; /** WechatWebLoginPlugin */ public class WechatWebLoginPlugin implements FlutterPlugin, MethodCallHandler { /// The MethodChannel that will the communication between Flutter and native Android /// /// This local reference serves to register the plugin with the Flutter Engine and unregister it /// when the Flutter Engine is detached from the Activity private MethodChannel channel; @Override public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "wechat_web_login_plugin"); channel.setMethodCallHandler(this); } @Override public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { if (call.method.equals("getPlatformVersion")) { result.success("Android " + android.os.Build.VERSION.RELEASE); } else { result.notImplemented(); } } @Override public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { channel.setMethodCallHandler(null); } }
[ "pu.liu@ivicar.cn" ]
pu.liu@ivicar.cn
3d7a3917c3e0a6e8e403c628556a0df52ee54573
166e018c2b5a14e3ef3707e11830fa7467a0b5f3
/basicOperate/src/main/java/datastream/sink/csvSink.java
93aa999219e4054eeca3ee43f258591cb5795bbb
[]
no_license
ZhiYinZhang/flinkStudy
cfa19aef245e5ace7e24118fbd5c576983dc6327
e0267c2976e536c843558753a6485f9b2d54e3e9
refs/heads/main
2023-07-18T06:42:18.282991
2021-08-25T01:20:07
2021-08-25T01:20:07
309,223,319
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package datastream.sink; import org.apache.flink.api.common.typeinfo.Types; import org.apache.flink.api.java.tuple.Tuple1; import org.apache.flink.core.fs.FileSystem; import org.apache.flink.streaming.api.datastream.DataStreamSource; import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.util.Collector; import java.util.Arrays; public class csvSink { public static void main(String[] args) throws Exception{ StreamExecutionEnvironment senv = StreamExecutionEnvironment.getExecutionEnvironment(); // DataStreamSource<Long> nums = senv.fromSequence(1, 10); DataStreamSource<String> lines = senv.socketTextStream("localhost", 9999); SingleOutputStreamOperator<String> words = lines.flatMap((String line, Collector<String> out) -> Arrays.stream(line.split(",")).forEach(out::collect) ).returns(Types.STRING); words.map(x-> Tuple1.of(x)).returns(Types.TUPLE(Types.STRING)) .writeAsCsv("e://test//flinkData//csv", FileSystem.WriteMode.OVERWRITE); words.startNewChain(); words.disableChaining(); senv.execute(); } }
[ "2454099127@qq.com" ]
2454099127@qq.com
24923049e493a79662a5ee20262e5099cf1ae241
ae8a729a409ebc968744a341f0196347417dd268
/java8/ip-treatment-offering/src/main/java/com/cts/iptms/model/PackageDetail.java
2a6c817d119856ec5e4b83945155586e2da0e8c2
[]
no_license
Vineet2408/PODNOSwagger
b914809d51b98d6ae18d21f8d8c269e02d123ed0
897a3fa3052a12883be46518a0015ac05e3ca713
refs/heads/master
2023-03-17T13:53:36.044995
2021-03-12T14:19:42
2021-03-12T14:19:42
347,090,065
0
0
null
null
null
null
UTF-8
Java
false
false
1,395
java
package com.cts.iptms.model; import javax.persistence.Embeddable; @Embeddable public class PackageDetail { private String treatmentPackageName; private String testDetails; private int cost; private int treatmentDuration; @Override public String toString() { return "PackageDetail [treatmentPackageName=" + treatmentPackageName + ", testDetails=" + testDetails + ", cost=" + cost + ", treatmentDuration=" + treatmentDuration + "]"; } public String getTreatmentPackageName() { return treatmentPackageName; } public void setTreatmentPackageName(String treatmentPackageName) { this.treatmentPackageName = treatmentPackageName; } public String getTestDetails() { return testDetails; } public void setTestDetails(String testDetails) { this.testDetails = testDetails; } public int getCost() { return cost; } public void setCost(int cost) { this.cost = cost; } public int getTreatmentDuration() { return treatmentDuration; } public void setTreatmentDuration(int treatmentDuration) { this.treatmentDuration = treatmentDuration; } public PackageDetail(String treatmentPackageName, String testDetails, int cost, int treatmentDuration) { super(); this.treatmentPackageName = treatmentPackageName; this.testDetails = testDetails; this.cost = cost; this.treatmentDuration = treatmentDuration; } public PackageDetail() { super(); } }
[ "vineetd84@gmail.com" ]
vineetd84@gmail.com
66fec82b13f1133f65882ba14834d5eff742aedf
f2bd083ebc26faa924f563f3db5685e75ef93f71
/tddl-rule/src/main/java/com/taobao/tddl/rule/impl/groovy/GroovyStaticMethod.java
88f70f8399f0970d99d55e4fdccba2f60584e569
[ "Apache-2.0" ]
permissive
hejianzxl/TDDL-1
bf942c10d8e42d4a8f3e3eadb0c262fcaa03f299
33ab99c37ae8b927f1cd3294d1ec8aa31b71c84b
refs/heads/master
2022-07-01T08:56:47.798878
2015-08-18T02:55:16
2015-08-18T02:55:16
144,922,536
0
0
Apache-2.0
2022-06-21T04:20:21
2018-08-16T01:48:15
Java
UTF-8
Java
false
false
10,074
java
package com.taobao.tddl.rule.impl.groovy; import java.util.Calendar; import java.util.Date; import com.taobao.tddl.common.utils.thread.ThreadLocalMap; /** * 可直接用于groovy规则中的便捷方法 * * @author shenxun * @author linxuan */ public class GroovyStaticMethod { public static final String GROOVY_STATIC_METHOD_CALENDAR = "GROOVY_STATIC_METHOD_CALENDAR"; private final static long[] pow10 = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000L, 100000000000L, 1000000000000L, 10000000000000L, 100000000000000L, 1000000000000000L, 10000000000000000L, 100000000000000000L, 1000000000000000000L }; /** * @return 返回4位年份 */ public static int yyyy(Date date) { Calendar cal = getCalendar(date); return cal.get(Calendar.YEAR); } public static int yyyy(Calendar cal) { return cal.get(Calendar.YEAR); } /** * @return 返回2位年份(年份的后两位) */ public static int yy(Date date) { Calendar cal = getCalendar(date); return cal.get(Calendar.YEAR) % 100; } public static int yy(Calendar cal) { return cal.get(Calendar.YEAR) % 100; } /** * @return 返回月份数字,注意:从1开始:1-12(返回 Calendar.MONTH对应的值加1) */ public static int month(Date date) { Calendar cal = getCalendar(date); return cal.get(Calendar.MONTH) + 1; } public static int month(Calendar cal) { return cal.get(Calendar.MONTH) + 1; } /** * @return 返回2位的月份字串,从01开始:01-12(Calendar.MONTH对应的值加1) */ public static String mm(Date date) { Calendar cal = getCalendar(date); int m = cal.get(Calendar.MONTH) + 1; return m < 10 ? "0" + m : String.valueOf(m); } public static String mm(Calendar cal) { int m = cal.get(Calendar.MONTH) + 1; return m < 10 ? "0" + m : String.valueOf(m); } /** * @return 返回 Calendar.DAY_OF_WEEK 对应的值 */ public static int week(Date date) { Calendar cal = getCalendar(date); return cal.get(Calendar.DAY_OF_WEEK); } public static int week(Calendar cal) { return cal.get(Calendar.DAY_OF_WEEK); } /** * 旧规则默认的dayofweek : 如果offset = 0;那么为默认 SUNDAY=1; MONDAY=2; TUESDAY=3; * WEDNESDAY=4; THURSDAY=5; FRIDAY=6; SATURDAY=7; */ public static int dayofweek(Date date, int offset) { Calendar cal = getCalendar(date); return cal.get(Calendar.DAY_OF_WEEK) + offset; } public static int dayofweek(Calendar cal, int offset) { return cal.get(Calendar.DAY_OF_WEEK) + offset; } /** * 旧规则的dayofweek.因为旧规则计算结果为数组下标,尤其表规则结果是库内表数组下标,必须从0开始, 因此必须让day of week从0 * 开始。通过直接offset = -1 解决:星期日=0,星期一=1,...星期六=6 */ public static int dayofweek(Date date) { return dayofweek(date, -1); } public static int dayofweek(Calendar cal) { return dayofweek(cal, -1); } /** * @return 返回4位年份和2位月份的字串,月份从01开始:01-12 */ public static String yyyymm(Date date) { Calendar cal = getCalendar(date); return yyyy(cal) + mm(cal); } public static String yyyymm(Calendar cal) { return yyyy(cal) + mm(cal); } /** * @return 返回 4位年份_2位月份 的字串,月份从01开始:01-12 */ public static String yyyy_mm(Date date) { Calendar cal = getCalendar(date); return yyyy(cal) + "_" + mm(cal); } public static String yyyy_mm(Calendar cal) { return yyyy(cal) + "_" + mm(cal); } /** * @return 返回2位年份和2位月份的字串,月份从01开始:01-12 */ public static String yymm(Date date) { Calendar cal = getCalendar(date); return yy(cal) + mm(cal); } public static String yymm(Calendar cal) { return yy(cal) + mm(cal); } /** * @return 返回 2位年份_2位月份 的字串,月份从01开始:01-12 */ public static String yy_mm(Date date) { Calendar cal = getCalendar(date); return yy(cal) + "_" + mm(cal); } public static String yy_mm(Calendar cal) { return yy(cal) + "_" + mm(cal); } /** * @return 返回 Calendar.DATE 对应的值。每月的1号值为1, 2号值为2... */ public static int date(Date date) { Calendar cal = getCalendar(date); return cal.get(Calendar.DATE); } public static int date(Calendar cal) { return cal.get(Calendar.DATE); } @SuppressWarnings("unused") private static Calendar getCalendar(Calendar c) { return c; } private static Calendar getCalendar(Date date) { Calendar cal = (Calendar) ThreadLocalMap.get(GROOVY_STATIC_METHOD_CALENDAR); if (cal == null) { cal = Calendar.getInstance(); ThreadLocalMap.put(GROOVY_STATIC_METHOD_CALENDAR, cal); } cal.setTime(date); return cal; } /** * @param bit 补齐后的长度 * @param table 数值 * @return 返回前面补0达到bit长度的字符串。如果table长度大于bit,则返回table的原始值 */ public static String placeHolder(int bit, long table) { if (bit > 18) { throw new IllegalArgumentException("截取的位数不能大于18位"); } if (table == 0) { // bugfix 被0除 return String.valueOf(pow10[bit]).substring(1); } if (table >= pow10[bit - 1]) { // 当数值的width >= 要求的补齐位数时,应该直接返回原始数值 return String.valueOf(table); } long max = pow10[bit]; long placedNumber = max + table; return String.valueOf(placedNumber).substring(1); } @SuppressWarnings("unused") private static long getModRight(long targetID, int size, int bitNumber) { if (bitNumber < size) { throw new IllegalArgumentException("输入的位数比要求的size还小"); } return (size == 0 ? 0 : targetID / pow10[bitNumber - size]); } /** * 从左开始,取指定多的位数。默认是一个long形长度的数据,也就是bitNumber= 19 * * @param targetID 目标id,也就是等待被decode的数据 * @param st 从哪儿开始取,如果想取最左边的一位那么可以输入st = 0;ed =1; * @param ed 取到哪儿,如果想取最左边的两位,那么可以输入st = 0;ed = 2; * @return */ // public static long leftBetween(long targetID,int st,int ed){ // int sizeAll = st + ed - 1; // if(sizeAll >= 19||sizeAll <= 0){ // throw new IllegalArgumentException("截取19位请直接使用元数据。"); // } // if(targetID / pow10[sizeAll] < 1){ // throw new IllegalArgumentException(targetID+",小于"+(st+ed)+"位,不能进行计算"); // } // long end = getModRight(targetID, ed,19); // return end % pow10[(ed-st)]; // } public static int quarter(Date date) { Calendar cal = getCalendar(date); int month = cal.get(Calendar.MONTH); return quarter(month); } public static int quarter(long month) { return quarter((int) month); } public static int halfayear(long month) { return halfayear((int) month); } public static int quarter(int month) { if (month > 11 || month < 0) { throw new IllegalArgumentException("month range is 1~12"); } return month / 3 + 1; } public static int halfayear(Date date) { Calendar cal = getCalendar(date); int month = cal.get(Calendar.MONTH); return halfayear(month); } public static int halfayear(int month) { if (month > 11 || month < 0) { throw new IllegalArgumentException("month range is 1~12,current value is " + month); } return month / 6 + 1; } /** * 从右开始,取指定多的位数。 假如参数是1234567.那么rightBetwen(1234567,2,3) 返回的数据是 345 * rightBetween(10000234,2,2) 返回的数据是2 rightBetween(10000234,3,2) 返回的数据是0 * * @param targetID 目标id,也就是等待被decode的数据 * @param closeFrom 从哪儿开始取,如果想取最右边的一位那么可以输入st = 0;ed =1; * @param openTo 取到哪儿,如果想取最右边的两位,那么可以输入st = 0;ed = 2; * @throws IllegalArgumentException 如果st+ed -1 >= 19,这时候对long来说不需要截取。 * 如果targetId小于st+ed, * @return */ public static long rightCut(long targetID, int closeFrom, int openTo) { int sizeAll = closeFrom + openTo - 1; if (sizeAll >= 19 || sizeAll < 0) { throw new IllegalArgumentException("截取19位请直接使用元数据。"); } long right = targetID / pow10[(closeFrom)]; right = right % pow10[openTo]; return right; } public static long right(long targetID, int size) { if (size >= 19 || size < 0) { throw new IllegalArgumentException("截取19位请直接使用元数据。"); } return targetID % pow10[size]; } public static void validate(long targetID, int size) { if (targetID / pow10[size - 1] < 1) { throw new IllegalArgumentException(targetID + ",小于" + (size) + "位,不能进行计算"); } } public static String right(String right, int rightLength) { int length = right.length(); int start = length - rightLength; return right.substring(start < 0 ? 0 : start); } }
[ "jianghang115@gmail.com" ]
jianghang115@gmail.com
9bafa5b90fca7e4fadfa6fb09fcff9e0c93fe822
8e020e1dee6c5dd16aecf12693c85c598a5d6124
/miracle-rpc-core/src/main/java/com/miraclebay/miracle/rpc/core/config/CustomShutdownHook.java
b7cfe2e947f96a0f5d2e3aeb15f745a0d38478dc
[]
no_license
miraclebay/miracle-rpc
6c0c7e5d22918e905871374a0f3f8efe9ac15723
4d49b7f96001e26cb21b4ef54aa36426bb28ade4
refs/heads/main
2023-06-26T09:55:56.782612
2021-08-03T06:29:29
2021-08-03T06:29:29
386,564,775
0
0
null
2021-08-03T06:26:47
2021-07-16T08:25:15
null
UTF-8
Java
false
false
1,242
java
package com.miraclebay.miracle.rpc.core.config; import com.miraclebay.miracle.rpc.common.utils.concurrent.threadpool.ThreadPoolFactoryUtils; import com.miraclebay.miracle.rpc.core.registry.zk.util.CuratorUtils; import com.miraclebay.miracle.rpc.core.remoting.transport.netty.server.NettyRpcServer; import lombok.extern.slf4j.Slf4j; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; /** * @author dangyong */ @Slf4j public class CustomShutdownHook { private static final CustomShutdownHook CUSTOM_SHUTDOWN_HOOK = new CustomShutdownHook(); public static CustomShutdownHook getCustomShutdownHook(){ return CUSTOM_SHUTDOWN_HOOK; } public void clearAll(){ log.info("addShutdownHook for clear"); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try{ InetSocketAddress inetSocketAddress = new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), NettyRpcServer.PORT); CuratorUtils.clearRegistry(CuratorUtils.getZkClient(), inetSocketAddress); }catch (UnknownHostException ignored){ } ThreadPoolFactoryUtils.shutDownAllThreadPool(); })); } }
[ "dangyong.dy@alibaba-inc.com" ]
dangyong.dy@alibaba-inc.com
0b8f42a15d0ba9b0a33db18cf41a74f12fd8b3cd
4ef431684e518b07288e8b8bdebbcfbe35f364e4
/fld/tas-tests/test-core/src/main/java/com/ca/apm/systemtest/fld/role/GeolocationLoadRole.java
7a067be7e0f9d07bc16b5658bb39e2a36e6cd2bc
[]
no_license
Sarojkswain/APMAutomation
a37c59aade283b079284cb0a8d3cbbf79f3480e3
15659ce9a0030c2e9e5b992040e05311fff713be
refs/heads/master
2020-03-30T00:43:23.925740
2018-09-27T23:42:04
2018-09-27T23:42:04
150,540,177
0
0
null
null
null
null
UTF-8
Java
false
false
6,476
java
package com.ca.apm.systemtest.fld.role; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.aether.artifact.DefaultArtifact; import com.ca.apm.automation.action.flow.commandline.RunCommandFlowContext; import com.ca.apm.automation.action.flow.utility.FileModifierFlow; import com.ca.apm.automation.action.flow.utility.FileModifierFlowContext; import com.ca.apm.automation.action.flow.utility.GenericFlow; import com.ca.apm.automation.action.flow.utility.GenericFlowContext; import com.ca.tas.builder.BuilderBase; import com.ca.tas.client.IAutomationAgentClient; import com.ca.tas.resolver.ITasResolver; import com.ca.tas.role.AbstractRole; /** * Geo Location Load Script for EM FLD. This role should be added to any of the * one FLD TIM machine. So that the btstat files are generated and placed in * tim/out/data/btstats folder. * * Usage: new GeolocationLoadRole.LinuxBuilder(ROLE_ID, * tasResolver).dbHost("flddb01") * .dbPort(5432).dbAdmin("admin").dbPassword("quality") * .dbName("cemdb").build(); * * @author banra06@ca.com */ public class GeolocationLoadRole extends AbstractRole { private String installDir; private ITasResolver tasResolver; public static final String GEOLOCATION_START_LOAD = "geoloadStart"; public static final String GEOLOCATION_STOP_LOAD = "geoloadStop"; private static final String COMMAND = "yum"; private String dbHost; private int dbPort; private String dbAdmin; private String dbPassword; private String dbName; protected GeolocationLoadRole(Builder builder) { super(builder.roleId, builder.getEnvProperties()); this.tasResolver = builder.tasResolver; this.installDir = builder.installDir; this.dbHost = builder.dbHost; this.dbPort = builder.dbPort; this.dbAdmin = builder.dbAdmin; this.dbPassword = builder.dbPassword; this.dbName = builder.dbName; } @Override public void deploy(IAutomationAgentClient aaClient) { getArtifacts(aaClient); updateDBHostName(aaClient); installYumPackages(aaClient); createStartPython(aaClient); createKillPython(aaClient); } private void updateDBHostName(IAutomationAgentClient aaClient) { Map<String, String> updateArgs = new HashMap<String, String>(); updateArgs.put("flddb01", dbHost); updateArgs.put("5432", Integer.toString(dbPort)); updateArgs.put("uid='admin'", "uid='" + dbAdmin + "'"); updateArgs.put("pwd='quality'", "pwd='" + dbPassword + "'"); updateArgs.put("cemdb", dbName); FileModifierFlowContext updateHost = new FileModifierFlowContext.Builder() .replace(installDir + "demo.py", updateArgs).build(); runFlow(aaClient, FileModifierFlow.class, updateHost); } private void installYumPackages(IAutomationAgentClient aaClient) { List<String> arguments = new ArrayList<>(); arguments.add("install"); arguments.add("-y"); arguments.add("pyodbc.x86_64"); arguments.add("python-psycopg2.x86_64"); RunCommandFlowContext runCmdFlowContext = new RunCommandFlowContext.Builder( COMMAND).args(arguments).build(); runCommandFlow(aaClient, runCmdFlowContext); } private void createKillPython(IAutomationAgentClient aaClient) { Collection<String> createSHFile = Arrays .asList("kill $(ps aux | grep '[p]ython2.6 demo.py' | awk '{print $2}')"); FileModifierFlowContext killSh = new FileModifierFlowContext.Builder() .create(installDir + "/killGeo.sh", createSHFile).build(); runFlow(aaClient, FileModifierFlow.class, killSh); } private void getArtifacts(IAutomationAgentClient aaClient) { URL url = tasResolver.getArtifactUrl(new DefaultArtifact( "com.ca.apm.binaries", "fld", "fld", "tar.gz", "1.0")); GenericFlowContext getAgentContext = new GenericFlowContext.Builder() .artifactUrl(url).destination(installDir).build(); runFlow(aaClient, GenericFlow.class, getAgentContext); } private void createStartPython(IAutomationAgentClient aaClient) { Collection<String> createSHFile = Arrays.asList("cd " + installDir, "nohup /usr/bin/python2.6 demo.py > out.log 2>&1 &"); FileModifierFlowContext kickoffSH = new FileModifierFlowContext.Builder() .create(installDir + "/runGeo.sh", createSHFile).build(); runFlow(aaClient, FileModifierFlow.class, kickoffSH); } public static class LinuxBuilder extends Builder { public LinuxBuilder(String roleId, ITasResolver tasResolver) { super(roleId, tasResolver); } } public static class Builder extends BuilderBase<Builder, GeolocationLoadRole> { private final String roleId; private final ITasResolver tasResolver; protected String installDir = "/opt/geolocation/"; protected String dbHost = "localhost"; protected int dbPort = 5432; protected String dbAdmin = "admin"; protected String dbPassword = "quality"; protected String dbName = "cemdb"; public Builder(String roleId, ITasResolver tasResolver) { this.roleId = roleId; this.tasResolver = tasResolver; } @Override public GeolocationLoadRole build() { // TODO Auto-generated method stub startGeoLoad(); stopGeoLoad(); return getInstance(); } @Override protected GeolocationLoadRole getInstance() { // TODO Auto-generated method stub return new GeolocationLoadRole(this); } @Override protected Builder builder() { // TODO Auto-generated method stub return this; } public Builder installDir(String installDir) { this.installDir = installDir; return builder(); } public Builder dbHost(String dbHost) { this.dbHost = dbHost; return builder(); } public Builder dbPort(int dbPort) { this.dbPort = dbPort; return builder(); } public Builder dbAdmin(String dbAdmin) { this.dbAdmin = dbAdmin; return builder(); } public Builder dbName(String dbName) { this.dbName = dbName; return builder(); } public Builder dbPassword(String dbPassword) { this.dbPassword = dbPassword; return builder(); } private void startGeoLoad() { RunCommandFlowContext runCmdFlowContext = new RunCommandFlowContext.Builder( "runGeo.sh").workDir(installDir).build(); getEnvProperties().add(GEOLOCATION_START_LOAD, runCmdFlowContext); } private void stopGeoLoad() { RunCommandFlowContext runCmdFlowContext = new RunCommandFlowContext.Builder( "killGeo.sh").workDir(installDir).build(); getEnvProperties().add(GEOLOCATION_STOP_LOAD, runCmdFlowContext); } } }
[ "sarojkswain@gmail.com" ]
sarojkswain@gmail.com
88dc4eaac184221e6aa9c4aa2a2f9065f42f5527
b7056190961b18fad2c9073bbc3e69fb2c8eae5a
/embs-core/src/main/java/net/securustech/embs/util/EMBSRetryableException.java
8e9f2852869475628c2022ff160f706889991917
[]
no_license
hariharnarayanan/core
40fe1ebda3e53ecace06bb55f0413df3d5318e52
1a33b07fb00ab593c67d8c7bfbc314d3c13354cf
refs/heads/master
2023-01-24T17:28:03.619252
2020-11-30T20:45:32
2020-11-30T20:45:32
314,325,512
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
package net.securustech.embs.util; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.stereotype.Component; @Getter @Setter @NoArgsConstructor @Component public class EMBSRetryableException extends Exception { private String embsErrorCode; private String embsErrorMessage; public EMBSRetryableException(String originalErrorMessage) { super(originalErrorMessage); } public EMBSRetryableException(String originalErrorMessage, String embsErrorCode, String embsErrorMessage) { super(originalErrorMessage + "\nEMBSError Code :-> " + embsErrorCode + "\nEMBS Error Message :-> " + embsErrorMessage); this.embsErrorCode = embsErrorCode; this.embsErrorMessage = embsErrorMessage; } }
[ "hnarayanan@securustechnologies.com" ]
hnarayanan@securustechnologies.com
f83cf64325ed7c14f4d3ed35e9990f670b16d1ee
ca97a7318b16c29dfbe81ab621afd1718fa48ad1
/netty-rpc-demo/springboot-websocket/src/main/java/cn/v5cn/springboot/websocket/handler/SendToOneHandler.java
bd32397ca704aa657b7606f81e4a99fdf001db54
[]
no_license
zyw/springcloud-common
61994a9a91d0403098f4118ceaedf093afdc06e2
3c5dbe33844c1009e7ed625a93199effd21f1f20
refs/heads/master
2022-05-20T21:41:50.984381
2022-05-19T01:16:18
2022-05-19T01:16:18
200,951,573
1
2
null
2020-07-02T00:09:19
2019-08-07T01:47:37
Java
UTF-8
Java
false
false
1,222
java
package cn.v5cn.springboot.websocket.handler; import cn.v5cn.springboot.websocket.message.SendResponse; import cn.v5cn.springboot.websocket.message.SendToOneRequest; import cn.v5cn.springboot.websocket.message.SendToUserRequest; import cn.v5cn.springboot.websocket.util.WebSocketUtil; import org.springframework.stereotype.Component; import org.springframework.web.socket.WebSocketSession; @Component public class SendToOneHandler implements MessageHandler<SendToOneRequest> { @Override public void execute(WebSocketSession session, SendToOneRequest message) { // 这里,假装直接成功 SendResponse response = new SendResponse(); response.setMsgId(message.getMsgId()); response.setCode(0); WebSocketUtil.send(session, SendResponse.TYPE, response); // 创建转发的消息 SendToUserRequest toUserRequest = new SendToUserRequest(); toUserRequest.setMsgId(message.getMsgId()); toUserRequest.setContent(message.getContent()); //发送消息 WebSocketUtil.send(message.getToUser(), SendToUserRequest.TYPE, toUserRequest); } @Override public String getType() { return SendToOneRequest.TYPE; } }
[ "zyw090111@163.com" ]
zyw090111@163.com
5e31ec14e3b57108ad3ded29bcb7acf29ed61501
44b643894e3ccf08c664306da46219e074116f6c
/JavaApplication-POO/src/javaAppAbstractClass/AbstractImage2.java
34f98bdba2d5142a75843b1945d11deb1c3bfd91
[]
no_license
deisekinsk/learnJAVA-part2
40c3ddcefb10875889f8edbd8e7f1c31b32f89a2
3b12b86912cd7cc66cda425236c5f595f20f9c57
refs/heads/main
2023-05-19T23:26:58.196389
2021-06-12T19:13:02
2021-06-12T19:13:02
375,007,564
1
0
null
null
null
null
UTF-8
Java
false
false
150
java
package javaAppAbstractClass; /** * * @author Deise Kinsk */ public abstract class AbstractImage2 { abstract public void draw(); }
[ "kinsk@msn.com" ]
kinsk@msn.com
815f30097584100dfd347054ba77ee57470d70e5
fdf49f10afe49c2cbf998538ffca4f98a55ad2a1
/src/main/java/com/schedule/config/ThreadPoolCache.java
86746f26902a61aa93c3c239f1e13f8358645d97
[]
no_license
gwy572294624/schedule-demo
196ea2127edd6dc85eca7a513e4bf3775e120269
266ccb1c9e9a04906e27a8ba9bc711b090334a49
refs/heads/main
2023-03-06T18:08:32.891472
2021-02-18T04:20:58
2021-02-18T04:20:58
336,457,985
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package com.schedule.config; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @Author * @Date 2021/2/6 下午12:23 * @Version 1.0 * @Remarks */ public class ThreadPoolCache { public static class InitThreadPoolCache{ public static ExecutorService executorService = Executors.newCachedThreadPool(); } }
[ "gyy@auc2.com" ]
gyy@auc2.com
d7c5cfd831744c2d25fec95a4e63ddd3fd525197
bd153e2968e708399560c728be33cd25f95fe179
/src/main/java/com/example/lede2/DatabaseObject.java
04fa93a4dd8053ae0aee7d83d780c99cf3049331
[]
no_license
kct456/PLRG-Vigilia
1c29577e2ce9ba08263bcca5daf7a23f7873565e
4965a0b386891f89b47897adead6709d23912e8c
refs/heads/master
2020-03-23T21:06:39.367774
2018-07-24T00:22:56
2018-07-24T00:22:56
142,082,084
0
0
null
null
null
null
UTF-8
Java
false
false
1,231
java
package com.example.lede2; import android.provider.ContactsContract; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Set; /** * Created by Brian on 2/28/2018. */ /*hierarchy of this object is dbobject -> dbtypeobject -> dbsubtypeobject dbobject holds a hashtable of typeobject and typeobject holds a hashtable of subtypeobject structure is similar across all levels, subtype obejct also holds the individual instances */ public class DatabaseObject { private int numTypes; Hashtable<String, DatabaseTypeObject> types; public DatabaseObject(){ numTypes = 0; types = new Hashtable<String, DatabaseTypeObject>(); } public void addTypeObject(String name, DatabaseTypeObject typeObject){ if(!types.contains(name)){ types.put(name, typeObject); numTypes++; } } public void deleteTypeObject(String name){ if(types.contains(name)){ types.remove(name); numTypes--; } } public DatabaseTypeObject getTypeObject(String name){ return types.get(name); } public Set<String> getKeySet(){ return types.keySet(); } }
[ "kctruon1@uci.edu" ]
kctruon1@uci.edu
81b4f73b5c43814532703fb37b1a61558c67b3b6
5870aca25aa69d8298b6d54534fa05e05ff3ba2c
/src/main/java/com/rongzer/demo/statemachine/state/PollingCheckStates.java
1fcb9457dd4a40a0f7fc6c302d5521f1f83827fe
[]
no_license
ysglyl/learn-spring-state-machine
0dc7ef18866e53503ebc00fde3d439930137ca51
4f305c1618289f16cd5fe5a0dcf5a281b9e47433
refs/heads/master
2022-06-23T00:28:04.675444
2019-10-11T01:12:06
2019-10-11T01:12:06
214,314,863
0
0
null
2022-06-17T02:33:23
2019-10-11T01:10:11
Java
UTF-8
Java
false
false
125
java
package com.rongzer.demo.statemachine.state; public enum PollingCheckStates { INIT, PLAN, RUNNING, FINISH }
[ "yushigui1990@foxmail.com" ]
yushigui1990@foxmail.com
f31d60736d17377997f882bf69ca2b2d04b2afb7
98112c1aa663dfcb5b5e44ffd96c1615d104b708
/Programmer_en_JAVA_edition_9/CodeSource_ProgJava9e/chap07/Tab2ind1.java
77cfa35a02260050ad5683ad83f2d47b0d1490cf
[]
no_license
Lexriel/POO
4744b9e6648d48bdd5795a888ceac73047acd7be
eec76ea2f02f7e2585a96472815419834cec791d
refs/heads/master
2021-08-07T19:02:29.043889
2017-11-08T19:10:42
2017-11-08T19:10:42
110,018,766
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
class Util { static void raz (int t[] []) { int i, j ; for (i= 0 ; i<t.length ; i++) // for... each non applicable ici for (j=0 ; j<t[i].length ; j++) // puisque modification des valeurs de t t[i] [j] = 0 ; } static void affiche (int t[] []) { int i, j ; for (i= 0 ; i<t.length ; i++) { System.out.print ("ligne de rang " + i + " = ") ; for (j=0 ; j<t[i].length ; j++) // pour utiliser for... each System.out.print (t[i] [j] + " ") ; // voir paragraphe suivant System.out.println() ; } } } public class Tab2ind1 { public static void main (String args[]) { int t[] [] = { {1, 2, 3}, {11, 12}, {21, 22, 23, 24} } ; System.out.println ("t avant raz : ") ; Util.affiche(t) ; Util.raz(t) ; System.out.println ("t apres raz : ") ; Util.affiche(t) ; } }
[ "a.temperville@ed.univ-lille1.fr" ]
a.temperville@ed.univ-lille1.fr
ba243b28d8411fb322e9b7b381a8a917967281ca
0469c9f27b8505be67e5cb6d02c775bef6c550b2
/src/main/java/lt/lb/ot/task1/factories/ClassContructorFactory.java
b46bf7368b10a341118c57033d408d1839489040
[]
no_license
laim0nas100/OT
8b99a45819dd62b18dc47dc70badf82dfda5d810
0a9a667c9bc289adbeea2bf51e56e062da8b1944
refs/heads/master
2022-06-25T13:49:55.888134
2019-05-30T08:40:11
2019-05-30T08:40:11
184,101,137
0
0
null
2022-05-25T06:29:39
2019-04-29T15:56:11
Java
UTF-8
Java
false
false
800
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 lt.lb.ot.task1.factories; import java.lang.reflect.Constructor; import java.util.function.Supplier; import lt.lb.commons.F; import lt.lb.ot.task1.Product; /** * * @author Lemmin */ public class ClassContructorFactory<T extends Product> implements Supplier<T> { private Constructor<T> con; public ClassContructorFactory(Class<T> cls) { con = F.unsafeCall(cls::getDeclaredConstructor); // get default constructor with suppressed and wrapped excpetion } @Override public T get() { return F.unsafeCall(con::newInstance); } }
[ "aciukadsiunciate@gmail.com" ]
aciukadsiunciate@gmail.com
154abc903fe98adecfe88a5fbe1563b2dfca34ab
8cd5881d1ab59072f946634539ae5f1f5a336988
/src/test/java/com/madrascoder/cucumberbooksample/stepdefinitions/AdditionStepDefinitions.java
a3fe5c622af1de7395a06b7eec9177a7d8eea8f9
[]
no_license
bcarun/cucumber-book
6f2ab71b20745955615271e13cc5319cb43649a6
88e65f60b890ddef0582f8665f770b60cbdf26fe
refs/heads/main
2023-04-07T12:17:33.968301
2021-04-13T16:21:43
2021-04-13T16:21:43
357,616,626
1
0
null
null
null
null
UTF-8
Java
false
false
888
java
package com.madrascoder.cucumberbooksample.stepdefinitions; import static org.assertj.core.api.Assertions.assertThat; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; public class AdditionStepDefinitions { private int firstNumber; private int secondNumber; private int calculatedSum; @Given("first number is {int}") public void firstNumberIs(int firstNumber) { this.firstNumber = firstNumber; } @And("second number is {int}") public void secondNumberIs(int secondNumber) { this.secondNumber = secondNumber; } @When("user executes sum function") public void userExecutesSumFunction() { calculatedSum = firstNumber + secondNumber; } @Then("the sum is {int}") public void theSumIs(int expectedSum) { assertThat(calculatedSum).isEqualTo(expectedSum); } }
[ "achandrasekaran@wfscorp.com" ]
achandrasekaran@wfscorp.com
7ac269b789204e46828e61872d539e9fb9182512
ef79cade5cb031dc5862994e56aaedfbcc082938
/src/main/java/com/ghsong/security/account/AccountRepository.java
c0a4c263d322311d56424d0f1147e7b69c3d4123
[]
no_license
sgoho01/Srping-Security
bf8902be1df243badc3117296387ae9bf14e4514
f60bfae6832c5831a0b8261d892668c8a0baf7de
refs/heads/master
2022-09-06T09:09:12.993851
2020-05-22T07:12:13
2020-05-22T07:12:13
266,042,483
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.ghsong.security.account; import org.springframework.data.jpa.repository.JpaRepository; public interface AccountRepository extends JpaRepository<Account, Long> { Account findByEmail(String email); }
[ "song6497@gmail.com" ]
song6497@gmail.com
8efbba3a533dbac7b6efd47f4ad624e8cc29564a
de3eb812d5d91cbc5b81e852fc32e25e8dcca05f
/tags/3.0.0-r2079/CruxWidgets/src/br/com/sysmap/crux/widgets/client/dynatabs/Tab.java
e9fbee8e2cdda003025f84045fc37f3ecb79a969
[]
no_license
svn2github/crux-framework
7dd52a951587d4635112987301c88db23325c427
58bcb4821752b405a209cfc21fb83e3bf528727b
refs/heads/master
2016-09-06T13:33:41.975737
2015-01-22T08:03:25
2015-01-22T08:03:25
13,135,398
0
0
null
null
null
null
ISO-8859-2
Java
false
false
2,594
java
/* * Copyright 2009 Sysmap Solutions Software e Consultoria Ltda. * * 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 br.com.sysmap.crux.widgets.client.dynatabs; import br.com.sysmap.crux.widgets.client.event.focusblur.BeforeBlurHandler; import br.com.sysmap.crux.widgets.client.event.focusblur.BeforeFocusEvent; import br.com.sysmap.crux.widgets.client.event.focusblur.BeforeFocusHandler; import br.com.sysmap.crux.widgets.client.event.focusblur.HasBeforeFocusAndBeforeBlurHandlers; import com.google.gwt.event.shared.HandlerRegistration; /** * TODO - Gessé - Comment * * @author Gessé S. F. Dafé */ public class Tab extends AbstractTab implements HasBeforeFocusAndBeforeBlurHandlers { private FlapPanel flapPanel; private boolean closeable; private int insertionIndex; private String label; /** * Constructor * * @param id * @param label * @param url * @param closeable * @param reloadIfExists */ Tab(String id, String label, String url, boolean closeable, int insertionIndex, FlapPanel flapPanel) { super(id, url); this.label = label; this.insertionIndex = insertionIndex; this.flapPanel = flapPanel; this.closeable = closeable; } /** * @param label the label to set */ public void setLabel(String label) { this.label = label; this.flapPanel.getFlapController().setTabTitle(label); } /** * @return the label */ public String getLabel() { return label; } public HandlerRegistration addBeforeFocusHandler(BeforeFocusHandler handler) { return addHandler(handler, BeforeFocusEvent.getType()); } public HandlerRegistration addBeforeBlurHandler(BeforeBlurHandler handler) { return flapPanel.addBeforeBlurHandler(handler); } /** * @return the insertionIndex */ int getIndex() { return insertionIndex; } /** * @return the flapPanel */ FlapPanel getFlapPanel() { return flapPanel; } /** * @return the closeable */ boolean isCloseable() { return closeable; } }
[ "tr_bustamante@yahoo.com.br@a5d2bbaa-053c-11de-b17c-0f1ef23b492c" ]
tr_bustamante@yahoo.com.br@a5d2bbaa-053c-11de-b17c-0f1ef23b492c
a496aed390fc80bb7fc5e66e392226b13076ad4a
06ff92c06edeba17a72dfa59c03d3a1cc6973c1f
/IO/src/main/java/DataTest.java
43367b929bf6738c8917dc591bceadad7814cebf
[]
no_license
qq297227742/code
8b31c49428236cc56b4faa7c4d539a6e1d9c04df
719436c7f9a3063067ea6cdca33ea9476e5c609a
refs/heads/master
2021-08-09T00:46:05.283952
2020-06-17T09:13:35
2020-06-17T09:13:35
244,068,284
0
0
null
null
null
null
UTF-8
Java
false
false
1,251
java
import java.io.*; /** * 数据流 * 1、先写出后读取 * 2、读取的顺序与写出的保持一致 * * DataOutputStream * DataInputStream */ public class DataTest { public static void main(String[] args) throws IOException { //写出 ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(byteArrayOutputStream)); //操作数据类型+数据 dataOutputStream.writeUTF("编码辛酸泪"); dataOutputStream.writeInt(18); dataOutputStream.writeBoolean(false); dataOutputStream.writeChar('a'); dataOutputStream.flush(); byte[] datas = byteArrayOutputStream.toByteArray(); System.out.println(datas.length); //读取 DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(new ByteArrayInputStream(datas))); //顺序与写出一致 String string; string = dataInputStream.readUTF(); int int1 = dataInputStream.readInt(); boolean flag = dataInputStream.readBoolean(); char c = dataInputStream.readChar(); System.out.println(string+int1+flag+c); } }
[ "wangweiwei521@live.cn" ]
wangweiwei521@live.cn
0a2d5b1c6e632b02d691ba80a238ba6f3afb6f5f
486f84c1b4432948e63de3fd9d74eec9b45e6c67
/snsbuy~huiduweb/web-common/src/main/java/com/samaxes/filter/CacheFilter.java
dc85dd777402d32ae366115c4986757c3975d101
[]
no_license
gubaojian/huidu
78a49eaf59d2605485a9cc970de531c96e8cb756
7d2fe0d83304cffab8b71c8aad125103ff403349
refs/heads/master
2022-12-25T14:07:49.886961
2020-06-06T09:45:14
2022-01-05T01:37:39
188,653,887
1
1
null
2022-12-16T10:04:48
2019-05-26T07:39:34
Java
UTF-8
Java
false
false
5,547
java
/* * $Id: CacheFilter.java 90 2011-03-07 22:06:02Z samaxes $ * * Copyright 2008 samaxes.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.samaxes.filter; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.samaxes.filter.util.CacheConfigParameter; import com.samaxes.filter.util.Cacheability; import com.samaxes.filter.util.HTTPCacheHeader; /** * Filter responsible for browser caching. * 配置示例如下: * <!-- 缓存过滤 --> <filter> <filter-name>normalCache</filter-name> <filter-class>com.samaxes.filter.CacheFilter</filter-class> <!-- 作为精通内容输出 --> <init-param> <param-name>static</param-name> <param-value>true</param-value> </init-param> <!-- 允许中间代理服务器缓存 --> <init-param> <param-name>private</param-name> <param-value>false</param-value> </init-param> <!-- 缓存33分钟,时间错有效时间为30 --> <init-param> <param-name>expirationTime</param-name> <param-value>2000</param-value> </init-param> </filter> <filter-mapping> <filter-name>normalCache</filter-name> <url-pattern>*.json</url-pattern> </filter-mapping> * @author Samuel Santos * @version $Revision: 25 $ */ public class CacheFilter extends OnceFilter{ private Cacheability cacheability; private boolean isStatic; private long seconds; /** * Place this filter into service. * * @param filterConfig the filter configuration object used by a servlet container to pass information to a filter * during initialization * @throws ServletException to inform the container to not place the filter into service */ public void init(FilterConfig filterConfig) throws ServletException { cacheability = (Boolean.valueOf(filterConfig.getInitParameter(CacheConfigParameter.PRIVATE.getName()))) ? Cacheability.PRIVATE : Cacheability.PUBLIC; isStatic = Boolean.valueOf(filterConfig.getInitParameter(CacheConfigParameter.STATIC.getName())); try { seconds = Long.valueOf(filterConfig.getInitParameter(CacheConfigParameter.EXPIRATION_TIME.getName())); } catch (NumberFormatException e) { throw new ServletException(new StringBuilder("The initialization parameter ").append( CacheConfigParameter.EXPIRATION_TIME.getName()).append(" is missing for filter ").append( filterConfig.getFilterName()).append(".").toString()); } } /** * Set cache header directives. * * @param servletRequest provides data including parameter name and values, attributes, and an input stream * @param servletResponse assists a servlet in sending a response to the client * @param filterChain gives a view into the invocation chain of a filtered request */ @Override public void doOnceFilter(HttpServletRequest request, HttpServletResponse response,FilterChain chain) throws IOException, ServletException { try { long requestIfModifiedSince = request.getDateHeader(HTTPCacheHeader.IfModifiedSince.getName()); if(requestIfModifiedSince > 0){ requestIfModifiedSince += 8*60*60*1000L; if(requestIfModifiedSince > System.currentTimeMillis()){ response.setHeader(HTTPCacheHeader.LastModified.getName(), request.getHeader(HTTPCacheHeader.IfModifiedSince.getName())); response.sendError(HttpServletResponse.SC_NOT_MODIFIED); return; } } } catch (Exception e) {} StringBuilder cacheControl = new StringBuilder(cacheability.getValue()).append(", max-age=").append(seconds); if (!isStatic) { cacheControl.append(", must-revalidate"); } // Set cache directives long expire = System.currentTimeMillis() + seconds*1000L + 8*60*60*1000L; //中美时差 response.setHeader(HTTPCacheHeader.CACHE_CONTROL.getName(), cacheControl.toString()); response.setDateHeader(HTTPCacheHeader.EXPIRES.getName(), expire); response.setDateHeader(HTTPCacheHeader.LastModified.getName(), expire); /* * By default, some servers (e.g. Tomcat) will set headers on any SSL content to deny caching. Setting the * Pragma header to null or to an empty string takes care of user-agents implementing HTTP 1.0. */ if (response.containsHeader("Pragma")) { response.setHeader(HTTPCacheHeader.PRAGMA.getName(), null); } chain.doFilter(request, response); } /** * Take this filter out of service. */ public void destroy() { } }
[ "gubaojian@163.com" ]
gubaojian@163.com
a47eabd5977f63bf98c2b88719715858949b6920
2520fabaa7fb8736d406beca23789a3e750d16c2
/src/test/java/com/automation/steps/SignInPageSteps.java
e4907e9c41544686abad1b62ed2d7185d9b060e4
[]
no_license
svitc00/ScanPay
7396d5a47469ae4fde40d9401b4995f3acfe9490
d2a8d0f35697aa97dc3426a9bea5ae84e80feef0
refs/heads/master
2023-07-14T12:21:32.293904
2021-08-31T00:05:28
2021-08-31T00:05:28
399,324,587
0
0
null
null
null
null
UTF-8
Java
false
false
4,284
java
package com.automation.steps; import com.automation.mobile.appium.AppiumDeviceManager; import com.automation.mobile.appium.AppiumDriverManager; import com.automation.mobile.manager.ConfigFileManager; import com.automation.pages.*; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.appium.java_client.AppiumDriver; import org.junit.Assert; import java.util.Map; public class SignInPageSteps { public AppiumDriver driver = AppiumDriverManager.getDriver(); public SignInPage signInPage = new SignInPage(driver); public StartUpPage startUpPage = new StartUpPage(driver); private String[] banners = {"safeway", "vons"}; public String getCurrentBanner(){ return driver.getCapabilities().getCapability("banner").toString(); } public String getCurrentEnv(){ return driver.getCapabilities().getCapability("env").toString(); } @Given("^user launch app$") public void user_launch_app() { startUpPage.clickContinue(); } @Then("^sign in page is displayed$") public void sign_in_page_is_displayed() { signInPage.waitForSignInPageDisplayed(); } @When("^user enters \"([^\"]*)\" in username field on Sign In page$") public void user_enters_in_username_field_on_Sign_In_page(String arg1) throws Throwable { if (arg1.equalsIgnoreCase("email")) { signInPage.enterUsername(AppiumDeviceManager.getDevice().getAccountUser()); } else { signInPage.enterUsername(arg1); } } @When("^user enters \"([^\"]*)\" in password field on Sign In page$") public void user_enters_in_password_field_on_Sign_In_page(String arg1) throws Throwable { if (arg1.equalsIgnoreCase("password")) { signInPage.enterPassword("Pass1234"); } else { signInPage.enterPassword(arg1); } } @When("^user clicks sign in on sign in page$") public void user_clicks_sign_in_on_sign_in_page() throws Throwable { signInPage.clickSignIn(); } @When("^user clicks CreateAccount on Sign In Page$") public void user_clicks_CreateAccount_on_Sign_In_Page() throws Throwable { signInPage.clickCreateAccountButton(); } @When("^user click forgot password link on Sign In page$") public void userClickForgotPasswordLinkOnSignInPage() { signInPage.clickForgotPasswordLink(); } @When("^user enters different banner \"([^\"]*)\" in username field on Sign In page$") public void userEntersDifferentBannerInUsernameFieldOnSignInPage(String arg0) throws Throwable { String banner = getCurrentBanner(); for(String brand: banners){ if(banner.equalsIgnoreCase(brand)) { continue; }else{ banner = brand; break; } } String env = getCurrentEnv(); Map<String, String> bannerProperty = ConfigFileManager.getBannerPropertyMap(banner, env); signInPage.enterUsername(bannerProperty.get("USERNAME")); } @When("^user close application and relaunch$") public void userCloseApplicationAndRelaunch() throws InterruptedException { HomePage homePage = new HomePage(driver); MenuPage menuPage = new MenuPage(driver); SelectOrderTypePage selectOrderTypePage = new SelectOrderTypePage(driver); signInPage.closeAndRelaunch(); } @Then("^verify email and password mismatch error message is displayed$") public void verifyEmailAndPasswordMismatchErrorMessageIsDisplayed() { signInPage.waitForInvalidPasswordError(); } @Then("^verify no account record error message is displayed on forgot password page$") public void verifyNoAccountRecordErrorMessageIsDisplayedOnForgotPasswordPage() { signInPage.verifyNoRecordError(); } @Then("^verify next button is not enabled for send forgot password email$") public void verifyNextButtonIsNotEnabledForSendForgotPasswordEmail() { Assert.assertFalse(signInPage.forgotPasswordNextButtonEnabled()); } @When("^user clicks cancel from signin page$") public void userClicksCancelFromSigninPage() { signInPage.clickCancelButton(); } }
[ "70666513+svitc00@users.noreply.github.com" ]
70666513+svitc00@users.noreply.github.com
31e6e7823bfbb1769cac5f3545b0d2bd41e5793e
467d68aa08b14925f5075006414757535bf16795
/EjemploCustomControls/EjemploCustomControls.Droid/obj/Debug/android/src/md5546e312dc334494fb573e823e7a43bca/MainActivity.java
f06d24ff5f6db462d798f57e86547365710152ac
[]
no_license
JCQuiroga/EjemploCustomControls
07e88dc9cdc8bd69020b98ec1c4d24eaf8448a70
2ce1f728d106f669361f51c62385d6b781ee890d
refs/heads/master
2021-01-10T16:32:51.053559
2016-02-04T19:43:22
2016-02-04T19:43:22
50,937,346
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package md5546e312dc334494fb573e823e7a43bca; public class MainActivity extends md5d4dd78677dce656d5db26c85a3743ef3.FormsApplicationActivity implements mono.android.IGCUserPeer { static final String __md_methods; static { __md_methods = "n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" + ""; mono.android.Runtime.register ("EjemploCustomControls.Droid.MainActivity, EjemploCustomControls.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", MainActivity.class, __md_methods); } public MainActivity () throws java.lang.Throwable { super (); if (getClass () == MainActivity.class) mono.android.TypeManager.Activate ("EjemploCustomControls.Droid.MainActivity, EjemploCustomControls.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { }); } public void onCreate (android.os.Bundle p0) { n_onCreate (p0); } private native void n_onCreate (android.os.Bundle p0); java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
[ "josecquiroga@gmail.com" ]
josecquiroga@gmail.com
edebea40ebb77eca3deb5713fbd47a458a63419d
c37d0d069fff859767d0f9a5fa9ca860e96d9339
/src/tools/android/java/com/google/devtools/build/android/desugar/langmodel/LangModelHelper.java
9d50b466c03b5ffb3b8f061d6c2cd49e13b560a5
[ "Apache-2.0" ]
permissive
Squadrick/bazel
e759241ce3de4038bc42303250237ac4ba8ad9e5
5a8219ada648bae84d9d342c3dff67a5b6b14be2
refs/heads/master
2020-11-28T12:44:35.135463
2019-12-23T19:25:39
2019-12-23T19:26:30
229,814,062
1
0
Apache-2.0
2019-12-23T19:50:40
2019-12-23T19:50:40
null
UTF-8
Java
false
false
5,136
java
/* * Copyright 2019 The Bazel Authors. 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.devtools.build.android.desugar.langmodel; import static com.google.devtools.build.android.desugar.langmodel.LangModelConstants.NEST_COMPANION_CLASS_SIMPLE_NAME; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; /** A utility class for the desguaring of nest-based access control classes. */ public final class LangModelHelper { /** * Returns the internal name of the nest host class for a given class. * * <p>e.g. The nest host of a/b/C$D is a/b/C */ public static String nestHost(String classInternalName) { int index = classInternalName.indexOf('$'); return index > 0 ? classInternalName.substring(0, index) : classInternalName; } /** * Returns the internal name of the nest companion class for a given class. * * <p>e.g. The nest host of a/b/C$D is a/b/C$NestCC */ public static String nestCompanion(String classInternalName) { return nestHost(classInternalName) + '$' + NEST_COMPANION_CLASS_SIMPLE_NAME; } /** * Adjust the operation code for dup and pop operations by type size. The method supplements * {@link org.objectweb.asm.Type#getOpcode(int)}. */ public static int getTypeSizeAlignedOpcode(int baseOpcode, Type type) { if (baseOpcode == Opcodes.DUP || baseOpcode == Opcodes.DUP2) { switch (type.getSize()) { case 1: return Opcodes.DUP; case 2: return Opcodes.DUP2; default: // fall out: Impossible Condition throw new AssertionError( String.format("Impossible size (%d) for type (%s)", type.getSize(), type)); } } else if (baseOpcode == Opcodes.DUP_X1 || baseOpcode == Opcodes.DUP_X2) { switch (type.getSize()) { case 1: return Opcodes.DUP_X1; case 2: return Opcodes.DUP_X2; default: // fall out: Impossible Condition throw new AssertionError( String.format("Impossible size (%d) for type (%s)", type.getSize(), type)); } } else if (baseOpcode == Opcodes.DUP2_X1 || baseOpcode == Opcodes.DUP2_X2) { switch (type.getSize()) { case 1: return Opcodes.DUP2_X1; case 2: return Opcodes.DUP2_X2; default: // fall out: Impossible Condition throw new AssertionError( String.format("Impossible size (%d) for type (%s)", type.getSize(), type)); } } else if (baseOpcode == Opcodes.POP || baseOpcode == Opcodes.POP2) { switch (type.getSize()) { case 1: return Opcodes.POP; case 2: return Opcodes.POP2; default: // fall out: Impossible Condition throw new AssertionError( String.format("Impossible size (%d) for type (%s)", type.getSize(), type)); } } else { throw new UnsupportedOperationException( String.format( "Unsupported Opcode Adjustment: Type: %s of base opcode: %d", type, baseOpcode)); } } /** * A checker on whether the give class is eligible as an inner class by its class internal name. * * <p>Note: The reliable source of truth is to check the InnerClasses attribute. However, the * attribute may have not been visited yet. */ public static boolean isEligibleAsInnerClass(String className) { return className.contains("$"); } /** * Whether the referenced class member is a in-nest distinct class access within the given * enclosing method. */ public static boolean isCrossMateRefInNest( ClassMemberKey referencedMember, MethodKey enclosingMethod) { String enclosingClassName = enclosingMethod.owner(); String referencedMemberName = referencedMember.owner(); return (isEligibleAsInnerClass(enclosingClassName) || isEligibleAsInnerClass(referencedMemberName)) && !referencedMemberName.equals(enclosingClassName); } /** Emits efficient instructions for a given integer push operation. */ public static void visitPushInstr(MethodVisitor mv, final int value) { if (value >= -1 && value <= 5) { mv.visitInsn(Opcodes.ICONST_0 + value); } else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) { mv.visitIntInsn(Opcodes.BIPUSH, value); } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) { mv.visitIntInsn(Opcodes.SIPUSH, value); } else { mv.visitLdcInsn(value); } } private LangModelHelper() {} }
[ "copybara-worker@google.com" ]
copybara-worker@google.com
cc1e95789da5847479cd33c5498c975607d34cf9
1690695c7863ec512c4903d7e4688bd417ee8cfb
/easeui/build/generated/source/buildConfig/debug/cn/ucai/easeui/BuildConfig.java
6926711dbd59d976237440caf9ced9960d86d90e
[ "Apache-2.0" ]
permissive
caonimammp/superwechat
5b056b6acfe0e26a5e5878b2133906d7dfe66a42
cbd3e731f182121b92541b1573614964cee56e4b
refs/heads/master
2021-01-21T11:50:30.339502
2017-06-06T13:24:39
2017-06-06T13:24:39
91,757,563
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
/** * Automatically generated file. DO NOT MODIFY */ package cn.ucai.easeui; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "cn.ucai.easeui"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
[ "kkkkkkkkkkkop.qq.com" ]
kkkkkkkkkkkop.qq.com
25c5f7081a546961199af3a6ee83b54d888724a2
add11a2387c208c124808bde43d3f22e43a59ea8
/ThreadDemo/src/com/gokul/threadPractice/TestThreadPriority.java
3dc30f0fce31801ed483ea4ada8731461d687531
[]
no_license
balajisundaramm/Eclipse-Projects
a79cab9851fec0aa9e50051290fc41c87a549285
e45888343b5a942d2d52eecdb6fe3dc8e2e8c049
refs/heads/master
2021-09-04T06:29:45.136011
2018-01-16T17:54:51
2018-01-16T17:54:51
117,720,112
0
0
null
null
null
null
UTF-8
Java
false
false
2,179
java
package com.gokul.threadPractice; public class TestThreadPriority { // Thread MIN priority is 1 // Thread NORM priority is 5 // Thread MAX priority is 10 // This will have highest priority than others public static void main(String[] args) { // TODO Auto-generated method stub Thread thread1=new Thread(); System.out.println("Thread MIN priority is "+thread1.MIN_PRIORITY); System.out.println("Thread NORM priority is "+thread1.NORM_PRIORITY); System.out.println("Thread MAX priority is "+thread1.MAX_PRIORITY); System.out.println("************"); // Thread scheduler use priority while allocating process // Thread having highest priority will get the highest change // If two threads have same priority, order of execution is decided by THREAD SCHEDULER // Allowed priority values are 1 to 10 // thread1.setPriority(newPriority); // thread1.getPriority(); // DEFAULT PRIORITY of Main Thread is 5 // For Remaining Threads defalt priority of thread is inherited from its Parent Thread System.out.println("Current thread - "+Thread.currentThread().getName()+" Thread's priority is " +Thread.currentThread().getPriority()); // Setting priorities other than [1 to 10] leads to [ RE: ILLEAGAL ARGUMENT EXCEPTION ] //Thread.currentThread().setPriority(15); //Setting main thread's priority to 4 Thread.currentThread().setPriority(4); System.out.println("Setting Current thread - "+Thread.currentThread().getName() +" thread's priority to "+Thread.currentThread().getPriority()); // Main thread creating a child thread ThreadB mythread1=new ThreadB(); //child thread's priority will obtained from its parent System.out.println("child thread's priority is "+mythread1.getPriority()); // Parent thread is different and parent class is different //mythread1.setPriority(10); mythread1.start(); //Creating new child thread for(int i=0;i<10;i++) { System.out.println("Main Thread"); } //IDEAL OUTPUT is printing "child thread" 10 times followed by "Main thread" 10 times //Some platforms won't provide proper support for Thread priorities // In that case we need to contact OS VENDOR } }
[ "balajitpgit13@gmail.com" ]
balajitpgit13@gmail.com
14f986fb264db0a5874998561eb866f5c2aa1b3f
9a289f120d61ac943a6db6ff6436f38ec3bfcdc8
/src/com/bruce/gogo/system/service/impl/a.java
55a3dc5700e3ab45d365a38274058be33fa733a6
[]
no_license
softgo/Model1
4a954e0e413b335dd06dc2cd6f6e47d661a629af
3f53a6a1900fa6916d877a4d7b11738d3cc2b3fa
refs/heads/master
2021-01-01T06:05:13.102255
2017-04-14T09:48:34
2017-04-14T09:48:34
25,861,131
0
0
null
null
null
null
UTF-8
Java
false
false
65
java
package com.bruce.gogo.system.service.impl; public class a { }
[ "supingemail@126.com" ]
supingemail@126.com
7b9d59a655e1012b50cfeaf66ccc6174bdd7a9a0
6a0ed6f192ea1775f9bd31b537baf493cfe63ae4
/thinkCache/src/androidTest/java/com/thinkcore/cache/ExampleInstrumentedTest.java
c1f9111726d0325f0cfa519d85d58a1b74c3be83
[]
no_license
banketree/ThinkCore-Kotlin
6f2388b9bc095c4a60051e4eafee398c93f70a73
e28debd45cd5b01f31ccefece80d312d24b54ce8
refs/heads/master
2022-09-27T08:11:55.109695
2021-04-18T03:51:45
2021-04-18T03:51:45
222,626,414
2
0
null
null
null
null
UTF-8
Java
false
false
713
java
package com.thinkcore.cache; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.thinkcore.cache.test", appContext.getPackageName()); } }
[ "banketree@qq.com" ]
banketree@qq.com
68d508b4a110cb5a68fc2fa27fb983ff8bea1a86
0067f94e3d57bfe0846f34361f684ec39a663da7
/src/main/java/me/design/strategy/sub3/Context.java
6c71ee0eacbb1a2ba8affbc98a5304cbc0f120f3
[]
no_license
luckygeo/design-pattern
46734162307d5aefe6d559f1ed380865a20c0407
4b260b6f8c9c798ec0e169a6b1b57588d780185e
refs/heads/master
2021-07-15T14:04:30.179463
2021-07-14T06:01:02
2021-07-14T06:01:02
97,786,425
0
0
null
2021-07-14T04:02:01
2017-07-20T03:26:11
Java
UTF-8
Java
false
false
266
java
package me.design.strategy.sub3; /** * Created on 2017/7/28 */ public class Context { private Calc calc = null; public Context(Calc calc) { this.calc = calc; } public int exec(int a, int b) { return this.calc.calc(a, b); } }
[ "tellmegao@gmail.com" ]
tellmegao@gmail.com
c63460939763c4caffc91030f54d2edbd4c0ec8f
ae5cbac2ba64152d920fdb8c96355422f55e1e55
/src/com/mylearning/generics/coffee/Breve.java
8f81e5a1fe4e0124bf3b6e6a9cdd88bb8432316b
[]
no_license
huangyinhy/ThinkingInJava4th
ea31b182105bc7db4c0f59dd7d27612c7fd53aef
b119539e438170b27bdf42528e0d0dc5b0bb88b8
refs/heads/master
2020-03-26T21:30:25.936405
2018-09-06T10:12:31
2018-09-06T10:12:31
145,392,512
0
0
null
null
null
null
UTF-8
Java
false
false
85
java
package com.mylearning.generics.coffee; public class Breve extends Coffee { }
[ "I034966@PVGN56583944A.apj.global.corp.sap" ]
I034966@PVGN56583944A.apj.global.corp.sap
648dd48b51a567fb883e9dde37b8d52ff01ec8bf
a542d7d423ce0966d59ec760987dddd6fa9767d2
/kblog-converter/src/org/kotemaru/blog/builder/BuilderSinglePage.java
2e7cda1947beae4d26eacd080804ea309579a15b
[]
no_license
kotemaru/kotemaru
05dc18271ca7a85af41d4fe0a8154b3809bbd83e
0e886150a15c49abfcdec354d36d57a58061dcd0
refs/heads/master
2020-05-28T14:01:07.615419
2015-04-10T07:07:54
2015-04-10T07:07:54
33,769,860
5
3
null
null
null
null
UTF-8
Java
false
false
1,547
java
package org.kotemaru.blog.builder; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.List; import org.apache.velocity.VelocityContext; public class BuilderSinglePage implements Builder { public boolean build(BlogContext ctx) throws IOException { List<Blog> blogs = ctx.getBlogs(); for (int i=0; i<blogs.size(); i++ ) { Blog[] blog3 = new Blog[3]; blog3[2] = (i>=1)?blogs.get(i-1):null; blog3[1] = blogs.get(i); blog3[0] = (i<blogs.size()-1)?blogs.get(i+1):null; buildSiglePage(ctx, blog3); } return true; } public boolean buildSiglePage(BlogContext ctx, Blog[] blogs) throws IOException { Blog blog = blogs[1]; boolean isUpdate = isUpdate(ctx,blogs[0]) || isUpdate(ctx,blog) || isUpdate(ctx,blogs[2]); //Tool.log(blog.get(Blog.Subject)+":" // +","+isUpdate(ctx,blogs[0]) // +","+isUpdate(ctx,blog) // +","+isUpdate(ctx,blogs[2]) //); if (!isUpdate) return false; VelocityContext vctx = VelocityUtil.getVelocityContext(ctx, blog); vctx.put("blog", blog); vctx.put("next-blog", blogs[0]); vctx.put("prev-blog", blogs[2]); vctx.put("content-path", blog.getContentPath()); vctx.put("categoryTag", ""); vctx.put("recent-path", ""); File outFile = new File(ctx.getDocumentRoot(), blog.getContentPath()); VelocityUtil.write(ctx, "content.html", vctx, outFile); return true; } private static boolean isUpdate(BlogContext ctx, Blog blog) throws IOException { if (blog == null) return false; return blog.isUpdate(); } }
[ "kotemaru@kotemaru.org@007fbaa9-8b8e-5bb4-69cf-ca3c05551f93" ]
kotemaru@kotemaru.org@007fbaa9-8b8e-5bb4-69cf-ca3c05551f93
00c9d1298a1c235a6edebaa01c9c120fcb420ab2
e7c3833e699b1c91fcad3761c22d81226e9f2db5
/bite/src/bite02/FactorialSum.java
3c91f7c221bb7885c553ed77b990902dc476123d
[]
no_license
wlisionate/bite
3c6ca5531c26266e81b9a5a8e79d8b795e055145
5cb3c52741166b0dc536e6f5cd700fe1f2fd460c
refs/heads/master
2022-12-01T11:07:31.875565
2020-08-17T08:11:43
2020-08-17T08:11:43
288,120,397
1
0
null
null
null
null
UTF-8
Java
false
false
892
java
package bite02; /** * ⊙﹏⊙&&&&&&⊙▽⊙ * * @Auther: pangchenbo * @Date: 2019/12/11 12:02 * @Description: */ public class FactorialSum { public static int sumWhile(int n){ int i=1; int sum = 0; while (i <= n){ int j=1; int temp = 1; while (j<=i){ temp *= j; j++; } sum+=temp; i++; } return sum; } public static int sumFor(int n){ int sum = 0; int i1 = 1; for(int i=1;i<=n;i++){ int j1=1; int temp = 1; for(int j=j1;j<=i;j++){ temp *= j; } sum += temp; } return sum; } public static void main(String[] args) { System.out.println(sumWhile(5)); System.out.println(sumFor(5)); } }
[ "pangchenbokk@163.com" ]
pangchenbokk@163.com
aa13847e06f8a5e708c7213fe34ba7b09d4b3080
d34ee7d854c19716d1b1cee28784e5861bbe6c38
/examples_lev1/src/StringBasic.java
610f95ffcadd6de9b2325370fe53694f042e1c47
[]
no_license
rkdls8268/programmers_example
ff631de8cab1f895c3c0bb0acb6030d7837de096
6a6199fc0e891bc57f7518888ca917d0a8eb72d8
refs/heads/master
2023-07-27T05:32:38.149142
2023-07-11T09:12:22
2023-07-11T09:12:22
294,185,598
2
0
null
null
null
null
UTF-8
Java
false
false
523
java
public class StringBasic { // 문자열 다루기 기본 public static void main(String[] args) { String s = "a234"; String s1 = "1234"; System.out.println(solution(s)); System.out.println(solution(s1)); } static boolean solution(String s) { boolean answer = true; // 정규식: [0-9]* -> 숫자가 0개 이상인 패턴 answer = (s.length() == 4 || s.length() == 6) && s.matches("[0-9]*"); return answer; } } // 정규식 정리하기~~
[ "rkdls8268@gmail.com" ]
rkdls8268@gmail.com
e9b9e0953fc6afd84d6856b1e4e9a1d24d9004b2
fd1b3baefee95d65c50782d10450db00716da8de
/core/src/main/java/com/future/yingyue/ffmpeg/service/OutHandler.java
7f16ebf36cefe400ae3b7092ef52ed3eb3400733
[]
no_license
cuishiying/yingyue-master
b29ade04d92d8013b31f1f07515c43ce6579221f
8df0364e5388fdf48597df854abafa326583d88b
refs/heads/master
2021-08-29T17:19:40.763594
2017-12-14T12:29:14
2017-12-14T12:29:14
108,139,999
0
0
null
null
null
null
UTF-8
Java
false
false
1,814
java
package com.future.yingyue.ffmpeg.service; import com.future.yingyue.ffmpeg.config.FFmpegConfig; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; /** * 任务消息输出处理器 */ public class OutHandler extends Thread { /** * 控制状态 */ private volatile boolean desstatus = true; /** * 读取输出流 */ private BufferedReader br = null; /** * 输出类型 */ private String type = null; /** * 消息处理方法 */ private OutHandlerMethod ohm; public void setOhm(OutHandlerMethod ohm) { this.ohm = ohm; } public void setDesStatus(boolean desStatus) { this.desstatus = desStatus; } public OutHandler(InputStream is, String type, OutHandlerMethod ohm) { br = new BufferedReader(new InputStreamReader(is)); this.type = type; this.ohm=ohm; } /** * 重写线程销毁方法,安全的关闭线程 */ @Override public void destroy() { setDesStatus(false); } /** * 执行输出线程 */ @Override public void run() { String msg = null; try { if (FFmpegConfig.isDebug()) { System.out.println(type + "开始推流!"); while (desstatus && (msg = br.readLine()) != null) { ohm.parse(type,msg); } } else { Thread.yield(); } } catch (IOException e) { System.out.println("发生内部异常错误,自动关闭[" + this.getId() + "]线程"); destroy(); } finally { if (this.isAlive()) { destroy(); } } } }
[ "cuishiying163@163.com" ]
cuishiying163@163.com
d9d691a634ca815beaca3be9425cf5ac6f32dedb
46c6759a6e6ea754bdee56e414872151ca2e1cee
/KanbanBoard/src/main/java/com/unimib/KanbanBoard/model/Tile.java
d831200ff02815803444e3f4b69f59c94179bbfc
[]
no_license
SamueleCrispino/didactic-kanban-model-spring
c2ea721a08d2d77651a22e3a1cc742d8063f7742
a87b1e30eafd58495bb94c10fba5ab1a26346645
refs/heads/master
2023-06-18T20:37:00.179212
2021-07-16T09:12:35
2021-07-16T09:12:35
383,125,989
0
0
null
2021-07-16T09:12:36
2021-07-05T12:01:02
Java
UTF-8
Java
false
false
2,349
java
package com.unimib.KanbanBoard.model; import java.io.Serializable; import java.sql.Blob; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonBackReference; @Entity @Table(name = "tile") public class Tile implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="idTile") private Long idTile; @NotBlank @Column(name="titolo") private String titolo; @NotBlank @Column(name="autore") private String autore; @NotBlank @Column(name="tipo_messaggio") // {ORGANIZZATIVO, INFORMATIVO} private String tipoMessaggio; @Column(name="contenuto_testuale") private String contenutoTestuale; @Lob @Column(name = "contenuto_multimediale", length = 1000) private byte[] contenutoMultimediale; @JsonBackReference @ManyToOne private Colonna colonna; public Long getIdTile() { return idTile; } public void setIdTile(Long idTile) { this.idTile = idTile; } public String getTitolo() { return titolo; } public void setTitolo(String titolo) { this.titolo = titolo; } public String getAutore() { return autore; } public void setAutore(String autore) { this.autore = autore; } public String getTipoMessaggio() { return tipoMessaggio; } public void setTipoMessaggio(String tipoMessaggio) { this.tipoMessaggio = tipoMessaggio; } public String getContenutoTestuale() { return contenutoTestuale; } public void setContenutoTestuale(String contenutoTestuale) { this.contenutoTestuale = contenutoTestuale; } public Colonna getColonna() { return colonna; } public void setColonna(Colonna colonna) { this.colonna = colonna; } public static long getSerialversionuid() { return serialVersionUID; } public byte[] getContenutoMultimediale() { return contenutoMultimediale; } public void setContenutoMultimediale(byte[] contenutoMultimediale) { this.contenutoMultimediale = contenutoMultimediale; } }
[ "samuele.crispino.consultant@axa.it" ]
samuele.crispino.consultant@axa.it
f58639e746379b6c775c4508ce5ac4ced2a7deec
279038953035525fe9855ce54b1a465b7f3c5f9c
/myblogs_client/src/main/java/com/xk/myblogs/client/entity/ryvue/SysDictType.java
6100237889374921f8cbbef1704a3a6fe84aecf5
[]
no_license
tscxk/myblogs
f152facf9cd5cd7dc8f7cd4c8b56b74c2dfc5feb
029f109f0e92643017659298f5f23ca74717e5d3
refs/heads/master
2023-04-13T21:07:23.555459
2020-08-11T11:58:01
2020-08-11T11:58:01
234,834,056
0
0
null
2020-01-19T03:24:01
2020-01-19T03:24:00
null
UTF-8
Java
false
false
3,177
java
package com.xk.myblogs.client.entity.ryvue; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Date; /** * * 字典类型表 * * TABLE sys_dict_type * MyBatis Generator Create */ public class SysDictType implements Serializable { @ApiModelProperty(value = "字典主键") private Long dictId; @ApiModelProperty(value = "字典名称") private String dictName; @ApiModelProperty(value = "字典类型") private String dictType; @ApiModelProperty(value = "状态(0正常 1停用)") private String status; @ApiModelProperty(value = "创建者") private String createBy; @ApiModelProperty(value = "创建时间") private Date createTime; @ApiModelProperty(value = "更新者") private String updateBy; @ApiModelProperty(value = "更新时间") private Date updateTime; @ApiModelProperty(value = "备注") private String remark; private static final long serialVersionUID = 1L; public Long getDictId() { return dictId; } public void setDictId(Long dictId) { this.dictId = dictId; } public String getDictName() { return dictName; } public void setDictName(String dictName) { this.dictName = dictName; } public String getDictType() { return dictType; } public void setDictType(String dictType) { this.dictType = dictType; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getCreateBy() { return createBy; } public void setCreateBy(String createBy) { this.createBy = createBy; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getUpdateBy() { return updateBy; } public void setUpdateBy(String updateBy) { this.updateBy = updateBy; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", dictId=").append(dictId); sb.append(", dictName=").append(dictName); sb.append(", dictType=").append(dictType); sb.append(", status=").append(status); sb.append(", createBy=").append(createBy); sb.append(", createTime=").append(createTime); sb.append(", updateBy=").append(updateBy); sb.append(", updateTime=").append(updateTime); sb.append(", remark=").append(remark); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
[ "952505116@qq.com" ]
952505116@qq.com
bc8604cd8cdc687325fe3c003ee165a2cfaf4fcf
257bf86ee27965eb2bae687b0207ada5490d11d2
/java/src.network/test/LocalHost.java
baf0f05b8c8703cae20df025d20f7cdf485c3c6c
[]
no_license
ynicekyhh/Java
88dad42922441219c32fe6330ed76bbe9fede070
f42aa2a1b51ed30ae173856c9a15ef96da89f11e
refs/heads/master
2021-07-11T12:08:01.977475
2017-10-15T16:24:42
2017-10-15T16:24:42
106,667,368
0
1
null
null
null
null
UTF-8
Java
false
false
706
java
package test; import java.net.InetAddress; import java.net.UnknownHostException; public class LocalHost { public static void main(String[] args) { try { InetAddress inetAddress = InetAddress.getLocalHost(); String hostName = inetAddress.getHostName(); String hostAddress = inetAddress.getHostAddress(); byte[] addresses = inetAddress.getAddress(); System.out.println( hostName ); System.out.println( hostAddress ); for( int i = 0; i < addresses.length; i++ ) { System.out.print( addresses[i] & 0x000000ff ); if( i < 3 ) { System.out.print( "." ); } } } catch (UnknownHostException e) { e.printStackTrace(); } } }
[ "ynicekyhh@gmail.com" ]
ynicekyhh@gmail.com
26023f5f643ef6476a47aac0cd1829a583ea87c6
8fd949df48f3c3226fea690132a7218b92a86869
/alex-admin/src/main/java/com/alex/alexadmin/mq/DemoQueueConsumer.java
25340373ae4a94daed1f4efcca580949ac0b19bc
[]
no_license
AlexhahahaDrag/kitty-learn
e555c09d1e3f4e2f477e339a7178820ba48fca25
e2581800412956d7990c213906b7746e10e06e1e
refs/heads/master
2022-02-20T04:30:16.085884
2019-12-15T08:52:35
2019-12-15T08:52:35
227,044,010
0
0
null
2022-02-09T22:21:01
2019-12-10T06:21:32
Java
UTF-8
Java
false
false
537
java
package com.alex.alexadmin.mq; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; @Component @RabbitListener(queues = "demoQueue") public class DemoQueueConsumer { /** *消息消费 * @RabbitHandler代表此方法为接受到消息后的处理方法 */ @RabbitHandler public void received(String msg) { System.out.println("[demoQueue] received message:" + msg); } }
[ "734663446@qq.com" ]
734663446@qq.com
c7bb1648910b914c1b4f81686394ce38f7c90c95
3bef7512ec8660cbc65e6599a0ba1e6abfdae35e
/WebProj4/src/Com/internousdev/webproj4/dao/InquiryDAO.java
a59019b6fde1779df348b24ff2fd146d068e167f
[]
no_license
kameishi/test
1cea82f041e2b2fa5118f26ad5d791e205150ba7
357045cae371dcf28ce6fb4ae12652614b6842dc
refs/heads/master
2021-09-14T07:13:47.514468
2018-05-09T10:15:39
2018-05-09T10:15:39
124,337,126
0
0
null
null
null
null
UTF-8
Java
false
false
1,607
java
package Com.internousdev.webproj4.dao; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.sql.PreparedStatement; import Com.internousdev.webproj4.dto.InquiryDTO; import Com.internousdev.webproj4.util.DBConnector; public class InquiryDAO { List<InquiryDTO> inquiryDTOList=new ArrayList<InquiryDTO>(); public List<InquiryDTO> select(){ DBConnector db=new DBConnector(); Connection con=db.getConnection(); String sql="select * from inquiry"; try{ PreparedStatement ps=con.prepareStatement(sql); ResultSet rs=ps.executeQuery(); while(rs.next()){ InquiryDTO dto=new InquiryDTO(); dto.setName(rs.getString("name")); dto.setQtype(rs.getString("qtype")); dto.setBody(rs.getString("body")); inquiryDTOList.add(dto); } }catch(SQLException e){ e.printStackTrace(); } try{ con.close(); }catch(SQLException e){ e.printStackTrace(); } return inquiryDTOList; } public int insert(String name,String qtype,String body){ int ret=0; DBConnector db=new DBConnector(); Connection con=db.getConnection(); String sql="insert into inquiry values(?,?,?)"; try{ PreparedStatement ps=con.prepareStatement(sql); ps.setString(1, name); ps.setString(2, qtype); ps.setString(3, body); int i=ps.executeUpdate(); if(i>0){ System.out.println(i+"件登録されますた"); ret=i; } }catch(SQLException e){ e.printStackTrace(); } try{ con.close(); }catch(SQLException e){ e.printStackTrace(); } return ret; } }
[ "cc30.tm24@docomo.ne.jp" ]
cc30.tm24@docomo.ne.jp
6f8bf503569e1002f0f12d1f5cd88e97a8f3b9ca
42939d0db9d0f6ef3c67f57309acff6ac18d7f6b
/src/test/java/restapi/RestApiAutomation.java
12bdec2b7020a9ab0922359fcb047547219e9895
[]
no_license
gulnoza22/VideoGameProject
2a71938033daab90996b1f83e468941d8b5cfaaf
b9390164983ed517e7b396a03e6da36d7486cd0a
refs/heads/master
2023-05-10T23:52:55.450286
2020-02-04T19:23:19
2020-02-04T19:23:19
238,285,454
0
0
null
2023-05-09T18:19:40
2020-02-04T19:15:30
HTML
UTF-8
Java
false
false
2,947
java
package restapi; import org.hamcrest.MatcherAssert; import org.testng.Assert; import org.testng.annotations.Test; import static org.hamcrest.Matchers.equalTo; import io.restassured.matcher.ResponseAwareMatcher; import io.restassured.response.Response; import static io.restassured.RestAssured.given; import java.util.HashMap; public class RestApiAutomation { // Testing GET request with BDD approach in Rest API @Test(priority = 1) // PASSED public void testGetRequest_getAllVideoGames_TC1() { given() .when().get("http://localhost:8080/app/videogames") .then().statusCode(200); } // Testing POST request with BDD approach in Rest API @Test(priority = 2) // PASSED public void testPost_toAddNewVideoGame() { // Creating a new datas in API by using POST method HashMap data = new HashMap(); data.put("id", "19"); data.put("name", "Tourist"); data.put("releaseDate", "2020-01-25T06:01:13.418Z"); data.put("reviewScore", "5"); data.put("category", "Adventure"); data.put("rating", "Universal"); Response res = given().contentType("application/json") .body(data)// it will show the data's in the payload .when() .post("http://localhost:8080/app/videogames") .then() .statusCode(200) .log().body()// this log is printing the body in the console .extract().response(); String jsonString = res.asString();// getting a success string message // verifying success message--> "Record Added Successfully" Assert.assertEquals(jsonString.contains("Record Added Successfully"), true); } // Testing with GET request to get the Created VideoGame ID @Test(priority = 3) // PASSED public void testGet_toGetCreatedVideoID() { given() .when() .get("http://localhost:8080/app/videogames/19") .then() .statusCode(200) .log().body() .body("videoGame.id", equalTo("19")).body("videoGame.name", equalTo("Tourist")); } //Updating with PUT method an existing videoGame @Test(priority = 4) //PASSED public void testPUT_toUpdateVideoGame() { HashMap data1 = new HashMap(); data1.put("id", "19"); data1.put("name", "BatMan"); data1.put("releaseDate", "2020-01-25T06:01:13.418Z"); data1.put("reviewScore", "10"); data1.put("category", "Adventure"); data1.put("rating", "Universal"); given() .contentType("application/json") .body(data1) .when() .put("http://localhost:8080/app/videogames/19") .then() .statusCode(200) .log().body() .body("videoGame.id", equalTo("19")) .body("videoGame.name", equalTo("BatMan")); } //Deleting videoGame ID with delete method. @Test(priority=5)//PASSED public void testDelete_toDeleteVideoGameID() { Response res =given() .when() .delete("http://localhost:8080/app/videogames/19") .then() .statusCode(200) .log().body() .extract().response(); String jsonString = res.asString(); Assert.assertEquals(jsonString.contains("Record Deleted Successfully"), true); } }
[ "tadjichka@gmail.com" ]
tadjichka@gmail.com
3d9e8fcdbd03a153d0324e8f45d5f403631c1f50
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21_ReducedClassCount/applicationModule/src/test/java/applicationModulepackageJava1/Foo244Test.java
1ec0e07a6dbc6666aeb4b459d64573ceb13af38d
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package applicationModulepackageJava1; import org.junit.Test; public class Foo244Test { @Test public void testFoo0() { new Foo244().foo0(); } @Test public void testFoo1() { new Foo244().foo1(); } @Test public void testFoo2() { new Foo244().foo2(); } @Test public void testFoo3() { new Foo244().foo3(); } @Test public void testFoo4() { new Foo244().foo4(); } @Test public void testFoo5() { new Foo244().foo5(); } @Test public void testFoo6() { new Foo244().foo6(); } @Test public void testFoo7() { new Foo244().foo7(); } @Test public void testFoo8() { new Foo244().foo8(); } @Test public void testFoo9() { new Foo244().foo9(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
06087f27cc3cbc54795011695ceae56c2df80e7b
0ed9f2f2455e3ffd90a01e253b1a458dc494784b
/src/main/java/com/alexchetcuti/azure/coursework/Common.java
754dd69e6742f0e275c606c8cc1913a525bb489c
[]
no_license
alexchet/VehicleCheck
6bc1571290e0fee0ec1c58cf12fd818225d798d7
e70da790e1556a100c69618508170929e66b432b
refs/heads/master
2021-01-18T16:14:10.189809
2016-12-15T17:10:10
2016-12-15T17:10:10
86,730,929
0
0
null
null
null
null
UTF-8
Java
false
false
4,283
java
package com.alexchetcuti.azure.coursework; import com.microsoft.windowsazure.Configuration; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.services.servicebus.ServiceBusConfiguration; import com.microsoft.windowsazure.services.servicebus.ServiceBusContract; import com.microsoft.windowsazure.services.servicebus.ServiceBusService; import com.microsoft.windowsazure.services.servicebus.models.BrokeredMessage; import com.microsoft.windowsazure.services.servicebus.models.ReceiveMessageOptions; import com.microsoft.windowsazure.services.servicebus.models.ReceiveMode; import com.microsoft.windowsazure.services.servicebus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.servicebus.models.ReceiveSubscriptionMessageResult; public class Common { public Common() { // TODO Auto-generated constructor stub } private static final Configuration SSCServiceBusConfig = ServiceBusConfiguration.configureWithSASAuthentication( "smartspeedcamera", "RootManageSharedAccessKey", "e9eZDy/Vj+gzxhTsM2ZMzNlliqpO305GT/KB+GPEvas=", ".servicebus.windows.net" ); public static ServiceBusContract serviceConnect() { ServiceBusContract service = ServiceBusService.create(SSCServiceBusConfig); return service; } public static boolean isVehicleStolen(String vehicleRegistration) { try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return (Math.random() > 0.95); } public static boolean receiveVehicleMessages() { try { ServiceBusContract service = serviceConnect(); ReceiveMessageOptions opts = ReceiveMessageOptions.DEFAULT; opts.setReceiveMode(ReceiveMode.PEEK_LOCK); ReceiveSubscriptionMessageResult resultSubMsg = service.receiveSubscriptionMessage("MainTopic", "VehiclesSpeeding", opts); BrokeredMessage message = resultSubMsg.getValue(); if (message != null) { Vehicle vehicle = new Vehicle( VehicleType.valueOf(message.getProperty("vehicleType").toString()), message.getProperty("regPlate").toString(), Integer.parseInt(message.getProperty("velocity").toString()), Integer.parseInt(message.getProperty("cameraUniqueID").toString()) ); System.out.println(vehicle.getRegPlate() + ": " + isVehicleStolen(vehicle.getRegPlate())); // Delete message. service.deleteMessage(message); return true; } } catch (ServiceException e) { System.out.print("ServiceException encountered: "); System.out.println(e.getMessage()); System.exit(-1); } catch (Exception e) { System.out.print("Generic exception encountered: "); System.out.println(e.getMessage()); System.exit(-1); } return false; } public static Boolean receiveVehicleQueue() { try { ServiceBusContract service = serviceConnect(); ReceiveMessageOptions opts = ReceiveMessageOptions.DEFAULT; opts.setReceiveMode(ReceiveMode.PEEK_LOCK); ReceiveQueueMessageResult resultQM = service.receiveQueueMessage("vehiclespeedingqueue", opts); BrokeredMessage message = resultQM.getValue(); if (message != null && message.getMessageId() != null) { byte[] b = new byte[200]; String s = null; int numRead = message.getBody().read(b); while (-1 != numRead) { s = new String(b); s = s.trim(); numRead = message.getBody().read(b); } System.out.println(s + ": " + isVehicleStolen(s)); service.deleteMessage(message); return true; } return false; } catch (ServiceException e) { System.out.print("ServiceException encountered: "); System.out.println(e.getMessage()); System.exit(-1); } catch (Exception e) { System.out.print("Generic exception encountered: "); System.out.println(e.getMessage()); System.exit(-1); } return false; } }
[ "Alex Chetcuti" ]
Alex Chetcuti
67293e5f858418711d0ec035b068dae13f0955d3
5aae02a22ee472fd4d5f8bc6d21013b5ced7ca87
/repetition/src/presentation/PersonView.java
7674762c13daa84404cbf91893987126d1928cdc
[]
no_license
HEDMU-2015/Repetition
aa1c913401f8bf1a166e926afc6d422e72d42015
abd5bca672d358845e57d184004f408ca2a52864
refs/heads/master
2021-01-10T17:43:52.109357
2016-04-25T19:25:32
2016-04-25T19:25:32
55,909,640
5
0
null
null
null
null
UTF-8
Java
false
false
4,153
java
package presentation; import static javafx.geometry.HPos.RIGHT; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import domain.PersonDomain; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; import logic.Personer; public class PersonView { private Stage primaryStage; private PersonsView view; private int index; private PersonDomain person; private TextField nameField; private TextField emailField; private TextField birthField; private Text errorField; private Personer personer = Personer.instance(); public PersonView(Stage primaryStage, PersonsView view, int index, PersonDomain person) { this.primaryStage = primaryStage; this.view = view; this.index = index; this.person = person; } public void init() { primaryStage.setTitle("Person detail"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome to Person detail"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label nameLabel = new Label("Name:"); grid.add(nameLabel, 0, 1); Label emailLabel = new Label("Email:"); grid.add(emailLabel, 0, 2); Label birthLabel = new Label("Date of birth:"); grid.add(birthLabel, 0, 3); nameField = new TextField(person.getName()); grid.add(nameField, 1, 1); emailField = new TextField(person.getEmail()); grid.add(emailField, 1, 2); DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd"); if (person.getBirthdate() != null) { birthField = new TextField(person.getBirthdate().format(format)); } else { birthField = new TextField(); } grid.add(birthField, 1, 3); Button savebtn = new Button("Save"); Button deletebtn = new Button("Delete"); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(savebtn); hbBtn.getChildren().add(deletebtn); grid.add(hbBtn, 1, 8); errorField = new Text(); grid.add(errorField, 0, 9); GridPane.setColumnSpan(errorField, 2); GridPane.setHalignment(errorField, RIGHT); errorField.setId("error"); errorField.setFill(Color.FIREBRICK); savebtn.setOnAction(e -> save()); deletebtn.setOnAction(e -> delete()); Scene scene = new Scene(grid, 300, 400); primaryStage.setScene(scene); primaryStage.show(); } private void save() { errorField.setText(""); if (index == -1) { PersonDomain newperson = new PersonDomain(); newperson.setName(nameField.getText()); newperson.setEmail(emailField.getText()); if (birthField.getText() != null && !birthField.getText().equals("")) { newperson.setBirthdate(LocalDate.parse(birthField.getText())); } view.getPlist().add(newperson); personer.create(newperson); } else { person.setName(nameField.getText()); person.setEmail(emailField.getText()); person.setBirthdate(LocalDate.parse(birthField.getText())); view.getPlist().set(index, person); personer.update(person); } primaryStage.close();; } private void delete() { errorField.setText(""); view.getPlist().remove(person); personer.delete(person); primaryStage.close(); } }
[ "hi@eamv.dk" ]
hi@eamv.dk
95509a1d8a94721b14197790107f1321b48cf53b
447520f40e82a060368a0802a391697bc00be96f
/apks/malware/app79/source/com/hzpz/pay/jsoup/select/e.java
359b0b1d89a674b57bb0706ade166892262c85b2
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
11,678
java
package com.hzpz.pay.jsoup.select; import com.hzpz.pay.jsoup.helper.StringUtil; import com.hzpz.pay.jsoup.helper.Validate; import com.hzpz.pay.jsoup.parser.TokenQueue; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; class e { private static final String[] a = { ",", ">", "+", "~", " " }; private static final String[] b = { "=", "!=", "^=", "$=", "*=", "~=" }; private static final Pattern f = Pattern.compile("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d+)?", 2); private static final Pattern g = Pattern.compile("(\\+|-)?(\\d+)"); private TokenQueue c; private String d; private List e = new ArrayList(); private e(String paramString) { this.d = paramString; this.c = new TokenQueue(paramString); } public static Evaluator a(String paramString) { return new e(paramString).a(); } private void a(char paramChar) { this.c.e(); Evaluator localEvaluator = a(b()); Object localObject1; Object localObject3; int i; Object localObject2; if (this.e.size() == 1) { localObject1 = (Evaluator)this.e.get(0); if ((!(localObject1 instanceof d)) || (paramChar == ',')) { break label363; } localObject3 = ((d)localObject1).a(); i = 1; localObject2 = localObject1; localObject1 = localObject3; } for (;;) { this.e.clear(); if (paramChar == '>') { localObject1 = new c(new Evaluator[] { localEvaluator, new h((Evaluator)localObject1) }); label117: if (i == 0) { break label357; } ((d)localObject2).a((Evaluator)localObject1); } for (;;) { this.e.add(localObject2); return; localObject1 = new c(this.e); localObject2 = localObject1; i = 0; break; if (paramChar == ' ') { localObject1 = new c(new Evaluator[] { localEvaluator, new k((Evaluator)localObject1) }); break label117; } if (paramChar == '+') { localObject1 = new c(new Evaluator[] { localEvaluator, new i((Evaluator)localObject1) }); break label117; } if (paramChar == '~') { localObject1 = new c(new Evaluator[] { localEvaluator, new l((Evaluator)localObject1) }); break label117; } if (paramChar == ',') { if ((localObject1 instanceof d)) { localObject1 = (d)localObject1; ((d)localObject1).b(localEvaluator); } for (;;) { break; localObject3 = new d(); ((d)localObject3).b((Evaluator)localObject1); ((d)localObject3).b(localEvaluator); localObject1 = localObject3; } } throw new Selector.SelectorParseException("Unknown combinator: " + paramChar, new Object[0]); label357: localObject2 = localObject1; } label363: localObject2 = localObject1; i = 0; } } private void a(boolean paramBoolean) { TokenQueue localTokenQueue = this.c; if (paramBoolean) {} for (String str = ":containsOwn";; str = ":contains") { localTokenQueue.c(str); str = TokenQueue.f(this.c.a('(', ')')); Validate.a(str, ":contains(text) query must not be empty"); if (!paramBoolean) { break; } this.e.add(new Evaluator.ContainsOwnText(str)); return; } this.e.add(new Evaluator.ContainsText(str)); } private void a(boolean paramBoolean1, boolean paramBoolean2) { int k = 1; int j = 0; String str = this.c.e(")").trim().toLowerCase(); Matcher localMatcher1 = f.matcher(str); Matcher localMatcher2 = g.matcher(str); int i; if ("odd".equals(str)) { j = 1; i = 2; } while (paramBoolean2) { if (paramBoolean1) { this.e.add(new Evaluator.IsNthLastOfType(i, j)); return; if ("even".equals(str)) { i = 2; } else if (localMatcher1.matches()) { if (localMatcher1.group(3) != null) { k = Integer.parseInt(localMatcher1.group(1).replaceFirst("^\\+", "")); } i = k; if (localMatcher1.group(4) != null) { j = Integer.parseInt(localMatcher1.group(4).replaceFirst("^\\+", "")); i = k; } } else if (localMatcher2.matches()) { j = Integer.parseInt(localMatcher2.group().replaceFirst("^\\+", "")); i = 0; } else { throw new Selector.SelectorParseException("Could not parse nth-index '%s': unexpected format", new Object[] { str }); } } else { this.e.add(new Evaluator.IsNthOfType(i, j)); return; } } if (paramBoolean1) { this.e.add(new Evaluator.IsNthLastChild(i, j)); return; } this.e.add(new Evaluator.IsNthChild(i, j)); } private String b() { StringBuilder localStringBuilder = new StringBuilder(); while (!this.c.a()) { if (this.c.a("(")) { localStringBuilder.append("(").append(this.c.a('(', ')')).append(")"); } else if (this.c.a("[")) { localStringBuilder.append("[").append(this.c.a('[', ']')).append("]"); } else { if (this.c.a(a)) { break; } localStringBuilder.append(this.c.d()); } } return localStringBuilder.toString(); } private void b(boolean paramBoolean) { TokenQueue localTokenQueue = this.c; if (paramBoolean) {} for (String str = ":matchesOwn";; str = ":matches") { localTokenQueue.c(str); str = this.c.a('(', ')'); Validate.a(str, ":matches(regex) query must not be empty"); if (!paramBoolean) { break; } this.e.add(new Evaluator.MatchesOwn(Pattern.compile(str))); return; } this.e.add(new Evaluator.Matches(Pattern.compile(str))); } private void c() { if (this.c.b("#")) { d(); return; } if (this.c.b(".")) { e(); return; } if (this.c.c()) { f(); return; } if (this.c.a("[")) { g(); return; } if (this.c.b("*")) { h(); return; } if (this.c.b(":lt(")) { i(); return; } if (this.c.b(":gt(")) { j(); return; } if (this.c.b(":eq(")) { k(); return; } if (this.c.a(":has(")) { m(); return; } if (this.c.a(":contains(")) { a(false); return; } if (this.c.a(":containsOwn(")) { a(true); return; } if (this.c.a(":matches(")) { b(false); return; } if (this.c.a(":matchesOwn(")) { b(true); return; } if (this.c.a(":not(")) { n(); return; } if (this.c.b(":nth-child(")) { a(false, false); return; } if (this.c.b(":nth-last-child(")) { a(true, false); return; } if (this.c.b(":nth-of-type(")) { a(false, true); return; } if (this.c.b(":nth-last-of-type(")) { a(true, true); return; } if (this.c.b(":first-child")) { this.e.add(new Evaluator.IsFirstChild()); return; } if (this.c.b(":last-child")) { this.e.add(new Evaluator.IsLastChild()); return; } if (this.c.b(":first-of-type")) { this.e.add(new Evaluator.IsFirstOfType()); return; } if (this.c.b(":last-of-type")) { this.e.add(new Evaluator.IsLastOfType()); return; } if (this.c.b(":only-child")) { this.e.add(new Evaluator.IsOnlyChild()); return; } if (this.c.b(":only-of-type")) { this.e.add(new Evaluator.IsOnlyOfType()); return; } if (this.c.b(":empty")) { this.e.add(new Evaluator.IsEmpty()); return; } if (this.c.b(":root")) { this.e.add(new Evaluator.IsRoot()); return; } throw new Selector.SelectorParseException("Could not parse query '%s': unexpected token at '%s'", new Object[] { this.d, this.c.h() }); } private void d() { String str = this.c.g(); Validate.a(str); this.e.add(new Evaluator.Id(str)); } private void e() { String str = this.c.g(); Validate.a(str); this.e.add(new Evaluator.Class(str.trim().toLowerCase())); } private void f() { String str2 = this.c.f(); Validate.a(str2); String str1 = str2; if (str2.contains("|")) { str1 = str2.replace("|", ":"); } this.e.add(new Evaluator.Tag(str1.trim().toLowerCase())); } private void g() { TokenQueue localTokenQueue = new TokenQueue(this.c.a('[', ']')); String str = localTokenQueue.b(b); Validate.a(str); localTokenQueue.e(); if (localTokenQueue.a()) { if (str.startsWith("^")) { this.e.add(new Evaluator.AttributeStarting(str.substring(1))); return; } this.e.add(new Evaluator.Attribute(str)); return; } if (localTokenQueue.b("=")) { this.e.add(new Evaluator.AttributeWithValue(str, localTokenQueue.h())); return; } if (localTokenQueue.b("!=")) { this.e.add(new Evaluator.AttributeWithValueNot(str, localTokenQueue.h())); return; } if (localTokenQueue.b("^=")) { this.e.add(new Evaluator.AttributeWithValueStarting(str, localTokenQueue.h())); return; } if (localTokenQueue.b("$=")) { this.e.add(new Evaluator.AttributeWithValueEnding(str, localTokenQueue.h())); return; } if (localTokenQueue.b("*=")) { this.e.add(new Evaluator.AttributeWithValueContaining(str, localTokenQueue.h())); return; } if (localTokenQueue.b("~=")) { this.e.add(new Evaluator.AttributeWithValueMatching(str, Pattern.compile(localTokenQueue.h()))); return; } throw new Selector.SelectorParseException("Could not parse attribute query '%s': unexpected token at '%s'", new Object[] { this.d, localTokenQueue.h() }); } private void h() { this.e.add(new Evaluator.AllElements()); } private void i() { this.e.add(new Evaluator.IndexLessThan(l())); } private void j() { this.e.add(new Evaluator.IndexGreaterThan(l())); } private void k() { this.e.add(new Evaluator.IndexEquals(l())); } private int l() { String str = this.c.e(")").trim(); Validate.a(StringUtil.b(str), "Index must be numeric"); return Integer.parseInt(str); } private void m() { this.c.c(":has"); String str = this.c.a('(', ')'); Validate.a(str, ":has(el) subselect must not be empty"); this.e.add(new g(a(str))); } private void n() { this.c.c(":not"); String str = this.c.a('(', ')'); Validate.a(str, ":not(selector) subselect must not be empty"); this.e.add(new j(a(str))); } Evaluator a() { this.c.e(); if (this.c.a(a)) { this.e.add(new m()); a(this.c.d()); } while (!this.c.a()) { boolean bool = this.c.e(); if (this.c.a(a)) { a(this.c.d()); continue; c(); } else if (bool) { a(' '); } else { c(); } } if (this.e.size() == 1) { return (Evaluator)this.e.get(0); } return new c(this.e); } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
dc8718d9c3c7f4ea96586745a5ab169465fb8d54
dce12ec907511424713be130fe7959f3868194b5
/src/main/java/com/klymchuk/reflectionApi/staticData/PageTitle.java
12c3e78f1e8b7f44a904cb90e01ccd26a9786819
[]
no_license
iklymchuk/web-automation
1dda10cb64bb23e0890314d3a1157b125d99e565
3243d1a534bae7ab32fe8cf851e927f19f7d29de
refs/heads/master
2021-01-10T09:44:17.122995
2016-02-05T15:26:24
2016-02-05T15:26:24
50,850,467
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.klymchuk.reflectionApi.staticData; /** * Created by iklymchuk on 01.02.16. */ public enum PageTitle { EMPTY(""), LOGIN_PAGE("ONLINE STORE › Log In"), HOME_PAGE(""), ACCOUNT_PAGE(""); private String pageTitle; private PageTitle (String pageTitle) { this.pageTitle = pageTitle; } public String getPageTitle() { return pageTitle; } }
[ "klimchuk_ivan@mail.ru" ]
klimchuk_ivan@mail.ru
dd90d1909c45d5df0d0c040b82a96a6bcf176ed8
5152d4af7fb8d72a92f72bc3dab8baceb7d1f6b0
/src/main/java/spring/gradle/app/GradleAppApplication.java
76d60f589f63584243a1b84d14c29107d12f99f1
[]
no_license
EithiriHtun/spring5-mongo-recipe-app
cebf557cb1b303fb4cf9f6a6946ceb0fbe58c7e1
8ab6743ea929dd2312dd5e05857433371836bf48
refs/heads/master
2022-10-08T20:36:27.406803
2020-06-08T10:51:04
2020-06-08T10:51:04
270,631,830
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package spring.gradle.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GradleAppApplication { public static void main(String[] args) { SpringApplication.run(GradleAppApplication.class, args); } }
[ "eithiritun1997@gmail.com" ]
eithiritun1997@gmail.com
0f41219430e0385486b89d91dbe5d21dd66c2b9a
8b1937c179c2830c6c04df536a44fc39e2cd8caa
/src/main/java/com/apap/tutorial4/service/PilotService.java
bd186e8cb752c0353735769c503c240e1a0db1d2
[]
no_license
Apap-2018/tutorial4_1606822964
178ffa4fc87656575d78662b84a313b0d804267f
c4c2b701a8c03bb815355b79097fc80997778187
refs/heads/master
2020-03-30T21:01:59.398548
2018-10-04T18:01:39
2018-10-04T18:01:39
151,614,095
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.apap.tutorial4.service; import com.apap.tutorial4.model.PilotModel; /** * PilotService * @author Priscilla Tiffany */ public interface PilotService { PilotModel getPilotDetailByLicenseNumber(String licenseNumber); void addPilot(PilotModel pilot); void deletePilot(PilotModel pilot); void updatePilot(PilotModel pilot, String name, int flyHour); }
[ "priscilla.tiffany@ui.ac.id" ]
priscilla.tiffany@ui.ac.id
2c6d6436994e580786680fa474b274681b48f66e
5701f8e018afe56e78e151ff4f088b2ebab427be
/src/Operations/DBOperations.java
f1ee09be6b1aacd040b41495e18f916633c710c9
[]
no_license
gezgblack/Year2Project
169c31f2b2b2aba9bbc42532205dab9d18da947e
d8b11d840bee4aed98c0ca6752650b9b1e06fe61
refs/heads/master
2020-05-18T06:50:28.777706
2015-10-01T09:46:38
2015-10-01T09:46:38
36,433,540
0
1
null
null
null
null
UTF-8
Java
false
false
22,855
java
package Operations; import java.sql.*; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import oracle.jdbc.pool.OracleDataSource; public class DBOperations { private PreparedStatement pstmt; private ResultSet rset; private Connection conn; private Statement stmt; public DBOperations() { conn = openDB(); } public Connection openDB() { try { OracleDataSource ods = new OracleDataSource(); //Tallaght ods.setURL("jdbc:oracle:thin:@//10.10.2.7:1521/global1"); ods.setUser("x00108663"); ods.setPassword("db31Mar96"); // Home Oracle XE //ods.setURL("jdbc:oracle:thin:HR/pmagee@localhost:1521:XE"); //ods.setUser("hr"); //ods.setPassword("passhr"); conn = ods.getConnection(); } catch (Exception e) { System.out.print("Unable to load driver " + e); System.exit(1); } return conn; } public void closeDB() { try { conn.close(); System.out.print("Connection closed"); } catch (SQLException e) { System.out.print("Could not close connection "); e.printStackTrace(); } } public ResultSet Login(String user, String pass) { try{ String query = "SELECT username, phoneNum, address, name, email, shopId, userLevel FROM Users WHERE username=" + " '" + user + "' AND password='"+pass+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at login operation" + ex); return null; } } public int getQtybyID(String ID){ int prodQty = -7; try{ String sql ="SELECT qtyOnHand FROM Products WHERE productID = "+ID+""; pstmt =conn.prepareStatement(sql); rset= pstmt.executeQuery(sql); if(rset.next()){ prodQty =rset.getInt(1); } return prodQty; }catch(Exception ex){ System.out.println("Error here at getQtybyID " + ex); return -7; } } public ResultSet showStock(int shopID) { try { String query = "SELECT productId,productName,productPrice,sellCost,qtyOnHand FROM Products WHERE shopId='"+shopID+"'" ; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at showStock Operation " + ex); return null; } } public ResultSet showSales(int shopId) { try { String query = "SELECT salesId, sales.username, productId, amountSold, totalSale, customer, salesDate FROM Sales INNER JOIN Users ON Sales.Username=Users.Username WHERE ShopId ='"+shopId+"' ORDER BY salesdate DESC"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at showStock Operation " + ex); return null; } } public ResultSet searchSales(String name, int shopId) { //Searching by Product Id try { String query = "SELECT salesId, sales.username, productId, amountSold, totalSale, customer, salesDate FROM Sales INNER JOIN Users ON Sales.username=Users.username WHERE salesId = '" + name + "' AND ShopId ='"+shopId+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at searchId Operation"); } return rset; } public ResultSet searchId(String id, int shopId) { //Searching by Product Id try { String query = "SELECT productId,productName,productPrice,sellCost,qtyOnHand FROM Products WHERE productId = '" + id + "' AND shopId ='"+shopId+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at searchId Operation"); } return rset; } public ResultSet searchName(String name, int shopID) { //Searching by Product Name try { String query = "SELECT productId,productName,productPrice,sellCost,qtyOnHand FROM Products WHERE UPPER(productName) = UPPER('" + name + "') AND shopId ='"+shopID+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at searchName Operation"); } return rset; } public ResultSet searchOrderId(String id, int shopId) { //Searching by Order Id try { String query = "SELECT orderId,orderDate,orderCost FROM Delivery WHERE orderId = '" + id + "'" + "AND shopId ='"+shopId+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at searchOrderId Operation"); } return rset; } //ADD PRODUCT CODE public void addProduct(String productName, Double productPrice, Double sellCost, int qty, int shopId) { try { String insertString = "INSERT INTO Products(productId,productName,productPrice,sellCost,qtyOnHand,shopId) values(productId_seq.nextVal,?,?,?,?,?)"; pstmt = conn.prepareStatement(insertString); pstmt.setString(1, productName); pstmt.setDouble(2, productPrice); pstmt.setDouble(3, sellCost); pstmt.setInt(4, qty); pstmt.setInt(5, shopId); pstmt.executeUpdate(); String query = "SELECT * FROM Products"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while (rset.next()) { System.out.print(rset); } } catch (Exception e) { System.out.println(e); } } //REMOVE A PRODUCT public int deleteProduct(String name, int qty){ int no=0; try{ String productNames = getProductName(name); String sql = "DELETE FROM Products WHERE productName ="+"'"+ name +"'"+"AND qtyOnHand =" + qty; pstmt= conn.prepareStatement(sql); no = pstmt.executeUpdate(sql); }catch(Exception ex){ System.out.println("Error here in deleteProduct Operations" + ex); } return no; } // GET PRODUCT NAME public String getProductName(String name){ String prodNames =""; try{ String sql ="SELECT productName FROM Products WHERE productName = "+"'"+name+"'"; pstmt =conn.prepareStatement(sql); rset= pstmt.executeQuery(sql); if(rset.next()){ prodNames =rset.getString(0); } }catch(Exception ex){ System.out.println("Error here at getProductName " + ex); } return prodNames; } public int getShopIdofProduct(String productId){ int shopId =0; try{ String sql ="SELECT shopId FROM Products WHERE productId = "+"'"+productId+"'"; pstmt =conn.prepareStatement(sql); rset= pstmt.executeQuery(sql); if(rset.next()){ shopId =rset.getInt(1); } }catch(Exception ex){ System.out.println("Error here at getProductName " + ex); } return shopId; } public void editStock(String prodID, String newName, double newPrice, double newSellCost, int newQty){ try{ String e = "UPDATE Products SET productName=" + "'" + newName + "'"+ "," + "productPrice=" + "'" + newPrice + "'" + ","+ "sellCost=" + "'" + newSellCost + "'" + "," + "qtyOnHand=" + "'" + newQty + "' WHERE PRODUCTID='"+prodID+"'"; stmt = conn.createStatement(); stmt.executeUpdate(e); }catch (Exception se) { System.out.println(se); } } public void removeProduct(String name, int shopId){ try{ String deleteString = "DELETE FROM PRODUCTS WHERE productName = '"+name+"' AND shopId ='"+shopId+"'"; stmt = conn.createStatement(); stmt.executeUpdate(deleteString); }catch(Exception se){ System.out.println(se); } } //Set stock qty using productid public void changeStockQty(String productId, int diff, int shopId){ try{ String removeSQL = "UPDATE Products SET qtyOnHand='" + diff+"' WHERE productId='"+productId+"' AND shopId ='"+shopId+"'"; stmt = conn.createStatement(); stmt.executeUpdate(removeSQL); }catch (Exception se) { System.out.println(se); } } public ResultSet showDelivery(int shopId) { try { String s=""; String query = "SELECT orderId,orderDate,orderCost FROM Delivery WHERE shopId='" + shopId + "' ORDER BY orderDate DESC" ; pstmt = conn.prepareStatement(query); rset=pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at showDelivery Operation " + ex); return null; } } public ResultSet filterDate(String dateToBack, String table, int shopId){ try{ Calendar dt = Calendar.getInstance(); Calendar backDate = Calendar.getInstance(); DateFormat dateFormat = new SimpleDateFormat("YYYY-MMM-dd"); Date d1 = new Date(); Date d2; d1 = dt.getTime(); String query ="", datePhrase=""; String s = dateFormat.format(d1).toString(); if(table.equals("Delivery")){ query ="select orderId,orderDate,orderCost from delivery where shopId ='"+shopId+"' AND "; datePhrase = "orderDate"; }else if(table.equals("Sales")){ query ="SELECT salesId, sales.username, productId, amountSold, totalSale, customer, salesDate FROM Sales INNER JOIN Users ON Sales.Username=Users.Username WHERE users.ShopId = '"+shopId+"' AND "; datePhrase="salesDate"; } if(dateToBack.equals("Last Week")){ backDate.add(Calendar.DAY_OF_YEAR, -7); d2 = backDate.getTime(); String s2 = dateFormat.format(d2).toString(); // System.out.println(s+"\n"+ s2); query += (datePhrase+" <=To_date('"+s+"','YYYY-mon-DD') AND "+datePhrase+" >=To_date('"+s2+"', 'YYYY-mon-DD')"); } else if(dateToBack.equals("Last Month")){ backDate.add(Calendar.DAY_OF_YEAR,-30); d2 = backDate.getTime(); String s2 = dateFormat.format(d2).toString(); query += (datePhrase+" <=To_date('"+s+"','YYYY-mon-DD') AND "+datePhrase+" >=To_date('"+s2+"', 'YYYY-mon-DD')"); } else if(dateToBack.equals("Last Year")){ backDate.add(Calendar.DAY_OF_YEAR,-365); d2 = backDate.getTime(); String s2 = dateFormat.format(d2).toString(); query += (datePhrase+" <=To_date('"+s+"','YYYY-mon-DD') AND "+datePhrase+" >=To_date('"+s2+"', 'YYYY-mon-DD')"); } pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; }catch(Exception ex){ System.out.println("Error here at filterDate Operation "+ ex); return null; } } //ADD NEW DELIVERY public void addDelivery(String orderDate, String productId, int quantity, double cost,int shopId) { try { String insertString = "INSERT INTO Delivery(orderId, orderDate,productId,qty,orderCost,shopId) values(orderId_seq.nextVal, To_date(?,'YYYY-mon-DD'),?,?,?,?)"; pstmt = conn.prepareStatement(insertString); //pstmt.setDate(1, settingDate()); pstmt.setString(1, orderDate); pstmt.setString(2, productId); pstmt.setInt(3, quantity); pstmt.setDouble(4,cost); pstmt.setInt(5,shopId); pstmt.executeUpdate(); String query = "SELECT * FROM Delivery"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while (rset.next()) { System.out.print(rset); } } catch (Exception e) { System.out.println(e); } } public void logSale(String user, String productID, int qty, double total, String custName, String date) { try { String insertString = "INSERT INTO Sales(salesId,username,productId,amountSold,totalSale,customer,salesDate) values(salesId_seq.nextVal,?,?,?,?,?,To_date(?,'YYYY/MM/DD HH24/MI/SS'))"; pstmt = conn.prepareStatement(insertString); pstmt.setString(1, user); pstmt.setString(2, productID); pstmt.setDouble(3, qty); pstmt.setDouble(4, total); pstmt.setString(5, custName); pstmt.setString(6, date); pstmt.executeUpdate(); String query = "SELECT * FROM Products"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while (rset.next()) { System.out.print(rset); } } catch (Exception e) { System.out.println(e); } } //GET SHOP MONEY public double getShopMoney(int shopID){ try{ double money =0; String sql ="SELECT shopBank FROM Shop WHERE shopID = "+shopID+""; pstmt =conn.prepareStatement(sql); rset= pstmt.executeQuery(sql); if(rset.next()){ money =rset.getDouble(1); } return money; }catch(Exception e){ System.out.println(e); return 0; } } public void updateBank(double amt,boolean positive, int shopID) { try { double newBal = 0; if (positive == true) { newBal = amt + getShopMoney(shopID); } else { newBal = getShopMoney(shopID)- amt; } String removeSQL = "UPDATE Shop SET shopBank='" + newBal + "' WHERE shopID='" + shopID + "'"; stmt = conn.createStatement(); stmt.executeUpdate(removeSQL); }catch(Exception se){ System.out.println(se); } } //Sell Stock public void sellStock(String prodName, double total, int diff, int shopID){ try{ updateBank(total,true,shopID); //Adds the total of the sale to the shops bank changeStockQty(prodName, diff, shopID); //Changes stock quantity }catch(Exception e){ System.out.println(e); } } public ResultSet salesSearch(ArrayList<String> id, int shopId) { //Searching by Product Id try { String idS = ""; for(int loop1 =0; loop1 < id.size();loop1++){ if(loop1 == 0){ idS += "productID ='"+id.get(loop1)+"'"; }else if(loop1==id.size()){ idS += "OR productID='"+id.get(loop1)+"'"; }else{ idS += "OR productID='"+id.get(loop1)+"'"; } } String query = "SELECT productID, ProductName AS \"Product Name\", ProductPrice AS \"Price\", SellCost AS \"Cost\", qtyOnHand AS \"Amount Available\", 'Shannon Is Awesome' AS \"Quantity\" FROM Products WHERE shopId='"+shopId+"' AND (" + idS + ")"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at sales Operation "+ex); } return rset; } public boolean inStock(String prodId, int shopId){ boolean in = false; try{ String sql ="SELECT productId FROM Products WHERE shopID = "+shopId+" AND productID ='"+prodId+"'"; pstmt =conn.prepareStatement(sql); rset= pstmt.executeQuery(sql); while(rset.next()){ if(rset.getString(1).equals(prodId)){ in = true; } } }catch(Exception e){ System.out.println("Error here at InStock "+e); } return in; } public String[] getShops(){ try { String query1 = "SELECT shopName FROM Shop"; String query2 = "Select Count(*) FROM Shop"; pstmt = conn.prepareStatement(query1); ResultSet rset1 = pstmt.executeQuery(query1); pstmt = conn.prepareStatement(query2); ResultSet rset2 = pstmt.executeQuery(query2); int counter = 0; int length =0; while(rset2.next()){ length = rset2.getInt(1);} String[] shopIds = new String[length]; while(rset1.next()){shopIds[counter]=rset1.getString(1); counter++;} return shopIds; } catch (Exception ex) { System.out.println("Error here at searchbyProdId Operation "+ex); } return null; } public void addShop(String shopName, String shopAddress, String phoneNum, double shopBank) { try { String insertString = "INSERT INTO Shop(shopId,shopName,shopAddress,phoneNum,shopBank) values(shopId_seq.nextVal,?,?,?,?)"; pstmt = conn.prepareStatement(insertString); pstmt.setString(1, shopName); pstmt.setString(2, shopAddress); pstmt.setString(3, phoneNum); pstmt.setDouble(4, shopBank); pstmt.executeUpdate(); String query = "SELECT * FROM Shop"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while (rset.next()) { System.out.print(rset); } } catch (Exception e) { System.out.println(e); } } //Remove Shop public void removeShop(String shopId){ try{ String deleteString = "DELETE FROM SHOP WHERE shopId = '"+shopId+"'"; stmt = conn.createStatement(); stmt.executeUpdate(deleteString); }catch(Exception se){ System.out.println(se); } } //ADD User public void addUser(String username, String pw,int lvl, String phNum, String addr, String name, String email, int shopId) { try { String insertString = "INSERT INTO Users(username,password,userLevel,phoneNum,address,name,email,shopId) values(?,?,?,?,?,?,?,?) "; pstmt = conn.prepareStatement(insertString); pstmt.setString(1, username); pstmt.setString(2, pw); pstmt.setInt(3, lvl); pstmt.setString(4, phNum); pstmt.setString(5, addr); pstmt.setString(6,name); pstmt.setString(7, email); pstmt.setInt(8, shopId); pstmt.executeUpdate(); String query = "SELECT * FROM Users"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while (rset.next()) { System.out.print(rset); } } catch (Exception e) { System.out.println(e); } } public int getShopIdOfShopName(String shopName){ int shopId = -7; try{ String query="SELECT shopId From Shop WHERE shopName= '"+ shopName+ "'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(); while(rset.next()){ shopId = rset.getInt(1); } return shopId; }catch(Exception ex){ System.out.println("Error here at getShopId Operation " + ex); return shopId; } } public ResultSet getProductByName(String name, int shopId) { //Searching by Product name try { String query = "SELECT * FROM Products WHERE productName = '" + name + "' AND shopId ='"+shopId+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at searchId Operation"); } return rset; } public ResultSet getShopDetails(String shopId){//Gets a shops information for the purposes of constructing a shop object try { String query = "SELECT * FROM Shop WHERE shopId ='"+shopId+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); } catch (Exception ex) { System.out.println("Error here at getShopDetails Operation"); } return rset; } public ResultSet showDb(String db){ try { String query = "SELECT * FROM "+db+""; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at Show DB Operation " + ex); return null; } } public ResultSet productDetails(String prodID){ try { String query = "SELECT * FROM Products WHERE productId='"+prodID+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); return rset; } catch (Exception ex) { System.out.println("Error here at Product Details Operation " + ex); return null; } } public boolean usernameExists(String username){ try { String query = "SELECT * FROM Users WHERE username='"+username+"'"; pstmt = conn.prepareStatement(query); rset = pstmt.executeQuery(query); while(rset.next()){ return true; } } catch (Exception ex) { System.out.println("Error here at Product Details Operation " + ex); } return false; } }
[ "gezgblack@gmail.com" ]
gezgblack@gmail.com
008049151b5cb086450962437d0248da21cbdfa7
bdd290e07e48e11a385c8dd521f085d8da29684b
/src/main/java/Pomodoro/settings/control/Range.java
4520f7444b4879a5b64050867c15428c8f572188
[]
no_license
JRbemt/Pomodoro
9248793d86c56d2eb61c27627aea6977a582532f
c0e8ed7a2285e15da831e9be774308b3556a5a0f
refs/heads/master
2020-04-22T06:21:45.339962
2019-02-11T19:27:01
2019-02-11T19:27:01
170,187,651
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package Pomodoro.settings.control; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Range { double min() default 0d; double max() default 1d; double stepsize() default 0.1d; }
[ "joaquin.vandenbemt@gmail.com" ]
joaquin.vandenbemt@gmail.com
9fa3ac3d2d5fa3e79041a1cd38e703e5cfce582b
b9bc871eee837dea4f12f808c9011b99e19464e2
/src/org/apache/commons/lang/IncompleteArgumentException.java
5e8d675d3a21821a53f9eafe432889bcf2b86efa
[]
no_license
qian/qdemo
c46fd37a7b2c669f4acc76f8be727391c320d2a1
13023919cb967b4e87b1acfd4eb1b1d7a236e20a
refs/heads/master
2020-05-19T12:40:45.639176
2011-02-14T03:35:28
2011-02-14T03:35:28
1,349,923
0
1
null
null
null
null
UTF-8
Java
false
false
3,282
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.commons.lang; import java.util.Arrays; /** * <p>Thrown to indicate an incomplete argument to a method. * This exception supplements the standard <code>IllegalArgumentException</code> * by providing a more semantically rich description of the problem.</p> * * <p><code>IncompleteArgumentException</code> represents the case where a method takes * in a parameter that has a number of properties, some of which have not been set. * A case might be a search requirements bean that must have three properties set * in order for the method to run, but only one is actually set. * This exception would be used in place of * <code>IllegalArgumentException</code>, yet it still extends it.</p> * * <pre> * public void foo(PersonSearcher search) { * if (search.getSurname() == null || * search.getForename() == null || * search.getSex() == null) { * throw new IncompleteArgumentException("search"); * } * // do something with the searcher * } * </pre> * * @author Matthew Hawthorne * @since 2.0 * @version $Id: IncompleteArgumentException.java 437554 2006-08-28 06:21:41Z bayard $ */ public class IncompleteArgumentException extends IllegalArgumentException { /** * Required for serialization support. * * @see java.io.Serializable */ private static final long serialVersionUID = 4954193403612068178L; /** * <p>Instantiates with the specified description.</p> * * @param argName a description of the incomplete argument */ public IncompleteArgumentException(String argName) { super(argName + " is incomplete."); } /** * <p>Instantiates with the specified description.</p> * * @param argName a description of the incomplete argument * @param items an array describing the arguments missing */ public IncompleteArgumentException(String argName, String[] items) { super( argName + " is missing the following items: " + safeArrayToString(items)); } /** * <p>Converts an array to a string without throwing an exception.</p> * * @param array an array * @return the array as a string */ private static final String safeArrayToString(Object[] array) { return array == null ? null : Arrays.asList(array).toString(); } }
[ "qiananchuan@gmail.com" ]
qiananchuan@gmail.com
330c06adcd47ada6c6f7a80c72f81d8bc9cd25d0
0ad7a93ea5942b1d97972bd482e3b6ff178c724e
/src/main/java/com/jsfbootsfaces/view/PaginatorView.java
0fe3a3c8f3f80dc5a9816f8be417213c1b16bd16
[]
no_license
jierou/clp
247291b67f80f7a2d05b381adb4f4b6d72b17917
d9a9b38cb969ea3d54fc5e3632cc0cd865e3aefa
refs/heads/master
2021-01-12T01:34:07.827122
2017-02-06T08:29:12
2017-02-06T08:29:12
78,404,630
0
0
null
null
null
null
UTF-8
Java
false
false
283
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 com.jsfbootsfaces.view; /** * * @author sharon */ public class PaginatorView { }
[ "sharonlee@base.tw" ]
sharonlee@base.tw
6409e12b1c53625bef82178c151e3d1a1fd9c720
04d13742c89a404661cdac8bdb93a2e7225661aa
/api/src/main/java/com/yuyh/inject/ViewInjector.java
e8d708052650012ea13d9b7c62822da51990f894
[]
no_license
smuyyh/ProcessorDemo
92d09742bcdc9434a9e6e4af2ce3d8a4a00f30e7
615a6a69b694940fef059613e566f09f6a4095b2
refs/heads/master
2021-01-19T18:28:53.470386
2017-08-24T05:01:54
2017-08-24T05:01:54
101,140,697
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package com.yuyh.inject; /** * @author yuyuhang. * @since 2017/8/22. */ public interface ViewInjector<T> { void inject(T t, Object source); }
[ "352091626@qq.com" ]
352091626@qq.com
084062c414ff1f30df52ec10a092c8c340482c5f
764ce39c1bad590bf7839b4e175539eecbb9584a
/tis-console/src/main/java/com/alibaba/citrus/turbine/Context.java
65e0c8a5ab523e4e941230194e22cce704498eb2
[ "MIT" ]
permissive
GSIL-Monitor/tis-neptune
9b758ec5f6e977d353ce66c7c625537dfb1253e2
28f4d1dc3d4ada256457837ead3249e4addac7c2
refs/heads/master
2020-04-17T11:13:35.969979
2019-01-19T09:55:00
2019-01-19T09:55:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,518
java
/* * The MIT License * * Copyright (c) 2018-2022, qinglangtech Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * 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.alibaba.citrus.turbine; import java.util.Set; /* * * @author 百岁(baisui@qlangtech.com) * @date 2019年1月17日 */ public interface Context { public boolean containsKey(String key); public Object get(String key); public Set<String> keySet(); public void put(String key, Object value); public void remove(String key); }
[ "baisui@2dfire.com" ]
baisui@2dfire.com
5ee73efa5e4843251211fbe5797026d78397fde0
2a4010ae57a7c580d756f6f1cedeeb48e3353eca
/app/src/main/java/com/keenbrace/activity/InputActivity.java
1f55f39195f844c0ef4573697eb42bfc93e291f4
[]
no_license
feark/keenbrace3
f057a1d999ba0cfd25c161a25fa120a948fd49d2
c059c3b57e8495e4d011cfcf098ee2b0fea23352
refs/heads/master
2021-01-13T03:01:13.731881
2016-12-21T08:37:29
2016-12-21T08:37:29
77,028,038
0
0
null
null
null
null
UTF-8
Java
false
false
2,298
java
package com.keenbrace.activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.InputType; import android.view.MenuItem; import android.widget.EditText; import com.keenbrace.R; import com.keenbrace.base.BaseActivity; import butterknife.Bind; import butterknife.OnClick; public class InputActivity extends BaseActivity { int type=1; public static int INPUT_TEXT=0; public static int INPUT_EMAIL=1; public static int INPUT_MOBIEL=2; public static int INPUT_MORE=3; String value; @Bind(R.id.et_input) EditText etInput; @OnClick(R.id.iv_clean) void clean() { etInput.setText(""); } void updateTextType() { etInput.setText(value); switch (type) { case 0: break; case 1: etInput.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS); etInput.setHint(R.string.hit_email); break; case 2: etInput.setInputType(InputType.TYPE_CLASS_PHONE); etInput.setHint(R.string.hit_mobile); break; case 3: etInput.setLines(5); etInput.setHint("请输入备注"); } } @Override protected int getLayoutId() { return R.layout.activity_input; } @Override public void initView() { type = getIntent().getIntExtra("type", 0); value= getIntent().getStringExtra("value"); updateTextType(); toolbar.inflateMenu(R.menu.menu_save); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { save(); return true; } }); } @Override public void initData() { } @Override protected boolean hasBackButton() { return true; } @Override protected boolean hasActionBar() { return true; } void save() { Intent intent3 = new Intent(); Bundle mBundle = new Bundle(); mBundle.putString("value",etInput.getText().toString()); intent3.putExtras(mBundle); setResult(type, intent3); finish(); } }
[ "lj@keenbrace.com" ]
lj@keenbrace.com
7215cea5a797afe08309b551fc50cf36f01de783
05fef908524df342bc303e41b2c21bcb85905453
/ceredeserver/src/main/java/com/mayforever/cerede/rmi/RmiImageServer.java
61dbd7dab596b309c61d639174ceb59d7eb1b362
[]
no_license
mayforever/cerede2
c7fa500bb49bd916223e13a1b8d7e7cf3b5f330a
0179f4cfb55c3cd4504a0c2883769a624fc8c368
refs/heads/master
2021-07-18T13:29:29.769661
2020-10-24T07:28:16
2020-10-24T07:28:16
214,139,759
0
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
package com.mayforever.cerede.rmi; import java.rmi.AlreadyBoundException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.HashMap; public class RmiImageServer{ // protected RmiImageServer(int port) throws RemoteException { // super(port); // mapChangesColumn = new HashMap<>(); // BaseClassImage baseClassImage = new BaseClassImage(this); // try { // Naming.bind("rmi://0.0.0.0:"+port+"/BaseClassImage", baseClassImage); // // } catch (MalformedURLException | AlreadyBoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // // TODO Auto-generated constructor stub // } public RmiImageServer(int port, String ip) { mapChangesColumn = new HashMap<>(); mapClipboardText = new HashMap<String, String>(); BaseClassImage baseClassImage; try { baseClassImage = new BaseClassImage(); Registry r = LocateRegistry.createRegistry(port); // r = LocateRegistry.getRegistry(); r.bind("cerede", baseClassImage); } catch (RemoteException | AlreadyBoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } public HashMap<String, HashMap<Short, HashMap<Short, Integer>>> mapChangesColumn = null; public HashMap<String, String> mapClipboardText = null; /** * */ // private static final long serialVersionUID = 1L; }
[ "chonggomuvalencia@gmail.com" ]
chonggomuvalencia@gmail.com
2df1aa0c07ab2437588f1df48018ac62f4df1055
504d74691a788976f07b792d521da0b5b51d8dfe
/optimise/src/optimise/geters.java
6385c74c810e4ba7403ca559107eea1296696dcf
[]
no_license
hemanth-431/My-JAVA-Codes
e8286d43fa51041e9fffeff4c66b287b9bf38115
96aafbcfd4a0c8603b79055c5d5bc1e6ce4baf80
refs/heads/master
2023-06-18T01:19:28.337254
2021-07-14T17:35:29
2021-07-14T17:35:29
386,028,031
0
0
null
null
null
null
UTF-8
Java
false
false
1,400
java
package optimise; import java.util.Scanner; class hi { Scanner in=new Scanner(System.in); private int age; private String id; private String location; private String name; public int getAge() { return age; } public void setAge(int age) { System.out.println("Enter age"); age=in.nextInt(); this.age = age; } public String getId() { return id; } public void setId(String id) { System.out.println("Enter id"); id=in.nextLine(); this.id = id; } public String getLocation() { return location; } public void setLocation(String location) { System.out.println("Enter location"); location=in.nextLine(); this.location = location; } public String getName() { return name; } public void setName(String name) { System.out.println("Enter name"); name=in.nextLine(); this.name = name; } } public class geters { public static void main(String[] args) { hi obj=new hi(); obj.setAge(0); obj.setId("34"); obj.setName(null); obj.setLocation(null); System.out.println(obj.getName()); System.out.println(obj.getAge()); System.out.println(obj.getId()); System.out.println(obj.getLocation()); } }
[ "bandlavhemanth@gmail.com" ]
bandlavhemanth@gmail.com