blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
f62289ae51c65f934616ba3603648363ef84f325
8ed9f95fd028b7d89e7276847573878e32f12674
/docx4j-openxml-objects-sml/src/main/java/org/xlsx4j/sml/STFormulaExpression.java
0576b2c952f713be1bb7c3435f1950dd782adc3e
[ "Apache-2.0" ]
permissive
plutext/docx4j
a75b7502841a06f314cb31bbaa219b416f35d8a8
1f496eca1f70e07d8c112168857bee4c8e6b0514
refs/heads/VERSION_11_4_8
2023-06-23T10:02:08.676214
2023-03-11T23:02:44
2023-03-11T23:02:44
4,302,287
1,826
1,024
null
2023-03-11T23:02:45
2012-05-11T22:13:30
Java
UTF-8
Java
false
false
2,259
java
/* * Copyright 2010-2013, Plutext Pty Ltd. * * This file is part of xlsx4j, a component of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.xlsx4j.sml; import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; /** * <p>Java class for ST_FormulaExpression. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ST_FormulaExpression"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="ref"/> * &lt;enumeration value="refError"/> * &lt;enumeration value="area"/> * &lt;enumeration value="areaError"/> * &lt;enumeration value="computedArea"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "ST_FormulaExpression") @XmlEnum public enum STFormulaExpression { @XmlEnumValue("ref") REF("ref"), @XmlEnumValue("refError") REF_ERROR("refError"), @XmlEnumValue("area") AREA("area"), @XmlEnumValue("areaError") AREA_ERROR("areaError"), @XmlEnumValue("computedArea") COMPUTED_AREA("computedArea"); private final String value; STFormulaExpression(String v) { value = v; } public String value() { return value; } public static STFormulaExpression fromValue(String v) { for (STFormulaExpression c: STFormulaExpression.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
12e83a4004de0361498e1f6e8ab397c6929e780d
567dcdd93b4bf252577a753fdaab4a8ca8e25cfa
/src/com/android/callassistant/info/ContactInfo.java
20e9f4df42f7a1c8154d7091afbcda8db6416cfe
[]
no_license
taugin/callassistant
8d8554160cd11bb4c39bba10a91223c7c32372af
75b5741928feae085a8e9ce07b1fcd469dd8ae37
refs/heads/master
2016-09-11T07:17:45.388521
2014-11-23T04:42:13
2014-11-23T04:42:13
22,370,597
2
0
null
null
null
null
UTF-8
Java
false
false
590
java
package com.android.callassistant.info; import android.text.TextUtils; public class ContactInfo { public int _id; public String contactName; public int contactSex; public int contactAge; public String contactAddress; public String contactNumber; public int contactLogCount; public long contactUpdate; public int contactAllowRecord; public int contactState; public boolean contactModifyName; public boolean checked; public boolean blocked; public String toString() { return contactNumber; } }
191bb2356a3e60e1c40c9f980065ffcc376978da
ba9544bb66d8d07a30d7990f29d925a369d4f458
/java-basic/src/main/java/bitcamp/java100/ch11/ex6/B.java
73e0254f0a82df67e3b89e236f61f265d36f7c00
[]
no_license
dumnight/bitcamp
b0345a21494999bdfb1d6b22974bebb5f5ecd493
ba2c21cfc30c6dac7693c0dec0e005ca3c8027a2
refs/heads/master
2021-09-07T00:32:34.960358
2018-02-14T06:07:47
2018-02-14T06:07:47
104,423,412
0
0
null
null
null
null
UTF-8
Java
false
false
139
java
package bitcamp.java100.ch11.ex6; public class B extends A { int v2; public void m2() { System.out.println("B.m2()"); } }
b24b079a2d9397e554dc797fb7b8a752f876755d
34d2f6c5d8e332fb2e6911fe3fc627546f53fc4a
/src/main/java/com/mrig/rest/webservices/restfulwebservices/service/TodoJpaRepository.java
ebb4e8684c8ab08ee7b476b37f08a01f1bd65d8d
[]
no_license
mrig786/ActivityManagement-backend
f72fa0aedfe8c549d18dec13278cc21e97f68d87
6e69c0b35c1933bcdc5fecb5e7a8c46229bad62a
refs/heads/master
2022-06-16T10:52:35.091233
2020-05-03T08:15:12
2020-05-03T08:15:12
260,856,863
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.mrig.rest.webservices.restfulwebservices.service; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.mrig.rest.webservices.restfulwebservices.beans.Todo; public interface TodoJpaRepository extends JpaRepository<Todo, Long> { List<Todo> findByUsername(String username); }
f2dcec1bc5b7b35fcaec930673dcbf53d0dff556
25741747d249db8b7cbd1c0a8fc9fb93ad7fcbf1
/src/solid/liskov/ReadOnlyDocument.java
44639bd3901cc888f8e59d7aa2ff7c13bf18f181
[]
no_license
alexrgzo12/Modulo2JARG
c50b05f978a2a7a59d8ea54a455cb93986c536e3
f40580a4b6a53ded5304e85cbd103e338709ce12
refs/heads/main
2023-08-15T22:52:55.618995
2021-10-15T00:54:12
2021-10-15T00:54:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package solid.liskov; public class ReadOnlyDocument extends Document { public ReadOnlyDocument(String fileName) { super(fileName); } }
593e5c70650b72e41cb530c867a4677608acf953
1b29b52dfa9736dd51e1c109184306e684689f65
/src/controller/Controller_Product_Buy.java
c7352cef8ab0ebdb4e80523f034abfdbd7713826
[]
no_license
drosdek/SPT-SIG
0c9c5745a17d6fff7c7a79dfa24c45d3d1067b05
63255f63d7492a695122fda106411316f695c22c
refs/heads/master
2020-03-22T20:53:16.976408
2018-07-12T00:36:59
2018-07-12T00:36:59
140,639,129
0
0
null
2018-07-12T00:00:33
2018-07-12T00:00:33
null
UTF-8
Java
false
false
3,730
java
/* * Copyright (C) 2018 gruber * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package controller; import cache.Cache; import gqbd.GQBD; import java.util.ArrayList; import model.Order_Model_Purchase; import model.Person_Employee; import model.Person_Provider; import model.Product_Exchange; import model.Product_Price; import view.Container_Product_Buy; /** * * @author gruber */ public class Controller_Product_Buy { public void control(Container_Product_Buy container_Product_Buy) { GQBD.list_Person_providers(); GQBD.list_Person_employees(); GQBD.list_Products(); GQBD.list_Product_prices(); container_Product_Buy.setProviders(Cache.getPersons_provider()); container_Product_Buy.setEmployees(Cache.getPersons_employee()); Cache.getProducts().forEach((product) -> { Product_Price product_Price = new Product_Price(); Product_Exchange product_Exchange = new Product_Exchange(); Cache.getProduct_Prices().forEach((price) -> { if (product.getId_product() == price.getProduct().getId_product()) { product_Exchange.setPrice(price); } }); product_Exchange.setDescription(product.getDescription()); product_Exchange.setId_product(product.getId_product()); product_Exchange.setModel(product.getModel()); product_Exchange.setName(product.getName()); product_Exchange.setUrl_image(product.getUrl_image()); container_Product_Buy.getProducts().add(product_Exchange); }); container_Product_Buy.updateComboProvider(); container_Product_Buy.updateComboEmployee(); container_Product_Buy.updateTable(); container_Product_Buy.getButton_cancel().setOnAction((event) -> { container_Product_Buy.getTableView().getItems().clear(); container_Product_Buy.updateTable(); }); container_Product_Buy.getButton_confirm().setOnAction((event) -> { ArrayList<Product_Exchange> products = new ArrayList(); for (Product_Exchange product_Exchange : container_Product_Buy.getTableView().getItems()) { if (product_Exchange.isAdded().get() || product_Exchange.getAmount().get() > 0) { products.add(product_Exchange); } } GQBD.insert_Order_Model_purchase(new Order_Model_Purchase( 0, (Person_Provider) container_Product_Buy.getComboBox_provider().getSelectionModel().getSelectedItem(), (Person_Employee) container_Product_Buy.getComboBox_employee().getSelectionModel().getSelectedItem(), products, 0, 0, "Compra", "Compra de produto Default")); container_Product_Buy.getTableView().getItems().clear(); container_Product_Buy.updateTable(); }); } }
1d5379e0093cfa39a938a2ac2b0b1e3fb77d6417
0588cf1de7a7d60827786107613dd318259815c4
/src/main/java/com/vrann/actormatrix/PositionLocator.java
0d4eeeb618fa83c2a50e6b17e2897047381c3033
[]
no_license
vrann/akka-block-matrix-operations
9db5a116bcda52acb1a26d23473399af9a55f736
0416f474d3cf2acdaeaa348e1ac2dfd518cc72c1
refs/heads/master
2021-07-08T14:40:35.548028
2020-11-14T10:47:47
2020-11-14T10:47:47
212,799,603
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package com.vrann.actormatrix; import java.util.ArrayList; import java.util.List; public class PositionLocator { private Position currentPosition; public PositionLocator(Position currentPosition) { this.currentPosition = currentPosition; } public List<Position> getL21Neighbours() { return new ArrayList<>(); } public String getDataLocation(Position position, String type) { return "topology1/data"; } }
38812134fb0fd8a5beee2fe90bd314bcd3beb4c4
40874ba6a9e6537434bed91675d026aa1b76aa3b
/src/com/hinj/asynctask/PhotoAsyncTask.java
e5b30581d53e12a4c26fd2ddaa570a71cf6615c2
[]
no_license
hitesh141/Hinj
3085964ab9eac24ba95d213ef9e3bdf20eb0caac
41266b8d2cb594cecb805206608a0175c7a47922
refs/heads/master
2021-01-10T20:56:11.858857
2015-07-07T07:22:47
2015-07-07T07:22:47
38,670,690
4
0
null
null
null
null
UTF-8
Java
false
false
11,300
java
/** * Copyright OCTAL INFO SOLUTIONS PVT LTD. */ package com.hinj.asynctask; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import org.json.JSONObject; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.AsyncTask; import android.provider.MediaStore; import android.provider.Settings.Secure; import android.util.Log; import com.hinj.app.utils.ConnectUrl; import com.hinj.app.utils.HinjAppPreferenceUtils; import com.hinj.app.utils.JsonPostRequest; import com.hinj.app.utils.RequestPost; import com.hinj.app.utils.SpyCallSharedPrefrence; import com.hinj.app.utils.Utility; import com.hinj.secure.smsgps.DeviceInterface; public class PhotoAsyncTask extends AsyncTask<String, Void, String> { private Context ctx; private static final String TAG = "PhotoAsyncTask"; private RequestPost mRequestPostClass; private DeviceInterface onComplete; Bitmap resized; /** * */ public PhotoAsyncTask(Context ctx,DeviceInterface onComplete) { this.ctx=ctx; this.onComplete=onComplete; } @Override public void onPreExecute() { } @Override protected String doInBackground(String... params) { try{ getImagesDetail(); }catch(Exception e){ e.printStackTrace(); }finally{ onComplete.onCompletedDeviceImages(); } return null; } @Override public void onPostExecute(String serverResponse) { } /********************************** Images Upload On Server Start*****************************/ public void getImagesDetail() { String filepath,imagename,imagetype; try{ final String orderBy = MediaStore.Images.Media._ID; Cursor imagecursor1 = ctx.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null,null, orderBy); int getTotal=imagecursor1.getCount(); int PreImageCount=SpyCallSharedPrefrence.getsaveIMAGES_PreCount(ctx); int remaingCount=getTotal-PreImageCount; Log.i("remaining count", "remaining "+remaingCount); int pp; if(remaingCount>0) { Log.i("remaining count", remaingCount+""); if(remaingCount>2){ pp=2; } else{ pp=remaingCount; } Cursor imagecursor = ctx.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null,null,orderBy+" LIMIT "+PreImageCount+","+ pp); //CallActivity.Imagescount=CallActivity.Imagescount+pp; int image_column_index = imagecursor.getColumnIndex(MediaStore.Images.Media._ID); Log.i("getTotalt***************", ""+getTotal); int j = 0; int countImage=0; while(imagecursor.moveToNext()){ countImage++; //Toast.makeText(this, "i "+imagecursor.getPosition(), Toast.LENGTH_SHORT).show(); int id = imagecursor.getInt(image_column_index); int dataColumnIndex = imagecursor.getColumnIndex(MediaStore.Images.Media.DATA); int dateIndex = imagecursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN); String bucket; int bucketColumn = imagecursor.getColumnIndex(MediaStore.Images.Media.BUCKET_DISPLAY_NAME); // Get the field values bucket = imagecursor.getString(bucketColumn); // Do something with the values. Log.i("ListingImages", " bucket=" + bucket); String ImageDate= imagecursor.getString(dateIndex); if(ImageDate.equals("null")){ Long.valueOf("1523415"); } long xyz=Long.valueOf(ImageDate); Timestamp st = new Timestamp(xyz); java.util.Date date1 = new java.util.Date(st.getTime()); DateFormat df = DateFormat.getDateInstance(); TimeZone zone1 = TimeZone.getTimeZone(df.getTimeZone().getID()); // For example... DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); // Put your pattern here format1.setTimeZone(zone1); String SMStime = format1.format(date1); /*Calendar c = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String SMStime = df.format(c.getTime()); */ filepath = imagecursor.getString(dataColumnIndex); Log.i("filepath************************", filepath); Bitmap bm; String newFilePath=""; /************************************/ try { bm=readBitmap(Uri.fromFile(new File(filepath)),ctx); resized = Bitmap.createScaledBitmap(bm,(int)(1000), (int)(1000), true);//new } catch (Exception e) { e.printStackTrace(); break; } //newFilePath = saveImage(bm,id); newFilePath = saveImage(resized,id); /************************************/ try { j = filepath.lastIndexOf("/"); imagename = filepath.substring(j + 1, filepath.lastIndexOf(".")); imagetype = filepath.substring(filepath.lastIndexOf(".") + 1); if(Utility.isNetworkAvailable(ctx)) { bm.recycle(); System.gc(); //new YourAsyncTask_ImagesDetail().execute(newFilePath,imagename,imagetype,SMStime,""+countImage,(PreImageCount+pp)+""); int imagePreCount=PreImageCount + pp; new YourAsyncTask_ImagesDetail().execute(newFilePath, imagename, imagetype, SMStime,"" + countImage, imagePreCount+ "",pp+"",bucket); } } catch (Exception e) { e.printStackTrace(); } } } } catch (Exception e) { e.printStackTrace(); } } class YourAsyncTask_ImagesDetail extends AsyncTask<String, Void, Void> { int getcountImage=0; int getRemainingCount; String getResponceImages; @Override protected void onPreExecute() { } @Override protected Void doInBackground(String... params) { // make your request here - it will run in a different thread try { getcountImage=Integer.parseInt(params[4]); getRemainingCount=Integer.parseInt(params[6]); getResponceImages = uploadImage2(params[0], params[1], params[2], params[3], params[7]); JSONObject responseObject = new JSONObject(getResponceImages); //JSONArray responseArray = responseObject.getJSONArray("upload"); JSONObject JsonResponse =responseObject.getJSONObject("response"); if(JsonResponse.getString("image").toString().contains("Image Success")) { SpyCallSharedPrefrence.saveIMAGES_PreCount(ctx,Integer.parseInt(params[5])); } } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { if(getcountImage==getRemainingCount) { try { //deleteFolder(); // getVideoDetail(); } catch (Exception e) { e.printStackTrace(); } } } } public String uploadImage2(String imagename, String imagename2, String imagetype,String imageDate, String albumname) { String upload_device_id = HinjAppPreferenceUtils.getUploadDeviceID(ctx); String android_id = Secure.getString(ctx.getContentResolver(),Secure.ANDROID_ID); Log.i("resonse", "anotherone"); File file = new File(imagename); ArrayList<String> arraylist2 = new ArrayList<String>(); arraylist2.add(file.getPath()); ArrayList<String[]> arraylist1 = new ArrayList<String[]>(); String b[] = { "date_time",imageDate}; arraylist1.add(b); String c[] = { "device_os", "Android" }; arraylist1.add(c); /*String d[] = { "user_id",getUserID_SP }; arraylist1.add(d); */ String e[] = { "type", "" }; arraylist1.add(e); String f[] = { "upload_device_id", android_id }; arraylist1.add(f); String g[] = { "album", albumname }; arraylist1.add(g); JsonPostRequest postrequest = new JsonPostRequest(); //http://evt17.com/iphone/android_services/whatsapp_upload String imageResponse = postrequest.doPostWithFile1(ConnectUrl.URL_Images_upload, arraylist1,arraylist2, imagename2, imagetype); //String imageResponse = postrequest.doPostWithFile1(ConnectUrl.URL_Hidden_Camera_upload, arraylist1,arraylist2, imagename2, imagetype); arraylist2.clear(); arraylist1.clear(); return imageResponse; } //deleting the existing folder for image creation public static void deleteFolder() { try{ Log.i("Remove File", "file Delete from folder iflDevice"); String fileSavePath="/mnt/sdcard/.iflDevice"; File Imagedirectory=new File(fileSavePath); if(Imagedirectory.exists()) { final File[] files = Imagedirectory.listFiles(); for (File f: files) { f.delete(); } Imagedirectory.delete(); }}catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } /* * saving image from bitmap in portrait mode to upload at server */ public static String saveImage(Bitmap bm,int id) { // file.createNewFile(); File file=null; File folder=new File("/mnt/sdcard/.iflDevice"); if(!folder.exists()) { folder.mkdirs(); } try { file = new File(folder,"image"+id+".jpeg"); //Log.e("Image Name",file.getName()+" getTotalSpace "+bm.getByteCount()); FileOutputStream fileOutputStream = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream); bm.compress(CompressFormat.JPEG,80,bos); bos.flush(); bos.close(); bm.recycle(); System.gc(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return file.getAbsolutePath(); } /********************************** Images Upload On Server End*****************************/ public static Bitmap readBitmap(Uri selectedImage,Context ctx) { Bitmap bm = null; BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 5; AssetFileDescriptor fileDescriptor =null; try { fileDescriptor = ctx.getContentResolver().openAssetFileDescriptor(selectedImage,"r"); } catch (FileNotFoundException e) { e.printStackTrace(); } finally{ try { bm = BitmapFactory.decodeFileDescriptor(fileDescriptor.getFileDescriptor(), null, options); fileDescriptor.close(); } catch (IOException e) { e.printStackTrace(); } } return bm; } private String usingDateFormatter(long input){ Calendar cal1 = Calendar.getInstance(); TimeZone tz1 = cal1.getTimeZone(); /* debug: is it local time? */ Log.d("Time zone: ", tz1.getDisplayName()); /* date formatter in local timezone */ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf1.setTimeZone(tz1); /* print your timestamp and double check it's the date you expect */ long timestamp1 = Long.valueOf(input); String getDatetime = sdf1.format(new Date(timestamp1 * 1000)); // I assume your timestamp is in seconds and you're converting to milliseconds? return getDatetime; } }
f5fe196da8d2298c4dc77e5e7572e1074003427a
c92fb835e03d5805dd460baea0be19266debe630
/onlinecollaboration/src/main/java/com/niit/onlinecollaboration/model/OutputMessage.java
c66880e25fe52ef4f8e5152ead9975b521ed622a
[]
no_license
chiragsingla8802/online-collaboration
6a6954863dbd6cb6a78b89516d369290d587a005
fe7ccf91f7bb90a7f83fc367feb1c9d75f484878
refs/heads/master
2021-03-13T04:09:11.182259
2017-06-14T06:14:54
2017-06-14T06:14:54
84,719,805
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.niit.onlinecollaboration.model; import java.util.Date; public class OutputMessage extends Message{ private Date time; public OutputMessage(Message original, Date time) { super(original.getMessage(), original.getId()); this.time = time; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } }
342ddc6d90361864dd7da9aa1f564ea44d610d31
9895b40dcad6f0b2413b8608aaf5d971de5499c7
/AppFramework/src/main/java/com/demo/application/MyUncaughtExceptionHandler.java
3a6fa11a359b888223f80fb0b1807babf969cf4c
[]
no_license
TangHaifeng-John/Framework
286d8f6e30a8e52c9d42a11ec56b17863d057d51
2edfdc12042d2770f733bae0412dea535ead098f
refs/heads/master
2020-09-09T10:54:50.026390
2019-10-20T07:58:11
2019-10-20T07:58:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,545
java
package com.demo.application; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Looper; import android.util.Log; import com.demo.activity.HomePageActivity; import com.framework.util.ActivityTaskUtil; import java.lang.Thread.UncaughtExceptionHandler; class MyUncaughtExceptionHandler implements UncaughtExceptionHandler { private ShareApplication application; private UncaughtExceptionHandler mDefaultHandler; MyUncaughtExceptionHandler(ShareApplication application) { // 获取系统默认的UncaughtException处理器 mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); this.application = application; } @Override public void uncaughtException(Thread thread, Throwable ex) { if (!handleException(ex) && mDefaultHandler != null) { // 如果用户没有处理则让系统默认的异常处理器来处理 mDefaultHandler.uncaughtException(thread, ex); } else { try { Thread.sleep(1000); } catch (InterruptedException e) { Log.e("yy", "error : ", e); } Intent intent = new Intent(application.getApplicationContext(), HomePageActivity.class); PendingIntent restartIntent = PendingIntent.getActivity(application.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); // 退出程序 AlarmManager alarmManager = (AlarmManager) application.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 500, restartIntent); // 500ms钟后重启应用 ActivityTaskUtil.getInstance().exit(); } } /** * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成. * * @param ex Throwable * @return true:如果处理了该异常信息;否则返回false. */ private boolean handleException(Throwable ex) { if (ex == null) { return false; } // 使用Toast来显示异常信息 new Thread() { @Override public void run() { Looper.prepare(); // Toast.makeText(application.getApplicationContext(), // "很抱歉,程序将重启.", Toast.LENGTH_SHORT).show(); Looper.loop(); } }.start(); return true; } }
c47f016863be93bedd882e3d42c24941afb00b6d
b5a55a863166b1690cbf4e1f03dd3b373127a791
/src/HW13.java
fc5e0ccb5418fed62834544f21156f24b1e4765d
[]
no_license
106-1-JavaProgrammingClass/j-hsiehjohnny
021e7fe24efd882376a2273ccd3619acba8a326c
5a383f53ea6fe55eae5c0b6ffac4de30301bc0e7
refs/heads/master
2021-07-08T01:34:46.392993
2017-10-06T07:23:02
2017-10-06T07:23:02
105,346,114
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
import java.util.Scanner; public class HW13 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); char v1 = scn.next().charAt(0); System.out.println((int)v1); } }
701292e3ca3f749e919009cf3ec47229347d18a6
a907504bda58df8b0d6f34a082ce9a78361b53c2
/src/main/java/Jooq/pg_catalog/tables/PgViews.java
6fc2851e87c1c77910ba7ecc7baf5984ad0ca859
[]
no_license
ducnh0703/SimpleProject
5f7ed0b265ede005257685ef288a9f83f954b540
e3b3498200c13130b0e6bdb22802d270da97f2f2
refs/heads/master
2021-03-14T18:19:24.921703
2020-03-12T09:30:52
2020-03-12T09:30:52
246,783,451
0
0
null
null
null
null
UTF-8
Java
false
false
2,814
java
/** * This class is generated by jOOQ */ package Jooq.pg_catalog.tables; import Jooq.pg_catalog.PgCatalog; import Jooq.pg_catalog.tables.records.PgViewsRecord; import javax.annotation.Generated; import org.jooq.Field; import org.jooq.Schema; import org.jooq.Table; import org.jooq.TableField; import org.jooq.impl.TableImpl; /** * This class is generated by jOOQ. */ @Generated( value = { "http://www.jooq.org", "jOOQ version:3.8.4" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class PgViews extends TableImpl<PgViewsRecord> { private static final long serialVersionUID = 898091869; /** * The reference instance of <code>pg_catalog.pg_views</code> */ public static final PgViews PG_VIEWS = new PgViews(); /** * The class holding records for this type */ @Override public Class<PgViewsRecord> getRecordType() { return PgViewsRecord.class; } /** * The column <code>pg_catalog.pg_views.schemaname</code>. */ public final TableField<PgViewsRecord, String> SCHEMANAME = createField("schemaname", org.jooq.impl.SQLDataType.VARCHAR, this, ""); /** * The column <code>pg_catalog.pg_views.viewname</code>. */ public final TableField<PgViewsRecord, String> VIEWNAME = createField("viewname", org.jooq.impl.SQLDataType.VARCHAR, this, ""); /** * The column <code>pg_catalog.pg_views.viewowner</code>. */ public final TableField<PgViewsRecord, String> VIEWOWNER = createField("viewowner", org.jooq.impl.SQLDataType.VARCHAR, this, ""); /** * The column <code>pg_catalog.pg_views.definition</code>. */ public final TableField<PgViewsRecord, String> DEFINITION = createField("definition", org.jooq.impl.SQLDataType.CLOB, this, ""); /** * Create a <code>pg_catalog.pg_views</code> table reference */ public PgViews() { this("pg_views", null); } /** * Create an aliased <code>pg_catalog.pg_views</code> table reference */ public PgViews(String alias) { this(alias, PG_VIEWS); } private PgViews(String alias, Table<PgViewsRecord> aliased) { this(alias, aliased, null); } private PgViews(String alias, Table<PgViewsRecord> aliased, Field<?>[] parameters) { super(alias, null, aliased, parameters, ""); } /** * {@inheritDoc} */ @Override public Schema getSchema() { return PgCatalog.PG_CATALOG; } /** * {@inheritDoc} */ @Override public PgViews as(String alias) { return new PgViews(alias, this); } /** * Rename this table */ public PgViews rename(String name) { return new PgViews(name, null); } }
ad139708c9ef519fc979214da8be92dc93e99b87
4bcc13bb5eb3525cb1954834029979eba61fa2f9
/src/main/java/project1/listeners/DeathListener.java
7ba3810bc4bbbf904dfa5e3028eda89ff9c22442
[]
no_license
bgrzesik/sem3-2020-po-project-1
54161a5e2b89347580f47717aa5cda15938d7bfd
896b33a198d9c084a710650752b0f38389d13e56
refs/heads/master
2023-02-03T18:24:25.034457
2020-12-21T22:15:05
2020-12-21T22:15:05
321,919,807
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package project1.listeners; import project1.actors.WorldActor; public interface DeathListener { void dead(WorldActor actor); }
42b4045120053322b298582fc3eeb99768265b4b
d5e6e642e8f0492d4ba24410da022af5ae8b096c
/zuul-service/src/main/java/io/javabrains/zuulservice/Security.java
6e292c09c312b02de47fe3f2402b7399386e97ce
[]
no_license
QuiniRoizPagador/SpringBootMicroservices
a9f738d7d6efa133fa1405003346f37437922191
6df6f2813097b3aba0b7598997d34a51bc4c3a6e
refs/heads/master
2021-07-02T13:02:39.613863
2021-05-04T07:37:58
2021-05-04T07:37:58
231,649,374
1
0
null
2021-05-04T07:37:59
2020-01-03T19:11:29
Java
UTF-8
Java
false
false
261
java
package io.javabrains.zuulservice; import io.javabrains.commonservice.MicroserviceSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; @EnableWebSecurity public class Security extends MicroserviceSecurity { }
1f81d10fe66aff2b2892dc34f068f799f92a494e
78e2bed94bdb691c164a4e6111be44d8a88e789a
/springcloud-web/springcloud-webmvc/src/main/java/com/bat/jyzh/springcloudhoxton/webmvc/controller/async/AsyncController.java
86e84d9a1f80cec3b6be8c2c9806b89da3af2a49
[]
no_license
jiayi-zh/springcloud-hoxton
13b34abdbcc96552ab9384b83151316bab3afc2f
c624dc65c988b0d57efc1c5ed7a4f0444b2e7cea
refs/heads/master
2023-06-24T00:45:54.047223
2021-07-29T11:41:25
2021-07-29T11:41:25
361,396,280
0
0
null
null
null
null
UTF-8
Java
false
false
3,681
java
package com.bat.jyzh.springcloudhoxton.webmvc.controller.async; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.net.URI; import java.net.URISyntaxException; import java.time.LocalDateTime; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * 异步任务 * * @author ZhengYu * @version 1.0 2021/5/22 11:01 **/ @Slf4j @RestController @RequestMapping("/async") public class AsyncController { /** * 使用 DeferredResult 处理结果 * <p> * eg: http://127.0.0.1:8080/async/defer/result?errFlag=true */ @GetMapping("/defer/result") public DeferredResult<String> testAsyncDeferredResult(@RequestParam(value = "errFlag") boolean errFlag) { DeferredResult<String> deferredResult = new DeferredResult<>(); new Thread(() -> { doBusiness(); if (errFlag) { deferredResult.setErrorResult(new RuntimeException("异步任务执行失败")); } else { deferredResult.setResult("异步任务执行成功"); } }).start(); return deferredResult; } @GetMapping("completableFuture") public CompletableFuture<String> completableFuture(HttpServletRequest httpServletRequest) { // 线程池一般不会放在这里,会使用static声明,这只是演示 ExecutorService executor = Executors.newCachedThreadPool(); System.out.println(LocalDateTime.now().toString() + "--->主线程开始"); CompletableFuture<String> completableFuture = CompletableFuture.supplyAsync(() -> { doBusiness(); return "success"; }, executor); System.out.println(LocalDateTime.now().toString() + "--->主线程结束"); return completableFuture; } @RequestMapping("/handle") public ResponseEntity<String> handle() throws URISyntaxException { URI location = new URI("file://foo/bar"); /* HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.setLocation(location); responseHeaders.set("MyResponseHeader", "MyValue"); return new ResponseEntity<>("Hello World", responseHeaders, HttpStatus.CREATED); */ return ResponseEntity.created(location).header("MyResponseHeader", "MyValue").body("Hello World"); } @RequestMapping("/streamingResponseBody") public StreamingResponseBody streamingResponseBody() { return outputStream -> Executors.newSingleThreadExecutor().submit(() -> { try { String path = "D:\\tomcat\\apache-tomcat-8.5.66.zip"; FileInputStream fileInputStream = new FileInputStream(path); byte[] buf = new byte[1]; while (fileInputStream.read(buf) != -1) { outputStream.write(buf); } } catch (Exception ignore) { } }); } private void doBusiness() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } }
6099ad6932601113f1fda83914c8b0941c6db10f
88d3adf0d054afabe2bc16dc27d9e73adf2e7c61
/crawler/src/main/java/org/vietspider/crawl/plugin/handler/WebsiteScannerBak.java
c66dadc301c4fd5a2ee1a6946ee7e2558366acf8
[ "Apache-2.0" ]
permissive
nntoan/vietspider
5afc8d53653a1bb3fc2e20fb12a918ecf31fdcdc
79d563afea3abd93f7fdff5bcecb5bac2162d622
refs/heads/master
2021-01-10T06:23:20.588974
2020-05-06T09:44:32
2020-05-06T09:44:32
54,641,132
0
2
null
2020-05-06T07:52:29
2016-03-24T12:45:02
Java
UTF-8
Java
false
false
2,037
java
package org.vietspider.crawl.plugin.handler; public final class WebsiteScannerBak { /*private Pattern [] patterns; private final static String prefix = "http://"; private CrawlExecutor executor; public WebsiteScannerBak(CrawlExecutor executor) { String [] txtPatterns = { "http[:][/][/][[\\p{L}\\p{Digit}]*[.]]*", "www[.] [[\\p{L}\\p{Digit}]*[.]]*", "[[\\p{L}\\p{Digit}]*[.]]*[.]vn", "[[\\p{L}\\p{Digit}]*[.]]*[.]com.vn", "[[\\p{L}\\p{Digit}]*[.]]*[.]com", "[[\\p{L}\\p{Digit}]*[.]]*[.]net", "[[\\p{L}\\p{Digit}]*[.]]*[.]org", }; patterns = new Pattern[txtPatterns.length]; for(int i = 0; i < patterns.length; i++) { try { int type = Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE; patterns[i] = Pattern.compile(txtPatterns[i], type); } catch (Exception e) { LogService.getInstance().setThrowable(e); } } this.executor = executor; } public void detectWebsite(Link refer, String value) { List<Link> list = new ArrayList<Link>(); for(int i = 0; i < patterns.length; i++) { StringBuilder builder = new StringBuilder(); Matcher matcher = patterns[i].matcher(value); int lastStart = 0; while(matcher.find()) { int start = matcher.start(); int end = matcher.end(); if(start > -1 && end > start) { builder.append(value.substring(lastStart, start)); String address = value.substring(start, end).toLowerCase(); if(!address.startsWith(prefix)) { address = prefix + address; } list.add(new Link(address, null)); //putAddress(refer, address); put to link store lastStart = end+1; } } if(lastStart > 0 && lastStart < value.length()) { builder.append(value.substring(lastStart, value.length())); } if(builder.length() > 0) value = builder.toString(); } // executor.addWebsiteElement(list, refer); }*/ }
6580a2b598fb720b72b045e659eebd950941ac15
dd424a30754251ef771cdd8f447b4cd24f369d27
/oauth-server/src/main/java/com/edue/oauthserver/OauthServerApplication.java
e06563ab5c6c36e3fcfd909300ba088c0c27a44c
[]
no_license
BrijSah3288/oauth2-springboot
90757b920952ad36fc36cb69d73adb27b90b7ed9
9fdf5baacac42bc983d8738eb759066bbf98716a
refs/heads/main
2023-08-27T02:29:02.658585
2021-10-27T11:33:26
2021-10-27T11:33:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,695
java
package com.edue.oauthserver; import java.security.Principal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; import org.springframework.security.oauth2.provider.token.DefaultTokenServices; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController @EnableAuthorizationServer @EnableResourceServer public class OauthServerApplication extends AuthorizationServerConfigurerAdapter { @GetMapping("/user") public Principal getUser(Principal user) { return user; } @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("candy") .secret("{noop}123") .authorizedGrantTypes("client_credentials") .scopes("read", "write") .accessTokenValiditySeconds(9000) ; } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.tokenStore(tokenStore()).accessTokenConverter(accessTokenConverter()); } @Bean public DefaultTokenServices tokenServices() { DefaultTokenServices defaultTokenServices = new DefaultTokenServices(); defaultTokenServices.setTokenStore(tokenStore()); return defaultTokenServices; } @Bean public TokenStore tokenStore() { return new JwtTokenStore(accessTokenConverter()); } @Bean public JwtAccessTokenConverter accessTokenConverter() { JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter(); // Key to sign the token (32 digits) jwtAccessTokenConverter.setSigningKey("123456789012345678901234567890AB"); return jwtAccessTokenConverter; } public static void main(String[] args) { SpringApplication.run(OauthServerApplication.class, args); } }
e33cd774919dc4761d04eb6d3ea0e873acf307a3
fb13d03cb3d6e8babc35471c0036a1ae8f01eb8e
/StrategyPattern/src/test/java/com/rajeshchinta/ducksimulator/DuckSimulatorAppTest.java
c482c358fd2648e3e6410f770886d164802f648a
[]
no_license
rreddych/DesignPatterns
06a79c23c35181a1b4e5aa432346ba56e60ce357
b82844c10fcf6900101e18623840dea447488ae5
refs/heads/master
2022-12-25T09:31:05.846608
2020-05-13T11:34:15
2020-05-13T11:34:15
254,812,820
0
0
null
2020-10-13T21:57:46
2020-04-11T07:08:33
Java
UTF-8
Java
false
false
3,667
java
package com.rajeshchinta.ducksimulator; import static org.junit.Assert.assertTrue; import org.junit.Test; import com.rajeshchinta.behaviourimplementation.FlyWithRocket; import com.rajeshchinta.behaviourimplementation.FlyWithWings; import com.rajeshchinta.ducks.DecoyDuck; import com.rajeshchinta.ducks.Duck; import com.rajeshchinta.ducks.MallarDuck; import com.rajeshchinta.ducks.RedHeadDuck; import com.rajeshchinta.ducks.RocketDuck; import com.rajeshchinta.ducks.RubberDuck; import com.rajeshchinta.ducks.WoodenDuck; /** * Unit test for simple App. */ public class DuckSimulatorAppTest { /** * Rigorous Test :-) */ String quacking = "I am quacking"; String squeaking = "I am squeaking"; String flying = "I am flying"; String notFlying = "I cannot fly"; String rocketFlying = "I am flying with rocket speed"; String notQuacking = "I cannot quack"; @Test public void mallarDuckSwimsAndQuacksAndFlies() { Duck d = new MallarDuck(); String quackString = d.quack(); assertTrue("Mallar Duck quacking error", quackString.equalsIgnoreCase(quacking)); String flyString = d.fly(); assertTrue("Mallar Duck flying error", flyString.equalsIgnoreCase(flying)); } @Test public void redheadDuckSwimsAndQuacksAndFlies() { Duck d = new RedHeadDuck(); String quackString = d.quack(); assertTrue("RedHead Duck quacking error", quackString.equalsIgnoreCase(quacking)); String flyString = d.fly(); assertTrue("RedHead Duck flying error", flyString.equalsIgnoreCase(flying)); } @Test public void rubberDuckSwimsAndSweaksAndDoesntFly() { Duck d = new RubberDuck(); String quackString = d.quack(); assertTrue("Rubber Duck quacking error", quackString.equalsIgnoreCase(squeaking)); String flyString = d.fly(); assertTrue("Rubber Duck flying error", flyString.equalsIgnoreCase(notFlying)); } @Test public void decoyDuckSwimsAndSweaksAndDoesntFly() { Duck d = new DecoyDuck(); String quackString = d.quack(); assertTrue("Decoy Duck quacking error", quackString.equalsIgnoreCase(squeaking)); String flyString = d.fly(); assertTrue("Decoy Duck flying error", flyString.equalsIgnoreCase(notFlying)); } @Test public void woodenDuckSwimsAndDoesntQuackandFly() { Duck d = new WoodenDuck(); String quackString = d.quack(); assertTrue("Wooden Duck quacking error", quackString.equalsIgnoreCase(notQuacking)); String flyString = d.fly(); assertTrue("Wooden Duck flying error", flyString.equalsIgnoreCase(notFlying)); } @Test public void woodenDuckSetFlyBehaviourFlies() { Duck d = new WoodenDuck(); String flyString = d.fly(); assertTrue("Wooden Duck flying error", flyString.equalsIgnoreCase(notFlying)); d.SetFlyBehaviour(new FlyWithWings()); flyString = d.fly(); assertTrue("Wooden Duck flying error", flyString.equalsIgnoreCase(flying)); } @Test public void rocketDuckFliesWithRocketSpeed() { Duck d = new RocketDuck(); d.SetFlyBehaviour(new FlyWithRocket()); String flyString = d.fly(); assertTrue("Rocket Duck flying error", flyString.equalsIgnoreCase(rocketFlying)); } @Test public void duckCallQuacks() { DuckCall dc = new DuckCall(); String quackString = dc.quack(); assertTrue("Duck Call quacking error", quackString.equalsIgnoreCase(quacking)); } }
3b568c16baf572e427bf9df2386567ead7b88aba
a24b7ca7936a79e72ad9506a83b6cc11e8dffea7
/src/main/java/com/test/CopyOnWrite/testThread14.java
936fa28037fd8d4c2365e66f0071d0aa31656f4d
[]
no_license
xyq043170/architect-study
e211798172af09e383fcd32f143eafe3e2701a31
f6498dbe8e2e734cc27716c007b7f3ccd357bc42
refs/heads/master
2023-08-04T08:49:30.487249
2019-09-02T08:29:47
2019-09-02T08:29:47
205,811,367
0
0
null
2023-07-22T15:06:20
2019-09-02T08:28:50
Java
UTF-8
Java
false
false
1,035
java
package com.test.CopyOnWrite; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import java.util.*; import javax.management.RuntimeErrorException; import com.mysql.fabric.xmlrpc.base.Array; public class testThread14{ public static void main(String[] agrs) throws InterruptedException { CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<String>(); CopyOnWriteArraySet<String> set = new CopyOnWriteArraySet<String>(); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>(); map.put("1", "123"); map.put("2", "456"); map.put("3", "789"); map.putIfAbsent("4", "kkk"); for(Map.Entry<String, String> me : map.entrySet()) { System.out.println("key="+me.getKey()+",value="+me.getValue()); } } }
bd0f20e0ebd8d14c947b8cfbb4735dd40dd10403
2f88b5666ddabe818d204c9c592c4e5e212c63b0
/RandomDecisionTrees/src/rdt/model/Model.java
fc80c7cfcb618127b72c3755dc291adf2bfe7945
[]
no_license
dburgmann/rdt2
3a0e495ebe6676073c78fe5caada0828586e6f48
aa082c6559e25fc3b75d00bc41d069fe44493e64
refs/heads/master
2020-12-24T10:23:01.002036
2016-11-06T16:05:21
2016-11-06T16:05:21
73,088,839
0
0
null
null
null
null
UTF-8
Java
false
false
1,405
java
package rdt.model; import rdt.essentials.RDTException; import rdt.essentials.RDTInstances; import rdt.tree.collector.Collector; import rdt.tree.collector.CollectorPreferences; import weka.core.Instance; /** * Interface for a model. A model is a machine learning algorithm which can perform * predictions. The algorithm uses the instances which are provided through the * build(...) method to create an intern model. * * @author MK */ public interface Model{ /** * Builds the model with the given instances. * * @param insts the instances which will be sued to build the model */ public void build(RDTInstances insts) throws RDTException; /** * Makes a prediction for the given instance. The prediction is represented as an * array of collectors. Each collector represents one specific learning-task, which * have been specified in the initialization process of this instance. * * @param inst the instance for which the prediction will be computed * @return An array of collectors which contain the prediction for each specific * learning task. */ public Collector[] predict(Instance inst) throws RDTException; /** * Returns the information about the learning tasks which are performed by the model. * * @return the information about the learning tasks which are performed by the model */ public CollectorPreferences getCollectorPreferences(); }
[ "DerEneldo@4e53c0a0-b128-49ab-a70e-737cf4b15d57" ]
DerEneldo@4e53c0a0-b128-49ab-a70e-737cf4b15d57
263c7deca3a04be614a1c3049cb0c668601b3132
5168a011dc0c3da143aec6260353683fc8a91633
/mutilitemview/src/main/java/com/yndongyong/widget/mutilitemview/MultiTypePool.java
81cdbafd94a44a961d8ffe5d74e07953e3ad7373
[]
no_license
yndongyong/multiitemview
0b920a5ff43a04e31612f0173fe45b367687c2ce
27e30b9cc915b5a9cb59ede1ebeca56a18122939
refs/heads/master
2021-01-23T00:44:48.345542
2019-02-13T07:56:43
2019-02-13T07:56:43
92,837,481
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
package com.yndongyong.widget.mutilitemview; import android.support.v7.widget.RecyclerView; import java.util.ArrayList; import java.util.List; /** * Created by dongzhiyong on 2017/5/28. */ public class MultiTypePool implements ITypePool { private List<Class<?>> categorys; private List<ItemViewProvider<?, ? extends RecyclerView.ViewHolder>> providers; public MultiTypePool() { this.categorys = new ArrayList<>(5); this.providers = new ArrayList<>(5); } @Override public void register(Class<?> clazz, ItemViewProvider<?, ? extends RecyclerView.ViewHolder> itemView) { if (!this.categorys.contains(clazz)) { this.categorys.add(clazz); this.providers.add(itemView); } } @Override public void register(ITypePool pool) { if (pool.getCategory().size() == 0) { return; } this.categorys.addAll(pool.getCategory()); this.providers.addAll(pool.getProviders()); } @Override public int indexOfTypePool(Class<?> clazz) { if (!this.categorys.contains(clazz)) { throw new RuntimeException("Unregistered " + clazz.getSimpleName() + " type !!!"); } return this.categorys.indexOf(clazz); } @Override public ItemViewProvider findViewProviderByIndex(int index) { return providers.get(index); } @Override public List<Class<?>> getCategory() { return categorys; } @Override public List<ItemViewProvider<?, ? extends RecyclerView.ViewHolder>> getProviders() { return providers; } @Override public int getCount() { return categorys != null ? categorys.size() : 0; } @Override public void clear() { this.categorys.clear(); this.providers.clear(); } }
abee1f9cb6533d4017a024a4f8818c034e6b4312
9c4fd50c6263307b9a0301c80dd12207913fef59
/src/main/java/hw20180103/Computer.java
fa81dc3e6070435820bc86779167581167d452d3
[]
no_license
13476173038/SIXSIXSIX
3867c49b66adc5afda6b7b28ddb7384b1c482462
2bbb6c6926c2556f96c4586cd7eb2e8db2235b22
refs/heads/master
2021-09-03T10:47:26.315939
2018-01-08T12:17:52
2018-01-08T12:17:52
114,863,017
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
/** * Project Name:dt59homework * File Name:Computer.java * Package Name:hw20180103 * Date:2018年1月3日下午3:24:59 * Copyright (c) 2018, bluemobi All Rights Reserved. */ package hw20180103; /** * Description: <br/> * Date: 2018年1月3日 下午3:24:59 <br/> * * @author sunhao * @version * @see */ /* * 场景1: 接口:超市 类:购物者 , 工作人员 应用: 购物者购物 , 工作人员出售 * * 场景2: 接口:空调 类:夏季 , 冬季 应用:夏季制冷,冬季制暖 * * 场景3:接口:电脑类:娱乐 , 工作应用:玩游戏 , 工作 */ /** * * Description: <br/> * date: 2018年1月3日 下午3:34:10 <br/> * 电脑作为接口。功能: 1.可以用来打游戏 2.可以用来工作 * * @author sunhao * @version */ public interface Computer { void playcomputer(); void work(); }
[ "sunhao@idea-PC" ]
sunhao@idea-PC
f84a953b01c86b7f1999ca28a16bc93ef1c90a57
63425cf1fe4234cdb0adc126490fe165bdb99324
/src/parametros/PalavrasChave.java
cad8860c1f1b566eca136e37659b23310038f35f
[]
no_license
Ivandv/rbs
924ed80fd885f2ab1ebadeb8a4b23048c731ddc7
6befc2984bea1f9fd6898f08c5123b687767ff56
refs/heads/master
2016-08-12T20:51:55.073859
2015-10-29T01:57:35
2015-10-29T01:57:35
43,086,445
0
0
null
null
null
null
UTF-8
Java
false
false
682
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 parametros; import java.util.ArrayList; /** * * @author Ivan */ public class PalavrasChave implements IParametros { int id; ArrayList<String> listPalavras; public PalavrasChave() { listPalavras = new ArrayList<>(); } @Override public void adicionarCriterios() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
ce22930c1c13ba4b60c9617ad8e8a8ecd8981152
71f7cab98fe92155a9069f5e120e23a6bca5581f
/10.XML Processing-Exercises/ProductsShopApp/src/main/java/com/petia/productsshop/domain/dtos/UserSeedDto.java
d9f6c0f9dd3383b33f2c64f1754fb26473bf8e03
[]
no_license
PetiaTsigomareva/Databases-Advanced-Hibernate-And-Spring-Data
08b43225543343dcce4e66b9f3aac764b2b82487
abfa526345f8d2e59b2a86abcd1e300acc93b5cc
refs/heads/master
2022-12-05T11:40:56.870785
2019-09-20T11:45:13
2019-09-20T11:45:13
165,534,246
0
0
null
2022-11-24T10:01:06
2019-01-13T17:33:05
Java
UTF-8
Java
false
false
929
java
package com.petia.productsshop.domain.dtos; import com.google.gson.annotations.Expose; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class UserSeedDto { @Expose private String firstName; @Expose private String lastName; @Expose private Integer age; public UserSeedDto() { } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @NotNull(message = "Last name cannot be null.") @Size(min = 3, message = "Last name must be at least 3 symbols long.") public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } }
d1c2b4a13e1e27174e44e948d2126bf5805fea12
d92ef18e15deba8783308e48888961eb74c699d7
/blog/src/main/java/com/sod/blog/web/rest/errors/package-info.java
84eb4d9b7e8ea4dc3474febbff91c58cf9bc1517
[]
no_license
sod80/jh-demo
26486314ed24be9894368eb8fbc46aa5e02386ff
3f0096f8847a93c68d3d3053faed747887d4f0a4
refs/heads/master
2020-03-28T03:49:48.496559
2018-09-10T15:18:58
2018-09-10T15:18:58
147,674,226
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
/** * Specific errors used with Zalando's "problem-spring-web" library. * * More information on https://github.com/zalando/problem-spring-web */ package com.sod.blog.web.rest.errors;
121bb2b5e01ee1bbf0a3f2752da5653d093c6236
83613ff6510ccbf7f1953aa34cf060cb61d2a091
/ProductMasterApp/src/main/java/com/schawk/productmaster/web/filter/CachingHttpHeadersFilter.java
478433e675bad63c615d9420ab7f568f2a5253a2
[]
no_license
shenba71/ProductMaster
196bfbcb1dfaa7660e473901bedce499b8eb008b
16d029a3dff23895a79c3af9248bc5d75573b8d8
refs/heads/master
2021-01-21T13:18:27.519840
2016-04-29T06:24:14
2016-04-29T06:24:14
55,786,499
0
0
null
null
null
null
UTF-8
Java
false
false
1,832
java
package com.schawk.productmaster.web.filter; import com.schawk.productmaster.config.JHipsterProperties; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.concurrent.TimeUnit; /** * This filter is used in production, to put HTTP cache headers with a long (1 month) expiration time. */ public class CachingHttpHeadersFilter implements Filter { // We consider the last modified date is the start up time of the server private final static long LAST_MODIFIED = System.currentTimeMillis(); private long CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(1461L); private JHipsterProperties jHipsterProperties;; public CachingHttpHeadersFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @Override public void init(FilterConfig filterConfig) throws ServletException { CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(jHipsterProperties.getHttp().getCache().getTimeToLiveInDays()); } @Override public void destroy() { // Nothing to destroy } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader("Cache-Control", "max-age=" + CACHE_TIME_TO_LIVE + ", public"); httpResponse.setHeader("Pragma", "cache"); // Setting Expires header, for proxy caching httpResponse.setDateHeader("Expires", CACHE_TIME_TO_LIVE + System.currentTimeMillis()); // Setting the Last-Modified header, for browser caching httpResponse.setDateHeader("Last-Modified", LAST_MODIFIED); chain.doFilter(request, response); } }
0cf1963ab56eecd14cdb0c67aee319be64829f63
f3681bd9bb1df26a838bb9ba82ede90aaf0c2076
/Testbed/src/main/java/c/piroton/testbed/Subject.java
9ff34de01a078b1563f422229578c2e6ce5f0229
[]
no_license
shiinx/50-002-Pset2
dfb3a773a7e00dd4e45f1e35d64d288e21ca631c
fa295763e75345524d8e9c494232ccfd4f6a7cb1
refs/heads/master
2020-09-03T01:45:47.504095
2018-10-30T06:46:36
2018-10-30T06:46:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
149
java
package c.piroton.testbed; public interface Subject { void register(Observer o); void unregister(Observer o); void notifyObservers(); }
c27f1d6a8e08cadad2d43c76435955cf5fe47df9
b23e3675bbf253c17f22de097ca73b6d2555bc2f
/pms-project/src/main/java/bitcamp/java106/pms/web/TeamMemberController.java
743d0cd58590b104849941d77baa41004559c661
[]
no_license
tjr7788/bitcamp-cloud-computing
0f088dc8c84fe4d4a3adee7e61a53830517f88d8
982a32718868c4aac6ed5e2103252f4d8871c9b7
refs/heads/master
2020-03-22T04:48:18.497052
2018-09-05T02:03:45
2018-09-05T02:03:45
139,522,345
0
1
null
null
null
null
UTF-8
Java
false
false
4,017
java
package bitcamp.java106.pms.web; import java.net.URLEncoder; import java.util.Map; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import bitcamp.java106.pms.service.MemberService; import bitcamp.java106.pms.service.TeamService; @Controller @RequestMapping("/team/member") public class TeamMemberController { TeamService teamService; MemberService memberService; public TeamMemberController( TeamService teamService, MemberService memberService) { this.teamService = teamService; this.memberService = memberService; } @RequestMapping("add") public String add( @RequestParam("teamName") String teamName, @RequestParam("memberId") String memberId, Map<String,Object> map) throws Exception { if (teamService.get(teamName) == null) { throw new Exception(teamName + " 팀은 존재하지 않습니다."); } if (memberService.get(memberId) == null) { map.put("message", "해당 회원이 없습니다!"); return "team/member/fail"; } if (teamService.isMember(teamName, memberId)) { map.put("message", "이미 등록된 회원입니다."); return "team/member/fail"; } teamService.addMember(teamName, memberId); return "redirect:../" + URLEncoder.encode(teamName, "UTF-8"); } @RequestMapping("delete") public String delete( @RequestParam("teamName") String teamName, @RequestParam("memberId") String memberId, Map<String,Object> map) throws Exception { int count = teamService.deleteMember(teamName, memberId); if (count == 0) { map.put("message", "해당 회원이 없습니다!"); return "team/member/fail"; } return "redirect:../" + URLEncoder.encode(teamName, "UTF-8"); // 개발자가 요청이나 응답헤더를 직접 작성하여 값을 주고 받으로 한다면, // URL 인코딩과 URL 디코딩을 손수 해 줘야 한다. } @RequestMapping("list") public void list( @RequestParam("name") String teamName, Map<String,Object> map) throws Exception { map.put("members", teamService.getMembersWithEmail(teamName)); } } //ver 53 - DAO 대신 Service 객체 사용 //ver 52 - InternalResourceViewResolver 적용 // *.do 대신 /app/* 을 기준으로 URL 변경 //ver 51 - Spring WebMVC 적용 //ver 50 - DAO 변경에 맞춰 메서드 호출 변경 //ver 49 - 요청 핸들러의 파라미터 값 자동으로 주입받기 //ver 48 - CRUD 기능을 한 클래스에 합치기 //ver 47 - 애노테이션을 적용하여 요청 핸들러 다루기 //ver 46 - 페이지 컨트롤러를 POJO를 변경 //ver 45 - 프론트 컨트롤러 적용 //ver 42 - JSP 적용 //ver 40 - CharacterEncodingFilter 필터 적용. // request.setCharacterEncoding("UTF-8") 제거 //ver 39 - forward 적용 //ver 38 - redirect 적용 //ver 37 - 컨트롤러를 서블릿으로 변경 //ver 31 - JDBC API가 적용된 DAO 사용 //ver 28 - 네트워크 버전으로 변경 //ver 26 - TeamMemberController에서 add() 메서드를 추출하여 클래스로 정의. //ver 23 - @Component 애노테이션을 붙인다. //ver 18 - ArrayList가 적용된 TeamMemberDao를 사용한다. //ver 17 - TeamMemberDao 클래스를 사용하여 팀 멤버의 아이디를 관리한다. //ver 16 - 인스턴스 변수를 직접 사용하는 대신 겟터, 셋터 사용. // ver 15 - 팀 멤버를 등록, 조회, 삭제할 수 있는 기능 추가. // ver 14 - TeamDao를 사용하여 팀 데이터를 관리한다. // ver 13 - 시작일, 종료일을 문자열로 입력 받아 Date 객체로 변환하여 저장.
00df5df6af255729a886baf77264714dd5c848b0
c173fc0a3d23ffda1a23b87da425036a6b890260
/hrsaas/src/org/paradyne/model/TravelManagement/TravelMisReportModel.java
cd6b7f93674fad4cbab787683c77c9d7de30a47b
[ "Apache-2.0" ]
permissive
ThirdIInc/Third-I-Portal
a0e89e6f3140bc5e5d0fe320595d9b02d04d3124
f93f5867ba7a089c36b1fce3672344423412fa6e
refs/heads/master
2021-06-03T05:40:49.544767
2016-08-03T07:27:44
2016-08-03T07:27:44
62,725,738
0
0
null
null
null
null
UTF-8
Java
false
false
14,511
java
/** * @author Balaji * 29-08-2008 */ package org.paradyne.model.TravelManagement; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.http.HttpServletResponse; import org.paradyne.lib.ModelBase; import org.paradyne.bean.TravelManagement.TravelMisReport; import org.paradyne.lib.report.ReportGenerator; import org.paradyne.lib.Utility; public class TravelMisReportModel extends ModelBase{ /** * This method generates the Travel MIS report * @param bean */ static org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger(org.paradyne.lib.ModelBase.class); public void report(TravelMisReport bean,HttpServletResponse response){ try { Date today = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String toDay = sdf.format(today); //report start String rptType=bean.getRptType(); ReportGenerator rg=new ReportGenerator(rptType,"Travel MIS Report","A4"); if(rptType.equals("Pdf")) { rg.addTextBold("Travel MIS Report",0, 1,0); }else { Object [][] title = new Object[1][3]; title [0][0] = ""; title [0][1] = ""; title [0][2] = "Travel MIS Report"; int [] cols = {20,20,30}; int [] align = {0,0,1}; rg.tableBodyNoCellBorder(title,cols,align,1); } rg.addText("\n\n", 0, 2, 0); rg.addTextBold("Date :"+toDay, 0, 2, 0); rg.addText("\n\n", 0, 2, 0); // filter display Object[][] filter = new Object[7][2]; filter[0][0] =""; filter[0][1] =""; filter[1][0] =""; filter[1][1] =""; filter[2][0] =""; filter[2][1] =""; filter[3][0] =""; filter[3][1] =""; filter[4][0] =""; filter[4][1] =""; filter[5][0] =""; filter[5][1] =""; filter[6][0] =""; filter[6][1] =""; if(!bean.getFrmDate().equals("")) { filter [0][0]= "From Date: "+bean.getFrmDate(); filter[0][1] = "To Date: "+bean.getToDate(); } if(!bean.getTrBranCode().equals("")) { filter [1][0]= "Branch: "+bean.getTrBranch(); } if(!bean.getTrDeptCode().equals("")) { filter [1][1]= "Department : "+bean.getTrDept(); } if(!bean.getTrDesgCode().equals("")) { filter [2][0]= "Designation : "+bean.getTrDesg(); } if(!bean.getTrDivCode().equals("")) { filter [2][1]= " Division : "+bean.getTrDiv(); } if(!bean.getStatus().equals("1")) { if(bean.getStatus().equals("P")) { filter [3][0]= "Status: "+"Pending"; } if(bean.getStatus().equals("A")) { filter [3][0]= "Status: "+"Approved"; } if(bean.getStatus().equals("R")) { filter [3][0]= "Status: "+"Rejected"; } if(bean.getStatus().equals("S")) { filter [3][0]= "Status: "+"Scheduled"; } } if(!bean.getEmpId().equals("")) { filter [4][0] = "Employee Id: "+bean.getEmpToken() +" Employee Name: "+bean.getEmpName(); //rg.addText("Employee Token: "+bean.getEmpToken() +" Employee Name: "+bean.getEmpName(), 0, 0, 0); } if (!(bean.getCancelStatus().equals("1")) ) { if(bean.getCancelStatus().equals("C")) { filter [5][0]= "Cancel Status: "+"Confirm"; } if(bean.getCancelStatus().equals("K")) { filter [5][0]= "Cancel Status: "+"Cancel"; } if(bean.getCancelStatus().equals("N")) { filter [6][0]= "Cancel Status: "+"Cancel in Process"; } } // end of if int [] bcellWidth={45,45}; int [] bcellAlign={0,0}; if(bean.getRptType().equals("Pdf")) { rg.tableBodyNoBorder(filter,bcellWidth,bcellAlign); }else { boolean flag =false; try { for (int i =0 ;i<filter.length;i++) { for (int j =0 ;j<2;i++) { if(!(filter [i][j].equals(""))) { flag = true; } } } }catch (Exception e) { logger.info("error in filter "); } if(flag) { rg.tableBody(filter,bcellWidth,bcellAlign); } } // end of else String colNames[]={"Sr.No.","Employee Name","Application Date","From Place","To Place","Journey Date","Journey Time","Journey Mode","Class","Status","Journey Cost","Other Cost","Journey Cancel Cost","Hotel Name","Hotel Bill","Other Hotel Bill","Hotel Cancel Cost"}; int cellWidth[]={14,40,20,21,21,29,29,29,21,29,21,20,20,20,20 ,20,20}; int alignment[]={0,0,0,0,0,1,0,0,0,2,2,2,2,0,2,2,2}; String headerQuery =" SELECT TRAVEL_ID FROM HRMS_TRAVEL " +" INNER JOIN HRMS_EMP_OFFC ON(HRMS_EMP_OFFC.EMP_ID = HRMS_TRAVEL.TRAVEL_EMPID) " +" INNER JOIN HRMS_CENTER ON (HRMS_CENTER.CENTER_ID = HRMS_EMP_OFFC. EMP_CENTER ) " +" INNER JOIN HRMS_RANK ON (HRMS_RANK.RANK_ID = HRMS_EMP_OFFC. EMP_RANK ) " +" INNER JOIN HRMS_DEPT ON (HRMS_DEPT.DEPT_ID = HRMS_EMP_OFFC. EMP_DEPT )" +" WHERE 1=1 "; if (!(bean.getFrmDate().equals("")) && !(bean.getFrmDate() == null) && !bean.getFrmDate().equals("null")) { headerQuery += " AND TRAVEL_APPDATE BETWEEN TO_DATE('" + bean.getFrmDate() + "','DD-MM-YYYY')"; if (!(bean.getToDate().equals("")) && !(bean.getToDate() == null) && !bean.getToDate().equals("null")) { headerQuery += " AND TO_DATE('" + bean.getToDate() + "','DD-MM-YYYY')"; } else { headerQuery += " AND TO_DATE(SYSDATE,'DD-MM-YYYY')"; } } if (!(bean.getEmpId().equals("")) && !(bean.getEmpId() == null) && !bean.getEmpId().equals("null")) { headerQuery += " AND TRAVEL_EMPID =" + bean.getEmpId(); } if (!(bean.getTrBranCode().equals("")) && !(bean.getTrBranCode() == null) && !bean.getTrBranCode().equals("null")) { headerQuery += " AND HRMS_EMP_OFFC.EMP_CENTER =" + bean.getTrBranCode(); } if (!(bean.getTrDeptCode().equals("")) && !(bean.getTrDeptCode() == null) && !bean.getTrDeptCode().equals("null")) { headerQuery += " AND HRMS_EMP_OFFC.EMP_DEPT =" + bean.getTrDeptCode(); } if (!(bean.getTrDesgCode().equals("")) && !(bean.getTrDesgCode() == null) && !bean.getTrDesgCode().equals("null")) { headerQuery += " AND HRMS_EMP_OFFC.EMP_RANK =" + bean.getTrDesgCode(); } if (!(bean.getTrDivCode().equals("")) && !(bean.getTrDivCode() == null) && !bean.getTrDivCode().equals("null")) { headerQuery += " AND HRMS_EMP_OFFC.EMP_DIV =" + bean.getTrDivCode(); } if (!(bean.getStatus().equals("1")) && !(bean.getStatus() == null) && !bean.getStatus().equals("null")) { if(bean.getStatus().equals("S")) { headerQuery += " AND TRAVEL_SCHEDULE_STATUS ='S' AND TRAVEL_CONFIRM_STATUS ='D'"; }else { headerQuery += " AND TRAVEL_STATUS ='" + bean.getStatus()+"'"; } } if (!(bean.getCancelStatus().equals("1")) && !(bean.getCancelStatus() == null) && !bean.getCancelStatus().equals("null")) { headerQuery += " AND TRAVEL_CONFIRM_STATUS ='" + bean.getCancelStatus()+"'"; } headerQuery += " ORDER BY TRAVEL_APPDATE DESC ,TRAVEL_ID "; Object appData[][]=getSqlModel().getSingleResult(headerQuery); int rowNum =1; if(appData.length>0 && appData != null) { double tJour =0; double tExJour =0; double tCancelJour =0; double tHotel =0; double tExHotel =0; double tCancelHotel=0; System.out.println("appData.length=========== "+appData.length); for(int k=0; k <appData.length ;k++) { System.out.println("appData[k][0] checking=========== "+appData[k][0]); String jourQuery="SELECT NVL(EMP_FNAME||' '||EMP_MNAME||' '||EMP_LNAME,' '),TO_CHAR(TRAVEL_APPDATE,'DD-MM-YYYY'),L1.LOCATION_NAME FROMPLACE ,L2.LOCATION_NAME TOPLACE,NVL(TO_CHAR(TRAVELDTL_SCHD_DATE,'DD-MM-YYYY'),' '),NVL(TRAVELDTL_SCHD_TIME,' '),NVL(HRMS_JOURNEY.JOURNEY_NAME,' '),NVL(HRMS_JOURNEY_CLASS.JOURNEY_CLASS_NAME,' ')," + " CASE WHEN TRAVEL_SCHEDULE_STATUS ='S' THEN DECODE(TRAVEL_CONFIRM_STATUS,'D','Schedule','C','Confirm','N','Cancel In Process','K','Cancel') ELSE DECODE(TRAVEL_STATUS,'P','Pending','A','Approved','R','Rejected') END ,"+ " NVL(TRAVELDTL_SCHD_JOUR_COST,0),NVL(TRAVELDTL_SCHD_JOUR_EXTAMT,0), " + " TRAVELDTL_FROM_PLACE,TRAVELDTL_TO_PLACE,TRAVELDTL_SCHD_JOUR_MODE,TRAVELDTL_SCHD_JOUR_CLASS,TRAVEL_ID,TRAVEL_EMPID,NVL(TRAVELDTL_SCHD_CANCEL_AMT,0) FROM HRMS_TRAVEL_DTL"+ " LEFT JOIN HRMS_TRAVEL ON(HRMS_TRAVEL.TRAVEL_ID = HRMS_TRAVEL_DTL.TRAVELDTL_TRAVEL_ID)"+ " INNER JOIN HRMS_EMP_OFFC ON(HRMS_EMP_OFFC.EMP_ID = HRMS_TRAVEL.TRAVEL_EMPID)"+ " LEFT JOIN HRMS_LOCATION L1 ON (L1.LOCATION_CODE = HRMS_TRAVEL_DTL.TRAVELDTL_FROM_PLACE)"+ " LEFT JOIN HRMS_LOCATION L2 ON (L2.LOCATION_CODE = HRMS_TRAVEL_DTL.TRAVELDTL_TO_PLACE)"+ " LEFT JOIN HRMS_JOURNEY ON (HRMS_JOURNEY.JOURNEY_ID = HRMS_TRAVEL_DTL.TRAVELDTL_SCHD_JOUR_MODE)"+ " LEFT JOIN HRMS_JOURNEY_CLASS ON(HRMS_JOURNEY_CLASS.JOURNEY_CLASS_ID = HRMS_TRAVEL_DTL.TRAVELDTL_SCHD_JOUR_CLASS)"+ " WHERE 1=1 AND HRMS_TRAVEL.TRAVEL_ID = "+appData[k][0]+" ORDER BY TRAVEL_APPDATE DESC"; Object jourData[][]=getSqlModel().getSingleResult(jourQuery); String hotelQuery =" SELECT NVL(TRAVEL_HOTEL_NAME,' '), NVL(TRAVEL_HOTEL_BILL,0), NVL(TRAVEL_HOTEL_OTHER_BILL,0),NVL(TRAVEL_HOTEL_CANCEL_AMT,0) FROM HRMS_TRAVEL_HOTEL " +" WHERE TRAVEL_HOTEL_TRAVEL_ID ="+appData[k][0]; Object hotelData[][]=getSqlModel().getSingleResult(hotelQuery); if(jourData.length>0 && jourData!=null) { int length =0; if(jourData.length >= hotelData.length) length =jourData.length; else length =hotelData.length; Object [][] data = new Object [length][17]; // Object [][] appSum = new Object [1][14]; for(int i =0 ; i <length;i++) { if(i <length) { if(i<jourData.length) { data [i][0] = rowNum; data [i][1] = jourData[i][0]; data [i][2] = jourData[i][1]; data [i][3] = jourData[i][2]; data [i][4] = jourData[i][3]; data [i][5] = jourData[i][4]; data [i][6] = jourData[i][5] ; data [i][7] = jourData[i][6]; data [i][8] = jourData[i][7]; data [i][9] = jourData[i][8]; if(String.valueOf(jourData[i][17]).equals("")||String.valueOf(jourData[i][17]).equals("0")) { data [i][10] = jourData[i][9]; data [i][11] = jourData[i][10]; }else { data [i][10] = "0"; data [i][11] = "0"; } data [i][12] = jourData[i][17]; // jourCost += Math.round(Double.parseDouble(""+jourData[i][8])); // jourExCost += Math.round(Double.parseDouble(""+jourData[i][9])); tCancelJour += Math.round(Double.parseDouble(""+jourData[i][17])); tJour += Math.round(Double.parseDouble(""+data [i][10])); tExJour += Math.round(Double.parseDouble(""+data [i][11])); }else{ data [i][0] = rowNum; data [i][1] = ""; data [i][2] = ""; data [i][3] = ""; data [i][4] = ""; data [i][5] = ""; data [i][6] = ""; data [i][7] = ""; data [i][8] = ""; data [i][9] = ""; data [i][10] = ""; data [i][11] = ""; data [i][12] = ""; } if(i<hotelData.length) { data [i][13] = hotelData[i][0] ; if(String.valueOf(hotelData[i][3]).equals("")||String.valueOf(hotelData[i][3]).equals("0")) { data [i][14] = hotelData[i][1] ; data [i][15] = hotelData[i][2] ; }else { data [i][14] = "0" ; data [i][15] = "0" ; } data [i][16] = hotelData[i][3] ; // hotelCost += Math.round(Double.parseDouble(""+hotelData[i][1])); // hotelExCost += Math.round(Double.parseDouble(""+hotelData[i][2])); tHotel += Math.round(Double.parseDouble(""+data [i][14])); tExHotel += Math.round(Double.parseDouble(""+data [i][15])); tCancelHotel += Math.round(Double.parseDouble(""+hotelData[i][3])); }else{ data [i][13] = "" ; data [i][14] = "" ; data [i][15] = ""; data [i][16] = ""; } rowNum++; }/*else { data [i][0] = "TOTAL"; data [i][1] = ""; data [i][2] = ""; data [i][3] = ""; data [i][4] = ""; data [i][5] = ""; data [i][6] = "" ; data [i][7] = ""; data [i][8] = ""; data [i][9] = jourCost; data [i][10] = jourExCost; data [i][11] = "" ; data [i][12] = hotelCost ; data [i][13] = hotelExCost ; } */ } if(k==0) { rg.tableBody(colNames,data, cellWidth, alignment); }else { rg.tableBody(data, cellWidth, alignment); } } //end of if }//end of for loop rg.addText("\n".trim(), 0, 0, 0); Object [][] totObj = new Object [1][17]; totObj [0][0] = ""; totObj [0][1] = "Grand Total"; totObj [0][2] = ""; totObj [0][3] = ""; totObj [0][4] = ""; totObj [0][5] = ""; totObj [0][6] = ""; totObj [0][7] = ""; totObj [0][8] = ""; totObj [0][9] = ""; totObj [0][10] = tJour; totObj [0][11] = tExJour; totObj [0][12] = tCancelJour; totObj [0][13] = ""; totObj [0][14] = tHotel; totObj [0][15] = tExHotel; totObj [0][16] = tCancelHotel; rg.tableBodyNoCellBorder(totObj, cellWidth, alignment,1); } // end of if else{ rg.addText("There are no data to display", 0, 1, 0); } rg.createReport(response); } catch (Exception e) { logger.error(e.getMessage()); logger.info("Exception in Travel Mis Report=="+e); } } // end of report. }
[ "Jigar.V@jigar_vasani.THIRDI.COM" ]
Jigar.V@jigar_vasani.THIRDI.COM
08dd7a11fe931f54241f17fb851d142b362554da
e779d7dc903237577b13d4d654480c1cb73728f0
/CalculatorMain/src/com/ict100/jutiprojects/CalculatorTest.java
405b3895deb9dda5e81e112c4ffb6f3d6f84c2ba
[]
no_license
Love98729/SoftwareQuality-LearningActivity1
8b126f4de8bff92c107929a164466c8cbdada2ba
da7a7645eeb0322414b10ece225d1bc895784f72
refs/heads/master
2023-04-19T23:09:50.172939
2021-05-19T03:58:47
2021-05-19T03:58:47
368,736,637
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.ict100.jutiprojects; import static org.junit.Assert.*; import org.junit.Test; public class CalculatorTest { @Test public void calTestAddFail() { assertEquals("error in add()",21, Calculator.add(10, 11)); assertEquals("error in add()", -11, Calculator.add(-6, -5)); assertEquals("error in add()", 27, Calculator.add(9,18)); } public void calcTestFail() { assertEquals("error in add() ",0, Calculator.add(1,2)); } public void calcTestSubPass() { assertEquals("error in sub()", 27, Calculator.add(20, 7)); assertEquals("error in sub()", -1, Calculator.add(-1, -2)); assertEquals("error in sub()", 0, Calculator.add(9, 0)); } public void calcSubFail() { assertEquals("error in add() ",0, Calculator.add(2, 1)); } }
bfbf4a95ef57568de2174db75d3266b0e9fc9235
2fe48c5e979b6e45800ff7a717809c877bc93460
/hospital-reflections/drhouse-accountancy/src/main/java/at/nacs/drhouseaccountancy/persistence/repository/InvoiceRepository.java
33d272af23acd663ef27994d35245568acc19282
[]
no_license
omaralzuhairi27/BackEnd
7a28f1076ae9c1ff8c82940fdd651a0e4436efd6
015dd05b4c4e19a956f2d863fb4176221b8b0889
refs/heads/master
2020-04-24T15:07:46.302453
2019-05-07T11:19:01
2019-05-07T11:19:01
172,053,210
1
0
null
null
null
null
UTF-8
Java
false
false
261
java
package at.nacs.drhouseaccountancy.persistence.repository; import at.nacs.drhouseaccountancy.persistence.domain.Invoice; import org.springframework.data.jpa.repository.JpaRepository; public interface InvoiceRepository extends JpaRepository<Invoice, Long> { }
fca97b7b16cd3c93a10afd8f59eb44cbab1d2e86
39e1ecc579ccf2ac64dda1e5174b6d45811dbf23
/Factory Pattern/src/com/factoryClasses/Triangle.java
c64c0d63bd531cec0bf41258c84e1d8f190b66f5
[]
no_license
codhar/designPatterns
110c912e4a4b3f3dab46e0ac0de7524d47127f0c
77fadff043b32a955728cc23dbc5c07592d0a57f
refs/heads/master
2023-02-13T13:58:25.946025
2023-02-07T06:47:13
2023-02-07T06:47:13
66,203,008
0
0
null
null
null
null
UTF-8
Java
false
false
205
java
package com.factoryClasses; import com.interfaces.Shape; public class Triangle implements Shape { @Override public void draw() { System.out.println("in Triangle : draw method"); } }
e90c65377392d7b2d991f51b1495d0439112d1d8
292e4ac144d14e6fe13555d59fa450731454eda8
/app/src/main/java/com/hwadzan/ebook/lib/PingCallBack.java
00caa1527bd45b70946ff4449527e2ac6e31efe9
[]
no_license
amtbtv/EBook
92898ac30323148b25ab431b24fcdd666d0a9dd8
e28ce726f9b81c15db9cfc7f3d28ff18d618d64c
refs/heads/master
2021-11-20T13:00:09.401740
2021-08-25T10:12:57
2021-08-25T10:12:57
154,249,482
1
0
null
null
null
null
UTF-8
Java
false
false
97
java
package com.hwadzan.ebook.lib; public interface PingCallBack { void state(boolean state); }
514d12993154c59cf55ad52f725a1d39bf28a1cc
80403ec5838e300c53fcb96aeb84d409bdce1c0c
/server/modules/study/src/org/labkey/study/query/StudyQueryView.java
a709939a87936ea111599be570156a630753a8af
[]
no_license
scchess/LabKey
7e073656ea494026b0020ad7f9d9179f03d87b41
ce5f7a903c78c0d480002f738bccdbef97d6aeb9
refs/heads/master
2021-09-17T10:49:48.147439
2018-03-22T13:01:41
2018-03-22T13:01:41
126,447,224
0
1
null
null
null
null
UTF-8
Java
false
false
1,419
java
/* * Copyright (c) 2012-2013 LabKey Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.labkey.study.query; import org.labkey.api.query.QuerySettings; import org.labkey.api.query.QueryView; import org.labkey.api.query.UserSchema; import org.labkey.api.study.Study; import org.labkey.api.study.StudyService; import org.labkey.study.CohortFilter; import org.springframework.validation.BindException; /** * User: matthewb * Date: 2012-12-10 * Time: 2:03 PM * * Base class for DatasetQueryView and SpecimenQueryView */ public class StudyQueryView extends QueryView { protected Study _study; public StudyQueryView(UserSchema schema, QuerySettings settings, BindException errors) { super(schema, settings, errors); _study = StudyService.get().getStudy(getContainer()); } public CohortFilter getCohortFilter() { return null; } }
561b7feac8c54606f89e461aee1adaf3d3c1c5d4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_e03ca6a6f07e566824ceb03cbbc043cb59a4dd03/ProActiveRuntimeAdapterForwarderImpl/2_e03ca6a6f07e566824ceb03cbbc043cb59a4dd03_ProActiveRuntimeAdapterForwarderImpl_t.java
77ebd65c2fbd756fbf5fc76de8d21634ea62835b
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
24,759
java
/* * ################################################################ * * ProActive: The Java(TM) library for Parallel, Distributed, * Concurrent computing with Security and Mobility * * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis * Contact: [email protected] * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * Initial developer(s): The ProActive Team * http://www.inria.fr/oasis/ProActive/contacts.html * Contributor(s): * * ################################################################ */ package org.objectweb.proactive.core.runtime; import java.io.IOException; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.rmi.AlreadyBoundException; import java.rmi.UnmarshalException; import java.security.PublicKey; import java.security.cert.X509Certificate; import java.util.ArrayList; import org.objectweb.proactive.Body; import org.objectweb.proactive.core.ProActiveException; import org.objectweb.proactive.core.UniqueRuntimeID; import org.objectweb.proactive.core.body.UniversalBody; import org.objectweb.proactive.core.body.ft.checkpointing.Checkpoint; import org.objectweb.proactive.core.config.ProActiveConfiguration; import org.objectweb.proactive.core.descriptor.data.ProActiveDescriptor; import org.objectweb.proactive.core.descriptor.data.VirtualNode; import org.objectweb.proactive.core.mop.ConstructorCall; import org.objectweb.proactive.core.mop.ConstructorCallExecutionFailedException; import org.objectweb.proactive.core.node.NodeException; import org.objectweb.proactive.core.process.ExternalProcess; import org.objectweb.proactive.core.process.UniversalProcess; import org.objectweb.proactive.ext.security.Communication; import org.objectweb.proactive.ext.security.ProActiveSecurityManager; import org.objectweb.proactive.ext.security.SecurityContext; import org.objectweb.proactive.ext.security.crypto.KeyExchangeException; import org.objectweb.proactive.ext.security.exceptions.RenegotiateSessionException; import org.objectweb.proactive.ext.security.exceptions.SecurityNotAvailableException; import org.objectweb.proactive.ext.security.securityentity.Entity; /** * An adapter for a RemoteProActiveRuntimeForwarder. The Adpater is the generic entry point for remote calls * to a RemoteProActiveRuntimeForwarder using different protocols such as RMI, RMISSH, IBIS, HTTP, JINI. * This also allows to cache informations, and so to avoid crossing the network when calling some methods. * * All calls done on a ProActiveRuntimeAdapterForwarderImpl, method1(foo, bar) for example, are * translated into remotePA.method1(urid, foo, bar) where urid is an unique identifiant for runtimes. * The forwarder forwards the call to the right runtime by using this ID. * * @author ProActiveTeam * */ public class ProActiveRuntimeAdapterForwarderImpl extends ProActiveRuntimeAdapter implements Serializable, Cloneable { private UniqueRuntimeID urid; // Cached for speed issue protected RemoteProActiveRuntimeForwarder proActiveRuntime; protected String proActiveRuntimeURL; // this boolean is used when killing the runtime. // Indeed in case of co-allocation, we avoid a second call to the runtime which is already dead protected boolean alreadykilled = false; // // -- Constructors ----------------------------------------------- // public ProActiveRuntimeAdapterForwarderImpl() { } public ProActiveRuntimeAdapterForwarderImpl( RemoteProActiveRuntimeForwarder proActiveRuntime) throws ProActiveException { this.proActiveRuntime = proActiveRuntime; try { this.vmInformation = proActiveRuntime.getVMInformation(); this.proActiveRuntimeURL = proActiveRuntime.getURL(); } catch (IOException e) { throw new ProActiveException(e); } } public ProActiveRuntimeAdapterForwarderImpl( ProActiveRuntimeAdapterForwarderImpl localAdapter, ProActiveRuntime remoteAdapter) throws ProActiveException { this.proActiveRuntime = (RemoteProActiveRuntimeForwarder) localAdapter.proActiveRuntime; this.vmInformation = remoteAdapter.getVMInformation(); this.proActiveRuntimeURL = remoteAdapter.getURL(); this.urid = new UniqueRuntimeID(remoteAdapter.getVMInformation() .getName(), remoteAdapter.getVMInformation().getVMID()); } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); if (ProActiveConfiguration.isForwarder()) { // on a forwarder and during the deserialization of a ProActiveAdapterForwarderImpl. ProActiveRuntimeForwarderImpl partf = (ProActiveRuntimeForwarderImpl) ProActiveRuntimeImpl.getProActiveRuntime(); if ((urid != null) && !partf.registeredRuntimes.containsKey(urid)) { try { // Add this unknown runtime to the table of forwarded runtimes partf.registeredRuntimes.put(urid, (ProActiveRuntime) this.clone()); } catch (CloneNotSupportedException e) { runtimeLogger.warn(e); } } try { // Change the RMI reference to point on this forwarder. That's all, it's automagic ! proActiveRuntime = ((ProActiveRuntimeAdapterForwarderImpl) RuntimeFactory.getDefaultRuntime()).proActiveRuntime; } catch (ProActiveException e) { runtimeLogger.warn(e); } } } // // -- PUBLIC METHODS ----------------------------------------------- // @Override public boolean equals(Object o) { if (!(o instanceof ProActiveRuntimeAdapterForwarderImpl)) { return false; } ProActiveRuntimeAdapterForwarderImpl runtime = (ProActiveRuntimeAdapterForwarderImpl) o; return this.urid.equals(runtime.urid); } @Override public int hashCode() { return urid.hashCode(); } // // -- Implements ProActiveRuntime ----------------------------------------------- // /** * @throws NodeException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#createLocalNode(java.lang.String, boolean, ProActiveSecurityManager, java.lang.String, java.lang.String) */ public String createLocalNode(String nodeName, boolean replacePreviousBinding, ProActiveSecurityManager psm, String vnName, String jobId) throws NodeException { try { return proActiveRuntime.createLocalNode(urid, nodeName, replacePreviousBinding, psm, vnName, jobId); } catch (Exception e) { throw new NodeException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#killAllNodes() */ public void killAllNodes() throws ProActiveException { try { proActiveRuntime.killAllNodes(urid); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#killNode(java.lang.String) */ public void killNode(String nodeName) throws ProActiveException { try { proActiveRuntime.killNode(urid, nodeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws IOException * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#createVM(org.objectweb.proactive.core.process.UniversalProcess) */ public void createVM(UniversalProcess remoteProcess) throws IOException, ProActiveException { proActiveRuntime.createVM(urid, remoteProcess); } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getLocalNodeNames() */ public String[] getLocalNodeNames() throws ProActiveException { try { return proActiveRuntime.getLocalNodeNames(urid); } catch (IOException e) { throw new ProActiveException(e); } } /** * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getVMInformation() */ public VMInformation getVMInformation() { return vmInformation; } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#register(org.objectweb.proactive.core.runtime.ProActiveRuntime, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void register(ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeUrl, String creatorID, String creationProtocol, String vmName) throws ProActiveException { try { proActiveRuntime.register(urid, proActiveRuntimeDist, proActiveRuntimeUrl, creatorID, creationProtocol, vmName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#unregister(org.objectweb.proactive.core.runtime.ProActiveRuntime, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void unregister(ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeUrl, String creatorID, String creationProtocol, String vmName) throws ProActiveException { try { this.proActiveRuntime.unregister(urid, proActiveRuntimeDist, proActiveRuntimeUrl, creatorID, creationProtocol, vmName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getProActiveRuntimes() */ public ProActiveRuntime[] getProActiveRuntimes() throws ProActiveException { try { return proActiveRuntime.getProActiveRuntimes(urid); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getProActiveRuntime(java.lang.String) */ public ProActiveRuntime getProActiveRuntime(String proActiveRuntimeName) throws ProActiveException { try { return proActiveRuntime.getProActiveRuntime(urid, proActiveRuntimeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#addAcquaintance(java.lang.String) */ public void addAcquaintance(String proActiveRuntimeName) throws ProActiveException { try { proActiveRuntime.addAcquaintance(urid, proActiveRuntimeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getAcquaintances() */ public String[] getAcquaintances() throws ProActiveException { try { return proActiveRuntime.getAcquaintances(urid); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#rmAcquaintance(java.lang.String) */ public void rmAcquaintance(String proActiveRuntimeName) throws ProActiveException { try { proActiveRuntime.rmAcquaintance(urid, proActiveRuntimeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#killRT(boolean) */ public void killRT(boolean softly) throws Exception { try { if (!alreadykilled) { proActiveRuntime.killRT(urid, softly); } alreadykilled = true; } catch (UnmarshalException e) { //here should be caught the exception from System.exit alreadykilled = true; throw e; } } /** * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getURL() */ public String getURL() { return proActiveRuntimeURL; } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getActiveObjects(java.lang.String) */ public ArrayList getActiveObjects(String nodeName) throws ProActiveException { try { return proActiveRuntime.getActiveObjects(urid, nodeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getActiveObjects(java.lang.String, java.lang.String) */ public ArrayList getActiveObjects(String nodeName, String className) throws ProActiveException { try { return proActiveRuntime.getActiveObjects(urid, nodeName, className); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getVirtualNode(java.lang.String) */ public VirtualNode getVirtualNode(String virtualNodeName) throws ProActiveException { try { return proActiveRuntime.getVirtualNode(urid, virtualNodeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#registerVirtualNode(java.lang.String, boolean) */ public void registerVirtualNode(String virtualNodeName, boolean replacePreviousBinding) throws ProActiveException, AlreadyBoundException { try { proActiveRuntime.registerVirtualNode(urid, virtualNodeName, replacePreviousBinding); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#unregisterVirtualNode(java.lang.String) */ public void unregisterVirtualNode(String virtualNodeName) throws ProActiveException { try { proActiveRuntime.unregisterVirtualNode(urid, virtualNodeName); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#unregisterAllVirtualNodes() */ public void unregisterAllVirtualNodes() throws ProActiveException { try { proActiveRuntime.unregisterAllVirtualNodes(urid); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getJobID(java.lang.String) */ public String getJobID(String nodeUrl) throws ProActiveException { try { return proActiveRuntime.getJobID(urid, nodeUrl); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#createBody(java.lang.String, org.objectweb.proactive.core.mop.ConstructorCall, boolean) */ public UniversalBody createBody(String nodeName, ConstructorCall bodyConstructorCall, boolean isNodeLocal) throws ConstructorCallExecutionFailedException, InvocationTargetException, ProActiveException { try { return proActiveRuntime.createBody(urid, nodeName, bodyConstructorCall, isNodeLocal); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#receiveBody(java.lang.String, org.objectweb.proactive.Body) */ public UniversalBody receiveBody(String nodeName, Body body) throws ProActiveException { try { return proActiveRuntime.receiveBody(urid, nodeName, body); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#receiveCheckpoint(java.lang.String, org.objectweb.proactive.core.body.ft.checkpointing.Checkpoint, int) */ public UniversalBody receiveCheckpoint(String nodeName, Checkpoint ckpt, int inc) throws ProActiveException { try { return proActiveRuntime.receiveCheckpoint(urid, nodeName, ckpt, inc); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getVNName(java.lang.String) */ public String getVNName(String Nodename) throws ProActiveException { try { return proActiveRuntime.getVNName(urid, Nodename); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getClassDataFromThisRuntime(java.lang.String) */ public byte[] getClassDataFromThisRuntime(String className) throws ProActiveException { try { return proActiveRuntime.getClassDataFromThisRuntime(urid, className); } catch (IOException e) { throw new ProActiveException(e); } } /** * @throws ProActiveException * @see org.objectweb.proactive.core.runtime.ProActiveRuntime#getClassDataFromParentRuntime(java.lang.String) */ public byte[] getClassDataFromParentRuntime(String className) throws ProActiveException { try { return proActiveRuntime.getClassDataFromParentRuntime(urid, className); } catch (IOException e) { throw new ProActiveException(e); } } public ExternalProcess getProcessToDeploy( ProActiveRuntime proActiveRuntimeDist, String creatorID, String vmName, String padURL) throws ProActiveException { try { return proActiveRuntime.getProcessToDeploy(urid, proActiveRuntimeDist, creatorID, vmName, padURL); } catch (IOException e) { throw new ProActiveException(e); } } // // Implements Job Interface // /** * @see org.objectweb.proactive.Job#getJobID() */ public String getJobID() { return vmInformation.getJobID(); } public ProActiveDescriptor getDescriptor(String url, boolean isHierarchicalSearch) throws IOException, ProActiveException { try { return proActiveRuntime.getDescriptor(urid, url, isHierarchicalSearch); } catch (IOException e) { throw new ProActiveException(e); } } public void launchMain(String className, String[] parameters) throws ClassNotFoundException, NoSuchMethodException, ProActiveException { try { proActiveRuntime.launchMain(urid, className, parameters); } catch (IOException e) { throw new ProActiveException(e); } } public void newRemote(String className) throws ClassNotFoundException, ProActiveException { try { proActiveRuntime.newRemote(urid, className); } catch (IOException e) { throw new ProActiveException(e); } } public X509Certificate getCertificate() throws SecurityNotAvailableException, IOException { return proActiveRuntime.getCertificate(urid); } public byte[] getCertificateEncoded() throws SecurityNotAvailableException, IOException { return proActiveRuntime.getCertificateEncoded(urid); } public ArrayList<Entity> getEntities() throws SecurityNotAvailableException, IOException { return proActiveRuntime.getEntities(urid); } public PublicKey getPublicKey() throws SecurityNotAvailableException, IOException { return proActiveRuntime.getPublicKey(urid); } public byte[][] publicKeyExchange(long sessionID, byte[] myPublicKey, byte[] myCertificate, byte[] signature) throws SecurityNotAvailableException, RenegotiateSessionException, KeyExchangeException, IOException { return proActiveRuntime.publicKeyExchange(urid, sessionID, myPublicKey, myCertificate, signature); } public byte[] randomValue(long sessionID, byte[] clientRandomValue) throws SecurityNotAvailableException, RenegotiateSessionException, IOException { return proActiveRuntime.randomValue(urid, sessionID, clientRandomValue); } public byte[][] secretKeyExchange(long sessionID, byte[] encodedAESKey, byte[] encodedIVParameters, byte[] encodedClientMacKey, byte[] encodedLockData, byte[] parametersSignature) throws SecurityNotAvailableException, RenegotiateSessionException, IOException { return proActiveRuntime.secretKeyExchange(urid, sessionID, encodedAESKey, encodedIVParameters, encodedClientMacKey, encodedLockData, parametersSignature); } public long startNewSession(Communication policy) throws SecurityNotAvailableException, RenegotiateSessionException, IOException { return proActiveRuntime.startNewSession(urid, policy); } public void terminateSession(long sessionID) throws SecurityNotAvailableException, IOException { proActiveRuntime.terminateSession(urid, sessionID); } public SecurityContext getPolicy(SecurityContext securityContext) throws SecurityNotAvailableException, IOException { return proActiveRuntime.getPolicy(urid, securityContext); } public Object setLocalNodeProperty(String nodeName, String key, String value) throws ProActiveException { try { return this.proActiveRuntime.setLocalNodeProperty(this.urid, nodeName, key, value); } catch (IOException e) { throw new ProActiveException(e); } } public String getLocalNodeProperty(String nodeName, String key) throws ProActiveException { try { return this.proActiveRuntime.getLocalNodeProperty(this.urid, nodeName, key); } catch (IOException e) { throw new ProActiveException(e); } } }
efe6b4fc8a881ddb075837093ece447070a8820d
537dfef095621fb06b1260b959105af5cfa6f5c0
/Polymorphism/Main.java
c92d71265fb434686443927429ed105ac9c28132
[]
no_license
EdithZhu/Java-Basic-2
18fb57c0e5fbd98844c73db29484d3cb700cf22c
1874c176fc6910ccb68d85731727882766744d32
refs/heads/main
2023-02-23T11:42:04.853099
2021-01-17T06:31:10
2021-01-17T06:31:10
330,329,004
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package Polymorphism; public class Main { public static void main(String[] args) { Person a = new Man(); a.eat(); // a.Print(new Man()); a.age(80); } }
7f16d375f2f7499071015cc15cef8446b4d6357d
6e59fa8c5257c71936bc83427b07fe766aece23a
/src/main/java/com/igorfcfs/workshopmongo/repositories/UserRepository.java
b03f692042626cb73b8da8f0084b7add1d375b36
[]
no_license
igorfcfs/WorkshopSpringBootMongoDB
b93e48e90b6d89b68645be3410bb651e0b08c02e
f5bc20e113b80b9661ee95008cfa4bc2ea555f4f
refs/heads/master
2023-05-04T12:29:19.436509
2021-05-22T00:22:03
2021-05-22T00:22:03
369,639,474
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.igorfcfs.workshopmongo.repositories; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.stereotype.Repository; import com.igorfcfs.workshopmongo.domain.User; @Repository public interface UserRepository extends MongoRepository<User, String> { }
ae555a2653a5daa858d6638968aec2aae19431ff
63ec7395e9f41bfb48cc781109cb83e2ac700947
/test/genindex/RawDataTest.java
f522ebc91a6a869dadbe37e8dbc8b05f4584a95c
[]
no_license
CharlesLc/Genindexe
7e328b38b59161fde569b3fbbd748181b8b8bbc5
268fc533aaa61316398d8ce1afc9dc68e34e3cad
refs/heads/master
2021-01-02T23:13:24.965404
2015-05-22T11:50:30
2015-05-22T11:50:30
35,801,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,643
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 genindex; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author User */ public class RawDataTest { public RawDataTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of getPosition method, of class RawData. */ @Test public void testGetPosition() { System.out.println("getPosition"); RawData instance = null; int expResult = 0; int result = instance.getPosition(); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } /** * Test of getValue method, of class RawData. */ @Test public void testGetValue() { System.out.println("getValue"); RawData instance = null; int expResult = 0; int result = instance.getValue(); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } }
c6b9a981938a1d4d88cd92126bb7f2913f6bcb47
f5ab0e74edaa688393162ae462ea2f584bbccc7b
/src/data/CostsChanges.java
f1db05e8e0e4f96dc9c0b78cbef89decf1cf8b6a
[]
no_license
CaplanRobert123/POO_Tema2_Etapa1
80f07e74b6f0612ecf50531b301a2c01874fbdc4
6fb0a4e69451103116b2fc2c9cd7f18898d2381d
refs/heads/main
2023-01-29T13:55:08.701075
2020-12-09T00:50:18
2020-12-09T00:50:18
319,683,285
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package data; public class CostsChanges { private int id; private long infrastructureCost; private long productionCost; public int getId() { return id; } public void setId(int id) { this.id = id; } public long getInfrastructureCost() { return infrastructureCost; } public void setInfrastructureCost(long infrastructureCost) { this.infrastructureCost = infrastructureCost; } public long getProductionCost() { return productionCost; } public void setProductionCost(long productionCost) { this.productionCost = productionCost; } @Override public String toString() { return "CostsChanges{" + "id=" + id + ", infrastructureCost=" + infrastructureCost + ", productionCost=" + productionCost + '}'; } }
968f94f14a7a9a5f506b71f2d89c70615f087a3a
686722c63bd5a0e22337612f653a04f716958447
/hrms/src/main/java/kodlamaio/hrms/business/concretes/ExperienceForCVManager.java
e306dc60fe474bc59145cab6c6a846576eb177d7
[]
no_license
CerenBdk/HRMS-Project
4ad9e458dc2abf4cb0be7e95c7a6dbbc179248b7
ad3713b65da3368d07f2e108ad67b9e3a49cd734
refs/heads/master
2023-05-14T06:18:08.482816
2021-06-06T14:47:35
2021-06-06T14:47:35
365,824,813
118
14
null
null
null
null
UTF-8
Java
false
false
2,114
java
package kodlamaio.hrms.business.concretes; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kodlamaio.hrms.business.abstracts.ExperienceForCVService; import kodlamaio.hrms.core.utilities.results.DataResult; import kodlamaio.hrms.core.utilities.results.Result; import kodlamaio.hrms.core.utilities.results.SuccessDataResult; import kodlamaio.hrms.core.utilities.results.SuccessResult; import kodlamaio.hrms.dataAccess.abstracts.ExperienceForCVDao; import kodlamaio.hrms.entities.concretes.ExperienceForCV; @Service public class ExperienceForCVManager implements ExperienceForCVService{ private ExperienceForCVDao experienceForCVDao; @Autowired public ExperienceForCVManager(ExperienceForCVDao experienceForCVDao) { super(); this.experienceForCVDao = experienceForCVDao; } @Override public Result add(ExperienceForCV experienceForCV) { this.experienceForCVDao.save(experienceForCV); return new SuccessResult("Experience has been added."); } @Override public Result update(ExperienceForCV experienceForCV) { this.experienceForCVDao.save(experienceForCV); return new SuccessResult("Experience has been updated."); } @Override public Result delete(int id) { this.experienceForCVDao.deleteById(id); return new SuccessResult("Experience has been deleted."); } @Override public DataResult<ExperienceForCV> getById(int id) { return new SuccessDataResult<ExperienceForCV>(this.experienceForCVDao.getById(id)); } @Override public DataResult<List<ExperienceForCV>> getAll() { return new SuccessDataResult<List<ExperienceForCV>>(this.experienceForCVDao.findAll()); } @Override public DataResult<List<ExperienceForCV>> getAllByJobseekerIdOrderByEndAtDesc(int id) { return new SuccessDataResult<List<ExperienceForCV>>(this.experienceForCVDao.getAllByJobseeker_idOrderByEndAtDesc(id)); } @Override public DataResult<List<ExperienceForCV>> getAllByJobseekerId(int id) { return new SuccessDataResult<List<ExperienceForCV>>(this.experienceForCVDao.getAllByJobseeker_id(id)); } }
c0600aa28b03c4e60bbcd0211f71d1e4b483b33b
dc437d9434becb6acf9f44e528d0a801fbd5bfb8
/blue-web-in/src/main/java/com/common/system/controller/upPicController.java
3975f51212165ce35cd0eb9856b812939bc5abfb
[]
no_license
deicidelove/blue
d9eb8431e284d2dcba89356e80a4d324d2a43283
b1bf187ed004496d98a234bbe98bbebe73a4dd96
refs/heads/master
2021-09-03T08:40:03.078997
2018-01-07T15:40:51
2018-01-07T15:40:51
104,655,997
0
0
null
null
null
null
UTF-8
Java
false
false
1,581
java
/** * */ package com.common.system.controller; import java.text.ParseException; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.common.system.util.PicUtil; /** * @author amkong * */ @Controller public class upPicController { // @RequestMapping("upJson") // @ResponseBody // public String upJson(HttpServletRequest request) throws ParseException{ // // String path = PicUtil.upFile(file); // String config = // "{\n" + // " \"state\": \"SUCCESS\",\n" + // " \"url\": \""+path+"\",\n" + // " \"title\": \"path\",\n" + // " \"original\": \"path\"\n" + // " }"; // return config; // } // @RequestMapping("upPic") @ResponseBody public String upPic(@RequestParam("upfile") MultipartFile file) throws ParseException{ String path = PicUtil.upFile(file); String config = "{\n" + " \"state\": \"SUCCESS\",\n" + " \"url\": \""+path+"\",\n" + " \"title\": \"path\",\n" + " \"original\": \"path\"\n" + " }"; return config; } }
c752e4c2d893a9f3ed1c5f29a35012e3e25d0e97
6dfaccbb5dac417c6c878c6766044a41df2e33eb
/core-services/src/main/java/org/zalando/nakadi/service/publishing/EventMetadata.java
dffdae7da9a2d2cd2f6022f037fc86464fb0edca
[ "MIT" ]
permissive
pengup/nakadi
1b7cb867090aa5bd37fb305f34fc5cd96971cde4
d526be43874adefd94f40fcaf78bd9a810ecff9c
refs/heads/master
2022-08-22T12:19:43.520316
2022-08-08T10:53:54
2022-08-08T10:53:54
76,261,096
0
0
MIT
2022-08-08T10:53:56
2016-12-12T13:58:47
Java
UTF-8
Java
false
false
722
java
package org.zalando.nakadi.service.publishing; import org.json.JSONObject; import org.springframework.stereotype.Component; import org.zalando.nakadi.util.FlowIdUtils; import org.zalando.nakadi.util.UUIDGenerator; import java.time.Instant; @Component public class EventMetadata { private final UUIDGenerator uuidGenerator; public EventMetadata(final UUIDGenerator uuidGenerator) { this.uuidGenerator = uuidGenerator; } public JSONObject addTo(final JSONObject event) { return event.put("metadata", new JSONObject() .put("occurred_at", Instant.now()) .put("eid", uuidGenerator.randomUUID()) .put("flow_id", FlowIdUtils.peek())); } }
3ec3978b1edcb25e7437763c1a5a1e3e9381c1a7
2ecb2c2efd3442e83ab17b5593a2771f123323cc
/PidgeotActionBar/app/src/androidTest/java/com/example/saifil/pidgeotactionbar/ExampleInstrumentedTest.java
b9c74b39158bf15a23e50fc6370e7f0c736f990e
[]
no_license
Saifil/AndroidStudioProjects
f72d505a19179a3faff5e6b6e9b5912253a551a9
1c261d4774f2268ac0f9fc7c2b8a4fa0ffb1744a
refs/heads/master
2020-03-22T04:59:11.419904
2018-07-03T07:45:11
2018-07-03T07:45:11
139,534,185
1
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.example.saifil.pidgeotactionbar; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.saifil.pidgeotactionbar", appContext.getPackageName()); } }
21396370ae3dc483c88e3844984ce343855f1eda
d0c9f3ccefa44286d9d4ab21f55261a59c3f75de
/src/com/sword/tree/Solution3.java
9fc76cb4412083f7efaa0f3ac0494b7be52c35f7
[]
no_license
Cheakk/sword
aab46a0c81fd96915ccc3f4c2dbf0a1c43b7132d
fca22363329bc789b6f3907bbef04f20b8466494
refs/heads/master
2023-01-04T12:37:31.501326
2020-10-13T09:17:21
2020-10-13T09:17:21
261,923,309
0
0
null
null
null
null
GB18030
Java
false
false
1,317
java
package com.sword.tree; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; /** * 从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。 * @author Administrator * */ public class Solution3 { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); ArrayList<ArrayList<Integer>> Print(TreeNode pRoot) { if(pRoot == null) { return result; } Queue<TreeNode> que = new LinkedList<TreeNode>(); que.add(pRoot); while (!que.isEmpty()) { int size = que.size(); int index = 0; ArrayList<Integer> array = new ArrayList<Integer>(); while (index < size) { TreeNode node = que.poll(); array.add(node.val); if (node.left != null) { que.add(node.left); } if (node.right != null) { que.add(node.right); } index++; } result.add(array); } return result; } public static void main(String[] args) { Solution3 s3 =new Solution3(); TreeNode node = new TreeNode(1); node.left = new TreeNode(2); node.right = new TreeNode(3); node.right.right = new TreeNode(3); ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); result = s3.Print(node); System.out.println(1123); } }
909d339f484de500041cfd9771a557fac4d240c8
828103131a92f3901b05e4ec84a8aa575bd0f997
/designpattern-java-master/src/Behavioral/Responsibility/HandleRequest.java
130f80fa049d8ad33b7f466f0dbf9035bb1f08dd
[]
no_license
weizhxa/designpattern
1a3d051081058249bfedd76518ee8f787abf14f1
176153d5fad1f63c4fc2346a105d1f3f37c4add4
refs/heads/master
2020-03-25T01:37:52.044109
2018-08-03T07:52:34
2018-08-03T07:52:34
143,247,745
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package Behavioral.Responsibility; public class HandleRequest { private Handle small; private Handle middle; private Handle big; public HandleRequest(Handle small, Handle middle, Handle big) { this.small = small; this.middle = middle; this.big = big; } public Handle getRequestHandle(){ small.setNextHandle2(middle).setNextHandle2(big); return small; } }
944bc1172ec3b0e2f423ac6c1af644305a301ec8
da28f410342bec7a239194f1dcae7e5049fb2cab
/bootz-security/bootz-security-token-resource2/src/main/java/top/bootz/security/web/UserController.java
d64dc29496b48a0165974f867a82d4dda6106abd
[]
no_license
ibootz/ibootz
05e42ae4dfb1f7610cc471a236ed4810a10293a3
2c5c39cdd05cf4c7f96da35dfc2a66afb789b15a
refs/heads/master
2020-03-19T07:37:17.914845
2019-05-10T03:05:58
2019-05-10T03:05:58
136,132,369
1
1
null
null
null
null
UTF-8
Java
false
false
536
java
package top.bootz.security.web; import java.security.Principal; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/user") public class UserController { @GetMapping("/me") public Principal getUser(@AuthenticationPrincipal Principal principal) { return principal; } }
2be915414f97798fdfb68cb4d226c87c321999ef
0f4735ba8123760f4f71eb68351612d27deb0cde
/src/tiendacomputacion/Venta.java
2ffe770cc048a4dabfbc3df25ffd1ad2a0ff543b
[]
no_license
chuck002/TP01TiendaComputacion
0cc20d8b93e82f1f779513573d9efd03f1ccbbca
488f3cfb430a48296f296e5ba4b2f5e9b5ad220f
refs/heads/master
2023-02-21T06:28:40.072503
2021-01-24T18:56:02
2021-01-24T18:56:02
332,530,055
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package tiendacomputacion; import java.io.Serializable; public class Venta implements Serializable { private StockComputadoras compu; public Venta(StockComputadoras compu) { this.compu = compu; } public StockComputadoras getCompu() { return compu; } public void setCompu(StockComputadoras compu) { this.compu = compu; } }
b34d417f09beb997b9e7ae36062eeea589256bdf
da46d7941b092d97aea068c68e8c80d97d2ef30d
/code/projection.java
d8b4d57b8dc54a18414e5397635ad9741a63d58d
[]
no_license
Xin-Zhang-0122/FBDP_Lab_4
e08555b6ce61fae7fb037e5ce902c861fed0fd53
2c4513babb4ddb30b1b7b01369cc602174589f3e
refs/heads/master
2020-04-04T10:45:32.778309
2018-11-02T13:06:36
2018-11-02T13:06:36
155,864,982
0
0
null
null
null
null
UTF-8
Java
false
false
2,675
java
package relation; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; public class projection { public static class RelationA{ private int id; private String name; private int age; private int weight; public RelationA(String line){ String[] columns = line.split(","); id = Integer.parseInt(columns[0]); name = columns[1]; age = Integer.parseInt(columns[2]); weight = Integer.parseInt(columns[3]); } public String getCol(int col){ switch(col){ case 0: return String.valueOf(id); case 1: return name; case 2: return String.valueOf(age); case 3: return String.valueOf(weight); default: return null; } } } public static class ProjectionMap extends Mapper<LongWritable, Text, Text, NullWritable> { private int col; @Override protected void setup(Context context) throws IOException, InterruptedException { col = context.getConfiguration().getInt("col", 0); } @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { RelationA record = new RelationA(value.toString()); context.write(new Text(record.getCol(col)), NullWritable.get()); } } public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException { Configuration conf = new Configuration(); conf.setInt("col", Integer.parseInt(args[2])); Job projectionJob = Job.getInstance(conf, "ProgectionJob"); projectionJob.setJarByClass(projection.class); projectionJob.setMapperClass(ProjectionMap.class); projectionJob.setMapOutputKeyClass(Text.class); projectionJob.setMapOutputValueClass(NullWritable.class); projectionJob.setNumReduceTasks(0); projectionJob.setInputFormatClass(TextInputFormat.class); projectionJob.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(projectionJob, new Path(args[0])); FileOutputFormat.setOutputPath(projectionJob, new Path(args[1])); projectionJob.waitForCompletion(true); } }
8eeaf7331927c2ab7370af09a3873828803c7de2
1fb439ac41222e2c837b499957cedfbd6aa636ab
/Parcial 1/ClienteBT/src/clientebt/ClienteBT.java
b07570c454bb3057278d8185f6a425b06afdad7b
[]
no_license
emiliano080591/moviles-escom
1200c79d60028d58c57f9c33305fb9329b293077
fe502d3f3d29cc394b16e1e21f832597c3b37f32
refs/heads/master
2020-04-25T14:42:34.139730
2019-03-16T22:17:28
2019-03-16T22:17:28
172,850,740
0
0
null
null
null
null
UTF-8
Java
false
false
4,610
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 clientebt; import javax.microedition.midlet.*; import java.io.*; import java.util.*; import javax.bluetooth.*; import javax.microedition.io.*; import javax.microedition.lcdui.*; /** * @author JanetNaibi */ public class ClienteBT extends MIDlet implements DiscoveryListener, Runnable, CommandListener { private Form f; private Display d; private List l; private TextField tf = new TextField("Mensaje:", "", 40, TextField.ANY); private Command ce = new Command("Enviar", Command.CANCEL, 2); private Command cc = new Command("Conectar", Command.SCREEN, 2); private Command cl = new Command("Borrar texto",Command.SCREEN, 2); private Command cs = new Command("Salir", Command.SCREEN, 2); private Vector vdi = new Vector(); private Vector vda = new Vector(); private int id [] = new int[20]; private int [] attrSet; private UUID[] uuid = {new UUID("F0E0D0C0B0A000908070605040302010", false)}; private int dis; private InputStream is; private OutputStream os; private Thread t; public ClienteBT() { } public void startApp() { try { d = Display.getDisplay(this); l = new List("Servidores:", Choice.EXCLUSIVE); l.addCommand(cc); l.addCommand(cs); l.setCommandListener(this); d.setCurrent(l); LocalDevice dispositivoLocal = LocalDevice.getLocalDevice(); if (!dispositivoLocal.setDiscoverable(DiscoveryAgent.GIAC)) { } DiscoveryAgent agenteDeBusqueda = dispositivoLocal.getDiscoveryAgent(); agenteDeBusqueda.startInquiry(DiscoveryAgent.GIAC, this); while (vdi.size() == 0) { } for (int i = 0; i < vdi.size(); i++) { try { id[i] = agenteDeBusqueda.searchServices(attrSet, uuid, ((RemoteDevice) vdi.elementAt(i)), this); l.append(((RemoteDevice) vdi.elementAt(i)).getFriendlyName(true), null); } catch (Exception e) { } } while (vdi.size()==0 || vda.size()==0) { } d.setCurrent(l); } catch (Exception e) { } } public void pauseApp() { } public void destroyApp(boolean b) { notifyDestroyed(); } public void deviceDiscovered(RemoteDevice rd, DeviceClass dc) { vdi.addElement(rd); } public void inquiryCompleted(int ic) { this.dis = ic; } public void serviceSearchCompleted(int transID, int respCode) { } public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { for (int i = 0; i < servRecord.length; i++) vda.addElement(servRecord[i]); } public void run() { try { f = new Form("Cliente: Conectado al servidor"); f.append(tf); f.addCommand(ce); f.addCommand(cl); f.addCommand(cs); f.setCommandListener(this); d = Display.getDisplay(this); d.setCurrent(f); String direccion = ((ServiceRecord) vda.elementAt(l.getSelectedIndex())).getConnectionURL(((ServiceRecord) vda.elementAt(l.getSelectedIndex())).NOAUTHENTICATE_NOENCRYPT, false); StreamConnection conn = (StreamConnection) Connector.open(direccion); is = conn.openInputStream(); os = conn.openOutputStream(); while (conn != null) { byte buffer[] = new byte[40]; is.read(buffer); f.insert(1, new StringItem("Servidor:", new String(buffer))); d = Display.getDisplay(this); d.setCurrent(f); } } catch (Exception e) { f.append("Error : " + e); } } public void commandAction(Command c, Displayable d) { String label = c.getLabel(); if (label.equals("Conectar")) { t = new Thread(this); t.start(); } else if (label.equals("Enviar")) { try { os.write(tf.getString().getBytes()); f.insert(1, new StringItem("Cliente: ", tf.getString())); } catch (Exception e) { f.append("Error: " + e); } } else if (label.equals("Borrar texto")) { tf.setString(""); } else if (label.equals("Salir")) { destroyApp(false); } } }
b57d40e8c9ee18fef22b2557f4d97d9d5b64f843
74a03d163ba23a92d4225b8d35075fc94fe29b92
/src/main/java/com/example/pms/json/JsonUtils.java
cff5c6af0f3ab55a50a58019c8d88512a031ed89
[]
no_license
Guitenbay/Property_Management_System
3943c2c4a03a6e7f5254b7252ff8c20507f1e901
e3943124fc133219442579dbc9cc0f9b360d573b
refs/heads/master
2020-04-14T04:58:17.695691
2019-01-05T15:47:19
2019-01-05T15:47:19
163,650,714
1
0
null
null
null
null
UTF-8
Java
false
false
1,417
java
package com.example.pms.json; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class JsonUtils { public static String FILE_PATH = "src/main/java/com/example/pms/json/fields.json"; public static String readFile(String Path){ BufferedReader reader = null; String laststr = ""; try{ FileInputStream fileInputStream = new FileInputStream(Path); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8"); reader = new BufferedReader(inputStreamReader); String tempString = null; while((tempString = reader.readLine()) != null){ laststr += tempString; } reader.close(); }catch(IOException e){ e.printStackTrace(); }finally{ if(reader != null){ try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return laststr; } public static JSONObject stringToJSONObject(String jsonString, String entity){ JSONObject jsonObject = JSON.parseObject(jsonString); return jsonObject.getJSONObject(entity); } }
1b80f7d6676aed3a27ebfcafc0cb4a29840e73a9
fd46661342686924fd0cc97f8c2785bdab159bf6
/src/com/yx/zhihu/view/photoview/gestures/OnGestureListener.java
678f558f178c6d644b0ab198efe3a29af7efa774
[]
no_license
tombcato/Zhihu_Demo
45f2e6a8abab73cd91b0297e1246b856b96d7875
689c4ef55e480c84d636bd042e24627fab7fa402
refs/heads/master
2016-08-04T05:52:03.602372
2015-03-03T03:25:59
2015-03-03T03:25:59
30,250,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
/******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * 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.yx.zhihu.view.photoview.gestures; public interface OnGestureListener { public void onDrag(float dx, float dy); public void onFling(float startX, float startY, float velocityX, float velocityY); public void onScale(float scaleFactor, float focusX, float focusY); }
5c84fe61b0bfdb923ab2160d6cbf5c2820628512
368dffdd63f04ca40bce41029e3b7f2c5ecee59a
/src/main/java/drm/demo/MonitorServlet.java
abc5f9601c93bcbafe04a9e3ebbee6b78f4a4e78
[]
no_license
eliasdc/taskworker-examples
ba713f4c6727a0218f14af45823d03a40d260deb
3002a8e7878eae6233cf7764c7ccc6acbc2a2ee5
refs/heads/master
2021-01-18T07:51:41.795843
2013-10-05T11:59:44
2013-10-05T11:59:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,739
java
/** * * Copyright 2013 KU Leuven Research and Development - iMinds - Distrinet * * 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. * * Administrative Contact: [email protected] * Technical Contact: [email protected] */ package drm.demo; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import drm.taskworker.tasks.WorkflowInstance; /** * Servlet implementation class Workflow */ @WebServlet("/monitor") public class MonitorServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public MonitorServlet() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("/monitor.jsp").forward(request, response); } }
c4b1ac0b97f78e3cbefe1701855d721aac9c1aa7
505946e0b6ccd2320d9e597ceef26d193354a72f
/generic-incremental-classifier/src/logic/LabelPlaceHandler.java
694fe552fbf0b173ed2deedb27412fced88af455
[]
no_license
Arkidillo/generic-incremental-classifier
5c238ff62e0e2ab74239da9809a77011cfb705bf
7f4129ed2ad0a2431cb8d83f24f64fcd63c25454
refs/heads/master
2018-12-18T09:39:54.561381
2018-10-03T16:11:43
2018-10-03T16:11:43
119,290,232
2
1
null
null
null
null
UTF-8
Java
false
false
4,022
java
package logic; import gui.Label; import main.GenericIncrementalClassifier; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.image.BufferedImage; public class LabelPlaceHandler implements MouseListener { // LEFT and NOT_CREATING are the same because left is the first point you place private static final byte NOT_CREATING = 0; private static final byte LEFT = 0; private static final byte RIGHT = 1; private static final byte TOP = 2; private static final byte BOTTOM = 3; private byte state = 0; private Label newLabel; // the last label they have clicked on, if any public static Label selectedLabel; private GUIHandler gui; // we need the insets to correct for JFrame decoration private Insets insets; private JLabel textBox; public LabelPlaceHandler(GUIHandler gui, Insets insets) { state = NOT_CREATING; newLabel = new Label(); this.gui = gui; this.insets = insets; showInstructions(); } public void showInstructions() { // create new frame and add text box to it. JFrame instructionFrame = new JFrame(); instructionFrame.setSize(450, 75); instructionFrame.setLayout(new FlowLayout()); instructionFrame.setLocation(0, GenericIncrementalClassifier.WINDOW_HEIGHT); JLabel text = new JLabel("Click left most point", JLabel.CENTER); text.setFont(new Font(text.getFont().getName(), text.getFont().getStyle(), 20)); textBox = text; instructionFrame.getContentPane().add(text); instructionFrame.setVisible(true); } @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) { // adjust x,y b/c of insets, and make sure they are not out of bounds int adjX = correctOutOfBoundsX(e.getX() - insets.left); int adjY = correctOutOfBoundsY(e.getY() - insets.top); // if not already creating, check if this click is selecting a label if (state == NOT_CREATING) { gui.callRepaint(); selectedLabel = gui.getLabelOnClick(new Point(adjX, adjY)); // (if so, don't start creating a new one) if (selectedLabel != null) return; } // set the corresponding value based on where we are in the state machine switch (state){ case LEFT: newLabel.setLeft(adjX); textBox.setText("Click right most point"); break; case RIGHT: newLabel.setRight(adjX); textBox.setText("Click top most point"); break; case TOP: newLabel.setTop(adjY); textBox.setText("Click bottom most point"); break; case BOTTOM: newLabel.setBottom(adjY); textBox.setText("DONE. Click left to start new"); // add the new label to the pane to display gui.addLabel(newLabel); // this will be the selected label by default selectedLabel = newLabel; // create a new label for the next one newLabel = new Label(); break; } state = (byte)((state + 1) % 4); } private int correctOutOfBoundsX(int x) { BufferedImage currImage = gui.getImagePane().getImage(); // We don't have to worry about X being < 0 because they can't physically click there return Math.min(x, currImage.getWidth()); } private int correctOutOfBoundsY(int y) { BufferedImage currImage = gui.getImagePane().getImage(); return Math.min(y, currImage.getHeight()); } @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} }
0435d404d231faa2ed6ab704ca08a1174cba4f65
6237feaee63bb4c4831d3c663b49bb4ab28207b2
/CryptoNewsAndroid/app/src/main/java/com/princess/android/cryptonews/settings/Activity/SettingsActivity.java
66685dffba8f82d52ea393852003f59d59b2ddaf
[ "Apache-2.0" ]
permissive
elcruci/CryptoNews
6671500ae1185b4a33167d933edaaacaafa8ede1
b274419a02ce7963a30b47ba9e2b9fd442335e47
refs/heads/master
2021-09-15T15:15:10.075759
2018-05-09T14:36:33
2018-05-09T14:36:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,161
java
package com.princess.android.cryptonews.settings.Activity; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import com.princess.android.cryptonews.R; public class SettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_settings); setupActionBar(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { onBackPressed(); } return super.onOptionsItemSelected(item); } }
ab49b0dd42eeccc570f66b3a665ed711942dbbfc
f9ffdd4c0976080bfe5d3019fc7dea497ba6c7bf
/src/_13_String/UsingStringBuilder.java
87807838b8466b1e36087a1e39d43b356f3dc088
[]
no_license
GrapeLemon/Think-In-Java
67e389acee294a1404d8c84bb4726c0cd17b8371
f8755727194e9b8651f33f7910f70304fc7d9344
refs/heads/master
2020-07-07T12:25:25.367675
2019-09-08T15:05:03
2019-09-08T15:05:03
203,346,773
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package _13_String; import java.util.Random; public class UsingStringBuilder { public static Random rand = new Random(47); @Override public String toString() { StringBuilder result = new StringBuilder("{"); for (int i = 0; i < 25; i++) { result.append(rand.nextInt(100)); result.append(", "); } //最后一个字符串后面不需要带分隔符,特殊处理一下 result.delete(result.length() - 2, result.length()); result.append("}"); return result.toString(); } public static void main(String[] args) { UsingStringBuilder usb = new UsingStringBuilder(); System.out.println(usb); String a = "lwx"; String c = "22"; StringBuilder builder = new StringBuilder(); builder.append(a + ":" + c); } }
7e07fd55e38b533eea701e8ecc9d191420846115
ef3a61df294e446862ddfe592a08bc73edf08d4b
/app/src/main/java/demo/acube/application/healthcare/activity/doctor/models/officeHours/Thursday.java
3c4ecfd8c2e215cf5d5a89f0f120e89a0c02dbc6
[]
no_license
annsrahim/Symphony
6aaff970db9b0c10f87bd6e9cc14c0462aa9e2e2
6cf32f584327bbe7b1732d8af4417893f0d11346
refs/heads/master
2021-05-02T02:54:44.830007
2018-02-09T09:58:27
2018-02-09T09:58:27
120,888,790
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package demo.acube.application.healthcare.activity.doctor.models.officeHours; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Thursday { @SerializedName("start") @Expose private String start; @SerializedName("end") @Expose private String end; @SerializedName("breaks") @Expose private List<Object> breaks = null; public String getStart() { return start; } public void setStart(String start) { this.start = start; } public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public List<Object> getBreaks() { return breaks; } public void setBreaks(List<Object> breaks) { this.breaks = breaks; } }
3031c39d4da1986590bf7c9ab8b4b4467f2f6679
101973ec39be5f791f2c436aafc50ce6304216a6
/app/src/main/java/com/pan/coordinatorlayoutdemo/CollapsingToolbarDemo.java
28ebcffc004d465bade53308d6137d2b67e5e34b
[]
no_license
jakkypan/CoordinatorLayoutDemo
a4a592bf2f8a350c27e7d060715746a51b8539aa
c2b4dd010d61f9d86aee55033123a6a6d3047450
refs/heads/master
2020-03-19T11:24:01.888511
2018-06-08T07:44:20
2018-06-08T07:44:20
136,453,256
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.pan.coordinatorlayoutdemo; import android.os.Bundle; import android.support.annotation.Nullable; /** * Created by panda on 2018/6/7 **/ public class CollapsingToolbarDemo extends ToolBarBaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nine); } }
8a9258484a37d67c1323f6a69a7f167b6c99d721
b3a4698d05379fbb82cb44e919f9fc1cd76c2121
/tw-tasks-executor/src/main/java/com/transferwise/tasks/impl/tokafka/ToKafkaTaskHandlerConfiguration.java
cfc5eeef7bf1a308af95b421f11453067eabb076
[ "Apache-2.0" ]
permissive
465499642/tw-tasks-executor
d8974f874eeb9d96ae4e083830ba329d6c54e402
12cac07f6e2d93836841252f10f9efd403775966
refs/heads/master
2022-04-27T00:05:04.393983
2020-04-26T09:56:40
2020-04-26T09:56:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,407
java
package com.transferwise.tasks.impl.tokafka; import com.fasterxml.jackson.databind.ObjectMapper; import com.transferwise.common.baseutils.ExceptionUtils; import com.transferwise.tasks.config.TwTasksKafkaConfiguration; import com.transferwise.tasks.handler.ExponentialTaskRetryPolicy; import com.transferwise.tasks.handler.SimpleTaskConcurrencyPolicy; import com.transferwise.tasks.handler.SimpleTaskProcessingPolicy; import com.transferwise.tasks.handler.TaskHandlerAdapter; import com.transferwise.tasks.handler.interfaces.IAsyncTaskProcessor; import com.transferwise.tasks.handler.interfaces.ITaskHandler; import com.transferwise.tasks.helpers.IMeterHelper; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; import java.time.Duration; import java.util.concurrent.atomic.AtomicInteger; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Slf4j @Configuration public class ToKafkaTaskHandlerConfiguration { @Autowired(required = false) private MeterRegistry meterRegistry; @Bean public ITaskHandler toKafkaTaskHandler(TwTasksKafkaConfiguration kafkaConfiguration, ObjectMapper objectMapper, ToKafkaProperties toKafkaProperties) { return new TaskHandlerAdapter( (task) -> ToKafkaTaskType.VALUE.equals(task.getType()), (IAsyncTaskProcessor) (taskForProcessing, doneCallback, errorCallback) -> ExceptionUtils.doUnchecked(() -> { ToKafkaMessages toKafkaMessages = objectMapper.readValue(taskForProcessing.getData(), ToKafkaMessages.class); AtomicInteger doneCnt = new AtomicInteger(toKafkaMessages.getMessages().size()); String topic = toKafkaMessages.getTopic(); for (ToKafkaMessages.Message message : toKafkaMessages.getMessages()) { kafkaConfiguration.getKafkaTemplate() .send(topic, message.getKey(), message.getMessage()) .addCallback( result -> { log.debug("Sent and acked Kafka message to topic '{}'.", topic); registerSentMessage(topic); if (doneCnt.decrementAndGet() == 0) { doneCallback.run(); } }, exception -> { log.error("Sending message to Kafka topic '" + topic + "'.", exception); errorCallback.accept(exception); }); } }) ).setConcurrencyPolicy(new SimpleTaskConcurrencyPolicy(toKafkaProperties.getMaxConcurrency())).setProcessingPolicy( new SimpleTaskProcessingPolicy().setMaxProcessingDuration(Duration.ofMillis(toKafkaProperties.getMaxProcessingDurationMs()))).setRetryPolicy( new ExponentialTaskRetryPolicy().setDelay(Duration.ofMillis(toKafkaProperties.getRetryDelayMs())) .setMultiplier(toKafkaProperties.getRetryExponent()) .setMaxCount(toKafkaProperties.getRetryMaxCount()).setMaxDelay(Duration.ofMillis(toKafkaProperties.getRetryMaxDelayMs()))); } private void registerSentMessage(String topic) { if (meterRegistry != null) { meterRegistry.counter(IMeterHelper.METRIC_PREFIX + "toKafka.sentMessagesCount", Tags.of("topic", topic)); } } }
dd7f004b9cb1640506c0bc9f1b71ce86ab5e2897
6c1718de9e39d0bea94bc20a8c7e86ad7429ff3b
/FlipProductServiceModule/src/main/java/com/flip/entity/AuditModel.java
178ed04dd8427119177655fbacb8c72414122f7c
[]
no_license
pankamit/flip
e3341393606b42971a338a32098190158e82296d
6e34bbd51481e7fc6a2dd3c3a7799c2ceec64f48
refs/heads/master
2022-12-23T15:34:17.649966
2020-03-25T05:38:55
2020-03-25T05:38:55
242,803,731
0
1
null
2022-12-15T23:25:11
2020-02-24T17:52:39
Java
UTF-8
Java
false
false
1,781
java
package com.flip.entity; import java.io.IOException; import java.io.OutputStream; import java.util.Date; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.springframework.core.serializer.Serializer; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @MappedSuperclass @EntityListeners(AuditingEntityListener.class) @JsonIgnoreProperties( value = {"createdAt", "updatedAt","createdBy","updatedBy"}, allowGetters = true ) @Data public abstract class AuditModel implements Serializer{ @Temporal(TemporalType.TIMESTAMP) // @Column(nullable = false, updatable = false) @CreatedDate private Date createdAt; @Temporal(TemporalType.TIMESTAMP) // @Column(nullable = false) @LastModifiedDate private Date updatedAt; // @Column(nullable = false, updatable = false) private String createdBy; //@Column(nullable = false) private String updatedBy; // public Date getCreatedAt() { // return createdAt; // } // // public void setCreatedAt(Date createdAt) { // this.createdAt = createdAt; // } // // public Date getUpdatedAt() { // return updatedAt; // } // // public void setUpdatedAt(Date updatedAt) { // this.updatedAt = updatedAt; // } @Override public void serialize(Object object, OutputStream outputStream) throws IOException { // TODO Auto-generated method stub } }
c9b93a6b6d6968803db6cdb2f4fa3d010921f4bd
7d2b0997bba1ac7a7915e77adf56780a1351df1a
/src/main/java/com/base/utils/Base.java
3072daf24067bedf5e1158da87b602054a967cac
[]
no_license
AdnanMostafa/OSA09AgileFramework
d77e686e0206fdb22402b8e636c27f0b130623e3
ec9784ecb6f4b67f39376ea191d50eba4e75f808
refs/heads/master
2023-06-08T08:22:59.280297
2021-06-26T15:04:00
2021-06-26T15:04:00
380,398,191
0
0
null
2021-06-27T01:28:14
2021-06-26T02:40:18
Java
UTF-8
Java
false
false
48
java
package com.base.utils; public class Base { }
bc96b8a494daa9d096132b4b7415e3ff72a85892
6212cb5753ecc4b88b91ca94c70e2d6352c3932d
/DB/GetETF.java
5e3c12f2079dd97f97d2138e1f9a0f86f6e52310
[]
no_license
earoc/TickDataStreaming
ef18f6c826897b3686a19f96570d0a37d0ba3a47
2f03c87814783ecdca033e7c9a0d26838efb68ec
refs/heads/master
2020-12-30T23:33:14.260397
2013-07-15T13:00:28
2013-07-15T13:00:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package com.procedures; import org.voltdb.SQLStmt; import org.voltdb.VoltProcedure; import org.voltdb.VoltTable; import org.voltdb.VoltProcedure.VoltAbortException; public class GetETF extends VoltProcedure { public final SQLStmt getEtf = new SQLStmt( "select etf_ticker from basket group by etf_ticker ORDER BY etf_ticker ASC;" ); public VoltTable[] run() throws VoltAbortException { // Add a SQL statement to the current execution queue voltQueueSQL(getEtf); // Run all queued queries. // Passing true parameter since this is the last voltExecuteSQL for this procedure. return voltExecuteSQL(true); } }
70634a1caf1d848f5164513dc6eb8258a1fe8d98
29b81ac5a8d08ca977221307d0513ceb3684d1ab
/EmployeeEntities/src/com/v2soft/training/entities/EmployeeAddressHome.java
0acc704452925f6bbe1d0a22ff3cbdd4782a58c9
[]
no_license
ktrivedi95/V2Soft_Spring_Training
9d98368338d1e7ec109f713ad151fa74020b7daf
d53f6de2a7ab11292ea69164d8b8b602888bf289
refs/heads/master
2022-12-22T02:57:17.533350
2019-10-29T21:53:30
2019-10-29T21:53:30
214,223,196
0
0
null
2022-12-16T10:00:38
2019-10-10T15:45:26
Java
UTF-8
Java
false
false
1,890
java
package com.v2soft.training.entities; // Generated Oct 16, 2019 11:18:55 AM by Hibernate Tools 5.1.10.Final import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Home object for domain model class EmployeeAddress. * @see com.v2soft.training.entities.EmployeeAddress * @author Hibernate Tools */ @Stateless public class EmployeeAddressHome { private static final Log log = LogFactory.getLog(EmployeeAddressHome.class); @PersistenceContext private EntityManager entityManager; public void persist(EmployeeAddress transientInstance) { log.debug("persisting EmployeeAddress instance"); try { entityManager.persist(transientInstance); log.debug("persist successful"); } catch (RuntimeException re) { log.error("persist failed", re); throw re; } } public void remove(EmployeeAddress persistentInstance) { log.debug("removing EmployeeAddress instance"); try { entityManager.remove(persistentInstance); log.debug("remove successful"); } catch (RuntimeException re) { log.error("remove failed", re); throw re; } } public EmployeeAddress merge(EmployeeAddress detachedInstance) { log.debug("merging EmployeeAddress instance"); try { EmployeeAddress result = entityManager.merge(detachedInstance); log.debug("merge successful"); return result; } catch (RuntimeException re) { log.error("merge failed", re); throw re; } } public EmployeeAddress findById(EmployeeAddressId id) { log.debug("getting EmployeeAddress instance with id: " + id); try { EmployeeAddress instance = entityManager.find(EmployeeAddress.class, id); log.debug("get successful"); return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } } }
c6339b3ad0206afaff4e5ffbc2390c0d5f5a5779
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/a2/j/d/c/f4.java
cd1d18ac3e3fa2bf78ac29a49bff8cd2a4f528df
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package a2.j.d.c; import androidx.appcompat.app.AppCompatDelegateImpl; import java.util.Collection; import java.util.Iterator; import org.checkerframework.checker.nullness.compatqual.NullableDecl; public class f4<V> extends h4<Collection<V>> { private static final long serialVersionUID = 0; public class a extends b5<Collection<V>, Collection<V>> { public a(Iterator it) { super(it); } @Override // a2.j.d.c.b5 public Object a(Object obj) { return AppCompatDelegateImpl.i.d((Collection) obj, f4.this.b); } } public f4(Collection<Collection<V>> collection, @NullableDecl Object obj) { super(collection, obj, null); } @Override // a2.j.d.c.h4, java.util.Collection, java.lang.Iterable, java.util.Set public Iterator<Collection<V>> iterator() { return new a(super.iterator()); } }
7d0f5d2e7a1f37386ee464e46c0fe5f50dc97df9
03b8882bd195bf52f00769feb10a08be8563e3c6
/Window.java
ab495a8dc0ecdbe49f23ff748c360b4b3647dbc5
[]
no_license
SeveralFaun/TaylorTitans
205d39ddd53cd41c1155cebf1390fc204aa2908e
6f36ce81e41279977bd50c5f1cf75761538580c2
refs/heads/main
2023-08-16T02:21:48.746194
2021-10-02T23:50:13
2021-10-02T23:50:13
412,935,187
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
import java.awt.Canvas; import javax.swing.JFrame; public class Window extends Canvas{ public Window(int width, int height, String title, GameGUI game) { JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(width, height); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.add(game); frame.setVisible(true); game.start(); } }
d7e422ad6a18dbcf0a5154c49642bedc7e11c010
74efcaf6e9246f5c93f917e1031d03158f0f0f47
/src/main/java/com/atguigu/util/TestJson2.java
fa3aa89796b217cc2e6b178a6e4cf8b48e1313c9
[]
no_license
zhangzaixuan/sale_manager
3785a199d327a205f8ef0871e9db0aebee0433cb
d72f31763495b95819edf6c30d504520d2b01ba8
refs/heads/master
2021-05-14T10:13:16.103465
2018-01-05T06:03:54
2018-01-05T06:03:54
116,348,008
0
0
null
null
null
null
UTF-8
Java
false
false
946
java
package com.atguigu.util; import java.util.ArrayList; import java.util.List; import com.atguigu.bean.T_MALL_SHOPPINGCAR; import net.sf.json.JSONArray; public class TestJson2 { public static void main(String[] args) { // 1 // 2 // 3 // 4 List<T_MALL_SHOPPINGCAR> list_cart = new ArrayList<T_MALL_SHOPPINGCAR>(); for (int i = 0; i < 5; i++) { T_MALL_SHOPPINGCAR cart = new T_MALL_SHOPPINGCAR(); cart.setSku_mch("中文" + i); cart.setSku_jg(i); list_cart.add(cart); } // 集合转json JSONArray jsonArray = JSONArray.fromObject(list_cart); String string = jsonArray.toString(); System.out.println(string); // json转集合 JSONArray jsonArray2 = JSONArray.fromObject(string); List<T_MALL_SHOPPINGCAR> list_cart2 = (List<T_MALL_SHOPPINGCAR>) JSONArray.toCollection(jsonArray2, T_MALL_SHOPPINGCAR.class); System.out.println(list_cart2); } }
2e8b2bc56d186e93bc0927dd6cc2fba4bc3e2a0f
86505462601eae6007bef6c9f0f4eeb9fcdd1e7b
/bin/modules/b2b-accelerator-addons/b2bpunchout/src/org/cxml/OrganizationID.java
58fcb3486f71a618a51fe35e7e7a55493c8ea235
[]
no_license
jp-developer0/hybrisTrail
82165c5b91352332a3d471b3414faee47bdb6cee
a0208ffee7fee5b7f83dd982e372276492ae83d4
refs/heads/master
2020-12-03T19:53:58.652431
2020-01-02T18:02:34
2020-01-02T18:02:34
231,430,332
0
4
null
2020-08-05T22:46:23
2020-01-02T17:39:15
null
UTF-8
Java
false
false
1,839
java
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ // // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.05.12 at 07:19:30 PM EDT // package org.cxml; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "credential" }) @XmlRootElement(name = "OrganizationID") public class OrganizationID { @XmlElement(name = "Credential", required = true) protected List<Credential> credential; /** * Gets the value of the credential property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the credential property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCredential().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Credential } * * */ public List<Credential> getCredential() { if (credential == null) { credential = new ArrayList<Credential>(); } return this.credential; } }
ada6296dbae57c0de6e319c96fc4b15728b5bb6c
660cafe8c699346186ed600113303d62c862afc9
/src/main/java/com/agency04/sbss/pizza/dto/DeliveryDTO.java
7ef25862ce3a65cbf35429e1d452ce5fbdb74bb2
[]
no_license
lrukavina/pizzaDeliveryApp
80461b2ae01b5205a75ef41a3c6811e1c434dc27
6d39c045c98a955ab1880d015132ace1ee658e1f
refs/heads/main
2023-07-08T03:30:32.655422
2021-08-17T17:58:17
2021-08-17T17:58:17
387,501,813
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.agency04.sbss.pizza.dto; import java.util.List; public class DeliveryDTO { private CustomerDTO customerDTO; private List<PizzaOrderDTO> pizzaOrderDTOS; public DeliveryDTO(CustomerDTO customerDTO, List<PizzaOrderDTO> pizzaOrderDTOS) { this.customerDTO = customerDTO; this.pizzaOrderDTOS = pizzaOrderDTOS; } public CustomerDTO getCustomerDTO() { return customerDTO; } public void setCustomerDTO(CustomerDTO customerDTO) { this.customerDTO = customerDTO; } public List<PizzaOrderDTO> getPizzaOrderDTOS() { return pizzaOrderDTOS; } public void setPizzaOrderDTOS(List<PizzaOrderDTO> pizzaOrderDTOS) { this.pizzaOrderDTOS = pizzaOrderDTOS; } }
9174761484fc6b0a88acdefd4fbddfee7c693ac6
1927bbe0c4ad1c54cb523cd66a3cca7164fdcad6
/core/src/androidTest/java/com/dogapi/core/ExampleInstrumentedTest.java
d9511070c163cfe90b3fefd6d5f7080097af7d66
[]
no_license
AnaGV/MVP_Dogs_Gallery
29f3bb9cda8f12587415f90c9d663991de95fb93
6b99844ab5a3d46d7fe31d999dbbb7d2815ec7fe
refs/heads/master
2021-05-01T08:50:29.449536
2018-02-11T23:52:17
2018-02-11T23:52:17
121,176,674
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.dogapi.core; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.dogapi.core.test", appContext.getPackageName()); } }
1aef274443b62f991f545843566d1bbb6ac9bbae
dd9b8cce53f74382f62e8b808658aa8054823710
/app/src/main/java/com/demo/amber/com/testdemo/FastBlur.java
ce1be3c419cc8ce72abb7982adf422b8bdc09007
[]
no_license
MasterWangBo/Android-BlurView-Master
fa69831f1e5f5ea9d5a10fcc19074d4c117d512e
85a59da6140af5bc90b3ffee698a236a9f29435a
refs/heads/master
2020-11-29T12:10:10.487565
2017-04-10T05:41:53
2017-04-10T05:41:53
87,494,984
17
1
null
null
null
null
UTF-8
Java
false
false
6,006
java
package com.demo.amber.com.testdemo; import android.graphics.Bitmap; /** * 快速模糊化工具 */ public class FastBlur { public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) { Bitmap bitmap; if (canReuseInBitmap) { bitmap = sentBitmap; } else { bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); } if (radius < 1) { return (null); } int w = bitmap.getWidth(); int h = bitmap.getHeight(); int[] pix = new int[w * h]; bitmap.getPixels(pix, 0, w, 0, 0, w, h); int wm = w - 1; int hm = h - 1; int wh = w * h; int div = radius + radius + 1; int r[] = new int[wh]; int g[] = new int[wh]; int b[] = new int[wh]; int rsum, gsum, bsum, x, y, i, p, yp, yi, yw; int vmin[] = new int[Math.max(w, h)]; int divsum = (div + 1) >> 1; divsum *= divsum; int dv[] = new int[256 * divsum]; for (i = 0; i < 256 * divsum; i++) { dv[i] = (i / divsum); } yw = yi = 0; int[][] stack = new int[div][3]; int stackpointer; int stackstart; int[] sir; int rbs; int r1 = radius + 1; int routsum, goutsum, boutsum; int rinsum, ginsum, binsum; for (y = 0; y < h; y++) { rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; for (i = -radius; i <= radius; i++) { p = pix[yi + Math.min(wm, Math.max(i, 0))]; sir = stack[i + radius]; sir[0] = (p & 0xff0000) >> 16; sir[1] = (p & 0x00ff00) >> 8; sir[2] = (p & 0x0000ff); rbs = r1 - Math.abs(i); rsum += sir[0] * rbs; gsum += sir[1] * rbs; bsum += sir[2] * rbs; if (i > 0) { rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; } else { routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; } } stackpointer = radius; for (x = 0; x < w; x++) { r[yi] = dv[rsum]; g[yi] = dv[gsum]; b[yi] = dv[bsum]; rsum -= routsum; gsum -= goutsum; bsum -= boutsum; stackstart = stackpointer - radius + div; sir = stack[stackstart % div]; routsum -= sir[0]; goutsum -= sir[1]; boutsum -= sir[2]; if (y == 0) { vmin[x] = Math.min(x + radius + 1, wm); } p = pix[yw + vmin[x]]; sir[0] = (p & 0xff0000) >> 16; sir[1] = (p & 0x00ff00) >> 8; sir[2] = (p & 0x0000ff); rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; rsum += rinsum; gsum += ginsum; bsum += binsum; stackpointer = (stackpointer + 1) % div; sir = stack[(stackpointer) % div]; routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; rinsum -= sir[0]; ginsum -= sir[1]; binsum -= sir[2]; yi++; } yw += w; } for (x = 0; x < w; x++) { rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; yp = -radius * w; for (i = -radius; i <= radius; i++) { yi = Math.max(0, yp) + x; sir = stack[i + radius]; sir[0] = r[yi]; sir[1] = g[yi]; sir[2] = b[yi]; rbs = r1 - Math.abs(i); rsum += r[yi] * rbs; gsum += g[yi] * rbs; bsum += b[yi] * rbs; if (i > 0) { rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; } else { routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; } if (i < hm) { yp += w; } } yi = x; stackpointer = radius; for (y = 0; y < h; y++) { // Preserve alpha channel: ( 0xff000000 & pix[yi] ) pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum]; rsum -= routsum; gsum -= goutsum; bsum -= boutsum; stackstart = stackpointer - radius + div; sir = stack[stackstart % div]; routsum -= sir[0]; goutsum -= sir[1]; boutsum -= sir[2]; if (x == 0) { vmin[y] = Math.min(y + r1, hm) * w; } p = x + vmin[y]; sir[0] = r[p]; sir[1] = g[p]; sir[2] = b[p]; rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; rsum += rinsum; gsum += ginsum; bsum += binsum; stackpointer = (stackpointer + 1) % div; sir = stack[stackpointer]; routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; rinsum -= sir[0]; ginsum -= sir[1]; binsum -= sir[2]; yi += w; } } bitmap.setPixels(pix, 0, w, 0, 0, w, h); return (bitmap); } }
3c8bb1e16dbcbd79b50b0846c83ceb87cd4f81b4
43c0da5f294a3cb7d6c4483524e266f87f335c9f
/src/jp/tokyo/shibuya/pinco/util/ImageCache.java
b2637d285c65619582f2cc77d05131ffd2035c78
[]
no_license
czhiraga/Pinco_Beta
ae41cc384284882fec589b9b69fa7b0be7f2b78a
04d3d1e7e7e896050be0b998900a67d4add5db46
refs/heads/master
2016-08-08T15:54:23.943029
2014-07-12T09:17:29
2014-07-12T09:17:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package jp.tokyo.shibuya.pinco.util; import java.util.HashMap; import android.graphics.Bitmap; /** * imageキャッシュ作成 * * @author obinata_hiroaki_gn * */ public class ImageCache { private static HashMap<String, Bitmap> cache = new HashMap<String, Bitmap>(); // キャッシュより画像データを取得 public static Bitmap getImage(String key) { if (cache.containsKey(key)) { return cache.get(key); } // 存在しない場合はNULLを返す return null; } // キャッシュに画像データを設定 public static void setImage(String key, Bitmap image) { cache.put(key, image); } // キャッシュの初期化(リスト選択終了時に呼び出し、キャッシュで使用していたメモリを解放する) public static void clearCache() { cache = null; cache = new HashMap<String, Bitmap>(); } }
0387ff9d71fea93a158a93a1ce675947dcdc76d5
2ed76e81af4f14846cb4d6b977658b828bfd736e
/mybatis/src/main/java/com/chinatvpay/type/hander/MyTypeHandler.java
5f2376f117096b7da5d6ef39ada66de95c265156
[]
no_license
dignjun/WorkSet
2d8be8e9f59d91cb622257b18e8815e71e9c437f
fb813807c649283aea758d3eb73b91398ae3517e
refs/heads/master
2021-07-08T18:18:22.431430
2019-03-11T02:02:10
2019-03-11T02:02:10
146,717,017
1
0
null
null
null
null
UTF-8
Java
false
false
1,844
java
package com.chinatvpay.type.hander; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedJdbcTypes; /** * 自定义的类型处理器 * 使用这个的类型处理器将会覆盖已经存在的处理 Java 的 String 类型属性和 VARCHAR 参数及结果的类型处理器。 * 要注意 MyBatis 不会窥探数据库元信息来决定使用哪种类型,所以你必须在参数和结果映射中指明那是 VARCHAR 类型的字段, 以使其能够绑定到正确的类型处理器上。 * 这是因为:MyBatis 直到语句被执行才清楚数据类型。 * * @author DINGJUN * */ @MappedJdbcTypes(JdbcType.VARCHAR)//指定与其关联的jdbc类型列表配置文件中指定数据类型也是可以的,同时指定,注解方式将被忽略 //@MappedTypes(value=String.class)//指定与其关联的java类型列表,如果同时在配置文件中的typeHandler元素的javaType属性上也指定,此时注解是不起作用的。 public class MyTypeHandler extends BaseTypeHandler<String> { @Override public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { ps.setString(i, parameter); } @Override public String getNullableResult(ResultSet rs, String columnName) throws SQLException { return rs.getString(columnName); } @Override public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { return rs.getString(columnIndex); } @Override public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { return cs.getString(columnIndex); } }
bd2cee25f41f371738fbc7a1b2db08e5f485eb69
45bff82afd41a8a5fa05c1d034fff69f4834c732
/src/ru/pasharik/chapter_1_arrays_strings/question_1_7/RotateMatrix90.java
6bd9222a02f104f29ec70e5ce6f7dd999e2bb0c9
[]
no_license
pasharik/code_interview
a6511ef946ba5edd2f13e8f3b5b7683e548ba37b
041ed33ae9ee88d99b6ed1b586dba63440a2992c
refs/heads/master
2020-04-07T17:40:50.660152
2019-08-20T16:08:25
2019-08-20T16:08:25
158,578,975
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package ru.pasharik.chapter_1_arrays_strings.question_1_7; import static ru.pasharik.chapter_1_arrays_strings.question_1_7.MatrixUtils.printMatrix; public class RotateMatrix90 { private static int[][] rotate90(int[][] a) { int n = a.length - 1; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { //Top quarter: join of two triangles if ((i <= j) //Top-right triangle && ((n - j) > i)) { //Top-left triangle int buf = a[i][j]; a[i][j] = a[n - j][i]; //Left -> Top a[n - j][i] = a[n - i][n - j]; //Bottom -> Left a[n - i][n - j] = a[j][n - i]; //Right -> Bottom a[j][n - i] = buf; //Top -> Right } } } return a; } public static void main(String[] args) { int[][] arr = new int[][] { {1,0,1,1,1,1}, {1,0,1,1,1,1}, {1,0,1,1,1,0}, {1,0,1,1,1,1}, {1,0,1,1,1,1}, {1,0,1,1,1,1} }; printMatrix(arr); System.out.println("Rotating..."); printMatrix(rotate90(arr)); } }
daf26d03f202dc3eaba82e4300a02e87cf57344c
18aa88f6e72c6f78b6fe51dbfe821253b4b1ea46
/hb-06-many-to-many/src/com/aku/hibernate/demo/GetCourseForStudent.java
016e0e6982f4104791b21db5a374d4b63fbb0f36
[]
no_license
Akki19hzb/hibernate
8763985e50176a90abe580279f03a1b57b8a8d71
40904a12879ebfa89597914aea62e29bea431a5b
refs/heads/main
2023-07-20T19:56:12.801885
2021-09-05T06:03:48
2021-09-05T06:03:48
395,232,587
0
0
null
null
null
null
UTF-8
Java
false
false
1,283
java
package com.aku.hibernate.demo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.aku.jdbc.Course; import com.aku.jdbc.Instructor; import com.aku.jdbc.InstructorDetail; import com.aku.jdbc.Review; import com.aku.jdbc.Student; public class GetCourseForStudent { public static void main(String[] args) { //Create Session Factory SessionFactory factory = new Configuration() .configure() .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .addAnnotatedClass(Course.class) .addAnnotatedClass(Review.class) .addAnnotatedClass(Student.class) .buildSessionFactory(); //Create Session Session session = factory.getCurrentSession(); try { session.beginTransaction(); Student tempStudent = session.get(Student.class, 1); System.out.println("Loaded Student: "+ tempStudent); System.out.println("Courses: "+tempStudent.getCourses()); //Commit Transaction session.getTransaction().commit(); System.out.println("DONE!!!"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { session.close(); factory.close(); } } }
7741b4c0ff06b0b13738f3511970a5d4ea425d55
250191e2703c608a10a8896dd927bca5b2e8007c
/src/com/slp/service/SiteInfoService.java
47481cdd641444a73512fd69da650d229fb30021
[]
no_license
zhengxiansheng-github/slp
e8b6ee978df77473461d73328983c7a1c646dd3a
6811a0a8d986d393a4202059deee6a04115f1f3c
refs/heads/master
2020-03-27T10:06:31.356571
2018-08-28T05:09:01
2018-08-28T05:09:01
146,395,678
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package com.slp.service; import java.util.List; import com.slp.bean.SiteInfo; public interface SiteInfoService { /** * 获取站点信息的总条数 * @return int : 总条数 */ public int totalCount(); /** * 站点信息列表并实现分页 * @param start 开始条数 * @param pageSize 每页显示条数 * @return List 集合:SiteInfo */ public List<SiteInfo> siteInfoList(int start, int pageSize); /** * 站点信息模糊查询 * @param siteInfo * @param start 开始条数 * @param pageSize 每页显示条数 * @return List 集合:SiteInfo */ public List<SiteInfo> search(SiteInfo siteInfo, int start, int pageSize); /** * 模糊查询 获取站点信息的总条数 * @param siteInfo * @return int : 总条数 */ public int totalCount(SiteInfo siteInfo); /** * 添加站点信息 * @param siteInfo 站点对象 */ public void addSiteInfo(SiteInfo siteInfo); /** * 站点信息修改前查询id * @param siteInfo对象 * @return SiteInfo对象 */ public SiteInfo findSiteInfoById(SiteInfo siteInfo); /** * 站点信息修改 * @param siteInfo对象 */ public void update(SiteInfo siteInfo); /** * 站点信息修改 * @param siteInfo对象 */ public void deleteSiteInfo(SiteInfo siteInfo); /** * 根据站点name查询部分站点对象 * @param names * @return List<SiteInfo> */ public List<SiteInfo> findSiteInfo(String [] names); }
350e07bfae91fea0cdbace156c95adc17996b1e8
97ed73baa6ec46e254ca484e2d280aa67f52c38b
/src/main/java/com/github/amsabots/aspect/Loggable.java
a30f645e916fc2e15c17e7c0e3e56e526f0a8a0d
[]
no_license
amsabots/Aspect
fd6c4c69c4767d98eb608f439582ea79b19daf7a
7210e93871c4ec335faac0732a903a562b6bd3ff
refs/heads/master
2023-07-26T22:02:01.027465
2021-08-30T19:58:33
2021-08-30T19:58:33
401,399,191
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.github.amsabots.aspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Loggable { }
1b94a5748f0896400bc36aa6ef169e475c8329cf
3fe8e5db53dc425afdb24303f2f6926cade14f04
/user/ezt_hall/src/main/java/com/eztcn/user/eztcn/activity/mine/StatementActivity.java
bfc87acb929125e670cb924c95262b3456a161a2
[]
no_license
llorch19/ezt_user_code
087a9474a301d8d8fef7bd1172d6c836373c2faf
ee82f4bfbbd14c81976be1275dcd4fc49f6b1753
refs/heads/master
2021-06-01T09:40:19.437831
2016-08-10T02:33:35
2016-08-10T02:33:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,388
java
package com.eztcn.user.eztcn.activity.mine; import xutils.ViewUtils; import xutils.view.annotation.ViewInject; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.widget.TextView; import com.eztcn.user.R; import com.eztcn.user.eztcn.activity.FinalActivity; import com.eztcn.user.eztcn.utils.CommonUtil; /** * @title 软件使用许可协议 * @describe * @author ezt * @created 2014年10月29日 */ public class StatementActivity extends FinalActivity { @ViewInject(R.id.showText) private TextView showText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_statement); ViewUtils.inject(StatementActivity.this); loadTitleBar(true, "使用协议和免责声明", null); showProgressToast(); new Thread(new Runnable() { @Override public void run() { Looper.prepare(); Message msg = new Message(); String str = CommonUtil.getFromAssets(getApplicationContext(), "statement.txt"); msg.obj = str; handler.sendMessage(msg); Looper.loop(); } }).start(); } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); String str = msg.obj.toString(); showText.setText(str); hideProgressToast(); } }; }
06f6c5fe2e3d124c683da0402614abe424543dfa
ed8ad1952e28bb930df26855d64da0e5b0c17ae6
/lab10/TopBottomDraw.java
099a8760bccd1459b0d8c637200a670edf066f10
[]
no_license
Yiwen-Feng/CS61B
a01c5a3167a84fc874c7e3357a3f367a63b8137e
78d53dbe7b646ec3f4af91e6f3778d0b2b18322a
refs/heads/master
2020-09-01T22:23:08.885278
2019-11-01T23:11:56
2019-11-01T23:11:56
219,074,028
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
class TopBottomDraw { /** An array of all cards in the deck. */ public int[] deck; /** Given some deck, TopBottomDraw can find the * best possible score for the starting player. Assume that our * opponent is playing optimally to minimize our score. */ public TopBottomDraw(int[] deck) { this.deck = deck; } /** Finds the best score, assuming our maximizer is going first. */ public int findBestScore(int i, int j) { if (i == j) { if (deck.length % 2 == 0) { return 0; } else { return deck[i]; } } else if ((j - i + 1) % 2 == deck.length % 2) { return Math.max(findBestScore(i + 1, j) + deck[i], findBestScore(i, j - 1) + deck[j]); } else { return Math.min (findBestScore(i + 1, j), findBestScore(i, j - 1)); } } /** Test cases for TopBottomDraw. */ public static void main(String[] args) { int[] exampleDeck1 = new int[] {1, 3, 45, 6, 7, 8, 9, 9}; int[] exampleDeck2 = new int[] {1, 3, 45, 6, 7, 8, 9, 9, 2}; int[] exampleDeck3 = new int[] {1,5,9}; TopBottomDraw tbp1 = new TopBottomDraw(exampleDeck1); TopBottomDraw tbp2 = new TopBottomDraw(exampleDeck2); TopBottomDraw tbp3 = new TopBottomDraw(exampleDeck3); System.out.printf("findBestScore returned %d, should be 63\n", tbp1.findBestScore(0, exampleDeck1.length - 1)); System.out.printf("findBestScore returned %d, should be 27\n", tbp2.findBestScore(0, exampleDeck2.length - 1)); System.out.println(tbp3.findBestScore(0, exampleDeck3.length - 1)); } }
eacefe634fd088a932e77f42b1da53743f5ebac6
1b493d786a5105eb90213137c35247bdf1827603
/SharedPreference/app/src/test/java/com/example/saruhan/sharedpreference/ExampleUnitTest.java
3736147206aae7c2249a261479ddef0bfd501386
[]
no_license
nursaruhan/Mobil-Programlama-Demo
7421ba9f763cf12b33c6e18bb9f5ae6d4c173869
e05fbab6dba71b9c3ef6e34c70d1a82be60a9235
refs/heads/master
2021-08-30T16:37:29.987077
2017-12-18T17:23:00
2017-12-18T17:23:00
114,667,457
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package com.example.saruhan.sharedpreference; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
03de879e0397a3602a66470fe8db4b479c566fb7
2b929141542574a409986a4e55da989a0946c0d8
/src/com/example/checkmate/mo.java
482f0c6b32de1d08337574946b10298608d732e2
[]
no_license
mouzarf/Checkmate
523bbbcbb9b2ea90271be5a610bb33a80c0a48fe
c34eccbf27e601adce0ea2491940b759ed4888c8
refs/heads/master
2020-12-26T02:49:32.594486
2014-05-14T12:59:08
2014-05-14T12:59:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
63
java
package com.example.checkmate; public class mo { tesr2 }
12a6e94d6af033dbfc82f6cfff0a9e32edbb3a96
96f8d42c474f8dd42ecc6811b6e555363f168d3e
/budejie/sources/com/ali/auth/third/core/util/ReflectionUtils.java
3c0f84cf6e44f5484f8bf932255f491824c27227
[]
no_license
aheadlcx/analyzeApk
050b261595cecc85790558a02d79739a789ae3a3
25cecc394dde4ed7d4971baf0e9504dcb7fabaca
refs/heads/master
2020-03-10T10:24:49.773318
2018-04-13T09:44:45
2018-04-13T09:44:45
129,332,351
6
2
null
null
null
null
UTF-8
Java
false
false
3,560
java
package com.ali.auth.third.core.util; import com.ali.auth.third.core.trace.SDKLogger; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; public class ReflectionUtils { private static final Map<String, Class<?>> PRIMITIVE_CLASSES = new HashMap(); private static final String TAG = ReflectionUtils.class.getSimpleName(); static { PRIMITIVE_CLASSES.put("short", Short.TYPE); PRIMITIVE_CLASSES.put("int", Integer.TYPE); PRIMITIVE_CLASSES.put("long", Long.TYPE); PRIMITIVE_CLASSES.put("double", Double.TYPE); PRIMITIVE_CLASSES.put("float", Float.TYPE); PRIMITIVE_CLASSES.put("char", Character.TYPE); PRIMITIVE_CLASSES.put("boolean", Boolean.TYPE); } public static Object invoke(String str, String str2, String[] strArr, Object obj, Object[] objArr) { try { Method method; Class cls = Class.forName(str); if (strArr == null || strArr.length == 0) { method = cls.getMethod(str2, new Class[0]); } else { method = cls.getMethod(str2, toClasses(strArr)); } return method.invoke(obj, objArr); } catch (Throwable e) { SDKLogger.e(TAG, "Fail to invoke the " + str + "." + str2 + ", the error is " + e.getMessage()); throw new RuntimeException(e); } } public static void set(Object obj, String str, Object obj2) { try { Field field = obj.getClass().getField(str); field.setAccessible(true); field.set(obj, obj2); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e2) { e2.printStackTrace(); } } public static <T> T newInstance(Class<T> cls, Class<?>[] clsArr, Object[] objArr) { if (clsArr != null) { try { if (clsArr.length != 0) { return cls.getConstructor(clsArr).newInstance(objArr); } } catch (Throwable e) { SDKLogger.e(TAG, "Fail to create the instance of type " + cls.getName() + ", the error is " + e.getMessage()); throw new RuntimeException(e); } } return cls.newInstance(); } public static Object newInstance(String str, String[] strArr, Object[] objArr) { try { return newInstance(Class.forName(str), toClasses(strArr), objArr); } catch (RuntimeException e) { throw e; } catch (Throwable e2) { SDKLogger.e(TAG, "Fail to create the instance of type " + str + ", the error is " + e2.getMessage()); throw new RuntimeException(e2); } } public static Class<?>[] toClasses(String[] strArr) throws Exception { if (strArr == null) { return null; } Class<?>[] clsArr = new Class[strArr.length]; int length = strArr.length; for (int i = 0; i < length; i++) { String str = strArr[i]; if (str.length() < 8) { clsArr[i] = (Class) PRIMITIVE_CLASSES.get(str); } if (clsArr[i] == null) { clsArr[i] = Class.forName(str); } } return clsArr; } public static Class<?> loadClassQuietly(String str) { try { return Class.forName(str); } catch (Throwable th) { return null; } } }
8b592b83bccb68a60a1eb692711285e5257cedb0
d1a89498ecc9c766bb4d8d523f899ebc80eb8b16
/src/main/java/main/Main.java
c68ae7c13dd08e871d77c9aac95853d4195e1e47
[]
no_license
laatopi/ohtu-viikko1
e86e426b299426bf33afcb351d98294682b29889
081952bf1c2f56714aedb1c9e4c08ee8148384c4
refs/heads/master
2021-08-08T23:16:39.520412
2017-11-11T14:51:46
2017-11-11T14:51:46
108,860,377
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package main; import ohtu.ohtuvarasto.Varasto; public class Main { public static void main(String[] args) { } }
fa4af67f095588a1062400aa9f77ff9d5a5ae7d3
adde1ccf86a6da7626c92a84e430c3f50e52304a
/app/src/main/java/com/example/nguyennam/financialbook/recordtab/IncomeFormEdit.java
718050c7a56b7186b77ae707cde5867c4f7d51a6
[]
no_license
namnhbap/FinancialBook
f812894385f59e98ef32760bf8acdd399ea31df2
d83cf803029ee92015e8cbfe4408b4c7795eeec5
refs/heads/master
2023-04-27T07:23:38.436227
2017-05-29T09:10:18
2017-05-29T09:10:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,909
java
package com.example.nguyennam.financialbook.recordtab; import android.app.DatePickerDialog; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.DatePicker; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.example.nguyennam.financialbook.MainActivity; import com.example.nguyennam.financialbook.R; import com.example.nguyennam.financialbook.database.AccountRecyclerViewDAO; import com.example.nguyennam.financialbook.database.IncomeDAO; import com.example.nguyennam.financialbook.model.AccountRecyclerView; import com.example.nguyennam.financialbook.model.Income; import com.example.nguyennam.financialbook.utils.CalculatorSupport; import com.example.nguyennam.financialbook.utils.Constant; import com.example.nguyennam.financialbook.utils.FileHelper; import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class IncomeFormEdit extends Fragment implements View.OnClickListener, DeleteFinancialHistoryDialog.DeleteDialogListener { Context context; Calendar myCalendar; TextView txtAmount; TextView txtIncomeCategory; TextView txtDescription; TextView txtAccountName; TextView txtIncomeTime; TextView txtEvent; Income income = new Income(); String temp_new_account_id; @Override public void onAttach(Context context) { super.onAttach(context); this.context = context; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); income = new IncomeDAO(context).getIncomeById(Integer.parseInt(FileHelper.readFile(context, Constant.TEMP_INCOME_ID))); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.record_edit_income, container, false); txtAmount = (TextView) view.findViewById(R.id.txtAmount); txtAmount.setOnClickListener(this); txtIncomeCategory = (TextView) view.findViewById(R.id.txtIncomeCategory); txtIncomeCategory.setText(income.get_category()); txtDescription = (TextView) view.findViewById(R.id.txtDescription); txtDescription.setText(income.get_description()); txtAccountName = (TextView) view.findViewById(R.id.txtAccountName); AccountRecyclerViewDAO accountDAO = new AccountRecyclerViewDAO(context); txtAccountName.setText(accountDAO.getAccountById(income.get_accountID()).getAccountName()); txtIncomeTime = (TextView) view.findViewById(R.id.txtIncomeTime); txtIncomeTime.setText(getDate()); txtEvent = (TextView) view.findViewById(R.id.txtEvent); txtEvent.setText(income.get_event()); RelativeLayout rlSelectCategory = (RelativeLayout) view.findViewById(R.id.rlSelectCategory); rlSelectCategory.setOnClickListener(this); RelativeLayout rlDescription = (RelativeLayout) view.findViewById(R.id.rlDescription); rlDescription.setOnClickListener(this); RelativeLayout rlSelectAccount = (RelativeLayout) view.findViewById(R.id.rlAccountName); rlSelectAccount.setOnClickListener(this); RelativeLayout rlSelectTime = (RelativeLayout) view.findViewById(R.id.rlIncomeTime); rlSelectTime.setOnClickListener(this); RelativeLayout rlIncomeEvent = (RelativeLayout) view.findViewById(R.id.rlEvent); rlIncomeEvent.setOnClickListener(this); LinearLayout lnSaveIncome = (LinearLayout) view.findViewById(R.id.lnSave); lnSaveIncome.setOnClickListener(this); LinearLayout lnDeleteIncome = (LinearLayout) view.findViewById(R.id.lnDelete); lnDeleteIncome.setOnClickListener(this); return view; } @Override public void onStart() { super.onStart(); if (!"".equals(FileHelper.readFile(context, Constant.TEMP_CALCULATOR))) { txtAmount.setText(FileHelper.readFile(context, Constant.TEMP_CALCULATOR)); } else { txtAmount.setText(income.get_amountMoney()); FileHelper.writeFile(context, Constant.TEMP_CALCULATOR_EDIT, income.get_amountMoney()); } if (!"".equals(FileHelper.readFile(context, Constant.TEMP_CATEGORY))) { txtIncomeCategory.setText(FileHelper.readFile(context, Constant.TEMP_CATEGORY)); } if (!"".equals(FileHelper.readFile(context, Constant.TEMP_ACCOUNT_ID_EDIT))) { AccountRecyclerViewDAO accountDAO = new AccountRecyclerViewDAO(context); temp_new_account_id = FileHelper.readFile(context, Constant.TEMP_ACCOUNT_ID_EDIT); txtAccountName.setText(accountDAO.getAccountById(Integer.parseInt(temp_new_account_id)).getAccountName()); } else { temp_new_account_id = String.valueOf(income.get_accountID()); } if (!"".equals(FileHelper.readFile(context, Constant.TEMP_DESCRIPTION))) { txtDescription.setText(FileHelper.readFile(context, Constant.TEMP_DESCRIPTION)); } if (!"".equals(FileHelper.readFile(context, Constant.TEMP_EVENT))) { txtEvent.setText(FileHelper.readFile(context, Constant.TEMP_EVENT)); } } String getDate() { myCalendar = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); if (!"".equals(FileHelper.readFile(context, Constant.TEMP_DATE))) { try { myCalendar.setTime(df.parse(FileHelper.readFile(context, Constant.TEMP_DATE))); } catch (ParseException e) { e.printStackTrace(); } return df.format(myCalendar.getTime()); } else { try { myCalendar.setTime(df.parse(income.get_date())); } catch (ParseException e) { e.printStackTrace(); } return df.format(myCalendar.getTime()); } } DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, month); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateLabel(); } }; private void updateLabel() { String myFormat = "dd/MM/yyyy"; //In which you need put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat); FileHelper.writeFile(context, Constant.TEMP_DATE, sdf.format(myCalendar.getTime())); txtIncomeTime.setText(sdf.format(myCalendar.getTime())); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.txtAmount: ((MainActivity)context).replaceFragment(new Calculator(), true); break; case R.id.rlSelectCategory: ((MainActivity)context).replaceFragment(new IncomeCategory(), true); break; case R.id.rlDescription: ((MainActivity)context).replaceFragment(new Description(), true); break; case R.id.rlAccountName: ((MainActivity)context).replaceFragment(new Accounts(), true); break; case R.id.rlIncomeTime: new DatePickerDialog(context, date, myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); break; case R.id.rlEvent: ((MainActivity)context).replaceFragment(new Event(), true); break; case R.id.lnSave: if ("".equals(txtAmount.getText().toString())) { Toast.makeText(getActivity(), getResources().getString(R.string.noticeNoMoney), Toast.LENGTH_LONG).show(); } else if ("".equals(txtIncomeCategory.getText().toString())){ Toast.makeText(getActivity(), getResources().getString(R.string.noticeNoCategory), Toast.LENGTH_LONG).show(); } else if ("".equals(txtAccountName.getText().toString())){ Toast.makeText(getActivity(), getResources().getString(R.string.noticeNoAccount), Toast.LENGTH_LONG).show(); } else { saveData(); } break; case R.id.lnDelete: DeleteFinancialHistoryDialog deleteFinancial = new DeleteFinancialHistoryDialog(); deleteFinancial.setTargetFragment(IncomeFormEdit.this, 271); deleteFinancial.show(getActivity().getSupportFragmentManager(), "delete_financial"); break; } } public void saveData() { // avoid bug can't set date current when click save FileHelper.deleteFile(context, Constant.TEMP_DATE); //update amountmoney of account updateAmountMoneyAccount(); //set expense setExpense(); //add expense into database IncomeDAO incomeDAO = new IncomeDAO(context); incomeDAO.updateIncome(income); Toast.makeText(context, R.string.editSuccessfully, Toast.LENGTH_SHORT).show(); //clear temp file clearTempFile(); //exit getActivity().getSupportFragmentManager().popBackStack(); } private void updateAmountMoneyAccount() { AccountRecyclerViewDAO accountDAO = new AccountRecyclerViewDAO(context); AccountRecyclerView accountOld = accountDAO.getAccountById(income.get_accountID()); AccountRecyclerView accountNew = accountDAO.getAccountById(Integer.parseInt(temp_new_account_id)); if (temp_new_account_id.equals(String.valueOf(income.get_accountID()))) { updateMoneyOldAccount(accountDAO, accountOld); } else { updateMoneyNewAccount(accountDAO, accountOld, accountNew); } } private void updateMoneyNewAccount(AccountRecyclerViewDAO accountDAO, AccountRecyclerView accountOld, AccountRecyclerView accountNew) { double remainMoneyNumber = Double.parseDouble(CalculatorSupport.formatExpression(accountNew.getAmountMoney())) + Double.parseDouble(CalculatorSupport.formatExpression(txtAmount.getText().toString())); double remainOldMoney = Double.parseDouble(CalculatorSupport.formatExpression(accountOld.getAmountMoney())) - Double.parseDouble(CalculatorSupport.formatExpression(income.get_amountMoney())); NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY); accountNew.setAmountMoney(nf.format(remainMoneyNumber)); accountOld.setAmountMoney(nf.format(remainOldMoney)); accountDAO.updateAccount(accountNew); accountDAO.updateAccount(accountOld); } private void updateMoneyOldAccount(AccountRecyclerViewDAO accountDAO, AccountRecyclerView accountOld) { double remainMoneyNumber = Double.parseDouble(CalculatorSupport.formatExpression(accountOld.getAmountMoney())) + Double.parseDouble(CalculatorSupport.formatExpression(txtAmount.getText().toString())) - Double.parseDouble(CalculatorSupport.formatExpression(income.get_amountMoney())); NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY); accountOld.setAmountMoney(nf.format(remainMoneyNumber)); accountDAO.updateAccount(accountOld); } private void setExpense() { income.set_amountMoney(txtAmount.getText().toString()); income.set_description(txtDescription.getText().toString()); income.set_accountID(Integer.parseInt(temp_new_account_id)); income.set_category(txtIncomeCategory.getText().toString()); income.set_event(txtEvent.getText().toString()); income.set_date(txtIncomeTime.getText().toString()); } private void clearTempFile() { FileHelper.deleteFile(context, Constant.TEMP_CALCULATOR); FileHelper.deleteFile(context, Constant.TEMP_CATEGORY); FileHelper.deleteFile(context, Constant.TEMP_DESCRIPTION); FileHelper.deleteFile(context, Constant.TEMP_EVENT); FileHelper.deleteFile(context, Constant.TEMP_ACCOUNT_ID_EDIT); FileHelper.deleteFile(context, Constant.TEMP_CALCULATOR_EDIT); FileHelper.deleteFile(context, Constant.TEMP_ISEXPENSE); } @Override public void onFinishDeleteDialog(boolean isDelete) { if (isDelete) { recoverMoney(); IncomeDAO incomeDAO = new IncomeDAO(context); incomeDAO.deleteIncome(income); clearTempFile(); Toast.makeText(context, R.string.deleteSuccessfully, Toast.LENGTH_SHORT).show(); getActivity().getSupportFragmentManager().popBackStack(); } } private void recoverMoney() { AccountRecyclerViewDAO accountDAO = new AccountRecyclerViewDAO(context); AccountRecyclerView account = accountDAO.getAccountById(income.get_accountID()); double remainMoneyNumber = Double.parseDouble(CalculatorSupport.formatExpression(account.getAmountMoney())) - Double.parseDouble(CalculatorSupport.formatExpression(income.get_amountMoney())); NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY); account.setAmountMoney(nf.format(remainMoneyNumber)); accountDAO.updateAccount(account); } }
6e8acd3ea6b1f21f1468328ccf4cf4dcbff4233b
c4540ffc0f8f564184be008cb63d1759b5640fd3
/app/src/main/java/com/example/sunray/ftpforandroid/logUtil/LogUtil.java
0ccca28abdaf6c9d1d8a51f80e9829db401488a1
[ "Apache-2.0" ]
permissive
WilliamWzh/ftpForAndroid
b6ee14fe03e289bdd6ef5a2ba73c204cf90a6cdf
085e9b6a9f5819c663b1fba6a0ad0f581e60256c
refs/heads/master
2021-06-26T15:42:08.059217
2017-09-13T02:30:40
2017-09-13T02:30:40
103,340,818
0
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
package com.example.sunray.ftpforandroid.logUtil; import android.util.Log; /** * Created by sunray on 2017-8-31. */ public class LogUtil { public static final int VERBOSE = 1; public static final int DEBUG = 2; public static final int INFO = 3; public static final int WARN = 4; public static final int ERROR = 5; public static final int NOTHING = 6; public static int level = VERBOSE; public static void v(String tag ,String msg){ if(level <= VERBOSE){ Log.v(tag,msg); } } public static void d(String tag ,String msg){ if(level <= DEBUG){ Log.d(tag,msg); } } public static void i(String tag ,String msg){ if(level <= INFO){ Log.i(tag,msg); } } public static void w(String tag ,String msg){ if(level <= WARN){ Log.w(tag,msg); } } public static void e(String tag ,String msg){ if(level <= ERROR){ Log.e(tag,msg); } } }
28df25c782929967b364ffed75d95bdf363c313d
4e510162291fa7e7773167ceca8576ba9c6838bd
/src/main/java/net/projecthade/jepret/web/rest/AccountResource.java
e84b8f74deac5ef27b70aa4a3ca5afc9892ef50c
[]
no_license
avew/jepret
82ed5cb6bbaf20b2326907b776ee0bddee36d877
3bea64591688a854d40357d8ed2b1dd71c39c56d
refs/heads/master
2021-01-10T14:01:47.766545
2016-02-11T20:11:03
2016-02-11T20:11:03
51,539,959
0
0
null
2016-02-11T20:11:03
2016-02-11T19:20:05
Java
UTF-8
Java
false
false
10,251
java
package net.projecthade.jepret.web.rest; import com.codahale.metrics.annotation.Timed; import net.projecthade.jepret.domain.Authority; import net.projecthade.jepret.domain.PersistentToken; import net.projecthade.jepret.domain.User; import net.projecthade.jepret.repository.PersistentTokenRepository; import net.projecthade.jepret.repository.UserRepository; import net.projecthade.jepret.security.SecurityUtils; import net.projecthade.jepret.service.MailService; import net.projecthade.jepret.service.UserService; import net.projecthade.jepret.web.rest.dto.KeyAndPasswordDTO; import net.projecthade.jepret.web.rest.dto.UserDTO; import net.projecthade.jepret.web.rest.util.HeaderUtil; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.*; /** * REST controller for managing the current user's account. */ @RestController @RequestMapping("/api") public class AccountResource { private final Logger log = LoggerFactory.getLogger(AccountResource.class); @Inject private UserRepository userRepository; @Inject private UserService userService; @Inject private PersistentTokenRepository persistentTokenRepository; @Inject private MailService mailService; /** * POST /register -> register the user. */ @RequestMapping(value = "/register", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<?> registerAccount(@Valid @RequestBody UserDTO userDTO, HttpServletRequest request) { return userRepository.findOneByLogin(userDTO.getLogin()) .map(user -> new ResponseEntity<>("login already in use", HttpStatus.BAD_REQUEST)) .orElseGet(() -> userRepository.findOneByEmail(userDTO.getEmail()) .map(user -> new ResponseEntity<>("e-mail address already in use", HttpStatus.BAD_REQUEST)) .orElseGet(() -> { User user = userService.createUserInformation(userDTO.getLogin(), userDTO.getPassword(), userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail().toLowerCase(), userDTO.getLangKey()); String baseUrl = request.getScheme() + // "http" "://" + // "://" request.getServerName() + // "myhost" ":" + // ":" request.getServerPort() + // "80" request.getContextPath(); // "/myContextPath" or "" if deployed in root context mailService.sendActivationEmail(user, baseUrl); return new ResponseEntity<>(HttpStatus.CREATED); }) ); } /** * GET /activate -> activate the registered user. */ @RequestMapping(value = "/activate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<String> activateAccount(@RequestParam(value = "key") String key) { return Optional.ofNullable(userService.activateRegistration(key)) .map(user -> new ResponseEntity<String>(HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * GET /authenticate -> check if the user is authenticated, and return its login. */ @RequestMapping(value = "/authenticate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public String isAuthenticated(HttpServletRequest request) { log.debug("REST request to check if the current user is authenticated"); return request.getRemoteUser(); } /** * GET /account -> get the current user. */ @RequestMapping(value = "/account", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<UserDTO> getAccount() { return Optional.ofNullable(userService.getUserWithAuthorities()) .map(user -> new ResponseEntity<>(new UserDTO(user), HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * POST /account -> update the current user information. */ @RequestMapping(value = "/account", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<String> saveAccount(@RequestBody UserDTO userDTO) { Optional<User> existingUser = userRepository.findOneByEmail(userDTO.getEmail()); if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userDTO.getLogin()))) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("user-management", "emailexists", "Email already in use")).body(null); } return userRepository .findOneByLogin(SecurityUtils.getCurrentUser().getUsername()) .map(u -> { userService.updateUserInformation(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(), userDTO.getLangKey()); return new ResponseEntity<String>(HttpStatus.OK); }) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * POST /change_password -> changes the current user's password */ @RequestMapping(value = "/account/change_password", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<?> changePassword(@RequestBody String password) { if (!checkPasswordLength(password)) { return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST); } userService.changePassword(password); return new ResponseEntity<>(HttpStatus.OK); } /** * GET /account/sessions -> get the current open sessions. */ @RequestMapping(value = "/account/sessions", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<List<PersistentToken>> getCurrentSessions() { return userRepository.findOneByLogin(SecurityUtils.getCurrentUser().getUsername()) .map(user -> new ResponseEntity<>( persistentTokenRepository.findByUser(user), HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * DELETE /account/sessions?series={series} -> invalidate an existing session. * * - You can only delete your own sessions, not any other user's session * - If you delete one of your existing sessions, and that you are currently logged in on that session, you will * still be able to use that session, until you quit your browser: it does not work in real time (there is * no API for that), it only removes the "remember me" cookie * - This is also true if you invalidate your current session: you will still be able to use it until you close * your browser or that the session times out. But automatic login (the "remember me" cookie) will not work * anymore. * There is an API to invalidate the current session, but there is no API to check which session uses which * cookie. */ @RequestMapping(value = "/account/sessions/{series}", method = RequestMethod.DELETE) @Timed public void invalidateSession(@PathVariable String series) throws UnsupportedEncodingException { String decodedSeries = URLDecoder.decode(series, "UTF-8"); userRepository.findOneByLogin(SecurityUtils.getCurrentUser().getUsername()).ifPresent(u -> { persistentTokenRepository.findByUser(u).stream() .filter(persistentToken -> StringUtils.equals(persistentToken.getSeries(), decodedSeries)) .findAny().ifPresent(t -> persistentTokenRepository.delete(decodedSeries)); }); } @RequestMapping(value = "/account/reset_password/init", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<?> requestPasswordReset(@RequestBody String mail, HttpServletRequest request) { return userService.requestPasswordReset(mail) .map(user -> { String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); mailService.sendPasswordResetMail(user, baseUrl); return new ResponseEntity<>("e-mail was sent", HttpStatus.OK); }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST)); } @RequestMapping(value = "/account/reset_password/finish", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<String> finishPasswordReset(@RequestBody KeyAndPasswordDTO keyAndPassword) { if (!checkPasswordLength(keyAndPassword.getNewPassword())) { return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST); } return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()) .map(user -> new ResponseEntity<String>(HttpStatus.OK)).orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } private boolean checkPasswordLength(String password) { return (!StringUtils.isEmpty(password) && password.length() >= UserDTO.PASSWORD_MIN_LENGTH && password.length() <= UserDTO.PASSWORD_MAX_LENGTH); } }
b90e781a011da6c84775a2242627549be9911cc6
7a358099e4eef460832dc0b4c9b163b08e567a98
/app/src/main/java/com/sh/doctorapplication/ui/activity/RegisterActivity.java
2983f230bebdb48e125719187a9c0c63235ac8f0
[]
no_license
buivanduc2101/DoctorAppliton
38782f149f7777b768b73fc01a46c5fe894c337b
e3dababdd8bb804a1a119a8ce3b1b3859b5c7fcc
refs/heads/master
2023-06-05T06:29:06.286539
2021-07-01T08:13:18
2021-07-01T08:13:18
375,116,819
0
0
null
null
null
null
UTF-8
Java
false
false
5,605
java
package com.sh.doctorapplication.ui.activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.sh.doctorapplication.R; import com.sh.doctorapplication.model.UserDetail; import com.sh.doctorapplication.network.ApiService; import com.sh.doctorapplication.network.RetrofitClient; import com.sh.doctorapplication.network.request.RegisterRequest; import com.sh.doctorapplication.utils.NetworkUtils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class RegisterActivity extends AppCompatActivity implements View.OnClickListener { private Button btnRegister; private ProgressDialog progressDialog; private EditText edtName, edtAddress, edtPhone, edtUsername, edtPassword, edtBirthDay; private ApiService apiService; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); initViews(); initInstance(); clearData(); } private void initInstance() { if (apiService == null) { apiService = RetrofitClient.getClient().create(ApiService.class); } } private void initViews() { progressDialog = new ProgressDialog(RegisterActivity.this); progressDialog.setMessage(getResources().getString(R.string.vui_long_doi) + "..."); progressDialog.setCanceledOnTouchOutside(false); edtName = this.findViewById(R.id.edtFullNameRegister); edtAddress = this.findViewById(R.id.edtAddressRegister); edtPhone = this.findViewById(R.id.edtPhoneNumberRegister); edtUsername = this.findViewById(R.id.edtUsernameRegister); edtPassword = this.findViewById(R.id.edtPassRegister); edtBirthDay = this.findViewById(R.id.edtBirthdayRegister); btnRegister = this.findViewById(R.id.btnRegister); btnRegister.setOnClickListener(this); } private void clearData() { edtName.setText(""); edtAddress.setText(""); edtPhone.setText(""); edtUsername.setText(""); edtPassword.setText(""); edtBirthDay.setText(""); } @Override public void onClick(View v) { if (v.getId() == R.id.btnRegister) { onClickRegister(); } } private void onClickRegister() { String name = edtName.getText().toString(); String address = edtAddress.getText().toString(); String phoneNumber = edtPhone.getText().toString(); String username = edtUsername.getText().toString(); String password = edtPassword.getText().toString(); String birthDay = edtBirthDay.getText().toString(); if (name.isEmpty() || address.isEmpty() || phoneNumber.isEmpty() || username.isEmpty() || password.isEmpty()) { Toast.makeText(this, "Vui lòng nhập đầy đủ thông tin", Toast.LENGTH_SHORT).show(); return; } RegisterRequest registerRequest = RegisterRequest.builder() .isDoctor(false) .fullName(name.trim()) .address(address.trim()) .password(password.trim()) .mobile(phoneNumber.trim()) .username(username.trim().toLowerCase()) .birthDay(birthDay.trim()) .build(); if (NetworkUtils.haveNetwork(RegisterActivity.this)) { showProgressDialog(); Call<UserDetail> callLogin = apiService.register(registerRequest); callLogin.enqueue(new Callback<UserDetail>() { @Override public void onResponse(Call<UserDetail> call, Response<UserDetail> response) { if (response.isSuccessful() && response.body() != null) { Toast.makeText(RegisterActivity.this, "Đăng ký tài khoản thành công", Toast.LENGTH_SHORT).show(); Intent mIntent = new Intent(RegisterActivity.this, LoginActivity.class); startActivity(mIntent); finish(); } else { Toast.makeText(RegisterActivity.this, "Đăng ký thất bại", Toast.LENGTH_SHORT).show(); } hiddenProgressDialog(); } @Override public void onFailure(Call<UserDetail> call, Throwable t) { Toast.makeText(RegisterActivity.this, "Đăng ký thất bại", Toast.LENGTH_SHORT).show(); hiddenProgressDialog(); } }); } else { Toast.makeText(RegisterActivity.this, getResources().getString(R.string.check_connection_network), Toast.LENGTH_SHORT).show(); hiddenProgressDialog(); } } private void showProgressDialog() { if (progressDialog != null && !progressDialog.isShowing()) { progressDialog.show(); } } private void hiddenProgressDialog() { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } @Override public void onDestroy() { super.onDestroy(); if (progressDialog != null) { progressDialog.dismiss(); progressDialog = null; } } }
6f90b5343f4ff9c7c139d34879e66e2a8346ff86
3dd140b1105a51c6ab55fde1359ef69b61eb6743
/src/main/java/net/llamaslayers/infiniteworld/App.java
69f755cbb9010087bc42fccb4a861aaf630032e4
[]
no_license
Nightgunner5/InfiniteWorld
24e70fca50778872ec7a7e2168ee760f135c0594
b7112d59dd902743d05a0316977b810bef8da588
refs/heads/master
2020-05-15T18:28:12.453267
2011-08-20T19:09:13
2011-08-20T19:09:13
2,239,729
1
0
null
null
null
null
UTF-8
Java
false
false
4,035
java
package net.llamaslayers.infiniteworld; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.text.NumberFormat; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; public class App implements Runnable { private static final OctreeGenerator gen = new RawSimplexGen(); private static int currentDetail = 0; private static final Object detailLock = new Object(); private static final int maxDetail = 64; private static Thread[] threads; public static void main(String[] args) { System.out.println("Memory at start: " + getMem()); System.out.println("Memory after initialization: " + getMem()); System.gc(); startThreads(); } private static void startThreads() { threads = new Thread[Runtime.getRuntime().availableProcessors()]; for (int i = 0; i < threads.length; i++) { threads[i] = new Thread(new App()); } for (Thread thread : threads) { thread.start(); } for (Thread thread : threads) { try { thread.join(); } catch (InterruptedException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } } } @Override public void run() { Octree oct = null; long start = 0, end = 0; float[] internal1 = new float[3]; float[] internal2 = new float[3]; float[] ret = new float[3]; while (true) { int detail; synchronized (detailLock) { if (currentDetail < maxDetail) { detail = currentDetail; currentDetail++; } else { break; } } System.out.println("Memory before generating octree #" + detail + ": " + getMem()); start = System.nanoTime(); oct = Octree.generateOctree(gen, detail, -128, -128, -128, 128, 128, 128); end = System.nanoTime(); System.out.println(" Octree generation took " + (end - start) / 1000000000.0 + " seconds."); System.out.println("Memory after generating octree #" + detail + ": " + getMem()); System.out.println("Memory before processing lighting for octree #" + detail + ": " + getMem()); start = System.nanoTime(); Octree lightingOct = oct.generateLightingOctree(detail); end = System.nanoTime(); System.out.println(" Lighting calculation took " + (end - start) / 1000000000.0 + " seconds."); System.out.println("Memory after processing lighting for octree #" + detail + ": " + getMem()); { System.out.println("Memory before rendering octree #" + detail + ": " + getMem()); start = System.nanoTime(); BufferedImage img = new BufferedImage(512, 512, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < 512; x++) { for (int y = 0; y < 512; y++) { float[] pos = oct.traceFov(0.5f, 0.5f, -2, 0.25f, 0.25f, 0.25f, x / 1024.0f + 0.25f, y / 1024.0f + 0.25f, 0.75f, 0.75f, 0.75f, 0.75f, internal1, internal2, ret); if (pos == null) { img.setRGB(x, y, 0x77EEFF); } else { img.setRGB(x, y, compostFog(lightingOct.getLightAt(pos[0], pos[1], pos[2]), Math.max(pos[2], 0.25f))); } } } try { ImageIO.write(img, "png", new File(detail + ".png")); } catch (IOException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } img.flush(); end = System.nanoTime(); System.out.println(" Rendering took " + (end - start) / 1000000000.0 + " seconds."); System.out.println("Memory after rendering octree #" + detail + ": " + getMem()); } oct = null; lightingOct = null; System.gc(); System.out.println("Memory after attempting to GC the octree: " + getMem()); } } private static String getMem() { return NumberFormat.getIntegerInstance().format(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()); } private static int compostFog(int lighting, float fog) { fog = fog * 2 - 0.5f; int r = (int) (lighting * (1 - fog) + 0x77 * fog); int g = (int) (lighting * (1 - fog) + 0xEE * fog); int b = (int) (lighting * (1 - fog) + 0xFF * fog); return (r << 16) | (g << 8) | b; } }
dc4395033b1046f400269c40fbb0ad0d18bb03f1
2c9edd09ba7006c29d5a543645a1c3b0680513a4
/ArrayImplementation/src/PlayWithArray.java
0addc0d2de8d2b240f368420622879f7f82c9067
[]
no_license
webkhushboo/DataStructures
006f4f5c5db8916b1bf0ce348074288813bda04c
1e3e717cb12dcddc9e10dfb0610206af7f976618
refs/heads/master
2021-01-22T22:35:02.969501
2017-09-06T09:04:15
2017-09-06T09:04:15
85,554,751
1
0
null
2019-12-30T11:15:15
2017-03-20T08:54:38
JavaScript
UTF-8
Java
false
false
843
java
import java.util.HashMap; import java.util.Scanner; public class PlayWithArray { private static void printArray(int[] arr) { int max =arr[0]; int secondMax = arr[0]; int indexOfMax =0; for(int i =0;i<arr.length;i++) { if(arr[i]> max){ secondMax =max; max = arr[i]; indexOfMax = i; } } for(int i=0;i<arr.length;i++){ } System.out.println(max); System.out.println(secondMax); } /* Driver program to test the above functions */ public static void main(String[] args) { // int a[] = new int[]{2,2,2,2,5,5,2,3,3}; Scanner scan = new Scanner(System.in); int noOfElements = scan.nextInt(); int[] arr = new int[noOfElements]; for(int i=0;i<noOfElements;i++){ arr[i] = scan.nextInt(); } printArray(arr); } }
73697ea8582691f265cd4661acd8b5f3145ae3da
2dac69d72b777798a9f8e3d5ebbc3e079953d369
/src/test/java/com/example/testingwithboot/service/CustomerServiceTest.java
fd078b03f5be37cad7797d8e8f0af963ad2cf049
[]
no_license
Ppustota/testingwithboot
913d52f151f448520dd64aa5ee4b0d25b70c814d
afe4fe3a78e1eed5bf2e7bd996c5ac8a3dd69069
refs/heads/master
2023-08-23T06:49:27.696521
2021-10-04T07:45:03
2021-10-04T07:45:03
413,397,393
0
0
null
null
null
null
UTF-8
Java
false
false
2,009
java
package com.example.testingwithboot.service; import com.example.testingwithboot.model.Customer; import com.example.testingwithboot.repo.CustomerRepo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace.*; @ActiveProfiles("test") @RunWith(SpringRunner.class) @DataJpaTest @AutoConfigureTestDatabase(replace = NONE) public class CustomerServiceTest { @Autowired private TestEntityManager entityManager; @Autowired private CustomerRepo customerRepo; @Test public void findAllTest() throws Exception{ Customer customer = new Customer(); customer.setName("zura"); entityManager.persist(customer); entityManager.flush(); Customer secondCustomer = new Customer(); customer.setName("luka"); entityManager.persist(secondCustomer); entityManager.flush(); List<Customer> list = customerRepo.findAll(); assertThat(list.size()).isEqualTo(3); assertThat(list.get(1)).isEqualTo(customer); assertThat(list.get(2)).isEqualTo(secondCustomer); } @Test public void findByNameTest() throws Exception{ Customer customer = new Customer(); customer.setName("zura"); entityManager.persist(customer); entityManager.flush(); Customer byName = customerRepo.findByName(customer.getName()); assertThat(byName.getName()).isEqualTo(customer.getName()); } }
3fb8df6bea45a7aada246e2f1a3c5895205ca05d
9d9c0d9aba0c3102787a0215621b24dbe7f64b59
/jeecms-backup/src/main/java/com/jeecms/backup/utils/CmdExecutor.java
3671b83a78192bc3a1b4b3b6647126645b05bb93
[]
no_license
hd19901110/jeecms1.4.1test
b354019c57a06384524d53aa667614c1f4e5a743
4e3e0cb31513e53004aa20c108f79741203becb0
refs/heads/master
2022-12-08T06:10:06.868825
2020-08-31T09:59:19
2020-08-31T09:59:19
285,445,431
0
1
null
null
null
null
UTF-8
Java
false
false
7,136
java
package com.jeecms.backup.utils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; /** * 命令行执行器 * 线程安全性未测试 * * @author Zhu Kaixiao * @version 1.0 * @date 2019/7/30 13:58 * @copyright 江西金磊科技发展有限公司 All rights reserved. Notice * 仅限于授权后使用,禁止非授权传阅以及私自用于商业目的。 */ public class CmdExecutor { static Logger log = LoggerFactory.getLogger(CmdExecutor.class); /** * 执行命令 * * @param commonds 要执行的命令 * @return 程序在执行命令过程中产生的各信息,执行出错时返回null */ public static CmdResult executeCommand(List<String> commonds) { if (CollectionUtils.isEmpty(commonds)) { log.error(" 指令执行失败,因为要执行的指令为空! "); return null; } String cmdStr = StringUtils.join(commonds, " "); return executeCommand(cmdStr); } public static CmdResult executeCommand(String cmd) { if (StringUtils.isBlank(cmd)) { log.error(" 指令执行失败,因为要执行的指令为空! "); return null; } LinkedList<String> cmds = new LinkedList<>(); String osName = System.getProperty("os.name"); // 如果第一个不是cmd, 那么创建的进程将是直接调用其他程序, 而不是调用cmd // 所以cmd下的一些功能(如管道符,重定向符)都不被支持 switch (OSUtil.currentPlatform()) { case OSUtil.PLATFORM_WINDOWS: cmds.add("cmd"); // /c参数是指命令执行完毕后退出cmd cmds.add("/c"); break; case OSUtil.PLATFORM_LINUX: case OSUtil.PLATFORM_MAC: cmds.add("sh"); cmds.add("-c"); break; default: log.error("不支持的操作系统: [{}]", osName); } cmds.add(cmd); // 设置程序所在路径 log.debug(" 待执行的指令为:[{}]", cmd); Runtime runtime = Runtime.getRuntime(); Process process = null; try { // 执行指令 ProcessBuilder builder = new ProcessBuilder(); builder.command(cmds); process = builder.start(); // 取出输出流和错误流的信息 // 注意:必须要取出在执行命令过程中产生的输出信息,如果不取的话当输出流信息填满jvm存储输出留信息的缓冲区时,线程就回阻塞住 PrintStream errorStream = new PrintStream(process.getErrorStream()); PrintStream inputStream = new PrintStream(process.getInputStream()); errorStream.start(); inputStream.start(); // 等待命令执行完 int pr = process.waitFor(); // 输出执行的命令信息 String resultStr = pr == 0 ? "正常" : "异常"; log.debug("已执行的命令:[{}] 已执行完毕,执行结果:[{}]", cmd, resultStr); return new CmdResult(pr, inputStream.stringBuffer.toString(), errorStream.stringBuffer.toString()); } catch (Exception e) { log.error("命令执行出错! 出错信息: {}", e.getMessage()); return null; } finally { if (null != process) { ProcessKiller killer = new ProcessKiller(process); // JVM退出时,先通过钩子关闭进程 runtime.addShutdownHook(killer); } } } /** * 在程序退出前结束已有的进程 */ private static class ProcessKiller extends Thread { static Logger log = LoggerFactory.getLogger(ProcessKiller.class); private Process process; ProcessKiller(Process process) { this.process = process; } @Override public void run() { this.process.destroy(); log.debug(" 已销毁进程 进程名: [{}]", process.toString()); } } /** * 用于取出线程执行过程中产生的各种输出和错误流的信息 */ static class PrintStream extends Thread { static Logger log = LoggerFactory.getLogger(PrintStream.class); InputStream inputStream; BufferedReader bufferedReader; StringBuffer stringBuffer; PrintStream(InputStream inputStream) { this.inputStream = inputStream; } @Override public void run() { try { if (null == inputStream) { log.error(" 读取输出流出错!因为当前输出流为空!"); } String charsetName = OSUtil.platformCharsetName(); bufferedReader = new BufferedReader(new InputStreamReader(inputStream, charsetName)); String line; stringBuffer = new StringBuffer(); while ((line = bufferedReader.readLine()) != null) { log.debug(line); stringBuffer.append(line); } } catch (Exception e) { log.error(" 读取输入流出错了! 错误信息:{}", e.getMessage()); } finally { try { if (null != bufferedReader) { bufferedReader.close(); } if (null != inputStream) { inputStream.close(); } } catch (IOException e) { log.error(" 调用PrintStream读取输出流后,关闭流时出错!"); } } } } public static class CmdResult { private int code; private String out; private String error; /** * @return the code */ public int getCode() { return code; } /** * @return the out */ public String getOut() { return out; } /** * @return the error */ public String getError() { return error; } /** * @param code the code to set */ public void setCode(int code) { this.code = code; } /** * @param out the out to set */ public void setOut(String out) { this.out = out; } /** * @param error the error to set */ public void setError(String error) { this.error = error; } public CmdResult(int code, String out, String error) { super(); this.code = code; this.out = out; this.error = error; } } }
60d42a695b04639c4ccdc98bd91b27fa47d04647
27898ac2655155535ef6fba74a46e9e5fb8fd108
/src/homePractice/hh.java
334fd71ac7ae3676ec35e076440000904f8e5487
[]
no_license
sushilsharma77/JavaBasic
ebb4424a183b319ced8af9b75f3f26d7b88a5a9f
83fa5de3e944faaa0ba340813fc71016640dbefa
refs/heads/master
2021-04-09T22:03:04.512689
2020-06-02T20:50:10
2020-06-02T20:50:10
248,367,746
1
0
null
null
null
null
UTF-8
Java
false
false
372
java
package homePractice; import java.util.Iterator; import java.util.TreeSet; public class hh{ public static void main(String[] args) { TreeSet map = new TreeSet(); map.add("one"); map.add("two"); map.add("three"); map.add("four"); map.add("one"); Iterator it = map.iterator(); while (it.hasNext() ) { System.out.print( it.next() + " " ); } } }
775b1a76bb68f488f7999bb4385438dd8c445a23
43c464438339da29cb20655d28b675eed4b99825
/app/src/main/java/com/sagar/policesearch/PolicePojo.java
355d7de711ce3e2e670dbc12b6656054e10e69f9
[]
no_license
sagar2buddy/PoliceSearch
e6508fceb590c4e29860e86574e79fe959678e61
020edec145127a5f0bedbf09338c8f95c8f17cd6
refs/heads/master
2023-06-23T07:21:28.389469
2021-07-14T05:44:14
2021-07-14T05:44:14
385,827,870
0
0
null
null
null
null
UTF-8
Java
false
false
2,304
java
package com.sagar.policesearch; import java.util.Objects; public class PolicePojo { private String sno; private String policeStation; private String district; private String state; private String phoneNumber; public PolicePojo(String sno, String policeStation, String district, String state, String phoneNumber) { this.sno = sno; this.policeStation = policeStation; this.district = district; this.state = state; this.phoneNumber = phoneNumber; } public PolicePojo(){ } public String getSno() { return sno; } public void setSno(String sno) { this.sno = sno; } public String getPoliceStation() { return policeStation; } public void setPoliceStation(String policeStation) { this.policeStation = policeStation; } public String getDistrict() { return district; } public void setDistrict(String district) { this.district = district; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PolicePojo that = (PolicePojo) o; return Objects.equals(sno, that.sno) && Objects.equals(policeStation, that.policeStation) && Objects.equals(district, that.district) && Objects.equals(state, that.state) && Objects.equals(phoneNumber, that.phoneNumber); } @Override public int hashCode() { return Objects.hash(sno, policeStation, district, state, phoneNumber); } @Override public String toString() { return "PolicePojo{" + "sno='" + sno + '\'' + ", policeStation='" + policeStation + '\'' + ", district='" + district + '\'' + ", state='" + state + '\'' + ", phoneNumber='" + phoneNumber + '\'' + '}'; } }
0591d7bcba042b657c801d112db8d3003e2c6fa1
a0ce847450bac349423b7b6d4f77c722241a7785
/open-source/Java/org/apache/flume/source/taildir/TaildirMatcher.java
cd40cb1ba4f45fa9c02e28bae6064679fecc659c
[]
no_license
zozospider/note
34e1974576c6dc6c53a3a71af3d6472e90ba162e
b50c37db309600a2295749394ecca8a00d9da777
refs/heads/master
2023-04-20T17:10:12.133400
2023-03-30T09:19:01
2023-03-30T09:19:01
153,109,264
2
2
null
2018-10-16T08:33:41
2018-10-15T12:30:50
null
UTF-8
Java
false
false
13,475
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.flume.source.taildir; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import org.apache.flume.annotations.InterfaceAudience; import org.apache.flume.annotations.InterfaceStability; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.PathMatcher; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.concurrent.TimeUnit; /** * Identifies and caches the files matched by single file pattern for {@code TAILDIR} source. * <p></p> * Since file patterns only apply to the fileNames and not the parent dictionaries, this * implementation checks the parent directory for modification (additional or removed files * update modification time of parent dir) * If no modification happened to the parent dir that means the underlying files could only be * written to but no need to rerun the pattern matching on fileNames. * <p></p> * This implementation provides lazy caching or no caching. Instances of this class keep the * result file list from the last successful execution of {@linkplain #getMatchingFiles()} * function invocation, and may serve the content without hitting the FileSystem for performance * optimization. * <p></p> * <b>IMPORTANT:</b> It is assumed that the hosting system provides at least second granularity * for both {@code System.currentTimeMillis()} and {@code File.lastModified()}. Also * that system clock is used for file system timestamps. If it is not the case then configure it * as uncached. Class is solely for package only usage. Member functions are not thread safe. * 当前 FileGroup 对应的 Taildir 匹配器 * * @see TaildirSource * @see ReliableTaildirEventReader * @see TaildirSourceConfigurationConstants */ @InterfaceAudience.Private @InterfaceStability.Evolving public class TaildirMatcher { private static final Logger logger = LoggerFactory.getLogger(TaildirMatcher.class); private static final FileSystem FS = FileSystems.getDefault(); // flag from configuration to switch off caching completely private final boolean cachePatternMatching; // id from configuration private final String fileGroup; // plain string of the desired files from configuration private final String filePattern; // directory monitored for changes private final File parentDir; // cached instance for filtering files based on filePattern private final DirectoryStream.Filter<Path> fileFilter; // system time in milliseconds, stores the last modification time of the // parent directory seen by the last check, rounded to seconds // initial value is used in first check only when it will be replaced instantly // (system time is positive) private long lastSeenParentDirMTime = -1; // system time in milliseconds, time of the last check, rounded to seconds // initial value is used in first check only when it will be replaced instantly // (system time is positive) private long lastCheckedTime = -1; // cached content, files which matched the pattern within the parent directory private List<File> lastMatchedFiles = Lists.newArrayList(); /** * Package accessible constructor. From configuration context it represents a single * <code>filegroup</code> and encapsulates the corresponding <code>filePattern</code>. * <code>filePattern</code> consists of two parts: first part has to be a valid path to an * existing parent directory, second part has to be a valid regex * {@link java.util.regex.Pattern} that match any non-hidden file names within parent directory * . A valid example for filePattern is <code>/dir0/dir1/.*</code> given * <code>/dir0/dir1</code> is an existing directory structure readable by the running user. * <p></p> * An instance of this class is created for each fileGroup * * @param fileGroup arbitrary name of the group given by the config * @param filePattern parent directory plus regex pattern. No wildcards are allowed in directory * name * @param cachePatternMatching default true, recommended in every setup especially with huge * parent directories. Don't set when local system clock is not used * for stamping mtime (eg: remote filesystems) * @see TaildirSourceConfigurationConstants */ TaildirMatcher(String fileGroup, String filePattern, boolean cachePatternMatching) { // store whatever came from configuration // f2 this.fileGroup = fileGroup; // /var/log/test2/.*log.* this.filePattern = filePattern; // true this.cachePatternMatching = cachePatternMatching; // calculate final members // 初始化父文件夹, 正则表达式过滤器 File f = new File(filePattern); this.parentDir = f.getParentFile(); String regex = f.getName(); final PathMatcher matcher = FS.getPathMatcher("regex:" + regex); this.fileFilter = new DirectoryStream.Filter<Path>() { @Override public boolean accept(Path entry) throws IOException { return matcher.matches(entry.getFileName()) && !Files.isDirectory(entry); } }; // sanity check Preconditions.checkState(parentDir.exists(), "Directory does not exist: " + parentDir.getAbsolutePath()); } /** * Lists those files within the parentDir that match regex pattern passed in during object * instantiation. Designed for frequent periodic invocation * {@link org.apache.flume.source.PollableSourceRunner}. * <p></p> * Based on the modification of the parentDir this function may trigger cache recalculation by * calling {@linkplain #getMatchingFilesNoCache()} or * return the value stored in {@linkplain #lastMatchedFiles}. * Parentdir is allowed to be a symbolic link. * <p></p> * Files returned by this call are weakly consistent (see {@link DirectoryStream}). * It does not freeze the directory while iterating, * so it may (or may not) reflect updates to the directory that occur during the call, * In which case next call * will return those files (as mtime is increasing it won't hit cache but trigger recalculation). * It is guaranteed that invocation reflects every change which was observable at the time of * invocation. * <p></p> * Matching file list recalculation is triggered when caching was turned off or * if mtime is greater than the previously seen mtime * (including the case of cache hasn't been calculated before). * Additionally if a constantly updated directory was configured as parentDir * then multiple changes to the parentDir may happen * within the same second so in such case (assuming at least second granularity of reported mtime) * it is impossible to tell whether a change of the dir happened before the check or after * (unless the check happened after that second). * Having said that implementation also stores system time of the previous invocation and previous * invocation has to happen strictly after the current mtime to avoid further cache refresh * (because then it is guaranteed that previous invocation resulted in valid cache content). * If system clock hasn't passed the second of * the current mtime then logic expects more changes as well * (since it cannot be sure that there won't be any further changes still in that second * and it would like to avoid data loss in first place) * hence it recalculates matching files. If system clock finally * passed actual mtime then a subsequent invocation guarantees that it picked up every * change from the passed second so * any further invocations can be served from cache associated with that second * (given mtime is not updated again). * 获取当前 FileGroup 对应的 Taildir 匹配器匹配的文件集合 * * @return List of files matching the pattern sorted by last modification time. No recursion. * No directories. If nothing matches then returns an empty list. If I/O issue occurred then * returns the list collected to the point when exception was thrown. * * @see #getMatchingFilesNoCache() */ List<File> getMatchingFiles() { // 当前时间 long now = TimeUnit.SECONDS.toMillis( TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())); // 当前父文件夹修改时间 long currentParentDirMTime = parentDir.lastModified(); List<File> result; // calculate matched files if // - we don't want to use cache (recalculate every time) OR // - directory was clearly updated after the last check OR // - last mtime change wasn't already checked for sure // (system clock hasn't passed that second yet) // 计算匹配的文件, 如果: // - 我们不想使用缓存 (每次重新计算) // - 目录在最后一次检查后有更新 // - 最后一次 mtime 更改尚未确定 (系统时钟尚未通过那个秒) if (!cachePatternMatching || lastSeenParentDirMTime < currentParentDirMTime || !(currentParentDirMTime < lastCheckedTime)) { // 获取匹配的文件集合, 按照修改时间重新排序, 并赋值给 lastMatchedFiles lastMatchedFiles = sortByLastModifiedTime(getMatchingFilesNoCache()); // 更新 lastSeenParentDirMTime lastSeenParentDirMTime = currentParentDirMTime; // 更新 lastCheckedTime lastCheckedTime = now; } // 返回匹配的文件集合 return lastMatchedFiles; } /** * Provides the actual files within the parentDir which * files are matching the regex pattern. Each invocation uses {@link DirectoryStream} * to identify matching files. * * Files returned by this call are weakly consistent (see {@link DirectoryStream}). * It does not freeze the directory while iterating, so it may (or may not) reflect updates * to the directory that occur during the call. In which case next call will return those files. * 获取匹配的文件集合 * * @return List of files matching the pattern unsorted. No recursion. No directories. * If nothing matches then returns an empty list. If I/O issue occurred then returns the list * collected to the point when exception was thrown. * * @see DirectoryStream * @see DirectoryStream.Filter */ private List<File> getMatchingFilesNoCache() { List<File> result = Lists.newArrayList(); // 通过正则表达式过滤目录下的文件: Files.newDirectoryStream(/var/log/test2, .*log.*); try (DirectoryStream<Path> stream = Files.newDirectoryStream(parentDir.toPath(), fileFilter)) { // 将符合调节的文件添加到匹配结果 for (Path entry : stream) { result.add(entry.toFile()); } } catch (IOException e) { logger.error("I/O exception occurred while listing parent directory. " + "Files already matched will be returned. " + parentDir.toPath(), e); } return result; } /** * Utility function to sort matched files based on last modification time. * Sorting itself use only a snapshot of last modification times captured before the sorting * to keep the number of stat system calls to the required minimum. * 将文件集合按照修改时间重新排序 * * @param files list of files in any order * @return sorted list */ private static List<File> sortByLastModifiedTime(List<File> files) { final HashMap<File, Long> lastModificationTimes = new HashMap<File, Long>(files.size()); for (File f: files) { lastModificationTimes.put(f, f.lastModified()); } Collections.sort(files, new Comparator<File>() { @Override public int compare(File o1, File o2) { return lastModificationTimes.get(o1).compareTo(lastModificationTimes.get(o2)); } }); return files; } @Override public String toString() { return "{" + "filegroup='" + fileGroup + '\'' + ", filePattern='" + filePattern + '\'' + ", cached=" + cachePatternMatching + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TaildirMatcher that = (TaildirMatcher) o; return fileGroup.equals(that.fileGroup); } @Override public int hashCode() { return fileGroup.hashCode(); } public String getFileGroup() { return fileGroup; } }
55a98e7982b50e8de59381fe0d53962f6cae4448
46c6348293139d71bdc51c56ad81a3ef5363d45b
/htdz-services/htdz-liteguardian/src/main/java/com/htdz/liteguardian/util/UtilDate.java
aa49c146ab34e852da419d31dad6f0ffa095be04
[]
no_license
shanghaif/bdproject
80208f6c2595a666dd51de2c84c63125b4605727
d55ec9e2702eda21cf31d203058f45b3df10f069
refs/heads/master
2023-03-16T11:16:19.179054
2018-07-24T08:11:16
2018-07-24T08:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,970
java
package com.htdz.liteguardian.util; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Random; /* * *类名:UtilDate *功能:自定义订单类 *详细:工具类,可以用作获取系统日期、订单编号等 *版本:3.3 *日期:2012-08-17 *说明: *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 */ public class UtilDate { /** 年月日时分秒(无下划线) yyyyMMddHHmmss */ public static final String dtLong = "yyyyMMddHHmmss"; /** 完整时间 yyyy-MM-dd HH:mm:ss */ public static final String simple = "yyyy-MM-dd HH:mm:ss"; /** 年月日(无下划线) yyyyMMdd */ public static final String dtShort = "yyyyMMdd"; /** 年月日(无下划线) yyyyMMdd HH:mm */ public static final String nyrsf = "yyyy-MM-dd HH:mm"; /** 年月(无下划线) yyyyMM */ public static final String dtSmall = "yyyy.MM"; /** * 返回系统当前时间(精确到毫秒),作为一个唯一的订单编号 * * @return 以yyyyMMddHHmmss为格式的当前系统时间 */ public static String getOrderNum() { Date date = new Date(); DateFormat df = new SimpleDateFormat(dtLong); return df.format(date); } /** * 获取系统当前日期(精确到毫秒),格式:yyyy-MM-dd HH:mm:ss * * @return */ public static String getDateFormatter() { Date date = new Date(); DateFormat df = new SimpleDateFormat(simple); return df.format(date); } /** * 获取系统当期年月日(精确到天),格式:yyyyMMdd * * @return */ public static String getDate() { Date date = new Date(); DateFormat df = new SimpleDateFormat(dtShort); return df.format(date); } /** * 产生随机的三位数 * * @return */ public static String getThree() { Random rad = new Random(); return rad.nextInt(1000) + ""; } /** * 微信支付订单号 * * @return */ /* * public static String getNonCeStr() { Random rad = new Random(); return * com * .castel.family.weixin.MD5.getMessageDigest(String.valueOf(rad.nextInt(10000 * )).getBytes()); } */ /** * 将指定格式的字符串 转换成 date * * @param date * @param srcFormat * @return */ public static Date getDate(String date, String srcFormat) { if (date != null && !date.isEmpty() && null != srcFormat && !srcFormat.isEmpty()) { SimpleDateFormat format = new SimpleDateFormat(srcFormat); try { return format.parse(date); } catch (ParseException e) { return null; } } else { return null; } } /** * 根据时区获取UTC时间串 * * @param date * @param timezone * 对应javascript对象Date的timezoneOffset * @return */ public static String getUTCDateString(Date date, int timezone) { if (date != null) { Calendar cale = Calendar.getInstance(); cale.setTime(new Date(date.getTime() - timezone * 1000)); // cale.add(cale.MINUTE, timezone); return getDateString(cale.getTime()); } else { return ""; } } /** * 格式化日期,返回短时间格式 yyyy-MM-dd HH:mm:ss * * @param date * @return */ public static String getDateString(Object date) { if (date instanceof Date) { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); return format.format((Date) date); } else { return ""; } } /** * 格式化日期,返回短时间格式 yyyy-MM * * @param date * @return */ public static String getDateSmall(Object date) { if (date instanceof Date) { SimpleDateFormat format = new SimpleDateFormat(dtSmall); return format.format((Date) date); } else { return ""; } } /** * 获取时间差 yyyy-MM-dd HH:mm:ss * * @param date1 * :开始时间 date2:结束时间 * @return */ public static String getDateDiff(String date1, String date2) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = null; Date endDate = null; try { startDate = df.parse(date1); endDate = df.parse(date2); } catch (ParseException e) { return "00:00:00"; } long l = endDate.getTime() - startDate.getTime(); long day = l / (24 * 60 * 60 * 1000); long hour = (l / (60 * 60 * 1000) - day * 24); long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60); long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); if (day > 0) { hour = day * 24 + hour; } String hourTime = hour > 9 ? String.valueOf(hour) : "0" + hour; String minTime = min > 9 ? String.valueOf(min) : "0" + min; String sTime = s > 9 ? String.valueOf(s) : "0" + s; return hourTime + ":" + minTime + ":" + sTime; } /* * 把多少秒 换算成时分秒 **:**:** */ public static String getHourMinSec(int second) { int h = 0; int d = 0; int s = 0; String hstr = ""; String dstr = ""; String sstr = ""; int temp = second % 3600; if (second > 3600) { h = second / 3600; if (temp != 0) { if (temp > 60) { d = temp / 60; if (temp % 60 != 0) { s = temp % 60; } } else { s = temp; } } } else { d = second / 60; if (second % 60 != 0) { s = second % 60; } } if (h < 9) { hstr = "0" + String.valueOf(h); } else { hstr = String.valueOf(h); } if (d < 9) { dstr = "0" + String.valueOf(d); } else { dstr = String.valueOf(d); } if (s < 9) { sstr = "0" + String.valueOf(s); } else { sstr = String.valueOf(s); } return hstr + ":" + dstr + ":" + sstr; } public static void main(String[] args) { String time = getDateDiff("2017-11-15 10:25:00", "2017-11-15 10:40:00"); System.out.println(time.compareTo("00:05:00")); System.out.println("time:" + time); } }
cb72930555f16f89a47c7852eece5038bed6ded7
021cbb26daf65e4b47ef62a3c9c84f4c55a849ef
/src/main/java/de/matthiasmann/twl/TableSelectionManager.java
f3f3c0369527947e4cf59ba4d010ff92dbf7cd10
[]
no_license
ShadowLordAlpha/TWL
fe9e1f3994cc31417ed60d34ee020ed7eba577ba
94785108ae26e3f1fddb6afa4f6b803b9df4dde2
refs/heads/master
2021-01-10T15:40:59.422959
2015-10-10T19:18:55
2015-10-10T19:18:55
43,928,414
0
0
null
null
null
null
UTF-8
Java
false
false
2,500
java
/* * Copyright (c) 2008-2009, Matthias Mann * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Matthias Mann nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package de.matthiasmann.twl; import de.matthiasmann.twl.model.TableSelectionModel; /** * * @author Matthias Mann */ public interface TableSelectionManager { public enum SelectionGranularity { ROWS, CELLS } public TableSelectionModel getSelectionModel(); public void setAssociatedTable(TableBase base); public SelectionGranularity getSelectionGranularity(); public boolean handleKeyStrokeAction(String action, Event event); public boolean handleMouseEvent(int row, int column, Event event); public boolean isRowSelected(int row); public boolean isCellSelected(int row, int column); public int getLeadRow(); public int getLeadColumn(); public void modelChanged(); public void rowsInserted(int index, int count); public void rowsDeleted(int index, int count); public void columnInserted(int index, int count); public void columnsDeleted(int index, int count); }
ecdc3b535f714de839c39a702020c04a9e95e022
5aaebaafeb75c7616689bcf71b8dd5ab2c89fa3b
/src/ANXGallery/sources/com/miui/gallery/card/ui/detail/StoryAlbumRenameDialog.java
453950a961eba59e16029fcbe345625be55976fa
[]
no_license
gitgeek4dx/ANXGallery9
9bf2b4da409ab16492e64340bde4836d716ea7ec
af2e3c031d1857fa25636ada923652b66a37ff9e
refs/heads/master
2022-01-15T05:23:24.065872
2019-07-25T17:34:35
2019-07-25T17:34:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,944
java
package com.miui.gallery.card.ui.detail; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnShowListener; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import com.miui.gallery.R; import com.miui.gallery.util.ToastUtils; import com.miui.gallery.widget.GalleryDialogFragment; import miui.app.AlertDialog; import miui.app.AlertDialog.Builder; public class StoryAlbumRenameDialog extends GalleryDialogFragment { protected Button mConfirmButton; /* access modifiers changed from: private */ public final OnClickListener mConfirmListener = new OnClickListener() { public void onClick(View view) { String obj = StoryAlbumRenameDialog.this.mInputView.getText().toString(); if (StoryAlbumRenameDialog.this.verify(obj)) { if (!TextUtils.equals(StoryAlbumRenameDialog.this.mDefaultName, obj)) { StoryAlbumRenameDialog.this.mConfirmButton.setEnabled(true); if (StoryAlbumRenameDialog.this.mOnRenameDoneListener != null) { StoryAlbumRenameDialog.this.mOnRenameDoneListener.onOperationDone(obj); } } StoryAlbumRenameDialog.this.mDialog.dismiss(); } } }; protected String mDefaultName; protected AlertDialog mDialog; protected EditText mInputView; protected OnRenameDoneListener mOnRenameDoneListener; private final TextWatcher mTextWatcher = new TextWatcher() { public void afterTextChanged(Editable editable) { } public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (StoryAlbumRenameDialog.this.mConfirmButton != null) { StoryAlbumRenameDialog.this.mConfirmButton.setEnabled(!TextUtils.isEmpty(charSequence)); } } }; public interface OnRenameDoneListener { void onOperationDone(String str); } private void parseArguments() { this.mDefaultName = getArguments().getString("card_name"); } /* access modifiers changed from: private */ public boolean verify(String str) { if (TextUtils.isEmpty(str.trim())) { this.mInputView.selectAll(); return false; } else if ("._".indexOf(str.charAt(0)) >= 0) { ToastUtils.makeText((Context) getActivity(), (int) R.string.story_rename_invalid_prefix); return false; } else { for (int i = 0; i < str.length(); i++) { char charAt = str.charAt(i); if ("/\\:@*?<>\r\n\t".indexOf(charAt) >= 0) { if ("\r\n\t".indexOf(charAt) >= 0) { charAt = ' '; } ToastUtils.makeText((Context) getActivity(), (CharSequence) getString(R.string.story_rename_invalid_char, new Object[]{Character.valueOf(charAt)})); return false; } } return true; } } public void onCreate(Bundle bundle) { super.onCreate(bundle); parseArguments(); this.mInputView = (EditText) LayoutInflater.from(getActivity()).inflate(R.layout.edit_text_dialog, null, false); this.mInputView.setHint(R.string.rename_dialog_hint); this.mInputView.setText(this.mDefaultName); this.mInputView.selectAll(); this.mInputView.addTextChangedListener(this.mTextWatcher); } public Dialog onCreateDialog(Bundle bundle) { this.mDialog = new Builder(getActivity()).setView(this.mInputView).setTitle(R.string.rename_dialog_title).setPositiveButton(17039370, null).setNegativeButton(17039360, null).create(); if (this.mDialog.getWindow() != null) { this.mDialog.getWindow().setSoftInputMode(4); } this.mDialog.setOnShowListener(new OnShowListener() { public void onShow(DialogInterface dialogInterface) { StoryAlbumRenameDialog.this.mConfirmButton = StoryAlbumRenameDialog.this.mDialog.getButton(-1); StoryAlbumRenameDialog.this.mConfirmButton.setEnabled(!TextUtils.isEmpty(StoryAlbumRenameDialog.this.mInputView.getText())); StoryAlbumRenameDialog.this.mConfirmButton.setOnClickListener(StoryAlbumRenameDialog.this.mConfirmListener); } }); return this.mDialog; } public void setOnRenameDoneListener(OnRenameDoneListener onRenameDoneListener) { this.mOnRenameDoneListener = onRenameDoneListener; } }
72a8dc49b9137d1447b6440124dcd34340e90742
ff90b257620ce1add4e2c4da761b0e8d52b27d71
/src/main/java/attendance/model/AttendanceItem.java
7cf3d5e5fc8df916524aaaf98931d59e99aa5786
[]
no_license
jaenudin86/attendance-1
74949d030d1273bce6b45595e0234dad7486c16b
c19bd55259097eb546a048c60abd77a8f046697d
refs/heads/master
2020-06-27T06:51:43.213404
2016-04-09T08:40:44
2016-04-09T08:40:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,084
java
package attendance.model; import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Access(value=AccessType.FIELD) public class AttendanceItem { @JsonIgnore @ManyToOne private Employee employee; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; private AttendanceItemType attendanceItemType; private AttendanceItemStatus attendanceItemStatus; private Date startDate; private Date endDate; public AttendanceItem(Employee employee, AttendanceItemStatus attendanceItemStatus, AttendanceItemType attendanceItemType, Date startDate, Date endDate) { this.employee = employee; this.attendanceItemType = attendanceItemType; this.attendanceItemStatus = attendanceItemStatus; this.startDate = startDate; this.endDate = endDate; } public AttendanceItem() { } public Long getId() { return id; } public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } public AttendanceItemType getAttendanceItemType() { return attendanceItemType; } public void setAttendanceItemType(AttendanceItemType attendanceItemType) { this.attendanceItemType = attendanceItemType; } public AttendanceItemStatus getAttendanceItemStatus() { return attendanceItemStatus; } public void setAttendanceItemStatus(AttendanceItemStatus attendanceItemStatus) { this.attendanceItemStatus = attendanceItemStatus; } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } }
056c9b0b73389b2f9534bd9ecf2182a9dc1793a2
84a9bc02098ea943c7243e2844212dc8855dc6d0
/app/src/androidTest/java/afilbert/imgresizer/ExampleInstrumentedTest.java
0041ad7700cdabbb1793b5650185254804ff1cd8
[]
no_license
alexfilbert/ImgResizer
ee2e08e3f73c4db00a1de70eca104e9e9bcef0e6
3a5fb639e3161fa7266bad11325ec3451fae891c
refs/heads/master
2020-03-22T14:49:51.643824
2018-09-03T17:22:39
2018-09-03T17:22:39
140,208,982
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package afilbert.imgresizer; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("afilbert.imgresizer", appContext.getPackageName()); } }
ef146aef95bca13cc9cd751309be21103e741971
a01a99434a1f387142ad67dca4df432238241ab0
/Day-55/Program2.java
848cd7200582006480edb09a17c2f06b6578f76b
[]
no_license
Aksh-Konda/CP
8f84501391cfd0193da36282a47595d28d548117
c6b307316a9b820f3245c2b03c374470530b7717
refs/heads/main
2023-06-09T11:15:37.667789
2021-06-23T11:58:23
2021-06-23T11:58:23
333,118,842
0
0
null
null
null
null
UTF-8
Java
false
false
2,300
java
import java.util.*; public class Program2 { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); char[][] splits = new char[n][]; String raw[] = scn.next().split(","); for (int i = 0; i < n; i++) { splits[i] = raw[i].toCharArray(); } System.out.println(countRegions(splits, n)); scn.close(); } static int countRegions(char[][] splits, int n) { int parent[] = new int[n * n * 4]; for (int i = 0; i < parent.length; i++) parent[i] = i; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int idx = getElement(i, j, n); if (splits[i][j] != 'L') { union(parent, idx + 0, idx + 3); union(parent, idx + 1, idx + 2); } if (splits[i][j] != 'R') { union(parent, idx + 0, idx + 1); union(parent, idx + 2, idx + 3); } if (i + 1 < n) { union(parent, idx + 2, getElement(i + 1, j, n) + 0); } if (j + 1 < n) { union(parent, idx + 1, getElement(i, j + 1, n) + 3); } if (i > 0) { union(parent, idx + 0, getElement(i - 1, j, n) + 2); } if (j > 0) { union(parent, idx + 3, getElement(i, j - 1, n) + 1); } } } int count = 0; for (int i = 0; i < parent.length; i++) { if (find(parent, i) == i) { count++; } } return count; } static int getElement(int i, int j, int n) { return (i * n * 4) + (j * 4); } static int find(int parent[], int idx) { int root = idx; while (parent[root] != root) { root = parent[root]; } while (parent[idx] != idx) { int temp = idx; idx = parent[idx]; parent[temp] = root; } return root; } static void union(int parent[], int x, int y) { parent[find(parent, x)] = find(parent, y); } }
07cd23178812dc0f02d255d3a4b244bdf522417c
04178323a2f54947fae5a792ebbdb47037c49658
/src/main/java/lk/ijse/dep/web/business/custom/impl/OrderBOmpl.java
d601d3d48df223d94e435defdccfca30bd35663a
[]
no_license
dep-6-playground/layerd-architecture-pos
be92af554784ae5416ba1e79108cd55ce6bee7d6
5653ce8ec681f1390d570c394d724714a606cd08
refs/heads/master
2023-03-02T23:33:29.612844
2021-01-19T00:32:29
2021-01-19T00:32:29
334,323,612
0
0
null
null
null
null
UTF-8
Java
false
false
3,312
java
package lk.ijse.dep.web.business.custom.impl; import lk.ijse.dep.web.business.custom.OrderBO; import lk.ijse.dep.web.dao.DAOTypes; import lk.ijse.dep.web.dao.DaoFactory; import lk.ijse.dep.web.dao.custom.ItemDAO; import lk.ijse.dep.web.dao.custom.OrderDAO; import lk.ijse.dep.web.dao.custom.OrderDetailDAO; import lk.ijse.dep.web.dto.OrderDTO; import lk.ijse.dep.web.entity.Item; import lk.ijse.dep.web.entity.Order; import lk.ijse.dep.web.entity.OrderDetail; import java.sql.Connection; import java.sql.Date; import java.util.List; import java.util.stream.Collectors; /** * @author : Deshan Charuka <[email protected]> * @since : 2021-01-18 **/ public class OrderBOmpl implements OrderBO { private OrderDAO orderDAO; private OrderDetailDAO orderDetailDAO; private ItemDAO itemDAO; private Connection connection; public OrderBOmpl() { orderDAO = DaoFactory.getInstance().getDAO(DAOTypes.ORDER); itemDAO = DaoFactory.getInstance().getDAO(DAOTypes.ITEM); orderDetailDAO = DaoFactory.getInstance().getDAO(DAOTypes.ORDER_DETAIL); } @Override public void setConnection(Connection connection) throws Exception { this.connection = connection; orderDAO.setConnection(connection); itemDAO.setConnection(connection); orderDetailDAO.setConnection(connection); } @Override public boolean placeOrder(OrderDTO dto) throws Exception { connection.setAutoCommit(false); try { boolean result = false; /* 1. Saving the order */ result = orderDAO.save(new Order(dto.getOrderId(), Date.valueOf(dto.getOrderDate()), dto.getCustomerId())); if (!result) { throw new RuntimeException("Failed to complete the transaction"); } /* 2. Saving Order Details -> Updating the stock */ List<OrderDetail> orderDetails = dto.getOrderDetails().stream(). map(detail -> new OrderDetail(dto.getOrderId(), detail.getItemCode(), detail.getQty(), detail.getUnitPrice())) .collect(Collectors.toList()); for (OrderDetail orderDetail : orderDetails) { result = orderDetailDAO.save(orderDetail); if (!result) { throw new RuntimeException("Failed to complete the transaction"); } /* 3. Let's update the stock */ Item item = itemDAO.get(orderDetail.getOrderDetailPK().getItemCode()); if (item.getQtyOnHand() - orderDetail.getQty() < 0) { throw new RuntimeException("Invalid stock"); } item.setQtyOnHand(item.getQtyOnHand() - orderDetail.getQty()); result = itemDAO.update(item); if (!result) { throw new RuntimeException("Failed to complete the transaction"); } } connection.commit(); return true; } catch (Throwable t) { connection.rollback(); throw t; } finally { connection.setAutoCommit(true); } } @Override public List<OrderDTO> searchOrdersByCustomerName(String name) throws Exception { return null; } }
8277abb3bc040956bfdca50af584a9a1038740fe
54154fba534babb671fe2a7897bd951d60eb14ed
/src/Chapter11/collection/treemap/Member.java
125d26bb57e0827a6cd3cdde3576d3c9546c83c7
[]
no_license
scl2589/java-study
d38c64801717ce62d81fd507c31f3ddfd506fe52
782d47319582b586a3571561279d84069872d8f1
refs/heads/master
2023-04-20T02:58:13.371932
2021-05-10T02:01:20
2021-05-10T02:01:20
362,036,244
1
0
null
null
null
null
UTF-8
Java
false
false
710
java
package Chapter11.collection.treemap; public class Member { private int memberId; private String memberName; public Member() {} public Member(int memberId, String memberName) { this.memberId = memberId; this.memberName = memberName; } public int getMemberId() { return memberId; } public void setMemberId(int memberId) { this.memberId = memberId; } public String getMemberName() { return memberName; } public void setMemberName(String memberName) { this.memberName = memberName; } public String toString() { return memberName + "회원님의 아이디는 " + memberId + "입니다."; } }