blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
35bdfb840a21bbb8da78a1b3a8e478684fabcc9b
b8dbb2575b0bc06056acf739ddec0d258cf28227
/src/gravitacija/Prepreke.java
0addf61996d286bd8c204bd8fc0e1376186ae882
[ "MIT" ]
permissive
Emenghost/GSwitch
d9cfc4d78f5d5d5e91f546dfb086135f57a01a7e
2973288a2704e58f39b77d0d6892c7865c0f455d
refs/heads/master
2023-03-15T23:46:46.029717
2017-12-14T09:47:28
2017-12-14T09:47:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,710
java
package gravitacija; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; public class Prepreke { /* konstruktor */ public Prepreke(int pozicija){ vidljiva = true; this.pozicija = pozicija; } /* slika donju prepreku */ public void slikajdole(Graphics g){ if(vidljiva) g.drawImage(donjaPrepreka,pozicija,koordinataDonje,sirinaPrepreke,visinaPrepreke,null); } /* slika gornju prepreku */ public void slikajgore(Graphics g){ if(vidljiva) g.drawImage(gornjaPrepreka,pozicija,koordinataGornje,sirinaPrepreke,visinaPrepreke,null); } /* pomera prepreku po "X" koordinatama */ public void pomeriPrepreku(){ this.pozicija--; if(pozicija == -40) vidljiva = false; } /*Geteri i Seteri*/ public int getPozicija() { return pozicija; } public void setPozicija(int pozicija) { this.pozicija = pozicija; } public boolean isVidljiva() { return vidljiva; } public void setVidljiva(boolean vidljiva) { this.vidljiva = vidljiva; } private int pozicija; // Pozicija prepreke protected Image donjaPrepreka = Toolkit.getDefaultToolkit().getImage("slike/prepreke/donja.gif"); // Slika donje prepreke protected Image gornjaPrepreka = Toolkit.getDefaultToolkit().getImage("slike/prepreke/gornja.gif"); // Slika gornje prepreke private final int koordinataDonje = 350; // "Y" donje koordinata prepreke private final int koordinataGornje = 150; // "Y" gornje koordinata prepreke private final int sirinaPrepreke = 40; // Sirina prepreke private final int visinaPrepreke = 40; // Visina prepreke private boolean vidljiva; // Da li je vidjiva }
[ "skantar12@gmail.com" ]
skantar12@gmail.com
36b2f3ca695e7e1f3e3610f1df0097d777a1133d
8638a2efe2168eaa536bd89ca5f6b87927d17118
/Atcoder/ABC60/RandomGenerator/Main.java
e5ecc9656f26c6d9f3d741f79dbf6bd2c09e89f5
[]
no_license
Simply-divine/Competitive
5c5e6418ddaceb8fae3c643a2e120b23a256b67c
0a7e720322a57fd95cff0d796640ac69a6f45cdc
refs/heads/master
2022-12-26T21:32:04.483818
2020-04-18T15:52:40
2020-04-18T15:52:40
256,789,554
1
1
null
2020-10-01T06:37:57
2020-04-18T15:37:30
C++
UTF-8
Java
false
false
959
java
import java.io.*; import java.util.*; public class Main{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ try{ while(st==null||!st.hasMoreElements()){ st = new StringTokenizer(br.readLine()); } }catch(Exception e){ e.printStackTrace(); } return st.nextToken(); } public int nextInt(){ return Integer.parseInt(next()); } public long nextLong(){ return Long.parseLong(next()); } public double nextDouble(){ return Double.parseDouble(next()); } public String nextLine(){ String s = ""; try{ s = br.readLine(); }catch(Exception e){ e.printStackTrace(); } return s; } } public static void main(String[] args){ FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); out.flush(); out.close(); } }
[ "hardikvu0204@gmail.com" ]
hardikvu0204@gmail.com
b30801375284c1b194357725b1eee47feef3f348
6654423f2d38204cbe86e05957d0012be8dd5073
/3- Strategy Design Pattern/src/Dog.java
7bf520085235aa3df1e3fcdd1b4888a411deaf39
[]
no_license
musichopin/Derek-Banas_Design-Patterns
110cc5cfe1af595a247dcd286bf8875cfe046ac1
d3561a613356b75a85261698d5c3cac6939e2a57
refs/heads/master
2021-01-16T21:03:56.294873
2019-02-13T20:09:35
2019-02-13T20:09:35
59,821,814
1
1
null
null
null
null
UTF-8
Java
false
false
751
java
public class Dog extends Animal{ public void digHole(){ System.out.println("Dug a hole"); } public Dog(){ super(); setSound("Bark"); // We set the Flys interface polymorphically // This sets the behavior as a non-flying Animal flyingType = new CantFly(); // polymorphism } /* BAD * You could override the fly method, but we are breaking * the rule that we need to abstract what is different to * the subclasses. we need to continue to abstract out what * is different and put just those things that are different * inside of the classes. public void fly(){ System.out.println("I can't fly"); } *It would be also wrong to implement abstract fly method *for creating duplicates */ }
[ "merepianist@hotmail.com" ]
merepianist@hotmail.com
2f360b20e66d0d27bcc6481fda926bdeac02e847
55de95d91949317699659cd2c11bbfc921ed11a5
/design-patterns/src/main/java/com/cui/behavior/ovserver/Clients.java
f875db650174a3b73b905d5e420fa5c29e59cd3f
[ "Apache-2.0" ]
permissive
Common-zhou/wang-wen-jun
b4d9e30f5112ceeb88de445cb13117cb0f208d8e
c76aa1f276ec97ac551928c6bb1e7e3b1abb83d9
refs/heads/master
2023-08-17T18:58:47.476291
2021-09-17T08:47:25
2021-09-17T08:47:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.cui.behavior.ovserver; /** * @description: 客户端测试 * @date: 2020/7/18 21:48 * @author: wei·man cui */ public class Clients { public static void main(String[] args) { //定义观察目标对象 AllyControlCenter acc; acc = new ConcreteAllyControlCenter("金庸群侠"); //定义四个观察者对象 Observer player1, player2, player3, player4; player1 = new Player("杨过"); acc.join(player1); player2 = new Player("令狐冲"); acc.join(player2); player3 = new Player("张无忌"); acc.join(player3); player4 = new Player("段誉"); acc.join(player4); //某成员遭受攻击 player1.beAttacked(acc); } }
[ "daocaoren22222@163.com" ]
daocaoren22222@163.com
2c9f4905eed3d7c92c39d3476fa4d41fa1945c2d
0907c886f81331111e4e116ff0c274f47be71805
/sources/com/mopub/mraid/MraidCommandException.java
c022597eb866a5c4f27f83b0c2871cf43385d183
[ "MIT" ]
permissive
Minionguyjpro/Ghostly-Skills
18756dcdf351032c9af31ec08fdbd02db8f3f991
d1a1fb2498aec461da09deb3ef8d98083542baaf
refs/heads/Android-OS
2022-07-27T19:58:16.442419
2022-04-15T07:49:53
2022-04-15T07:49:53
415,272,874
2
0
MIT
2021-12-21T10:23:50
2021-10-09T10:12:36
Java
UTF-8
Java
false
false
332
java
package com.mopub.mraid; class MraidCommandException extends Exception { MraidCommandException() { } MraidCommandException(String str) { super(str); } MraidCommandException(String str, Throwable th) { super(str, th); } MraidCommandException(Throwable th) { super(th); } }
[ "66115754+Minionguyjpro@users.noreply.github.com" ]
66115754+Minionguyjpro@users.noreply.github.com
c4968af63940f70f1d045db207522cb14640c006
89658d5dd81a87be6a072942f4c95e5a0cd05487
/java-Deignpattern/src/com/aravinthrajchakkaravarthy/creationaldesignpattern/factorypatteren/AreaOfShapes.java
93fa44c47d5cc57480fdeb6b9308123cb0e7be19
[ "MIT" ]
permissive
586083/java-Design-pattern
ce89bb348c99612496add8818c0e3006908e986d
3b2bf0631e0106d28748d15cecb16281b87b662f
refs/heads/master
2022-10-06T12:26:57.229981
2020-06-11T12:35:22
2020-06-11T12:35:22
268,429,880
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.aravinthrajchakkaravarthy.creationaldesignpattern.factorypatteren; /** * Abstract Method which is used for create of object * * */ public abstract class AreaOfShapes { abstract void printAreaFormulae(); public AreaOfShapes() { System.out.println("In Area of Shapes"); } }
[ "aravinthraj.91@gmail.com" ]
aravinthraj.91@gmail.com
44004c13b74cb48ddd8961779152b8f00c6c3e17
b77818b29a5f71b2564d01aa491a16a22e74939a
/Spring5-JavaAnnotationssComponent/src/main/java/com/cybertek/services/Java.java
d564f7bc07baa17f0ca282d5810610cc33202551
[]
no_license
karinatech/spring-kd
c51abed2ec52ceef85b8d2bf02041f12a3203479
7a90774606bc6d0da22a650bae15fdad1d8e2e06
refs/heads/main
2023-03-21T10:44:54.180438
2021-02-08T00:24:04
2021-02-08T00:24:04
304,911,117
0
0
null
2021-02-08T00:24:06
2020-10-17T15:41:08
JavaScript
UTF-8
Java
false
false
287
java
package com.cybertek.services; import com.cybertek.interfaces.Course; import org.springframework.stereotype.Component; @Component public class Java implements Course { @Override public void getTeachingHours() { System.out.println("Weekly Teaching Hours : "); } }
[ "karinaminty@gmail.com" ]
karinaminty@gmail.com
6dd3f7c1acc41e22643e9ce46405206b66929af9
4d3f389f4fbb8391bae0264dee39e5fa99bf1b91
/src/DemoAndroidpn.java
69ab4b036e76dd5636d4f85fe4e8d2f52d7c1286
[]
no_license
CallMeSp/M_Push_server
634aad9d1840a24beed107d176c73f982f5b8221
fc1f8fcc62ed0fbd2d4c8f3e22ba9d55e5e1addc
refs/heads/master
2021-01-17T21:20:55.730014
2017-04-06T15:44:29
2017-04-06T15:49:21
84,176,333
1
2
null
null
null
null
UTF-8
Java
false
false
627
java
import org.androidpn.server.xmpp.push.NotificationManager; // // DemoAndroidpn.java // FeOA // // Created by LuTH on 2012-3-26. // Copyright 2012 flyrise. All rights reserved. // public class DemoAndroidpn { public static void main(String[] args) { String apiKey = "1234567890"; String title = "feoa"; String message = "Hello World!"; String uri = "http://www.baidu.com"; NotificationManager notificationManager = new NotificationManager(); //notificationManager.sendBroadcast(apiKey, title, message, uri); // notificationManager.sendNotifcationToUser(apiKey, username, title, // message, uri); } }
[ "995199235@qq.com" ]
995199235@qq.com
b9bfba9476e3c01a2be437988beda5c4001002a7
11cc2f89929f73d981194835084ab464c0e7ec73
/src/main/java/com/baldyoung/vita/merchant/service/MBillServiceImpl.java
aa1de95df7790c730bcd85d8dc9c20e8add52111
[]
no_license
baldyoung/vita
a7002995eb6b6141a54f9043e89e3679e2e90bfc
83a03f982e32030d2bab5312dd36d07e761bffc4
refs/heads/master
2022-11-28T15:55:59.522754
2020-06-27T00:09:18
2020-06-27T00:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,987
java
package com.baldyoung.vita.merchant.service; import com.baldyoung.vita.common.dao.BillDao; import com.baldyoung.vita.common.dao.DiningRoomDao; import com.baldyoung.vita.common.pojo.dto.bill.MBillDto; import com.baldyoung.vita.common.pojo.dto.order.MOrderDto; import com.baldyoung.vita.common.pojo.dto.orderItem.MOrderItemDto; import com.baldyoung.vita.common.pojo.entity.BillCountInfoEntity; import com.baldyoung.vita.common.pojo.entity.BillEntity; import com.baldyoung.vita.common.pojo.entity.DiningRoomEntity; import com.baldyoung.vita.common.pojo.exception.serviceException.ServiceException; import com.baldyoung.vita.common.service.impl.BillServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Date; import java.util.LinkedList; import java.util.List; import static com.baldyoung.vita.common.pojo.enums.serviceEnums.ServiceExceptionEnum.BILL_NO_FOUND; import static com.baldyoung.vita.common.pojo.enums.serviceEnums.ServiceExceptionEnum.ILLEGAL_OPERATION; import static com.baldyoung.vita.common.utility.CommonMethod.isEmpty; import static com.baldyoung.vita.common.utility.CommonMethod.isEmptyCollection; @Service public class MBillServiceImpl { @Autowired private BillDao billDao; @Autowired private MOrderServiceImpl mOrderService; @Autowired private BillServiceImpl billService; @Autowired private DiningRoomDao diningRoomDao; /** * 获取指定就餐位的账单详情 * @param roomId * @return */ public MBillDto getBillInfo(Integer roomId) throws ServiceException { String billNumber = billService.getRoomBillNumberWithoutCreate(roomId); if (isEmpty(billNumber)) { throw new ServiceException(BILL_NO_FOUND); } return getBillInfo(billNumber); } /** * 获取指定就餐位的账单详情 * @param billNumber * @return */ public MBillDto getBillInfo(String billNumber) { BillEntity billEntity = billDao.selectBill(billNumber); MBillDto dto = new MBillDto(); dto.setBillCustomerNumber(billEntity.getBillCustomerNumber()); dto.setBillEndDateTime(billEntity.getBillEndDateTime()); dto.setBillId(billEntity.getBillId()); dto.setBillNumber(billEntity.getBillNumber()); dto.setBillOrderQuantity(billEntity.getBillOrderQuantity()); dto.setBillOwnerId(billEntity.getBillOwnerId()); dto.setBillOwnerName(billEntity.getBillOwnerName()); dto.setBillOwnerTypeFlag(billEntity.getBillOwnerTypeFlag()); dto.setBillReceivedAmount(billEntity.getBillReceivedAmount()); dto.setBillReceivedDateTime(billEntity.getBillReceivedDateTime()); dto.setBillRecentHandlerId(billEntity.getBillRecentHandlerId()); dto.setBillRecentHandlerName(billEntity.getBillRecentHandlerName()); dto.setBillRemarks(billEntity.getBillRemarks()); dto.setBillStartDateTime(billEntity.getBillStartDateTime()); dto.setBillTotalAmount(billEntity.getBillTotalAmount()); dto.setBillCustomerName(billEntity.getBillCustomerName()); dto.setOrderList(mOrderService.getAllOrderInRoom(billNumber)); return dto; } /** * 修改帐单信息 * @param entity */ public void updateBillInfo (BillEntity entity) { billDao.updateBillEntity(entity); } /** * 账单结账 * @param billNumber * @param totalAmount * @param receiveAmount */ public void settleAccount (String billNumber, BigDecimal totalAmount, BigDecimal receiveAmount, String remarks) throws ServiceException { BillEntity bill = billDao.selectBill(billNumber); if (null == bill || null == bill.getBillId()) { return; } Date newDate = new Date(); BillEntity newBill = new BillEntity(); newBill.setBillId(bill.getBillId()); if (null == bill.getBillTotalAmount() || (0 == bill.getBillTotalAmount().compareTo(new BigDecimal(0))) ) { newBill.setBillTotalAmount(totalAmount); } if (null != bill.getBillReceivedAmount()) { throw new ServiceException(ILLEGAL_OPERATION); } newBill.setBillReceivedAmount(receiveAmount); newBill.setBillEndDateTime(newDate); if (null != receiveAmount) { newBill.setBillReceivedDateTime(newDate); } newBill.setBillRemarks(remarks); billDao.updateBillEntity(newBill); DiningRoomEntity room = new DiningRoomEntity(); room.setDiningRoomId(bill.getBillOwnerId()); room.setCurrentBillNumber(""); diningRoomDao.updateDiningRoom(room); billService.deleteBillNumberBuffer(bill.getBillOwnerId()); setAllProductItemToFinish(billNumber); } /** * 统计指定条件下的账单数量 * @param diningRoomName * @param zeroFlag * @param unPay * @param finishFlag * @return */ public Integer getBillNumberWithCondition(String diningRoomName, Boolean zeroFlag, Boolean unPay, Boolean finishFlag) { return billDao.countWithCondition(diningRoomName, zeroFlag, unPay, finishFlag); } /** * 筛选符合条件的账单 * @param diningRoomName * @param zeroFlag * @param unPay * @param finishFlag * @param startIndex * @param maxSize * @return */ public List<BillEntity> getBillListWithCondition(String diningRoomName, Boolean zeroFlag, Boolean unPay, Boolean finishFlag, Integer startIndex, Integer maxSize) { List<BillEntity> result = billDao.selectWithCondition(diningRoomName, zeroFlag, unPay, finishFlag, startIndex, maxSize); return result; } /** * 获取当前所有账单的统计情况 * @return */ public BillCountInfoEntity getBillCountInfo() { BillCountInfoEntity entity = billDao.countAllBillCountInfo(); BillCountInfoEntity temp = billDao.countZeroBillNumber(); entity.setZeroBillNumber(temp.getZeroBillNumber()); temp = billDao.countUnPayBillCountInfo(); entity.setUnPayBillNumber(temp.getUnPayBillNumber()); entity.setTotalUnReceive(temp.getTotalUnReceive()); return entity; } /** * 将指定账单下所有未完成的商品项设置为已完成 * @param billNumber */ public void setAllProductItemToFinish(String billNumber) { List<MOrderDto> orderList = mOrderService.getAllOrderInRoom(billNumber); if (isEmptyCollection(orderList)) { return; } List<Integer> orderProductItemIdList = new LinkedList(); for (MOrderDto order : orderList) { List<MOrderItemDto> itemList = order.getItemList(); if (isEmptyCollection(itemList)) { continue; } for (MOrderItemDto item : itemList) { if (item.getOrderProductItemStatusFlag() == null) { continue; } int status = item.getOrderProductItemStatusFlag().intValue(); // 收集状态为“待确定”和“待发货”的商品项编号 if (0 == status || 2 == status) { orderProductItemIdList.add(item.getOrderProductItemId()); } } } if (!isEmptyCollection(orderProductItemIdList)) { mOrderService.setOrderProductItemToFinish(orderProductItemIdList); } } }
[ "791178881@qq.com" ]
791178881@qq.com
72c3e538fbcae24252fc4deeaa0066fdec978cc4
204dad31a76c313963ae88a955a5e0901ecc8154
/app/src/main/java/reclamation/dev/com/reclamation20/MapActivity.java
4b163769613a8bc82e4679eed2e21edd2b7c03d3
[]
no_license
ahmedhamzaoui/Reclamation2.0
67be077842379502d02ba61937f08cbce84fd653
7ff2f674de39adb645976a36949194edcdb106ce
refs/heads/master
2020-04-17T01:02:24.673231
2019-01-18T05:40:58
2019-01-18T05:40:58
166,073,109
0
0
null
null
null
null
UTF-8
Java
false
false
10,158
java
package reclamation.dev.com.reclamation20; import android.location.Location; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.mapbox.android.core.location.LocationEngine; import com.mapbox.android.core.location.LocationEngineListener; import com.mapbox.android.core.location.LocationEnginePriority; import com.mapbox.android.core.location.LocationEngineProvider; import com.mapbox.android.core.permissions.PermissionsListener; import com.mapbox.android.core.permissions.PermissionsManager; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin; import com.mapbox.mapboxsdk.plugins.locationlayer.modes.CameraMode; import com.mapbox.mapboxsdk.plugins.locationlayer.modes.RenderMode; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import reclamation.dev.com.reclamation20.MyModels.Post; import reclamation.dev.com.reclamation20.Utils.ButtomNavigationHelper; public class MapActivity extends AppCompatActivity implements OnMapReadyCallback, LocationEngineListener, PermissionsListener, MapboxMap.OnMapClickListener{ BottomNavigationView navigation; private static final int ACTIVITY_NUM = 1; private MapView mapView; private MapboxMap map; private PermissionsManager permissionsManager; private LocationEngine locationEngine; private LocationLayerPlugin locationLayerPlugin; private Location originLocation; private Point originPosition; private Marker destinationMarker; ArrayList<Post> posts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); navigation = (BottomNavigationView) findViewById(R.id.bottomNavViewBar); ButtomNavigationHelper.setupButtomNavigationView(navigation); ButtomNavigationHelper.enableNavigation(MapActivity.this, this, navigation); Menu menu = navigation.getMenu(); MenuItem menuItem = menu.getItem(ACTIVITY_NUM); menuItem.setChecked(true); Mapbox.getInstance(this, getString(R.string.access_token)); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); getPosts(); } @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; map.addOnMapClickListener(this); enableLocation(); initializeLocationLayer(); } private void enableLocation(){ if(PermissionsManager.areLocationPermissionsGranted(this)){ //do stuff initializeLocationEngine(); initializeLocationLayer(); }else { permissionsManager = new PermissionsManager(this); permissionsManager.requestLocationPermissions(this); } } @SuppressWarnings("MissingPermission") private void initializeLocationEngine(){ locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable(); locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY); locationEngine.activate(); Location lastLocation = locationEngine.getLastLocation(); if(lastLocation != null){ originLocation = lastLocation; setCameraPosition(lastLocation); }else { locationEngine.addLocationEngineListener(this); } } @SuppressWarnings("MissingPermission") private void initializeLocationLayer(){ locationLayerPlugin = new LocationLayerPlugin(mapView, map, locationEngine); locationLayerPlugin.setLocationLayerEnabled(true); locationLayerPlugin.setCameraMode(CameraMode.TRACKING); locationLayerPlugin.setRenderMode(RenderMode.NORMAL); } private void setCameraPosition(Location location){ map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()),13.0)); } @Override @SuppressWarnings("MissingPermission") public void onConnected() { locationEngine.requestLocationUpdates(); } @Override public void onLocationChanged(Location location) { if(location != null){ originLocation = location; setCameraPosition(location); } } @Override public void onExplanationNeeded(List<String> permissionsToExplain) { } @Override public void onPermissionResult(boolean granted) { if(granted){ enableLocation(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults); } @Override @SuppressWarnings("MissingPermission") protected void onStart() { super.onStart(); if(locationEngine != null){ locationEngine.removeLocationUpdates(); } if(locationLayerPlugin != null){ locationLayerPlugin.onStart(); } mapView.onStart(); } @Override protected void onResume() { super.onResume(); mapView.onResume(); } @Override protected void onPause() { super.onPause(); mapView.onPause(); } @Override protected void onStop() { super.onStop(); if(locationEngine != null){ locationEngine.removeLocationUpdates(); } if(locationLayerPlugin != null){ locationLayerPlugin.onStop(); } mapView.onStop(); } @Override public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { super.onSaveInstanceState(outState, outPersistentState); mapView.onSaveInstanceState(outState); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } @Override protected void onDestroy() { super.onDestroy(); if(locationEngine != null){ locationEngine.deactivate(); } mapView.onDestroy(); } @Override public void onMapClick(@NonNull LatLng point) { //destinationMarker = map.addMarker(new MarkerOptions().position(point)); //originPosition = Point.fromLngLat(originLocation.getLongitude(), originLocation.getLatitude()); } private void getPosts(){ posts = new ArrayList<>(); RequestQueue mQueue = Volley.newRequestQueue(MapActivity.this); StringRequest stringRequest = new StringRequest( Request.Method.GET, Constants.URL_PUBLICATIONS, new Response.Listener<String>() { @Override public void onResponse(String response) { System.out.println("response "+response); try { JSONArray jsonArray = new JSONArray(response); for(int i=0;i<jsonArray.length();i++){ Post post = new Post(); post.setDescription(((JSONObject)jsonArray.get(i)).get("description").toString()); post.setTag(((JSONObject)jsonArray.get(i)).get("tag").toString()); post.setTitre(((JSONObject)jsonArray.get(i)).get("titre").toString()); post.setUserid(Integer.parseInt(((JSONObject)jsonArray.get(i)).get("userid").toString())); post.setLat(Double.parseDouble(((JSONObject)jsonArray.get(i)).get("lat").toString())); post.setLng(Double.parseDouble(((JSONObject)jsonArray.get(i)).get("lng").toString())); //System.out.println("publication "+ publication); System.out.println(post); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { Marker marker = mapboxMap.addMarker(new MarkerOptions() .position(new LatLng((post.getLat()), post.getLng())) .title(post.getTitre()) .snippet(post.getTag())); } }); posts.add(post); } System.out.println("publicationList "+posts); } catch (JSONException e) { e.printStackTrace(); } } } , new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { System.out.println("That didn't work ! " + error); } }); RequestQueue queue = Volley.newRequestQueue(MapActivity.this); queue.add(stringRequest); } }
[ "36207059+ahmedhamzaoui@users.noreply.github.com" ]
36207059+ahmedhamzaoui@users.noreply.github.com
31ecbd56bb519875e4eff002362150c8906fdaad
06a06a75c59c516db98fe929417f9c4684e85ca3
/app/src/main/java/com/example/android/musicalstructure/MainActivity.java
4361da0f50595cbb474202c00ef5ef1f20abbd3b
[]
no_license
lenardmulholland/MusicalStructure
3e996195e60ee704a630a8563fb2559957d2dbbc
02b724e51db30ea0ce952fd963ff28708082ee13
refs/heads/master
2020-03-20T18:58:10.987145
2018-06-16T22:23:02
2018-06-16T22:23:02
137,613,941
1
0
null
null
null
null
UTF-8
Java
false
false
3,235
java
package com.example.android.musicalstructure; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ArrayList<Song> songs = new ArrayList<>(); songs.add(new Song("Moonlight Sonata", "Ludwig van Beethoven", "7:27")); songs.add(new Song("Für Elise", "Ludwig van Beethoven", "3:04")); songs.add(new Song("5th Symphony", "Ludwig van Beethoven", "7:43")); songs.add(new Song("Eine Kleine Nachtmusik", "Wolfgang Amadeus Mozzart", "5:42")); songs.add(new Song("Turkish March", "Wolfgang Amadeus Mozzart", "2:21")); songs.add(new Song("Requiem: Lacrimosa", "Wolfgang Amadeus Mozzart", "3:18")); songs.add(new Song("Le Nozze di Figaro", "Wolfgang Amadeus Mozzart", "4:28")); songs.add(new Song("Toccata and Fugue in D Minor", "Johann Sebastian Bach", "2:59")); songs.add(new Song("Jesu, Joy of Man's Desiring", "Johann Sebastian Bach", "3:29")); songs.add(new Song("Goldberg Variations BMV 988: 1. Aria", "Johann Sebastian Bach", "4:41")); songs.add(new Song("Air on the G String", "Johann Sebastian Bach", "2:36")); songs.add(new Song("Largo from Xerxes", "Georg Friedrich Händel", "5:50")); songs.add(new Song("Organ Concerto Op. 7, No: 4: 1. Adagio", "Georg Friedrich Händel", "6:29")); songs.add(new Song("Hallelujah Chorus", "Georg Friedrich Händel", "4:23")); songs.add(new Song("Swan Lake", "Pyotr Ilyich Tchaikovsky", "3:15")); songs.add(new Song("Waltz of the Flowers", "Pyotr Ilyich Tchaikovsky", "7:01")); songs.add(new Song("Serenade for Strings in C, Op.48 - 2. Valse", "Pyotr Ilyich Tchaikovsky", "3:52")); songs.add(new Song("Minute Waltz", "Frédéric Chopin", "2:37")); songs.add(new Song("Grande Valse Brillante", "Frédéric Chopin", "5:29")); songs.add(new Song("Nocturne No.2 in E Flat, Op. 9 No. 2", "Frédéric Chopin", "3:57")); songs.add(new Song("Raindrop Prélude", "Frédéric Chopin", "4:57")); SongAdapter adapter = new SongAdapter(this, songs); final ListView listView = (ListView) findViewById(R.id.list); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Song selectedItem = (Song) listView.getItemAtPosition(position); final Bundle extra = new Bundle(); extra.putSerializable(NowPlayingActivity.SONG_INFO, selectedItem); Intent nowPlayingIntent = new Intent (view.getContext(), NowPlayingActivity.class); nowPlayingIntent.putExtras(extra); view.getContext().startActivity(nowPlayingIntent); } }); } }
[ "lenardmulholland@gmail.com" ]
lenardmulholland@gmail.com
8bcf5fbe5956c69543521003dc9d3b587cc5964b
c0930ffdd17da708eb70113a428258537e350cc5
/RECUPERACION/Programacion/Ficheros/B2/src/v1/Main.java
f659a68e67433cf2a68fcb4308386dbb24dc62a2
[]
no_license
fartorr0810/Clases1DawB
d1a4b4ec9ba4e1838937648c9b858e742b8b7454
8bc23913afbd4d464cab8bde61f480cf69b3ac72
refs/heads/master
2023-06-03T01:56:59.406771
2021-06-18T08:34:24
2021-06-18T08:34:24
302,466,497
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package v1; public class Main { public static void main(String[] args) { try { cargarDatos(".\\ficheros\\gratuidadlibrosdetextoandalucia.csv"); } catch (Exception e) { System.out.println(e.getMessage()); } } }
[ "xXxArroyoxXx" ]
xXxArroyoxXx
2b239263993a596e3bc68164527c9f9e7f7b3a6c
be994f700995a7e3a809509a2af46cadd01aafb4
/app/src/main/java/com/kinga/meritraknare_material/ChooseProgramActivity.java
a7b25847aeb866211b5565b476063f4bd59f5763
[]
no_license
abdusalamApps/MeritRaknareMaterial
1996c4ca4fcc76692169d4be4cd53819797c91b7
7d008a0437b0f2b0a88c4a418653e1338a8e3572
refs/heads/master
2020-04-18T23:12:09.220717
2019-01-27T14:01:56
2019-01-27T14:01:56
167,815,320
0
0
null
null
null
null
UTF-8
Java
false
false
3,843
java
package com.kinga.meritraknare_material; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; public class ChooseProgramActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_program); ListView listView = findViewById(R.id.program_listView); ArrayList<String> programs = new ArrayList<>(); programs.add(getString(R.string.ekonomiprogrammet)); programs.add(getString(R.string.estetiska_programmet)); programs.add(getString(R.string.humanistiska_programmet)); programs.add(getString(R.string.international_baccalaureate)); programs.add(getString(R.string.naturvetenskapsprogrammet)); programs.add(getString(R.string.samhallskunskapsprogrammet)); programs.add(getString(R.string.teknikprogrammet)); /* programs.add("Barn- och fritidsprogrammet"); programs.add("Bygg- och anläggningsprogrammet"); programs.add("El- och energiprogrammet"); programs.add("Fordons- och transportprogrammet"); programs.add("Handels- och administrationsprogrammet"); programs.add("Handels- och administrationsprogrammet"); programs.add("Hotell- och turismprogrammet"); programs.add("Industritekniska programmet"); programs.add("Estetiska programmet"); programs.add("Humanistiska programmet"); programs.add("International Baccalaureate"); programs.add("Naturvetenskapsprogrammet"); programs.add("Samhällsvetenskapsprogrammet"); programs.add("Teknikprogrammet");*/ ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, programs); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Intent intent = new Intent(ChooseProgramActivity.this, WelcomeActivity.class); intent.setData(Uri.parse("from chooseprogramactivity")); int programInt; switch (position){ case 0: programInt = Constants.ProgramsInts.EKONOMI; break; case 1: programInt = Constants.ProgramsInts.ESTETISK; break; case 2: programInt = Constants.ProgramsInts.HUMANISTISK; break; case 3: programInt = Constants.ProgramsInts.INTERNATIONAL; break; case 4: programInt = Constants.ProgramsInts.NATUR; break; case 5: programInt = Constants.ProgramsInts.SAMHALL; break; case 6: programInt = Constants.ProgramsInts.TEKNIK; break; default: programInt = Constants.ProgramsInts.EKONOMI; } intent.putExtra("program", programInt); startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); } }
[ "abdev@Abdevs-MacBook-Pro.local" ]
abdev@Abdevs-MacBook-Pro.local
223ab0c8eb7d553635582a1b950981441c579b4e
fd76d488c5057e4829b2d83f01370ea260d9912b
/Core/EnergyDominionCore/src/main/java/com/energy0124/energydominion/EnergyDominion.java
08c4553bf3cb0488ab442c220700dd2548152aea
[]
no_license
Energy0124/EnergyDominion
680f4931445e8eee9cca319010e5026422f8c285
263ab07e750dd6609f332f897f7fb98b48fa1326
refs/heads/master
2020-05-19T10:19:14.207419
2015-10-11T19:59:08
2015-10-11T19:59:08
13,497,109
0
0
null
null
null
null
UTF-8
Java
false
false
4,908
java
package com.energy0124.energydominion; import com.energy0124.energydominion.api.*; import com.energy0124.energydominion.core.DominionGameManager; import com.energy0124.energydominion.game.CardManager; import com.energy0124.energydominion.game.DominionCostFactory; import com.energy0124.energydominion.game.ExpansionManager; import com.energy0124.energydominion.game.GameManager; import core.DominionDeck; import core.LocalPlayer; import ro.fortsoft.pf4j.DefaultPluginManager; import ro.fortsoft.pf4j.PluginManager; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class EnergyDominion { private static PluginManager pluginManager; private static GameManager gameManager; private static CardManager cardManager; private static ExpansionManager expansionManager; private static String pluginPath = "expansions/"; private static boolean useDefaultBaseSet = true; public static void main(String[] args) { // System.out.println(System.getProperty("pf4j.pluginsDir", "plugins")); pluginManager = new DefaultPluginManager(new File(pluginPath)); // pluginManager = new DefaultPluginManager(); gameManager = new GameManager(); pluginManager.loadPlugins(); pluginManager.startPlugins(); init(); //simple test to check whether the expansion can be loaded test(pluginManager); //another test List<Player> playerList = new ArrayList(Arrays.asList(new LocalPlayer("Energy"), new LocalPlayer("Star"))); //create sample list of player Deck startingDeck = new DominionDeck(); Game testGame = gameManager.createLocalGame(playerList, startingDeck); //create a test game testGame.start(); //start the test game } private static void init() { DominionGameManager.setCostFactory(new DominionCostFactory()); } private static void test(PluginManager pm) { //todo: fix the bug that no expansion is found //may related to : // * if (type.isAssignableFrom(extensionClass) && extensionClass.isAnnotationPresent(Extension.class)) { //use debug to check List<DominionExpansion> expansions = pm.getExtensions(DominionExpansion.class); List<Card> cards = pm.getExtensions(Card.class); // List<Card> cards = pm.getExtensions(Card.class); /* for (Card card : cards) { System.out.println("--------------------------------------"); System.out.println(card.getClass().toString()); System.out.println(card.getName()); System.out.println("--------------------------------------"); } */ for (Expansion expansion : expansions) { System.out.println("--------------------------------------"); System.out.println(expansion.getClass().toString()); System.out.println(expansion.toString()); System.out.println("Name: " + expansion.getName()); if (expansion instanceof Expansion) { System.out.println("IsExpansion: True"); } System.out.println("CardList:"); System.out.println(expansion.getCardClassSet().toString()); for (Class card : expansion.getCardClassSet()) { System.out.println("**********"); System.out.println(card.getSimpleName()); try { System.out.println(card.newInstance().toString()); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } System.out.println("**********"); } System.out.println("--------------------------------------"); } for (Card card : cards) { System.out.println(card.getCardClass()); } } public static PluginManager getPluginManager() { return pluginManager; } public static void setPluginManager(PluginManager pluginManager) { EnergyDominion.pluginManager = pluginManager; } public static GameManager getGameManager() { return gameManager; } public static void setGameManager(GameManager gameManager) { EnergyDominion.gameManager = gameManager; } public static CardManager getCardManager() { return cardManager; } public static void setCardManager(CardManager cardManager) { EnergyDominion.cardManager = cardManager; } public static ExpansionManager getExpansionManager() { return expansionManager; } public static void setExpansionManager(ExpansionManager expansionManager) { EnergyDominion.expansionManager = expansionManager; } }
[ "energystar.0124@gmail.com" ]
energystar.0124@gmail.com
89e20db0eb79f84944cdb16e93be7fe8e11302e1
e3f945b9a6b24ede83bf1a72fae8769ebd17503b
/src/main/java/org/sid/controller/SubscriptionController.java
bb854c4dfe486e89e0f85bddb20d0f29f3fa9c80
[]
no_license
MraniYoussef/Biblioth-que
7a3abc2b02c70363e8fafd7956d3e3edb3131d4a
a18e9d62c00e23fe795c0d3ee8e8854877f9b407
refs/heads/master
2023-07-18T09:58:14.988247
2021-08-17T22:49:22
2021-08-17T22:49:22
397,408,460
0
0
null
null
null
null
UTF-8
Java
false
false
2,318
java
package org.sid.controller; import java.util.List; import org.sid.entities.Book; import org.sid.entities.Subscription; import org.sid.service.BookService; import org.sid.service.SubscriptionService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/subscription") public class SubscriptionController { private final SubscriptionService subscriptionService; public SubscriptionController(SubscriptionService subscriptionService) { this.subscriptionService = subscriptionService; } @GetMapping("/all") public ResponseEntity<List<Subscription>> getAllSubscriptions(){ List<Subscription> subscriptions = subscriptionService.findAllSubscriptions(); return new ResponseEntity(subscriptions, HttpStatus.OK); } @GetMapping("/find/{id}") public ResponseEntity<Subscription> getSubscriptionByIdSubscription (@PathVariable("id") Long id){ Subscription subscription = subscriptionService .findSubscriptionByIdSubscription(id); return new ResponseEntity(subscription, HttpStatus.OK); } @PostMapping("/add") public ResponseEntity<Subscription> addSubscription(@RequestBody Long idMember){ Subscription newSubscription = subscriptionService.createSubscription(idMember); return new ResponseEntity(newSubscription, HttpStatus.CREATED); } @PutMapping("/update") public ResponseEntity<Subscription> updateSubscription (@RequestBody Subscription subscription){ Subscription updateSubscription = subscriptionService .updateSubscription(subscription); return new ResponseEntity(updateSubscription, HttpStatus.OK); } @DeleteMapping("/delete/{id}") public ResponseEntity<?> deleteSubscription(@PathVariable("id") Long id){ subscriptionService.deleteSubscription(id); return new ResponseEntity(HttpStatus.OK); } }
[ "mraniyoussef3@gmail.com" ]
mraniyoussef3@gmail.com
11315f0b64e3ee692f38dccd181255c51ffc3c65
22a76a439c9208afb100a55ab7ad794b592edbd5
/src/project/pbo/states/IntroState.java
1e582e7e7e84c7e53e9373e2a4de2f83d8578e4d
[]
no_license
Ztrohub/ProjectPBO
a451499e8a1595af481c55b606a5f75310cb7729
e84d2ebbc0d714e85d54b81f39436b53341b63a1
refs/heads/master
2023-05-26T06:45:23.986864
2021-06-07T10:22:44
2021-06-07T10:22:44
359,666,977
1
0
null
null
null
null
UTF-8
Java
false
false
1,409
java
package project.pbo.states; import project.pbo.Handler; import project.pbo.gfx.Assets; import javax.sound.sampled.Clip; import java.awt.*; public class IntroState extends State{ private float alhpa = 0.1f; private int count = 0; private Clip clip; public IntroState(Handler handler) { super(handler); } @Override public void tick() { if (count < 100) alhpa += 0.01f; if (alhpa >= 1.0f){ alhpa = 1.0f; if (count < 100) count++; } if (count >= 100) alhpa -= 0.01f; if (alhpa <= 0.0f){ clip.stop(); Assets.initLogin(); State state = new LoginState(handler); state.playMusic(); State.setCurrentState(state); } } @Override public void render(Graphics g) { ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alhpa)); ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(Assets.logoSTTS, 400, 180, 250, 250, null); } @Override public void playMusic() { clip = Assets.audioIntro; clip.stop(); clip.setFramePosition(0); clip.start(); handler.setVol(clip, 0.1f); } @Override public void loadFile() { } }
[ "ztroidmail@gmail.com" ]
ztroidmail@gmail.com
db33d41b498166f38e9ef564b571d72778041dd6
324170a896c2af416f13f44d0d37615c5bdc7c3f
/lkl-mini-api/src/main/java/com/lakala/mini/dto/card/CardOrgQueryDTO.java
24ef5b12807f8bc537bc719dd275941d374fae3d
[]
no_license
wenchangwu/mini
76f1efcf55e27636ba39c02b14dd3df8c9c33343
e7725c69480ee5e6120aa6fc8c80589d11547aaa
refs/heads/master
2021-08-30T14:10:43.719415
2017-12-18T08:42:44
2017-12-18T08:42:44
114,058,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
/** * */ package com.lakala.mini.dto.card; import java.util.List; import javax.xml.bind.annotation.XmlType; import org.apache.cxf.annotations.WSDLDocumentation; import org.apache.cxf.annotations.WSDLDocumentation.Placement; import com.lakala.core.dto.BaseQueryDTO; /** * 联名卡机构查询参数对象 * @author QW * @CardOrgQueryDTO.java * @2011-4-20 下午02:35:44 */ @XmlType(name = "CardOrgQuery") @WSDLDocumentation(value = "MINI联名卡机构查询参数", placement = Placement.BINDING) public class CardOrgQueryDTO extends BaseQueryDTO { private Long[] ids; private String[] codes; private String[] names; /** * 移机规则 *@since 1.4.0 */ private List<Integer> movingRule; public Long[] getIds() { return ids; } public void setIds(Long[] ids) { this.ids = ids; } public String[] getCodes() { return codes; } public void setCodes(String[] codes) { this.codes = codes; } public String[] getNames() { return names; } public void setNames(String[] names) { this.names = names; } /** * @return the movingRule */ public List<Integer> getMovingRule() { return movingRule; } /** * @param movingRule the movingRule to set */ public void setMovingRule(List<Integer> movingRule) { this.movingRule = movingRule; } }
[ "wwc5201314" ]
wwc5201314
3d37fd9a087b9342cab9a141c81824c85921ab6e
e666a868e1536f6017624ac24c18172b5906fb56
/src/org/ulco/test/TriangleTest.java
69bbaa9cd1d441899c93c51f2ac513ed1335b470
[]
no_license
Cedricdelcroix/editorold
454d867b01e4533362b78ac4c4a19dbf74a87ff8
2d9abaf018c5f41e5ca37a65481c9ce87fb81630
refs/heads/master
2021-01-22T03:30:19.636509
2015-11-28T18:26:07
2015-11-28T18:26:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package org.ulco.test; import junit.framework.TestCase; import org.ulco.GraphicsObject; import org.ulco.Point; import org.ulco.Rectangle; import org.ulco.Triangle; public class TriangleTest extends TestCase { public void testType() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertTrue(triangle instanceof Triangle); assertTrue(triangle instanceof GraphicsObject); } public void testJson() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertEquals(triangle.toJson(), "{ type: triangle, point1: { type: point, x: 0.0, y: 0.0 }, point2: { type: point, x: 5.0, y: 2.0 }, point3: { type: point, x: 10.0, y: 4.0 } }"); } public void testCopy() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertEquals(triangle.toJson(), triangle.copy().toJson()); } }
[ "delcroix.cedric62@gmail.com" ]
delcroix.cedric62@gmail.com
065261a356e888f211330fbc079d81fb72a0ae18
bc794d54ef1311d95d0c479962eb506180873375
/posweb/src/main/java/com/keren/posweb/core/ifaces/UniteGestionManager.java
2fa14995285a85b0773c810a59a1ebfce2f862d1
[]
no_license
Teratech2018/Teratech
d1abb0f71a797181630d581cf5600c50e40c9663
612f1baf9636034cfa5d33a91e44bbf3a3f0a0cb
refs/heads/master
2021-04-28T05:31:38.081955
2019-04-01T08:35:34
2019-04-01T08:35:34
122,177,253
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.keren.posweb.core.ifaces; import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; import com.keren.posweb.model.UniteGestion; /** * Interface etendue par les interfaces locale et remote du manager * @since Tue Sep 04 17:34:18 GMT+01:00 2018 * */ public interface UniteGestionManager extends GenericManager<UniteGestion, Long> { public final static String SERVICE_NAME = "UniteGestionManager"; }
[ "bekondo_dieu@yahoo.fr" ]
bekondo_dieu@yahoo.fr
632316442ef0203b2da2ae8f9004de56f94b2a29
89f0034faac613f49edce7d86e1ca1bdffe2fbdd
/myerpGWT/src/main/java/org/adempiere/model/AdField.java
c9424ad3add6d571a4da23e56a40745cdfe40bb5
[]
no_license
qq122343779/myerpGXT
3263cbb688f92839a8354bcba87e57fba73d937d
2173e093b74c7a3699027eb7776789477699a137
refs/heads/master
2021-01-17T11:44:50.496141
2014-02-17T00:20:54
2014-02-17T00:20:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,207
java
package org.adempiere.model; import javax.persistence.*; /** * Auto-generated by: * org.adempiere.AdempiereCustomizer */ @Entity @Table(name="ad_field") public class AdField extends org.adempiere.common.ADEntityBase { private static final long serialVersionUID = 1L; private Integer adClientId; private Integer adColumnId; private Integer adFieldId; private Integer adFieldgroupId; private Integer adOrgId; private Integer adReferenceId; private Integer adReferenceValueId; private Integer adTabId; private Integer adValRuleId; private String created; private Integer createdby; private String defaultvalue; private String description; private Integer displaylength; private String displaylogic; private String entitytype; private String help; private Integer includedTabId; private String infofactoryclass; private Boolean isactive; private Boolean iscentrallymaintained; private Boolean isdisplayed; private Boolean isencrypted; private Boolean isfieldonly; private Boolean isheading; private Boolean ismandatory; private Boolean isreadonly; private Boolean issameline; private String name; private String obscuretype; private Integer seqno; private Integer sortno; private String updated; private Integer updatedby; public AdField() { } public AdField(Integer adFieldId) { this.adFieldId = adFieldId; } @Basic @Column(name="AD_CLIENT_ID", columnDefinition="INT", nullable=false) public Integer getAdClientId() { return adClientId; } public void setAdClientId(Integer adClientId) { this.adClientId = adClientId; } @Basic @Column(name="AD_COLUMN_ID", columnDefinition="INT") public Integer getAdColumnId() { return adColumnId; } public void setAdColumnId(Integer adColumnId) { this.adColumnId = adColumnId; } @Id @Column(name="AD_FIELD_ID", columnDefinition="INT") public Integer getAdFieldId() { return adFieldId; } public void setAdFieldId(Integer adFieldId) { this.adFieldId = adFieldId; } @Basic @Column(name="AD_FIELDGROUP_ID", columnDefinition="INT") public Integer getAdFieldgroupId() { return adFieldgroupId; } public void setAdFieldgroupId(Integer adFieldgroupId) { this.adFieldgroupId = adFieldgroupId; } @Basic @Column(name="AD_ORG_ID", columnDefinition="INT", nullable=false) public Integer getAdOrgId() { return adOrgId; } public void setAdOrgId(Integer adOrgId) { this.adOrgId = adOrgId; } @Basic @Column(name="AD_REFERENCE_ID", columnDefinition="INT") public Integer getAdReferenceId() { return adReferenceId; } public void setAdReferenceId(Integer adReferenceId) { this.adReferenceId = adReferenceId; } @Basic @Column(name="AD_REFERENCE_VALUE_ID", columnDefinition="INT") public Integer getAdReferenceValueId() { return adReferenceValueId; } public void setAdReferenceValueId(Integer adReferenceValueId) { this.adReferenceValueId = adReferenceValueId; } @Basic @Column(name="AD_TAB_ID", columnDefinition="INT", nullable=false) public Integer getAdTabId() { return adTabId; } public void setAdTabId(Integer adTabId) { this.adTabId = adTabId; } @Basic @Column(name="AD_VAL_RULE_ID", columnDefinition="INT") public Integer getAdValRuleId() { return adValRuleId; } public void setAdValRuleId(Integer adValRuleId) { this.adValRuleId = adValRuleId; } @Basic @Column(columnDefinition="TIMESTAMP", nullable=false) public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } @Basic @Column(columnDefinition="INT", nullable=false) public Integer getCreatedby() { return createdby; } public void setCreatedby(Integer createdby) { this.createdby = createdby; } @Basic @Column(length=2000) public String getDefaultvalue() { return defaultvalue; } public void setDefaultvalue(String defaultvalue) { this.defaultvalue = defaultvalue; } @Basic public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Basic @Column(columnDefinition="INT") public Integer getDisplaylength() { return displaylength; } public void setDisplaylength(Integer displaylength) { this.displaylength = displaylength; } @Basic @Column(length=2000) public String getDisplaylogic() { return displaylogic; } public void setDisplaylogic(String displaylogic) { this.displaylogic = displaylogic; } @Basic @Column(nullable=false, length=40) public String getEntitytype() { return entitytype; } public void setEntitytype(String entitytype) { this.entitytype = entitytype; } @Basic @Column(length=2000) public String getHelp() { return help; } public void setHelp(String help) { this.help = help; } @Basic @Column(name="INCLUDED_TAB_ID", columnDefinition="INT") public Integer getIncludedTabId() { return includedTabId; } public void setIncludedTabId(Integer includedTabId) { this.includedTabId = includedTabId; } @Basic public String getInfofactoryclass() { return infofactoryclass; } public void setInfofactoryclass(String infofactoryclass) { this.infofactoryclass = infofactoryclass; } @Basic @Column(nullable=false) public Boolean isIsactive() { return isactive; } public void setIsactive(Boolean isactive) { this.isactive = isactive; } @Basic @Column(nullable=false) public Boolean isIscentrallymaintained() { return iscentrallymaintained; } public void setIscentrallymaintained(Boolean iscentrallymaintained) { this.iscentrallymaintained = iscentrallymaintained; } @Basic @Column(nullable=false) public Boolean isIsdisplayed() { return isdisplayed; } public void setIsdisplayed(Boolean isdisplayed) { this.isdisplayed = isdisplayed; } @Basic @Column(nullable=false) public Boolean isIsencrypted() { return isencrypted; } public void setIsencrypted(Boolean isencrypted) { this.isencrypted = isencrypted; } @Basic @Column(nullable=false) public Boolean isIsfieldonly() { return isfieldonly; } public void setIsfieldonly(Boolean isfieldonly) { this.isfieldonly = isfieldonly; } @Basic @Column(nullable=false) public Boolean isIsheading() { return isheading; } public void setIsheading(Boolean isheading) { this.isheading = isheading; } @Basic public Boolean isIsmandatory() { return ismandatory; } public void setIsmandatory(Boolean ismandatory) { this.ismandatory = ismandatory; } @Basic @Column(nullable=false) public Boolean isIsreadonly() { return isreadonly; } public void setIsreadonly(Boolean isreadonly) { this.isreadonly = isreadonly; } @Basic @Column(nullable=false) public Boolean isIssameline() { return issameline; } public void setIssameline(Boolean issameline) { this.issameline = issameline; } @Basic @Column(nullable=false, length=60) public String getName() { return name; } public void setName(String name) { this.name = name; } @Basic @Column(length=3) public String getObscuretype() { return obscuretype; } public void setObscuretype(String obscuretype) { this.obscuretype = obscuretype; } @Basic @Column(columnDefinition="INT") public Integer getSeqno() { return seqno; } public void setSeqno(Integer seqno) { this.seqno = seqno; } @Basic @Column(columnDefinition="INT") public Integer getSortno() { return sortno; } public void setSortno(Integer sortno) { this.sortno = sortno; } @Basic @Column(columnDefinition="TIMESTAMP", nullable=false) public String getUpdated() { return updated; } public void setUpdated(String updated) { this.updated = updated; } @Basic @Column(columnDefinition="INT", nullable=false) public Integer getUpdatedby() { return updatedby; } public void setUpdatedby(Integer updatedby) { this.updatedby = updatedby; } }
[ "Administrator@Natural" ]
Administrator@Natural
c1343127f90cc58d68b4bd76bb6cf6a59d169a33
0741ac60786f806d8ee5eca758bb05bf22ffa13a
/src/main/java/vn/edu/vnu/uet/dkt/rest/model/semester/ListSemesterResponse.java
6f009a40e59a289c5244fb3a66547d3906fa2c34
[]
no_license
HaTu98/dkt
e4291d8b1fa94c9ca1534e7fc96f396696c6caaa
dfb10826f7e039deb9078742d8ceadbfc441a39b
refs/heads/master
2022-11-13T06:01:42.763870
2020-07-01T03:11:03
2020-07-01T03:11:03
232,301,784
0
2
null
null
null
null
UTF-8
Java
false
false
647
java
package vn.edu.vnu.uet.dkt.rest.model.semester; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; import vn.edu.vnu.uet.dkt.rest.model.PageResponse; import java.util.List; @Getter @Setter public class ListSemesterResponse { @JsonProperty(value = "SemesterResponse") List<SemesterResponse> semesterResponses; @JsonProperty(value = "Page") private PageResponse pageResponse; public ListSemesterResponse(List<SemesterResponse> semesterResponses, PageResponse pageResponse) { this.semesterResponses = semesterResponses; this.pageResponse = pageResponse; } }
[ "hatu98nd@gmail.com" ]
hatu98nd@gmail.com
3596cec9b03b11574bd03b3b81cee24d563af738
aab3c4a9a7124faad8dbf09ff802dab56fcea9d6
/src/test/java/com/grayben/riskExtractor/headingMarker/MarkedText/MarkedTextOracle.java
1bc0a7b162391637bc4b3c71e15c5eedfdc09fe4
[ "MIT" ]
permissive
grayben/10K-item-extractor
2031fc88c9001f313dabb38b9a97892d2f106b59
1a4960bfbf460dc84d93dcccdd8f34e1721756dd
refs/heads/master
2021-01-21T04:47:57.324939
2016-04-24T02:54:10
2016-04-24T02:54:10
46,213,379
0
0
null
null
null
null
UTF-8
Java
false
false
6,399
java
package com.grayben.riskExtractor.headingMarker.markedText; import com.grayben.riskExtractor.headingMarker.ElectedText; import org.apache.commons.collections4.list.SetUniqueList; import java.util.*; public class MarkedTextOracle { private ElectedText testInput; private Set<String> testExpectedOutput; protected ElectedText getTestInput(){ return this.testInput; } protected Set<String> getTestExpectedOutput(){ return Collections.unmodifiableSet(this.testExpectedOutput); } protected MarkedTextOracle(List<TextElementClass> classifiedList){ this.testInput = generateTestInput(classifiedList); generateTestExpectedOutput(classifiedList, this.testInput); } protected boolean validateResult(Set<String> result){ Set<String> expectedResult = getTestExpectedOutput(); return result.equals(expectedResult); } private void generateTestExpectedOutput(List<TextElementClass> param, ElectedText testInput) { class IndexHelper { Integer startIndex; Integer endIndex; Integer currentIndex; Boolean onSelectedContent; Map<Integer, Integer> targetIndexRanges; List<TextElementClass> elementList; IndexHelper(List<TextElementClass> elementList){ startIndex = null; endIndex = null; currentIndex = null; onSelectedContent = false; targetIndexRanges = new HashMap<>(); this.elementList = elementList; } Map<Integer, Integer> process(){ ListIterator<TextElementClass> iterator = elementList.listIterator(); while (iterator.hasNext()) { currentIndex = iterator.nextIndex(); TextElementClass elementType = iterator.next(); if (elementType.equals(TextElementClass.ELECTED_HEADING)) { encounterElectedHeading(); } else if (elementType.equals(TextElementClass.NOMINATED_HEADING)) { encounterNominatedHeading(); } } //now, check to see if there was a non-terminated target section if(startIndex != null){ //the endIndex must be null, else the section should have been closed assert endIndex == null; currentIndex = elementList.size(); completeMapEntry(); } return targetIndexRanges; } void encounterElectedHeading(){ /* if we were already in a section, we need to break off and start a new section */ if(onSelectedContent){ completeMapEntry(); } beginMapEntry(); } void encounterNominatedHeading(){ if (onSelectedContent) { completeMapEntry(); } /* assign onSelectedContent := false -> (startIndex == null & endIndex == null) */ assert startIndex == null && endIndex == null; onSelectedContent = false; } void beginMapEntry(){ //assign(startIndex) -> startIndex was null assert startIndex == null; startIndex = currentIndex; onSelectedContent = true; } void completeMapEntry(){ //if(onSelectedContent) -> startIndex is assigned assert startIndex != null; //assign(endIndex) -> endIndex was null assert endIndex == null; // index - 1 because we don't want to include the heading endIndex = currentIndex - 1; targetIndexRanges.put(startIndex, endIndex); startIndex = null; endIndex = null; } } IndexHelper indexHelper = new IndexHelper(param); Map<Integer, Integer> targetIndexRanges = indexHelper.process(); this.testExpectedOutput = constructExpectedOutput(targetIndexRanges, testInput); } protected ElectedText generateTestInput(List<TextElementClass> param){ List<String> textInput = new ArrayList<>(); SetUniqueList<Integer> nomineeIndex = SetUniqueList.setUniqueList(new ArrayList<>()); SetUniqueList<Integer> electeeIndex = SetUniqueList.setUniqueList(new ArrayList<>()); ListIterator<TextElementClass> it = param.listIterator(); while(it.hasNext()){ int index; index = it.nextIndex(); TextElementClass elementType = it.next(); String stringToAdd; stringToAdd = index + ": " + elementType.archetype(); textInput.add(stringToAdd); if(elementType.equals(TextElementClass.ELECTED_HEADING)) { nomineeIndex.add(index); electeeIndex.add(index); } else if(elementType.equals(TextElementClass.NOMINATED_HEADING)) { nomineeIndex.add(index); } } return new ElectedText( textInput, nomineeIndex, electeeIndex ); } private Set<String> constructExpectedOutput(Map<Integer, Integer> targetIndexRanges, ElectedText testInput){ Iterator<Map.Entry<Integer, Integer>> it = targetIndexRanges.entrySet().iterator(); Set<String> testExpectedOutput = new HashSet<>(); while(it.hasNext()){ Map.Entry<Integer, Integer> entry = it.next(); int startIndex = entry.getKey(); int endIndex = entry.getValue(); //endIndex + 1 because subList is exclusive of endIndex index argument List<String> subList = testInput.getStringList().subList(startIndex, endIndex + 1); StringBuilder sb = new StringBuilder(); for (String string : subList ) { sb.append(string + " "); } testExpectedOutput.add(sb.toString().replaceAll("\\s+", " ").trim()); } return testExpectedOutput; } }
[ "gray.ben.m@gmail.com" ]
gray.ben.m@gmail.com
cf2a1f23d035ab2643ef9a7bd60451a804f2dcb1
e22648f0b1a8db0569d37d1a7cef5440e27294f1
/src/main/java/com/group/service/GenerateDataService.java
d18cd60335401425b77ccb8e6f7160a13716fe73
[]
no_license
tnt123-83/advert-watcher
bdedf15f7091e6452ba21a94d7467736db8c5844
c5885b2668ed9dc842d33025d47107a0b5c8f082
refs/heads/master
2020-12-02T04:59:14.280087
2020-10-23T09:36:33
2020-10-23T09:36:33
230,896,831
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.group.service; import com.group.dto.AdvertDto; import java.util.ArrayDeque; import java.util.List; import java.util.Set; public interface GenerateDataService { void runGenerator(); ArrayDeque<AdvertDto> generateData(); Boolean isDataTransmited(); void setWorkingTaskCancelled(Boolean status); List<String> getResultTablesNames(); void setFoundAdverts(Set<AdvertDto> foundAdverts); }
[ "tnt123.833@gmail.com" ]
tnt123.833@gmail.com
8aea8d2c30d2b099941dbde6c708732a75b5291e
848a720a736b82efffa25b39c099bf0eeb45434a
/server/src/main/java/learn/collaboreat/models/User.java
caed6bd098b080c7f252aff01e1828a97a1f21b2
[]
no_license
cbarkume/CollaborEat
97a373b6ae26bfc8f19788d15b2fe57ba93a9b62
6be8aea0783e184c7929ddc9e52673db5ee5ec6a
refs/heads/main
2023-01-12T20:05:03.121203
2020-11-20T00:02:06
2020-11-20T00:02:06
311,383,721
0
0
null
null
null
null
UTF-8
Java
false
false
2,629
java
package learn.collaboreat.models; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.PositiveOrZero; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class User { @PositiveOrZero(message = "User ID must be positive or zero.") private int userId; @NotBlank(message = "First name is required.") private String firstName; @NotBlank(message = "Last name is required.") private String lastName; @NotBlank(message = "Email is required.") @Email(message = "Invalid Email") private String email; @NotBlank(message = "Password is required.") private String password; private List<Recipe> recipes = new ArrayList<>(); private List<String> roles = new ArrayList<>(); public List<String> getRoles() { return roles; } public void setRoles(List<String> roles) { this.roles = roles; } public List<Recipe> getRecipes() { return new ArrayList<>(recipes); } public void setRecipes(List<Recipe> recipes) { this.recipes = recipes; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean hasRole(String role) { if (roles == null) { return false; } return roles.contains(role); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; return userId == user.userId && Objects.equals(firstName, user.firstName) && Objects.equals(lastName, user.lastName) && Objects.equals(email, user.email) && Objects.equals(password, user.password); } @Override public int hashCode() { return Objects.hash(userId, firstName, lastName, email, password); } }
[ "ndorsett@dev-10.com" ]
ndorsett@dev-10.com
7c3a93902e2811ea9f2729f6de6d11e28f512157
9264312fe90f4810eae8ed1c8fd0854af0ac60fb
/app/src/main/java/com/ldedusoft/ldbm/model/FixingInfo.java
5c302c24df6ad10fc99387e2e54862a83f64e3fc
[]
no_license
LDedusoft/ldbmAndroid
066651f19026672a6e4e0367d8c4a4f9921360a9
2457cf0e067b7a089a1b1300a8520729fb2143b8
refs/heads/master
2020-04-12T09:32:02.844425
2016-09-19T08:27:05
2016-09-19T08:27:05
63,291,473
0
0
null
null
null
null
UTF-8
Java
false
false
1,889
java
package com.ldedusoft.ldbm.model; import java.io.Serializable; /** * 查询配件信息 * Created by wangjianwei on 2016/7/9. * {ID:id;BianHao:编号;MingCheng:名称;TuHao:图号;CangKu:仓库;KuCun:库存数量; * KuCunJinE:库存金额;KuCunJunJia:库存均价;DanWei:单位} */ public class FixingInfo implements Serializable { private int ID; private String BianHao; private String MingCheng; private String TuHao; private String CangKu; private String KuCun; private String KuCunJinE; private String KuCunJunJia; private String DanWei; public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public String getBianHao() { return BianHao; } public void setBianHao(String bianHao) { BianHao = bianHao; } public String getMingCheng() { return MingCheng; } public void setMingCheng(String mingCheng) { MingCheng = mingCheng; } public String getTuHao() { return TuHao; } public void setTuHao(String tuHao) { TuHao = tuHao; } public String getCangKu() { return CangKu; } public void setCangKu(String cangKu) { CangKu = cangKu; } public String getKuCun() { return KuCun; } public void setKuCun(String kuCun) { KuCun = kuCun; } public String getKuCunJinE() { return KuCunJinE; } public void setKuCunJinE(String kuCunJinE) { KuCunJinE = kuCunJinE; } public String getKuCunJunJia() { return KuCunJunJia; } public void setKuCunJunJia(String kuCunJunJia) { KuCunJunJia = kuCunJunJia; } public String getDanWei() { return DanWei; } public void setDanWei(String danWei) { DanWei = danWei; } }
[ "413835711@qq.com" ]
413835711@qq.com
3c85f58b362f25d218a2e8ad868e5f09c3684b9f
53a40ee0c757ae65d3be5ded19daf133a5461300
/src/ru/medev/bubble/Bullet.java
5341348d20587bdba93d1d34fe8f018aa749dfed
[]
no_license
Vurikus/BubbleShutter
05ad8a477c0090abded5f8e50f8ab1e8fbd41457
ed6e0acc2639c93d8a185610bce952c886a09762
refs/heads/master
2021-01-14T18:58:27.310580
2020-02-24T11:44:30
2020-02-24T11:44:30
242,721,399
0
0
null
null
null
null
UTF-8
Java
false
false
1,161
java
package ru.medev.bubble; import java.awt.*; public class Bullet { //Field private double x; private double y; private double bulletDX; private double bulletDY; private double distDX; private double distDY; private double dist; private int r = 2; private int speed = 20; private Color color = Color.WHITE; //Constructor public Bullet(){ x = GamePanel.gamer.getX(); y = GamePanel.gamer.getY(); distDX = GamePanel.mouseX - x; distDY = GamePanel.mouseY - y; dist = Math.sqrt(distDX*distDX + distDY*distDY); bulletDX = (distDX/dist)*speed; bulletDY = (distDY/dist)*speed; } //Function public void update(){ y +=bulletDY; x +=bulletDX; } public void draw(Graphics2D g){ g.setColor(color); g.fillOval((int)x,(int)y,r,2*r); } public boolean remove(){ if(y<0 && y>GamePanel.HEIGHT && x<0 && x>GamePanel.WIDTH){ return true; } return false; } public double getX() {return x;} public double getY() {return y;} public int getR(){return r;} }
[ "vurikus@yandex.ru" ]
vurikus@yandex.ru
0a392a8418b56aa39f33f04674792a18af175752
f619bbfc675e4cef2a6cbca442e71990392186ca
/mobilepayments/src/main/java/com/begateway/mobilepayments/view/SlashSpan.java
66081a5a4f1af67df5adb1b4ee11b47192c11667
[ "MIT" ]
permissive
a-yarohovich/begateway-android-sdk
14c027e07ddd009c9db74de79f8c5a0f8b7c3e9f
d81e25a4c892bdb490d8770e85c1394d871250ae
refs/heads/master
2023-01-29T09:55:04.644520
2020-11-17T17:46:06
2020-11-17T17:46:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package com.begateway.mobilepayments.view; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.FontMetricsInt; import android.text.style.ReplacementSpan; public class SlashSpan extends ReplacementSpan { @Override public int getSize(Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) { float padding = paint.measureText(" ", 0, 1) * 2; float slash = paint.measureText("/", 0, 1); float textSize = paint.measureText(text, start, end); return (int) (padding + slash + textSize); } @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { canvas.drawText(text.subSequence(start, end) + " / ", x, y, paint); } }
[ "" ]
74465647075397019909363825d4b2beed78e2fe
c28da52d72b65ae7e237eca212e0b1a8c3035759
/src/main/java/com/sxu/data/WorkingDataTxTsProcess.java
34946f968ec64f606e7c37ef8688f71dc6856217
[]
no_license
1303575952/nettyserver
59f38e735baead083b69c243f9f67ccba31d2be4
359c9b03e2b1e714b8e805087a5461346b63fafd
refs/heads/master
2020-04-16T07:14:00.018600
2019-05-12T11:02:12
2019-05-12T11:02:12
165,378,550
1
0
null
2019-03-11T09:16:45
2019-01-12T11:11:29
Java
UTF-8
Java
false
false
24,210
java
package com.sxu.data; import com.sxu.db.JDBCConfiguration; import com.sxu.entity.WorkingDataEntity; import com.sxu.entity.WorkingDataTxTsEntity; import com.sxu.utils.TimeUtil; import org.apache.log4j.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class WorkingDataTxTsProcess { private static final Logger LOGGER = Logger.getLogger(WorkingDataTxTsProcess.class); /** * 通过帧拿到工况数据,封装到workingDataEntity中 * <p> * 查 basic_company 得到 区域编号region_id 行业编号industry_id 公司编号id 公司名称name * 查 basic_industry 得到 行业名称name * 查 basic_drain 得到 排口名称name * 查 basic_facility 得到 设施编号id * * @param workingDataEntity * @return */ public static List<WorkingDataTxTsEntity> getWorkingDataTxTsEntityFromWorkingData(WorkingDataEntity workingDataEntity) { //脱硫脱硝数据放入workingDataTxTsEntities List<WorkingDataTxTsEntity> workingDataTxTsEntities = new ArrayList<WorkingDataTxTsEntity>(); //一条完整工况数据中脱硫脱硝公共部分 String qiyeID = workingDataEntity.getQiyeID(); Integer regionId = 0; Integer industryId = 0; Integer companyId = 0; String companyName = ""; Connection connection = null; try { connection = JDBCConfiguration.getConn(); PreparedStatement queryCompany = connection.prepareStatement("select * from basic_company where license_number_simple = ? limit 1"); queryCompany.setString(1, qiyeID); ResultSet queryCompanySet = queryCompany.executeQuery(); while (queryCompanySet.next()) { regionId = queryCompanySet.getInt("region_id"); industryId = queryCompanySet.getInt("industry_id"); companyId = queryCompanySet.getInt("id"); companyName = queryCompanySet.getString("name"); } queryCompanySet.close(); queryCompany.close(); String industryName = ""; PreparedStatement queryIndustry = connection.prepareStatement("select * from basic_industry where id = ?"); queryIndustry.setInt(1, industryId); ResultSet queryIndustrySet = queryIndustry.executeQuery(); while (queryIndustrySet.next()) { industryName = queryIndustrySet.getString("name"); } queryIndustrySet.close(); queryIndustry.close(); Integer drainId = Integer.valueOf(workingDataEntity.getPaikoubianhao()); String drainName = ""; PreparedStatement queryDrain = connection.prepareStatement("select * from basic_drain where data_from_paikoubianhao = ? and company_id = ?"); queryDrain.setInt(1, drainId); queryDrain.setInt(2, companyId); ResultSet queryDrainSet = queryDrain.executeQuery(); while (queryDrainSet.next()) { drainName = queryDrainSet.getString("name"); } queryDrainSet.close(); queryDrain.close(); String publishTime = TimeUtil.nianyueriFormat(workingDataEntity.getNianyueri()) + " " + workingDataEntity.getShifenmiao_1(); String createTime = workingDataEntity.getInsert_time(); /** * 1机组1脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_1_a = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1_a.setPublishTime(publishTime); workingDataTxTsEntity_1_a.setPublishType("N"); workingDataTxTsEntity_1_a.setRegionId(regionId); workingDataTxTsEntity_1_a.setIndustryId(industryId); workingDataTxTsEntity_1_a.setIndustryName(industryName); workingDataTxTsEntity_1_a.setCompanyId(companyId); workingDataTxTsEntity_1_a.setCompanyName(companyName); workingDataTxTsEntity_1_a.setDrainId(drainId); workingDataTxTsEntity_1_a.setDrainName(drainName); String facilityName_1_a = workingDataEntity.getGongyileixingTX_1_a() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1() + workingDataEntity.getZhilisheshibianhao_1_a(); PreparedStatement queryFacilityName_1_a = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1_a.setString(1, facilityName_1_a); queryFacilityName_1_a.setInt(2, companyId); Integer facilityId_1_a = 0; ResultSet queryFacilityName_1_aSet = queryFacilityName_1_a.executeQuery(); while (queryFacilityName_1_aSet.next()) { facilityId_1_a = queryFacilityName_1_aSet.getInt("id"); } workingDataTxTsEntity_1_a.setFacilityId(facilityId_1_a); queryFacilityName_1_aSet.close(); queryFacilityName_1_a.close(); workingDataTxTsEntity_1_a.setFacilityName(facilityName_1_a); workingDataTxTsEntity_1_a.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_1_a(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_1_a(), workingDataEntity.getAnqiliuliang_1_a() )); /*workingDataTxTsEntity_1_a.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a() ) );*/ workingDataTxTsEntity_1_a.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) ); workingDataTxTsEntity_1_a.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1_a); /** * 1机组2脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_1_b = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1_b.setPublishTime(publishTime); workingDataTxTsEntity_1_b.setPublishType("N"); workingDataTxTsEntity_1_b.setRegionId(regionId); workingDataTxTsEntity_1_b.setIndustryId(industryId); workingDataTxTsEntity_1_b.setIndustryName(industryName); workingDataTxTsEntity_1_b.setCompanyId(companyId); workingDataTxTsEntity_1_b.setCompanyName(companyName); workingDataTxTsEntity_1_b.setDrainId(drainId); workingDataTxTsEntity_1_b.setDrainName(drainName); String facilityName_1_b = workingDataEntity.getGongyileixingTX_1_b() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1() + workingDataEntity.getZhilisheshibianhao_1_b(); PreparedStatement queryFacilityName_1_b = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1_b.setString(1, facilityName_1_b); queryFacilityName_1_b.setInt(2, companyId); Integer facilityId_1_b = 0; ResultSet queryFacilityName_1_bSet = queryFacilityName_1_b.executeQuery(); while (queryFacilityName_1_bSet.next()) { facilityId_1_b = queryFacilityName_1_bSet.getInt("id"); } workingDataTxTsEntity_1_b.setFacilityId(facilityId_1_b); queryFacilityName_1_bSet.close(); queryFacilityName_1_b.close(); workingDataTxTsEntity_1_b.setFacilityName(facilityName_1_b); workingDataTxTsEntity_1_b.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_1_b(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_1_b(), workingDataEntity.getAnqiliuliang_1_b() )); /*workingDataTxTsEntity_1_b.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) );*/ workingDataTxTsEntity_1_b.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) ); workingDataTxTsEntity_1_b.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1_b); /** * 1机组脱硫 */ WorkingDataTxTsEntity workingDataTxTsEntity_1 = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1.setPublishTime(publishTime); workingDataTxTsEntity_1.setPublishType("S"); workingDataTxTsEntity_1.setRegionId(regionId); workingDataTxTsEntity_1.setIndustryId(industryId); workingDataTxTsEntity_1.setIndustryName(industryName); workingDataTxTsEntity_1.setCompanyId(companyId); workingDataTxTsEntity_1.setCompanyName(companyName); workingDataTxTsEntity_1.setDrainId(drainId); workingDataTxTsEntity_1.setDrainName(drainName); String facilityName_1 = workingDataEntity.getGongyileixingTS_1() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1(); PreparedStatement queryFacilityName_1 = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1.setString(1, facilityName_1); queryFacilityName_1.setInt(2, companyId); Integer facilityId_1 = 0; ResultSet queryFacilityName_1Set = queryFacilityName_1.executeQuery(); while (queryFacilityName_1Set.next()) { facilityId_1 = queryFacilityName_1Set.getInt("id"); } workingDataTxTsEntity_1.setFacilityId(facilityId_1); queryFacilityName_1Set.close(); queryFacilityName_1.close(); workingDataTxTsEntity_1.setFacilityName(facilityName_1); workingDataTxTsEntity_1.setOperationConcentration(WorkingDataModel.sOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getRukouO2nongdu_1(), workingDataEntity.getRukouyanwen_1(), workingDataEntity.getShihuishigongjiangliang_1(), 0.95f, workingDataEntity.getShihuishijiangyemidu_1(), String.valueOf(workingDataEntity.getNo1xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo2xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo3xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo4xunhuanbengkaiguanzhuangtai_1() ) )); /*workingDataTxTsEntity_1.setOperatingEfficiency( WorkingDataModel.sEfficiency(workingDataEntity.getChukouliunongdu_1(), workingDataEntity.getChukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getRukouyanqiliang_1() ) );*/ workingDataTxTsEntity_1.setOperatingEfficiency( WorkingDataModel.sModelEfficiency( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getChukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getChukouliunongdu_1() ) ); workingDataTxTsEntity_1.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1); /** * 2机组1脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_2_a = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2_a.setPublishTime(publishTime); workingDataTxTsEntity_2_a.setPublishType("N"); workingDataTxTsEntity_2_a.setRegionId(regionId); workingDataTxTsEntity_2_a.setIndustryId(industryId); workingDataTxTsEntity_2_a.setIndustryName(industryName); workingDataTxTsEntity_2_a.setCompanyId(companyId); workingDataTxTsEntity_2_a.setCompanyName(companyName); workingDataTxTsEntity_2_a.setDrainId(drainId); workingDataTxTsEntity_2_a.setDrainName(drainName); String facilityName_2_a = workingDataEntity.getGongyileixingTX_2_a() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2() + workingDataEntity.getZhilisheshibianhao_2_a(); PreparedStatement queryFacilityName_2_a = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2_a.setString(1, facilityName_2_a); queryFacilityName_2_a.setInt(2, companyId); Integer facilityId_2_a = 0; ResultSet queryFacilityName_2_aSet = queryFacilityName_2_a.executeQuery(); while (queryFacilityName_2_aSet.next()) { facilityId_2_a = queryFacilityName_2_aSet.getInt("id"); } workingDataTxTsEntity_2_a.setFacilityId(facilityId_2_a); queryFacilityName_2_aSet.close(); queryFacilityName_2_a.close(); workingDataTxTsEntity_2_a.setFacilityName(facilityName_2_a); workingDataTxTsEntity_2_a.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_2_a(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_2_a(), workingDataEntity.getAnqiliuliang_2_a() )); /*workingDataTxTsEntity_2_a.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a() ) );*/ workingDataTxTsEntity_2_a.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) ); workingDataTxTsEntity_2_a.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2_a); /** * 2机组2脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_2_b = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2_b.setPublishTime(publishTime); workingDataTxTsEntity_2_b.setPublishType("N"); workingDataTxTsEntity_2_b.setRegionId(regionId); workingDataTxTsEntity_2_b.setIndustryId(industryId); workingDataTxTsEntity_2_b.setIndustryName(industryName); workingDataTxTsEntity_2_b.setCompanyId(companyId); workingDataTxTsEntity_2_b.setCompanyName(companyName); workingDataTxTsEntity_2_b.setDrainId(drainId); workingDataTxTsEntity_2_b.setDrainName(drainName); String facilityName_2_b = workingDataEntity.getGongyileixingTX_2_b() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2() + workingDataEntity.getZhilisheshibianhao_2_b(); PreparedStatement queryFacilityName_2_b = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2_b.setString(1, facilityName_2_b); queryFacilityName_2_b.setInt(2, companyId); Integer facilityId_2_b = 0; ResultSet queryFacilityName_2_bSet = queryFacilityName_2_b.executeQuery(); while (queryFacilityName_2_bSet.next()) { facilityId_2_b = queryFacilityName_2_bSet.getInt("id"); } workingDataTxTsEntity_2_b.setFacilityId(facilityId_2_b); queryFacilityName_2_bSet.close(); queryFacilityName_2_b.close(); workingDataTxTsEntity_2_b.setFacilityName(facilityName_2_b); workingDataTxTsEntity_2_b.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_2_b(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_2_b(), workingDataEntity.getAnqiliuliang_2_b() )); /*workingDataTxTsEntity_2_b.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) );*/ workingDataTxTsEntity_2_b.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) ); workingDataTxTsEntity_2_b.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2_b); /** * 2机组脱硫 */ WorkingDataTxTsEntity workingDataTxTsEntity_2 = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2.setPublishTime(publishTime); workingDataTxTsEntity_2.setPublishType("S"); workingDataTxTsEntity_2.setRegionId(regionId); workingDataTxTsEntity_2.setIndustryId(industryId); workingDataTxTsEntity_2.setIndustryName(industryName); workingDataTxTsEntity_2.setCompanyId(companyId); workingDataTxTsEntity_2.setCompanyName(companyName); workingDataTxTsEntity_2.setDrainId(drainId); workingDataTxTsEntity_2.setDrainName(drainName); String facilityName_2 = workingDataEntity.getGongyileixingTS_2() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2(); PreparedStatement queryFacilityName_2 = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2.setString(1, facilityName_2); queryFacilityName_2.setInt(2, companyId); Integer facilityId_2 = 0; ResultSet queryFacilityName_2Set = queryFacilityName_2.executeQuery(); while (queryFacilityName_2Set.next()) { facilityId_2 = queryFacilityName_2Set.getInt("id"); } workingDataTxTsEntity_2.setFacilityId(facilityId_2); queryFacilityName_2Set.close(); queryFacilityName_2.close(); workingDataTxTsEntity_2.setFacilityName(facilityName_2); workingDataTxTsEntity_2.setOperationConcentration(WorkingDataModel.sOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getRukouO2nongdu_2(), workingDataEntity.getRukouyanwen_2(), workingDataEntity.getShihuishigongjiangliang_2(), 0.95f, workingDataEntity.getShihuishijiangyemidu_2(), String.valueOf(workingDataEntity.getNo1xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo2xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo3xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo4xunhuanbengkaiguanzhuangtai_2() ) )); /*workingDataTxTsEntity_2.setOperatingEfficiency( WorkingDataModel.sEfficiency( workingDataEntity.getChukouliunongdu_2(), workingDataEntity.getChukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getRukouyanqiliang_2() ) );*/ workingDataTxTsEntity_2.setOperatingEfficiency( WorkingDataModel.sModelEfficiency( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getChukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getChukouliunongdu_2() ) ); workingDataTxTsEntity_2.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2); connection.close(); LOGGER.debug("关闭MySQL连接"); } catch (Exception e) { e.printStackTrace(); } return workingDataTxTsEntities; } }
[ "1303575952@qq.com" ]
1303575952@qq.com
3787dbd7c7b1339e5d4782bf7e3a39978eaed5f6
cd08fe6078e65742b9d3e4576883d261392fbd73
/src/main/java/net/andreho/struct/EqualityAndHashCodeStrategy.java
b8b7828bf793c4f0c0da0787a12215e3aa637235
[ "Apache-2.0" ]
permissive
andreho/structs
d619f5001f9e62624d15d97bb3458d31a8803b86
eee225c15fe1f7fbad283937ed322e2e824a4cef
refs/heads/master
2021-09-01T21:43:04.340706
2017-12-28T20:03:19
2017-12-28T20:03:19
115,171,413
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package net.andreho.struct; public interface EqualityAndHashCodeStrategy<T> extends EqualityStrategy<T>, HashCodeStrategy<T> { }
[ "andreho84@gmail.com" ]
andreho84@gmail.com
033b10e707b6b045110ba6f5f7c8d98ccfa481c8
c4376def2ad77212bac10d18de4aa4cda0f3435a
/Queue/ArrayQueueTest.java
e268ca3357a8a092043a53dc465e26c3940315fa
[]
no_license
BrandonOdiwuor/Data-Structures-And-Algorithms-Java
34c6a47659ff1888c279c4164ce93cee79de2b1e
a20494f0030420b16473dd516e34f0ebf622e7e9
refs/heads/master
2021-01-19T12:16:16.732592
2017-01-26T15:29:08
2017-01-26T15:29:08
69,948,003
2
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
public class ArrayQueueTest extends MainTester{ public static void main(String[] args){ ArrayQueueTest tester = new ArrayQueueTest(); ArrayQueue<String> queue = new ArrayQueue<String>(); // Testing size() tester.testMethod(String.valueOf(queue.size()), "0"); // Testing isEmpty() tester.testMethod(String.valueOf(queue.isEmpty()), "true"); // Testing enqueue() queue.enqueue("Brandon Wayne Odiwuor"); tester.testMethod(Integer.toString(queue.size()), "1"); tester.testMethod(String.valueOf(queue.isEmpty()), "false"); queue.enqueue("Becker Otieno"); queue.enqueue("Hazel Joyce"); queue.enqueue("Brayden Gweth"); queue.enqueue("Jerdon Hawi"); tester.testMethod(Integer.toString(queue.size()), "5"); // Testing first() tester.testMethod(queue.first(), "Brandon Wayne Odiwuor"); // Testing deuque() tester.testMethod(queue.dequeue(), "Brandon Wayne Odiwuor"); tester.testMethod(queue.first(), "Becker Otieno"); tester.testMethod(Integer.toString(queue.size()), "4"); } }
[ "brandon.odiwuor@gmail.com" ]
brandon.odiwuor@gmail.com
e56cfa7b3eb0e8ec576ff0a3372f06ebc6024fc0
bc9bd0dea077b5f3aa191908d60ebf213a941379
/app/src/main/java/com/example/surbhimiglani/appetite/RegisterAsUser.java
ecc49067c8e991978e66c2f91644b30f968e45b8
[]
no_license
surbhimiglani/EmergencyApp
c9c7cbe7a71c39e30d61b6fa5ce663b7fdd16e88
24195404799bf44d1c28d38931bdb0e02dd2d474
refs/heads/master
2021-07-17T05:12:04.830543
2017-10-14T06:49:57
2017-10-14T06:49:57
106,900,537
0
0
null
null
null
null
UTF-8
Java
false
false
4,460
java
package com.example.surbhimiglani.appetite; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.HashMap; public class RegisterAsUser extends AppCompatActivity { private EditText inputEmail, inputPassword,inputaddress,inputphonenumber; private Button btnSignUp; private FirebaseAuth auth; private DatabaseReference userdatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register_as_user); auth = FirebaseAuth.getInstance(); inputEmail = (EditText) findViewById(R.id.email2); inputPassword = (EditText) findViewById(R.id.password2); inputaddress = (EditText) findViewById(R.id.address); inputphonenumber = (EditText) findViewById(R.id.editText6); btnSignUp = (Button) findViewById(R.id.button3); userdatabase= FirebaseDatabase.getInstance().getReference().child("user"); btnSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String email = inputEmail.getText().toString().trim(); String password = inputPassword.getText().toString().trim(); String Adresss = inputaddress.getText().toString().trim(); String phonenmber = inputphonenumber.getText().toString().trim(); HashMap<String,String> DataMap= new HashMap<String, String>(); DataMap.put("Name",email); DataMap.put("Password",password); DataMap.put("Address",Adresss); DataMap.put("Number",phonenmber); if (TextUtils.isEmpty(email)) { Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(password)) { Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show(); return; } if (password.length() < 6) { Toast.makeText(getApplicationContext(), "Password too short, enter minimum 6 characters!", Toast.LENGTH_SHORT).show(); return; } userdatabase.push().setValue(DataMap); //create user auth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(RegisterAsUser.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Toast.makeText(RegisterAsUser.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show(); // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. if (!task.isSuccessful()) { Toast.makeText(RegisterAsUser.this, "Authentication failed." + task.getException(), Toast.LENGTH_SHORT).show(); } else { startActivity(new Intent(RegisterAsUser.this, Welcome.class)); finish(); } } }); } }); } }
[ "me.surbhimiglani@gmail.com" ]
me.surbhimiglani@gmail.com
117e83156e27eaf750747c7023e22e5d66122421
9754873d7ba54e9bf0b3f66910c0ee6e68d37507
/src/main/java/test/rabbitmq/demo/RabbitMQDemoApplication.java
e5ba209c6029f711a79169df2d5a4fbe741fca73
[]
no_license
a-gomezuc/rabbitmq-springboot
d6b1ff658cc7342a6b095bfe14ac4a85bcc4e5c4
f777d7789a9dc5abc61c2c735d0fe13cdaa99417
refs/heads/master
2023-03-29T18:37:11.008911
2021-04-10T10:23:00
2021-04-10T10:23:00
340,888,477
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package test.rabbitmq.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RabbitMQDemoApplication { public static void main(String[] args) { SpringApplication.run(RabbitMQDemoApplication.class, args); } }
[ "alexyuncos96@gmail.com" ]
alexyuncos96@gmail.com
fe8c45491e0a8169cd3321f50027502cd5160b33
a7525ceff8431ccc08167aedd4f26c1f059eee5b
/app/src/main/java/com/example/rubs/renderscriptdemo/MainActivity.java
28183cd637691045d31f56ae9c2f00116c0ff540
[]
no_license
mytrendin/Renderscript
4099095e2bd0dd4b9d316645337b19833fb0ead2
8a37023b0cac6bce804c12273225e81b82f0e9f8
refs/heads/master
2021-01-21T21:05:38.090467
2017-05-24T14:59:30
2017-05-24T14:59:30
92,304,818
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
package com.example.rubs.renderscriptdemo; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView outputImage = (ImageView)findViewById(R.id.outputImage); Bitmap outputBitmap = Bluer.blur(this, BitmapFactory.decodeResource(getResources(),R.drawable.picture)); outputImage.setImageBitmap(outputBitmap); } }
[ "mytrendinn@gmail.com" ]
mytrendinn@gmail.com
4cd2e6c3eb795ad135fd9f5e0fc6c24c5993d57d
503ec69031e92a0e30627853dd02c435be4897bf
/app/src/main/java/com/nanodegree/android/stevenson/popularmovies/model/Trailer.java
4d467f7e2e5a7d0165dd3a5c3d5505a2c0045431
[]
no_license
Justin-Stevenson/Popular-Movies-java-
9b3efb1d58ad515ac089773259a7210bc2a083bf
c4488a6fcc6eb38e7907686093715cd66f43f57d
refs/heads/master
2022-05-13T12:36:18.149225
2019-06-27T23:00:44
2019-06-27T23:00:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.nanodegree.android.stevenson.popularmovies.model; public class Trailer { private String id; private String key; private String name; public String getId() { return id; } public String getKey() { return key; } public String getName() { return name; } }
[ "justinrstevenson@yahoo.com" ]
justinrstevenson@yahoo.com
c5fa4a8cd73e2dc53f1a2b64efcc45071ab895c2
4c2283bbc4efefc5f6378de88e2cdb254ad2a04b
/app/src/instigate/simCardChangeNotifier/mailing/CustomEmailSender.java
ca49b14bff3ff45776380b514861d748017b205a
[]
no_license
LianaHovhannisyan/build_system
9f5fe344fe8043f9e120c77e294da0617f4f35e8
1fe274cc5fdb0058a07dbee52bfa52de59a0475a
refs/heads/master
2016-08-12T18:35:26.009642
2015-11-26T18:27:25
2015-11-26T18:27:25
46,941,665
0
0
null
null
null
null
UTF-8
Java
false
false
1,296
java
package instigate.simCardChangeNotifier.mailing; import java.util.Set; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import instigate.simCardChangeNotifier.BuildConfig; public class CustomEmailSender extends AsyncTask<Void, Void, Boolean> { private Set<String> messageRecipients; private String messageSubject; private String messageBody; private Context context; GMailSender sender = new GMailSender(context, "notification.sender.sccn@gmail.com", "InstigateMobile1"); public CustomEmailSender(Context cnt, Set<String> recipients, String subject, String body) { messageRecipients = recipients; messageSubject = subject; messageBody = body; context = cnt; } @Override protected Boolean doInBackground(Void... params) { if (BuildConfig.DEBUG) Log.v(CustomEmailSender.class.getName(), "doInBackground()"); try { for (String i : messageRecipients) { GMailSender sender = new GMailSender(context, "notification.sender.sccn@gmail.com", "InstigateMobile1"); sender.sendMail(messageSubject, messageBody, "notification.sender.sccn@gmail.com", i); Log.d("SendMail", "Mail was sent"); } } catch (Exception e) { Log.d("SendMail", e.getMessage(), e); e.printStackTrace(); return false; } return true; } };
[ "liana.hovhannisyan.im@gmail.com" ]
liana.hovhannisyan.im@gmail.com
81d8d68114244c7b6b2ed0e68ddbacb3adcbcdd7
62a6a855f5519ad35291512188ab8ac88a7ce74d
/src/main/java/io/github/lr/ip2country/utils/UtilsHelper.java
55870cc468a5c8c317b2877fac58cf2169c87f09
[]
no_license
LeandroRavanal/ip2country
a6b81107f1dce546d9757a469539bb03d89309df
1dda55ef8f2cf20502c684d059aac3eb1c40af80
refs/heads/master
2020-06-09T13:46:30.680417
2019-11-08T19:45:21
2019-11-08T19:45:21
193,444,235
0
0
null
null
null
null
UTF-8
Java
false
false
2,160
java
package io.github.lr.ip2country.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpStatusCodeException; /** * Utilitario con funciones comunes. Contiene el calculo de distancia. * * @author lravanal * */ public class UtilsHelper { private static final Logger logger = LoggerFactory.getLogger(UtilsHelper.class); public static final double AR_LAT = -34; public static final double AR_LNG = -64; public static int distance2AR(double lat, double lng) { return (int) (distance(AR_LAT, lat, AR_LNG, lng, 0.0, 0.0) / 1000); } /** * Calculate distance between two points in latitude and longitude * taking into account height difference. * If you are not interested in height difference pass 0.0. * * lat1, lon1 Start point lat2, lon2 End point * el1 Start altitude in meters el2 End altitude in meters * @returns Distance in Meters */ private static double distance(double lat1, double lat2, double lon1, double lon2, double el1, double el2) { final int R = 6371; // Radius of the earth double latDistance = Math.toRadians(lat2 - lat1); double lonDistance = Math.toRadians(lon2 - lon1); double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); double distance = R * c * 1000; // convert to meters double height = el1 - el2; distance = Math.pow(distance, 2) + Math.pow(height, 2); return Math.sqrt(distance); } @SuppressWarnings("serial") public static void checkStatusResponse(ResponseEntity<?> responseEntity, String operationName) { if (!responseEntity.getStatusCode().is2xxSuccessful()) { logger.info("Operation Incompleted ({}): {}", operationName, responseEntity.getStatusCodeValue()); throw new HttpStatusCodeException(responseEntity.getStatusCode()) {}; } } }
[ "leandro.ravanal@gmail.com" ]
leandro.ravanal@gmail.com
df1f1f63e05baae6a91bd8682c4509ce64d9fede
7f8dfa3921c4925814b25b144e68bb86684aaab8
/src/main/java/top/gradual/blog/service/BlogLinksService.java
8333c59b8fdb39faeaefc1b2b3ede1390881b288
[]
no_license
gradual-wu/Blog
2d4a2c2bd2c16ee2ef5b444ad86fa22af7265c3f
cb104e52be4566ab4a654ee750169311ff559a1c
refs/heads/master
2023-05-28T19:46:38.006496
2018-10-23T03:50:17
2018-10-23T03:50:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package top.gradual.blog.service; import java.util.List; import top.gradual.blog.domain.dto.LinkInputDTO; import top.gradual.blog.domain.dto.LinksDTO; /** * @Description: * @Author: gradual * @Date: 2018-09-20 上午9:22 */ public interface BlogLinksService { List<LinksDTO> getAllLinks(); boolean deleteLinks(long id); boolean updateLinks(LinkInputDTO inputDTO); LinksDTO insertLinks(LinkInputDTO inputDTO); }
[ "425031186@qq.com" ]
425031186@qq.com
275c66c5d81a4391d051319acb873b10ef79436d
3bd543c20e59b480a420b96c25129a2ed70ca747
/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java
47850c5c1a856c1ec1567625dfd671c7d4cae364
[ "Apache-2.0" ]
permissive
pengwei52/spring-framework-4.3.18.RELEASE
527710f642b22e3d1e5fda0e1c6745cf9f418d97
fd4ca1f313b16e57076bdccfbb38b52dabf52f75
refs/heads/master
2020-08-28T02:47:37.623269
2019-10-25T15:41:52
2019-10-25T15:41:52
217,565,397
0
0
null
null
null
null
UTF-8
Java
false
false
18,153
java
/* * Copyright 2002-2016 the original author or authors. * * 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.springframework.web.context.support; import java.io.Serializable; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource.StubPropertySource; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestScope; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.SessionScope; import org.springframework.web.context.request.WebRequest; /** * Convenience methods for retrieving the root {@link WebApplicationContext} for * a given {@link ServletContext}. This is useful for programmatically accessing * a Spring application context from within custom web views or MVC actions. * * <p>Note that there are more convenient ways of accessing the root context for * many web frameworks, either part of Spring or available as an external library. * This helper class is just the most generic way to access the root context. * * @author Juergen Hoeller * @see org.springframework.web.context.ContextLoader * @see org.springframework.web.servlet.FrameworkServlet * @see org.springframework.web.servlet.DispatcherServlet * @see org.springframework.web.jsf.FacesContextUtils * @see org.springframework.web.jsf.el.SpringBeanFacesELResolver */ // 从web应用的根目录读取配置文件,需要先在web.xml中配置,可以配置监听器或者servlet来实现 public abstract class WebApplicationContextUtils { private static final boolean jsfPresent = ClassUtils.isPresent("javax.faces.context.FacesContext", RequestContextHolder.class.getClassLoader()); /** * Find the root {@code WebApplicationContext} for this web app, typically * loaded via {@link org.springframework.web.context.ContextLoaderListener}. * <p>Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param sc ServletContext to find the web application context for * @return the root WebApplicationContext for this web app * @throws IllegalStateException if the root WebApplicationContext could not be found * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */ public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException { WebApplicationContext wac = getWebApplicationContext(sc); if (wac == null) { throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?"); } return wac; } /** * Find the root {@code WebApplicationContext} for this web app, typically * loaded via {@link org.springframework.web.context.ContextLoaderListener}. * <p>Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param sc ServletContext to find the web application context for * @return the root WebApplicationContext for this web app, or {@code null} if none * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */ public static WebApplicationContext getWebApplicationContext(ServletContext sc) { return getWebApplicationContext(sc, WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); } /** * Find a custom {@code WebApplicationContext} for this web app. * @param sc ServletContext to find the web application context for * @param attrName the name of the ServletContext attribute to look for * @return the desired WebApplicationContext for this web app, or {@code null} if none */ public static WebApplicationContext getWebApplicationContext(ServletContext sc, String attrName) { Assert.notNull(sc, "ServletContext must not be null"); Object attr = sc.getAttribute(attrName); if (attr == null) { return null; } if (attr instanceof RuntimeException) { throw (RuntimeException) attr; } if (attr instanceof Error) { throw (Error) attr; } if (attr instanceof Exception) { throw new IllegalStateException((Exception) attr); } if (!(attr instanceof WebApplicationContext)) { throw new IllegalStateException("Context attribute is not of type WebApplicationContext: " + attr); } return (WebApplicationContext) attr; } /** * Find a unique {@code WebApplicationContext} for this web app: either the * root web app context (preferred) or a unique {@code WebApplicationContext} * among the registered {@code ServletContext} attributes (typically coming * from a single {@code DispatcherServlet} in the current web application). * <p>Note that {@code DispatcherServlet}'s exposure of its context can be * controlled through its {@code publishContext} property, which is {@code true} * by default but can be selectively switched to only publish a single context * despite multiple {@code DispatcherServlet} registrations in the web app. * @param sc ServletContext to find the web application context for * @return the desired WebApplicationContext for this web app, or {@code null} if none * @since 4.2 * @see #getWebApplicationContext(ServletContext) * @see ServletContext#getAttributeNames() */ public static WebApplicationContext findWebApplicationContext(ServletContext sc) { WebApplicationContext wac = getWebApplicationContext(sc); if (wac == null) { Enumeration<String> attrNames = sc.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = attrNames.nextElement(); Object attrValue = sc.getAttribute(attrName); if (attrValue instanceof WebApplicationContext) { if (wac != null) { throw new IllegalStateException("No unique WebApplicationContext found: more than one " + "DispatcherServlet registered with publishContext=true?"); } wac = (WebApplicationContext) attrValue; } } } return wac; } /** * Register web-specific scopes ("request", "session", "globalSession") * with the given BeanFactory, as used by the WebApplicationContext. * @param beanFactory the BeanFactory to configure */ public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory) { registerWebApplicationScopes(beanFactory, null); } /** * Register web-specific scopes ("request", "session", "globalSession", "application") * with the given BeanFactory, as used by the WebApplicationContext. * @param beanFactory the BeanFactory to configure * @param sc the ServletContext that we're running within */ public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory, ServletContext sc) { beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope()); beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false)); beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true)); if (sc != null) { ServletContextScope appScope = new ServletContextScope(sc); beanFactory.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope); // Register as ServletContext attribute, for ContextCleanupListener to detect it. sc.setAttribute(ServletContextScope.class.getName(), appScope); } beanFactory.registerResolvableDependency(ServletRequest.class, new RequestObjectFactory()); beanFactory.registerResolvableDependency(ServletResponse.class, new ResponseObjectFactory()); beanFactory.registerResolvableDependency(HttpSession.class, new SessionObjectFactory()); beanFactory.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory()); if (jsfPresent) { FacesDependencyRegistrar.registerFacesDependencies(beanFactory); } } /** * Register web-specific environment beans ("contextParameters", "contextAttributes") * with the given BeanFactory, as used by the WebApplicationContext. * @param bf the BeanFactory to configure * @param sc the ServletContext that we're running within */ public static void registerEnvironmentBeans(ConfigurableListableBeanFactory bf, ServletContext sc) { registerEnvironmentBeans(bf, sc, null); } /** * Register web-specific environment beans ("contextParameters", "contextAttributes") * with the given BeanFactory, as used by the WebApplicationContext. * @param bf the BeanFactory to configure * @param servletContext the ServletContext that we're running within * @param servletConfig the ServletConfig of the containing Portlet */ public static void registerEnvironmentBeans( ConfigurableListableBeanFactory bf, ServletContext servletContext, ServletConfig servletConfig) { if (servletContext != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) { bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, servletContext); } if (servletConfig != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) { bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig); } if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) { Map<String, String> parameterMap = new HashMap<String, String>(); if (servletContext != null) { Enumeration<?> paramNameEnum = servletContext.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement(); parameterMap.put(paramName, servletContext.getInitParameter(paramName)); } } if (servletConfig != null) { Enumeration<?> paramNameEnum = servletConfig.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement(); parameterMap.put(paramName, servletConfig.getInitParameter(paramName)); } } bf.registerSingleton(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME, Collections.unmodifiableMap(parameterMap)); } if (!bf.containsBean(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME)) { Map<String, Object> attributeMap = new HashMap<String, Object>(); if (servletContext != null) { Enumeration<?> attrNameEnum = servletContext.getAttributeNames(); while (attrNameEnum.hasMoreElements()) { String attrName = (String) attrNameEnum.nextElement(); attributeMap.put(attrName, servletContext.getAttribute(attrName)); } } bf.registerSingleton(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME, Collections.unmodifiableMap(attributeMap)); } } /** * Convenient variant of {@link #initServletPropertySources(MutablePropertySources, * ServletContext, ServletConfig)} that always provides {@code null} for the * {@link ServletConfig} parameter. * @see #initServletPropertySources(MutablePropertySources, ServletContext, ServletConfig) */ public static void initServletPropertySources(MutablePropertySources propertySources, ServletContext servletContext) { initServletPropertySources(propertySources, servletContext, null); } /** * Replace {@code Servlet}-based {@link StubPropertySource stub property sources} with * actual instances populated with the given {@code servletContext} and * {@code servletConfig} objects. * <p>This method is idempotent with respect to the fact it may be called any number * of times but will perform replacement of stub property sources with their * corresponding actual property sources once and only once. * @param propertySources the {@link MutablePropertySources} to initialize (must not * be {@code null}) * @param servletContext the current {@link ServletContext} (ignored if {@code null} * or if the {@link StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME * servlet context property source} has already been initialized) * @param servletConfig the current {@link ServletConfig} (ignored if {@code null} * or if the {@link StandardServletEnvironment#SERVLET_CONFIG_PROPERTY_SOURCE_NAME * servlet config property source} has already been initialized) * @see org.springframework.core.env.PropertySource.StubPropertySource * @see org.springframework.core.env.ConfigurableEnvironment#getPropertySources() */ public static void initServletPropertySources( MutablePropertySources propertySources, ServletContext servletContext, ServletConfig servletConfig) { Assert.notNull(propertySources, "'propertySources' must not be null"); if (servletContext != null && propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME) && propertySources.get(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME) instanceof StubPropertySource) { propertySources.replace(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, new ServletContextPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, servletContext)); } if (servletConfig != null && propertySources.contains(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME) && propertySources.get(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME) instanceof StubPropertySource) { propertySources.replace(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME, new ServletConfigPropertySource(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME, servletConfig)); } } /** * Return the current RequestAttributes instance as ServletRequestAttributes. * @see RequestContextHolder#currentRequestAttributes() */ private static ServletRequestAttributes currentRequestAttributes() { RequestAttributes requestAttr = RequestContextHolder.currentRequestAttributes(); if (!(requestAttr instanceof ServletRequestAttributes)) { throw new IllegalStateException("Current request is not a servlet request"); } return (ServletRequestAttributes) requestAttr; } /** * Factory that exposes the current request object on demand. */ @SuppressWarnings("serial") private static class RequestObjectFactory implements ObjectFactory<ServletRequest>, Serializable { @Override public ServletRequest getObject() { return currentRequestAttributes().getRequest(); } @Override public String toString() { return "Current HttpServletRequest"; } } /** * Factory that exposes the current response object on demand. */ @SuppressWarnings("serial") private static class ResponseObjectFactory implements ObjectFactory<ServletResponse>, Serializable { @Override public ServletResponse getObject() { ServletResponse response = currentRequestAttributes().getResponse(); if (response == null) { throw new IllegalStateException("Current servlet response not available - " + "consider using RequestContextFilter instead of RequestContextListener"); } return response; } @Override public String toString() { return "Current HttpServletResponse"; } } /** * Factory that exposes the current session object on demand. */ @SuppressWarnings("serial") private static class SessionObjectFactory implements ObjectFactory<HttpSession>, Serializable { @Override public HttpSession getObject() { return currentRequestAttributes().getRequest().getSession(); } @Override public String toString() { return "Current HttpSession"; } } /** * Factory that exposes the current WebRequest object on demand. */ @SuppressWarnings("serial") private static class WebRequestObjectFactory implements ObjectFactory<WebRequest>, Serializable { @Override public WebRequest getObject() { ServletRequestAttributes requestAttr = currentRequestAttributes(); return new ServletWebRequest(requestAttr.getRequest(), requestAttr.getResponse()); } @Override public String toString() { return "Current ServletWebRequest"; } } /** * Inner class to avoid hard-coded JSF dependency. */ private static class FacesDependencyRegistrar { public static void registerFacesDependencies(ConfigurableListableBeanFactory beanFactory) { beanFactory.registerResolvableDependency(FacesContext.class, new ObjectFactory<FacesContext>() { @Override public FacesContext getObject() { return FacesContext.getCurrentInstance(); } @Override public String toString() { return "Current JSF FacesContext"; } }); beanFactory.registerResolvableDependency(ExternalContext.class, new ObjectFactory<ExternalContext>() { @Override public ExternalContext getObject() { return FacesContext.getCurrentInstance().getExternalContext(); } @Override public String toString() { return "Current JSF ExternalContext"; } }); } } }
[ "pengwei@sunline.cn" ]
pengwei@sunline.cn
098a5b7f2e2fb8bad0505e595c3646a8d99317bd
71b183a47b44be4f564192f1f815d616e9b4b9e2
/app/src/main/java/com/maymanm/weathermap/viewmodel/DirectionsViweModel.java
8ee135e51449c2882f8857946c7b1b9b88b7ef6a
[]
no_license
MahmoudAymann/WeatherMap
a6cc98e0170d4c0923d48db807b80a13cc0bc886
2e6e590067b2735ceadcb5e1e27cf5250ccca96d
refs/heads/master
2020-06-03T00:46:56.589799
2019-06-11T12:24:01
2019-06-11T12:24:01
191,366,268
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package com.maymanm.weathermap.viewmodel; import androidx.lifecycle.LiveData; import androidx.lifecycle.ViewModel; import com.maymanm.weathermap.models.directions.DirectionsModel; import com.maymanm.weathermap.repository.DirectionRepository; /** * Created by MahmoudAyman on 6/11/2019. **/ public class DirectionsViweModel extends ViewModel { public LiveData<DirectionsModel> getDirectionsLiveData(String origin, String dest, String key){ return DirectionRepository.getInstance().getDirection(origin, dest, key); } public LiveData<String[]> getPolyLineLiveData(DirectionsModel directionsModel){ return DirectionRepository.getInstance().getPolyLine(directionsModel); } }
[ "mahmoud_aymann@outlook.com" ]
mahmoud_aymann@outlook.com
75d8fc09a56930be93893b6e23170424080b69c0
02c5ca0e9a5fad1cc5b661e1fc55dffae5eef6a8
/src/main/java/com/lockertracker/model/LockerRentalModel.java
ce1ecbc2ba4c004038ae8c1c0696a55135733bb4
[]
no_license
ollainorbert/LockerTracker
355ae39485cae497262d3151684c0c878f5d53e6
8abaa262ee2a975ac2831b53a2b6931ef81f314d
refs/heads/master
2021-01-24T20:58:54.510074
2018-04-04T11:41:41
2018-04-04T11:41:41
123,265,051
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.lockertracker.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table(name = "Lockerrentals", uniqueConstraints = { @UniqueConstraint(columnNames = { "lockerId", "userId" }) }) public class LockerRentalModel { @GeneratedValue @Id private long id; @Column(nullable = false) private short lockerId; @Column(nullable = false) private long userId; @Column(nullable = false) private Date createdAt; public long getId() { return id; } public void setId(long id) { this.id = id; } public short getLockerId() { return lockerId; } public void setLockerId(short lockerId) { this.lockerId = lockerId; } public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } }
[ "norbert_ollai@epam.com" ]
norbert_ollai@epam.com
d3a193ef851687163bff7e7d110d7985ebe0621c
466357ff7e6bfab5304be1331cb8bd57732239ac
/Danny-Behnecke-Task2/src/statMeUp/saveSet.java
03a327e2185179fb3d0e18305b7ffb7999f614f4
[ "Apache-2.0" ]
permissive
TUBS-ISF/spl2015.danny.behnecke
8c2a6045017391780e7b8c9e12cbbcf66694f5e9
d33190c1a6e28abeaf4c2db92083d139b356cdae
refs/heads/master
2020-05-07T21:51:49.854571
2015-07-21T08:51:43
2015-07-21T08:51:43
34,387,624
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package statMeUp; public interface saveSet { public void saveResult(Set s);//TODO might change to bool public void saveResult(Set s, String path); }
[ "d.behnecke@tu-bs.de" ]
d.behnecke@tu-bs.de
af5a381fc6e31d47fd016daf5f9d302cad5c8521
b474398887fd3f2fbebd29ccc580c5fb293e252d
/src/com/sun/corba/se/spi/activation/ServerNotRegistered.java
48787ca3ba5c0c0adef541b088670e83ddcf685c
[ "MIT" ]
permissive
AndyChenIT/JDKSourceCode1.8
65a27e356debdcedc15642849602174c6ea286aa
4aa406b5b52e19ef8a323f9f829ea1852105d18b
refs/heads/master
2023-09-02T15:14:37.857475
2021-11-19T10:13:31
2021-11-19T10:13:31
428,856,994
0
0
MIT
2021-11-17T00:26:30
2021-11-17T00:26:29
null
UTF-8
Java
false
false
892
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/ServerNotRegistered.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u201/12322/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Saturday, December 15, 2018 6:38:37 PM PST */ public final class ServerNotRegistered extends org.omg.CORBA.UserException { public int serverId = (int)0; public ServerNotRegistered () { super(ServerNotRegisteredHelper.id()); } // ctor public ServerNotRegistered (int _serverId) { super(ServerNotRegisteredHelper.id()); serverId = _serverId; } // ctor public ServerNotRegistered (String $reason, int _serverId) { super(ServerNotRegisteredHelper.id() + " " + $reason); serverId = _serverId; } // ctor } // class ServerNotRegistered
[ "wupx@glodon.com" ]
wupx@glodon.com
2b65453a3eb51256e85e7c26693f5d5b78b334ef
bf1c45b85e287cfec69ff1d30292dabac9f5b02e
/ismartlib/src/main/java/com/ismartlib/ui/dialog/SheetDialog.java
f2ccdff5461ebf86a2f8d72df5cc95e4e51579c0
[]
no_license
msdgwzhy6/android-ui-1
4bb144e62a9256dc02b3eccb6040de3f86d89fa6
6c93e49fe7a9a592d29b5f964fe0485ebce8c7ad
refs/heads/master
2021-01-19T22:43:39.465318
2017-04-03T14:40:10
2017-04-03T14:40:10
88,851,843
1
0
null
2017-04-20T10:11:50
2017-04-20T10:11:50
null
UTF-8
Java
false
false
3,373
java
package com.ismartlib.ui.dialog; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetDialog; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; /** *    ┏┓   ┏┓ *   ┏┛┻━━━┛┻┓ *   ┃       ┃ *   ┃   ━   ┃ *   ┃ ┳┛ ┗┳ ┃ *   ┃       ┃ *   ┃   ┻   ┃ *   ┃       ┃ *   ┗━┓   ┏━┛ *     ┃   ┃神兽保佑 *     ┃   ┃永无BUG! *     ┃   ┗━━━┓ *     ┃       ┣┓ *     ┃       ┏┛ *     ┗┓┓┏━┳┓┏┛ *      ┃┫┫ ┃┫┫ *      ┗┻┛ ┗┻┛ * ━━━━━━神兽出没━━━━━━ * Created by Administrator on 2016/9/23. * Email:924686754@qq.com * BottomSheetDialog */ public class SheetDialog extends BottomSheetDialog { private Context mContext; public SheetDialog(@NonNull Context context) { super(context); this.mContext = context; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int screenHeight = getScreenHeight((Activity) mContext); int statusBarHeight = getStatusBarHeight(getContext()); int dialogHeight = screenHeight - statusBarHeight; getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, dialogHeight == 0 ? ViewGroup.LayoutParams.MATCH_PARENT : dialogHeight); } private int getScreenHeight(Activity activity) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.heightPixels; } private int getStatusBarHeight(Context context) { int statusBarHeight = 0; Resources res = context.getResources(); int resourceId = res.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { statusBarHeight = res.getDimensionPixelSize(resourceId); } return statusBarHeight; } public void setView(View v) { setContentView(v); //防止用户滑动关闭后窗口不能被再次打开 View view = getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet); final BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(view); bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { if (newState == BottomSheetBehavior.STATE_HIDDEN) { dismiss(); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { } }); } }
[ "1711463997@qq.com" ]
1711463997@qq.com
d2eceb1211ed8668eae9379fbb17bbe34b66304a
9c042b1dc728dc1e820cca4e11ac5fc883a6bd59
/logistikapp-logistic/src/com/retailsbs/logistikapp/logistic/dao/ibatis/FinderRouteStoreDAOImpl.java
f493625710bb6c7987814e1b264a8a4b0a4d9609
[]
no_license
mcacho09/web-lgk
8152180e8d8c4f6c419ff686c65851e8c523e262
085896dadb9a9916a82506943bbff4640348f7a8
refs/heads/master
2023-07-05T00:59:46.680873
2021-08-05T17:06:17
2021-08-05T17:06:17
393,114,561
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package com.retailsbs.logistikapp.logistic.dao.ibatis; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; import com.retailsbs.logistikapp.logistic.dao.FinderRouteStoreDAO; public class FinderRouteStoreDAOImpl extends SqlMapClientDaoSupport implements FinderRouteStoreDAO { @Override public int delRouteStoreByIdRoute(Long id_route) { return getSqlMapClientTemplate().delete("finder_route_store.deleteByIdRoute", id_route); } @Override public int delRouteStoreByIdStore(Long id_store) { return getSqlMapClientTemplate().delete("finder_route_store.deleteByIdStore", id_store); } }
[ "mario.cacho09@outlook.com" ]
mario.cacho09@outlook.com
5a0d5b99956bd867ce96916b84e6eae03de5ebbc
92bd437b3e42069ff1d852a449bbdb02188cdcd8
/Chapter07/src/sub05/polymorphismTest.java
79f4417d6e0813aa2e927f40e29042537d2e10e4
[]
no_license
wingband/java
228b9fa654e2982aefa440e16a15807aa07dd90e
2c317703b3fa081989334fd09671606a9bc89c90
refs/heads/master
2022-09-17T16:50:04.154301
2020-05-27T01:33:19
2020-05-27T01:33:19
259,795,697
0
0
null
null
null
null
UHC
Java
false
false
511
java
package sub05; import java.util.Scanner; public class polymorphismTest { public static void main(String[] args) { OverWatch ow; System.out.println("플레이할 캐릭터 번호 선택(1.메이, 2.리퍼, 3.맥크리)"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n==1) { ow = new Mei(); }else if (n==2) { ow = new Reaper(); }else { ow = new Mccree(); } ow.name(); ow.lClick(); ow.rClick(); ow.shiftButton(); ow.eButton(); ow.qButton(); } }
[ "wingband4980@gmail.com" ]
wingband4980@gmail.com
8dcbcc9a27c99ec8891b8c057b65f11a20d5cfc1
668584d63f6ed8f48c8609c3a142f8bdf1ba1a40
/prj/coherence-core/src/main/java/com/tangosol/dev/compiler/java/CaseClause.java
8c30713b0c545dd8b953621fed052021521733f3
[ "EPL-1.0", "Classpath-exception-2.0", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-protobuf", "CDDL-1.1", "W3C", "APSL-1.0", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain"...
permissive
oracle/coherence
34c48d36674e69974a693925c18f097175052c5f
b1a009a406e37fdc5479366035d8c459165324e1
refs/heads/main
2023-08-31T14:53:40.437690
2023-08-31T02:04:15
2023-08-31T02:04:15
242,776,849
416
96
UPL-1.0
2023-08-07T04:27:39
2020-02-24T15:51:04
Java
UTF-8
Java
false
false
4,855
java
/* * Copyright (c) 2000, 2020, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ package com.tangosol.dev.compiler.java; import com.tangosol.dev.assembler.CodeAttribute; import com.tangosol.dev.compiler.CompilerException; import com.tangosol.dev.compiler.Context; import com.tangosol.dev.component.DataType; import com.tangosol.util.ErrorList; import java.util.Set; import java.util.Map; /** * This class implements the "case <constant-value> :" clause of a switch * statement. * * SwitchLabel: * case ConstantExpression : * default : * * @version 1.00, 09/21/98 * @author Cameron Purdy */ public class CaseClause extends TargetStatement { // ----- construction --------------------------------------------------- /** * Construct a case clause. * * @param stmt the statement within which this element exists * @param token the "case" token */ public CaseClause(Statement stmt, Token token) { super(stmt, token); } // ----- code generation ------------------------------------------------ /** * Perform semantic checks, parse tree re-organization, name binding, * and optimizations. * * @param ctx the compiler context * @param setUVars the set of potentially unassigned variables * @param setFVars the set of potentially assigned final variables * @param mapThrown the set of potentially thrown checked exceptions * @param errlist the error list * * @exception CompilerException thrown if an error occurs that should * stop the compilation process */ protected Element precompile(Context ctx, DualSet setUVars, DualSet setFVars, Map mapThrown, ErrorList errlist) throws CompilerException { Expression expr = getTest(); // pre-compile the test expr = (Expression) expr.precompile(ctx, setUVars, setFVars, mapThrown, errlist); // the test must be constant if (expr.checkConstant(errlist)) { // the test must match (be assignable to) the type of the switch if (expr.checkIntegral(errlist)) { DataType dt = ((SwitchStatement) getOuterStatement()).getTest().getType(); if (expr.checkAssignable(ctx, dt, errlist)) { expr = expr.convertAssignable(ctx, DataType.INT); } } } // store the test setTest(expr); // this will require a label getStartLabel(); return this; } /** * Perform final optimizations and code generation. * * @param ctx the compiler context * @param code the assembler code attribute to compile to * @param fReached true if this language element is reached (JLS 14.19) * @param errlist the error list to log errors to * * @return true if the element can complete normally (JLS 14.1) * * @exception CompilerException thrown if an error occurs that should * stop the compilation process */ protected boolean compileImpl(Context ctx, CodeAttribute code, boolean fReached, ErrorList errlist) throws CompilerException { return true; } // ----- accessors ------------------------------------------------------ /** * Get the test expression. * * @return the test expression */ public Expression getTest() { return test; } /** * Set the test expression. * * @param test the test expression */ protected void setTest(Expression test) { this.test = test; } /** * Determine if the test expression has a constant value. * * @return true if the test expression results in a constant value */ public boolean isConstant() { return test.isConstant(); } /** * Get the case value. * * @return the int case value */ protected int getValue() { return ((Number) getTest().getValue()).intValue(); } // ----- Element methods ------------------------------------------------ /** * Print the element information. * * @param sIndent */ public void print(String sIndent) { out(sIndent + toString()); out(sIndent + " Value:"); test.print(sIndent + " "); } // ----- data members --------------------------------------------------- /** * The class name. */ private static final String CLASS = "CaseClause"; /** * The conditional expression. */ private Expression test; }
[ "a@b" ]
a@b
903ca9b55492e8ac3e5ce4972a32cf2550843296
6f20ff6de3115b21b3730fc5f24570ba40d33d51
/OfertaPaquete11-EJB/ejbModule/com/ofertaPaq/integraciones/OfertasProductor.java
4bea9c09b66dc7eb57cb17cba3bb2e1ee865acd8
[]
no_license
JonyMedina/OfertaPaquete11
885f30f367a76106a91891ec64b07636036b8723
28feeb1b2a8270c23ab3b80d1b85d74eccbacb50
refs/heads/master
2020-03-19T16:04:52.344938
2018-06-16T03:19:15
2018-06-16T03:19:15
136,699,553
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
4,390
java
package com.ofertaPaq.integraciones; import java.util.Properties; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; @Stateless @LocalBean public class OfertasProductor { public void sendMessage1(String messageText) { Context context; try { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://192.168.1.81:8080")); env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "paquete")); env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "paquete")); context = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", "jms/RemoteConnectionFactory"); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString); String destinationString = System.getProperty("destination", "jms/queue/ofertapaquete"); Destination destination = (Destination) context.lookup(destinationString); // Create the JMS connection, session, producer, and consumer Connection connection = connectionFactory.createConnection(System.getProperty("username", "paquete"), System.getProperty("password", "paquete")); Session session = ((javax.jms.Connection) connection).createSession(false, Session.AUTO_ACKNOWLEDGE); // consumer = session.createConsumer(destination); connection.start(); // crear un producer para enviar mensajes usando la session MessageProducer producer = session.createProducer((Destination) destination); // crear un mensaje de tipo text y setearle el contenido TextMessage message = session.createTextMessage(); message.setText(messageText); // enviar el mensaje producer.send(message); // TODO: recordar cerrar la session y la connection en un bloque “finally” connection.close(); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("Mensaje enviado 1"); } } public void sendMessage2(String messageText) { Context context; try { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://192.168.1.69:8080")); env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "paquete")); env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "paquete")); context = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", "jms/RemoteConnectionFactory"); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString); String destinationString = System.getProperty("destination", "jms/queue/ofertapaquete"); Destination destination = (Destination) context.lookup(destinationString); // Create the JMS connection, session, producer, and consumer Connection connection = connectionFactory.createConnection(System.getProperty("username", "paquete"), System.getProperty("password", "paquete")); Session session = ((javax.jms.Connection) connection).createSession(false, Session.AUTO_ACKNOWLEDGE); // consumer = session.createConsumer(destination); connection.start(); // crear un producer para enviar mensajes usando la session MessageProducer producer = session.createProducer((Destination) destination); // crear un mensaje de tipo text y setearle el contenido TextMessage message = session.createTextMessage(); message.setText(messageText); // enviar el mensaje producer.send(message); // TODO: recordar cerrar la session y la connection en un bloque “finally” connection.close(); } catch (Exception e) { System.out.println("Mensaje enviado 2"); } } }
[ "jona.medina@gmail.com" ]
jona.medina@gmail.com
0e454ec3d175ab51d23bceb4fddb2c39ec78ce13
ee3db8c34dc91d6e8add03d603b3de412de96f5a
/viz/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/manager/SatelliteImageTypeList.java
9b4a8d0bf2520ca53902464abc014f8ee9575fd2
[]
no_license
Unidata/awips2-ncep
a9aa3a26d83e901cbfaac75416ce586fc56b77d7
0abdb2cf11fcc3b9daf482f282c0491484ea312c
refs/heads/unidata_18.2.1
2023-07-24T03:53:47.775210
2022-07-12T14:56:56
2022-07-12T14:56:56
34,419,331
2
5
null
2023-03-06T22:22:27
2015-04-22T22:26:52
Java
UTF-8
Java
false
false
963
java
package gov.noaa.nws.ncep.viz.resources.manager; import java.util.ArrayList; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * This class declares the top level of SatelliteArea.xml as * <SatelliteAreaList>. * * <pre> * SOFTWARE HISTORY * Date Ticket# Engineer Descriptio * ------------ ---------- ----------- -------------------------- * * 08/17/15 R7656 RCR Created. * * </pre> * * @author RCR * @version 1 */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class SatelliteImageTypeList { @XmlElement(name = "satelliteImageType") private ArrayList<SatelliteImageType> imageTypeList = null; public SatelliteImageTypeList() { } public ArrayList<SatelliteImageType> getImageTypeList() { return imageTypeList; } }
[ "Robert.C.Reynolds@noaa.gov" ]
Robert.C.Reynolds@noaa.gov
ddd60e8077c3e0569ead44091c3a7dfe83ff2ec2
9757cad73573ba89c0322ba346fa63c08c290f18
/microcourse/src/main/java/com/mcourse/frame/utils/PropUtils.java
2a4acf9ab3fda820155511bead20c33252c400c1
[ "Apache-2.0" ]
permissive
wrcold520/mcourse
929cb4bfc3008b7f1cf67fdbfdc9bd591104513a
5992bbffd0acff6b08f79676b4dad7e783dd64f2
refs/heads/master
2021-07-10T03:38:19.589375
2017-10-09T10:16:34
2017-10-09T10:16:34
106,268,264
0
0
null
null
null
null
UTF-8
Java
false
false
2,758
java
package com.mcourse.frame.utils; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @Title 属性文件获取属性值的工具类 * @Description * * @Created Assassin * @DateTime 2017/05/23 16:47:55 */ public class PropUtils { public static final Logger logger = LoggerFactory.getLogger(PropUtils.class); private static Map<String, Map<String, String>> propMap = new LinkedHashMap<String, Map<String, String>>(); /** * 加载配置文件 * * @param filepath * 文件路径 * @param alias * 当前属性文件别名 * @param trim * value是否trim */ public static void use(String filepath, String alias, boolean trim) { Assert.hasLength(filepath); propMap.clear(); try { InputStream in = new FileInputStream(filepath); Properties prop = new Properties(); prop.load(in); Map<String, String> cntPropMap = new LinkedHashMap<String, String>(); Set<Object> keySet = prop.keySet(); for (Object keyObj : keySet) { if (ObjectUtils.isNotBlank(keyObj)) { String key = keyObj.toString(); cntPropMap.put(key, trim ? prop.getProperty(key).trim() : prop.getProperty(key)); } } propMap.put(alias, cntPropMap); } catch (IOException e) { e.printStackTrace(); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static String getString(String alias, String key) { Map<String, String> aliasPropMap = propMap.get(alias); if (aliasPropMap == null) { logger.warn("Current property files doesn't contails alias " + alias + ", you could load your property file like this: PropUtils.use(filepath, alias, trim)..."); return null; } else { return aliasPropMap.get(key); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static Integer getInt(String alias, String key) { String value = getString(alias, key); if (value == null) { return null; } else { return Integer.valueOf(value); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static Long getLong(String alias, String key) { String value = getString(alias, key); if (value == null) { return null; } else { return Long.valueOf(value); } } }
[ "17197880306@163.com" ]
17197880306@163.com
0a018503bd18ce47330c75e0d353e34f0e091fa4
111d530d727a601c7298c7def60fc87b0a1723c2
/project1/src/main/Entity.java
d61696bd1bae7f0d5a1e5f8894d24175f7b7a93e
[]
no_license
fgudino3/cs4470-projects
279b7ebbece616bb23cb71bc516c36e8e33a1ae9
c3f82a9420f3e8f406971604505cc76f7c1ba451
refs/heads/master
2020-08-05T17:08:44.957748
2019-11-25T21:31:36
2019-11-25T21:31:36
212,627,812
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package main; public abstract class Entity { // Each entity will have a distance table protected int[][] distanceTable = new int[NetworkSimulator.NUMENTITIES] [NetworkSimulator.NUMENTITIES]; // The update function. Will have to be written in subclasses by students public abstract void update(Packet p); // The link cost change handlder. Will have to be written in appropriate // subclasses by students. Note that only Entity0 and Entity1 will need // this, and only if extra credit is being done public abstract void linkCostChangeHandler(int whichLink, int newCost); // Print the distance table of the current entity. protected abstract void printDT(); }
[ "frankyjg96@gmail.com" ]
frankyjg96@gmail.com
992e58df64f9a1f6ce0e3f2ada621ea27b3c49a9
72383cff5d2d711ea86c8b434f1e3fe875467804
/src/main/java/com/mavuno/famers/union/mavuno/models/ApiMpesaB2cReq.java
ee59d109c615ed7ffee94f538235ac821298d2fb
[]
no_license
KIbanyu/MavunoFarmersUnion-
ea63ef361e087c7f6f7c266d353d872a433ae09d
8e71c6ea1d84fcc3addfaac8bfe15b1611577d11
refs/heads/main
2023-01-13T18:09:19.639667
2020-11-12T11:49:21
2020-11-12T11:49:21
312,247,804
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
package com.mavuno.famers.union.mavuno.models; import com.sun.istack.NotNull; import java.math.BigDecimal; public class ApiMpesaB2cReq { @NotNull private String phoneNumber; @NotNull private BigDecimal amount; public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } }
[ "itotia.kibanyu@riverbank.co.ke" ]
itotia.kibanyu@riverbank.co.ke
cfe23568ca6d6c310746aeefef49908714169155
b892831c64f72e7519752b92d2dde468755c278a
/ajax/src/main/java/com/kaishengit/web/DictionaryServlet.java
336533ba4207db6dbaec9b2785c850ecc4a75796
[]
no_license
lizhenqi/MyJava
c2586fe3c695c7c1d98bb8894fc540bb80afc1b0
3786a82152c4230e5b0980b32f6d4f0783149615
refs/heads/master
2021-01-19T04:20:13.600927
2016-07-20T03:38:49
2016-07-20T03:38:49
60,684,848
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package com.kaishengit.web; import com.kaishengit.util.HttpUtil; import com.kaishengit.util.HttpUtil; 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 java.io.IOException; import java.io.PrintWriter; /** * Created by Administrator on 2016/6/21. */ @WebServlet("/dict") public class DictionaryServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String word=req.getParameter("q"); word=new String(word.getBytes("ISO8859-1"),"utf-8"); String url="http://fanyi.youdao.com/openapi.do?keyfrom=kaishengit&key=1587754017&type=data&doctype=xml&version=1.1&q="+word; String xml= HttpUtil.getRequestText(url); resp.setContentType("text/xml;charset=utf-8"); PrintWriter out=resp.getWriter(); out.print(xml); out.flush(); out.close(); }}
[ "565400895@qq.com" ]
565400895@qq.com
2a34cb0e511d7452c4ede09804251c445a99444e
d2d86bc8321c2430515bfd54afd5d38a9298dd0d
/src/main/java/math/complex/MComplex.java
419b118963bf672c7453493274afae707c20eb5d
[]
no_license
stefan-zobel/wip
c27cde4e9be1aead994bf157cfe1ba791c36953b
aa13736f2466dbf7a54e0b55ac19fb0769a91829
refs/heads/master
2023-08-08T04:00:35.742724
2023-08-07T13:54:59
2023-08-07T13:54:59
219,505,362
2
2
null
2022-10-04T23:58:31
2019-11-04T13:14:57
Java
UTF-8
Java
false
false
4,409
java
/* * Copyright 2018 Stefan Zobel * * 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 math.complex; /** * Mutable {@link IComplex} implementation. */ public final class MComplex extends AComplex implements IComplex { private double re; private double im; public double re() { return re; } public double im() { return im; } public MComplex(double re) { this(re, 0.0); } public MComplex(double re, double im) { this.re = re; this.im = im; } public MComplex(IComplex that) { this.re = that.re(); this.im = that.im(); } public void setRe(double re) { this.re = re; } public void setIm(double im) { this.im = im; } public MComplex copy() { return new MComplex(re, im); } public boolean isMutable() { return true; } public IComplex add(IComplex that) { re += that.re(); im += that.im(); return this; } public IComplex sub(IComplex that) { re -= that.re(); im -= that.im(); return this; } public IComplex mul(IComplex that) { if (isInfinite() || that.isInfinite()) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } double this_re = re; double that_re = that.re(); re = this_re * that_re - im * that.im(); im = im * that_re + this_re * that.im(); return this; } public IComplex div(IComplex that) { double c = that.re(); double d = that.im(); if (c == 0.0 && d == 0.0) { re = Double.NaN; im = Double.NaN; return this; } if (that.isInfinite() && !this.isInfinite()) { re = 0.0; im = 0.0; return this; } // limit overflow/underflow if (Math.abs(c) < Math.abs(d)) { double q = c / d; double denom = c * q + d; double real = re; re = (real * q + im) / denom; im = (im * q - real) / denom; } else { double q = d / c; double denom = d * q + c; double real = re; re = (im * q + real) / denom; im = (im - real * q) / denom; } return this; } public IComplex inv() { if (re == 0.0 && im == 0.0) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } if (isInfinite()) { re = 0.0; im = 0.0; return this; } double scale = re * re + im * im; re = re / scale; im = -im / scale; return this; } public IComplex ln() { double abs = abs(); double phi = arg(); re = Math.log(abs); im = phi; return this; } public IComplex exp() { ComplexFun.exp(this, true, true); return this; } public IComplex pow(double exponent) { return ln().scale(exponent).exp(); } public IComplex pow(IComplex exponent) { return ln().mul(exponent).exp(); } public IComplex scale(double alpha) { if (isInfinite() || Double.isInfinite(alpha)) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } re = alpha * re; im = alpha * im; return this; } public IComplex conj() { im = -im; return this; } public IComplex neg() { re = -re; im = -im; return this; } }
[ "stefan-zobel@users.noreply.github.com" ]
stefan-zobel@users.noreply.github.com
a4feb646d236795b6035904e4ea9b28bd6044e9c
0a45c48d057a004b7da215d589132fdb2160b2d5
/src/QUANLICUAHANGXEMAYDAL/UserDAL.java
a12723b5e65b15bce6bd5e816b7b39673a8137ec
[]
no_license
campha10x/QUANLICUAHANGXEMAY_JAVA
30a7fb8631f6db07d713ebb188b3c9227b606bf2
6a219ec88650d73e4aa020965d62f0ee9aedddff
refs/heads/master
2021-01-12T03:12:58.698086
2017-01-06T05:04:04
2017-01-06T05:04:04
78,175,447
0
1
null
null
null
null
UTF-8
Java
false
false
6,097
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 QUANLICUAHANGXEMAYDAL; import QUANLICUAHANGXEMAYEntity.User; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author duy */ public class UserDAL extends DataAccessHelper { private final String GET_LOGIN = "SELECT * FROM Users where [User]=? and MatKhauMoi=?"; private final String GET_MANV = "SELECT MaUser FROM Users where [User]=? "; private final String UPDATE_Password = "UPDATE dbo.Users SET [MatKhauMoi] = ? " + " WHERE [User] = ?"; private String GET_ALL = "SELECT * FROM dbo.Users"; private final String ADD_DATA = "INSERT INTO dbo.Users([User], MaNhanVien, MatKhauMoi, Quyen)" + "VALUES (?,?,?,?)"; private final String UPDATE = "UPDATE dbo.Users SET [MaNhanVien] = ? ,[MatKhauMoi] = ? ,[Quyen] = ? " + " WHERE [User] = ?"; public ArrayList<User> getALL(String TOP, String WHERE, String ORDER) { ArrayList<User> objs = new ArrayList<>(); if (TOP.length() != 0 || WHERE.length() != 0 || ORDER.length() != 0) { GET_ALL = "SELECT "; if (TOP.length() != 0) { GET_ALL += "TOP " + TOP; } GET_ALL += "* FROM Users "; if (WHERE.length() != 0) { GET_ALL += "WHERE " + WHERE; } if (ORDER.length() != 0) { GET_ALL += "ORDER BY" + ORDER; } } try { getConnect(); PreparedStatement ps = conn.prepareStatement(GET_ALL); ResultSet rs = ps.executeQuery(); if (rs != null) { while (rs.next()) { User nv = new User(); nv.setUser(rs.getString("User")); nv.setMaNhanVien(rs.getString("MaNhanVien")); nv.setMatKhauMoi(rs.getString("MatKhauMoi")); nv.setQuyen(rs.getString("Quyen")); objs.add(nv); } getClose(); } } catch (SQLException ex) { Logger.getLogger(UserDAL.class.getName()).log(Level.SEVERE, null, ex); } GET_ALL = "SELECT * FROM dbo.Users"; return objs; } // private final String ADD_DATA = "INSERT INTO dbo.Users(User, MaNhanVien, MatKhauMoi, Quyen" // + "VALUES (?,?,?,?)"; public boolean AddData(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareStatement(ADD_DATA); ps.setString(1, nv.getUser()); ps.setString(2, nv.getMaNhanVien()); ps.setString(3, nv.getMatKhauMoi()); ps.setString(4, nv.getQuyen()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { } return check; } public boolean updateData(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareCall(UPDATE); //"UPDATE dbo.User SET [DienThoai] = ? ,[TenUser] = ? ,[NgaySinh] = ? ,[GioiTinh] = ?,[DiaChi]=?, [Chucvu]=?,[LuongCoBan]=?,[Ngayvaolam]=?,[Luong]=?" // + "WHERE [MaUser] = ?"; ps.setString(1, nv.getMaNhanVien()); ps.setString(2, nv.getMatKhauMoi()); ps.setString(3, nv.getQuyen()); ps.setString(4, nv.getUser()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public boolean getLogin(String u, String p) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareStatement(GET_LOGIN); ps.setString(1, u); ps.setString(2, p); ResultSet rs = ps.executeQuery(); if (rs != null && rs.next()) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public boolean update_Password(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareCall(UPDATE_Password); //UPDATE = "UPDATE dbo.Users SET [NgayNhap] = ? ,[MaUser] = ? ,[MaNhaCungCap] = ? " // + " WHERE [MaPN] = ?"; ps.setString(1, nv.getMatKhauMoi()); ps.setString(2, nv.getUser()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public String Get_MaNhanVien(String Users) throws SQLException { String MaNV = ""; Statement stmt = null; getConnect(); String query = "SELECT MaNhanVien FROM Users where [User]='" + Users + "' "; stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { MaNV = rs.getString("MaNhanVien"); } return MaNV; } public String Get_Quyen(String Users) throws SQLException { String Quyen = ""; Statement stmt = null; getConnect(); String query = "SELECT Quyen FROM Users where [User]='" + Users + "' "; stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { Quyen = rs.getString("Quyen"); } return Quyen; } }
[ "campha10x@yahoo.com.vn" ]
campha10x@yahoo.com.vn
f82f3b22f57c6dee51b1d9164647a2fefd6556b1
162ad880702a58a709a96cb9ad47fa164222e6ac
/src/main/java/com/training/Upload.java
35320dbdd8249417659dc348b3551ffb76f276bf
[]
no_license
mannepallirakesh/Book_Hibernate
5298e802c0d1b9470e3fe85c4b041e1cb0504033
ded9cd72ad3d9f6e4a18342fccf534cd0da63ce0
refs/heads/master
2021-04-30T16:34:54.955969
2017-01-26T00:15:00
2017-01-26T00:15:00
80,071,289
0
0
null
null
null
null
UTF-8
Java
false
false
2,775
java
package com.training; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; import oracle.jdbc.driver.OracleDriver; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.lang.*; import java.sql.Driver; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.hibernate.*; import org.hibernate.cfg.Configuration; import java.util.List; import org.hibernate.*; import org.hibernate.cfg.Configuration; import com.training.Mem; import oracle.jdbc.driver.OracleDriver; public class Upload extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String bookName = req.getParameter("bookName"); String authorName = req.getParameter("authorName"); int prIce = Integer.parseInt(req.getParameter("prIce")); res.setContentType("text/html"); PrintWriter out = res.getWriter(); try { System.out.println("enter try"); Session session = getSessionFactory().openSession(); Transaction transaction = session.getTransaction(); transaction.begin(); Books bk = new Books(); bk.setName(bookName); bk.setAuthor(authorName); bk.setPrice(prIce); session.save(bk); transaction.commit(); out.println("<HTML><HEAD><TITLE>Success</TITLE></HEAD>"); out.println(); out.println("<BODY>"); out.println("Congrats! You Uploaded a Book Successfully"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println("Click here for homepage<br></br><A HREF=\"" + req.getContextPath() +"/Home\">HOME</A>"); out.println("</BODY></HTML>"); out.println("</BODY>"); out.println("</HTML>"); } catch (Exception ex) { System.out.println("Unknown exception."); } finally { } } private static SessionFactory getSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new Configuration().configure("hibernate-example1.cfg.xml") .buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } }
[ "mannepallirakesh@gmail.com" ]
mannepallirakesh@gmail.com
b28306315a3897dc9d22a52c67983c8244babc6d
18d3bb5f5b90e20787055620188384d04acf977f
/src/main/java/com/scopic/antiqueauction/domain/entity/Sale.java
8f5eb9c4a445a0dc308ab00658bfcb8c1880dcfc
[ "MIT" ]
permissive
berkaltug/Antique-Auction-Project
345607915a9d7738af38bda9715eb365a2399a24
20da62fdc116db54cdbd156679c76be00dbdda34
refs/heads/master
2022-12-30T13:46:58.430981
2020-10-23T12:58:43
2020-10-23T12:58:43
301,093,608
0
0
null
null
null
null
UTF-8
Java
false
false
2,237
java
package com.scopic.antiqueauction.domain.entity; import javax.persistence.*; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Objects; @Entity public class Sale { @Id @GeneratedValue(strategy= GenerationType.AUTO) private Integer id; @ManyToOne(fetch = FetchType.LAZY) private Antique antique; private BigDecimal price; @ManyToOne(fetch = FetchType.LAZY) private User buyer; private LocalDateTime date; public Sale(Antique antique, BigDecimal price, User buyer, LocalDateTime date) { this.antique = antique; this.price = price; this.buyer = buyer; this.date = date; } public Sale() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Antique getAntique() { return antique; } public void setAntique(Antique antique) { this.antique = antique; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public User getBuyer() { return buyer; } public void setBuyer(User buyer) { this.buyer = buyer; } public LocalDateTime getDate() { return date; } public void setDate(LocalDateTime date) { this.date = date; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Sale sale = (Sale) o; return Objects.equals(id, sale.id) && Objects.equals(antique, sale.antique) && Objects.equals(price, sale.price) && Objects.equals(buyer, sale.buyer) && Objects.equals(date, sale.date); } @Override public int hashCode() { return Objects.hash(id, antique, price, buyer, date); } @Override public String toString() { return "Sale{" + "id=" + id + ", antique=" + antique + ", price=" + price + ", buyer=" + buyer + ", date=" + date + '}'; } }
[ "berkaltug96@gmail.com" ]
berkaltug96@gmail.com
b434bf52ecdbc56d7d4417e9d70302b99ca3aa91
fa2604277be063f4cc246eadf0c8134c331a8b77
/src/bytebybyte/ClockAngle.java
8820ad92c4773423c78fe0aef962530ada8462ae
[]
no_license
nannareshkumar/sample
ae42f86c580cf65abf8626e531c151d801a92801
1e3c2b957510f69ebe3df928f85e2116de094679
refs/heads/master
2023-07-29T02:35:19.984542
2021-08-31T10:29:26
2021-08-31T10:29:26
295,343,461
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package bytebybyte;/* * Title: Clock Angle * * Given two integers, an hour and a minute, write a function to * calculate the angle between the two hands on a clock representing * that time. * * Execution: javac ClockAngle.java && java ClockAngle * For more details, check out http://www.byte-by-byte.com/clockangle */ public class ClockAngle { public static double clockAngle(int hour, int minutes) { final double MINUTES_PER_HOUR = 60; final double DEGREES_PER_MINUTE = 360 / MINUTES_PER_HOUR; final double DEGREES_PER_HOUR = 360 / 12; double minuteAngle = minutes * DEGREES_PER_MINUTE; double hourAngle = hour * DEGREES_PER_HOUR + (minutes / MINUTES_PER_HOUR) * DEGREES_PER_HOUR; double diff = Math.abs(minuteAngle - hourAngle); if (diff > 180) { return 360 - diff; } return diff; } // threads.Sample test cases public static void main(String[] args) { assert clockAngle(3, 40) == 130: "3:40 is 130 degrees"; assert clockAngle(1, 20) == 80: "1:20 is 80 degrees"; assert clockAngle(5, 15) == 67.5: "5:15 is 67.5 degrees"; System.out.println("Passed all test cases"); } }
[ "kumar.nandhikanti@gmail.com" ]
kumar.nandhikanti@gmail.com
34765a791b12f287c407d1b8d4029cd3188adb45
3ff114b325735317d30dea3f9b38537b776aa6df
/javapr/src/loop/ForLoop.java
b44f78fca4ddefdb58a39a6ef355983ef4f1ad5e
[]
no_license
elankanei/javabasics
3c8104335e832d1b96e6ecd3ec6d7705f35b0479
7eb0cb584cf13281717656d3aa60d720d316da8c
refs/heads/master
2020-03-18T21:14:45.971003
2018-06-03T05:49:43
2018-06-03T05:49:43
135,269,264
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package loop; public class ForLoop { public static void main(String args[]) {int i; for(i=1;i<10;i++) { System.out.println(i); } } }
[ "elankanei1197@gmail.com" ]
elankanei1197@gmail.com
5efddd5f4d30f81bba8705b496f0903f8a71265c
797b00c62f8eefc196cf23b28342ef00181fb025
/app/src/main/java/com/quantag/geofenceapp/connectivity/ConnectivityEventsReceiver.java
39d5ce789f347557247156bb723b53382df24c9f
[]
no_license
VasylT/GeofenceMonitor
241454cca604493779b167e58e2013842f30f294
5f1e772f062053ab4d9a96ea16cb119692009943
refs/heads/master
2020-06-24T05:34:29.874214
2017-07-13T10:16:04
2017-07-13T10:16:04
96,921,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package com.quantag.geofenceapp.connectivity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.support.v4.content.LocalBroadcastManager; import com.quantag.geofenceapp.utilities.Constants; public class ConnectivityEventsReceiver extends BroadcastReceiver { private boolean isRegistered = false; public interface IConnectivityReceiver { void onConnected(String extraInfo, boolean isNewWiFi); void onDisconnected(); } private IConnectivityReceiver mListener; public ConnectivityEventsReceiver(IConnectivityReceiver listener) { mListener = listener; } @Override public void onReceive(Context context, Intent intent) { int message = intent.getIntExtra(Constants.ARG_MESSAGE, 0); switch (message) { case Constants.MSG_CONNECTED: String extraInfo = intent.getStringExtra(Constants.ARG_STRING); boolean isNewWiFi = intent.getBooleanExtra(Constants.ARG_BOOLEAN, false); mListener.onConnected(extraInfo, isNewWiFi); break; case Constants.MSG_DISCONNECTED: mListener.onDisconnected(); break; default: } } public void register(Context context) { if (!isRegistered) { IntentFilter filter = new IntentFilter(Constants.ACTION_CONNECTIVITY); LocalBroadcastManager.getInstance(context).registerReceiver(this, filter); isRegistered = true; } } public void unregister(Context context) { if (isRegistered) { LocalBroadcastManager.getInstance(context).unregisterReceiver(this); isRegistered = false; } } }
[ "vasyl.tkachov@quantag-it.com" ]
vasyl.tkachov@quantag-it.com
03cfbe12a2e408b7692a4a23fc6895b599c927f8
9d4dfd6d9a47d69582a95b5e1733ec6c3b56ad4a
/algorithm/src/main/java/org/anonymous/loop/LinkedListDeleter.java
f91122841c76a32ce06b75244512b7b438de1312
[]
no_license
MacleZhou/child-s-notes
bee5979c351b2c4bab4cbda04168daa8f4877cee
951255a3c11797874ca13f28833ed0e590acd097
refs/heads/master
2023-04-14T00:11:56.906785
2020-06-23T06:23:11
2020-06-23T06:23:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package org.anonymous.loop; import org.anonymous.Node; /** * ~~ Talk is cheap. Show me the code. ~~ :-) * * @author MiaoOne * @since 2020/6/4 13:32 */ public class LinkedListDeleter { public Node deleteIfEquals(Node head, int value) { /*if (head.getValue() == value) { head = head.getNext(); }*/ while (head != null && head.getValue() == value) { head = head.getNext(); } if (head == null) { return null; } Node prev = head; while (prev.getNext() != null) { if (prev.getNext().getValue() == value) { // delete it prev.setNext(prev.getNext().getNext()); } else { prev = prev.getNext(); } } return head; } }
[ "13163249276@163.com" ]
13163249276@163.com
d1dff7640369e8f4a73914879e7c4637cd2e6a00
fb6a18d4fc7a90b77d6307f640727021b98664b7
/src/main/java/tv/seei/manage/ais/dao/DataLinkManagementRepository.java
7180d6e5aa74f99623b15c320c95878575f23911
[]
no_license
zDream/springboot
b370b4a04e97f7462a492f4291b8574df6c699f6
8362b6960214758612aebd827ff19c38054811cc
refs/heads/master
2021-05-11T10:24:05.229443
2018-06-25T02:23:52
2018-06-25T02:23:52
118,102,426
1
0
null
null
null
null
UTF-8
Java
false
false
475
java
package tv.seei.manage.ais.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import tv.seei.manage.ais.entity.DataLinkManagement; import java.io.Serializable; public interface DataLinkManagementRepository extends JpaRepository<DataLinkManagement,Long>,Serializable, JpaSpecificationExecutor<DataLinkManagement> { // DataLinkManagement findByName(String name); }
[ "zttongdeyx@126.com" ]
zttongdeyx@126.com
7fb2c41b4cee5930157ba4f6bfcbe3ede227b7f2
a63f73a0c0be8bbb7b9b591769b2a5ad26779c9d
/Ex3/Q4Test.java
b1eaf8bf5767b8bff6743c108014a19d9bf2a340
[]
no_license
ItamarAsulin/JAVA-Intro-Assignments
8517e22e24cbb1f212eb8794e52891c456be63eb
4078ede25a01960a7990b7ef15e98f611840e49c
refs/heads/main
2023-02-26T15:42:34.157299
2021-01-30T12:11:34
2021-01-30T12:11:34
334,167,489
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package ex3; import org.junit.jupiter.api.Test; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.*; class Q4Test { @Test void sumOfNeighboursTest() { int[][] mat = {{3,5,7,5},{-4,2,10,11},{9,-50,3,60}}; int[][] summedMat = Q4.sumOfNeighbours(mat); int [][] expectedResult = {{3, 18, 33, 28}, {-31, -17, 43, 85}, {-52, 20, 33, 24}}; for (int i = 0; i < expectedResult.length; i++) { for (int j = 0; j < expectedResult[i].length ; j++) { assertEquals(summedMat[i][j], expectedResult[i][j]); } } } }
[ "itamarq@gmail.com" ]
itamarq@gmail.com
1b2c056dd610d55e70e936db40f3811ee9143f51
89d191392632bbd7d29d4ab18f15848ece9f4951
/app/src/main/java/me/tsukanov/counter/infrastructure/BroadcastHelper.java
cf04a7d86ccb7855fce8d8305fd03aba28cf5b22
[ "Apache-2.0" ]
permissive
nafraf/Simple-Counter
4c873cbaaf7a6f7401faedab831902fc9f4406c1
ce6ef2f06479e91b00dbd0fa0705eceaa80d1d09
refs/heads/master
2023-08-09T00:11:24.094568
2023-05-16T03:16:13
2023-05-16T03:18:20
37,788,930
0
0
Apache-2.0
2019-01-14T02:33:15
2015-06-20T22:56:52
Java
UTF-8
Java
false
false
1,341
java
package me.tsukanov.counter.infrastructure; import android.content.Context; import android.content.Intent; import androidx.annotation.NonNull; import android.util.Log; import me.tsukanov.counter.CounterApplication; public class BroadcastHelper { public static final String EXTRA_COUNTER_NAME = String.format("%s.EXTRA_COUNTER_NAME", CounterApplication.PACKAGE_NAME); private static final String TAG = BroadcastHelper.class.getSimpleName(); @NonNull private final Context context; public BroadcastHelper(@NonNull final Context context) { this.context = context; } private void sendBroadcast(@NonNull final Intent intent) { this.context.sendBroadcast(intent); } public void sendBroadcast(@NonNull final Actions action) { final Intent intent = new Intent(); intent.setAction(action.getActionName()); intent.addCategory(Intent.CATEGORY_DEFAULT); sendBroadcast(intent); } public void sendSelectCounterBroadcast(@NonNull final String counterName) { final Intent intent = new Intent(); intent.setAction(Actions.SELECT_COUNTER.getActionName()); intent.putExtra(EXTRA_COUNTER_NAME, counterName); intent.addCategory(Intent.CATEGORY_DEFAULT); sendBroadcast(intent); Log.d(TAG, String.format("Sending counter selection broadcast [counterName=%s]", counterName)); } }
[ "gentlecat@users.noreply.github.com" ]
gentlecat@users.noreply.github.com
70bffbac85b543b98dd8f6e88117fdbd4c673773
5b4d8bbbc2d5fc8355cfb1d6f31e32f2c6354ac0
/app/src/main/java/com/niupai_xxr_lqtj/myui/view/RecyclerViewBaseOnPullToRefresh.java
7e40a75c5fc29d0490489b6ee5087d2422fbfa66
[]
no_license
heroxu/Final_Project_Xxr
0218530e717e1024c57f38e3739904aa9abee760
d62cad2150cf3f8dcc53bf419b19e3865f75703f
refs/heads/master
2023-05-01T12:28:14.578026
2016-05-14T05:17:32
2016-05-14T05:17:32
58,790,076
1
1
null
null
null
null
UTF-8
Java
false
false
1,897
java
package com.niupai_xxr_lqtj.myui.view; /** * Created by xuxiarong on 16/5/5. */ import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; import com.handmark.pulltorefresh.library.PullToRefreshBase; public class RecyclerViewBaseOnPullToRefresh extends PullToRefreshBase<RecyclerView> { public RecyclerViewBaseOnPullToRefresh(Context context) { super(context); } public RecyclerViewBaseOnPullToRefresh(Context context, AttributeSet attrs) { super(context, attrs); } public RecyclerViewBaseOnPullToRefresh(Context context, Mode mode) { super(context, mode); } public RecyclerViewBaseOnPullToRefresh(Context context, Mode mode, AnimationStyle animStyle) { super(context, mode, animStyle); } //重写4个方法 //1 滑动方向 @Override public Orientation getPullToRefreshScrollDirection() { return Orientation.VERTICAL; } //重写4个方法 //2 滑动的View @Override protected RecyclerView createRefreshableView(Context context, AttributeSet attrs) { RecyclerView view = new RecyclerView(context, attrs); return view; } //重写4个方法 //3 是否滑动到底部 @Override protected boolean isReadyForPullEnd() { View view = getRefreshableView().getChildAt(getRefreshableView().getChildCount() - 1); if (null != view) { return getRefreshableView().getBottom() >= view.getBottom(); } return false; } //重写4个方法 //4 是否滑动到顶部 @Override protected boolean isReadyForPullStart() { View view = getRefreshableView().getChildAt(0); if (view != null) { return view.getTop() >= getRefreshableView().getTop(); } return false; } }
[ "624591992@qq.com" ]
624591992@qq.com
8f13e67e9bec25bdc9e8bbc2d2bebb0954bc664e
da488ecf85205273ef3a0d9fd24aba24544cbd9d
/src/com/sharedcab/batchcar/GooglePlaces.java
928a9f3ddfd2380b01f8dd0f191a51cfb7118c1d
[]
no_license
kailIII/taxi-android-app
a3314886aecaa400075c7502551a2549ca66bc8d
3502da96614806caebc9c7e184535eefc38234cb
refs/heads/master
2020-03-07T07:04:19.496160
2015-01-04T17:31:18
2015-01-04T17:31:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,446
java
package com.sharedcab.batchcar; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class GooglePlaces { private static final String LOG_TAG = "Batchcar"; private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place"; private static final String TYPE_AUTOCOMPLETE = "/autocomplete"; private static final String TYPE_DETAILS = "/details"; private static final String OUT_JSON = "/json"; private String apiKey; public GooglePlaces(String apiKey) { this.apiKey = apiKey; } public ArrayList<HashMap<String,String>> autocomplete(String input) { ArrayList<HashMap<String,String>> resultList = null; StringBuilder sb = new StringBuilder(PLACES_API_BASE + TYPE_AUTOCOMPLETE + OUT_JSON); sb.append("?sensor=true&key=" + apiKey); sb.append("&components=country:in"); sb.append("&location=19.1167,72.8333&radius=50000"); sb.append("&components=country:in"); try { sb.append("&input=" + URLEncoder.encode(input, "utf8")); } catch (UnsupportedEncodingException e) { Log.e(LOG_TAG, "Error connecting to Places API", e); return resultList; } try { JSONObject jsonObj = new JSONObject(downloadStuff(sb.toString())); JSONArray predsJsonArray = jsonObj.getJSONArray("predictions"); resultList = new ArrayList<HashMap<String,String>>(predsJsonArray.length()); for (int i = 0; i < predsJsonArray.length(); i++) { JSONObject item = predsJsonArray.getJSONObject(i); HashMap<String, String> newhm = new HashMap<String, String>(); newhm.put("description", item.getString("description")); newhm.put("reference", item.getString("reference")); resultList.add(newhm); } } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return resultList; } public CustomAddress location(String reference) { JSONObject json = details(reference); try { JSONObject result = json.getJSONObject("result"); JSONObject location = result.getJSONObject("geometry").getJSONObject("location"); String name = result.getString("formatted_address"); String lat = Double.toString(location.getDouble("lat")); String lng = Double.toString(location.getDouble("lng")); return new CustomAddress(name, lat, lng); } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return null; } public JSONObject details(String reference) { StringBuilder sb = new StringBuilder(PLACES_API_BASE + TYPE_DETAILS + OUT_JSON); sb.append("?sensor=true&key=" + apiKey); sb.append("&reference=" + reference); try { return new JSONObject(downloadStuff(sb.toString())); } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return null; } private static String downloadStuff(String uri) { HttpURLConnection conn = null; StringBuilder jsonResults = new StringBuilder(); try { URL url = new URL(uri); conn = (HttpURLConnection) url.openConnection(); InputStreamReader in = new InputStreamReader(conn.getInputStream()); int read; char[] buff = new char[1024]; while ((read = in.read(buff)) != -1) { jsonResults.append(buff, 0, read); } } catch (MalformedURLException e) { Log.e(LOG_TAG, "Error processing Places API URL", e); return null; } catch (IOException e) { Log.e(LOG_TAG, "Error connecting to Places API", e); return null; } finally { if (conn != null) { conn.disconnect(); } } return jsonResults.toString(); } }
[ "sahilshah15@gmail.com" ]
sahilshah15@gmail.com
1a1ee4be632d664a5871f5f91fef5b064fd4adf0
b5c1d0c55c5234f34ad3278f4d641f12f4ea881f
/src/main/java/com/example/sunilrestdemo/entity/Book.java
76afd911068717dc74d961f03daa9fb6d537e722
[]
no_license
sunilmore690/spring-rest-book
08f0a81f1a8050a0fe63dec91887ec5612900eaa
d3c8a39a3d6c807d84c4477e72a49985e88b93c5
refs/heads/master
2023-04-01T22:50:13.359355
2021-04-10T15:01:37
2021-04-10T15:01:37
354,554,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package com.example.sunilrestdemo.entity; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Book { @Id @GeneratedValue(generator = "UUID") @GenericGenerator( name = "UUID", strategy = "org.hibernate.id.UUIDGenerator" ) @Column(updatable = false, nullable = false) private String id; private String name; private String author; private String category; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
[ "sunilmore690@gmail.com" ]
sunilmore690@gmail.com
e538953357243685d224bbcf257226961d86557f
de4c47f20dd597da1d42e9b1c4355e26d92bdb02
/src/main/java/com/smart/aspectj/fun/Waiter.java
6990eb42d1310ff3ab8d20f3d696d58c7c48c115
[]
no_license
leozhiyu/spring
513f0982cc47c9a130931cc07adc1f7fe4b25cb4
efcf69add3a914194d49e96554e0db664b57f458
refs/heads/master
2020-03-21T04:10:48.287006
2018-06-24T11:47:24
2018-06-24T11:47:24
138,095,207
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package com.smart.aspectj.fun; import com.smart.aspectj.anno.NeedTest; public interface Waiter { @NeedTest void greetTo(String clientName); void serveTo(String clientName); }
[ "18779775257@163.com" ]
18779775257@163.com
166c159bc89d97d24ee5d1e222e62bd153e91fb2
3a5a5aa4b24365afd672c08223ac4c993059d32a
/src/main/java/ru/job4j/utils/SqlRuDateTimeParser.java
85e78a8f446f0e57b3d4c0b5a5aef94d1ab42c50
[]
no_license
k2250427/job4j_grabber
8f7fa273af9b2a9abf883db4fe6f84b8c0f35166
6c96b219300fa967e84e6f39c6a372a4a945afa0
refs/heads/master
2023-07-02T22:41:09.818603
2021-08-10T17:17:43
2021-08-10T17:17:43
392,389,572
0
0
null
null
null
null
UTF-8
Java
false
false
2,276
java
package ru.job4j.utils; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static java.util.Map.entry; public class SqlRuDateTimeParser implements DateTimeParser { @SuppressWarnings("checkstyle:ConstantName") private static final Map<String, String> MONTHTONUMBER = Map.ofEntries( entry("янв", "01"), entry("фев", "02"), entry("мар", "03"), entry("апр", "04"), entry("май", "05"), entry("июн", "06"), entry("июл", "07"), entry("авг", "08"), entry("сен", "09"), entry("окт", "10"), entry("ноя", "11"), entry("дек", "12") ); @Override public LocalDateTime parse(String parse) { String[] buffer = parse.replace(",", "").split(" "); String[] dateParts = new String[4]; if (buffer.length == 2) { LocalDate date; if (buffer[0].equals("сегодня")) { date = LocalDate.now(); } else if (buffer[0].equals("вчера")) { date = LocalDate.now().minusDays(1L); } else { throw new IllegalArgumentException(); } dateParts[0] = String.valueOf(date.getDayOfMonth()); dateParts[1] = String.format("%02d", date.getMonthValue()); dateParts[2] = String.valueOf(date.getYear()); dateParts[3] = buffer[1]; } else { buffer[1] = MONTHTONUMBER.get(buffer[1]); int year = Integer.parseInt(buffer[2]); if (year < 2000) { buffer[2] = String.valueOf(year + 2000); } dateParts = Arrays.copyOf(buffer, 4); } String sb = String.join(" ", dateParts[0], dateParts[1], dateParts[2], dateParts[3]); return LocalDateTime.parse(sb, DateTimeFormatter.ofPattern("d MM yyyy HH:mm")); } public static void main(String[] args) { SqlRuDateTimeParser dtp = new SqlRuDateTimeParser(); LocalDateTime dt = dtp.parse("13 дек 21, 10:51"); } }
[ "kstasyuk@ya.ru" ]
kstasyuk@ya.ru
55bc3492e9719fb5cfd834a68134c155ca2886d4
5bd806fe2f4d7060aaf37ff3c9509f6a7790df96
/laboratory/java/office-document/sword-laboratory-easyexcel/src/test/java/com/alibaba/excel/EasyExcelTest.java
d4e49e463c4707d9e5ad7e10ad91bbc65a306689
[ "MIT" ]
permissive
bluesword12350/sword-laboratory
f3eb04012e565821b138e33f62139c29670a8fa0
8086a56933cc3ac8fac6f571224a90a86b791990
refs/heads/master
2023-08-20T12:57:47.600045
2023-08-09T01:58:11
2023-08-09T01:58:11
192,196,809
0
0
MIT
2023-07-14T02:40:23
2019-06-16T13:53:44
Java
UTF-8
Java
false
false
366
java
package com.alibaba.excel; import org.junit.jupiter.api.Test; import top.bluesword.model.DemoData; import java.util.List; class EasyExcelTest { @Test void simpleWrite() { String fileName = "write" + System.currentTimeMillis() + ".xlsx"; EasyExcel.write(fileName, DemoData.class).sheet("模板").doWrite(List.of(new DemoData())); } }
[ "yunlelongzai@qq.com" ]
yunlelongzai@qq.com
6fe1645286ad7707eafe70945832a9c1410249c4
dbe24984b40f745218b87ccbbe5cfd0ed9d174d9
/src/main/java/com/rajesh/HibDemo/DTO/Laptop.java
5f60b9a3f8e3396b4591f389565c97b0109abb42
[]
no_license
rajeshpanda796/Hibernate
5c18704458ae055b818d8659a3f5b17aec80b473
8267e25462b42448e0a433c4ccecbde309f1ba90
refs/heads/master
2023-04-18T03:22:03.680535
2021-04-22T14:27:50
2021-04-22T14:27:50
358,959,834
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.rajesh.HibDemo.DTO; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="Laptop") public class Laptop { @Id private int lid; private String lname; //@OneToOne(mappedBy = "rollno") //private int rollno; public int getLid() { return lid; } public void setLid(int lid) { this.lid = lid; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } }
[ "rajeshpanda796@gmail.com" ]
rajeshpanda796@gmail.com
52d6eda50a85b3611b207228743c7f8a31e55176
762ee945a7842465e29344921aa8f53a5e42ad36
/src/main/java/com/example/test/moder/User.java
4f47ea25cd8dfead68293396018e6c27bbd5d8b7
[]
no_license
zhuzhiwenzzw/zzw-springboot
a0ec59f7df7b53a29e892278ba949904dedc17bd
473b66616298b5a06d1b04ef60ffa2dcf7ee14f9
refs/heads/master
2020-08-28T22:49:17.504122
2019-10-27T15:41:59
2019-10-27T15:41:59
217,844,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,078
java
package com.example.test.moder; import javax.persistence.*; @Entity @Table(name = "t_user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String username; private String password; private int age; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", password='" + password + '\'' + ", age=" + age + '}'; } }
[ "1530448242@qq.com" ]
1530448242@qq.com
18caddbaca8eeebe8b69f9fb64b3cc9eeb4c7797
5ff6b4da08a3b7105e29a0cdbbffe2c5103f69fc
/src/Medium/PartitionList.java
bfd34c94a858f42b1d4ab117c85956653c8ab799
[]
no_license
Haydes/My_Leetcode_Solutions
64dcda9a3598bcc6b5c95c8e9b8c6cacbba4d3e8
f5e5cf62bcba4f8fa866bac0a1d48e96e08afcfe
refs/heads/master
2023-03-12T23:18:16.824448
2021-02-26T17:22:22
2021-02-26T17:22:22
341,530,270
0
0
null
null
null
null
UTF-8
Java
false
false
2,257
java
package Medium; import utils.ListNode; /** * 86. Partition List * * Given the head of a linked list and a value x, partition it such that all * nodes less than x come before nodes greater than or equal to x. * * You should preserve the original relative order of the nodes in each of the * two partitions. * * Constraints: * * The number of nodes in the list is in the range [0, 200]. * * -100 <= Node.val <=100 * * -200 <= x <= 200 */ public class PartitionList { public static void main(String[] args) { ListNode head = new ListNode(1, new ListNode(4, new ListNode(3, new ListNode(2, new ListNode(5, new ListNode(2)))))); System.out.println(head); ListNode partition = partition2(head, 3); System.out.println(partition); } /** * 链表内调换位置 * * 0 ms, faster than 100.00% * * @param head * @param x * @return */ public static ListNode partition(ListNode head, int x) { ListNode dummy = new ListNode(); dummy.next = head; ListNode pre = dummy; ListNode current = dummy.next; // 插入的位置在insertPos的下一个 ListNode insertPos = dummy; while (current != null) { // 如果当前值比x小,则移动到当前需要插入的位置 if (current.val < x) { // 前一个的下一个为当前的下一个 pre.next = current.next; // 当前的下一个为insertPos的下一个 current.next = insertPos.next; // 然后要插入的下一个位置变为current insertPos.next = current; insertPos = current; } pre = current; current = current.next; } return dummy.next; } /** * 小的全部放第一个链表,大的全部放第二个,然后第一个第二个链表连起来 * * 0 ms, faster than 100.00% * * @param head * @param x * @return */ public static ListNode partition2(ListNode head, int x) { ListNode node1 = new ListNode(); ListNode node2 = new ListNode(); ListNode n1 = node1; ListNode n2 = node2; ListNode current = head; while (current != null) { if (current.val < x) { n1.next = current; n1 = n1.next; } else { n2.next = current; n2 = n2.next; } current = current.next; } n2.next = null; n1.next = node2.next; return node1.next; } }
[ "knobea@qq.com" ]
knobea@qq.com
6a61b37957202fcaa9f98460d42c6e56313e28ae
b9a6beda6ec3da22a6e14158794de96701a9c271
/src/main/java/com/mykolabs/apple/pageobjects/InstructionsPage.java
11a33ec95b79c5ea78d5e45afa38a61c842e4701
[]
no_license
nikprix/webdriver-demo
e1ec716a16c1111ee72e47511001eea90365fc1f
a78d16499bfc9470b62e3e133c7a8a8fb3ab76f7
refs/heads/master
2021-01-20T14:18:51.427863
2017-05-25T04:52:54
2017-05-25T04:52:54
90,585,497
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package com.mykolabs.apple.pageobjects; /** * * @author nikprix */ public interface InstructionsPage { String INSTRUCTIONS_PAGE_TITLE = "Unsubscribing from Apple email subscriptions - Apple Support"; void loadEmailSubscriptions(); }
[ "gitkola@gmail.com" ]
gitkola@gmail.com
912dee1826dff59f5c78320481224673353e9520
c75effa001db5a11b8a6deb8dde85d4333f736cb
/app/src/main/java/com/example/a16/MainActivity.java
235b7563382770f783d4168697b6d3ebf936cad6
[]
no_license
qp759/16-listview
b98ae4fb444f93b71061ec8eba6dfc4dbbf1f2c6
525a418dcb09cf7cb40a9676fa10e914bedc328b
refs/heads/master
2020-12-03T02:56:00.320559
2020-01-01T07:25:36
2020-01-01T07:25:36
231,187,407
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package com.example.a16; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private TextView tv; private ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = findViewById(R.id.tv); lv = findViewById(R.id.lv); ArrayAdapter<CharSequence> arrAdapRegion = ArrayAdapter.createFromResource(getApplication(), R.array.list, android.R.layout.simple_list_item_1); lv.setAdapter(arrAdapRegion); lv.setOnItemClickListener(listViewRegionOnItemClick); } private AdapterView.OnItemClickListener listViewRegionOnItemClick = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String s = getString(R.string.selected); tv.setText(s + ((TextView) view).getText()); } }; }
[ "qp751359@gmail.com" ]
qp751359@gmail.com
a01a0f7d56a23b976508ea2d85d943bc71a19163
e85236402ee7e29535ba5ac6a2f7ba81b6d0c183
/technology_code/admin-plus/admin-core/src/main/java/com/finance/core/act/service/impl/ActicleServiceImpl.java
d9bec52cf1a503a23b336f952f4d8cdf2b331fdf
[ "Apache-2.0" ]
permissive
xiaotaowei1992/Working
78f95c06c6cf59247ede22a8ad4e1d3dea674bf1
b311ef4bd67af1c5be63b82cd662f7f7bfbdfaaf
refs/heads/master
2022-12-11T00:19:47.003256
2019-07-19T03:06:46
2019-07-19T03:06:46
136,190,476
0
0
null
2022-12-06T00:43:03
2018-06-05T14:33:12
Java
UTF-8
Java
false
false
2,620
java
package com.finance.core.act.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.finance.common.constant.ApiResultEnum; import com.finance.common.constant.Result; import com.finance.common.dto.PageDto; import com.finance.common.exception.TryAgainException; import com.finance.core.act.entity.Acticle; import com.finance.core.act.mapper.ActicleMapper; import com.finance.core.act.service.IActicleService; import com.finance.core.aspect.IsTryAgain; import org.springframework.stereotype.Service; import javax.servlet.http.HttpSession; /** * <p> * 服务实现类 * </p> * * @author rstyro * @since 2019-03-26 */ @Service public class ActicleServiceImpl extends ServiceImpl<ActicleMapper, Acticle> implements IActicleService{ @Override public Result getList(PageDto dto) throws Exception { IPage<Acticle> page = new Page<>(); if(dto.getPageNo() != null){ page.setCurrent(dto.getPageNo()); } if(dto.getPageSize() != null){ page.setSize(dto.getPageSize()); } QueryWrapper<Acticle> queryWrapper = new QueryWrapper(); // if(!StringUtils.isEmpty(dto.getKeyword())){ // queryWrapper.lambda() // .like(Acticle::getAuther,dto.getKeyword()) // .like(Acticle::getContent,dto.getKeyword()) // .like(Acticle::getTitle,dto.getKeyword()); // } IPage<Acticle> iPage = this.page(page, queryWrapper); return Result.ok(iPage); } @Override public Result add(Acticle item, HttpSession session) throws Exception { this.save(item); return Result.ok(); } /** * 更新失败就重试 * @param item * @param session * @return * @throws Exception */ @IsTryAgain public Result edit(Acticle item, HttpSession session) throws Exception { if(!this.updateById(item)){ throw new TryAgainException(ApiResultEnum.ERROR); } return Result.ok(); } @Override public Result del(Long id, HttpSession session) throws Exception { this.removeById(id); return Result.ok(); } @Override public Result getDetail(Long id) throws Exception { Acticle item = this.getOne(new QueryWrapper<Acticle>().lambda().eq(Acticle::getId,id)); return Result.ok(item); } }
[ "weixiaotao@shein.com" ]
weixiaotao@shein.com
c1bb1dd560d2a4f3edb08e8cb1fd7120520378ea
4ca31990d64db950951e50139f01f6e6f70f525c
/litchi-comsumer-movie-ribbon-properties-customizing/src/main/java/org/litchi/cloud/movie/ConsumperMovieRibbonPropertiesApplication.java
e010f463e957d2e2a1cea315d3c96c3d4f95b66d
[]
no_license
lyl616/litchi-cloud
6c6752b17b5f426cfd7f063c0196b3b01ce70ae3
f55b65b85d4c759b99ce78f992d49f64315f09f6
refs/heads/master
2021-01-24T08:47:57.055564
2018-03-20T10:29:29
2018-03-20T10:29:29
122,995,043
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
package org.litchi.cloud.movie; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableEurekaClient public class ConsumperMovieRibbonPropertiesApplication { @Bean @LoadBalanced public RestTemplate restTemplate() { return new RestTemplate(); } public static void main(String[] args) { SpringApplication.run(ConsumperMovieRibbonPropertiesApplication.class, args); } }
[ "liuyulong@wamingtech.com" ]
liuyulong@wamingtech.com
7ddc9494659fe654390c37d31d8a5378f2b7a087
3556f83a930b05526a8e4356c2d95dab5e94a22b
/src/main/java/org/ssh/pm/common/webservice/rs/server/impl/HzWebServiceImpl.java
d721a84af84c46e036dad50a3e39f9cf8c91ad4e
[]
no_license
yangjiandong/sshapp-mobileServer
2b2893a962fabde67b954b29dcf6c3e49fd4f147
e60b2135265187afc812ed3552e6c975823b1eaa
refs/heads/master
2023-04-28T01:14:15.817459
2012-08-17T00:31:47
2012-08-17T00:31:47
4,972,064
1
0
null
2023-04-14T20:07:46
2012-07-10T09:53:46
Java
UTF-8
Java
false
false
3,678
java
package org.ssh.pm.common.webservice.rs.server.impl; import java.util.List; import javax.jws.WebService; import org.dozer.DozerBeanMapper; import org.hibernate.ObjectNotFoundException; import org.perf4j.StopWatch; import org.perf4j.aop.Profiled; import org.perf4j.slf4j.Slf4JStopWatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.ssh.pm.common.webservice.rs.server.HzWebService; import org.ssh.pm.common.webservice.rs.server.WsConstants; import org.ssh.pm.common.webservice.rs.server.dto.HzDTO; import org.ssh.pm.common.webservice.rs.server.result.GetAllHzResult; import org.ssh.pm.common.webservice.rs.server.result.GetHzResult; import org.ssh.pm.common.webservice.rs.server.result.WSResult; import org.ssh.sys.entity.Hz; import org.ssh.sys.service.HzService; import com.google.common.collect.Lists; /** * HzWebService服务端实现类. * * @author yangjiandong */ //serviceName与portName属性指明WSDL中的名称, endpointInterface属性指向Interface定义类. @WebService(serviceName = "HzService", portName = "HzServicePort", endpointInterface = "org.ssh.pm.common.webservice.rs.server.HzWebService", targetNamespace = WsConstants.NS) public class HzWebServiceImpl implements HzWebService { private static Logger logger = LoggerFactory.getLogger(HzWebServiceImpl.class); @Autowired private HzService hzService; @Autowired private DozerBeanMapper dozer; @Override @Profiled(tag = "GetAllHzResult") public GetAllHzResult getAllHz() { try { List<Hz> allHzList = this.hzService.getAllHzOnMethodCache(); List<HzDTO> allHzDTOList = Lists.newArrayList(); for (Hz hz : allHzList) { allHzDTOList.add(dozer.map(hz, HzDTO.class)); } GetAllHzResult result = new GetAllHzResult(); result.setHzList(allHzDTOList); return result; } catch (RuntimeException e) { logger.error(e.getMessage(), e); return WSResult.buildDefaultErrorResult(GetAllHzResult.class); } } @Override public GetHzResult getHz(String hz) { StopWatch totalStopWatch = new Slf4JStopWatch(); //校验请求参数 try { Assert.notNull(hz, "hz参数为空"); } catch (IllegalArgumentException e) { logger.error(e.getMessage()); return WSResult.buildResult(GetHzResult.class, WSResult.PARAMETER_ERROR, e.getMessage()); } //获取用户 try { StopWatch dbStopWatch = new Slf4JStopWatch("GetHzResult.fetchDB"); Hz oneHz = this.hzService.getHz(hz); dbStopWatch.stop(); HzDTO dto = dozer.map(oneHz, HzDTO.class); GetHzResult result = new GetHzResult(); result.setHz(dto); totalStopWatch.stop("GerHz.total.success"); return result; } catch (ObjectNotFoundException e) { String message = "用户不存在(id:" + hz + ")"; logger.error(message, e); totalStopWatch.stop("GerHz.total.failure"); return WSResult.buildResult(GetHzResult.class, WSResult.PARAMETER_ERROR, message); } catch (RuntimeException e) { logger.error(e.getMessage(), e); totalStopWatch.stop("GerHz.total.failure"); return WSResult.buildDefaultErrorResult(GetHzResult.class); } } }
[ "young.jiandong@gmail.com" ]
young.jiandong@gmail.com
bd6e2bf9f73365ccd1910f052d28b7ea7b421c99
542cf6fffa070ce283c2c437c556cc5fd8eb5b51
/src/com/lq/po/Page.java
9884b9f6be65ae210a4e1e4d2343ac6911e09749
[]
no_license
daqingdie/job
799a754b125a96113dfbdf558d8316ee76c74a2f
febf541cd4045f86e5c76932e94eda7f90b143db
refs/heads/master
2022-06-21T20:15:28.808030
2020-05-06T06:51:24
2020-05-06T06:51:24
261,675,529
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package com.lq.po; import java.io.Serializable; public class Page implements Serializable { private static final long serialVersionUID = -3198048449643774660L; private int pageNow = 1; // 当前页数 private int pageSize = 12; // 每页显示记录的条数 private int totalCount; // 总的记录条数 private int totalPageCount; // 总的页数 @SuppressWarnings("unused") private int startPos; // 开始位置,从0开始 /** * 通过构造函数 传入 总记录数 和 当前页 * @param totalCount * @param pageNow */ public Page(int totalCount, int pageNow) { this.totalCount = totalCount; this.pageNow = pageNow; } /** * 取得总页数,总页数=总记录数/每页显示记录的条数 * @return */ public int getTotalPageCount() { totalPageCount = getTotalCount() / getPageSize(); return (totalCount % pageSize == 0) ? totalPageCount //总页数 : totalPageCount + 1; } public void setTotalPageCount(int totalPageCount) { this.totalPageCount = totalPageCount; } public int getPageNow() { return pageNow; } public void setPageNow(int pageNow) { this.pageNow = pageNow; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } /** * 取得选择记录的初始位置 * @return */ public int getStartPos() { return (pageNow - 1) * pageSize; } public void setStartPos(int startPos) { this.startPos = startPos; } }
[ "532131417@qq.com" ]
532131417@qq.com
69a4184311681e1386a758b0751c13bc3e4e0f16
14869f69d7add442927190e07510367f1309bb67
/xyg-library/src/main/java/com/bumptech/glide/load/resource/gif/GifFrameLoader.java
3b823a9758cf53e8ddac9b56ce62ecd4e8d34620
[ "Apache-2.0" ]
permissive
droidranger/xygapp
35dc74d13773df9ce24937cabeed5b40c5aab3aa
193c60a53d5f1654d99e98286cf086e96c1cef3b
refs/heads/master
2021-01-19T08:48:25.527616
2017-12-12T01:10:54
2017-12-12T01:10:54
87,680,560
0
0
null
null
null
null
UTF-8
Java
false
false
7,043
java
package com.bumptech.glide.load.resource.gif; import android.content.Context; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import com.bumptech.glide.GenericRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.gifdecoder.GifDecoder; import com.bumptech.glide.load.Encoder; import com.bumptech.glide.load.Key; import com.bumptech.glide.load.Transformation; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.NullEncoder; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.util.UUID; class GifFrameLoader { private final FrameCallback callback; private final GifDecoder gifDecoder; private final Handler handler; private boolean isRunning = false; private boolean isLoadPending = false; private GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> requestBuilder; private DelayTarget current; private boolean isCleared; public interface FrameCallback { void onFrameReady(int index); } public GifFrameLoader(Context context, FrameCallback callback, GifDecoder gifDecoder, int width, int height) { this(callback, gifDecoder, null, getRequestBuilder(context, gifDecoder, width, height, Glide.get(context).getBitmapPool())); } GifFrameLoader(FrameCallback callback, GifDecoder gifDecoder, Handler handler, GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> requestBuilder) { if (handler == null) { handler = new Handler(Looper.getMainLooper(), new FrameLoaderCallback()); } this.callback = callback; this.gifDecoder = gifDecoder; this.handler = handler; this.requestBuilder = requestBuilder; } @SuppressWarnings("unchecked") public void setFrameTransformation(Transformation<Bitmap> transformation) { if (transformation == null) { throw new NullPointerException("Transformation must not be null"); } requestBuilder = requestBuilder.transform(transformation); } public void start() { if (isRunning) { return; } isRunning = true; isCleared = false; loadNextFrame(); } public void stop() { isRunning = false; } public void clear() { stop(); if (current != null) { Glide.clear(current); current = null; } isCleared = true; // test. } public Bitmap getCurrentFrame() { return current != null ? current.getResource() : null; } private void loadNextFrame() { if (!isRunning || isLoadPending) { return; } isLoadPending = true; long targetTime = SystemClock.uptimeMillis() + gifDecoder.getNextDelay(); gifDecoder.advance(); DelayTarget next = new DelayTarget(handler, gifDecoder.getCurrentFrameIndex(), targetTime); requestBuilder .signature(new FrameSignature()) .into(next); } // Visible for testing. void onFrameReady(DelayTarget delayTarget) { if (isCleared) { handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, delayTarget).sendToTarget(); return; } DelayTarget previous = current; current = delayTarget; callback.onFrameReady(delayTarget.index); if (previous != null) { handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, previous).sendToTarget(); } isLoadPending = false; loadNextFrame(); } private class FrameLoaderCallback implements Handler.Callback { public static final int MSG_DELAY = 1; public static final int MSG_CLEAR = 2; @Override public boolean handleMessage(Message msg) { if (msg.what == MSG_DELAY) { DelayTarget target = (DelayTarget) msg.obj; onFrameReady(target); return true; } else if (msg.what == MSG_CLEAR) { DelayTarget target = (DelayTarget) msg.obj; Glide.clear(target); } return false; } } // Visible for testing. static class DelayTarget extends SimpleTarget<Bitmap> { private final Handler handler; private final int index; private final long targetTime; private Bitmap resource; public DelayTarget(Handler handler, int index, long targetTime) { this.handler = handler; this.index = index; this.targetTime = targetTime; } public Bitmap getResource() { return resource; } @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { this.resource = resource; Message msg = handler.obtainMessage(FrameLoaderCallback.MSG_DELAY, this); handler.sendMessageAtTime(msg, targetTime); } } private static GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> getRequestBuilder(Context context, GifDecoder gifDecoder, int width, int height, BitmapPool bitmapPool) { GifFrameResourceDecoder frameResourceDecoder = new GifFrameResourceDecoder(bitmapPool); GifFrameModelLoader frameLoader = new GifFrameModelLoader(); Encoder<GifDecoder> sourceEncoder = NullEncoder.get(); return Glide.with(context) .using(frameLoader, GifDecoder.class) .load(gifDecoder) .as(Bitmap.class) .sourceEncoder(sourceEncoder) .decoder(frameResourceDecoder) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) .override(width, height); } // Visible for testing. static class FrameSignature implements Key { private final UUID uuid; public FrameSignature() { this(UUID.randomUUID()); } // VisibleForTesting. FrameSignature(UUID uuid) { this.uuid = uuid; } @Override public boolean equals(Object o) { if (o instanceof FrameSignature) { FrameSignature other = (FrameSignature) o; return other.uuid.equals(uuid); } return false; } @Override public int hashCode() { return uuid.hashCode(); } @Override public void updateDiskCacheKey(MessageDigest messageDigest) throws UnsupportedEncodingException { throw new UnsupportedOperationException("Not implemented"); } } }
[ "xingyugang@tuniu.com" ]
xingyugang@tuniu.com
9fa49b56ac74657386ced319da8f60cc39a759a1
c35d218a96ffb4797883ef8ffad6c37b14b2df71
/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/configuration/readers/MergedVariantMongoReaderConfiguration.java
6ea88526aeca40127127f2284a0fc436be93ae5e
[ "Apache-2.0" ]
permissive
108krohan/eva-accession
085350c622e6e2c562e62f85cdd13d3017631af8
0fed0c8b5e8694027c6d81479328b40f4bf4e461
refs/heads/master
2020-06-07T12:04:07.711039
2019-08-09T12:26:04
2019-08-09T12:26:04
193,018,339
0
0
Apache-2.0
2019-07-23T04:13:24
2019-06-21T02:42:10
Java
UTF-8
Java
false
false
2,537
java
/* * Copyright 2019 EMBL - European Bioinformatics Institute * * 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 uk.ac.ebi.eva.accession.release.configuration.readers; import com.mongodb.MongoClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.item.ItemStreamReader; import org.springframework.boot.autoconfigure.mongo.MongoProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import uk.ac.ebi.eva.accession.core.configuration.MongoConfiguration; import uk.ac.ebi.eva.accession.release.io.MergedVariantMongoReader; import uk.ac.ebi.eva.accession.release.parameters.InputParameters; import uk.ac.ebi.eva.commons.batch.io.UnwindingItemStreamReader; import uk.ac.ebi.eva.commons.core.models.pipeline.Variant; import static uk.ac.ebi.eva.accession.release.configuration.BeanNames.MERGED_VARIANT_READER; @Configuration @Import({MongoConfiguration.class}) public class MergedVariantMongoReaderConfiguration { private static final Logger logger = LoggerFactory.getLogger(MergedVariantMongoReaderConfiguration.class); @Bean(MERGED_VARIANT_READER) @StepScope public ItemStreamReader<Variant> unwindingReader(MergedVariantMongoReader mergedVariantMongoReader) { return new UnwindingItemStreamReader<>(mergedVariantMongoReader); } @Bean @StepScope MergedVariantMongoReader mergedVariantMongoReader(InputParameters parameters, MongoClient mongoClient, MongoProperties mongoProperties) { logger.info("Injecting MergedVariantMongoReader with parameters: {}", parameters); return new MergedVariantMongoReader(parameters.getAssemblyAccession(), mongoClient, mongoProperties.getDatabase(), parameters.getChunkSize()); } }
[ "jomutlo@gmail.com" ]
jomutlo@gmail.com
0db93fc905d65c0392b7627a2cf31b52faf497d5
f83a867eba9bad28bd31b746f05f86480d8c7155
/src/gfg/stringclass/stringToInt.java
11b16f249102caf33766489eb49a811cd3196961
[]
no_license
shekhar88085/java1
25f3654584648788ebebb365ff7342fc10338392
2432d7dd5aa4e3ae54881e6bc15bdd4c799d5d63
refs/heads/master
2023-02-26T03:11:06.651570
2021-02-03T04:54:43
2021-02-03T04:54:43
335,511,028
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package gfg.stringclass; import static java.lang.System.*; public class stringToInt { public static void main(String [] dd){ String s="1234"; //using Integer.parseInt(String); int sa=Integer.parseInt(s); System.out.println(sa); //radix sa=Integer.parseInt(s,16); System.out.println(sa); //using Integer.valueOf(String); sa=Integer.valueOf(s); System.out.println(sa); out.println("wdfghj"); } }
[ "shekhar88085@gmail.com" ]
shekhar88085@gmail.com
baa1495758a0becd538e3edc0d1b7823ed47b677
62e334192393326476756dfa89dce9f0f08570d4
/ztk_code/ztk-arena-parent/arena-dubbo-api/src/main/java/com/huatu/ztk/arena/dubbo/ArenaDubboService.java
1b8e42654d90c048165f193948850cecb0363e36
[]
no_license
JellyB/code_back
4796d5816ba6ff6f3925fded9d75254536a5ddcf
f5cecf3a9efd6851724a1315813337a0741bd89d
refs/heads/master
2022-07-16T14:19:39.770569
2019-11-22T09:22:12
2019-11-22T09:22:12
223,366,837
1
2
null
2022-06-30T20:21:38
2019-11-22T09:15:50
Java
UTF-8
Java
false
false
497
java
package com.huatu.ztk.arena.dubbo; import com.huatu.ztk.arena.bean.ArenaRoom; import org.springframework.data.mongodb.core.query.Update; /** * Created by shaojieyue * Created time 2016-10-08 19:57 */ public interface ArenaDubboService { /** * 根据id查询房间 * @param id * @return */ ArenaRoom findById(long id); /** * 根据id 更新指定房间的数据 * @param id * @param update */ void updateById(long id, Update update); }
[ "jelly_b@126.com" ]
jelly_b@126.com
289940a20b878890ad861114bc1992f3e3ed6ce6
66bf7a7cfeaf5a8c6042d97e3f739af49a7bac2d
/Test1/src/com/zsy/frame/lib/net/http/volley/toolbox/Authenticator.java
5d6adbe89fe2ca799aca6bb6438db63efcc38542
[]
no_license
shengyouzhang/test1
f82b13c6abca36dd286041b30df94aed02cbc5a7
739d11cb449b4a3fcef96b9665048458254e6963
refs/heads/master
2020-04-14T11:47:48.051788
2015-03-16T15:13:07
2015-03-16T15:13:07
31,312,684
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
/* * Copyright (C) 2011 The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zsy.frame.lib.net.http.volley.toolbox; import com.zsy.frame.lib.net.http.volley.AuthFailureError; /** * An interface for interacting with auth tokens. */ public interface Authenticator { /** * Synchronously retrieves an auth token. * * @throws AuthFailureError If authentication did not succeed */ public String getAuthToken() throws AuthFailureError; /** * Invalidates the provided auth token. */ public void invalidateAuthToken(String authToken); }
[ "hongfeiliuxing@gmail.com" ]
hongfeiliuxing@gmail.com
5221438602f75a6bc7f5c32eca3a510cfa5d7c4f
6224ededa3950f9f6245c5564ab693d51c3e30ba
/dönüştürücü/app/src/test/java/com/ma/MiniProje_Donusturucu/ExampleUnitTest.java
8a3f302928bb46185049fd293bfcf08228c91654
[]
no_license
klonesa/AndroidProjeler
8ecd803911fab494a3b2a9472b507ccd68407e7f
311daebb4fcef0761dc2745d755f726700bc7174
refs/heads/master
2023-02-05T12:05:17.498164
2020-12-25T09:47:32
2020-12-25T09:47:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.ma.MiniProje_Donusturucu; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "mahirrakarsu@gmail.com" ]
mahirrakarsu@gmail.com
dae379e81d3c45609b872ac572af53a11a836fd3
a4e456c0d748a4a6717b18be3ed1bbea511e35a4
/src/main/java/com/yusei/model/dto/SubFieldDto.java
5cea199448016cf564b72415927dba0b24ebe2ce
[]
no_license
lutwwp/my-custom-flow
cf1da13e9e9c3c92fd4b8f0870797180df5af783
5eb4a0e8f9ae85e1bb3fe8208e04f2e6d5f5b889
refs/heads/master
2023-06-02T10:26:35.533546
2021-06-24T04:21:38
2021-06-24T04:21:38
379,801,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,236
java
package com.yusei.model.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.yusei.model.param.ExtendDataParam; import com.yusei.model.param.ExtendRuleParam; import com.yusei.model.param.LinkFilterAddParam; import lombok.Data; import java.util.List; /** * @author liuqiang * @TOTD * @date 2020/9/2 18:03 */ @Data public class SubFieldDto { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long fieldId; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long formId; private String fieldCode; private String fieldName; private String fieldType; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long linkFormId; private String linkFormName; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long linkFieldId; private String linkFieldName; private String defaultValueType; private String defaultValue; private Boolean necessary; private Boolean allowRepeated; private Boolean showField; private Boolean editField; private List<LinkFieldDetailDto> linkFields; private List<LinkFilterDetailDto> linkFilters; private List<ExtendDataDto> extendDatas; private List<ExtendRuleDto> extendRules; }
[ "wangwp@si-tech.com.cn" ]
wangwp@si-tech.com.cn
d931552de4aab59eb0b2a8007442d8db5b3fc666
4e08fcee1a748c31fd18fa49ea77acbba11db0e9
/src/testSpace/TestInfoSetSpecificByIndex_Insert.java
83615bbdf292e0bff3b255ab560b3611b993c8d5
[]
no_license
181847/DataStructCourseDesign2015
c695e67d7cf12900405a69e7b696a39c32e903b4
6f3ada5f941d881fe4ea68f49be8a6b12d6c6032
refs/heads/master
2020-05-27T13:22:19.002679
2018-01-26T02:31:03
2018-01-26T02:31:03
82,553,792
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package testSpace; import collegeComponent.tool.traverser.StudentTraverser; import info.InfoWithContainer; import info.infoTool.AllTrueFilter; import infoSet.InfoSetSpecificByIndex; public class TestInfoSetSpecificByIndex_Insert extends Test { public static void main(String[] args){ prepare(); InfoSetSpecificByIndex issbi = new InfoSetSpecificByIndex(); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[0]))); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[0]))); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[5]))); issbi.traverseInfo(new StudentTraverser(), new AllTrueFilter()); } }
[ "753090084@qq.com" ]
753090084@qq.com
4b1030589f460387f2fa1e95c758fa41ee152956
c299e4ddf144b7281789f79df38308d1809cc1d1
/app/src/main/java/com/example/webtextselect/MainActivity.java
5690b8d8047dd0bd074234e33f70c66a8e7f9612
[]
no_license
deaboway/AndroidWebViewTextSelect
0b7d2060c02061c2e2c31abed2c23eea2412ef11
4fd24db1a4a35864bb4deb10722e8e71476cfe03
refs/heads/master
2021-08-29T16:15:57.895242
2017-12-14T09:15:41
2017-12-14T09:15:41
114,217,756
4
0
null
null
null
null
UTF-8
Java
false
false
995
java
package com.example.webtextselect; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "zw@letsrun.cn" ]
zw@letsrun.cn
c1ba80dd8f8e8b298b70d80e9c09c16ddd8a7dd9
761e5c89536bc8e30fb5f0c3a280cd03e95620c9
/src/com/xinyuan/dao/CardsDAO.java
4d36e18dbee442ec45ffbc35a1215afbcdbd88c1
[]
no_license
suchavision/ERPWebServer
81c86f9b44c19ff6566040bd49c45363e1f27d9e
b53b440ff48bf9954c2a7f57ad3c4460b8d30a34
refs/heads/master
2021-01-10T19:59:41.544377
2014-11-21T07:18:14
2014-11-21T07:18:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package com.xinyuan.dao; public interface CardsDAO { }
[ "suchavision@gmail.com" ]
suchavision@gmail.com
bc8816ae65171b3f913d0a6409de306f65880797
73364c57427e07e90d66692a3664281d5113177e
/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java
1696afdb8b1d158216879d00893cf8ca9a62180e
[ "BSD-3-Clause" ]
permissive
abyot/sun-pmt
4681f008804c8a7fc7a75fe5124f9b90df24d44d
40add275f06134b04c363027de6af793c692c0a1
refs/heads/master
2022-12-28T09:54:11.381274
2019-06-10T15:47:21
2019-06-10T15:47:21
55,851,437
0
1
BSD-3-Clause
2022-12-16T12:05:12
2016-04-09T15:21:22
Java
UTF-8
Java
false
false
2,080
java
package org.hisp.dhis.mapgeneration.comparator; /* * Copyright (c) 2004-2017, University of Oslo * 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 the HISP project 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. */ import java.util.Comparator; import org.hisp.dhis.mapgeneration.Interval; /** * @author Lars Helge Overland */ public class IntervalLowValueAscComparator implements Comparator<Interval> { public static final IntervalLowValueAscComparator INSTANCE = new IntervalLowValueAscComparator(); @Override public int compare( Interval i1, Interval i2 ) { return new Double( i1.getValueLow() ).compareTo( new Double( i2.getValueLow() ) ); } }
[ "abyota@gmail.com" ]
abyota@gmail.com
94b27f78c18f016b2fcd100d81858d42569b0ff0
6e6e5324f7060c202c4482c84caf93c23ec99c8f
/java/typecasting/src/com/ust_global/typecasting/refferenced/Pen.java
bea9f3411fcd7bda76b1fe972a3ea3cf5d7ac4fe
[]
no_license
Rehan-007/USTGlobal-16sept-19-anwar-rehan
f68a447f49f0577f60c1679a9d7296b08bd01bb3
7beb4f93fc880bc752313286f2dd23ebd11016a3
refs/heads/master
2023-01-11T18:59:10.545806
2019-12-22T03:57:08
2019-12-22T03:57:08
215,536,631
0
0
null
2023-01-07T13:03:10
2019-10-16T11:56:14
Java
UTF-8
Java
false
false
157
java
package com.ust_global.typecasting.refferenced; public class Pen { public int cost; void write() { System.out.println("pen write() method"); } }
[ "rehananwar.zuhaib@gmail.com" ]
rehananwar.zuhaib@gmail.com
3a9f055935b475e7d0702b8899a73542061af69a
995f73d30450a6dce6bc7145d89344b4ad6e0622
/DVC-AN20_EMUI10.1.1/src/main/java/android/animation/Keyframe.java
9e31f8e3f9703ba98321039d53b4a2a66fe0691f
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,884
java
package android.animation; public abstract class Keyframe implements Cloneable { float mFraction; boolean mHasValue; private TimeInterpolator mInterpolator = null; Class mValueType; boolean mValueWasSetOnStart; @Override // java.lang.Object public abstract Keyframe clone(); public abstract Object getValue(); public abstract void setValue(Object obj); public static Keyframe ofInt(float fraction, int value) { return new IntKeyframe(fraction, value); } public static Keyframe ofInt(float fraction) { return new IntKeyframe(fraction); } public static Keyframe ofFloat(float fraction, float value) { return new FloatKeyframe(fraction, value); } public static Keyframe ofFloat(float fraction) { return new FloatKeyframe(fraction); } public static Keyframe ofObject(float fraction, Object value) { return new ObjectKeyframe(fraction, value); } public static Keyframe ofObject(float fraction) { return new ObjectKeyframe(fraction, null); } public boolean hasValue() { return this.mHasValue; } /* access modifiers changed from: package-private */ public boolean valueWasSetOnStart() { return this.mValueWasSetOnStart; } /* access modifiers changed from: package-private */ public void setValueWasSetOnStart(boolean valueWasSetOnStart) { this.mValueWasSetOnStart = valueWasSetOnStart; } public float getFraction() { return this.mFraction; } public void setFraction(float fraction) { this.mFraction = fraction; } public TimeInterpolator getInterpolator() { return this.mInterpolator; } public void setInterpolator(TimeInterpolator interpolator) { this.mInterpolator = interpolator; } public Class getType() { return this.mValueType; } static class ObjectKeyframe extends Keyframe { Object mValue; ObjectKeyframe(float fraction, Object value) { this.mFraction = fraction; this.mValue = value; this.mHasValue = value != null; this.mValueType = this.mHasValue ? value.getClass() : Object.class; } @Override // android.animation.Keyframe public Object getValue() { return this.mValue; } @Override // android.animation.Keyframe public void setValue(Object value) { this.mValue = value; this.mHasValue = value != null; } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public ObjectKeyframe clone() { ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), hasValue() ? this.mValue : null); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; kfClone.setInterpolator(getInterpolator()); return kfClone; } } static class IntKeyframe extends Keyframe { int mValue; IntKeyframe(float fraction, int value) { this.mFraction = fraction; this.mValue = value; this.mValueType = Integer.TYPE; this.mHasValue = true; } IntKeyframe(float fraction) { this.mFraction = fraction; this.mValueType = Integer.TYPE; } public int getIntValue() { return this.mValue; } @Override // android.animation.Keyframe public Object getValue() { return Integer.valueOf(this.mValue); } @Override // android.animation.Keyframe public void setValue(Object value) { if (value != null && value.getClass() == Integer.class) { this.mValue = ((Integer) value).intValue(); this.mHasValue = true; } } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public IntKeyframe clone() { IntKeyframe kfClone; if (this.mHasValue) { kfClone = new IntKeyframe(getFraction(), this.mValue); } else { kfClone = new IntKeyframe(getFraction()); } kfClone.setInterpolator(getInterpolator()); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; return kfClone; } } static class FloatKeyframe extends Keyframe { float mValue; FloatKeyframe(float fraction, float value) { this.mFraction = fraction; this.mValue = value; this.mValueType = Float.TYPE; this.mHasValue = true; } FloatKeyframe(float fraction) { this.mFraction = fraction; this.mValueType = Float.TYPE; } public float getFloatValue() { return this.mValue; } @Override // android.animation.Keyframe public Object getValue() { return Float.valueOf(this.mValue); } @Override // android.animation.Keyframe public void setValue(Object value) { if (value != null && value.getClass() == Float.class) { this.mValue = ((Float) value).floatValue(); this.mHasValue = true; } } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public FloatKeyframe clone() { FloatKeyframe kfClone; if (this.mHasValue) { kfClone = new FloatKeyframe(getFraction(), this.mValue); } else { kfClone = new FloatKeyframe(getFraction()); } kfClone.setInterpolator(getInterpolator()); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; return kfClone; } } }
[ "dstmath@163.com" ]
dstmath@163.com
fc191c45184ede5816f0acf55c5748cc23920914
b34a4472e08b3f98c64328e179cfe6f61f796843
/app/src/main/java/com/deploy/livesdk/com/microsoft/live/OAuthRequestObserver.java
4bd8d36eedf114291c0fb966e947058abb1dbbdb
[]
no_license
TechieSouls/gooday-android
40073c2e90034975df7f37ff5f08c56cf201a691
5756a677fdb86a720b9e0d1939b59d8adfe38754
refs/heads/master
2020-04-11T18:10:27.336540
2020-01-03T17:09:06
2020-01-03T17:09:06
161,988,496
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
// ------------------------------------------------------------------------------ // Copyright (c) 2014 Microsoft Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // ------------------------------------------------------------------------------ package com.deploy.livesdk.com.microsoft.live; /** * An observer of an OAuth Request. It will be notified of an Exception or of a Response. */ interface OAuthRequestObserver { /** * Callback used on an exception. * * @param exception */ public void onException(LiveAuthException exception); /** * Callback used on a response. * * @param response */ public void onResponse(OAuthResponse response); }
[ "mspanesar145@gmail.com" ]
mspanesar145@gmail.com
dd418183ac45e776069507957c18bc4628d41f6d
78648c09159c9e225fd6b35a0f602f8814c7853e
/practice_15/src/main/java/utility/PlayerDatabase.java
67007a6ab0d36fe243c4af004b61fd9f0047fc2b
[]
no_license
dblanari/tekwill_oca
c0355afe5203a94e3e5828b5ebda7cd5e6d0db8c
ea5128a5865238e1642023b7d3243d5ea7c812dd
refs/heads/master
2021-05-07T01:09:03.416177
2018-03-30T16:46:07
2018-03-30T16:46:07
110,218,901
0
1
null
2018-01-29T18:04:45
2017-11-10T07:52:45
Java
UTF-8
Java
false
false
2,125
java
/* Copyright © 2016 Oracle and/or its affiliates. All rights reserved. */ package utility; import java.util.ArrayList; import java.util.StringTokenizer; import soccer.Player; public class PlayerDatabase { private ArrayList <Player> players; public PlayerDatabase(){ StringTokenizer authorTokens = new StringTokenizer(authorList, ","); players = new ArrayList(); while (authorTokens.hasMoreTokens()){ players.add(new Player(authorTokens.nextToken())); } } public Player[] getTeam(int numberOfPlayers){ Player[] teamPlayers = new Player[numberOfPlayers]; for (int i = 0; i < numberOfPlayers; i++){ int playerIndex = (int) (Math.random() * players.size()); teamPlayers[i] = players.get(playerIndex); players.remove(playerIndex); } return teamPlayers; } String authorList = "Agatha Christie," + "Alan Patton," + "Alexander Solzhenitsyn," + "Arthur Conan Doyle," + "Anthony Trollope," + "Baroness Orczy," + "Brendan Behan," + "Brian Moore," + "Boris Pasternik," + "Charles Dickens," + "Charlotte Bronte," + "Dorothy Parker," + "Emile Zola," + "Frank O'Connor," + "Geoffrey Chaucer," + "George Eliot," + "G. K. Chesterton," + "Graham Green," + "Henry James," + "James Joyce," + "J. M. Synge," + "J. R. Tolkien," + "Jane Austin," + "Leo Tolstoy," + "Liam O'Flaherty," + "Marcel Proust," + "Mark Twain," + "Oscar Wilde," + "O. Henry," + "Samuel Beckett," + "Sean O'Casey," + "William Shakespeare," + "William Makepeace Thackeray," + "W. B. Yeats," + "Wilkie Collins"; }
[ "denis.blanari@gmail.com" ]
denis.blanari@gmail.com
215aaaf8b47ddc18ca26b74b81392d857cd6b895
56684c261856a727f8804b2c852029dc5faba9a7
/fa-server/src/main/java/nl/tudelft/fa/server/helper/jackson/CarParametersMixin.java
97fbcac477d2a83c68dcfbcbcdfbc94b3fa869a5
[ "MIT" ]
permissive
fabianishere/formula-andy
757d0e943fecb5cdaa260fdb9206adcadb089faa
ac73ea2766b8f25ec97e2e7d0c58c938f89a81be
refs/heads/master
2021-03-16T08:35:54.932321
2018-12-18T16:27:08
2018-12-18T16:27:08
74,035,424
4
0
null
null
null
null
UTF-8
Java
false
false
2,230
java
/* * The MIT License (MIT) * * Copyright (c) 2017 Fabian Mastenbroek, Christian Slothouber, * Laetitia Molkenboer, Nikki Bouman, Nils de Beukelaar * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package nl.tudelft.fa.server.helper.jackson; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import nl.tudelft.fa.core.race.CarParameters; import nl.tudelft.fa.core.team.inventory.Tire; /** * Mix-in for the {@link CarParameters} class. * * @author Fabian Mastenbroek */ public abstract class CarParametersMixin { /** * Construct a {@link CarParameters} instance. * * @param mechanicalRisk The risk of the car setup. * @param aerodynamicRisk The risk of the car design. * @param strategicRisk The risk of the strategy. * @param tire The tire that is being used. */ @JsonCreator public CarParametersMixin(@JsonProperty("mechanicalRisk") int mechanicalRisk, @JsonProperty("aerodynamicRisk") int aerodynamicRisk, @JsonProperty("strategicRisk") int strategicRisk, @JsonProperty("tire") Tire tire) {} }
[ "mail.fabianm@gmail.com" ]
mail.fabianm@gmail.com
e50e712dd35d8bfca1d135deeba6c48f9cef23bf
8b96417ea286f9b2d3ec7d448e1a31c0ba8d57cb
/entitybroker/api/src/java/org/sakaiproject/entitybroker/entityprovider/extension/RequestStorageWrite.java
e63480f80ab946a01fa2e14fc5fd69b6a0fd9308
[ "ECL-2.0" ]
permissive
deemsys/Deemsys_Learnguild
d5b11c5d1ad514888f14369b9947582836749883
606efcb2cdc2bc6093f914f78befc65ab79d32be
refs/heads/master
2021-01-15T16:16:12.036004
2013-08-13T12:13:45
2013-08-13T12:13:45
12,083,202
0
1
null
null
null
null
UTF-8
Java
false
false
3,277
java
/** * $Id: RequestStorageWrite.java 59674 2009-04-03 23:05:58Z arwhyte@umich.edu $ * $URL: https://source.sakaiproject.org/svn/entitybroker/tags/entitybroker-1.5.2/api/src/java/org/sakaiproject/entitybroker/entityprovider/extension/RequestStorageWrite.java $ * RequestStorage.java - entity-broker - Jul 24, 2008 1:55:12 PM - azeckoski ************************************************************************** * Copyright (c) 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.entitybroker.entityprovider.extension; import java.util.Locale; import java.util.Map; /** * This allows write access to values which are stored in the current request thread, * these values are inaccessible outside of a request and will be destroyed * when the thread ends<br/> * This also "magically" exposes all the values in the request (attributes and params) * as if they were stored in the map as well, if there are conflicts then locally stored data always wins * over data from the request<br/> * Standard reserved keys have values that are always available:<br/> * <ul> * <li><b>_locale</b> : {@link Locale}</li> * <li><b>_requestEntityReference</b> : String</li> * <li><b>_requestActive</b> : [true,false]</li> * <li><b>_requestOrigin</b> : ['REST','EXTERNAL','INTERNAL']</li> * </ul> * * @author Aaron Zeckoski (azeckoski @ gmail.com) */ public interface RequestStorageWrite extends RequestStorage { /** * Store a value in the request storage with an associated key * @param key a key for a stored value * @param value an object to store * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setStoredValue(String key, Object value); /** * Place all these params into the request storage * @param params map of string -> value params * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setRequestValues(Map<String, Object> params); /** * Allows user to set the value of a key directly, including reserved keys * @param key the name of the value * @param value the value to store * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setRequestValue(String key, Object value); /** * Clear all values in the request storage (does not wipe the values form the request itself) */ public void reset(); }
[ "sangee1229@gmail.com" ]
sangee1229@gmail.com
95acaea80db6cd921351befced6b437feead12b4
be4b91fda464ed768b20a0b6a7870b5cdcf36c37
/crazy-eights/src/test/java/student/crazyeights/GameEngineTest.java
e8a698c8f81b9693ca7604fc7f434df8a20fc5f8
[]
no_license
richwellp/Software-Design-Studio
d2337d73ba83c77f0c5a3f29a47523f7d044882a
2ebb69579846804c592a159e77a298ccdc295b54
refs/heads/master
2023-05-03T13:28:35.447335
2021-05-21T06:36:33
2021-05-21T06:36:33
369,434,874
1
0
null
null
null
null
UTF-8
Java
false
false
2,407
java
package student.crazyeights; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.SimpleFormatter; import static org.junit.Assert.assertEquals; public class GameEngineTest { private List<Card> deck; private List<Card> gameDeck; private List<PlayerStrategy> players; private ByteArrayOutputStream outputStream; private GameEngine game; @Before public void setUp() { outputStream = new ByteArrayOutputStream(); players = new ArrayList<PlayerStrategy>(); game = new GameEngine(); SimplePlayer player1 = new SimplePlayer(); SimplePlayer player2 = new SimplePlayer(); ComplexPlayer player3 = new ComplexPlayer(); ComplexPlayer player4 = new ComplexPlayer(); players.add(player1); players.add(player2); players.add(player3); players.add(player4); deck = Card.getDeck(); game.setUpGame(players, outputStream); gameDeck = game.getGameDeck(); } @Test public void testCardShuffled() { boolean isShuffled = false; for (int i = 0; i < deck.size(); i++) { if (!gameDeck.get(i).equals(deck.get(i))) { isShuffled = true; break; } } Assert.assertTrue(isShuffled); } @Test public void testPlayerReceiveInitialCards() { boolean passed = true; for (Integer numberOfCards: game.getNumberOfPlayerCards()) { if (numberOfCards != 5) { passed = false; } } Assert.assertTrue(passed); } @Test public void testTournament() { String output = outputStream.toString(); game.playTournament(); Assert.assertThat(output, CoreMatchers.containsString("Tournament ended.")); } @Test public void testCheating() { String output = outputStream.toString(); game.playRound(); Assert.assertThat(output, CoreMatchers.containsString("Cheat")); } @Test public void testGame() { String output = outputStream.toString(); game.playGame(); Assert.assertThat(output, CoreMatchers.containsString("Game ended.")); } }
[ "richwell.perez@gmail.com" ]
richwell.perez@gmail.com
8341b0919baa7e9008ebb30384f2cce92c75a73e
f0241ac2e7c3f001b4d0d3ec69219869c6c9b946
/module1/Task3/src/test/java/it/academy/TestClassTest.java
14b00c927ad47492430762570fb05631ae024ef6
[]
no_license
aleksey0koval/jd2_hw
b3ceeca9815258210f874ceac6bd3e2bbc02a4bf
989e600da1d05c2102b3c373ad27f8f4a6d46a70
refs/heads/master
2023-03-20T03:10:34.771827
2021-03-02T21:48:47
2021-03-02T21:48:47
320,006,762
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package it.academy; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; public class TestClassTest { @Test public void testClassTest() { List<Integer> list = Arrays.asList(1, 2,null, null); double actual = TestClass.average(list); double expected = 1.5; assertEquals(expected, actual, 0); } }
[ "aleksey0koval@gmail.com" ]
aleksey0koval@gmail.com
c31af6d8ee4e1e97b62610b156fcc7894e726ad9
69d8f4ac55d544e73f72381504cc785fd6625729
/app/src/main/java/com/dihanov/musiq/ui/detail/detail_fragments/ArtistSpecificsBiography.java
136c03dbd0cdef24f99c4404c78af19330aeae2f
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
gabynnette/musiQ
82077ab3913ec2ae6a5b94c92204999c3e96d60a
a81f9c6e405bd30b9f42e66d85c4d47a215db09a
refs/heads/master
2020-03-17T23:43:07.624083
2018-05-19T12:17:17
2018-05-19T12:17:17
134,057,178
0
0
Apache-2.0
2018-05-19T12:15:23
2018-05-19T11:49:30
Java
UTF-8
Java
false
false
3,359
java
package com.dihanov.musiq.ui.detail.detail_fragments; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.text.Html; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.TextView; import com.dihanov.musiq.R; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by dimitar.dihanov on 9/29/2017. */ //this needs no presenter, because it is a simple fragment that only displays text public class ArtistSpecificsBiography extends ArtistSpecifics { public static final String TITLE = "biography"; @BindView(R.id.biography_progress_bar) ProgressBar progressBar; @BindView(R.id.artist_details_biography) TextView biographyTextView; private String biography; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(TITLE, this.biography); } public static ArtistSpecificsBiography newInstance(){ Bundle args = new Bundle(); ArtistSpecificsBiography artistDetailsBiographyFragment = new ArtistSpecificsBiography(); artistDetailsBiographyFragment.setArguments(args); return artistDetailsBiographyFragment; } @Override public void onAttach(Context context) { super.onAttach(context); if(this.biography == null){ this.biography = this.artistDetailsActivity.getArtistBiography(); } } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.artist_details_biography_fragment, container, false); ButterKnife.bind(this, view); progressBar.setVisibility(View.VISIBLE); Handler handler = new Handler(); new Thread(() -> { String modifiedBio = formatText(biography); handler.post(() -> { progressBar.setVisibility(View.GONE); biographyTextView.setText(Html.fromHtml(modifiedBio)); biographyTextView.setMovementMethod(LinkMovementMethod.getInstance()); }); }).run(); this.artistDetailsFragmentPresenter.takeView(this); return view; } private String formatText(String biography) { String result = biography; result = result.replaceAll("<a href=\"https://www.last.fm/music/Red\">Read more on Last.fm</a>. User-contributed text is available under the Creative Commons By-SA License; additional terms may apply.", "\n<a href=\"https://www.last.fm/music/Red\">Read more on Last.fm</a>. User-contributed text is available under the Creative Commons By-SA License; additional terms may apply."); result = result.replaceAll("\\n", "<br>"); return result; } public String getBiography() { return biography; } public void setBiography(String biography) { this.biography = biography; } }
[ "dimitar.dihanov@gmail.com" ]
dimitar.dihanov@gmail.com
3a9a0273d30b4ae08728c392d4f9eaff19283564
868ff684c4981f0608c1f2ff9f36e9433464cb37
/src/client/Client.java
8caf052b127f80239c706020d0242c924299b94d
[]
no_license
Obsir/ChatRoom
f9bc960fc5e596f714abae901fc8ff173f3cd8f2
6c8fb59edf030d43cfb90b70752b2180d68969af
refs/heads/master
2021-01-20T13:50:06.283990
2017-05-07T12:23:42
2017-05-07T12:23:42
90,529,688
1
0
null
null
null
null
UTF-8
Java
false
false
12,329
java
package client; import bean.User; import listener.MessageListener; import protocol.Protocol; import utils.Utils; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.*; import java.net.Socket; /** * Created by Obser on 2017/5/2. */ public class Client { private JTextArea textArea; private JTextField textField; private JTextField txt_port; private JTextField txt_hostIp; private JButton btn_start; private JButton btn_stop; private JButton btn_send; private DefaultListModel listModel; private JList userList; private JPanel northPanel; private JScrollPane rightScroll; private JPanel southPanel; private JScrollPane leftScroll; private JSplitPane centerSplit; private JFrame frame; private boolean isConnected; private Socket socket; private PrintWriter out; private BufferedReader in; private MessageThread messageThread; private User user; private JComboBox<String> comboBox; private static final String ALL = "所有人"; private MessageListener messageListener; public Client(User user, MessageThread messageThread){ initData(user, messageThread); initView(); initListener(); } private void initData(User user, MessageThread messageThread){ isConnected = true; this.user = user; this.messageThread = messageThread; this.in = messageThread.getIn(); this.out = messageThread.getOut(); this.socket = messageThread.getSocket(); } private void initView() { textArea = new JTextArea(); textArea.setEnabled(false); textField = new JTextField(); txt_port = new JTextField("6666"); txt_hostIp = new JTextField("127.0.0.1"); btn_start = new JButton("连接"); btn_stop = new JButton("断开"); btn_send = new JButton("发送"); listModel = new DefaultListModel(); userList = new JList(listModel); comboBox = new JComboBox<>(); comboBox.addItem(ALL); refreshButton(!isConnected); northPanel = new JPanel(); northPanel.setLayout(new GridLayout(1, 7)); northPanel.add(new JLabel("端口")); northPanel.add(txt_port); northPanel.add(new JLabel("服务器IP")); northPanel.add(txt_hostIp); northPanel.add(btn_start); northPanel.add(btn_stop); northPanel.setBorder(BorderFactory.createTitledBorder("连接信息")); rightScroll = new JScrollPane(textArea); rightScroll.setBorder(BorderFactory.createTitledBorder("消息显示区")); leftScroll = new JScrollPane(userList); leftScroll.setBorder(BorderFactory.createTitledBorder("在线用户")); southPanel = new JPanel(new BorderLayout()); southPanel.add(comboBox, BorderLayout.WEST); southPanel.add(textField, BorderLayout.CENTER); southPanel.add(btn_send, BorderLayout.EAST); southPanel.setBorder(BorderFactory.createTitledBorder("写消息")); centerSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScroll, rightScroll); centerSplit.setDividerLocation(100); frame = new JFrame(user.getName()); frame.setLayout(new BorderLayout()); frame.add(northPanel, BorderLayout.NORTH); frame.add(centerSplit, BorderLayout.CENTER); frame.add(southPanel, BorderLayout.SOUTH); frame.setSize(600, 400); int screen_width = Toolkit.getDefaultToolkit().getScreenSize().width; int screen_height = Toolkit.getDefaultToolkit().getScreenSize().height; frame.setLocation((screen_width - frame.getWidth()) / 2, (screen_height - frame.getHeight()) / 2); frame.setVisible(true); } private void initListener() { messageListener = new MessageListener() { @Override public void onReceiveAll(Protocol.Message message) { appendText("\t" + message.getTime() + "\r\n"); appendText("[所有人] " + message.getName() + " 说:\r\n" + message.getMessage() + "\r\n"); } @Override public void onClose() throws Exception { close(); appendText("服务器已关闭!\r\n"); } @Override public void onConnect(Protocol.Message message) { appendText("与端口号为:" + txt_port.getText().trim() + " IP地址为:" + txt_hostIp.getText().trim() + "的服务器连接成功!" + "\r\n"); listModel.removeAllElements(); } @Override public void onReceiveList(Protocol.Message message) { refreshListModel(message); } @Override public void onReceivePrivate(Protocol.Message message, boolean flag) { appendText("\t" + message.getTime() + "\r\n"); if(flag) appendText("[悄悄话] " + message.getName() + " 对 你 说:\r\n" + message.getMessage() + "\r\n"); else appendText("[悄悄话] 你 对 " +message.getToUser() + " 说:\r\n" + message.getMessage() + "\r\n"); } @Override public void onFailed(Protocol.Message message) { } }; messageThread.setMessageListener(messageListener); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if(isConnected){ try { closeConnection();//关闭连接 } catch (Exception e1) { e1.printStackTrace(); } } System.exit(0); } }); btn_start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int port; try{ try{ port = Integer.parseInt(txt_port.getText().trim()); } catch(NumberFormatException e1){ throw new Exception("端口号不符合要求!端口号为整数"); } String hostIp = txt_hostIp.getText().trim(); if(Utils.isEmpty(hostIp)){ throw new Exception("服务器IP不能为空!"); } connectServer(port, hostIp); //反馈 } catch (Exception exc){ JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE); } refreshButton(!isConnected); } }); btn_stop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try{ closeConnection();//断开连接 }catch (Exception exc){ JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE); } refreshButton(!isConnected); } }); //写消息的文本框中按回车键时事件 textField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(comboBox.getSelectedItem().equals(ALL)){ send("", Protocol.MSG_ALL); } else { send((String)comboBox.getSelectedItem(), Protocol.MSG_PRIVATE_TO); } } }); //单击发送按钮时事件 btn_send.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(comboBox.getSelectedItem().equals(ALL)) send("", Protocol.MSG_ALL); else send((String) comboBox.getSelectedItem(), Protocol.MSG_PRIVATE_TO); } }); } /** * 客户端断开连接 * @throws Exception */ private void closeConnection() throws Exception{ Protocol.Message message = new Protocol.Message(Protocol.CLOSE); sendMessage(Protocol.packMessage(message));//发送断开连接的命令给服务器 close(); } /** * 断开连接 * @throws Exception */ private synchronized void close() throws Exception{ try{ // messageThread.stop();//停止接收消息的线程 messageThread.setFlag(false);//停止接收消息的线程 //释放资源 if(in != null){ in.close(); } if(out != null){ out.close(); } if(socket != null){ socket.close(); } isConnected = false; listModel.removeAllElements(); } catch (IOException e1){ e1.printStackTrace(); isConnected = true; throw new Exception("断开连接发生异常!"); } finally { refreshButton(!isConnected); } } /** * 发送消息 * @param message */ private void sendMessage(String message) { out.println(message); out.flush(); } /** * 执行发送 */ private void send(String toUser, String id){ if(!isConnected){ JOptionPane.showMessageDialog(frame, "还没有连接服务器,无法发送消息", "错误", JOptionPane.ERROR_MESSAGE); return ; } String message = textField.getText().trim(); if(Utils.isEmpty(message)){ return ; } Protocol.Message msg = new Protocol.Message(user.getName(), user.getIp(), toUser, message, id); sendMessage(Protocol.packMessage(msg)); textField.setText(""); } /** * 连接服务器 * @param port 端口号 * @param hostIp 主机地址 * @throws Exception */ public void connectServer(int port, String hostIp) throws Exception{ try { socket = new Socket(hostIp, port);//根据端口号和服务器ip建立连接 in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream()); //发送客户端基本用户信息 Protocol.Message message = new Protocol.Message(user.getName(), user.getIp(), Protocol.INIT); message.setPassword(user.getPassword()); sendMessage(Protocol.packMessage(message)); //开启接收消息的线程 messageThread = new MessageThread(in, out, socket); messageThread.setMessageListener(messageListener); messageThread.start(); isConnected = true;//已经连接上 } catch (IOException e) { isConnected = false;//未连接上 appendText("与端口号为:" + port + " IP地址为:" + hostIp + "的服务器连接失败!" + "\r\n"); throw new Exception("与服务器连接失败!"); } } /** * 更新textArea * @param text */ private void appendText(String text){ textArea.append(text); textArea.setCaretPosition(textArea.getText().length()); } /** * 刷新列表 * @param message */ private void refreshListModel(Protocol.Message message){ listModel.removeAllElements(); comboBox.removeAllItems(); comboBox.addItem(ALL); for(String name : message.getNameList()){ listModel.addElement(name); if(name.equals(user.getName())) continue; comboBox.addItem(name); } } /** * 刷新按钮 * @param flag */ private void refreshButton(boolean flag){ btn_start.setEnabled(flag); btn_stop.setEnabled(!flag); txt_hostIp.setEnabled(flag); txt_port.setEnabled(flag); } }
[ "Obser47@outlook.com" ]
Obser47@outlook.com
293d76f17f4ad90faff1226eeb282104ca2e4b8e
816c46fa90e4c66e4017cc6745148329877b29d2
/app/src/test/java/com/shangxiazuoyou/advancedslidelayout/ExampleUnitTest.java
a4a59939b62ff66652dc43de83106e141142166a
[ "Apache-2.0" ]
permissive
shangxiazuoyou/AdvancedSlideLayout
361e47f61b088cfe6ee3a2f928bcf3b12b737594
50075102e79d250da0887cbdb612c41dea57de5e
refs/heads/master
2021-08-24T04:40:03.270769
2017-12-08T02:57:27
2017-12-08T02:57:27
113,518,719
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.shangxiazuoyou.advancedslidelayout; 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); } }
[ "megzzi@163.com" ]
megzzi@163.com