blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
a7416767b197cf800fbcc037d6992a70e5abadef
72f3f199aea7e5acacda92b43bc9d91ab000f9ef
/Suit.java
3129ef16f7d9f04e4149c563b074eb614dab78ba
[]
no_license
krla241/BridgeGame-Lab
dc6cf8ea071f7897a7dee25ba7b278f0ae032678
60d930bde1e4a7478a804e5db70a7f7d6104dd72
refs/heads/master
2020-06-17T09:20:13.604474
2019-07-08T22:58:26
2019-07-08T22:58:26
195,878,493
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
import java.util.ArrayList; public class Suit { private ArrayList<Card>cards; private String suitStr; private final int MIN_LONG=1; private final int VOID_POINTS=3; private final int SINGLETON_POINTS=2; private final int DOUBLETON_POINTS=1; public Suit(String suitStr) //name of suite { this.cards=new ArrayList<Card>(); //instantiates with default array list constructor this.suitStr=suitStr; //sets to value } public void addCard(char face) { //creates appropriate card object (card with number or card with figure)and adds it to the list if(face<=57 && face >=50) { CardWithNumber number=new CardWithNumber(face); this.cards.add(number); } else { CardWithFigure figure=new CardWithFigure(face); this.cards.add(figure); } } public void printSuit() { System.out.print(this.suitStr + ": "); for( Card c: this.cards){ System.out.print(c.toString()); } System.out.println(); } public int suitPoints() { int points=0; for(Card c: this.cards) { if(c instanceof CardWithFigure){ points += c.getPoints();} else if(c instanceof CardWithNumber){ points +=c.getPoints(); } } return points; } }
a9ec5919577184f3d2a02d86237813bf5932648a
6bfee90cc5225a225043bd1b59b5334495c70b11
/src/main/java/com/test/campaingapi/controller/CampaignController.java
9c6ede296c0cb93674688895fb913199a758fa76
[]
no_license
renanpallin/spring-campaign-teams
ddd78f7fa145c2a508bd72aa3d2e68d429916141
d96ec2ba8ce191fb923b3d03f323004b09a976bf
refs/heads/master
2021-01-22T18:38:24.597492
2017-08-21T05:58:45
2017-08-21T05:58:45
100,760,141
2
0
null
null
null
null
UTF-8
Java
false
false
3,298
java
package com.test.campaingapi.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; 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; import com.test.campaingapi.model.Campaign; import com.test.campaingapi.repository.CampaignRepository; @RestController @RequestMapping("/campaign") public class CampaignController { @Autowired private CampaignRepository campaignRepository; /** * Show all the on going Campaigns */ @GetMapping Iterable<Campaign> index() { return campaignRepository.findOnGoingCampaigns(); } /** * Show a campaign by ID * @param campaign * @return */ @GetMapping("{campaign}") ResponseEntity<Campaign> show(@PathVariable Campaign campaign) { if (campaign == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); return new ResponseEntity<>(campaign, HttpStatus.OK); } @PostMapping Campaign save(@RequestBody Campaign campaign) { List<Campaign> onGoingCampaignsByDate = campaignRepository.findOnGoingCampaignsByDate(campaign.getStart(), campaign.getEnd()); int max = onGoingCampaignsByDate.size(); for (Campaign c : onGoingCampaignsByDate) { c.addDayInTheEnd(); int i = 0; while(i < max) { Campaign anotherCampaign = onGoingCampaignsByDate.get(i); if (anotherCampaign == c) { i++; continue; } if (c.getEnd().equals(campaign.getEnd()) || c.getEnd().equals(anotherCampaign.getEnd())) { c.addDayInTheEnd(); i = 0; } else { i++; } } } campaignRepository.save(onGoingCampaignsByDate); return campaignRepository.save(campaign); } /** * Test method, use in develop only */ // @PostMapping("just-save") // Campaign justSave(@RequestBody Campaign campaign) { // return campaignRepository.save(campaign); // } /** * Update a campaign. * Obs: You can't update the start or end date * * @param campaign * @param newCampaign * @return */ @PutMapping("{campaign}") ResponseEntity<Campaign> update(@PathVariable Campaign campaign, @RequestBody Campaign newCampaign) { if (campaign == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); if (newCampaign.getTeam() != null) campaign.setTeam(newCampaign.getTeam()); if (newCampaign.getName() != null) campaign.setName(newCampaign.getName()); return new ResponseEntity<Campaign>(campaignRepository.save(campaign), HttpStatus.OK); } /** * Delete an campaign by ID * * @param campaign * @return */ @DeleteMapping("{campaign}") ResponseEntity<Campaign> destroy(@PathVariable Campaign campaign) { if (campaign == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); campaignRepository.delete(campaign); return new ResponseEntity<>(campaign, HttpStatus.OK); } }
4c22d6afcb2a6560fd4cfe8f979309b7c75be489
a3478539fa1c2fcfd179f23ebe08b036f55c4df3
/src/com/bochy/util/DbUtil.java
a14175f868c4392746518128fdf8cd9e7f9d4a5a
[ "MIT" ]
permissive
Green8948/moon_Girl
c1a6f61affad8495f68ce5ce225b9443076c2280
195a0b199bd53fbb801b5fe2a585fab20594178f
refs/heads/master
2020-03-26T01:12:16.570495
2018-08-11T05:17:12
2018-08-11T05:17:12
144,356,911
0
0
null
null
null
null
GB18030
Java
false
false
9,176
java
package com.bochy.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import com.bochy.entity.Admin; import com.bochy.entity.Category; import com.bochy.entity.Customer; import com.bochy.entity.Image; import com.bochy.entity.Order; import com.bochy.entity.Product; //util包里放工具类:封装了工具的类 列如:数据库连接与操作 public class DbUtil { public Connection getConnection()throws ClassNotFoundException, SQLException{ Connection conn=null; try { Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection ("jdbc:mysql://localhost:3306/database119", "root", "3119"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return conn; } public int executeUpdate(String sql,Object... obj){ int num=0; Connection conn=null; PreparedStatement pstat=null; try { conn=getConnection(); pstat=conn.prepareStatement(sql); // String sql="insert into tb_new (title,author,content) values(?,?,?)"; for (int i = 0; i < obj.length; i++) { pstat.setObject((i+1), obj[i]); } num=pstat.executeUpdate(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }finally{ close(null,pstat,conn); } return num; } public List<Product> executeQuery(String sql,Object...obj){ List<Product> list=new ArrayList<Product>(); Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn=getConnection(); ps=conn.prepareStatement(sql); for (int i = 0; i < obj.length; i++) { ps.setObject(i+1,obj[i]); } rs=ps.executeQuery(); while(rs.next()){ Integer id=(Integer)rs.getObject("id"); String name=(String) rs.getObject("name"); String filename=(String) rs.getObject("filename"); String sellprice=(String) rs.getObject("sellprice"); String description=(String) rs.getObject("description"); String baseprice=(String)rs.getObject("baseprice"); String marketprice=(String)rs.getObject("marketprice") ; String comment=(String)rs.getObject("comment") ; String categoryid=(String)rs.getObject("categoryid") ; String sexrequest=(String)rs.getObject("sexrequest"); Product product=new Product(); product.setId(id); product.setName(name); product.setFilename(filename); product.setSellprice(sellprice); product.setDescription(description); product.setBaseprice(baseprice); product.setMarketprice(marketprice); product.setComment(comment); product.setCategoryid(categoryid); product.setSexrequest(sexrequest); list.add(product); } } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ close(rs,ps,conn); } return list; } public List<Image> executeQueryImage(String sql,Object...object ){ List<Image> list=new ArrayList<Image>(); Connection conn=null; PreparedStatement pstat=null; ResultSet re=null; try { conn=getConnection(); pstat=conn.prepareStatement(sql); for (int i = 0; i < object.length; i++) { pstat.setObject((i+1), object[i]); } re=pstat.executeQuery(); while(re.next()){ String fileName=(String)re.getObject("fileName"); Image image=new Image(); image.setFileName(fileName); list.add(image); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } finally{ close(re, pstat, conn); } return list; } public List<Category> executeQueryCategory(String sql, Object...obj) { List<Category> list=new ArrayList<Category>(); Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn=getConnection(); ps=conn.prepareStatement(sql); for (int i=0; i <obj.length; i++) { ps.setObject(i+1,obj[i]); } rs=ps.executeQuery(); while(rs.next()){ Integer id=(Integer)rs.getObject("id"); String name=(String) rs.getObject("name"); Integer level=(Integer) rs.getObject("level"); Integer pid=(Integer) rs.getObject("pid"); Timestamp categoryTime=(Timestamp) rs.getObject("categoryTime"); Category category=new Category(); category.setId(id); category.setName(name); category.setCategoryTime(categoryTime); category.setLevel(level); category.setPid(pid); list.add(category); } }catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ close(rs,ps,conn); } return list; } public void close (ResultSet rs,PreparedStatement ps,Connection conn){ try { if(rs!=null){ rs.close(); } if(ps!=null){ ps.close(); } if(conn!=null){ conn.close(); } } catch (SQLException e) { e.printStackTrace(); } } public List<Admin> executeQueryAdmin(String sql,Object...obj ) { List<Admin> list=new ArrayList<Admin>(); Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn=getConnection(); ps=conn.prepareStatement(sql); for (int i = 0; i < obj.length; i++) { ps.setObject(i+1,obj[i]); } rs=ps.executeQuery(); while(rs.next()){ Integer id=(Integer)rs.getObject("id"); String username=(String) rs.getObject("username"); String password=(String)rs.getObject("password"); Admin admin=new Admin(); admin.setId(id); admin.setUsername(username); admin.setPassword(password); list.add(admin); } } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e) { e.printStackTrace(); }finally{ close(rs,ps,conn); } return list; } public List<Order> executeQueryOrder(String sql, Object...obj) { List<Order> list=new ArrayList<Order>(); Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn=getConnection(); ps=conn.prepareStatement(sql); for (int i = 0; i < obj.length; i++) { ps.setObject(i+1,obj[i]); } rs=ps.executeQuery(); while(rs.next()){ Integer id=(Integer)rs.getObject("id"); Integer totalMoney=(Integer)rs.getObject("totalMoney"); String receiver=(String) rs.getObject("receiver"); String address=(String) rs.getObject("address"); String payMethod=(String) rs.getObject("payMethod"); String orderState=(String) rs.getObject("orderState"); Timestamp orderTime=(Timestamp) rs.getObject("orderTime"); Order order=new Order(); order.setId(id); order.setTotalMoney(totalMoney); order.setReceiver(receiver); order.setAddress(address); order.setPayMethod(payMethod); order.setOrderState(orderState); order.setOrderTime(orderTime); list.add(order); } } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e) { e.printStackTrace(); }finally{ close(rs,ps,conn); } return list; } public List<Customer> executeQueryCustomer(String sql, Object...obj) { List<Customer> list = new ArrayList<Customer>(); Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn=getConnection(); ps=conn.prepareStatement(sql); for (int i = 0; i < obj.length; i++) { ps.setObject(i+1, obj[i]); } rs = ps.executeQuery(); while(rs.next()){ Integer id=(Integer) rs.getObject("id"); String name=(String) rs.getObject("name"); String password=(String) rs.getObject("password"); String realname=(String) rs.getObject("realname"); String address=(String) rs.getObject("address"); String email=(String) rs.getObject("email"); String tel=(String) rs.getObject("tel"); Customer customer=new Customer(); customer.setId(id); customer.setName(name); customer.setPassword(password); customer.setRealname(realname); customer.setAddress(address); customer.setEmail(email); customer.setTel(tel); list.add(customer); } } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e) { e.printStackTrace(); }finally{ close(rs,ps,conn); } return list; } }
55caac1145b87cbd8aa7ef590211b4135950b4a8
fa4ca2265cba6a5c626e11c0134939cc85b26e71
/notification-sending-system/src/main/java/com/example/javamvnspringbtblank/dao/NotificationDao.java
bf5cac310a5e4e6a71f7506de2bcfa7424d2de7e
[]
no_license
atkuzmanov/notification-system-kafka-evo
df9a5607b1f3652297e9109b659ed0e484530a54
cb7c4ab650ccbdc729f3f9941b21c5cc74099e54
refs/heads/main
2023-02-02T10:44:08.799360
2020-12-22T08:37:21
2020-12-22T08:37:21
321,991,704
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.example.javamvnspringbtblank.dao; import com.example.javamvnspringbtblank.model.BasicNotification; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; /** * MySQL Database Data Access Object (DAO) CRUD (Create Read Update Delete) repository. */ @Repository public interface NotificationDao extends CrudRepository<BasicNotification, Long> { }
6076f328d7c16222c809fd447cc4e0af9fdba4ca
c93e909cfa8a5a0b1a4f5b82956a51e4f06c6303
/Jabref_Beta_2_7_Docear/src/java/net/sf/jabref/imports/ImportInspector.java
00e637a9ea4286a5189f5476fe81135061409e9f
[]
no_license
gaobrian/Desktop
71088da71994660a536c2c29d6e1686dfd7f11a1
41fdbb021497eeb3bbfb963a9e388a50ee9777ef
refs/heads/master
2023-01-13T05:13:46.814353
2014-10-29T05:54:50
2014-10-29T05:54:50
25,906,710
2
0
null
2022-12-26T18:11:07
2014-10-29T05:56:26
Java
UTF-8
Java
false
false
1,110
java
package net.sf.jabref.imports; import net.sf.jabref.BibtexEntry; /** * An ImportInspector can be passed to a EntryFetcher and will receive entries * as they are fetched from somewhere. * * Currently there are two implementations: ImportInspectionDialog and * ImportInspectionCommandLine * */ public interface ImportInspector { /** * Notify the ImportInspector about the progress of the operation. * * The Inspector for instance could display a progress bar with the given * values. * * @param current * A number that is related to the work already done. * * @param max * A current estimate for the total amount of work to be done. */ void setProgress(int current, int max); /** * Add the given entry to the list of entries managed by the inspector. * * @param entry * The entry to add. */ void addEntry(BibtexEntry entry); /** * If this is a graphical dialog, bring it to the front. */ void toFront(); }
fa91bde037748b0c5acd57392185cc680f6daec3
995f73d30450a6dce6bc7145d89344b4ad6e0622
/P40_HarmonyOS_2.0.0_Developer_Beta1/src/main/java/com/huawei/hilink/framework/aidl/IHilinkService.java
54fa2bf86e1154d2048003be496e60dc817d2a3e
[]
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
16,114
java
package com.huawei.hilink.framework.aidl; import android.app.PendingIntent; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import android.os.RemoteException; import com.huawei.hilink.framework.aidl.IConnectResultCallback; import com.huawei.hilink.framework.aidl.IConnectionStateCallback; import com.huawei.hilink.framework.aidl.IRequestHandler; import com.huawei.hilink.framework.aidl.IResponseCallback; import com.huawei.hilink.framework.aidl.IServiceFoundCallback; public interface IHilinkService extends IInterface { int call(CallRequest callRequest, IResponseCallback iResponseCallback) throws RemoteException; int connect(ConnectRequest connectRequest, IConnectResultCallback iConnectResultCallback) throws RemoteException; int discover(DiscoverRequest discoverRequest, IServiceFoundCallback iServiceFoundCallback) throws RemoteException; int publishCanbeOffline(String str, String str2, PendingIntent pendingIntent) throws RemoteException; int publishKeepOnline(String str, String str2, IRequestHandler iRequestHandler) throws RemoteException; void registerConnectionStateCallback(IConnectionStateCallback iConnectionStateCallback) throws RemoteException; int sendResponse(int i, String str, CallRequest callRequest) throws RemoteException; void unpublish(String str) throws RemoteException; void unregisterConnectionStateCallback(IConnectionStateCallback iConnectionStateCallback) throws RemoteException; public static abstract class Stub extends Binder implements IHilinkService { private static final String DESCRIPTOR = "com.huawei.hilink.framework.aidl.IHilinkService"; static final int TRANSACTION_call = 2; static final int TRANSACTION_connect = 9; static final int TRANSACTION_discover = 1; static final int TRANSACTION_publishCanbeOffline = 4; static final int TRANSACTION_publishKeepOnline = 3; static final int TRANSACTION_registerConnectionStateCallback = 7; static final int TRANSACTION_sendResponse = 6; static final int TRANSACTION_unpublish = 5; static final int TRANSACTION_unregisterConnectionStateCallback = 8; public Stub() { attachInterface(this, DESCRIPTOR); } public static IHilinkService asInterface(IBinder obj) { if (obj == null) { return null; } IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (iin == null || !(iin instanceof IHilinkService)) { return new Proxy(obj); } return (IHilinkService) iin; } @Override // android.os.IInterface public IBinder asBinder() { return this; } @Override // android.os.Binder public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { DiscoverRequest _arg0; CallRequest _arg02; PendingIntent _arg2; CallRequest _arg22; ConnectRequest _arg03; if (code != 1598968902) { switch (code) { case 1: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = DiscoverRequest.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _result = discover(_arg0, IServiceFoundCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); reply.writeInt(_result); return true; case 2: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg02 = CallRequest.CREATOR.createFromParcel(data); } else { _arg02 = null; } int _result2 = call(_arg02, IResponseCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); reply.writeInt(_result2); return true; case 3: data.enforceInterface(DESCRIPTOR); int _result3 = publishKeepOnline(data.readString(), data.readString(), IRequestHandler.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); reply.writeInt(_result3); return true; case 4: data.enforceInterface(DESCRIPTOR); String _arg04 = data.readString(); String _arg1 = data.readString(); if (data.readInt() != 0) { _arg2 = (PendingIntent) PendingIntent.CREATOR.createFromParcel(data); } else { _arg2 = null; } int _result4 = publishCanbeOffline(_arg04, _arg1, _arg2); reply.writeNoException(); reply.writeInt(_result4); return true; case 5: data.enforceInterface(DESCRIPTOR); unpublish(data.readString()); reply.writeNoException(); return true; case 6: data.enforceInterface(DESCRIPTOR); int _arg05 = data.readInt(); String _arg12 = data.readString(); if (data.readInt() != 0) { _arg22 = CallRequest.CREATOR.createFromParcel(data); } else { _arg22 = null; } int _result5 = sendResponse(_arg05, _arg12, _arg22); reply.writeNoException(); reply.writeInt(_result5); return true; case 7: data.enforceInterface(DESCRIPTOR); registerConnectionStateCallback(IConnectionStateCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); return true; case 8: data.enforceInterface(DESCRIPTOR); unregisterConnectionStateCallback(IConnectionStateCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); return true; case 9: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg03 = ConnectRequest.CREATOR.createFromParcel(data); } else { _arg03 = null; } int _result6 = connect(_arg03, IConnectResultCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); reply.writeInt(_result6); return true; default: return super.onTransact(code, data, reply, flags); } } else { reply.writeString(DESCRIPTOR); return true; } } /* access modifiers changed from: private */ public static class Proxy implements IHilinkService { private IBinder mRemote; Proxy(IBinder remote) { this.mRemote = remote; } @Override // android.os.IInterface public IBinder asBinder() { return this.mRemote; } public String getInterfaceDescriptor() { return Stub.DESCRIPTOR; } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int discover(DiscoverRequest request, IServiceFoundCallback callback) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (request != null) { _data.writeInt(1); request.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeStrongBinder(callback != null ? callback.asBinder() : null); this.mRemote.transact(1, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int call(CallRequest request, IResponseCallback callback) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (request != null) { _data.writeInt(1); request.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeStrongBinder(callback != null ? callback.asBinder() : null); this.mRemote.transact(2, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int publishKeepOnline(String serviceType, String serviceID, IRequestHandler requestHandler) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeString(serviceType); _data.writeString(serviceID); _data.writeStrongBinder(requestHandler != null ? requestHandler.asBinder() : null); this.mRemote.transact(3, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int publishCanbeOffline(String serviceType, String serviceID, PendingIntent pendingIntent) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeString(serviceType); _data.writeString(serviceID); if (pendingIntent != null) { _data.writeInt(1); pendingIntent.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(4, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public void unpublish(String serviceID) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeString(serviceID); this.mRemote.transact(5, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int sendResponse(int errorCode, String payload, CallRequest callRequest) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeInt(errorCode); _data.writeString(payload); if (callRequest != null) { _data.writeInt(1); callRequest.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(6, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public void registerConnectionStateCallback(IConnectionStateCallback callback) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeStrongBinder(callback != null ? callback.asBinder() : null); this.mRemote.transact(7, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public void unregisterConnectionStateCallback(IConnectionStateCallback callback) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); _data.writeStrongBinder(callback != null ? callback.asBinder() : null); this.mRemote.transact(8, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override // com.huawei.hilink.framework.aidl.IHilinkService public int connect(ConnectRequest request, IConnectResultCallback callback) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (request != null) { _data.writeInt(1); request.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeStrongBinder(callback != null ? callback.asBinder() : null); this.mRemote.transact(9, _data, _reply, 0); _reply.readException(); return _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } } } } }
d020c1f36b099b2f1113b3671e50b322de8cd93e
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project81/src/test/java/org/gradle/test/performance81_3/Test81_286.java
faac3a504bc8d943eab67afad2d0e96cf9591715
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance81_3; import static org.junit.Assert.*; public class Test81_286 { private final Production81_286 production = new Production81_286("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
1979c3cdcb8b9aba8609143bf0154527915d2e26
8ffe119fece9c2f630ba912717071f6fb45aea1e
/app/src/main/java/com/ybj/myapplication/java/genericity/Banana.java
87ed4535b50fb7652c7992d12ebd3e062c3015a3
[]
no_license
AndGirl/Kotlin
fb8ebd0a4f48a6285fe813f6c69db85f36c2de35
00927776cd16a7dfaf7bbe6e5da14fdee61126ed
refs/heads/master
2022-11-25T19:39:24.859213
2020-08-04T13:35:39
2020-08-04T13:35:39
274,060,819
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package com.ybj.myapplication.java.genericity; /** * Created by 杨阳洋 on 2020/6/23. */ public class Banana implements Fruit { @Override public float weight() { return 1; } }
423b038dd7fa708dfa1800b4f4725865777fa983
ecdcac7b28276516494706d763599e2bbaabf325
/src/com/yth/JDBC上/jdbc4/preparedstatement/PreparedStatementQueryTest.java
6520651487190f99097ed7b4b75960de52ba1f93
[]
no_license
deleave/JDBC
4f68b605b6f02dbad507965eb80a028992e855eb
f3b96e32f0808cc3b76b696e84e10f9da98de8b2
refs/heads/master
2023-04-22T12:44:36.990272
2021-05-13T15:34:02
2021-05-13T15:34:02
366,621,209
0
0
null
null
null
null
UTF-8
Java
false
false
5,256
java
package com.yth.JDBC上.jdbc4.preparedstatement; import com.yth.JDBC上.jdbc2.bean.Customer; import com.yth.JDBC上.jdbc2.bean.Order; import com.yth.util.JDBCUtils; import org.junit.Test; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.ArrayList; import java.util.List; /** * @ClassName PreparedStatementQueryTest * @Description 使用PreparedStatement实现对于不同表的通用查询操作 * @Author deleave * @Date 2021/5/7 15:52 * @Version 1.0 **/ public class PreparedStatementQueryTest { @Test public void testgetForList(){ String sql="select id,name,email,birth from test.customers where id<?"; List<Customer> list = getForList(Customer.class, sql, 5); list.forEach(System.out::println); String sql1="select order_id orderId,order_name orderName,order_date orderDate from test.order where order_id>? "; List<Order> list1 = getForList(Order.class, sql1, 1); // 语义 list1.stream().forEach(order -> System.out.println(order)); list1.forEach(System.out::println); } public <T>List<T> getForList(Class<T> clazz,String sql,Object...args){ Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn = JDBCUtils.getConnection(); ps = conn.prepareStatement(sql); for (int i = 0; i < args.length; i++) { ps.setObject(i + 1, args[i]); } rs = ps.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); //获取列数 int columnCount = rsmd.getColumnCount(); //创建集合对象 ArrayList<T> list=new ArrayList<T>(); while (rs.next()) { //通过反射获取泛型对象 T t = clazz.newInstance(); //给t对象属性赋值 for (int i = 0; i < columnCount; i++) { //获取每个列的列值 Object columnValue = rs.getObject(i + 1); //获取每个列的列名 getColumnName() //获取列的别名 getColumnLabel() 无别名则取表名 String columnName = rsmd.getColumnLabel(i + 1); //通过反射将对象指定名columnName的属性赋值为指定的值columnValue Field field = clazz.getDeclaredField(columnName); field.setAccessible(true); field.set(t, columnValue);//确定赋值对象为order } list.add(t); } return list; }catch (Exception e){ e.printStackTrace(); }finally { JDBCUtils.closeResource(conn,ps,rs); } return null; } @Test public void testGetInstance(){ //查询customers表中的数据 String sql="select id,name,email from test.customers where id=?"; Customer customer = getInstance(Customer.class, sql, 19); System.out.println(customer); //查询order表中的数据 String sql1="select order_id orderId,order_name orderName,order_date orderDate from test.order where order_id=? "; Order order = getInstance(Order.class, sql1, 4); System.out.println(order); } /* *@ClassName PreparedStatementQueryTest *@Description 使用PreparedStatement实现针对于不同表的通用查询操作,返回一条数据 *@Author deleave *@Date 2021/5/7 16:13 *@Param [clazz, sql, args] **/ public <T>T getInstance(Class<T> clazz,String sql,Object...args){ Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; try { conn = JDBCUtils.getConnection(); ps = conn.prepareStatement(sql); for (int i = 0; i < args.length; i++) { ps.setObject(i + 1, args[i]); } rs = ps.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); //获取列数 int columnCount = rsmd.getColumnCount(); if (rs.next()) { //通过反射获取泛型对象 T t = clazz.newInstance(); for (int i = 0; i < columnCount; i++) { //获取每个列的列值 Object columnValue = rs.getObject(i + 1); //获取每个列的列名 getColumnName() //获取列的别名 getColumnLabel() 无别名则取表名 String columnName = rsmd.getColumnLabel(i + 1); //通过反射将对象指定名columnName的属性赋值为指定的值columnValue Field field = clazz.getDeclaredField(columnName); field.setAccessible(true); field.set(t, columnValue);//确定赋值对象为order } return t; } }catch (Exception e){ e.printStackTrace(); }finally { JDBCUtils.closeResource(conn,ps,rs); } return null; } }
3d7c0761cdd90b89678d62dd20bd8b7175a74848
5e0b56df883f87bcb78059c5a86f3a4409c65893
/src/main/java/com/agendapersonal/demomiagendapersonal/model/Contacto.java
aa897246a3ea37a47bce667ec0cd122581515885
[]
no_license
MarielozCL/pruebaAgendapersonal
a792ee80200c4c8b74aecfa5d50e133945c0b9b3
6a62ac2bfe4c4816da7151ecb914f962609d0a17
refs/heads/main
2023-09-02T13:20:56.468485
2021-11-05T00:50:07
2021-11-05T00:50:07
424,785,869
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package com.agendapersonal.demomiagendapersonal.model; import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; @Data @Entity public class Contacto { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer idcontacto; @NotBlank private String nombrecontacto; @NotBlank private String telefono; @NotBlank private String celular; @NotNull @Email private String email; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @NotNull private LocalDateTime citas; @NotBlank private String tipocontacto; @NotBlank private String direccion; }
2750fc1b8dd8f15b6476aa419f501e2a3869b264
8810972d0375c0a853e3a66bd015993932be9fad
/modelicaml/kepler/org.openmodelica.modelicaml.validation/src/org/openmodelica/modelicaml/validation/rules/classes/C45_FinalStateHaveNoOutgoingTransitionsConstrainst.java
8c966638a3d152991cac155735cd6a7e4a6b476e
[]
no_license
OpenModelica/MDT
275ffe4c61162a5292d614cd65eb6c88dc58b9d3
9ffbe27b99e729114ea9a4b4dac4816375c23794
refs/heads/master
2020-09-14T03:35:05.384414
2019-11-27T22:35:04
2019-11-27T23:08:29
222,999,464
3
2
null
2019-11-27T23:08:31
2019-11-20T18:15:27
Java
WINDOWS-1252
Java
false
false
2,947
java
/* * This file is part of OpenModelica. * * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC), * c/o Linköpings universitet, Department of Computer and Information Science, * SE-58183 Linköping, Sweden. * * All rights reserved. * * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE. * * The OpenModelica software and the Open Source Modelica * Consortium (OSMC) Public License (OSMC-PL) are obtained * from OSMC, either from the above address, * from the URLs: http://www.ida.liu.se/projects/OpenModelica or * http://www.openmodelica.org, and in the OpenModelica distribution. * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. * * This program is distributed WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. * * See the full OSMC Public License conditions for more details. * * Main author: Wladimir Schamai, EADS Innovation Works / Linköping University, 2009-2013 * * Contributors: * Uwe Pohlmann, University of Paderborn 2009-2010, contribution to the Modelica code generation for state machine behavior, contribution to Papyrus GUI adaptations */ package org.openmodelica.modelicaml.validation.rules.classes; import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.validation.AbstractModelConstraint; import org.eclipse.emf.validation.EMFEventType; import org.eclipse.emf.validation.IValidationContext; import org.eclipse.uml2.uml.FinalState; import org.openmodelica.modelicaml.common.constants.Constants; /** * State Machines * * C45: * Rule : Final State may not have outgoing transitions.. * * Severity : ERROR * * Mode : Batch */ public class C45_FinalStateHaveNoOutgoingTransitionsConstrainst extends AbstractModelConstraint { public C45_FinalStateHaveNoOutgoingTransitionsConstrainst() { } /* (non-Javadoc) * @see org.eclipse.emf.validation.AbstractModelConstraint#validate(org.eclipse.emf.validation.IValidationContext) */ @Override public IStatus validate(IValidationContext ctx) { EObject eObj = ctx.getTarget(); EMFEventType eType = ctx.getEventType(); // In Batch Mode if(eType == EMFEventType.NULL) { if(eObj instanceof FinalState){ FinalState finalState = (FinalState) eObj; if(finalState.getOutgoings().size() > 0){ return ctx.createFailureStatus(new Object[] {Constants.validationKeyWord_NOT_VALID + ": Final state may not have outgoing transitions"}); } } } return ctx.createSuccessStatus(); } }
[ "wschamai" ]
wschamai
b88bdd4e5d94685839fa674241ca7cc04afbcde5
aaf329ca081f14c512fdc44c4491b90e9955a68f
/app/src/main/java/com/android/mvp2/inject/scope/PerActivity.java
7efbdd0933c625b11ef9391c67b3a2eb718d8c0e
[]
no_license
cacarun/MyMVPDemo2
d253f46627c54d1425583386582581a412d9fb25
1cac0e655eeb9aefba66f30b1cb51a6eac2ca02e
refs/heads/master
2023-04-16T03:19:44.859952
2016-06-28T13:06:52
2016-06-28T13:06:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package com.android.mvp2.inject.scope; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; /** * In Dagger, an unscoped component cannot depend on a scoped component. As * {@link edu.com.app.injection.component.ApplicationComponent} is a scoped component ({@code @Singleton}, we create a custom * scope to be used by all fragment components. Additionally, a component with a specific scope * cannot have a sub component with the same scope. */ @Documented @Scope @Retention(RetentionPolicy.RUNTIME) public @interface PerActivity { }
79951dae7972e4f191b2a9e287b22e1ad0cd87fa
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-12584-1-16-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/XWikiHibernateStore_ESTest_scaffolding.java
8b257fa73eb795411005de8299250341d7eddf9b
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 20:37:34 UTC 2020 */ package com.xpn.xwiki.store; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class XWikiHibernateStore_ESTest_scaffolding { // Empty scaffolding for empty test suite }
4a2545d3802f18679db5d0f15b9340c0c9f78e1e
0bc2e5c44aa61207290d9d5a86105225399915c5
/Assessment/src/com/ibm/Assessment/Application.java
dfbc9b36906860b24c6977099d0a65fe1cde0cff
[]
no_license
IBMRupak/day1
1920c496d1c56b4448f1dd2b841373b242b4d8f7
7f8bf6600a7904f3d1629fc353a48bae1da0207b
refs/heads/main
2023-04-03T02:57:38.831428
2021-03-30T15:45:19
2021-03-30T15:45:19
345,996,183
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package com.ibm.Assessment; public class Application { public static void main(String[] args) { Bug bug = new Bug(111,"Rohan","Compiler","error",BugStatus.Open,Priority.Urgent); } }
df15781c391d8444391ff7a1da67fe923b5e9848
0fb0fa04615616f50261a9b157b4c1a3eb81adee
/gmall-oms/src/main/java/com/atguigu/gmall/oms/entity/OrderItemEntity.java
0d10e7bce3b54aa3c1e74d8dc94806012b14d1d7
[ "Apache-2.0" ]
permissive
youaremyhoney/gmall
56848394ecaef119496e3cbbccc04cb70ef24ede
fd6f86acbe266df89ff2b523acea0579454cda0f
refs/heads/master
2022-12-14T11:09:33.526900
2019-11-15T00:45:45
2019-11-15T00:45:45
218,020,994
0
0
Apache-2.0
2019-10-29T15:28:16
2019-10-28T10:25:39
JavaScript
UTF-8
Java
false
false
3,091
java
package com.atguigu.gmall.oms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 订单项信息 * * @author liuziqiang * @email [email protected] * @date 2019-10-28 20:26:14 */ @ApiModel @Data @TableName("oms_order_item") public class OrderItemEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId @ApiModelProperty(name = "id",value = "id") private Long id; /** * order_id */ @ApiModelProperty(name = "orderId",value = "order_id") private Long orderId; /** * order_sn */ @ApiModelProperty(name = "orderSn",value = "order_sn") private String orderSn; /** * spu_id */ @ApiModelProperty(name = "spuId",value = "spu_id") private Long spuId; /** * spu_name */ @ApiModelProperty(name = "spuName",value = "spu_name") private String spuName; /** * spu_pic */ @ApiModelProperty(name = "spuPic",value = "spu_pic") private String spuPic; /** * 品牌 */ @ApiModelProperty(name = "spuBrand",value = "品牌") private String spuBrand; /** * 商品分类id */ @ApiModelProperty(name = "categoryId",value = "商品分类id") private Long categoryId; /** * 商品sku编号 */ @ApiModelProperty(name = "skuId",value = "商品sku编号") private Long skuId; /** * 商品sku名字 */ @ApiModelProperty(name = "skuName",value = "商品sku名字") private String skuName; /** * 商品sku图片 */ @ApiModelProperty(name = "skuPic",value = "商品sku图片") private String skuPic; /** * 商品sku价格 */ @ApiModelProperty(name = "skuPrice",value = "商品sku价格") private BigDecimal skuPrice; /** * 商品购买的数量 */ @ApiModelProperty(name = "skuQuantity",value = "商品购买的数量") private Integer skuQuantity; /** * 商品销售属性组合(JSON) */ @ApiModelProperty(name = "skuAttrsVals",value = "商品销售属性组合(JSON)") private String skuAttrsVals; /** * 商品促销分解金额 */ @ApiModelProperty(name = "promotionAmount",value = "商品促销分解金额") private BigDecimal promotionAmount; /** * 优惠券优惠分解金额 */ @ApiModelProperty(name = "couponAmount",value = "优惠券优惠分解金额") private BigDecimal couponAmount; /** * 积分优惠分解金额 */ @ApiModelProperty(name = "integrationAmount",value = "积分优惠分解金额") private BigDecimal integrationAmount; /** * 该商品经过优惠后的分解金额 */ @ApiModelProperty(name = "realAmount",value = "该商品经过优惠后的分解金额") private BigDecimal realAmount; /** * 赠送积分 */ @ApiModelProperty(name = "giftIntegration",value = "赠送积分") private Integer giftIntegration; /** * 赠送成长值 */ @ApiModelProperty(name = "giftGrowth",value = "赠送成长值") private Integer giftGrowth; }
aa43581c04482566f99e336c2e200538546b8f1e
0f68807a666e283e63216235d0b0f4222cf66f69
/eyetouch-seentao-be/iuap-pcomments-api/src/main/java/com/yonyou/pcomments/api/PcommentsQueryService.java
b12ea9193ff8d12be76a491a8cc382cb7d035c10
[]
no_license
HiHaker/eyeTouch
709e1a88fbe5d6f539c1d9bb8d926f9a945d33c5
752fd12221ce1c035e8ddc6a3514d2a8ee83289b
refs/heads/master
2022-07-10T15:00:54.724060
2019-11-11T07:04:00
2019-11-11T07:04:00
207,545,728
1
0
null
2022-06-21T01:51:39
2019-09-10T11:52:02
Java
UTF-8
Java
false
false
486
java
package com.yonyou.pcomments.api; import com.yonyou.pcomments.dto.PcommentsDTO; import com.yonyou.iuap.ucf.common.rest.SearchParams; import com.yonyou.cloud.middleware.rpc.RemoteCall; import java.util.List; /** * RPC 调用接口声明 * @author * @date 2019-10-2 20:07:08 */ @RemoteCall("iuap-eyetouch-seentao-server") public interface PcommentsQueryService { /** * 查询帖子评论列表 */ List<PcommentsDTO> listPcomments(SearchParams searchParams); }
cbe2bae0566a82d33d6edf6586ce43d24a4f85d2
2a45fd01e2e9dc7e9c5b9e509eb0815a5acf3e71
/MediaMonitoringApp/app/src/main/java/com/academy/ndvalkov/mediamonitoringapp/common/events/main/UpdateSummaryEvent.java
8a1e9393b237f92b633aad0c9de9aeebd1e35126
[ "MIT" ]
permissive
ndvalkov/Android-Course-Project
8ff0471c420fad563b84392be74c8c59c76fff95
96cce329ada1e0cee80bd5cf1457141d01275c28
refs/heads/master
2021-07-11T04:56:09.505488
2017-10-13T13:44:16
2017-10-13T13:44:16
104,304,671
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.academy.ndvalkov.mediamonitoringapp.common.events.main; /** * An event object that will be passed as a result to * the subscribed methods from other classes and threads. */ public class UpdateSummaryEvent { public final boolean update; public UpdateSummaryEvent(boolean update) { this.update = update; } }
6452e7463d05961cb3f840388b7d63673455c12e
52ab979d0f05be96d58803c328df4e67d6768c4d
/app/src/androidTest/java/adnandanny/paknews/ExampleInstrumentedTest.java
43c11800a3f8c3675eecfcb643e9dc11c41edde5
[]
no_license
Adnan7k/PakNews
c08e24f177628000f18485b706e7c91c035cc679
7c086f40ea1f1be7a9cd8ca9f94ab83143bd577e
refs/heads/master
2021-07-19T12:43:46.026122
2017-10-27T09:08:37
2017-10-27T09:08:37
108,524,417
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package adnandanny.paknews; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("adnandanny.paknews", appContext.getPackageName()); } }
c1049788b41a33dd731029498847fc9064081118
f4b442e2e8ae44f58795dba793cba43c5944d97b
/app/src/main/java/protego/com/protegomaximus/KDDConnection.java
cea3fd0fb16d162a1547b5eb92a20841108606df
[]
no_license
liahos/ProtegoMaximus
257f37eb7174141cbe692ce3d9d2ff83bca10ca6
1900a1e6ef0c3aa597bf21e2dbf924721a122e95
refs/heads/master
2021-01-18T00:43:32.244384
2015-01-28T20:04:04
2015-01-28T20:04:04
29,983,407
0
0
null
2015-01-28T19:09:16
2015-01-28T19:09:16
null
UTF-8
Java
false
false
10,145
java
package protego.com.protegomaximus; /* * Creates an object for the connection record with the KDD Cup '99 data set features. * Of the 41 features in the KDD Cup '99 data set, features 10 to 22 have been removed as they * are not related to smartphones. Hence, this object will contain 28 features. */ import java.io.File; import java.io.FileWriter; import java.util.Set; public class KDDConnection { // Features as described in the KDD Cup '99 Documentation // List of features and descriptions at: http://www.sc.ehu.es/acwaldap/gureKddcup/README.pdf // Intrinsic features int duration = 0; String protocol = null; String service = null; String flag = null; int src_bytes = 0; int dst_bytes = 0; byte land = 0; int wrong_fragment = 0; int urgent = 0; // Time traffic features int count = 0; int srv_count = 0; double serror_rate = 0.00; double srv_serror_rate = 0.00; double rerror_rate = 0.00; double srv_error_rate = 0.00; double same_srv_rate = 0.00; double diff_srv_rate = 0.00; double srv_diff_host_rate = 0.00; // Machine traffic features int dst_host_count = 0; int dst_host_srv_count = 0; double dst_host_same_srv_rate = 0.00; double dst_host_diff_srv_rate = 0.00; double dst_host_same_src_port_rate = 0.00; double dst_host_srv_diff_host_rate = 0.00; double dst_host_serror_rate = 0.00; double dst_host_srv_serror_rate = 0.00; double dst_host_rerror_rate = 0.00; double dst_host_srv_error_rate = 0.00; private String convertRecord() { return (this.duration + "," + this.protocol + ',' + this.service + ',' + this.flag + ',' + this.src_bytes + ',' + this.dst_bytes + ',' + this.land + ',' + this.wrong_fragment + ',' + this.urgent + ',' + this.count + ',' + this.srv_count + ',' + String.format("%.2f", this.serror_rate) + ',' + String.format("%.2f", this.srv_serror_rate) + ',' + String.format("%.2f", this.rerror_rate) + ',' + String.format("%.2f", this.srv_error_rate) + ',' + String.format("%.2f", this.same_srv_rate) + ',' + String.format("%.2f", this.diff_srv_rate) + ',' + String.format("%.2f", this.srv_diff_host_rate) + ',' + this.dst_host_count + ',' + this.dst_host_srv_count + ',' + String.format("%.2f", this.dst_host_same_srv_rate) + ',' + String.format("%.2f", this.dst_host_diff_srv_rate) + ',' + String.format("%.2f", this.dst_host_same_src_port_rate) + ',' + String.format("%.2f", this.dst_host_srv_diff_host_rate) + ',' + String.format("%.2f", this.dst_host_serror_rate) + ',' + String.format("%.2f", this.dst_host_srv_serror_rate) + ',' + String.format("%.2f", this.dst_host_rerror_rate) + ',' + String.format("%.2f", this.dst_host_srv_error_rate)); } public static void writeToARFF(String filename, KDDConnection object) { // Filename is the name of the ARFF file to which the connection record is to be appended. try { File file = new File(filename); FileWriter writer = new FileWriter(file, true); writer.write(object.convertRecord()+"\n"); writer.flush(); writer.close(); } catch (Exception e) { e.printStackTrace(); } } // Creates a connection public static void createConnectionRecord(Set<DataFromLog> logData) { KDDConnection newConn = new KDDConnection(); // TIMESTAMP is in milliseconds newConn.duration = (int) ((GlobalVariables.endTime - GlobalVariables.startTime)/1000); newConn.protocol = GlobalVariables.connProtocol; newConn.service = GlobalVariables.connService; newConn.flag = getFlag(newConn.protocol); if (GlobalVariables.connSourceIP.equals(GlobalVariables.connDestIP) && GlobalVariables.connSourcePort == GlobalVariables.connDestPort) { newConn.land = 1; } else { newConn.land = 0; } for (DataFromLog temp1: logData) { newConn.src_bytes += (temp1.SRC_IP.equals(GlobalVariables.connSourceIP)) ? temp1.LENGTH : 0; newConn.dst_bytes += (temp1.DEST_IP.equals(GlobalVariables.connSourceIP)) ? temp1.LENGTH : 0; newConn.wrong_fragment += (temp1.CHECKSUM_DESC != null && temp1.CHECKSUM_DESC.equals("correct")) ? 0 : 1; newConn.urgent += (temp1.FLAGS.URG) ? 1 : 0; } // Create ReducedKDDConnection object and pass & add to last100Conn and lastTwoSec ReducedKDDConnection tempConn = new ReducedKDDConnection(); tempConn.TIMESTAMP = GlobalVariables.endTime; tempConn.PROTOCOL = newConn.protocol; tempConn.SERVICE = newConn.service; tempConn.FLAG = newConn.flag; tempConn.DEST_IP = GlobalVariables.connDestIP; tempConn.SRC_PORT = GlobalVariables.connSourcePort; tempConn.DEST_PORT = GlobalVariables.connDestPort; newConn = PastConnQueue.calculateTrafficFeatures(tempConn, newConn, GlobalVariables.last100Conn); newConn = LastTwoSecQueue.calculateTrafficFeatures(tempConn, newConn, GlobalVariables.lastTwoSec); writeToARFF(ReadFile1.csvFile, newConn); GlobalVariables.last100Conn.addConn(tempConn); GlobalVariables.lastTwoSec.addConn(tempConn); } private static String getFlag (String protocol) { // The flag is the state of the flag when the summary was written, ie when the connection terminated // 1. http://www.takakura.com/Kyoto_data/BenchmarkData-Description-v3.pdf // 2. https://www.bro.org/sphinx/_downloads/main20.bro // {OTH,REJ,RSTO,RSTOS0,RSTR,S0,S1,S2,S3,SF,SH} if (protocol.equals("tcp")) { if (GlobalVariables.stateHistory.contains("r")) { // Responder = TCP_RESET if (GlobalVariables.stateHistory.length() != 1) { // Has more than one character String temp = GlobalVariables.stateHistory.split("r", 2)[0]; if (temp != null && temp.contains("S") // Originator = TCP_SYN_SENT || temp.contains("H") // Originator = TCP_SYN_ACK_SENT || temp.contains("R")) { // Originator = TCP_RESET return "REJ"; } } else return "RSTR"; } else if (GlobalVariables.stateHistory.contains("R")) { if (GlobalVariables.stateHistory.length() != 1) { String temp = GlobalVariables.stateHistory.split("R", 2)[1]; if (temp != null && !temp.contains("S") && !temp.contains("H") && !temp.contains("I") && !temp.contains("A") && !temp.contains("F") && !temp.contains("R")) { // Originator sent a SYN followed by a RST, we never saw a SYN-ACK from the responder return "RSTOS0"; } } else return "RSTO"; } else if (GlobalVariables.stateHistory.contains("F") && GlobalVariables.stateHistory.contains("f")) { // Originator = TCP_CLOSED and Responder = TCP_CLOSED return "SF"; } else if (GlobalVariables.stateHistory.contains("F")) { // Originator = TCP_CLOSED (with finish bit) if (GlobalVariables.stateHistory.length() != 1) { String temp = GlobalVariables.stateHistory.split("F", 2)[1]; if (temp != null && !temp.contains("s") && !temp.contains("h") && !temp.contains("i") && !temp.contains("a") && !temp.contains("f") && !temp.contains("r")) { // Responder didn't send reply after Originator sends FIN (half open connection) return "SH"; } } else return "S2"; } else if (GlobalVariables.stateHistory.contains("f")) { // Responder = TCP_CLOSED if (GlobalVariables.stateHistory.length() != 1) { String temp = GlobalVariables.stateHistory.split("f", 2)[1]; if (temp != null && !temp.contains("S") && !temp.contains("H") && !temp.contains("I") && !temp.contains("A") && !temp.contains("F") && !temp.contains("R")) { // Originator doesn't respond return "S3"; } } else return "S3"; } else if (GlobalVariables.stateHistory.contains("S")) { if (GlobalVariables.stateHistory.length() != 1) { String temp = GlobalVariables.stateHistory.split("S", 2)[1]; if (temp != null && !temp.contains("s") && !temp.contains("h") && !temp.contains("i") && !temp.contains("a") && !temp.contains("f") && !temp.contains("r")) { // Originator = SYN_SENT and responder = TCP_INACTIVE return "S0"; } } return "S0"; } else if (GlobalVariables.stateHistory.contains("H") || GlobalVariables.stateHistory.contains("h")) { // Originator = TCP_ESTABLISHED and responder = TCP_ESTABLISHED return "S1"; } else return "OTH"; } else if (protocol.equals("udp") || protocol.equals("icmp")) { // As these do not have flags, etc set, and every connection is considered established and terminated, return "SF"; } return "OTH"; } }
e3be0cb550650b39489f0457538487008c773c32
47119d527d55e9adcb08a3a5834afe9a82dd2254
/tools/apidocs/src/main/test/com/emc/difftests/ApiClassDiffTests.java
1f1dd277feb564b6729b51c7827248d5fba8e385
[]
no_license
chrisdail/coprhd-controller
1c3ddf91bb840c66e4ece3d4b336a6df421b43e4
38a063c5620135a49013aae5e078aeb6534a5480
refs/heads/master
2020-12-03T10:42:22.520837
2015-06-08T15:24:36
2015-06-08T15:24:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,473
java
package com.emc.difftests; import com.emc.apidocs.differencing.DifferenceEngine; import com.emc.apidocs.model.ApiClass; import com.emc.apidocs.model.ApiField; import com.emc.apidocs.model.ApiMethod; import com.emc.apidocs.model.ChangeState; import com.google.common.collect.Lists; import java.util.Collections; import java.util.List; public class ApiClassDiffTests { public static void main(String[] args) throws Exception { List<ApiField> sequenceA = Lists.newArrayList(newField("A"),newField("B"),newField("P"),newField("C")); List<ApiField> sequenceB = Lists.newArrayList(newField("A"),newField("B"),newField("E"),newField("D"),newField("C")); List<ApiField> diffList = generateMergedList(sequenceA, sequenceB); System.out.println("OUTPUT : "); for (ApiField s : diffList) { switch(s.changeState) { case NOT_CHANGED: System.out.print("- "); break; case REMOVED: System.out.print("< "); break; case ADDED: System.out.print("> "); break; } System.out.println(s.name); } ApiClass apiClass = new ApiClass(); apiClass.fields = diffList; System.out.println("CONTAINS CHANGES :"+containsChanges(apiClass)); } /** * For more information on the LCS algorithm, see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem */ private static int[][] computeLcs(List<ApiField> sequenceA, List<ApiField> sequenceB) { int[][] lcs = new int[sequenceA.size()+1][sequenceB.size()+1]; for (int i = 0; i < sequenceA.size(); i++) { for (int j = 0; j < sequenceB.size(); j++) { if (sequenceA.get(i).compareTo(sequenceB.get(j)) == 0) { lcs[i+1][j+1] = lcs[i][j] + 1; } else { lcs[i+1][j+1] = Math.max(lcs[i][j+1], lcs[i+1][j]); } } } return lcs; } /** * Generates a merged list with changes */ public static List<ApiField> generateMergedList(List<ApiField> sequenceA, List<ApiField> sequenceB) { int[][] lcs = computeLcs(sequenceA, sequenceB); List<ApiField> mergedFields = Lists.newArrayList(); int aPos = sequenceA.size(); int bPos = sequenceB.size(); while (aPos > 0 || bPos > 0) { if (aPos > 0 && bPos > 0 && sequenceA.get(aPos-1).compareTo(sequenceB.get(bPos-1)) == 0) { ApiField field = sequenceA.get(aPos - 1); field.changeState = ChangeState.NOT_CHANGED; mergedFields.add(field); aPos--; bPos--; } else if (bPos > 0 && (aPos == 0 || lcs[aPos][bPos-1] >= lcs[aPos-1][bPos])) { ApiField field = sequenceB.get(bPos - 1); field.changeState = ChangeState.ADDED; mergedFields.add(field); bPos--; } else { ApiField field =sequenceA.get(aPos - 1); field.changeState = ChangeState.REMOVED; mergedFields.add(field); aPos--; } } // Backtracking generates the list from back to front, // so reverse it to get front-to-back. Collections.reverse(mergedFields); return mergedFields; } /** * @return Indicates if this class contains ANY changes (directly or within a fields type) */ public static boolean containsChanges(ApiClass apiClass) { for (ApiField field : apiClass.fields) { if (field.changeState != ChangeState.NOT_CHANGED) { return true; } } for (ApiField field : apiClass.fields) { if (!field.isPrimitive()) { boolean containsChanges = containsChanges(field.type); if (containsChanges) { return true; } } } return false; } private static ApiField newField(String name) { ApiField field = new ApiField(); field.name = name; field.primitiveType = "String"; return field; } }
051d19a77c062180f87674a6d352766a7f5b3db2
d5725488ccfee4f085bf8b55b59cc540d6e85ea0
/CityAPI/src/test/java/com/APICidades/CityAPI/CityApiApplicationTests.java
974c4c06f862f38d78889e6be85dfbd3be8a5158
[]
no_license
MicaelFrancisco19/projeto-DIOINNOVATION
1ad6a109e2120a673dcc9838da5a0e63d19382f0
123739f4874fa61391f79e5de748ce9c13b3d09d
refs/heads/main
2023-07-08T23:08:19.951961
2021-08-06T14:22:56
2021-08-06T14:22:56
393,375,211
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package com.APICidades.CityAPI; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CityApiApplicationTests { @Test void contextLoads() { } }
88bd84c375933c98609d9336e0038b7cc9f0b10f
3ec2b11a49ebf18e9d9f4f0a618d29306f14d5ac
/src/figure/Kvadrat.java
17accc031ba561d8fbdafcb8cfe22cd79e76b40d
[]
no_license
djordjedr/Bootcamp
8097e3930af0c15f814f7a9680b1d0baa83b7c3b
08c791fdbd9563e48b7cfad268be240ae8d0e371
refs/heads/main
2023-03-19T16:16:07.839765
2021-03-10T10:04:56
2021-03-10T10:04:56
332,848,416
0
0
null
null
null
null
UTF-8
Java
false
false
949
java
package figure; /* * Napraviti klasu GeometrijaFigura koja sadrzi podatke o x i y koordinatama tezista figure. * Napraviti klasu Krug koja sadrzi podatak o poluprecniku. Napraviti klasu Kvadrat koja sadrzi * podatak o duzini stranice. Napraviti klasu Trougao koja sadrzi podatke o duzinama stranica. * Za sve njih omoguciti funkcije za racunanje obima i povrsine. Napraviti listu figura. Igrati se sa njom. */ public class Kvadrat extends GeometrijaFigura { private int stranica; public Kvadrat(int x, int y, int stranica) { super(x, y); this.stranica=stranica; // TODO Auto-generated constructor stub } public void Obim() { System.out.println("Povrsina je: " + stranica*stranica); } public void Povrsina() { System.out.println("Obim je: " + 4*stranica); } public int getStranica() { return stranica; } public void setStranica(int stranica) { this.stranica = stranica; } }
80cdefc728ff5642f450bfa18f7f53570aa9754d
de264f18618e0b770c41f147124e9ed331d5cbcc
/Array/Count_The_Reversals.java
22e257ed147a94b617a7f3bbbe5a78e7f0e476b2
[]
no_license
mahesh122000/Data-Structures
5ac860a556c3ffe5cf839a30bf57f5adce2470f5
231a591770ac88af56f74bcdc08b695203d75a81
refs/heads/master
2021-06-25T13:45:22.186317
2021-02-24T16:05:57
2021-02-24T16:05:57
210,961,356
1
0
null
null
null
null
UTF-8
Java
false
false
1,026
java
import java.util.*; import java.lang.*; import java.io.*; class GFG { public static void main (String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { String c=s.next(); int n=c.length(); int count1=0,count2=0; for(int i=0;i<n;i++) { if(c.charAt(i)=='{') count1++; else { if(count1==0) { count2++; } else { count1--; } } } if((count1+count2)%2==1) System.out.println("-1"); else { int ans=0; if(count1%2==0) ans+=count1/2; else ans+=count1/2+1; if(count2%2==0) ans+=count2/2; else ans+=count2/2+1; System.out.println(ans); } } } }
2e56b0c80b419309ae6222bbe2b9f9809ef77b7b
932480a6fa3d2e04d6fa0901c51ad14b9704430b
/jonix-onix3/src/main/java/com/tectonica/jonix/onix3/BibleTextOrganization.java
03eed3f35bc20f49dc3bec67bc2986c26de0ae05
[ "Apache-2.0" ]
permissive
hobbut/jonix
952abda58a3e9817a57ae8232a4a62ab6b3cd50f
0544feb4b1ac8fd7dfd52e34e3f84d46eae5749e
refs/heads/master
2021-01-12T08:22:58.679531
2016-05-22T15:13:53
2016-05-22T15:13:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,111
java
/* * Copyright (C) 2012 Zach Melamed * * Latest version available online at https://github.com/zach-m/jonix * Contact me at [email protected] * * 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.tectonica.jonix.onix3; import java.io.Serializable; import com.tectonica.jonix.JPU; import com.tectonica.jonix.OnixElement; import com.tectonica.jonix.codelist.BibleTextOrganizations; import com.tectonica.jonix.codelist.RecordSourceTypes; /* * NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY */ /** * <h1>Bible text organization</h1> * <p> * An ONIX code indicating the way in which the content of a Bible or selected Biblical text is organized, for example * ‘Chronological’, ‘Chain reference’. Optional and non-repeating. * </p> * <table border='1' cellpadding='3'> * <tr> * <td>Format</td> * <td>Fixed-length, three letters</td> * </tr> * <tr> * <td>Codelist</td> * <td>List 86</td> * </tr> * <tr> * <td>Reference name</td> * <td>&lt;BibleTextOrganization&gt;</td> * </tr> * <tr> * <td>Short tag</td> * <td>&lt;b355&gt;</td> * </tr> * <tr> * <td>Cardinality</td> * <td>0&#8230;1</td> * </tr> * <tr> * <td>Example</td> * <td>&lt;b355&gt;CHA&lt;/b355&gt; (Chain reference)</td> * </tr> * </table> */ public class BibleTextOrganization implements OnixElement, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "BibleTextOrganization"; public static final String shortname = "b355"; // /////////////////////////////////////////////////////////////////////////////// // ATTRIBUTES // /////////////////////////////////////////////////////////////////////////////// /** * (type: dt.DateOrDateTime) */ public String datestamp; public RecordSourceTypes sourcetype; public String sourcename; // /////////////////////////////////////////////////////////////////////////////// // VALUE MEMBER // /////////////////////////////////////////////////////////////////////////////// public BibleTextOrganizations value; // /////////////////////////////////////////////////////////////////////////////// // SERVICES // /////////////////////////////////////////////////////////////////////////////// public BibleTextOrganization() {} public BibleTextOrganization(org.w3c.dom.Element element) { datestamp = JPU.getAttribute(element, "datestamp"); sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype")); sourcename = JPU.getAttribute(element, "sourcename"); value = BibleTextOrganizations.byCode(JPU.getContentAsString(element)); } }
f5091b42baa476399e5addbd96b85b3959f289f4
6acce890ffff72ffc56de6910274c506ddf77503
/src/main/java/cliente/Empresa.java
d14731fff08eb87738db2ad6ace9096c5d2b8924
[]
no_license
ProgramacionAvanzadaUJI/FactoryPatternEnumeraciones
f4d012df4c7b73447f9375954725972ebb57ce6d
d86c911a0a9d93d9e6373878aeac97b3ce777067
refs/heads/master
2023-04-03T06:09:02.137098
2023-03-29T08:42:16
2023-03-29T08:42:16
55,400,489
0
2
null
null
null
null
UTF-8
Java
false
false
205
java
package cliente; import cliente.Cliente; /** * Created by oscar on 4/4/16. */ public class Empresa extends Cliente { public Empresa(String nif, String nombre) { super(nif, nombre); } }
afe8238a04995c7b70521396d2ac7629a9660446
2125628fcb7239534f5f30f88fe2641fd7e256c8
/app/src/androidTest/java/top/isense/demo/testsensor/ApplicationTest.java
489e49318781cafb0b38fea06dd2ee4bc3fa0fee
[]
no_license
rickf91/TestSensor
49fee9feeb98572b00fce9b59b25c319f79b0ce8
060b12e0b3d75a21b40883d47f90a431e48632a1
refs/heads/master
2020-12-26T03:21:44.095185
2016-10-05T05:33:42
2016-10-05T05:33:42
68,783,852
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package top.isense.demo.testsensor; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
96639800d0fab7a5561de65f2c0a6d2bcff1cf8b
70203300d489c97da1a444c18de6235bdb4a83ff
/src/DAOImpl/DAOBookImpl.java
5c3a4db592dffe37d116385cf6a3e985a2e631c5
[]
no_license
Pasha7520/LibrarySql
a0672483961d188cf79a1c9cb942977daff1c814
4f41d19ac5524033f7193d69e0e651374c441109
refs/heads/master
2020-03-15T18:38:12.791532
2018-05-05T22:15:05
2018-05-05T22:15:05
132,288,477
0
0
null
null
null
null
UTF-8
Java
false
false
12,835
java
package DAOImpl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import com.mysql.jdbc.PreparedStatement; import entity.Author; import entity.Book; import entity.Customer; import service.OrderService; import serviceImpl.AuthorServiceImpl; import serviceImpl.OrderServiceImpl; import serviceImpl.RackServiceImpl; import util.DataBaseUtil2; import util.HibernateUtil; import util.MathUtil; import DAO.BaseDAO; import DAO.BookDAO; public class DAOBookImpl implements BaseDAO<Book>,BookDAO { @Override public Book getById(int Id) throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); List<Book> list = null; try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT b.* "+ " FROM book_author left join book b ON b.id = " + "book_author.book_id left join author a on book_author.author_id = a.id left join rack ON b.rack_id = rack.id left join department ON" + " rack.department_id = department.id where b.id =?;"); query.setParameter(0 , Id); query.addEntity("b", Book.class); list = query.list(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return list.get(0); } @Override public boolean add(Book b) throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("INSERT INTO book (book_name,book_page,rack_id,availeble,price) VALUE (?,?,?,?,?);"); query.setParameter(0,b.getName()); query.setParameter(1,b.getPages()); RackServiceImpl rackService = new RackServiceImpl(); query.setParameter(2,rackService.findfreeRac()); query.setParameter(3,true); query.setParameter(4,b.getPrice()); query.executeUpdate(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } AuthorServiceImpl authorServiceImpl = new AuthorServiceImpl(); authorServiceImpl.checkingOrWritingNewAuthor(b.getListAuthor()); bookAuthorWrite(b.getListAuthor()); return true; } @Override public boolean delete(Book t) throws SQLException { if(deleteBookAuthor(t.getId())){ Session session = HibernateUtil.getSessionFactory().openSession(); try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("DELETE FROM book WHERE id =?"); query.setParameter(0,t.getId()); query.executeUpdate(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return true; } return false; } @Override public List<Book> getAll() throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); List<Book> list = null; try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT DISTINCT b.* from book_author left join book b ON b.id = " + "book_author.book_id left join author a ON book_author.author_id = a.id left join rack ON b.rack_id = " + "rack.id left join department ON rack.department_id = department.id order by b.id;"); query.addEntity("b",Book.class); list = query.list(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return list; /*DataBaseUtil2.init(); List<Book> listbook = new ArrayList<Book>(); String query = "SELECT book.id,book.book_name,book.book_page,book.price,book.availeble,author.id author_id,author.author_name,rack.id rack_id from book_author left join book ON book.id = " + "book_author.book_id left join author on book_author.author_id = author.id left join rack ON book.rack_id = rack.id order by book.id"; PreparedStatement prepStat = (PreparedStatement) DataBaseUtil2.getConnection().prepareStatement(query); ResultSet resultSetBook = prepStat.executeQuery(); int id = 0; while(resultSetBook.next()){ if(id == resultSetBook.getInt("id")){ Author author = new Author(); author.setId(resultSetBook.getInt("author_id")); author.setAuthorName(resultSetBook.getString("author_name")); listbook.get(listbook.size()-1).addAuthor(author); } else{ Book book = new Book(); book.setId(resultSetBook.getInt("id")); book.setName(resultSetBook.getString("book_name")); book.setPages(resultSetBook.getInt("book_page")); if(resultSetBook.getByte("availeble")==0){ book.setAvaileble(false); }else{ book.setAvaileble(true); } book.setNumberRack(resultSetBook.getInt("rack_id")); book.setPrice(resultSetBook.getDouble("price")); Author author = new Author(); author.setId(resultSetBook.getInt("author_id")); author.setAuthorName(resultSetBook.getString("author_name")); book.addAuthor(author); listbook.add(book); } id = resultSetBook.getInt("id"); } resultSetBook.close(); prepStat.close(); return listbook; */ } @Override public void bookAuthorWrite(List<Author> listAuthor) throws SQLException { int BookId = getMaxBookId(); Session session = HibernateUtil.getSessionFactory().openSession(); AuthorServiceImpl authorService = new AuthorServiceImpl(); listAuthor = authorService.findAuthorsId(listAuthor); try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("INSERT INTO book_author (book_id,author_id) VALUE (?,?);"); for(Author a:listAuthor){ query.setParameter(0,BookId); query.setParameter(1,a.getId()); query.executeUpdate(); } session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } ///////// /* String query = "INSERT INTO book_author (book_id,author_id) VALUE (?,?);"; PreparedStatement prepStat = (PreparedStatement)DataBaseUtil2.getConnection().prepareStatement(query); String maxId = "SELECT MAX(id) FROM book;"; PreparedStatement prepStatMax = (PreparedStatement)DataBaseUtil2.getConnection().prepareStatement(maxId); ResultSet res = prepStatMax.executeQuery(); res.next(); int max = res.getInt(1); AuthorServiceImpl authorService = new AuthorServiceImpl(); listAuthor = authorService.findAuthorsId(listAuthor); for(Author a : listAuthor){ prepStat.setInt(1,max); prepStat.setInt(2, a.getId()); prepStat.executeUpdate(); } res.close(); prepStatMax.close(); prepStat.close();*/ } public int getMaxBookId(){ Session session = HibernateUtil.getSessionFactory().openSession(); List<Integer> list = null; try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT MAX(id) FROM book;"); list = query.list(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return (int)list.get(0); } @Override public void changeAvailebleBook(int id,boolean b) throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("UPDATE book SET availeble = ? WHERE id = ?;"); if(b){ byte br = 1; query.setParameter(0,br); } else { byte rr =0; query.setParameter(0, rr); } query.setParameter(1,id); query.executeUpdate(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } /////// /*DataBaseUtil2.init(); String queryBook = "UPDATE book SET availeble = ? WHERE id = ?;"; PreparedStatement prepStatBook = (PreparedStatement) DataBaseUtil2.getConnection().prepareStatement(queryBook); if(b){ byte br = 1; prepStatBook.setByte(1,br); } else { byte rr =0; prepStatBook.setByte(1, rr); } prepStatBook.setInt(2, id); prepStatBook.executeUpdate(); prepStatBook.close(); */ } @Override public int bookBelongDepartment(int bookId) throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); List<Integer> list = null; try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT department.id FROM book LEFT JOIN rack ON book.rack_id = rack.id LEFT JOIN " + "department ON rack.department_id = department.id where book.id =?;"); query.setParameter(0,bookId); list = query.list(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } /*DataBaseUtil2.init(); String query = "SELECT department.id FROM book LEFT JOIN rack ON book.rack_id = rack.id LEFT JOIN " + "department ON rack.department_id = department.id where book.id = "+bookId+";"; PreparedStatement prepStatBook = (PreparedStatement) DataBaseUtil2.getConnection().prepareStatement(query); ResultSet resultSet = prepStatBook.executeQuery(); resultSet.next(); int number = resultSet.getInt(1); resultSet.close(); prepStatBook.close();*/ return (int)list.get(0); } @Override public List<Book> getByName(String name)throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); List<Book> list = null; try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("SELECT b.*"+ " FROM book_author left join book b ON b.id = " + "book_author.book_id left join author a on book_author.author_id = a.id left join rack ON b.rack_id = rack.id left join department ON" + " rack.department_id = department.id where b.book_name =?;"); query.setParameter(0 , name); query.addEntity("b",Book.class); list = query.list(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return list; //// /*DataBaseUtil2.init(); List<Book> listbook = new ArrayList<Book>(); String queryBook = "SELECT book.id,book.book_name,book.book_page,book.price,book.availeble,author.id author_id,author.author_name,rack.id rack_id from book_author left join book ON book.id = " + "book_author.book_id left join author on book_author.author_id = author.id left join rack ON book.rack_id = rack.id left join department ON" + " rack.department_id = department.id where book.book_name =?"; PreparedStatement prepStatBook = (PreparedStatement) DataBaseUtil2.getConnection().prepareStatement(queryBook); prepStatBook.setString(1, name); //DAOAuthorImpl daoAuthorImpl = new DAOAuthorImpl(); ResultSet resultSetBook = prepStatBook.executeQuery(); int id = 0; while(resultSetBook.next()){ if(id == resultSetBook.getInt("id")){ Author author = new Author(); author.setId(resultSetBook.getInt("author_id")); author.setAuthorName(resultSetBook.getString("author_name")); listbook.get(listbook.size()-1).addAuthor(author); } else{ Book book = new Book(); book.setId(resultSetBook.getInt("id")); book.setName(resultSetBook.getString("book_name")); book.setPages(resultSetBook.getInt("book_page")); if(resultSetBook.getByte("availeble")==0){ book.setAvaileble(false); }else{ book.setAvaileble(true); } book.setNumberRack(resultSetBook.getInt("rack_id")); book.setPrice(resultSetBook.getDouble("price")); Author author = new Author(); author.setId(resultSetBook.getInt("author_id")); author.setAuthorName(resultSetBook.getString("author_name")); book.addAuthor(author); listbook.add(book); } id = resultSetBook.getInt("id"); } prepStatBook.close(); resultSetBook.close(); return listbook;*/ } @Override public boolean deleteBookAuthor(int id) throws SQLException { Session session = HibernateUtil.getSessionFactory().openSession(); try{ session.beginTransaction(); SQLQuery query = session.createSQLQuery("DELETE FROM book_author WHERE book_id =?"); query.setParameter(0,id); query.executeUpdate(); session.getTransaction().commit(); }catch(Exception e){ session.getTransaction().rollback(); e.printStackTrace(); } finally{ session.close(); } return true; } }
268651bcd3662d911e53f752e30dbbc5dbb46e53
024265faf2e58312f45ead4c26ff537811a00a81
/app/src/main/java/com/example/yazhai1226/androidtest/Observer/ObserverTest.java
cdf78840bcd3cc69864be394bd2fbcfc20a6f395
[]
no_license
VincentLoveAndroid/AndroidTest
28beccdb3b4d93320fffaa23ccda91350545336b
36987dea257d4c646d9adab0ceab0891aff9bbc2
refs/heads/master
2021-01-13T08:40:17.943978
2016-11-18T04:19:12
2016-11-18T04:19:12
72,271,218
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package com.example.yazhai1226.androidtest.Observer; /** * Created by MingRen on 2016/8/30. */ public class ObserverTest { public static void main(String args[]) { MySubject subject = new MySubject(); Observer1 observer1 = new Observer1(); Observer2 observer2 = new Observer2(); subject.addObserver(observer1); subject.addObserver(observer2); subject.addObserver(observer2);//此时vector中有三个元素1,2,2 subject.update(); subject.removeObserver(observer2);//移除第一个2,集合中还有1,2 subject.update(); } }
65a091eb0ca2fe6811f56987f0ce9c2c12a6e3ac
6e3ddabdb1c177c120e9d66dbdc7b9bb3f583b40
/build/project/src/com/safeDelivery/service/UserService.java
6ab9e5409a30591e9c0f67fc0859c3e2d268dbde
[]
no_license
MoiseGui/safeDelivery
778f764e462294a7921ee79afad9e0db3d43862a
530e3287e29aff0367f4a5ed3c4a4bb6a2b1fab9
refs/heads/master
2021-05-23T14:01:06.271465
2020-04-27T19:43:51
2020-04-27T19:43:51
253,325,665
1
0
null
null
null
null
UTF-8
Java
false
false
382
java
package com.safeDelivery.service; import com.safeDelivery.model.User; public interface UserService { public long existByEmailAndPass(String email, String pass); public User getUserByEmail(String email); public User getUserById(long id); public long addUser(User user); public int disableUserByEmail(String email); public int deleteUserByEmail(String email); }
[ "besto@Moïse-Gui" ]
besto@Moïse-Gui
52e4b54c60294d34f4985a874dc565d871575f89
b2d2d57b44c02883dfa12db810211bb0aaa1d804
/src/com/generic/util/loggerUtils.java
c7993a56ab46b3a421c685d82ece5837d5cd84ef
[]
no_license
tariqalrob97/RayCatch
30e0385f8d8b760ac8fbdfc38cc01b95bd04b0f7
48dfb75139acb3fd25d00fba3edd2b71b7a6d4b8
refs/heads/master
2020-06-29T06:21:11.906160
2019-11-12T07:32:39
2019-11-12T07:32:39
200,461,771
0
0
null
2019-08-04T07:40:44
2019-08-04T07:15:11
Java
UTF-8
Java
false
false
698
java
package com.generic.util; import org.apache.log4j.Logger; //import org.apache.log4j.Logger; public class loggerUtils { //private static ThreadLocal<Logger> loggers = new ThreadLocal<Logger>(); private String testName = ""; private Logger logs22; public void debug(String msg) { // System.out.println(msg); logs22.debug(testName +" : "+ Thread.currentThread().getId() +" : " + msg); Thread.currentThread().getThreadGroup(); //Reporter.log(msg, true ); } public loggerUtils(String testNameincome) { testName = testNameincome; logs22 = Logger.getLogger("logs"); debug(">>logs init TEST:" +Thread.currentThread().getId()+" : " +testNameincome); } }
6256209f9fc3c3dd38e2916f3e434e4d21800b76
9d271e07c8499a95845c0ba4a41820ec49afcfa9
/colorpicker/src/main/java/com/konstantinidis/harry/colorpicker/slider/AlphaSlider.java
95c849d25de330195ecd90fdd57e6650aa2ce4ee
[]
no_license
Harry1994/Solace
bda6b1f00acb65bee81da2942d2b3aa62441da78
360d8bc148f5673628a6e52e6d61a325f0dfedeb
refs/heads/master
2020-04-08T13:24:15.471435
2018-11-27T19:32:30
2018-11-27T19:32:30
159,389,524
0
0
null
null
null
null
UTF-8
Java
false
false
2,414
java
package com.konstantinidis.harry.colorpicker.slider; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff; import android.util.AttributeSet; import com.konstantinidis.harry.colorpicker.ColorPickerView; import com.konstantinidis.harry.colorpicker.Utils; import com.konstantinidis.harry.colorpicker.builder.PaintBuilder; public class AlphaSlider extends AbsCustomSlider { public int color; private Paint alphaPatternPaint = PaintBuilder.newPaint().build(); private Paint barPaint = PaintBuilder.newPaint().build(); private Paint solid = PaintBuilder.newPaint().build(); private Paint clearingStroke = PaintBuilder.newPaint().color(0xffffffff).xPerMode(PorterDuff.Mode.CLEAR).build(); private ColorPickerView colorPicker; public AlphaSlider(Context context) { super(context); } public AlphaSlider(Context context, AttributeSet attrs) { super(context, attrs); } public AlphaSlider(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void createBitmaps() { super.createBitmaps(); alphaPatternPaint.setShader(PaintBuilder.createAlphaPatternShader(barHeight / 2)); } @Override protected void drawBar(Canvas barCanvas) { int width = barCanvas.getWidth(); int height = barCanvas.getHeight(); barCanvas.drawRect(0, 0, width, height, alphaPatternPaint); int l = Math.max(2, width / 256); for (int x = 0; x <= width; x += l) { float alpha = (float) x / (width - 1); barPaint.setColor(color); barPaint.setAlpha(Math.round(alpha * 255)); barCanvas.drawRect(x, 0, x + l, height, barPaint); } } @Override protected void onValueChanged(float value) { if (colorPicker != null) colorPicker.setAlphaValue(value); } @Override protected void drawHandle(Canvas canvas, float x, float y) { solid.setColor(color); solid.setAlpha(Math.round(value * 255)); canvas.drawCircle(x, y, handleRadius, clearingStroke); if (value < 1) canvas.drawCircle(x, y, handleRadius * 0.75f, alphaPatternPaint); canvas.drawCircle(x, y, handleRadius * 0.75f, solid); } public void setColorPicker(ColorPickerView colorPicker) { this.colorPicker = colorPicker; } public void setColor(int color) { this.color = color; this.value = Utils.getAlphaPercent(color); if (bar != null) { updateBar(); invalidate(); } } }
d75ae82d63beb427617f2b4ee28344e0574cb7e0
be4773a9f66590f6f20a3126ac4fc0fdd48b81da
/Screen.java
60a58314b6f3a9fe658fbacbb440cf46f423b092
[]
no_license
Lallen25/Group-Golf-game
6a1dbcbb78836d06e38673eb8ac14294d337944a
8e2cf2ca7c1590761483762de06b7ccd06fe027f
refs/heads/master
2020-03-23T23:11:41.224772
2018-07-25T00:55:51
2018-07-25T00:55:51
142,221,046
0
0
null
2018-07-24T23:06:53
2018-07-24T23:00:20
null
UTF-8
Java
false
false
1,459
java
import java.io.File; import java.io.IOException; import java.nio.file.*; import java.util.ArrayList; import java.util.function.*; import java.util.Random; import org.jsfml.audio.*; import org.jsfml.system.*; import org.jsfml.window.*; import org.jsfml.window.event.*; import org.jsfml.graphics.*; /** * Is used as a base class for other game areas, so stores a number of variables here. */ public class Screen { int screenWidth = 1920; int screenHeight = 1080; int centreX = screenWidth /2; int centreY = screenHeight/2; RenderWindow window; // // The Java install comes with a set of fonts but these will // be on different filesystem paths depending on the version // of Java and whether the JDK or JRE version is being used. // String JavaVersion = Runtime.class.getPackage( ).getImplementationVersion( ); String JdkFontPath = "C:\\Program Files\\Java\\jdk" + JavaVersion +"\\jre\\lib\\fonts\\"; String JreFontPath ="C:\\Program Files\\Java\\jre" + JavaVersion +"\\lib\\fonts\\"; int fontSize = 48; String WindowTitle = "Golfmania v0.3.4"; String FontPath; // Where fonts were found //Arrays that most objects are found in throughout the game ArrayList<Object> objects = new ArrayList<Object>( ); ArrayList<Button> buttons = new ArrayList<Button>( ); int xMouse; int yMouse; public Screen() { } int clicked(String name) { return 0; } int run (RenderWindow window, int gameStateIn) { return 0; } }
3f28bc8c0e6406b89ee123f6d649f67ede91baa2
80118fa300bb0ae9f136e4cb68ff44f28381d104
/src/com/tz/user/service/impl/UserServiceImpl.java
5ac8c9f691bb110dbe68d2c6936321566f7876a3
[]
no_license
xhj224/crm01
24c3dcd5cae64d2e06a641749769c5d1ad8ba5af
080015d13882fc48497c6179c16d9b4c24af8627
refs/heads/master
2021-01-12T01:05:03.132841
2017-01-09T05:36:38
2017-01-09T05:36:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.tz.user.service.impl; import com.tz.entity.User; import com.tz.user.dao.IUserDao; import com.tz.user.service.IUserService; import com.tz.util.BeanFactory; public class UserServiceImpl implements IUserService { IUserDao userDao = (IUserDao) BeanFactory.getBean("userDao"); @Override public User login(String username, String password) { return userDao.selectUser(username, password); } }
65c6df3dd18f583046f684238e7578f62efc7de3
6b82417de7921a176c21175fab70cf0ab6a73a16
/src/main/java/com/moviestore/domain/Credit.java
3c4db5b436ad9664a436bbe6ff37378dc844e527
[ "MIT" ]
permissive
tanbinh123/movie-store-springboot-tutorial
5239dd46be5ea761e5d042e6df58443648983ee8
49e89ad59dd0d52f92e5da480d7c0fff6260ac5f
refs/heads/master
2023-03-18T08:09:27.660209
2017-12-20T22:41:24
2017-12-20T22:41:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
package com.moviestore.domain; public class Credit { private String name; private String role; private boolean star; public Credit(String name, String role, boolean star) { super(); this.name = name; this.role = role; this.star = star; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public boolean isStar() { return star; } public void setStar(boolean star) { this.star = star; } }
196ba723d655f11bc06dc15640e7f2ad122c0bc4
5c71f8ef378960d2f4e09d6d00266bb30513d401
/src/view/LoadGame.java
efe03026e2510fd778fdcd29e71faa81f3b928fb
[]
no_license
hhwcode/Plane
25971f54a460a88c08cf8638dc623a7ab6cf867a
e07a9f675a0e691e2362cf555739cd18264c6386
refs/heads/master
2021-06-21T03:49:37.481902
2017-07-20T06:26:36
2017-07-20T06:26:36
null
0
0
null
null
null
null
GB18030
Java
false
false
2,496
java
package view; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JPanel; import Plane.Config; import Plane.MusicPlayer; /** * 游戏加载页面 * * @author Administrator * */ public class LoadGame extends JPanel implements Runnable { private static final long serialVersionUID = 1L; // 背景图片 public Image bg; // 声明飞机图片 public Image logo_plane, bomb3; public Font f; // 飞机的xy private int x = 0; // 定义线程对象 private Thread thread; // 加载动画的状态 private boolean logo_type = true; public GameJPanel gameJPanel; /** * 构造方法 * @param gameJPanel */ public LoadGame(GameJPanel gameJPanel) { // 实例化背景图片 bg = new ImageIcon(Config.img_bg_level_2).getImage(); // 定义字体 f = new Font("", Font.BOLD, 25); this.gameJPanel = gameJPanel; this.setLayout(null); } /** * 开始线程,重绘 */ public void logoin() { MusicPlayer music = new MusicPlayer(Config.loading_sound); music.play(); thread = new Thread(this); thread.start(); } /** * 绘制背景(自动调用) 多次运行 线程在后台更新ui repaint */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(bg, 0, 0,480,700, null); g.drawImage(new ImageIcon(Config.myPlane).getImage(),(Config.window_width - 116)/2, 30,120,79, null); g.setColor(Color.WHITE); g.drawRect(19,Config.window_height - 201, 440, 42); g.setColor(Color.ORANGE); g.fillRect(20,Config.window_height - 200, 440 * x/100, 40); g.setColor(Color.ORANGE); g.setFont(new Font("微软雅黑",Font.BOLD,40)); g.drawString("全民飞机大战", (Config.window_width - 250)/2, 180); g.setColor(Color.WHITE); g.setFont(f); g.drawString("游戏加载中...", 150,400); } /** * 线程run方法 */ @Override public void run() { while (logo_type) { // 修改x坐标 重绘 x = x + 1; repaint(); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } if (x > 100) { logo_type = false;//结束线程 } } logo_type = true; x = 0; // 游戏页面 PlaneJFrame.card.show(PlaneJFrame.mainJPanel, "gameJPanel"); // 开始游戏 gameJPanel.startGame(); } }
3fef685a01e7defa4e3e3a50325dd13a4ef442b1
fe2633b35a882f094fd4dd77e680127096821a62
/src/main/java/com/audio/DAO/PayDAO.java
315a72913d8a917695b0e6f3a87546f99b5d208c
[]
no_license
jun1101/Test
84e89bc1804e419d2d5c7b9789dd62839b30e342
3d96e6ec7c894f27d5ec171e040533a712ac5949
refs/heads/master
2022-02-07T06:17:23.293633
2022-01-05T06:36:56
2022-01-05T06:36:56
253,834,629
0
0
null
null
null
null
UTF-8
Java
false
false
269
java
package com.audio.DAO; import com.audio.VO.PayVO; import com.audio.VO.userVO; public interface PayDAO { public void insertPay(PayVO vo) throws Exception; public int firstPayUpdate(userVO vo) throws Exception; public int payUpdate(userVO vo) throws Exception; }
050bde36e12f2bb737a490ebd91bc575026ad1f3
0818e54179fb1de01354f7d51c68b1d25ba178e2
/src/main/java/hr/fer/zemris/java/hw11/jnotepadpp/local/LocalizationProvider.java
c3297827161e1a8e6806210bfba717a4d303933e
[]
no_license
ivanrezic/jNotepad
b7afb9a9df49a41141a7e0684b0c05c6a198dc3a
bc476169019d3cf84896c2250a4a3b59787e4bba
refs/heads/master
2021-01-01T17:53:30.369932
2017-07-24T20:37:02
2017-07-24T20:37:02
98,187,770
1
0
null
null
null
null
UTF-8
Java
false
false
1,536
java
package hr.fer.zemris.java.hw11.jnotepadpp.local; import java.util.Locale; import java.util.ResourceBundle; /** * <code>LocalizationProvider</code> is singleton instance that enables us to * get current langueage values saved in property files. * * @author Ivan Rezic */ public class LocalizationProvider extends AbstractLocalizationProvider { /** Current language. */ private String language; /** Bundle which contains translation files. */ private ResourceBundle bundle; /** {@linkplain LocalizationProvider} instance. */ private static final LocalizationProvider instance = new LocalizationProvider(); /** * Constructor which instantiates new localization provider. */ private LocalizationProvider() { setLanguage("en"); } /** * Gets the single instance of LocalizationProvider. * * @return single instance of LocalizationProvider */ public static LocalizationProvider getInstance() { return instance; } @Override public String getString(String key) { return bundle.getString(key); } /** * Method which sets given language as language. * * @param language * New language. */ public void setLanguage(String language) { this.language = language; Locale locale = Locale.forLanguageTag(language); bundle = ResourceBundle.getBundle("hr.fer.zemris.java.hw11.jnotepadpp.local.translation", locale); fire(); } /** * Method used for getting property <code>Language</code>. * * @return Language. */ public String getLanguage() { return language; } }
cbddf2f3c93cc72657e33692525fb25947ca0b1d
e9770dd1289d90ff19486f7b7de879a2cd4c5490
/AnalizadorLexico/src/analizadorlexico/AnalizadorLexico.java
b4c54be1f3decdbf83350b04ddb89ef481a91f85
[ "MIT" ]
permissive
Skullcachi/compiladores2-analizadorlexico
a2224d40518e9d99c472cbee25e63a33e1f284d2
9ff90d5af0c3622cf22bf1290037028aab440a96
refs/heads/master
2020-07-11T14:08:31.769154
2019-09-28T00:36:57
2019-09-28T00:36:57
204,562,990
0
0
null
null
null
null
UTF-8
Java
false
false
1,866
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 analizadorlexico; import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author cachi */ public class AnalizadorLexico { static String PATH = "C:/Users/cachi/OneDrive/Documents/NetBeansProjects/AnalizadorLexico/src/analizadorlexico/Yylex.flex"; /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here GenerarLexer(PATH); } public static void GenerarLexer(String path){ File output = new File(path); jflex.Main.generate(output); } public static boolean moveFile(String fileName) { boolean fileMoved = false; File file = new File(fileName); if (file.exists()) { System.out.println("moving cup generated files to the correct path"); Path currentRelativePath = Paths.get(""); String newDir = currentRelativePath.toAbsolutePath().toString() + File.separator + "src" + File.separator + "analizadorlexico" + File.separator + file.getName(); if (file.renameTo(new File(newDir))) { System.out.println("the cup generated file has been moved successfully."); fileMoved = true; } else { System.out.println("ERROR, the file could not be moved."); } } else { System.out.println("File could not be found!"); } return fileMoved; } }
103ce98e25b9ec43f1098b939888d0ad8a2326d0
93dd4c645cc9da8be21157dccd47952779c234c7
/JAVA_SE/20200109_Scanner类Random类ArrayList类/src/Scanner类/ScannnerDemo2_Max.java
d06f9fe96c9bc67cc58f061aac64057430a304f6
[]
no_license
Shanshan-Shan/JavaPractice
620fbaa878fe0574090cb7fea3868a547dbf6106
a48a57065d9eb460d2d58d7249038619016db88c
refs/heads/master
2020-08-27T23:14:50.197482
2020-05-12T14:16:31
2020-05-12T14:16:31
217,516,783
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package Scanner类; import java.util.Scanner; //键盘输入三个int数字,然后求出其中的最大值。 public class ScannnerDemo2_Max { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入第一个数字a:"); int a = sc.nextInt(); System.out.println("请输入第二个数字b:"); int b = sc.nextInt(); System.out.println("请输入第三个数字c:"); int c = sc.nextInt(); // int re = 0; // if(a > b) // re = a; // else // re = b; // // int max = 0; // if(re > c) // max = re; // else // max = c; int temp = a > b ? a : b; int max = temp > c ? temp : c; System.out.println("三个数字中的最大值为:" + max); } }
c0afb691f39a168ebce7611e9242f4f25e8acc07
4f3d59101c8ff8c1295bba6236820c0b30deb1ea
/core/src/main/java/org/springframework/security/saml/SAMLAuthenticationToken.java
03e8db9ae79b454004ae9e1ec0952fd644964455
[]
no_license
chubbard/spring-security-saml
57d97a528f84210afa820ba7279a1b685f69364e
34580782adc87974287c9d063db582c5b6ce8a63
refs/heads/master
2021-07-31T20:12:49.460740
2021-07-17T22:10:33
2021-07-17T22:10:33
218,110,976
1
0
null
2019-10-28T17:52:39
2019-10-28T17:52:38
null
UTF-8
Java
false
false
2,521
java
/* Copyright 2009 Vladimir Schäfer * * 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 * * https://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.security.saml; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.saml.context.SAMLMessageContext; import org.springframework.util.Assert; /** * SAML Token is used to pass SAMLContext object through to the SAML Authentication provider. * * @author Vladimir Schäfer */ public class SAMLAuthenticationToken extends AbstractAuthenticationToken { private static final long serialVersionUID = 1L; /** * SAML context with content to verify */ private transient SAMLMessageContext credentials; /** * Default constructor initializing the context * * @param credentials SAML context object created after decoding */ public SAMLAuthenticationToken(SAMLMessageContext credentials) { super(null); Assert.notNull(credentials, "SAMLAuthenticationToken requires the credentials parameter to be set"); this.credentials = credentials; setAuthenticated(false); } /** * Returns the stored SAML context * * @return context */ public SAMLMessageContext getCredentials() { return this.credentials; } /** * Always null * * @return null */ public Object getPrincipal() { return null; } /** * This object can never be authenticated, call with true result in exception. * * @param isAuthenticated only false value allowed * * @throws IllegalArgumentException if isAuthenticated is true */ public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { if (isAuthenticated) { throw new IllegalArgumentException( "Cannot set this token to trusted - use constructor containing GrantedAuthority[]s instead"); } super.setAuthenticated(false); } }
17813675a5aec20e31eda9fea34d09ca9bc67e4d
28c9dbc1f8d9c4083534dbb2eb623781107619ef
/src/pubhub/dao/BookDAO.java
e5a471439c3ee641bed7a8075168257547b369ef
[]
no_license
haydenhw/PubHub
29164ec3201a7108b91aae85c3b05f4257e46651
b6a1b8a8a480aefd650c468b1c18da09cd94eabf
refs/heads/master
2023-01-09T17:55:36.112619
2020-11-07T23:59:58
2020-11-07T23:59:58
309,244,667
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package pubhub.dao; import java.util.List; import pubhub.model.Book; /** * Interface for our Data Access Object to handle database queries related to Books. */ public interface BookDAO { public List<Book> getAllBooks(); public List<Book> getBooksByTitle(String title); public List<Book> getBooksByAuthor(String author); public List<Book> getBooksLessThanPrice(double price); public List<Book> getBooksByTag(String tagName); public Book getBookByISBN(String isbn); public boolean addBook(Book book); public boolean updateBook(Book book); public boolean deleteBookByISBN(String isbn); }
f4066d6ced96c85600271618d3cccc7fef7e28d7
dfb3f631ed8c18bd4605739f1ecb6e47d715a236
/disconnect-highcharts/src/main/java/js/lang/external/highcharts/AnnotationsElliottWaveShapeOptions.java
ca928ed0cdcd8f5d61ccfe4bef828acfca4bbfb2
[ "Apache-2.0" ]
permissive
fluorumlabs/disconnect-project
ceb788b901d1bf7cfc5ee676592f55f8a584a34e
54f4ea5e6f05265ea985e1ee615cc3d59d5842b4
refs/heads/master
2022-12-26T11:26:46.539891
2020-08-20T16:37:19
2020-08-20T16:37:19
203,577,241
6
1
Apache-2.0
2022-12-16T00:41:56
2019-08-21T12:14:42
Java
UTF-8
Java
false
false
6,525
java
package js.lang.external.highcharts; import com.github.fluorumlabs.disconnect.core.annotations.Import; import com.github.fluorumlabs.disconnect.core.annotations.NpmPackage; import java.lang.String; import javax.annotation.Nullable; import js.lang.Any; import js.lang.Unknown /* ( ColorString | GradientColorObject | PatternObject ) */; import org.teavm.jso.JSProperty; /** * (Highstock) Options for annotation's shapes. Each shape inherits options from * the shapeOptions object. An option from the shapeOptions can be overwritten * by config for a specific shape. * */ @NpmPackage( name = "highcharts", version = "^8.1.2" ) @Import( module = "highcharts/es-modules/masters/highcharts.src.js" ) public interface AnnotationsElliottWaveShapeOptions extends Any { /** * (Highstock) Name of the dash style to use for the shape's stroke. * */ @JSProperty("dashStyle") @Nullable DashStyle getDashStyle(); /** * (Highstock) Name of the dash style to use for the shape's stroke. * */ @JSProperty("dashStyle") void setDashStyle(@Nullable DashStyle value); /** * (Highstock) The color of the shape's fill. * */ @JSProperty("fill") @Nullable Unknown /* ( ColorString | GradientColorObject | PatternObject ) */ getFill(); /** * (Highstock) The color of the shape's fill. * */ @JSProperty("fill") void setFill(@Nullable PatternObject value); /** * (Highstock) The color of the shape's fill. * */ @JSProperty("fill") void setFill(@Nullable String value); /** * (Highstock) The color of the shape's fill. * */ @JSProperty("fill") void setFill(@Nullable GradientColorObject value); /** * (Highstock) The height of the shape. * */ @JSProperty("height") double getHeight(); /** * (Highstock) The height of the shape. * */ @JSProperty("height") void setHeight(double value); /** * (Highstock) The radius of the shape. * */ @JSProperty("r") double getR(); /** * (Highstock) The radius of the shape. * */ @JSProperty("r") void setR(double value); /** * (Highstock) Defines additional snapping area around an annotation making * this annotation to focus. Defined in pixels. * */ @JSProperty("snap") double getSnap(); /** * (Highstock) Defines additional snapping area around an annotation making * this annotation to focus. Defined in pixels. * */ @JSProperty("snap") void setSnap(double value); /** * (Highstock) The URL for an image to use as the annotation shape. Note, * type has to be set to <code>'image'</code>. * */ @JSProperty("src") @Nullable String getSrc(); /** * (Highstock) The URL for an image to use as the annotation shape. Note, * type has to be set to <code>'image'</code>. * */ @JSProperty("src") void setSrc(@Nullable String value); /** * (Highstock) The color of the shape's stroke. * */ @JSProperty("stroke") @Nullable String getStroke(); /** * (Highstock) The color of the shape's stroke. * */ @JSProperty("stroke") void setStroke(@Nullable String value); /** * (Highstock) The pixel stroke width of the shape. * */ @JSProperty("strokeWidth") double getStrokeWidth(); /** * (Highstock) The pixel stroke width of the shape. * */ @JSProperty("strokeWidth") void setStrokeWidth(double value); /** * (Highstock) The type of the shape, e.g. circle or rectangle. * */ @JSProperty("type") @Nullable String getType(); /** * (Highstock) The type of the shape, e.g. circle or rectangle. * */ @JSProperty("type") void setType(@Nullable String value); /** * (Highstock) The width of the shape. * */ @JSProperty("width") double getWidth(); /** * (Highstock) The width of the shape. * */ @JSProperty("width") void setWidth(double value); static Builder builder() { return new Builder(); } final class Builder { private final AnnotationsElliottWaveShapeOptions object = Any.empty(); private Builder() { } public AnnotationsElliottWaveShapeOptions build() { return object; } /** * (Highstock) Name of the dash style to use for the shape's stroke. * */ public Builder dashStyle(@Nullable DashStyle value) { object.setDashStyle(value); return this; } /** * (Highstock) The color of the shape's fill. * */ public Builder fill(@Nullable PatternObject value) { object.setFill(value); return this; } /** * (Highstock) The color of the shape's fill. * */ public Builder fill(@Nullable String value) { object.setFill(value); return this; } /** * (Highstock) The color of the shape's fill. * */ public Builder fill(@Nullable GradientColorObject value) { object.setFill(value); return this; } /** * (Highstock) The height of the shape. * */ public Builder height(double value) { object.setHeight(value); return this; } /** * (Highstock) The radius of the shape. * */ public Builder r(double value) { object.setR(value); return this; } /** * (Highstock) Defines additional snapping area around an annotation making * this annotation to focus. Defined in pixels. * */ public Builder snap(double value) { object.setSnap(value); return this; } /** * (Highstock) The URL for an image to use as the annotation shape. Note, * type has to be set to <code>'image'</code>. * */ public Builder src(@Nullable String value) { object.setSrc(value); return this; } /** * (Highstock) The color of the shape's stroke. * */ public Builder stroke(@Nullable String value) { object.setStroke(value); return this; } /** * (Highstock) The pixel stroke width of the shape. * */ public Builder strokeWidth(double value) { object.setStrokeWidth(value); return this; } /** * (Highstock) The type of the shape, e.g. circle or rectangle. * */ public Builder type(@Nullable String value) { object.setType(value); return this; } /** * (Highstock) The width of the shape. * */ public Builder width(double value) { object.setWidth(value); return this; } } }
92b309cbff408cfc2cf463fa134473ec16e5d3e9
c6e6496e2fa9f3c971e868eee86561d51dc87c0b
/sts-provider/src/main/java/org/jboss/sts/provider/RoleClaimHandler.java
bd58dbe07cffb118f7f9b18962722b281ea15298
[]
no_license
jurakp/reproducers
5718ebf9cd179f61bfa029fa5893402191a3214b
f9df32ed36780d142ed6b5a168403d9528eaf4fd
refs/heads/master
2021-01-21T09:59:30.385219
2019-04-03T12:36:39
2019-04-03T12:36:39
91,675,266
0
0
null
null
null
null
UTF-8
Java
false
false
3,321
java
/* * JBoss, Home of Professional Open Source. * Copyright 2017, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.sts.provider; import java.net.URI; import java.net.URISyntaxException; import java.security.Principal; import java.util.Arrays; import java.util.List; import java.util.logging.Level; import javax.xml.ws.WebServiceContext; import org.apache.cxf.sts.claims.Claim; import org.apache.cxf.sts.claims.ClaimCollection; import org.apache.cxf.sts.claims.ClaimsHandler; import org.apache.cxf.sts.claims.ClaimsParameters; import org.apache.cxf.sts.claims.RequestClaim; import org.apache.cxf.sts.claims.RequestClaimCollection; import org.apache.ws.security.saml.ext.bean.AttributeBean; /** * @author pjurak * */ public class RoleClaimHandler implements ClaimsHandler { /* * (non-Javadoc) * * @see org.apache.cxf.sts.claims.ClaimsHandler#getSupportedClaimTypes() */ @Override public List<URI> getSupportedClaimTypes() { try { return Arrays.asList(new URI[] { new URI("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role") }); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } /* * (non-Javadoc) * * @see org.apache.cxf.sts.claims.ClaimsHandler#retrieveClaimValues(org.apache.cxf.sts.claims.RequestClaimCollection, * org.apache.cxf.sts.claims.ClaimsParameters) */ @Override public ClaimCollection retrieveClaimValues(RequestClaimCollection claims, ClaimsParameters parameters) { ClaimCollection claimsColl = new ClaimCollection(); for (RequestClaim claim : claims) { if ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role".equals(claim.getClaimType().toString())) { Claim c = new Claim(); c.setClaimType(claim.getClaimType()); c.setPrincipal(parameters.getPrincipal()); // add roles (hardcoded) if ("alice".equalsIgnoreCase(parameters.getPrincipal().getName())) { c.addValue("friend"); } else { c.addValue(""); } claimsColl.add(c); } else { System.out.println("Unsupported claim " + claim.getClaimType() + " " + claim.getClaimValue()); } } return claimsColl; } }
535f42437aaec9a30577dd0bc7956d9de723a92c
e83d23138c3902a6a3109aa1d5a004213301eafc
/wkx007/src/main/java/com/orcl/frame/dao/AccountDao.java
9984336f1539f43e2ca551885354160d326ec747
[]
no_license
WKVeis/wkx007Test
1d28b7c3a3463db8fa09bfd31cfa73fac202e1e6
35df46816f9a21f684543332e561ad43f03c505c
refs/heads/master
2022-06-24T05:48:29.257698
2020-03-13T06:09:36
2020-03-13T06:09:36
200,402,278
0
0
null
2022-06-21T01:43:20
2019-08-03T17:20:54
JavaScript
UTF-8
Java
false
false
633
java
package com.orcl.frame.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.orcl.frame.model.Account; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; /** * @author by weikaixiang * @date 2019/8/1 0001 * @DESC: */ public interface AccountDao extends BaseMapper<Account> { @Select("select *from ACCOUNT where USERNAME=#{userName} AND SEX=#{sex}") // @Select("SELECT" // +"*FROM ACCOUNT" // +"WHERE USERNAME=#{userName}" // +" AND SEX=#{sex}") Account finBytwo(@Param("userName") String userName, @Param("sex") String sex); }
3614a22a2885fc384ca4452c80bf50bd0b8f2f0a
ea82c0ea88234f282a148d73d1743fa81cf38232
/src.application/desmoj/extensions/applicationDomains/production/PartsList.java
28a52c7dea4b2047180cf9d9d9273b955698bf54
[]
no_license
PriyWerry/desmoj
64008d40ff9ea2722ceed6bd153f4747c4b304e8
683489d9a885c12f8ef4c22db7bdf3c3048fe102
refs/heads/master
2021-06-13T14:12:34.750043
2016-10-04T13:51:33
2016-10-04T13:51:33
72,842,185
0
2
null
null
null
null
UTF-8
Java
false
false
11,922
java
package desmoj.extensions.applicationDomains.production; import desmoj.core.simulator.Model; import desmoj.core.simulator.ModelComponent; /** * A PartsList is a listing of all the different kinds of parts and the number * (quantity) of them needed to produce a new part (or product). It is used in * conjunction with a <code>WorkStation</code> in order to tell the work * station how many and of which kind of parts should be assembled there. The * user can instantiate a PartsList either by providing to arrays of the same * length, one with all the different kinds of parts and one with the respective * number of each different part, or by instantiating a PartsList with the * number of different kinds of parts and then adding pairs of [kindOfPart, * number of this kind of parts] using the <code>addPart</code> method. * * @version DESMO-J, Ver. 2.5.1d copyright (c) 2015 * @author Soenke Claassen * * 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. * */ public class PartsList extends ModelComponent { /** * The number of different kinds of parts, needed for the assembly. */ private int numberOfDiffParts; /** * An array of the different kinds of the parts, needed for the assembly. */ private java.lang.Class[] kindOfParts; /** * An array of the number of each different kind of part, needed for the * assembly. */ private int[] numberOfParts; /** * Constructs a PartsList with the given arrays of different kinds of parts * and the quantities of that kind of part. Both arrays must be of the same * size, of course. The PartsList leaves no messages in the trace. * * @param ownerModel * desmoj.Model : The model this PartsList is associated to. * @param name * java.lang.String : The name of this PartsList. * @param kindsOfParts * java.lang.Class[] : The array containing the different kinds * of parts. * @param numOfParts * int[] : The array constaining the number of each kind of part. */ public PartsList(Model ownerModel, String name, Class[] kindsOfParts, int[] numOfParts) { super(ownerModel, name, false); // make a ModelComponent with no trace // output // check if the given arrays have the same length if (kindsOfParts.length != numOfParts.length) { sendWarning( "The given number of different kinds of parts is not the " + "same like the number of quantities of each kind. No PartsList will " + "be created!", getClass().getName() + ": " + getQuotedName() + ", Constructor: " + "PartsList(Model ownerModel, String name, Class[] kindsOfParts, " + "int[] numOfParts)", "Both arrays (kindsOfParts, numOfParts) must have the same length.", "Make sure to provide two arrays with the same length to construct a " + "valid PartsList."); return; // ignore that rubbish and just return } else { this.numberOfDiffParts = kindsOfParts.length; } // save both arrays this.kindOfParts = kindsOfParts; this.numberOfParts = numOfParts; } /** * Constructs a PartsList with enough space to store a number of different * kinds of parts with the respective quantity needed of each kind. Use the * method <code>addPart</code> to add a pair of [kind of part, quantity of * that kind of part]. The PartsList leaves no messages in the trace. * * @param ownerModel * desmoj.Model : The model this PartsList is associated to. * @param name * java.lang.String : The name of this PartsList. * @param numberOfDifferentParts * int : The number of different kinds of parts. Should not be * zero or negative! */ public PartsList(Model ownerModel, String name, int numberOfDifferentParts) { super(ownerModel, name, false); // make a ModelComponent with no trace // output // check the number of different kinds of parts if (numberOfDifferentParts < 1) { sendWarning( "The given number of different kinds of parts is zero or " + "negative. No PartsList will be created!", getClass().getName() + ": " + getQuotedName() + ", Constructor: " + "PartsList(Model ownerModel, String name, int numberOfDifferentParts)", "A PartsList with no parts does not make sense.", "Make sure to provide a positive valid number of parts to create a " + "PartsList."); return; // ignore that rubbish and just return } else { this.numberOfDiffParts = numberOfDifferentParts; } // create the arrays of the given size kindOfParts = new Class[numberOfDiffParts]; numberOfParts = new int[numberOfDiffParts]; } /** * Adds a pair of [kind of part, quantity of that kind of part] to the * PartsList. There can not be added more pairs than the PartsList can hold. * To check how many pairs a PartList can hold use the method * <code>getNumberOfDiffParts()<code>. * @param kindOfPart java.lang.Class : The kind of part as a Class object. * @param numberOfParts int : The number of that kind of part. */ public void addPart(Class kindOfPart, int numberOfParts) { // check the number of parts if (numberOfParts < 1) { sendWarning( "The number of parts is zero or negative. The attempted " + "insertion of a new pair into the PartsList will be ignored!", getClass().getName() + ": " + getQuotedName() + ", Method: " + "void addPart(Class kindOfPart, int numberOfParts)", "A negative or zero quantity of parts does not make sense.", "Make sure to provide a positive valid quantity of parts when adding " + "it to the PartsList."); return; // do nothing, just return } // flag, if the insertion of the pair was successful boolean successful = false; // loop through the arrays for (int i = 0; i < numberOfDiffParts; i++) { // check for a free space if (kindOfParts[i] == null) { this.kindOfParts[i] = kindOfPart; this.numberOfParts[i] = numberOfParts; successful = true; // sucessfully added to the arrays break; // leave the loop } } // if no place was found if (!successful) { sendWarning( "The PartsList is full already. No more elements can be added " + "to the list. The attempted insertion of a new pair will be ignored!", getClass().getName() + ": " + getQuotedName() + ", Method: " + "void addPart(Class kindOfPart, int numberOfParts)", "The size of this PartsList is not big enough to hold another pair.", "Make sure that the PartList is not full already before trying to add " + "another pair."); // do nothing } } /** * Returns the index of the given kind of part ( * <code>java.lang.Class</code>). The index is indicating the position in * the array of kindOfParts. If the given kind of part is not found in this * PartsList, undefinded (-1) will be returned. * * @return int : The index of the given kind of part ( * <code>java.lang.Class</code>). That is the position in the * array of kindOfParts. Or undefined (-1) if no such kind of part * can be found in this PartsList. * @param kind * java.lang.Class : The kind of part given as an object of * <code>java.lang.Class</code>. */ public int getIndexOfKind(Class kind) { // check kind if (kind == null) { sendWarning("The given kind of the part is only a null pointer. " + "No index can be returned for that kind of part!", getClass().getName() + ": " + getQuotedName() + ", Method: " + "int getIndexOfKind(Class kind)", "The given parameter is only a null pointer.", "Make sure to provide a valid Class variable for the kind of part you " + "are looking for."); return -1; // ignore that rubbish and just return (-1) undefined } // search the whole array for (int i = 0; i < numberOfDiffParts; i++) { if (kind == kindOfParts[i]) { return i; } } // nothing found -> return undefined return -1; } /** * Returns the kind of the part at index i as a Class object. * * @return java.lang.Class : The Class object identifying the kind of the * part. If there is no entry at this index position in the * PartsList <code>null</code> will be returned. * @param index * int : The index in the PartsList for which the kind of the * part will be returned. The index runs from zero to * (numberOfDiffParts - 1). */ public Class getKindOfPart(int index) { // check the index if (index >= numberOfDiffParts || index < 0) { sendWarning( "The given index is negative or greater than the number of " + "different parts in the PartsList. No kind of part can be returned for " + "that index!", getClass().getName() + ": " + getQuotedName() + ", Method: " + "Class getkindOfPart(int index)", "The given index is out of bounds.", "Make sure to provide a positive valid index when trying to retrieve " + "the kind of part for that index."); } return kindOfParts[index]; } /** * Returns the whole array of all kinds of parts listed in this PartsList. * * @return java.lang.Class[] : the whole array of all kinds of parts listed * in this PartsList. */ public java.lang.Class[] getKindOfParts() { return kindOfParts.clone(); } /** * Returns the number of different parts (that is the number of entries) in * this PartsList. * * @return int : The number of different parts (that is the number of * entries) in this PartsList. */ public int getNumberOfDiffParts() { return numberOfDiffParts; } /** * Returns the whole array of all the different quantities of all different * kinds of parts listed in this PartsList. * * @return int[] : The whole array of all the different quantities of all * different kinds of parts listed in this PartsList. */ public int[] getNumberOfParts() { return numberOfParts.clone(); } /** * Returns the quantity of the part at the index i of this PartsList. * * @return int : The quantity of the kind of part at index i of this * PartsList. * @param index * int : The index in the PartsList for which the quantity of the * part will be returned. The index runs from zero to * (numberOfDiffParts - 1). */ public int getQuantityOfPart(int index) { // check the index if (index >= numberOfDiffParts || index < 0) { sendWarning( "The given index is negative or greater than the number of " + "different parts in the PartsList. No kind of part can be returned for " + "that index!", getClass().getName() + ": " + getQuotedName() + ", Method: " + "int getQuantityOfPart(int index)", "The given index is out of bounds.", "Make sure to provide a positive valid index when trying to retrieve " + "the quantity of part for that index."); } return numberOfParts[index]; } }
[ "goebel_j@86b4f37d-0b98-42f3-ae9f-20825ac9f6ca" ]
goebel_j@86b4f37d-0b98-42f3-ae9f-20825ac9f6ca
d166b0f074f2b603b27fae5d18f4c34fd4471483
aec9894d4530593a464b8a4daf146d3f2b86f428
/src/main/java/com/wjzc/framework/config/GenConfig.java
410cd7b916448d02a1670df629f5404e1cdbda8c
[]
no_license
wqqing77/wjzc
f6a048126c93c499c070869419a87dc7343e9756
3b781d8d55c8f54088d7e876cb7d6729664adbf6
refs/heads/master
2023-03-04T01:07:35.802240
2021-02-13T02:56:29
2021-02-13T02:56:29
338,482,950
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package com.wjzc.framework.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * 读取代码生成相关配置 * * @author wjzc */ @Component @ConfigurationProperties(prefix = "gen") public class GenConfig { /** * 作者 */ public static String author; /** * 生成包路径 */ public static String packageName; /** * 自动去除表前缀,默认是true */ public static boolean autoRemovePre; /** * 表前缀(类名不会包含表前缀) */ public static String tablePrefix; public static String getAuthor() { return author; } public void setAuthor(String author) { GenConfig.author = author; } public static String getPackageName() { return packageName; } public void setPackageName(String packageName) { GenConfig.packageName = packageName; } public static boolean getAutoRemovePre() { return autoRemovePre; } public void setAutoRemovePre(boolean autoRemovePre) { GenConfig.autoRemovePre = autoRemovePre; } public static String getTablePrefix() { return tablePrefix; } public void setTablePrefix(String tablePrefix) { GenConfig.tablePrefix = tablePrefix; } }
8a5c3f34f309f1f0c9a06a6ed1f42ae52cb679df
9dc27aee0ec996d59978fce00974e103d3e6c698
/src/main/java/com/gymadmin/services/impl/PaymentServiceImpl.java
6c9105c2c353045081b8629bec66cc0af9fd8c4b
[]
no_license
MRodriguez08/gymadmin
c577ab268d82906e271fb03568b20e0b8823f729
b60459e6c926eba4f5520b69134db4bb219fda37
refs/heads/master
2016-08-12T17:50:06.385173
2015-05-05T02:32:12
2015-05-05T02:32:12
49,207,293
0
0
null
null
null
null
UTF-8
Java
false
false
5,180
java
package com.gymadmin.services.impl; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import com.gymadmin.config.Constants; import com.gymadmin.persistence.dao.CustomerDao; import com.gymadmin.persistence.dao.PaymentDao; import com.gymadmin.persistence.dao.PaymentStateDao; import com.gymadmin.persistence.dao.SysParamDao; import com.gymadmin.persistence.entities.CustomerEntity; import com.gymadmin.persistence.entities.PaymentEntity; import com.gymadmin.persistence.entities.PaymentStateEntity; import com.gymadmin.repository.BusinessException; import com.gymadmin.repository.DateTimeUtil; import com.gymadmin.services.PaymentService; /** * * @author mrodriguez */ @Component("paymentService") public class PaymentServiceImpl implements PaymentService { private static Logger logger = Logger.getLogger(PaymentServiceImpl.class); @Autowired private PaymentDao paymentDao; @Autowired private SysParamDao sysParamDao; @Autowired private PaymentStateDao paymentStateDao; @Autowired private CustomerDao customerDao; public List<PaymentEntity> findAll() { List<PaymentEntity> users = paymentDao.findAll(); return users; } public List<PaymentEntity> findByFilters(Map<String, Object> filters) { return paymentDao.findByFilters(filters); } public PaymentEntity create(PaymentEntity d) throws Exception { return d; } public PaymentEntity edit(PaymentEntity d) throws Exception { paymentDao.merge(d); return d; } public PaymentEntity pay(PaymentEntity d) throws Exception { PaymentStateEntity paidState = paymentStateDao.findById(Constants.PAYMENT_STATE_PAID); PaymentEntity p = paymentDao.findById(d.getId()); p.setState(paidState); paymentDao.merge(p); return p; } public PaymentEntity get(Integer id) throws Exception { PaymentEntity entity = paymentDao.findById(id); return entity; } public void delete(Integer id) throws Exception { try { PaymentEntity entity = paymentDao.findById(id); entity.setState(paymentStateDao.findById(Constants.PAYMENT_STATE_CANCELLED)); paymentDao.merge(entity); } catch (Exception e) { logger.error(getClass().getCanonicalName() , e); throw new BusinessException("Error al eliminar plan"); } } @Transactional(readOnly = false) @Scheduled(fixedDelay = 10000, initialDelay = 5000) public void generatePayments(){ try { logger.info("Generating payments..."); Integer dueDateMonthDay = Integer.valueOf(sysParamDao.findById(Constants.SYSPARAM_DUE_DATE_MONTH_DAY).getValue()); List<CustomerEntity> customers = customerDao.findAllByState(true); for (CustomerEntity e : customers){ //Si no hay cuotas pendientes o por vencer tengo que generar una nueva factura List<PaymentEntity> activePayments = paymentDao.findActiveByCustomer(e.getId()); if (activePayments.size() == 0){ PaymentEntity newPayment = new PaymentEntity(); newPayment.setPaymentGenerationDate(new Date()); newPayment.setCustomer(e); newPayment.setPlan(e.getPlan()); newPayment.setValidCost(e.getPlan().getCost()); newPayment.setPaymentDueDate(DateTimeUtil.getNextDueDate(e.getPaymentPlan().getMonthsCount(), dueDateMonthDay)); newPayment.setState(paymentStateDao.findById(Constants.PAYMENT_STATE_PENDING)); paymentDao.persist(newPayment); } } } catch (Exception e) { logger.error(getClass().getCanonicalName() , e); } } @Transactional(readOnly = false) @Scheduled(fixedDelay = 10000, initialDelay = 0) public void updatePaymentsState() { try { logger.info("Updating payments state..."); Integer aboutToOverDays = Integer.valueOf(sysParamDao.findById(Constants.SYSPARAM_ABOUT_TO_OVERDUE_DAYS).getValue()); PaymentStateEntity aboutToOverdue = paymentStateDao.findById(Constants.PAYMENT_STATE_ABOUT_TO_OVERDUE); PaymentStateEntity overdue = paymentStateDao.findById(Constants.PAYMENT_STATE_OVERDUE); Float recharge = 1 + Float.valueOf(sysParamDao.findById(Constants.SYSPARAM_OVERDUE_RECHARGE).getValue()) / 100; Date now = new Date(); List<PaymentEntity> payments = paymentDao.findActive(); for (PaymentEntity e : payments){ Boolean changed = false; Integer remainingDays = DateTimeUtil.getRemainingDays(now, e.getPaymentDueDate()); if (remainingDays <= 0){ //aboutToOverdue -> overdue transition e.setState(overdue); //apply the recharge e.setValidCost(e.getValidCost() * recharge); changed = true; } else if (remainingDays <= aboutToOverDays){ //pending -> aboutToOverdue transition e.setState(aboutToOverdue); changed = true; } if ( changed ){ paymentDao.merge(e); } } } catch (Exception e) { logger.error(getClass().getCanonicalName() , e); } } }
8630f6579311b98b701350c6ebf7ce60f7ebfe8a
ae464c2aa556d002e2b69e4936f10dd392ff1c9a
/src/EngineFrame.java
f4f05c79e7d13c174d29ffdd41cdcc8886d6d7c7
[]
no_license
ducttapecrown/raycaster
8fcdecac03ea88a61e2c08e2b41a40f9b9d126d2
ae9207767441e912aa8594381fc9a41508313384
refs/heads/master
2020-06-24T20:34:59.132384
2016-11-24T07:14:29
2016-11-24T07:14:29
74,622,777
3
0
null
null
null
null
UTF-8
Java
false
false
4,544
java
/** * Frame to display the engine. * * @author Tim Stoddard, Sam Lindbloom-Airey * @version program007 */ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import java.awt.Image; import java.text.DecimalFormat; import java.util.Arrays; /** * Frame to display the engine. * * @author Tim Stoddard, Sam Lindbloom-Airey * @version program007 */ public class EngineFrame extends JFrame { // double buffering private Image dbImage; private Graphics dbg; // stuff public Map map; public Player player; public Keyboard keyboard; public Mouse mouse; private int currLevel; private long startTime; private double[] distances; /** * Creates a new EngineFrame to display and render the game. */ public EngineFrame() { super("CPE Quest"); add(new JPanel() { public void paint(Graphics window) { /* don't edit this */ dbImage = createImage(getWidth(), getHeight()); dbg = dbImage.getGraphics(); paintComponent(dbg); window.drawImage(dbImage, 0, 0, this); /* end don't edit this */ } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; if (distances != null) { draw3D(g2); } drawMiniMap(g2, 520, 0); } }); init(); setSize(865, 480); setVisible(true); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void draw3D(Graphics2D g2) { int height = 480; for (int x = 0; x < distances.length; x++) { int lineHeight = (int) (height / distances[x]); int drawStart = - lineHeight / 2 + height / 2; drawStart = drawStart < 0 ? 0 : drawStart; int drawEnd = lineHeight / 2 + height / 2; drawEnd = drawEnd >= height ? height - 1 : drawEnd; g2.drawLine(x, drawStart, x, drawEnd); } } private void drawMiniMap(Graphics2D g2, int dx, int dy) { // draw stats double scale = 1; dy += scale * map.getHeight(); g2.setColor(Color.black); DecimalFormat dec = new DecimalFormat("##.00"); g2.setFont(new Font("Helvetica", Font.PLAIN, 30)); g2.drawString("Position: " + dec.format(player.position[0]) + ", " + dec.format(player.position[1]), 10 + dx, 50 + dy); g2.drawString("Direction: " + dec.format(player.direction[0]) + ", " + dec.format(player.direction[1]), 10 + dx, 150 + dy); g2.drawString( "Time: " + new DecimalFormat("##.00") .format((System.currentTimeMillis() - startTime) / 1000.0), 145 + dx, 250 + dy); } /** * Starts the game at level1. */ public void init() { currLevel = 1; updateMap(currLevel); startTime = System.currentTimeMillis(); } /** * Setter method for the field of vision, set by Engine. * * @param fieldOfVision a double array of rectangle heights that * has length equal to number of rays cast by the engine. */ public void sendDistances(double[] distances) { this.distances = Arrays.copyOf(distances, distances.length); } private String stripNonAlpha(String text) { char[] chars = text.toCharArray(); for (int i = 0; i < chars.length; i++) { if (!Character.isAlphabetic(chars[i]) && !Character.isDigit(chars[i]) && chars[i] != 32) { chars[i] = '.'; } } String temp = new String(chars).replace(".", ""); return temp.length() > 20 ? temp.substring(0, 20) : temp; } /** * Returns the current map. * * @return The current map */ public Map getMap() { return map; } /** * Returns the player. * * @return the player */ public Player getPlayer() { return player; } private void updateMap(int level) { map = new Map(level); player = new Player(map); keyboard = new Keyboard(player); mouse = new Mouse(player); addKeyListener(keyboard); addMouseMotionListener(mouse); } }
035c753e3dd075878393c277e2ac18a7d563d09a
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project27/src/main/java/org/gradle/test/performance/mediumjavamultiproject/project27/p135/Production2700.java
4755e1fd96dd5afd1e2efe5fff200bd7704670a2
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
1,896
java
package org.gradle.test.performance.mediumjavamultiproject.project27.p135; public class Production2700 { private String property0; public String getProperty0() { return property0; } public void setProperty0(String value) { property0 = value; } private String property1; public String getProperty1() { return property1; } public void setProperty1(String value) { property1 = value; } private String property2; public String getProperty2() { return property2; } public void setProperty2(String value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
1f5dd187d87a5be9698f6386b0ffefb532b022f8
5af4e82cfd03ab53fbbd74220f923c051caacaed
/classloader-pitfalls/src/test/java/com/link_intersystems/publications/blog/classloader_pitfalls/ClassCastExceptionTest.java
41b87a06465a6df831abef137e4304d60f05b457
[ "Apache-2.0" ]
permissive
szymonleyk/blog
3399cc17b8011aea78beed52256fc8714855710e
24917cbba66a0b0e7def0c622020ab5ab1b94d28
refs/heads/master
2021-05-28T16:18:26.387061
2015-05-01T15:47:23
2015-05-01T15:51:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,813
java
package com.link_intersystems.publications.blog.classloader_pitfalls; import java.net.URL; import java.net.URLClassLoader; import org.junit.Assert; import org.junit.Test; public class ClassCastExceptionTest { /** * This test shows that a class loaded by one class loader is not equal to * the same class loaded by another class loader. * * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException */ @Test(expected = ClassCastException.class) @SuppressWarnings("unused") public void classCastExceptionWithDifferentClassLoaders() throws ClassNotFoundException, InstantiationException, IllegalAccessException { // Calculator is just a test class that I created URL[] urls = getClassLoaderClasspath(Calculator.class); URLClassLoader classLoader1 = new URLClassLoader(urls, null); URLClassLoader classLoader2 = new URLClassLoader(urls, null); String canonicalName = Calculator.class.getCanonicalName(); Class<?> calcClass1 = classLoader1.loadClass(canonicalName); Class<?> calcClass2 = classLoader2.loadClass(canonicalName); // The classes are not equal, because they are loaded by different class // loaders. Assert.assertFalse(calcClass1.equals(calcClass2)); Object calcInstance1 = calcClass1.newInstance(); Object calcInstance2 = calcClass2.newInstance(); // As the test defines we expect a ClassCastException, because an // instance of calcClass2 can not be casted to calcClass1 calcClass1.cast(calcInstance2); } private URL[] getClassLoaderClasspath(Class<?> clazz) { ClassLoader classLoader = clazz.getClassLoader(); Assert.assertTrue(classLoader instanceof URLClassLoader); URLClassLoader urlClassLoader = (URLClassLoader) classLoader; URL[] urls = urlClassLoader.getURLs(); return urls; } }
10280738626a98002c7f4502d8e1bbec56bb47ba
109064e4b2d480e28f35148e715e687e1185e473
/dictionary-core/src/main/java/org/tveki/dictionary/api/TranslateRequest.java
e6c129114a5ac7ebd01f002dc747c17ae0e5a9cb
[]
no_license
tveki/dictionary-api
6ad44075e340d8949670762388112dfdc47f1efe
ffd278c8095961104c08be6e1fc908ee652d07d2
refs/heads/master
2021-01-22T06:58:54.688880
2019-02-24T07:56:22
2019-02-24T07:56:22
31,650,504
1
0
null
null
null
null
UTF-8
Java
false
false
307
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 org.tveki.dictionary.api; /** * * @author tveki */ public class TranslateRequest extends TranslationTask { }
63ebc0f56e0e45e80b32ef6c153613bab9125339
0d084d2e7fd0bec8a201f53ce0625e1b3ed48980
/TicTacToe/src/tictactoe/Statistics.java
a7ef0dd2627a1d7bfa498d39916976fb2aff1a68
[]
no_license
wdeng7714/Grade-12-Projects
1a9b6d67c6a71ef0105495a4437984691640070d
38e80a70e3fcc1efe50db68cc37ff2a29fba0863
refs/heads/master
2021-01-09T20:18:45.154436
2016-07-30T19:02:57
2016-07-30T19:02:57
64,558,641
0
0
null
null
null
null
UTF-8
Java
false
false
6,487
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 tictactoe; /** * * @author Wendy */ public class Statistics extends javax.swing.JFrame { Game game = new Game(); /** * Creates new form Statistics */ public Statistics() { initComponents(); refreshScores(); } private void refreshScores(){ txtEasy.setText("Times Won: " + game.intEasyWins + "\n" + "Times Lost: " + game.intEasyLosses+ "\n" + "Times Tied: " + game.intEasyTies); txtMedium.setText("Times Won: " + game.intMedWins + "\n" + "Times Lost: " + game.intMedLosses + "\n" + "Times Tied: " + game.intMedTies); txtHard.setText("Times Won: " + game.intHardWins+ "\n" + "Times Lost: " + game.intHardLosses+ "\n" + "Times Tied: " + game.intHardTies); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); txtMedium = new javax.swing.JTextArea(); txtEasy = new javax.swing.JTextArea(); txtHard = new javax.swing.JTextArea(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(204, 255, 204)); setMinimumSize(new java.awt.Dimension(455, 250)); setResizable(false); getContentPane().setLayout(null); jLabel1.setFont(new java.awt.Font("Hobo Std", 0, 18)); // NOI18N jLabel1.setText("STATISTICS"); getContentPane().add(jLabel1); jLabel1.setBounds(170, 20, 120, 20); jLabel3.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N jLabel3.setText("MEDIUM"); getContentPane().add(jLabel3); jLabel3.setBounds(200, 50, 49, 13); jLabel2.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N jLabel2.setText("EASY"); getContentPane().add(jLabel2); jLabel2.setBounds(54, 52, 30, 13); jLabel4.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N jLabel4.setText("HARD"); getContentPane().add(jLabel4); jLabel4.setBounds(350, 50, 33, 13); txtMedium.setEditable(false); txtMedium.setBackground(new java.awt.Color(204, 255, 204)); txtMedium.setColumns(20); txtMedium.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N txtMedium.setLineWrap(true); txtMedium.setRows(5); getContentPane().add(txtMedium); txtMedium.setBounds(155, 70, 140, 100); txtEasy.setEditable(false); txtEasy.setBackground(new java.awt.Color(204, 255, 204)); txtEasy.setColumns(20); txtEasy.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N txtEasy.setLineWrap(true); txtEasy.setRows(5); getContentPane().add(txtEasy); txtEasy.setBounds(10, 70, 140, 100); txtHard.setEditable(false); txtHard.setBackground(new java.awt.Color(204, 255, 204)); txtHard.setColumns(20); txtHard.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N txtHard.setLineWrap(true); txtHard.setRows(5); getContentPane().add(txtHard); txtHard.setBounds(300, 70, 140, 100); jButton1.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N jButton1.setText("Return to Game"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1); jButton1.setBounds(320, 180, 120, 30); jButton2.setFont(new java.awt.Font("Hobo Std", 0, 12)); // NOI18N jButton2.setText("Reset"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); getContentPane().add(jButton2); jButton2.setBounds(10, 180, 120, 30); jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tictactoe/background.jpg"))); // NOI18N jLabel5.setText("jLabel5"); jLabel5.setMinimumSize(new java.awt.Dimension(460, 240)); jLabel5.setOpaque(true); jLabel5.setRequestFocusEnabled(false); getContentPane().add(jLabel5); jLabel5.setBounds(0, 0, 450, 220); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed game.setVisible(true); this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed game.intEasyWins=0; game.intEasyLosses=0; game.intEasyTies=0; game.intMedWins=0; game.intMedLosses=0; game.intMedTies=0; game.intHardWins=0; game.intHardLosses=0; game.intHardTies=0; game.updateFiles(); refreshScores(); }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JTextArea txtEasy; private javax.swing.JTextArea txtHard; private javax.swing.JTextArea txtMedium; // End of variables declaration//GEN-END:variables }
e8b2e60e02c8d309eacb6c69b6c0735025ab5ad3
02f4c29726cec69f5923bb70e2eb2c91a9635fb5
/src/main/java/com/iceq/springdata/controller/MemService.java
c5c82edd3eeb5ce5764f7609dd8bb755493268e9
[]
no_license
ikrix32/IceQAI
f40cd40899d24ce61320327adb283811ae433543
77283f6205daebffa41ad3cc4a4a68d2578fb226
refs/heads/master
2020-05-20T23:07:50.346486
2017-06-01T14:52:55
2017-06-01T14:52:55
84,542,376
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.iceq.springdata.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.iceq.natural.language.Sequence; import com.iceq.springdata.repository.NodeRepository; @Service public class MemService { @Autowired NodeRepository nodeRepository; @Transactional public void saveStatement(Sequence seq){ } }
f903837662cdbf55a54334f22ecbd6d5905d1083
f64893d16ab13919cf4bf6695dc6fa7256a382ae
/jvm-core/src/main/java/jvm/allocate/MinorGC.java
b435c45afe14a2b020cb3ced2cf2c471554d6973
[]
no_license
JadeLuo/JVM
816f77e67ac4f00fcb43ba1c5903fbd32fac3346
2b599b2a07c9135a6e310bff3fd46d2ceaec870d
refs/heads/master
2020-06-10T16:24:00.507089
2019-01-22T14:56:44
2019-01-22T14:56:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,379
java
package jvm.allocate; /** * MinorGC 新生代垃圾收集动作 * VM params : -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 * * @author LightMingMing */ public class MinorGC { private static final int _1M = 1024 * 1024; public static void main(String[] args) { byte[] alloc1, alloc2, alloc3, alloc4; alloc1 = new byte[2 * _1M]; alloc2 = new byte[2 * _1M]; alloc3 = new byte[2 * _1M]; alloc4 = new byte[4 * _1M]; // Minor GC } } /* JDK 8 [GC (Allocation Failure) [PSYoungGen: 8192K->624K(9216K)] 12288K->4728K(19456K), 0.0009462 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] Heap PSYoungGen total 9216K, used 872K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000) eden space 8192K, 3% used [0x00000007bf600000,0x00000007bf63e0d0,0x00000007bfe00000) from space 1024K, 60% used [0x00000007bfe00000,0x00000007bfe9c010,0x00000007bff00000) to space 1024K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007c0000000) ParOldGen total 10240K, used 4104K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000) object space 10240K, 40% used [0x00000007bec00000,0x00000007bf002010,0x00000007bf600000) Metaspace used 3277K, capacity 4496K, committed 4864K, reserved 1056768K class space used 360K, capacity 388K, committed 512K, reserved 1048576K */
3b4c6934886ed36abbaa883b6f6f6ea3204b7229
e048a05c4eb2a1686ec3c7efde287e56023d076a
/src/controller/src/launchingGame/SearchBar.java
4cb1016f7bafed2f5e3a53c913a437bb2ad2b43a
[ "MIT" ]
permissive
yk154/voogasalad_PrintStackTrace
66b80e8e1bd8dd9f147ceba68acbb4fc3c893055
47e82b3401270e81681f8fef11691a3878b26a82
refs/heads/master
2020-04-23T11:39:05.466768
2019-02-17T19:24:35
2019-02-17T19:24:35
171,143,365
0
0
null
null
null
null
UTF-8
Java
false
false
2,538
java
package launchingGame; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.layout.HBox; import social.EngineEvent; import social.EventBus; public class SearchBar { public static final String PROMPT_MESSAGE = "Game Name"; public static final String CROSS_PATH = "/graphics/black-cross.png"; public static final double BAR_WIDTH = 400; public static final double MIN_WIDTH = 200; public static final double ICON_WIDTH = 10; public static final double ICON_HEIGHT = 10; private HBox myBox; private TextField myTextField; private Button myCloseButton; private Searchable mySearchable; public SearchBar(Searchable searchable) { mySearchable = searchable; initField(); initButton(); initBox(); myBox.getChildren().add(myCloseButton); myBox.getChildren().add(myTextField); EventBus.getInstance().register(EngineEvent.SWITCH_SEARCHABLE, this::switchSearchable); } private void initBox() { myBox = new HBox(); myBox.setAlignment(Pos.CENTER_LEFT); } private void initField() { myTextField = new TextField(); myTextField.setPromptText(PROMPT_MESSAGE); myTextField.getStyleClass().add("search-bar"); myTextField.setPrefWidth(BAR_WIDTH); myTextField.setMinWidth(MIN_WIDTH); myTextField.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.ENTER) { String txt = myTextField.getCharacters().toString(); mySearchable.showByTag(txt); myTextField.clear(); } }); } private void initButton() { Image image = new Image(getClass().getResourceAsStream(CROSS_PATH)); ImageView imageView = new ImageView(image); imageView.setFitWidth(ICON_WIDTH); imageView.setFitHeight(ICON_HEIGHT); myCloseButton = new Button(); myCloseButton.setGraphic(imageView); myCloseButton.getStyleClass().add("closebutton"); myCloseButton.setOnAction(event -> { myTextField.clear(); mySearchable.showAll(); }); } public void switchSearchable(Object ...args){ Searchable searchable = (Searchable) args[0]; mySearchable = searchable; } public HBox getView() { return myBox; } }
6cf02d0a1833c3abb313cade002ede51addb80db
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_3/src/g/d/j/Calc_1_3_6398.java
9579268e84a49812436de1386f004f233c6fcc7a
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
package g.d.j; public class Calc_1_3_6398 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
a7179256396e479782dba8c6a7e4921d17734090
02ebac56a263f5b31e008c2e6856e412fca8eae0
/app/build/generated/source/r/debug/android/support/mediacompat/R.java
db972198e40aabab5b7cba279a817030ce6e6d33
[]
no_license
akhilsurnedi5479/Birthday_Card
d6bbe26886f10ac1ad888247647e36e0b3695444
202ca61242c57081922bec636cead95d9c6a279f
refs/heads/master
2020-03-06T18:43:40.335933
2018-03-27T16:12:24
2018-03-27T16:12:24
127,012,801
1
0
null
null
null
null
UTF-8
Java
false
false
9,442
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.mediacompat; public final class R { public static final class attr { public static final int font = 0x7f020070; public static final int fontProviderAuthority = 0x7f020072; public static final int fontProviderCerts = 0x7f020073; public static final int fontProviderFetchStrategy = 0x7f020074; public static final int fontProviderFetchTimeout = 0x7f020075; public static final int fontProviderPackage = 0x7f020076; public static final int fontProviderQuery = 0x7f020077; public static final int fontStyle = 0x7f020078; public static final int fontWeight = 0x7f020079; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f030000; } public static final class color { public static final int notification_action_color_filter = 0x7f04003e; public static final int notification_icon_bg_color = 0x7f04003f; public static final int notification_material_background_media_default_color = 0x7f040040; public static final int primary_text_default_material_dark = 0x7f040045; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_dark = 0x7f04004b; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f05004a; public static final int compat_button_inset_vertical_material = 0x7f05004b; public static final int compat_button_padding_horizontal_material = 0x7f05004c; public static final int compat_button_padding_vertical_material = 0x7f05004d; public static final int compat_control_corner_material = 0x7f05004e; public static final int notification_action_icon_size = 0x7f050058; public static final int notification_action_text_size = 0x7f050059; public static final int notification_big_circle_margin = 0x7f05005a; public static final int notification_content_margin_start = 0x7f05005b; public static final int notification_large_icon_height = 0x7f05005c; public static final int notification_large_icon_width = 0x7f05005d; public static final int notification_main_column_padding_top = 0x7f05005e; public static final int notification_media_narrow_margin = 0x7f05005f; public static final int notification_right_icon_size = 0x7f050060; public static final int notification_right_side_padding_top = 0x7f050061; public static final int notification_small_icon_background_padding = 0x7f050062; public static final int notification_small_icon_size_as_large = 0x7f050063; public static final int notification_subtext_size = 0x7f050064; public static final int notification_top_pad = 0x7f050065; public static final int notification_top_pad_large_text = 0x7f050066; } public static final class drawable { public static final int notification_action_background = 0x7f060057; public static final int notification_bg = 0x7f060058; public static final int notification_bg_low = 0x7f060059; public static final int notification_bg_low_normal = 0x7f06005a; public static final int notification_bg_low_pressed = 0x7f06005b; public static final int notification_bg_normal = 0x7f06005c; public static final int notification_bg_normal_pressed = 0x7f06005d; public static final int notification_icon_background = 0x7f06005e; public static final int notification_template_icon_bg = 0x7f06005f; public static final int notification_template_icon_low_bg = 0x7f060060; public static final int notification_tile_bg = 0x7f060061; public static final int notify_panel_notification_icon_bg = 0x7f060062; } public static final class id { public static final int action0 = 0x7f070006; public static final int action_container = 0x7f07000e; public static final int action_divider = 0x7f070010; public static final int action_image = 0x7f070011; public static final int action_text = 0x7f070017; public static final int actions = 0x7f070018; public static final int async = 0x7f07001e; public static final int blocking = 0x7f070021; public static final int cancel_action = 0x7f070024; public static final int chronometer = 0x7f070027; public static final int end_padder = 0x7f070031; public static final int forever = 0x7f070034; public static final int icon = 0x7f070037; public static final int icon_group = 0x7f070038; public static final int info = 0x7f07003b; public static final int italic = 0x7f07003c; public static final int line1 = 0x7f07003d; public static final int line3 = 0x7f07003e; public static final int media_actions = 0x7f070041; public static final int normal = 0x7f070047; public static final int notification_background = 0x7f070048; public static final int notification_main_column = 0x7f070049; public static final int notification_main_column_container = 0x7f07004a; public static final int right_icon = 0x7f070051; public static final int right_side = 0x7f070052; public static final int status_bar_latest_event_content = 0x7f07006d; public static final int text = 0x7f070071; public static final int text2 = 0x7f070072; public static final int time = 0x7f070075; public static final int title = 0x7f070076; } public static final class integer { public static final int cancel_button_image_alpha = 0x7f080002; public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int notification_action = 0x7f09001c; public static final int notification_action_tombstone = 0x7f09001d; public static final int notification_media_action = 0x7f09001e; public static final int notification_media_cancel_action = 0x7f09001f; public static final int notification_template_big_media = 0x7f090020; public static final int notification_template_big_media_custom = 0x7f090021; public static final int notification_template_big_media_narrow = 0x7f090022; public static final int notification_template_big_media_narrow_custom = 0x7f090023; public static final int notification_template_custom_big = 0x7f090024; public static final int notification_template_icon_group = 0x7f090025; public static final int notification_template_lines_media = 0x7f090026; public static final int notification_template_media = 0x7f090027; public static final int notification_template_media_custom = 0x7f090028; public static final int notification_template_part_chronometer = 0x7f090029; public static final int notification_template_part_time = 0x7f09002a; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0b0021; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0c00fa; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00fb; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0c00fc; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00fd; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0c00fe; public static final int TextAppearance_Compat_Notification_Media = 0x7f0c00ff; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c0100; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0c0101; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c0102; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0c0103; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c016b; public static final int Widget_Compat_NotificationActionText = 0x7f0c016c; } public static final class styleable { public static final int[] FontFamily = { 0x7f020072, 0x7f020073, 0x7f020074, 0x7f020075, 0x7f020076, 0x7f020077 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x7f020070, 0x7f020078, 0x7f020079 }; public static final int FontFamilyFont_font = 0; public static final int FontFamilyFont_fontStyle = 1; public static final int FontFamilyFont_fontWeight = 2; } }
6cd9eda6d0b22332cd4ae20a3c26cd6e057e0e92
1ac5ec3b840b0edc852ece29b31c546d46159abd
/kodilla-spring/src/main/java/com/kodilla/spring/portfolio/Board.java
2aa2bc0df6f641bb5098438e7ba7046ddc8439c3
[]
no_license
maciej-spychalski/maciej-spychalski-kodilla-java
7c9e4dfe8bab210c192c4cdeba1876b1e5475194
5be43258c4a392acc71167e12025987e5b1faeee
refs/heads/master
2023-01-03T18:33:58.166922
2020-10-30T16:46:08
2020-10-30T16:46:08
257,049,636
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package com.kodilla.spring.portfolio; public class Board { TaskList toDoList; TaskList inProgressList; TaskList doneList; public Board(TaskList toDoList, TaskList inProgressList, TaskList doneList) { this.toDoList = toDoList; this.inProgressList = inProgressList; this.doneList = doneList; } public TaskList getToDoList() { return toDoList; } public TaskList getInProgressList() { return inProgressList; } public TaskList getDoneList() { return doneList; } @Override public String toString() { return "Board{" + "toDoList=" + toDoList + ", inProgressList=" + inProgressList + ", doneList=" + doneList + '}'; } }
6836d8ef430627b4815b3d21796c8ba781a62ccc
40d95f0cc0ed7ad2052a3d4ab2bcf0fa2fad950f
/src/main/java/com/recruitment/common/MD5.java
adc5f4fc9a9de1d40aed362ddf8141b79e4b8e54
[]
no_license
mcholka/recruitment
f394f00b13b20c13498f52492984416fd06e1613
bf0517b17eb893be09bf7cabf876c840ad49ed1b
refs/heads/master
2016-09-06T09:53:45.968595
2014-07-02T19:13:41
2014-07-02T19:13:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.recruitment.common; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * Created by mcholka on 2014-05-22. Enjoy! */ public class MD5 { public String getMd5(String value){ try { MessageDigest md; md = MessageDigest.getInstance("MD5"); byte[] array = md.digest(value.getBytes()); StringBuilder sb = new StringBuilder(); for (byte anArray : array) { sb.append(Integer.toHexString((anArray & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }
b8b180ca0645a3a6e496b3f384701a54d1d9a0ca
3c2990adae62effb525da0406c22d75d7a6f387c
/src/com/cloudgarden/jigloo/actions/ToggleEditorsAction.java
b0ea3be41344c413a0ab1c2db83de9ca463af31b
[]
no_license
orb1t/jigloo
567840b2cd5311e3b4169c2f950fee13bac6751b
0f885e336665562a23f3de17e06608bff29d00c8
refs/heads/master
2021-07-14T13:47:01.787942
2017-10-20T20:50:25
2017-10-20T20:50:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package com.cloudgarden.jigloo.actions; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IEditorActionDelegate; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import com.cloudgarden.jigloo.editors.FormEditor; /** * Our sample action implements workbench action delegate. * The action proxy will be created by the workbench and * shown in the UI. When the user tries to use the action, * this delegate will be created and execution will be * delegated to it. * @see IWorkbenchWindowActionDelegate */ public class ToggleEditorsAction extends Action implements IEditorActionDelegate { private IEditorPart editor; /** * The constructor. */ public ToggleEditorsAction() { } /** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI. * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { if(editor instanceof FormEditor) { FormEditor fed = (FormEditor)editor; fed.toggleEditors(); } } /** * Selection in the workbench has been changed. We * can change the state of the 'real' action here * if we want, but this can only happen after * the delegate has been created. * @see IWorkbenchWindowActionDelegate#selectionChanged */ public void selectionChanged(IAction action, ISelection selection) { } /** * We can use this method to dispose of any system * resources we previously allocated. * @see IWorkbenchWindowActionDelegate#dispose */ public void dispose() { editor = null; } /* (non-Javadoc) * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) */ public void setActiveEditor(IAction action, IEditorPart targetEditor) { editor = targetEditor; } }
1592e0eb92a1284a3cb410ca0d4ee1821ac79ffa
195a49ea5bbfc2706fd4440bd061bbae17af714f
/src/main/java/exception/ParamException.java
62a0b977e00b282d3e87c11dfdf9dc320c7e3979
[]
no_license
xiaoxixi0314/use-java-thread
1d282353cf66b5f503d909178db8679db161e35f
c3f373d927e8056e81985873b787c6948d387a5c
refs/heads/master
2022-07-14T12:18:54.138748
2020-06-15T03:21:29
2020-06-15T03:21:29
225,623,694
0
0
null
2022-06-17T02:41:46
2019-12-03T13:14:11
Java
UTF-8
Java
false
false
152
java
package exception; public class ParamException extends RuntimeException { public ParamException(String message) { super(message); } }
ced4c95e9c0ce9640c0bc77718b0f1d8f4a338e9
3cf86285483513fb0a34f21650bd551fc0d56474
/src/main/java/br/com/campanate/orders/entity/Type.java
4194f89809575dfe7a2b23513c164f873e9fb457
[]
no_license
FernandoCamp/service-order
5504b97e75069b972e3be6005c24b4946056a0ee
c7f2c22bcfdb85f07f037e11fe17a5a6d33e4870
refs/heads/master
2021-06-24T20:25:30.772156
2019-10-19T23:57:34
2019-10-19T23:57:34
216,283,582
1
0
null
2021-04-26T19:35:59
2019-10-19T23:39:30
Java
UTF-8
Java
false
false
685
java
package br.com.campanate.orders.entity; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import lombok.Getter; import lombok.Setter; @Entity(name = "types") @Getter @Setter public class Type { @Id @Column(insertable = false, updatable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String description; private boolean active; @OneToMany(fetch = FetchType.LAZY, mappedBy = "type") private List<Order> order; }
[ "fernando@fernando-H81M-S1" ]
fernando@fernando-H81M-S1
c688d5ee34e2483b1391ac308a163e2717f3ad87
aab2c74d9a58a7dcd3b6c45d822c0207d71ce8a3
/07-Inner-And-Abstract-Classes-&-Interfaces/Abstraction/src/com/rahul/Dog.java
7e5b88e9529ebe445114f01bc1bef203eb3b3d13
[]
no_license
Rowlptk/java_tutorial
0bf098718bc1b166f0e83fd500dbaf94b4ecff69
40292275d77cac9e6891ae9fee5cb15ccc5a92a0
refs/heads/master
2022-12-05T05:53:58.045538
2020-08-13T12:09:41
2020-08-13T12:09:41
277,821,346
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.rahul; public class Dog extends Animal { public Dog(String name) { super(name); } @Override public void eat() { System.out.println(getName() + " is eating"); } @Override public void breathe() { System.out.println("Breathe in, breathe out, repeat"); } }
34f625a193366b40e841d5eb546642655892200f
095d00a66a4f646e8ce9d42753579a468f94fbd7
/src/main/java/com/rfa/employee/repository/EnterpriseOrgStructureRepository.java
c651b13462df6a64a34ee7a719393654d7170965
[]
no_license
jinggasella/employee
4e83193dd580dc576ac0959d4a9d60939d354d7f
0d1d5c69988a17128d15c086e0e665e76d86a208
refs/heads/master
2020-06-22T10:32:03.635769
2019-07-19T04:06:53
2019-07-19T04:06:53
197,699,606
0
0
null
null
null
null
UTF-8
Java
false
false
262
java
package com.rfa.employee.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.rfa.employee.model.EnterpriseOrgStructure; public interface EnterpriseOrgStructureRepository extends JpaRepository<EnterpriseOrgStructure, Long>{ }
c170f4352912203c41f309320e2c23e9ff942b09
e01dc5993b7ac310c346763d46e900f3b2d5db5e
/jasperserver-dto/src/test/java/com/jaspersoft/jasperserver/dto/logcapture/CollectorSettingsTest.java
3946abf995d6374768b048d1fb34993a4f6da103
[]
no_license
yohnniebabe/jasperreports-server-ce
ed56548a2ee18d37511c5243ffd8e0caff2be8f7
e65ce85a5dfca8d9002fcabc172242f418104453
refs/heads/master
2023-08-26T00:01:23.634829
2021-10-22T14:15:32
2021-10-22T14:15:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,228
java
/* * Copyright (C) 2005 - 2020 TIBCO Software Inc. All rights reserved. * http://www.jaspersoft.com. * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.jaspersoft.jasperserver.dto.logcapture; import com.jaspersoft.jasperserver.dto.basetests.BaseDTOPresentableTest; import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; /** * @author Andriy Tivodar <ativodar@tibco> */ public class CollectorSettingsTest extends BaseDTOPresentableTest<CollectorSettings> { @Override protected List<CollectorSettings> prepareInstancesWithAlternativeParameters() { return Arrays.asList( createFullyConfiguredInstance().setId("id2"), createFullyConfiguredInstance().setName("name2"), createFullyConfiguredInstance().setStatus("status2"), createFullyConfiguredInstance().setVerbosity("verbosity2"), createFullyConfiguredInstance().setLogFilterParameters(new LogFilterParameters().setUserId("userId2")), // with null values createFullyConfiguredInstance().setId(null), createFullyConfiguredInstance().setName(null), createFullyConfiguredInstance().setStatus(null), createFullyConfiguredInstance().setVerbosity(null), createFullyConfiguredInstance().setLogFilterParameters(null) ); } @Override protected CollectorSettings createFullyConfiguredInstance() { CollectorSettings collectorSettings = new CollectorSettings(); collectorSettings.setId("id"); collectorSettings.setName("name"); collectorSettings.setStatus("status"); collectorSettings.setVerbosity("verbosity"); collectorSettings.setLogFilterParameters(new LogFilterParameters().setUserId("userId")); return collectorSettings; } @Override protected CollectorSettings createInstanceWithDefaultParameters() { return new CollectorSettings(); } @Override protected CollectorSettings createInstanceFromOther(CollectorSettings other) { return new CollectorSettings(other); } @Override protected void assertFieldsHaveUniqueReferences(CollectorSettings expected, CollectorSettings actual) { assertNotSame(expected.getLogFilterParameters(), actual.getLogFilterParameters()); } @Test public void exportIsNotEnabledForNullLogFilterParameters() { fullyConfiguredTestInstance.setLogFilterParameters(null); boolean result = fullyConfiguredTestInstance.exportEnabled(); assertEquals(false, result); } @Test public void exportIsEnabledWhenExportDataSnapshotDisabled() { boolean result = fullyConfiguredTestInstance.exportEnabled(); assertEquals(false, result); } @Test public void exportIsEnabledWhenExportDataSnapshotEnabled() { ResourceAndSnapshotFilter resourceAndSnapshotFilter = new ResourceAndSnapshotFilter() .setResourceUri("uri") .setIncludeDataSnapshots(true); fullyConfiguredTestInstance.setLogFilterParameters(new LogFilterParameters() .setResourceAndSnapshotFilter(resourceAndSnapshotFilter)); boolean result = fullyConfiguredTestInstance.exportEnabled(); assertEquals(true, result); } }
ff7e432d2ea94749d81b570be1af0e5eb11df0bf
cd449c17b5cf6ec7080079dcd62f5e0567fd6b1e
/app/src/main/java/com/linghao/mychattest/controller/adapter/GroupDetailAdapter.java
bc696cd982144708c0f10ab22b384cd8b8ef0569
[]
no_license
duanxian123/MyChatTest
a145c86785aa15f543fec087c00fe2ecade8bd90
e4fa379a7c58d7796c59de77178c6932253bebee
refs/heads/master
2021-01-01T19:40:27.629337
2017-09-05T02:10:54
2017-09-05T02:10:56
98,643,370
0
0
null
null
null
null
UTF-8
Java
false
false
6,578
java
package com.linghao.mychattest.controller.adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.linghao.mychattest.R; import com.linghao.mychattest.model.bean.UserInfo; import java.util.ArrayList; import java.util.List; /** * Created by Administrator on 2016/9/26. */ public class GroupDetailAdapter extends BaseAdapter { private Context mContext; private boolean mIsCanModify;// 是否允许添加和删除群成员 private List<UserInfo> mUsers = new ArrayList<>(); private boolean mIsDeleteModel;// 删除模式 true:表示可以删除; false:表示不可以删除 private OnGroupDetailListener mOnGroupDetailListener; public GroupDetailAdapter(Context context, boolean isCanModify, OnGroupDetailListener onGroupDetailListener) { mContext = context; mIsCanModify = isCanModify; mOnGroupDetailListener = onGroupDetailListener; } // 获取当前的删除模式 public boolean ismIsDeleteModel() { return mIsDeleteModel; } // 设置当前的删除模式 public void setmIsDeleteModel(boolean mIsDeleteModel) { this.mIsDeleteModel = mIsDeleteModel; } // 刷新数据 public void refresh(List<UserInfo> users) { if (users != null && users.size() >= 0) { mUsers.clear(); // 添加加号和减号 initUsers(); mUsers.addAll(0, users); } notifyDataSetChanged(); } private void initUsers() { UserInfo add = new UserInfo("add"); UserInfo delete = new UserInfo("delete"); mUsers.add(delete); mUsers.add(0, add); } @Override public int getCount() { return mUsers == null ? 0 : mUsers.size(); } @Override public Object getItem(int position) { return mUsers.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // 获取或创建viewholder ViewHolder holder = null; if(convertView == null) { holder = new ViewHolder(); convertView = View.inflate(mContext, R.layout.item_groupdetail,null); holder.photo = (ImageView) convertView.findViewById(R.id.iv_group_detail_photo); holder.delete = (ImageView) convertView.findViewById(R.id.iv_group_detail_delete); holder.name = (TextView) convertView.findViewById(R.id.tv_group_detail_name); convertView.setTag(holder); }else { holder = (ViewHolder) convertView.getTag(); } // 获取当前item数据 final UserInfo userInfo = mUsers.get(position); // 显示数据 if(mIsCanModify) {// 群主或开放了群权限 // 布局的处理 if(position == getCount() - 1) {// 减号处理 // 删除模式判断 if(mIsDeleteModel) { convertView.setVisibility(View.INVISIBLE); }else { convertView.setVisibility(View.VISIBLE); holder.photo.setImageResource(R.drawable.em_smiley_minus_btn_pressed); holder.delete.setVisibility(View.GONE); holder.name.setVisibility(View.INVISIBLE); } }else if(position == getCount() - 2) {// 加号的处理 // 删除模式判断 if(mIsDeleteModel) { convertView.setVisibility(View.INVISIBLE); }else { convertView.setVisibility(View.VISIBLE); holder.photo.setImageResource(R.drawable.em_smiley_add_btn_pressed); holder.delete.setVisibility(View.GONE); holder.name.setVisibility(View.INVISIBLE); } }else {// 群成员 convertView.setVisibility(View.VISIBLE); holder.name.setVisibility(View.VISIBLE); holder.name.setText(userInfo.getName()); holder.photo.setImageResource(R.drawable.em_default_avatar); if(mIsDeleteModel) { holder.delete.setVisibility(View.VISIBLE); }else { holder.delete.setVisibility(View.GONE); } } // 点击事件的处理 if(position == getCount() - 1) {// 减号 holder.photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!mIsDeleteModel) { mIsDeleteModel = true; notifyDataSetChanged(); } } }); }else if(position == getCount() - 2) {// 加号的位置 holder.photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnGroupDetailListener.onAddMembers(); } }); }else { holder.delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnGroupDetailListener.onDeleteMember(userInfo); } }); } }else {// 普通的群成员 if(position == getCount() - 1 || position == getCount() - 2) { convertView.setVisibility(View.GONE); }else { convertView.setVisibility(View.VISIBLE); // 名称 holder.name.setText(userInfo.getName()); // 头像 holder.photo.setImageResource(R.drawable.em_default_avatar); // 删除 holder.delete.setVisibility(View.GONE); } } // 返回view return convertView; } private class ViewHolder{ private ImageView photo; private ImageView delete; private TextView name; } public interface OnGroupDetailListener{ // 添加群成员方法 void onAddMembers(); // 删除群成员方法 void onDeleteMember(UserInfo user); } }
a2d2e348c1aa9a14c0722981284bf2cd200cc60f
68047d2f520ab586f16faa8fd3e4287ea478b26d
/android/src/main/java/com/facebook/flipper/plugins/sandbox/SandboxFlipperPlugin.java
881affcd0b5105196f7a98dbd20a9f36b1a79fe8
[ "MIT" ]
permissive
s1rius/flipper
34bf8523af1bee09a8bd28fcb61c4cf3981692ab
082daa57eadb05f9455bf62cdd832974e54348b3
refs/heads/master
2020-08-05T14:56:44.613410
2019-10-03T14:10:37
2019-10-03T14:10:37
186,237,175
3
0
MIT
2019-05-12T09:50:23
2019-05-12T09:50:22
null
UTF-8
Java
false
false
2,436
java
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. */ package com.facebook.flipper.plugins.sandbox; import com.facebook.flipper.core.FlipperArray; import com.facebook.flipper.core.FlipperConnection; import com.facebook.flipper.core.FlipperObject; import com.facebook.flipper.core.FlipperPlugin; import com.facebook.flipper.core.FlipperReceiver; import com.facebook.flipper.core.FlipperResponder; import java.util.Map; public class SandboxFlipperPlugin implements FlipperPlugin { public static final String ID = "Sandbox"; private static final String SET_METHOD_NAME = "setSandbox"; private static final String GET_METHOD_NAME = "getSandbox"; private final SandboxFlipperPluginStrategy mStrategy; public SandboxFlipperPlugin(SandboxFlipperPluginStrategy strategy) { mStrategy = strategy; } @Override public String getId() { return ID; } @Override public void onConnect(FlipperConnection connection) { connection.receive( GET_METHOD_NAME, new FlipperReceiver() { @Override public void onReceive(FlipperObject params, final FlipperResponder responder) { final FlipperArray.Builder sandboxes = new FlipperArray.Builder(); Map<String, String> knownSandboxes = mStrategy.getKnownSandboxes(); if (knownSandboxes == null) { responder.success(sandboxes.build()); return; } for (String sandboxName : knownSandboxes.keySet()) { sandboxes.put( new FlipperObject.Builder() .put("name", sandboxName) .put("value", knownSandboxes.get(sandboxName))); } responder.success(sandboxes.build()); } }); connection.receive( SET_METHOD_NAME, new FlipperReceiver() { @Override public void onReceive(FlipperObject params, FlipperResponder responder) throws Exception { String sandbox = params.getString("sandbox"); mStrategy.setSandbox(sandbox); responder.success(new FlipperObject.Builder().put("result", true).build()); } }); } @Override public void onDisconnect() {} @Override public boolean runInBackground() { return false; } }
916aa06539c6bd41493816a1c600ed3cd438c1df
f7e3116d6cd5d717c230c9a630b902bf299ae309
/code/java/test/qam/pat/PilotSequenceTest.java
1b3f819ff28b1c4542986653f574dd3ba76a38bf
[]
no_license
robbymckilliam/FastOptimalQAM
e11e743a5b79891cea1e5e71657fd32be0add683
d45c4f79153b6afaf5b0cf50c2a37517470486c1
refs/heads/master
2020-08-07T06:32:42.110230
2014-04-14T05:44:13
2014-04-14T05:44:13
18,748,923
2
0
null
null
null
null
UTF-8
Java
false
false
2,507
java
package qam.pat; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; import pubsim.Complex; /** * * @author Robby */ public class PilotSequenceTest { public PilotSequenceTest() { } @BeforeClass public static void setUpClass() throws Exception { } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of next method, of class PilotSequence. */ @Test public void next() { System.out.println("next"); Complex[] ca = { new Complex(1,2), new Complex(3,4), new Complex(5,6) }; PilotSequence instance = new PilotSequence(ca); assertEquals(true, instance.next().equals(new Complex(3,4))); assertEquals(true, instance.next().equals(new Complex(5,6))); assertEquals(true, instance.next().equals(new Complex(1,2))); assertEquals(true, instance.next().equals(new Complex(3,4))); double[] da = { 1,2, 3,4, 5,6 }; instance = new PilotSequence(da); assertEquals(true, instance.next().equals(new Complex(3,4))); assertEquals(true, instance.next().equals(new Complex(5,6))); assertEquals(true, instance.next().equals(new Complex(1,2))); assertEquals(true, instance.next().equals(new Complex(3,4))); } /** * Test of current method, of class PilotSequence. */ @Test public void current() { System.out.println("current"); Complex[] ca = { new Complex(1,2), new Complex(3,4), new Complex(5,6) }; PilotSequence instance = new PilotSequence(ca); assertEquals(true, instance.current().equals(new Complex(1,2))); assertEquals(true, instance.next().equals(new Complex(3,4))); assertEquals(true, instance.current().equals(new Complex(3,4))); assertEquals(true, instance.next().equals(new Complex(5,6))); assertEquals(true, instance.current().equals(new Complex(5,6))); assertEquals(true, instance.next().equals(new Complex(1,2))); assertEquals(true, instance.current().equals(new Complex(1,2))); assertEquals(true, instance.next().equals(new Complex(3,4))); assertEquals(true, instance.current().equals(new Complex(3,4))); } }
546cdb7f735355ddda42ca2ddce4ca0523b6203d
5052c8597ddd6d29568355df2037588ce88834f0
/src/modulo-01-java-OO/modulo-01/DataTerceiraEraTest.java
67f63a3346ad5ba4a78b16d3eed196f587dc350f
[]
no_license
OtavioBubans/crescer-2016-2
4a13b6f96daf40d48bd716113e64500b321ae06a
914417e17a51ff892116398dd44e9b0c5feeade2
refs/heads/master
2021-05-03T11:47:28.690962
2016-12-07T19:46:49
2016-12-07T19:46:49
69,389,931
0
0
null
2016-11-01T22:39:25
2016-09-27T19:12:08
JavaScript
UTF-8
Java
false
false
1,732
java
import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; public class DataTerceiraEraTest{ @Test public void testaData(){ DataTerceiraEra data = new DataTerceiraEra(1,5,2005); assertEquals(1,data.getDia()); assertEquals(5,data.getMes()); assertEquals(2005,data.getAno()); } @Test public void testaDataInexistente(){ DataTerceiraEra data = new DataTerceiraEra(40,15,403); assertEquals(40,data.getDia()); assertEquals(15,data.getMes()); assertEquals(403,data.getAno()); } @Test public void criarAno3019QueNaoEhBissexto() { // Arrange DataTerceiraEra data = new DataTerceiraEra(1, 10, 3019); // Act boolean obtido = data.ehBissexto(); // Assert assertFalse(obtido); } @Test public void criarAno2000QueEhBissexto() { // Arrange DataTerceiraEra data = new DataTerceiraEra(1, 1, 2000); // Act boolean obtido = data.ehBissexto(); // Assert assertTrue(obtido); } @Test public void criarAno1900NaoEhBissexto() { assertFalse(new DataTerceiraEra(1,1,1900).ehBissexto()); } @Test public void criarAno2012QueEhBissexto() { assertTrue(new DataTerceiraEra(04, 05, 2012).ehBissexto()); } @Test public void criarAno2200QueNaoEhBissexto() { assertFalse(new DataTerceiraEra(04, 05, 2200).ehBissexto()); } @Test public void criarAno2015QueNaoEhBissexto() { assertFalse(new DataTerceiraEra(04, 05, 2015).ehBissexto()); } }
0f13a24e34febbd990c1e6cf87ebbea78792c65b
78eb1491c0c7ca6c9561647e375c2633043b5eb8
/src/main/java/nl/stefankohler/stash/badgr/achievements/extension/StyleIsEternal.java
af3c1cedaab0425d0ff09d8a3a8269a12f5db29e
[]
no_license
ofir123/Badgr
0e157661697e2cc4779ab3d19867463322f1934e
dfbe55ca64bb9be2ebe49ee5d59dbaeae607da8d
refs/heads/master
2021-01-13T02:22:36.770445
2014-09-24T16:00:34
2014-09-24T16:00:34
20,454,086
0
1
null
null
null
null
UTF-8
Java
false
false
654
java
package nl.stefankohler.stash.badgr.achievements.extension; import nl.stefankohler.stash.badgr.Achievement; /** * The Style Is Eternal Achievement. * Granted after adding an X number of CSS files * to Stash. * * @author Stefan Kohler * @since 1.1 */ @Achievement public class StyleIsEternal extends ExtensionBasedAchievement { private static final Integer COUNTING_LIMIT = 71; @Override public String getExtension() { return "css"; } @Override public String getBadge() { return "styleiseternal.png"; } @Override public Integer getCountingLimit() { return COUNTING_LIMIT; } }
638f45a24f772749f43b67391079ad6e3cbca657
6415ab2efcc2e16d9c300374c4f5fef2dc4a1aed
/CS/CS/src/gui/ChagePerson.java
ca364d56c1fedcfd6506eb9769136ee372720754
[]
no_license
wangshumiao/123456
584507758815dceb892facc52aad6a35f0ac8ad7
a2b155210e720d4e410c18df5a4afdf8cc6b01b9
refs/heads/master
2020-07-22T18:37:04.947423
2020-01-02T12:32:57
2020-01-02T12:32:57
207,291,303
0
0
null
null
null
null
GB18030
Java
false
false
2,851
java
package gui; import data.*; import ui.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.JFrame; public class ChagePerson extends JFrame { JTextField f1 =new JTextField(8); JTextField f2 =new JTextField(8); JTextField f3 =new JTextField(8); public void change (String id ) { this .setLayout(new FlowLayout(FlowLayout.CENTER,300,20)); this.setSize(600,600); this.setLocation(600,260); this.setTitle("修改个人信息"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); JLabel l0 =new JLabel("请选择更改信息的选项"); JButton b1 = new JButton ("新的信息---年龄 :"); JButton b2 = new JButton ("新的信息---性别 :"); JButton b3 = new JButton ("新的信息---院系: "); JPanel p1 =new JPanel (); JPanel p2 =new JPanel (); JPanel p3 =new JPanel (); p1.add(f1); p1.add(b1); p2.add(f2); p2.add(b2); p3.add(f3); p3.add(b3); this.add(l0); this.add(p1); this.add(p2); this.add(p3); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String str1=f1.getText(); try { Modify.information(id, "1",str1); JOptionPane.showMessageDialog(null,"修改成功","提示消息",JOptionPane.WARNING_MESSAGE); PersonUi p=new PersonUi(); p.guisystem(id); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String str2=f2.getText(); try { Modify.information(id, "2",str2); JOptionPane.showMessageDialog(null,"修改成功","提示消息",JOptionPane.WARNING_MESSAGE); PersonUi person=new PersonUi(); person.guisystem(id); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); b3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String str3=f3.getText(); try { Modify.information(id, "3",str3); JOptionPane.showMessageDialog(null,"修改成功","提示消息",JOptionPane.WARNING_MESSAGE); PersonUi person=new PersonUi(); person.guisystem(id); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } }
6cecae5f8151dfcb660747f6d249ebea59d15da6
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/product/ui/HtmlTextView.java
8c433257e505e1b90526d79128d15538b1d679fb
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
1,417
java
package com.tencent.mm.plugin.product.ui; import android.content.Context; import android.text.Html.ImageGetter; import android.text.Html.TagHandler; import android.util.AttributeSet; import android.widget.TextView; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.kernel.g; import com.tencent.mm.sdk.platformtools.al; public class HtmlTextView extends TextView { Html.ImageGetter pib; Html.TagHandler pic; public HtmlTextView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); AppMethodBeat.i(44016); this.pib = new HtmlTextView.2(this); this.pic = new HtmlTextView.3(this); AppMethodBeat.o(44016); } public HtmlTextView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) { super(paramContext, paramAttributeSet, paramInt); AppMethodBeat.i(44015); this.pib = new HtmlTextView.2(this); this.pic = new HtmlTextView.3(this); AppMethodBeat.o(44015); } public void setText(String paramString) { AppMethodBeat.i(44017); g.RS().a(new HtmlTextView.1(this, paramString)); AppMethodBeat.o(44017); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes8-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.product.ui.HtmlTextView * JD-Core Version: 0.6.2 */
36e63d244630353e06e8008eb19ce01d4c3ae422
91121d7f4f5f83aa82eff29669c721b57d0e1361
/src/main/java/com/squirrel/smsfapi/exception/BadRequestException.java
c462d9b194f081999fba473171518186dcdca623
[]
no_license
RonildoBragaJunior/smsf-api
1b311cdcf21e4ddb23b1e89b262de2c2287222fc
939001bb6d145d4b6c6b5accf2e63ef453034db2
refs/heads/master
2021-10-28T13:00:19.217979
2019-03-11T23:00:18
2019-03-11T23:00:18
166,924,506
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.squirrel.smsfapi.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.BAD_REQUEST) public class BadRequestException extends RuntimeException { public BadRequestException(String message) { super(message); } public BadRequestException(String message, Throwable cause) { super(message, cause); } }
83d6ac3d494e37470218a78fe98b5313cf0f249c
b86f8c9282857e7507d1c06552089ced3ccf48e9
/11-Timer/examples/ScheduleTimer/ScheduleTimer-ejb/src/java/com/example/TimerServiceLocal.java
932903c9da0a7d0110c737c15075d7b3f8a2b055
[]
no_license
sidlors/CursoEJB
3b45662a0ae221fcbf5059271383b36e2de4bbf5
14246c28dcbbe9636fd7839a7d1448b4c2be97aa
refs/heads/master
2022-11-25T05:27:23.349044
2020-04-06T13:20:46
2020-04-06T13:20:46
31,856,155
3
9
null
2022-11-24T02:15:06
2015-03-08T16:12:25
Java
UTF-8
Java
false
false
251
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.example; import javax.ejb.Local; /** * * @author anshenoy */ @Local public interface TimerServiceLocal { public void doWork(); }
54ee8591caeef7a296506e063843b0282ed4ea5a
913977dba09d712f51923229fb10860fd08cf5a1
/src/leetcode/Lee792.java
daa174006f92758b21e1501e231f996ffb9257ab
[]
no_license
zsjwish/algorithm
17e5bbcef780c30e0b9ab415551a3e642bf001b8
4e21ef7398a418ea6358e67b1923ac60c98a6e4e
refs/heads/master
2021-06-21T06:37:18.566962
2019-08-17T15:27:20
2019-08-17T15:27:35
130,315,973
0
0
null
2018-04-23T09:26:15
2018-04-20T06:00:52
Java
UTF-8
Java
false
false
1,748
java
package leetcode; import java.util.HashSet; import java.util.Set; /** * created by zsj in 15:58 2018/9/25 * description:给定字符串 S 和单词字典 words, 求 words[i] 中是 S 的子序列的单词个数。 * 示例: * 输入: * S = "abcde" * words = ["a", "bb", "acd", "ace"] * 输出: 3 * 解释: 有三个是 S 的子序列的单词: "a", "acd", "ace"。 **/ public class Lee792 { public static void main(String[] args) { System.out.println(isSubsequence("abc","ahbgdc")); } public static int numMatchingSubseq(String S, String[] words) { int res = 0; Set<String> pass = new HashSet<>(); Set<String> out = new HashSet<>(); for (String tmp : words) { if (pass.contains(tmp) || out.contains(tmp)) { if (pass.contains(tmp)) { res++; } continue; } else { if (isSubsequence(tmp, S)) { pass.add(tmp); res++; } else { out.add(tmp); } } } return res; } /** * s 是 t 的子序列 * @param s * @param t * @return */ public static boolean isSubsequence(String s, String t) { if (s.length() == 0) { return true; } if (t.length() == 0) { return false; } int pos = 0; for (int i = 0; i < t.length() && pos < s.length(); i++) { if (s.charAt(pos) == t.charAt(i)) { pos++; } } if (pos == s.length()) { return true; } return false; } }
629b7746a804e7a105eda5c6830d3077299e5fb3
c941a61f445e41627319d190719abab521a96174
/vetclinic/src/main/java/ua/iot/lviv/Main.java
908176d47034e53b36f4fbb096dfac84c41d3d9d
[]
no_license
smallpoxlviv/3s_db_lab_5
49102cddad162671801427fac6a036fb1f5f5207
8c3ad34734a379152c50eaa48999c0e84521ddae
refs/heads/main
2023-02-01T16:07:17.266978
2020-12-11T17:32:01
2020-12-11T17:32:01
317,036,060
0
0
null
2020-12-11T17:28:15
2020-11-29T20:22:02
null
UTF-8
Java
false
false
570
java
package ua.iot.lviv; import ua.iot.lviv.persistence.ConnectionManager; import ua.iot.lviv.view.MyView; public class Main { public static void main(final String[] args) { try { Class.forName("com.mysql.cj.jdbc.Driver"); new MyView().show(); } catch (ClassNotFoundException ex) { System.out.println("MySql Driver is not loaded"); } finally { ConnectionManager.closeSession(); ConnectionManager.closeSessionFactory(); System.out.println("Good Bye!"); } } }
05cfdee226f02819ca1b076ebfe319c67a80a8e7
ae124491d41fd9bbe79b982f689fd7d255061d9b
/modules/core/src/main/java/org/mycontroller/standalone/offheap/MessageQueueSleepImpl.java
c61aa01175384c4674b8c14ec2a1de1a81e3bfe9
[ "Apache-2.0" ]
permissive
nino21/mycontroller
8d1a56256fdff04c16732a00873dac73ed3f31f1
1f162e269175980d243aeaab19d34c07a31a57b1
refs/heads/development
2021-01-25T14:49:16.492198
2018-10-29T14:50:06
2018-10-29T14:50:06
123,730,094
0
0
Apache-2.0
2019-03-11T20:25:32
2018-03-03T20:48:42
Java
UTF-8
Java
false
false
2,819
java
/* * Copyright 2015-2018 Jeeva Kandasamy ([email protected]) * and other contributors as indicated by the @author tags. * * 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.mycontroller.standalone.offheap; import java.util.ArrayList; import org.mapdb.HTreeMap; import org.mycontroller.standalone.AppProperties; import org.mycontroller.standalone.message.IMessage; import lombok.extern.slf4j.Slf4j; /** * @author Jeeva Kandasamy (jkandasa) * @since 1.2.0 */ @Slf4j public class MessageQueueSleepImpl { private String _nameMap; HTreeMap<String, ArrayList<IMessage>> _map; public MessageQueueSleepImpl(String name) { _nameMap = IMap.MAP_PREFIX + "_msg_sleep_" + name; _map = OffHeapFactory.store().getHashMap(_nameMap); if (AppProperties.getInstance().getClearMessagesQueueOnStart()) { _map.clear(); } else { _logger.debug("Continuing with offline messages in the map:[{}]", _nameMap); } } public synchronized void clear() { _map.clear(); } public synchronized void delete() { OffHeapFactory.store().delete(_nameMap); } public synchronized void put(IMessage message) { // no need to handle broadcast messages if (message.getNodeEui().equalsIgnoreCase(IMessage.NODE_BROADCAST_ID)) { return; } updateEmpty(message.getNodeEui()); ArrayList<IMessage> _queue = _map.get(message.getNodeEui()); _queue.add(message); _logger.debug("Adding [key:{}, size:{}, {}] in to the map", message.getNodeEui(), _queue.size(), message); } public synchronized ArrayList<IMessage> get(String key) { updateEmpty(key); return _map.get(key); } public synchronized ArrayList<IMessage> remove(String key) { updateEmpty(key); ArrayList<IMessage> _queue = _map.remove(key); _logger.debug("Removing[key:{}, size:{}] in to the map", key, _queue.size()); return _queue; } public synchronized boolean isEmpty(String key) { updateEmpty(key); return _map.get(key).isEmpty(); } private synchronized void updateEmpty(String key) { if (_map.get(key) == null) { _map.put(key, new ArrayList<IMessage>()); } } }
b630ea3baee045dba7b033a17cd2b4b7ea54fe2d
ab2080016e068c60118870ce7f89466dc2dd9abe
/app/src/main/java/com/huske/sharedexample/AdminPreferenceConfig.java
a4fbb1e6d260a62eb24b37861319d92227403484
[]
no_license
Samul333/NotifyMe
db2410c112df0a2448f09373cbfb6d19ed4e5358
1619859c6e88c98e2326cd99cea9db5997142fbc
refs/heads/master
2020-05-17T06:37:50.974335
2019-08-01T07:17:40
2019-08-01T07:17:40
183,563,002
0
0
null
null
null
null
UTF-8
Java
false
false
955
java
package com.huske.sharedexample; import android.content.Context; import android.content.SharedPreferences; public class AdminPreferenceConfig { private SharedPreferences sharedPreferences; private Context context; public AdminPreferenceConfig(Context context){ this.context = context; sharedPreferences = context.getSharedPreferences(context.getResources().getString(R.string.admin_login_preference),Context.MODE_PRIVATE); } public void writeLoginStatus(Boolean status){ SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(context.getResources().getString(R.string.admin_login_status_preference),status); editor.commit(); } public boolean readLoginstatus (){ boolean status = false; status = sharedPreferences.getBoolean(context.getResources().getString(R.string.admin_login_status_preference),false); return status; } }
1af8d157e7c5ca3e56008824a4672e92f61c3072
f260eced97f135f743e855f50fb197c1af26e1ab
/src/main/java/com/wspa/mpkmanager/model/AbstractUniqueEntity.java
6e3eea0b03b2125ef8c5359dd6b27de98271d69d
[]
no_license
Palii-Meshchanynets-Tiupa/MpkManager
a4f71deced76cfcaaee0acbc876b11d62d1ce584
8137c1367cc5955e12815bd6a1d61df10de1ba54
refs/heads/master
2021-01-24T09:55:54.761065
2018-06-03T17:10:41
2018-06-03T17:10:41
123,028,665
1
0
null
2018-05-20T19:09:52
2018-02-26T20:49:26
TypeScript
UTF-8
Java
false
false
557
java
package com.wspa.mpkmanager.model; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import javax.validation.constraints.NotNull; import java.util.UUID; @MappedSuperclass @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) public abstract class AbstractUniqueEntity extends AbstractEntity { @Getter @Setter @NotNull @Column(columnDefinition = "UUID") private UUID uuid = UUID.randomUUID(); }
7f486e2d27e503f80d8fc66d05b339c5bc24a44d
5b62981e0a3b016c6e32aef3a5d829f3b5ca5c88
/src/test_Suite/lib/eForms/EForm.java
ea4a32fae4f00e218b88f4e9e60a9d5be9799b7d
[]
no_license
kamaltechnocrat/JMeter
c1f61416fb832d97ad4f09e022a80a2a74c2f01b
cd36cf4185949e8516c446f6705f4144eb6bfb19
refs/heads/master
2020-03-15T13:40:43.682421
2018-05-04T18:03:34
2018-05-04T18:03:34
132,172,591
0
0
null
null
null
null
UTF-8
Java
false
false
14,637
java
/* * FormsHelper.java * * Created on February 1, 2007, 457 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package test_Suite.lib.eForms; /** * * @author mshakshouki */ import static watij.finders.SymbolFactory.*; import java.util.ArrayList; import java.util.List; import watij.runtime.ie.IE; import test_Suite.constants.eForms.*; import test_Suite.constants.ui.*; import test_Suite.utils.cases.GeneralUtil; import test_Suite.utils.ui.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.lang.RandomStringUtils; //import org.apache.commons. public class EForm { private static Log log = LogFactory.getLog(EForm.class); protected String eFormType = null; protected String eFormName = null; protected String eFormSubType = null; protected String eFormId = null; protected String eFormFullId = null; protected String eFormTitle = null; private String eFormTitles[] = null; protected String scrumble = null; protected String preFix = null; protected String postFix = null; protected Integer formletCounter = 0; protected boolean retValue; protected String primaryOrg = null; protected String orgAccess = null; protected String defaultFormlet; protected String displayProjInfo = "Never"; protected List<Formlet> lstFormlets; static ArrayList<String> errorSmall; /************* Constructors ****/ public EForm(String preFix, String eFormName, String postFix, boolean isNew) { this.preFix = preFix; this.eFormName = eFormName; this.postFix = postFix; this.setEFormFullId(preFix + eFormName + postFix); this.setEFormId(preFix + eFormName); } public EForm() { this.setScrumble(RandomStringUtils.randomAlphabetic(5)); this.setFormletCounter(0); // TODO: may change and be set in the test case this.setPrimaryOrg("G3"); this.setOrgAccess("Public"); } public EForm(String eFormType, String preFix) { this.eFormType = eFormType; this.setScrumble(RandomStringUtils.randomAlphabetic(5)); this.setEFormId(preFix + eFormType); this.setEFormFullId(this.getEFormId() + "-" + this.getScrumble()); this.setFormletCounter(0); this.preFix = preFix; // TODO: may change and be set in the test case this.setPrimaryOrg("G3"); this.setOrgAccess("Public"); } public EForm(String eFormType, String eFormSubType, String preFix) { this.eFormType = eFormType; this.eFormSubType = eFormSubType; this.setScrumble(RandomStringUtils.randomAlphabetic(5)); this.setEFormId(preFix + eFormSubType); this.setEFormFullId(this.getEFormId() + "-" + this.getScrumble()); this.setFormletCounter(0); this.preFix = preFix; // TODO: may change and be set in the test case this.setPrimaryOrg("G3"); this.setOrgAccess("Public"); } public EForm(String eFormType, String eFormSubType, String preFix, String postFix) { this.eFormType = eFormType; this.eFormSubType = eFormSubType; this.preFix = preFix; this.postFix = postFix; this.setScrumble(RandomStringUtils.randomAlphabetic(5)); this.setEFormId(this.getPreFix() + this.getEFormSubType()); this.setEFormFullId(this.getEFormId() + this.getPostFix()); this.setFormletCounter(0); // TODO: may change and be set in the test case this.setPrimaryOrg("G3"); this.setOrgAccess("Public"); } public boolean createEForm() throws Exception { log.info("Start Creating eForm Type " + this.eFormType); retValue = false; IE ie = IEUtil.getActiveIE(); log.info("Opening Forms List"); ClicksUtil.clickLinks(IClicksConst.openFormsListLnk); FiltersUtil.filterListByLabel(IFiltersConst.gpa_FormIdent_Lbl, this.eFormFullId,"Exact"); ClicksUtil.clickImage(IClicksConst.newImg); ie.textField(id, IEFormsConst.formIdentifier_TextField_Id).set( this.getEFormFullId()); ie.selectList(id, IEFormsConst.formType_SelectList_Id).select( this.eFormType); GeneralUtil.takeANap(0.5); ie.selectList(id, IEFormsConst.formSubType_SelectList_Id).select( this.eFormSubType); ie.selectList(id, IEFormsConst.formPrimaryOrg_DropdownField_Id).select( this.getPrimaryOrg()); ie.selectList(id, IEFormsConst.formOrgAccess_DropdownField_Id).select( this.getOrgAccess()); if (ie.selectList(id,IEFormsConst.formDeisplyProjectInfo_DropdwonField_Id).exists()) { ie.selectList(id,IEFormsConst.formDeisplyProjectInfo_DropdwonField_Id).select(this.displayProjInfo); } ie.textField(id, "/0:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); if (ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } ClicksUtil.clickButtons(IClicksConst.saveBtn); GeneralUtil.takeANap(0.5); if (ClicksUtil.clickButtons(IClicksConst.openFormPlannerBtn)){ retValue = true; } return retValue; } public void editEFormDetails() throws Exception { IE ie = IEUtil.getActiveIE(); ie.textField(id, IEFormsConst.formIdentifier_TextField_Id).set( this.getEFormFullId()); if(ie.selectList(id, IEFormsConst.formType_SelectList_Id).exists()) { ie.selectList(id, IEFormsConst.formType_SelectList_Id).select( this.eFormType); GeneralUtil.takeANap(0.5); ie.selectList(id, IEFormsConst.formSubType_SelectList_Id).select( this.eFormSubType); } ie.selectList(id, IEFormsConst.formPrimaryOrg_DropdownField_Id).select( this.getPrimaryOrg()); ie.selectList(id, IEFormsConst.formOrgAccess_DropdownField_Id).select( this.getOrgAccess()); ie.selectList(id,IEFormsConst.formDeisplyProjectInfo_DropdwonField_Id).select(this.displayProjInfo); ie.textField(id, "/0:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); if (ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } ClicksUtil.clickButtons(IClicksConst.saveBtn); GeneralUtil.takeANap(0.5); ClicksUtil.clickButtons(IClicksConst.saveBtn); } /** * Simplified method to create or update Form * * @throws Exception * Added by Alex Pankov */ public void createOrUpdateForm() throws Exception { IE ie = IEUtil.getActiveIE(); if (GeneralUtil.isButtonExists(IClicksConst.unPublishFormBtn)) ClicksUtil.clickButtons(IClicksConst.unPublishFormBtn); ie.textField(id, IEFormsConst.formIdentifier_TextField_Id).set( this.eFormId); ie.selectList(id, IEFormsConst.formType_SelectList_Id).select( this.eFormType); ie.selectList(id, IEFormsConst.formPrimaryOrg_DropdownField_Id).select( this.primaryOrg); ie.selectList(id, IEFormsConst.formOrgAccess_DropdownField_Id).select( this.orgAccess); ie.textField(id, "/0:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); if (ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/1:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/2:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .exists()) { ie.textField(id, "/3:" + IEFormsConst.formTitle_TextField_Id + "/") .set(this.getEFormTitle()); } if (GeneralUtil.isButtonExists(IClicksConst.publishFormBtn)){ ClicksUtil.clickButtons(IClicksConst.publishFormBtn); GeneralUtil.takeANap(0.5); ClicksUtil.clickButtons(IClicksConst.publishFormBtn); } else { ClicksUtil.clickButtons(IClicksConst.saveBtn); GeneralUtil.takeANap(0.5); ClicksUtil.clickButtons(IClicksConst.saveBtn); } } public boolean publishForm(String defaultFormlet) throws Exception { retValue = false; IE ie = IEUtil.getActiveIE(); // are you still in the Form planner? if (ie.link(title, IClicksConst.eForm_eFormDetails_Title_lnk).exists() || ie.htmlElement(title, IClicksConst.eForm_eFormDetails_Title_lnk).exists()) { ClicksUtil .clickLinksByTitle(IClicksConst.eForm_eFormDetails_Title_lnk); retValue = true; } else { // Start from the Forms List ClicksUtil.clickLinks(IClicksConst.openFormsListLnk); FiltersUtil.filterListByLabel(IFiltersConst.gpa_FormIdent_Lbl, this.eFormId,"Exact"); // IF there is More pages for (Integer x = 2; x == 20; x++) { if (TablesUtil.findInTable(ITablesConst.formsTableId, this.eFormId)) { ClicksUtil.clickLinks(this.eFormId); ClicksUtil .clickLinksByTitle(IClicksConst.eForm_eFormDetails_Title_lnk); retValue = true; break; } else { if (ie.link(text, x.toString()).exists()) { ClicksUtil.clickLinks(x.toString()); } else { log.debug("could not find Form"); break; } } } } if (retValue) { ie.selectList(id, IEFormsConst.formDefaultFormlet_SelectList_Id) .select(defaultFormlet); if (!ClicksUtil.clickButtons(IClicksConst.publishFormBtn)){ log.error("Form cannot be published"); return false; } log.info("Form has been published"); } return retValue; } public boolean publishEFormAndCheckErrors(String defaultFormlet) throws Exception { IE ie = IEUtil.getActiveIE(); errorSmall = null; ClicksUtil.clickLinksByTitle(IClicksConst.eForm_eFormDetails_Title_lnk); ie.selectList(id, IEFormsConst.formDefaultFormlet_SelectList_Id) .select(defaultFormlet); ClicksUtil.clickButtons(IClicksConst.publishFormBtn); if (GeneralUtil.isButtonExistsByValue(IClicksConst.unPublishFormBtn)) { return true; } errorSmall = GeneralUtil.checkForErrorMessages(); if (errorSmall != null && !errorSmall.isEmpty()) { for (String string : errorSmall) { log.error("Validation error: " + string); } } return false; } public boolean unPublishForm() throws Exception { ClicksUtil.clickLinksByTitle("e.Form Details"); if (GeneralUtil.isButtonExistsByValue(IClicksConst.unPublishFormBtn)) { ClicksUtil.clickButtons(IClicksConst.unPublishFormBtn); if (GeneralUtil.isButtonExistsByValue(IClicksConst.publishFormBtn)) { ClicksUtil.clickButtons(IClicksConst.backBtn); return true; } } ClicksUtil.clickButtons(IClicksConst.backBtn); return false; } // #####*************End of etc**************************** /** * @return the eFormFullId */ public String getEFormFullId() { return eFormFullId; } /** * @param formFullId * the eFormFullId to set */ public void setEFormFullId(String formFullId) { eFormFullId = formFullId; } public String getEFormName(){ return eFormName; } // public void setEFormName(String eFormName){ // // eFormName = eFormName; // } /** * @return the defaultFormlet */ public String getDefaultFormlet() { return defaultFormlet; } /** * @param defaultFormlet * the defaultFormlet to set */ public void setDefaultFormlet(String defaultFormlet) { this.defaultFormlet = defaultFormlet; } /** * @return the formletCounter */ public Integer getFormletCounter() { return formletCounter; } /** * @param formletCounter * the formletCounter to set */ public void setFormletCounter(Integer formletCounter) { this.formletCounter = formletCounter; } public String getEFormId() { return eFormId; } public void setEFormId(String formId) { eFormId = formId; } public String getEFormType() { return eFormType; } public void setEFormType(String formType) { eFormType = formType; } public String getEFormTitle() { return eFormTitle; } public void setEFormTitle(String formTitle) { eFormTitle = formTitle; } public String getOrgAccess() { return orgAccess; } public void setOrgAccess(String orgAccess) { this.orgAccess = orgAccess; } public String getPrimaryOrg() { return primaryOrg; } public void setPrimaryOrg(String primaryOrg) { this.primaryOrg = primaryOrg; } public String[] getEFormTitles() { return eFormTitles; } public void setEFormTitles(String[] formTitles) { eFormTitles = formTitles; } /** * @return the eFormSubType */ public String getEFormSubType() { return eFormSubType; } /** * @param formSubType * the eFormSubType to set */ public void setEFormSubType(String formSubType) { eFormSubType = formSubType; } /** * @return the scrumble */ public String getScrumble() { return scrumble; } /** * @param scrumble * the scrumble to set */ public void setScrumble(String scrumble) { this.scrumble = scrumble; } /** * @return the postFix */ public String getPostFix() { return postFix; } /** * @param postFix * the postFix to set */ public void setPostFix(String postFix) { this.postFix = postFix; } /** * @return the preFix */ public String getPreFix() { return preFix; } /** * @param preFix * the preFix to set */ public void setPreFix(String preFix) { this.preFix = preFix; } /** * @return the lstFormlets */ public List<Formlet> getLstFormlets() { return lstFormlets; } /** * @param lstFormlets the lstFormlets to set */ public void setLstFormlets(List<Formlet> lstFormlets) { this.lstFormlets = lstFormlets; } /** * @return the displayProjInfo */ public String getDisplayProjInfo() { return displayProjInfo; } /** * @param displayProjInfo the displayProjInfo to set */ public void setDisplayProjInfo(String displayProjInfo) { this.displayProjInfo = displayProjInfo; } }
7df80ad9d32f2613a4e8417d82934367780216c1
447698e4348550abed6a8732e42cf163d43b78e8
/app/src/main/java/KotlinAgency/XiaomingFather.java
f9b7c44e1db8750fde25a6f869fe9d6677063ffc
[]
no_license
aWhalefall/andoridkotlin
c747003e231df45f95d15063b8f4bd1d03d3110a
50eead1f5f71fe71df92782b9b09aef2ba7bdba8
refs/heads/master
2021-08-14T17:26:31.544003
2017-11-16T10:13:27
2017-11-16T10:13:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package KotlinAgency; /** * Created by weichyang on 2017/11/2. */ public interface XiaomingFather { void payMoney(); }
363176ff48ac84293f2d486f37aabdc5654dde27
6e6905e5f32d803d8d5edb591210fd0e78dd20a0
/src/main/java/site/higgs/limiter/semaphore/SemaphoreManager.java
9578ae44045d52a9cd02a0897579f52b3eefb73a
[ "Apache-2.0" ]
permissive
986510453/SpringLimiter
247da439f9f3980f4137b89ada3b2f9a21733e1d
5b9474e71c3293033ab611829e59e02e4c32cf72
refs/heads/master
2020-04-11T11:53:35.062816
2018-12-02T06:33:37
2018-12-02T06:33:37
161,762,697
2
0
Apache-2.0
2018-12-14T09:33:34
2018-12-14T09:33:34
null
UTF-8
Java
false
false
562
java
package site.higgs.limiter.semaphore; import site.higgs.limiter.LimiterManager; import java.util.Collection; /** * Created by caocg on 2018/9/23. */ public abstract class SemaphoreManager implements LimiterManager<Semaphore> { public abstract Semaphore getSemaphore(String name); public abstract Collection<String> getSemaphoreNames(); @Override public Semaphore getLimiter(String name) { return getSemaphore(name); } @Override public Collection<String> getLimiterNames() { return getSemaphoreNames(); } }
6ca4a7366c83dbebf17f830aea3e01f2f089ee46
cdeb9c129a8bccbd56c5cfa0fcc5f443ce21889a
/src/EditingArrays/AddElement.java
921a92ea10bf29e1dbbab05da1470605d2c3a92c
[]
no_license
RayNjire/The-Complete-Arrays-Study
8c6392f27a740fb089235ca27cbd86d2162c6fcd
829f9760dcbfc0f69d7478dd5efa7ec356c2e34e
refs/heads/master
2023-03-01T03:17:44.091974
2021-02-03T09:44:36
2021-02-03T09:44:36
265,082,657
1
0
null
null
null
null
UTF-8
Java
false
false
1,660
java
package EditingArrays; import java.util.Arrays; /**Author and License * * 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. * * @author ray njire */ public class AddElement { public static void AddString() { String allSubjects[] = {"Maths", "Science", "English", "Kiswahili", "S.S.T.", "C.R.E.", "P.E.", "Swimming"}; System.out.println("Original Array -> " + Arrays.toString(allSubjects) + "\n\n"); //Copy the array into itself but declare it with a larger array size allSubjects = Arrays.copyOf(allSubjects, allSubjects.length + 1); //Enter the number 4 into the last index of the array allSubjects[allSubjects.length - 1] = "Arts and Crafts"; System.out.println("New Array -> " + Arrays.toString(allSubjects) + "\n\n"); } public static void AddInt() { int allNumbers[] = {600, 50, 98, 65, 78, 95, 111, 521}; System.out.println("Original Array -> " + Arrays.toString(allNumbers) + "\n\n"); //Copy the array into itself but declare it with a larger array size allNumbers = Arrays.copyOf(allNumbers, allNumbers.length + 1); //Enter the number 4 into the last index of the array allNumbers[allNumbers.length - 1] = 123456; System.out.println("New Array -> " + Arrays.toString(allNumbers) + "\n\n"); } public static void main(String args[]) { //AddString(); //AddInt(); } }
7a4244fc6870d7c493f66bde2aaecee07bf925d2
d905c9cad548390506661bfc5cb57695c271b320
/app/src/main/java/tr/edu/ufuk/siberguvenlikegitimi/genericList/GirisGenericList.java
5206008b15588f699ba3781bb08085694e7c0071
[]
no_license
mustafaergan/Siber-Guvenlik-Egitimi
9e068b1a7b06653b9af0e0bfe7ce0a9005b449a7
24bb26dc665a387ec7c4e14f023c7eb31b73535b
refs/heads/master
2020-05-30T15:52:16.625031
2019-06-02T10:09:10
2019-06-02T10:09:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,222
java
package tr.edu.ufuk.siberguvenlikegitimi.genericList; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; import tr.edu.ufuk.siberguvenlikegitimi.R; import tr.edu.ufuk.siberguvenlikegitimi.entity.ImageGenericList; /** * Created by mustafaergan. */ public class GirisGenericList extends BaseAdapter { private LayoutInflater layoutInflater; List<ImageGenericList> imageGenericListList; public GirisGenericList(Activity activity, List<ImageGenericList> imageGenericListList) { this.layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.imageGenericListList = imageGenericListList; } @Override public int getCount() { return imageGenericListList.size(); } @Override public Object getItem(int position) { return imageGenericListList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View myView; myView = layoutInflater.inflate(R.layout.generic_liste_image,null); TextView textViewName = (TextView) myView.findViewById(R.id.girisListName); ImageView ımageView = (ImageView)myView.findViewById(R.id.girisListImage); ImageGenericList person = this.imageGenericListList.get(position); textViewName.setText(person.getName()); for (ImageGenericList imageGenericList : imageGenericListList) { if (imageGenericList.getImageNumber() == 0) { ımageView.setImageResource(R.drawable.giris0); } else if (imageGenericList.getImageNumber() == 1) { ımageView.setImageResource(R.drawable.giris1); } else if (imageGenericList.getImageNumber() == 2) { ımageView.setImageResource(R.drawable.giris2); } } return myView; } }
581233f28337484b74d0a27670d146c096183d0e
9211886c9631c072d3aa6e8dfe642af0a3e78919
/src/main/java/com/brian/config/BrianTypeFilter.java
419a7d31289ff148d32e7a76e2b5722ff29e2cf8
[]
no_license
showkawa/spring-annotation
ee3e286e9a1c2c7706e527caf56d9f1e499db60f
1a04b7d5a32bcfb2e074dba5ea3362643a3d6d30
refs/heads/master
2022-08-09T16:47:20.174817
2022-07-06T09:57:44
2022-07-06T09:57:44
150,225,788
30
5
null
2022-06-28T06:15:10
2018-09-25T07:38:05
Java
UTF-8
Java
false
false
853
java
package com.brian.config; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.core.type.filter.TypeFilter; import java.io.IOException; public class BrianTypeFilter implements TypeFilter { /* * * metadataReader:读取到的当前正在扫描类的信息 * metadataReaderFactory: 可以获取到其他类的任何信息 * */ public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException { System.out.println("getClassMetadata--:" + metadataReader.getClassMetadata().getClassName()); if(metadataReader.getClassMetadata().getClassName().contains("BrianBeanFactory")) { return true; } return false; } }
1cb4ed333b563cc35bb0586e359896bfe723426f
1c31b9ec95619aa5573221614902cc2f9eeceb32
/koreaweather4j/src/kr/ac/chungbuk/bigdata/weather/main/DailyScrapSimpleWeatherData.java
615d517fb2dd94a3905a95ea3f1d83602b646ed0
[]
no_license
SuperMartin/KoreaWeather4j
030e243458bc88d172b0b6583365ae2dbcda9613
340fb3bd5389d3179eaef5454050f28f664df010
refs/heads/master
2021-01-01T18:37:46.168393
2016-10-26T14:04:42
2016-10-26T14:04:42
20,653,089
1
1
null
null
null
null
UTF-8
Java
false
false
3,957
java
package kr.ac.chungbuk.bigdata.weather.main; import java.io.FileNotFoundException; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import kr.ac.chungbuk.bigdata.weather.manager.DatabaseConnectionPoolManager2; import kr.ac.chungbuk.bigdata.weather.manager.HttpProtocolManager2; import kr.ac.chungbuk.bigdata.weather.model.KoreaWeatherSimpleModel; import kr.ac.chungbuk.bigdata.weather.util.ConfigUtil; import kr.ac.chungbuk.bigdata.weather.util.DateGenerator; import kr.ac.chungbuk.bigdata.weather.util.GeoLocationManager; import kr.ac.chungbuk.bigdata.weather.util.MarioService; /** * 어제 00시부터 23시 날씨데이터를 가져옴 * * @author HYUNA,Chihwan Choi([email protected]) * */ public class DailyScrapSimpleWeatherData { public void getData() throws FileNotFoundException, IOException, ParseException, InterruptedException { Properties prop = ConfigUtil.getXMLProperties("koreaweather4j.xml"); // CLI APACHE PR OJECT Logger logger = LoggerFactory.getLogger(DailyScrapSimpleWeatherData.class); logger.info("{}", "starting application"); logger.info("{}", "Initializing GeoLocationManager"); GeoLocationManager.initialize(); logger.info("{}", "Initializing GeoLocationManager...OK"); // AWS Data를 받아올 날짜 입력 (YYYYMMDDHHMM). null = 현재. // 추가해야 할 사항 : 1.과거 데이터 수집 시, From~To 기능 추가 / 2.일정 간격으로 계속 수집하는 기능 추가 SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH"); long yesterday = System.currentTimeMillis() - 1000 * 60 * 60 * 24; Date date = new Date(yesterday); String dateString = sdf.format(date); // System.out.println(dateString); dateString = dateString.subSequence(0, 11) + "00.00.00"; Date fromDate = sdf.parse(dateString); Date toDate = new Date((fromDate.getTime() + 1000 * 60 * 60 * 24)); // System.out.println(sdf.format(fromDate)); // System.out.println(sdf.format(toDate)); List<Date> dateList = DateGenerator.doDateGenerateYYYYMMDDHH(sdf.format(fromDate), sdf.format(toDate), true); for (Date inputDate : dateList) { // HttpProtocolManager2 httpMgr = new HttpProtocolManager2(); String httpRequest = httpMgr.getHttpURL(sdf.format(inputDate)); String responseHtml = httpMgr.getWeatherData(httpRequest); List<KoreaWeatherSimpleModel> koreaWeatherDataList = httpMgr.getKoreaSimpleWeatherDataList(responseHtml); // db에 저장. 현재 MySQL로 저장 가능한 상태. // 추가해야 할 사항 : 1.Create, Update 기능 추가 / 2.MS_SQL 연동 추가 DatabaseConnectionPoolManager2 database = new DatabaseConnectionPoolManager2(false, prop.getProperty("IPADDRESS"), prop.getProperty("PORT"), prop.getProperty("DATABASENAME"), prop.getProperty("USER"), prop.getProperty("PASSWORD"), prop.getProperty("TABLENAME")); long start = System.currentTimeMillis(); database.persistSimpleWeatherData(koreaWeatherDataList); long end = System.currentTimeMillis(); System.out.println("** Inserted Recoreds : " + koreaWeatherDataList.size() + " Working Time : " + (end - start) + " ms "); try { Thread.sleep(3000); // 1000 milliseconds is one second. } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } System.exit(0); // String inputDate = "201406201800"; // ex = "201405201800" } public static void main(String[] args) { MarioService.printMarioAsciiPictureR2(); DailyScrapSimpleWeatherData crawler = new DailyScrapSimpleWeatherData(); try { crawler.getData(); } catch (IOException | ParseException | InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
71070893238bbdcf0cc9b6507b9602fc68efa6fe
44292c4e6bce26b2209061664f344075ed983595
/loveouapprate/src/main/java/br/com/kikomesquita/loveouapprate/LoveOurAppRate.java
9eda2175a338b844122965351f9c5cef32192de1
[ "MIT" ]
permissive
kikomesquita/LoveOurAppRate-Android
065b98ca59415f262b3bddbcf23a352a50dbe2d0
1af4bcbc4d57e3fed91de33efc446dc792467716
refs/heads/master
2022-07-29T22:24:32.426762
2020-05-22T02:27:58
2020-05-22T02:27:58
265,997,618
0
0
null
null
null
null
UTF-8
Java
false
false
7,974
java
package br.com.kikomesquita.loveouapprate; import java.util.Date; import java.util.concurrent.TimeUnit; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.util.Log; public class LoveOurAppRate { private static final String TAG = LoveOurAppRate.class.getSimpleName(); private static final String PREF_NAME = "LoveOurAppRate"; private static final String KEY_INSTALL_DATE = "loar_install_date"; private static final String KEY_LAUNCH_TIMES = "loar_launch_times"; private static final String KEY_OPT_OUT = "loar_opt_out"; private static final String KEY_ASK_LATER_DATE = "loar_ask_later_date"; private static Date mInstallDate = new Date(); private static int mLaunchTimes = 0; private static boolean mOptOut = false; private static Date mAskLaterDate = new Date(); private static Config sConfig = new Config(); /** * Initialize configuration. * @param config Configuration object. */ public static void init(Config config) { sConfig = config; } /** * Call this API when the launcher activity is launched.<br> * It is better to call this API in onCreate() of the launcher activity. * @param context Context */ public static void onCreate(Context context) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); // If it is the first launch, save the date in shared preference. if (pref.getLong(KEY_INSTALL_DATE, 0) == 0L) { storeInstallDate(context, editor); } // Increment launch times int launchTimes = pref.getInt(KEY_LAUNCH_TIMES, 0); launchTimes++; editor.putInt(KEY_LAUNCH_TIMES, launchTimes); log("Launch times; " + launchTimes); editor.apply(); mInstallDate = new Date(pref.getLong(KEY_INSTALL_DATE, 0)); mLaunchTimes = pref.getInt(KEY_LAUNCH_TIMES, 0); mOptOut = pref.getBoolean(KEY_OPT_OUT, false); mAskLaterDate = new Date(pref.getLong(KEY_ASK_LATER_DATE, 0)); printStatus(context); } /** * Check whether the rate dialog should be shown or not. * Developers may call this method directly if they want to show their own view instead of * dialog provided by this library. * @return */ public static boolean shouldShowRateRequest() { if (mOptOut) { return false; } else { if (mLaunchTimes >= sConfig.mCriteriaLaunchTimes) { return true; } long threshold = TimeUnit.DAYS.toMillis(sConfig.mCriteriaInstallDays); // msec if (new Date().getTime() - mInstallDate.getTime() >= threshold && new Date().getTime() - mAskLaterDate.getTime() >= threshold) { return true; } return false; } } /** * Stop showing the rate request * @param context */ public static void stopRateRequest(final Context context){ setOptOut(context, true); } /** * Get count number of rate request launches * @return */ public static int getLaunchCount(final Context context){ SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); return pref.getInt(KEY_LAUNCH_TIMES, 0); } /** * Show the rate dialog if the criteria is satisfied. * @param context Context * @return true if shown, false otherwise. */ public static boolean showRateRequestIfNeeded(final Context context) { if (shouldShowRateRequest()) { showRateRequest(context); return true; } else { return false; } } protected static void clearSharedPreferences(Context context) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); editor.remove(KEY_INSTALL_DATE); editor.remove(KEY_LAUNCH_TIMES); editor.apply(); } /** * Set opt out flag. * If it is true, the rate dialog will never shown unless app data is cleared. * This method is called when Yes or No is pressed. * @param context * @param optOut */ protected static void setOptOut(final Context context, boolean optOut) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); editor.putBoolean(KEY_OPT_OUT, optOut); editor.apply(); mOptOut = optOut; } /** * Store install date. * Install date is retrieved from package manager if possible. * @param context * @param editor */ private static void storeInstallDate(final Context context, SharedPreferences.Editor editor) { Date installDate = new Date(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { PackageManager packMan = context.getPackageManager(); try { PackageInfo pkgInfo = packMan.getPackageInfo(context.getPackageName(), 0); installDate = new Date(pkgInfo.firstInstallTime); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } editor.putLong(KEY_INSTALL_DATE, installDate.getTime()); log("First install: " + installDate.toString()); } /** * Store the date the user asked for being asked again later. * @param context */ protected static void storeAskLaterDate(final Context context) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); editor.putLong(KEY_ASK_LATER_DATE, System.currentTimeMillis()); editor.apply(); } /** * Print values in SharedPreferences (used for debug) * @param context */ private static void printStatus(final Context context) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); log("*** LoveOuAppStatus Status ***"); log("Install Date: " + new Date(pref.getLong(KEY_INSTALL_DATE, 0))); log("Launch Times: " + pref.getInt(KEY_LAUNCH_TIMES, 0)); log("Opt out: " + pref.getBoolean(KEY_OPT_OUT, false)); } /** * Print log * @param message */ private static void log(String message) { Log.v(TAG, message); } public static void showRateRequest(Context context){ Intent i = new Intent(context, LoveOurAppRateActivity.class); i.putExtra("appPackageName", context.getPackageName() ); context.startActivity(i); } /** * configuration. */ public static class Config { public static final int CANCEL_MODE_BACK_KEY_OR_TOUCH_OUTSIDE = 0; public static final int CANCEL_MODE_BACK_KEY = 1; public static final int CANCEL_MODE_NONE = 2; private String mUrl = null; private int mCriteriaInstallDays; private int mCriteriaLaunchTimes; private int mCancelMode = CANCEL_MODE_BACK_KEY_OR_TOUCH_OUTSIDE; /** * Constructor with default criteria. */ public Config() { this(7, 10); } /** * Constructor. * * @param criteriaInstallDays * @param criteriaLaunchTimes */ public Config(int criteriaInstallDays, int criteriaLaunchTimes) { this.mCriteriaInstallDays = criteriaInstallDays; this.mCriteriaLaunchTimes = criteriaLaunchTimes; } } }
aee01637bddc291a5cb2698e8640cedb6e0cf2d7
d7c5f605608eb9b31a733b85eb7a24ddac3ca736
/Java 2 Projects/tellepet_Assignment08/src/SerializableObjectsPackage/ProgrammerMon.java
5393ca59960ae508a4dc52aef55fef0b4ea9324f
[]
no_license
navett52/Java-Repo
590ecaa79e813b5b9210cf32e3d4c2bdb6559407
4c3e915f8f907af26edb3cd3bd2215db84bab31e
refs/heads/master
2021-01-01T18:21:21.436951
2017-07-25T17:59:59
2017-07-25T17:59:59
98,320,335
0
0
null
null
null
null
UTF-8
Java
false
false
9,544
java
/****************************************************** * Evan Tellep * * Assignment 08 * * 03/10/2016 * * IT2045C (Computer Programming 2) * * Class used to define a programmer monster * * Ref: Friendship bread from Bill(what was posted) * ******************************************************/ package SerializableObjectsPackage; import java.io.Serializable; import java.util.ArrayList; public class ProgrammerMon implements Serializable { /** * */ private static final long serialVersionUID = -3054587322009948232L; // the list of languages the monster knows private ArrayList<String> Languages = new ArrayList<String>(); //The monster's given name private String name; //The monster's height in inches private int heightInches; //The monster's weight in pounds private int weightPounds; //How much the monster makes every hour private double hourlyRate; //The highest degree the monster has earned private String highestDegreeEarned; //Whether or not the monster wears glasses private Boolean wearsGlasses; /** * Constructs a monster based on parameters entered * @param name Name of the monster * @param heightInches Height of the monster in inches * @param weightPounds Weight of the monster in pounds * @param hourlyRate How much the monster makes every hour * @param highestDegreeEarned The highest degree the monster has earned * @param wearsGlasses Whether the monster wears glasses or not */ public ProgrammerMon(String name, int heightInches, int weightPounds, double hourlyRate, String highestDegreeEarned, Boolean wearsGlasses ) { this.name = name; this.heightInches = heightInches; this.weightPounds = weightPounds; this.hourlyRate = hourlyRate; this.highestDegreeEarned = highestDegreeEarned; this.wearsGlasses = wearsGlasses; } /** * Logic that compares the attributes of the monsters and determines if one is better than the other * @param opponent The monster to fight the current monster * @return True if the current object wins, false if the opponent wins */ public boolean Fight(ProgrammerMon opponent) { //Default battleForce for each programmer starts at 100 int thisBattleForce = 100; int opponentBattleForce = 100; //If the current object's name contains any of these "cool letters" making their name cool the current object gets +1 battle force for each "cool letter" for (int i = 0; i < this.name.length(); i++) { if (this.name.charAt(i) == 'x' || this.name.charAt(i) == 'z' || this.name.charAt(i) == 'v' || this.name.charAt(i) == 'q' || this.name.charAt(i) == 'n' || this.name.charAt(i) == 'j' || this.name.charAt(i) == 'e' || this.name.charAt(i) == 'X' || this.name.charAt(i) == 'Z' || this.name.charAt(i) == 'V' || this.name.charAt(i) == 'Q' || this.name.charAt(i) == 'N' || this.name.charAt(i) == 'J' || this.name.charAt(i) == 'E') { thisBattleForce ++; } thisBattleForce ++; } //If the opponent's name contains any of these "cool letters" making their name cool the opponent gets +1 battle force for each "cool letter" for (int i = 0; i < opponent.name.length(); i++) { if (opponent.name.charAt(i) == 'x' || opponent.name.charAt(i) == 'z' || opponent.name.charAt(i) == 'v' || opponent.name.charAt(i) == 'q' || opponent.name.charAt(i) == 'n' || opponent.name.charAt(i) == 'j' || opponent.name.charAt(i) == 'e' || opponent.name.charAt(i) == 'X' || opponent.name.charAt(i) == 'Z' || opponent.name.charAt(i) == 'V' || opponent.name.charAt(i) == 'Q' || opponent.name.charAt(i) == 'N' || opponent.name.charAt(i) == 'J' || opponent.name.charAt(i) == 'E') { opponentBattleForce ++; } opponentBattleForce ++; } //Whichever object is taller receives +5 to their battleForce if (this.heightInches > opponent.heightInches) { thisBattleForce += 5; } else { opponentBattleForce += 5; } //Whichever object weighs more receives +5 to their battleForce if (this.weightPounds > opponent.weightPounds) { thisBattleForce += 5; } else { opponentBattleForce += 5; } //Takes whichever object's hourly rate is higher and adds the difference in hourlyRates to that object's battleForce if (this.hourlyRate > opponent.hourlyRate) { thisBattleForce = thisBattleForce + ((int)this.hourlyRate - (int)opponent.hourlyRate); } else { opponentBattleForce = opponentBattleForce + ((int)opponent.hourlyRate - (int)this.hourlyRate); } //Adds more to this object's battleForce depending on what that highest degree earned is if (this.highestDegreeEarned == "High School Diploma") { thisBattleForce += 1; } else if (this.highestDegreeEarned == "Associates Degree") { thisBattleForce += 3; } else if (this.highestDegreeEarned == "Bachelor's Degree") { thisBattleForce += 5; } else if (this.highestDegreeEarned == "Master's Degree") { thisBattleForce += 8; } else if (this.highestDegreeEarned == "Doctorate" || this.highestDegreeEarned == "PhD") { thisBattleForce += 10; } //Adds more to the opponent's battleForce depending on what that highest degree earned is if (opponent.highestDegreeEarned == "High School Diploma") { opponentBattleForce += 1; } else if (opponent.highestDegreeEarned == "Associates Degree") { opponentBattleForce += 3; } else if (opponent.highestDegreeEarned == "Bachelor's Degree") { opponentBattleForce += 5; } else if (opponent.highestDegreeEarned == "Master's Degree") { opponentBattleForce += 8; } else if (opponent.highestDegreeEarned == "Doctorate" || this.highestDegreeEarned == "PhD") { opponentBattleForce += 10; } //If either object wears glasses they get +5 to their battleForce if (this.wearsGlasses == true) { thisBattleForce += 5; } else if (opponent.wearsGlasses == true) { opponentBattleForce += 5; } if (this.getLanguages() != null) { //Adds one to this object's battleForce for every language known, and adds +3 to it's battleForce for every popular* language it knows //* http://www.codingdojo.com/blog/9-most-in-demand-programming-languages-of-2016/ for (int i = 0; i < this.Languages.size(); i++) { if (this.Languages.get(i) == "Java" || this.Languages.get(i) == "SQL" || this.Languages.get(i) == "Javascript" || this.Languages.get(i) == "C#" || this.Languages.get(i) == "Python" || this.Languages.get(i) == "C++" || this.Languages.get(i) == "PHP" || this.Languages.get(i) == "IOS" || this.Languages.get(i) == "Ruby") { thisBattleForce += 3; } thisBattleForce ++; } } if (opponent.getLanguages() != null) { //Adds one to the opponent's battleForce for every language known, and adds +3 to the opponent's battleForce for every popular* language it knows //* http://www.codingdojo.com/blog/9-most-in-demand-programming-languages-of-2016/ for (int i = 0; i < opponent.Languages.size(); i++) { if (opponent.Languages.get(i) == "Java" || opponent.Languages.get(i) == "SQL" || opponent.Languages.get(i) == "Javascript" || opponent.Languages.get(i) == "C#" || opponent.Languages.get(i) == "Python" || opponent.Languages.get(i) == "C++" || opponent.Languages.get(i) == "PHP" || opponent.Languages.get(i) == "IOS" || opponent.Languages.get(i) == "Ruby") { opponentBattleForce += 3; } opponentBattleForce ++; } } System.out.println(this.name + "'s Battle Force is " + thisBattleForce); System.out.println(opponent.name + "'s Battle Force is " + opponentBattleForce); //Determines the winner by comparing battleForces if (thisBattleForce < opponentBattleForce) { return false; } return true; } // Todo write gets and sets for private members of the class. /** * Get languages list * @return list of languages */ public ArrayList<String> getLanguages() { return Languages; } /** * Get the amount of money the monster makes hourly * @return The amount of money the monster makes hourly */ public double getHourlyRate() { return hourlyRate; } /** * Get the highest degree the monster has earned * @return The highest degree earned */ public String getHighestDegreeEarned() { return highestDegreeEarned; } /** * Get whether or not the monster wears glasses * @return true if the monster wears glasses, false otherwise */ public Boolean getWearsGlasses() { return wearsGlasses; } /** * Get the name of the monster * @return The name of the monster */ public String getName() { return name; } /** * Get the height of the monster in inches * @return The height of the monster */ public int getHeightInches() { return heightInches; } /** * Get the weight of the monster in pounds * @return The weight of the monster */ public int getWeightPounds() { return weightPounds; } }
d1fcd901e55ea7666640f1b580e4b494842c869d
6bddfe245aefa4591d18c20c61407b215349ba2b
/src/main/java/lilypuree/forest_tree/datagen/Languages.java
94cc55ba7aa3ef7d902083205a53522e15375921
[]
no_license
lilypuree/ForestTree
53bcc9f5a8156439695fb96ca7141a9a78d667eb
e23ba0b28d232fe37fa778bde8acd4ea9539c578
refs/heads/master
2020-12-28T17:33:39.915847
2020-08-28T16:01:39
2020-08-28T16:01:39
238,422,214
2
0
null
null
null
null
UTF-8
Java
false
false
1,244
java
package lilypuree.forest_tree.datagen; import lilypuree.forest_tree.ForestTree; import lilypuree.forest_tree.Registration; import lilypuree.forest_tree.common.world.trees.gen.feature.parametric.Module; import lilypuree.forest_tree.common.world.trees.gen.feature.parametric.Parameter; import net.minecraft.data.DataGenerator; import net.minecraftforge.common.data.LanguageProvider; public class Languages extends LanguageProvider { public Languages(DataGenerator gen, String locale) { super(gen, ForestTree.MODID, locale); } @Override protected void addTranslations() { add(Registration.TREE_DESIGNER_BLOCK.get(), "Tree Designer"); add(Registration.CUSTOM_SAPLING.get(), "Custom Sapling"); add(Registration.GRAFTING_TOOL.get(), "Grafting Tool"); for (Module module : Module.values()){ for (Parameter parameter : Parameter.parameters[module.index]){ add("forest_tree.treedesignergui.parameters."+parameter.name, parameter.name); add("forest_tree.treedesignergui.descriptions."+parameter.name, "description here"); } add("forest_tree.treedesignergui.modules."+module.name(), module.name()); } } }
d0bd88db17acb6c12a3d9bb00071654f6f605554
ec0e94dd7f82c698ffed377c1b9603b108cee346
/S01.02-Exercise-AddWeatherList/app/src/main/java/com/example/android/sunshine/MainActivity.java
9bf05b19e30eef1a1a8a85ddcb0d2c056358ffe0
[ "Apache-2.0" ]
permissive
novelty105/sunshine
15078e6b95c13933e240c2ec292ec4687ac17f81
1ed306fb71963354f4205bf8cc15555d52d7510d
refs/heads/master
2020-03-18T22:12:45.153256
2018-05-29T18:15:48
2018-05-29T18:15:48
135,332,042
0
0
null
null
null
null
UTF-8
Java
false
false
1,567
java
/* * Copyright (C) 2016 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.example.android.sunshine; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity { // TODO (1) Create a field to store the weather display TextView TextView kekWeather; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forecast); // TODO (2) Use findViewById to get a reference to the weather display TextView kekWeather = (TextView) findViewById(R.id.tv_weather_data); // TODO (3) Create an array of Strings that contain fake weather data String[] pols = {"Cloud","Rainy","Sunny"}; // TODO (4) Append each String from the fake weather data array to the TextView for (String weathers : pols){ kekWeather.append(weathers + "\n\n\n"); } } }
0e35b87ca8d929540a5900d81ff25643da743e5e
7f9fa8221b7bc975beb5abc6c8add3028a6240f6
/java-demo-blahblah/src/main/java/com/zhangshixu/java/demo/blahblah/reflection/TestFields.java
4ccfde92e5081e4c74aa6f60193467db7384f95f
[]
no_license
darkhorsezsx/java-demo
9c9f3a7a8f0c8dc54fdb2a9db9e534a0ece64718
e43f5c5c91a85cc40de7d1d114fcec7e246183a6
refs/heads/master
2021-05-03T17:25:37.727847
2018-02-06T11:30:09
2018-02-06T11:30:09
120,444,707
0
0
null
null
null
null
UTF-8
Java
false
false
6,926
java
package com.zhangshixu.java.demo.blahblah.reflection; import com.zhangshixu.java.demo.blahblah.reflection.entity.Animal; import com.zhangshixu.java.demo.blahblah.reflection.entity.Person; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.*; /** * This is {@link TestFields}. * * @author Zhang Shixu * @since 0.0.1 */ public class TestFields { public static void main(String[] args) { Animal animal = new Animal("dog", 12, "zsx"); Animal animal2 = new Animal("cat", 12, "sss"); Person person = new Person("Jack", animal); Person person2 = new Person("Jack", animal); // System.out.println(contrastObj(animal, animal2)); System.out.println(compareFieldsV3(person, person2, new String[]{})); } /** * demo1 * @param obj1 * @param obj2 * @return */ public static boolean contrastObj(Object obj1, Object obj2) { boolean isEquals = true; if (obj1 instanceof Animal && obj2 instanceof Animal ) { Animal pojo1 = (Animal) obj1; Animal pojo2 = (Animal) obj2; List textList = new ArrayList<String>(); try { Class clazz = pojo1.getClass(); Field[] fields = pojo1.getClass().getDeclaredFields(); for (Field field : fields) { PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); Method getMethod = pd.getReadMethod(); Object o1 = getMethod.invoke(pojo1); Object o2 = getMethod.invoke(pojo2); if (!o1.toString().equals(o2.toString())) { isEquals = false; textList.add(getMethod.getName() + ":" + "false"); } else { textList.add(getMethod.getName() + ":" + "true"); } } } catch (Exception e) { } for (Object object : textList) { System.out.println(object); } } return isEquals; } /** * demo2 * @param obj1 * @param obj2 * @param ignoreArr * @return */ public static Map<String, List<Object>> compareFields(Object obj1, Object obj2, String[] ignoreArr) { try{ Map<String, List<Object>> map = new HashMap<String, List<Object>>(); List<String> ignoreList = null; if(ignoreArr != null && ignoreArr.length > 0){ ignoreList = Arrays.asList(ignoreArr); } if (obj1.getClass() == obj2.getClass()) {// 只有两个对象都是同一类型的才有可比性 Class clazz = obj1.getClass(); // 获取object的属性描述 PropertyDescriptor[] pds = Introspector.getBeanInfo(clazz, Object.class).getPropertyDescriptors(); for (PropertyDescriptor pd : pds) {// 这里就是所有的属性了 String name = pd.getName();// 属性名 if(ignoreList != null && ignoreList.contains(name)){// 如果当前属性选择忽略比较,跳到下一次循环 continue; } Method readMethod = pd.getReadMethod();// get方法 // 在obj1上调用get方法等同于获得obj1的属性值 Object o1 = readMethod.invoke(obj1); // 在obj2上调用get方法等同于获得obj2的属性值 Object o2 = readMethod.invoke(obj2); if(o1 == null && o2 == null){ continue; }else if(o1 == null && o2 != null){ List<Object> list = new ArrayList<Object>(); list.add(o1); list.add(o2); map.put(name, list); continue; } if (!o1.equals(o2)) {// 比较这两个值是否相等,不等就可以放入map了 List<Object> list = new ArrayList<Object>(); list.add(o1); list.add(o2); map.put(name, list); } } } return map; }catch(Exception e){ e.printStackTrace(); return null; } } /** * demo3 * @param obj1 * @param obj2 * @param ignoreArr * @return */ public static Map<String, Map<String,Object>> compareFieldsV3(Object obj1, Object obj2, String[] ignoreArr) { try{ Map<String, Map<String,Object>> map = new HashMap<>(); Map<String, Object> objMap1 = new HashMap<>(); Map<String, Object> objMap2 = new HashMap<>(); map.put("former", objMap1); map.put("latter", objMap2); List<String> ignoreList = null; if(ignoreArr != null && ignoreArr.length > 0){ ignoreList = Arrays.asList(ignoreArr); } if (obj1.getClass() == obj2.getClass()) {// 只有两个对象都是同一类型的才有可比性 Class clazz = obj1.getClass(); // 获取object的属性描述 PropertyDescriptor[] pds = Introspector.getBeanInfo(clazz, Object.class).getPropertyDescriptors(); for (PropertyDescriptor pd : pds) {// 这里就是所有的属性了 String name = pd.getName();// 属性名 if(ignoreList != null && ignoreList.contains(name)){// 如果当前属性选择忽略比较,跳到下一次循环 continue; } Method readMethod = pd.getReadMethod();// get方法 // 在obj1上调用get方法等同于获得obj1的属性值 Object o1 = readMethod.invoke(obj1); // 在obj2上调用get方法等同于获得obj2的属性值 Object o2 = readMethod.invoke(obj2); if(o1 == null && o2 == null){ continue; }else if(o1 == null && o2 != null){ objMap1.put(name, o1); objMap2.put(name, o2); continue; } if (!o1.equals(o2)) {// 比较这两个值是否相等,不等就可以放入map了 objMap1.put(name, o1); objMap2.put(name, o2); } } } return map; }catch(Exception e){ e.printStackTrace(); return null; } } }
53f8b643034c2460225882b66733b3acb2caa6a3
4f55eb5487c62936502153e799b9ab21687d265b
/hihsoft-sso/JavaSource/com/hihframework/core/utils/StringHelpers.java
007ee36d01885fa527326392f0539d202cad8b2c
[ "Apache-2.0" ]
permissive
qinglinGG/sso
00edd3ac8723a1c60039b3e4d3b87531baa9a18f
d5867b6eab25015e146431f1c5927160652e7a08
refs/heads/master
2021-01-20T01:35:18.900427
2017-04-26T02:35:48
2017-04-26T02:35:48
89,302,895
0
0
null
2017-04-25T01:21:29
2017-04-25T01:21:29
null
UTF-8
Java
false
false
26,668
java
/** * Copyright (c) 2013-2015 www.javahih.com * * Licensed under the Apache License, Version 2.0 (the "License"); */ package com.hihframework.core.utils; import java.io.UnsupportedEncodingException; import java.lang.reflect.Method; import java.math.BigDecimal; import java.util.List; import org.apache.commons.lang.RandomStringUtils; /** * <p> Title: 字符处理辅助类:主要处理字符的各种操作</p> * <p> Description:字符追加、字符替换、字符编码转换、各种类型的转化</p> * <p> Copyright: Copyright (c) 2013 </p> * <p> Company:hihsoft.co.,ltd </p> * * @author hihsoft.co.,ltd * @version 1.0 */ public class StringHelpers { /** The Constant chr. */ public final static char[] chr = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; // 将字符串转换成BigDecimal类型 /** * To big decimal. * * @param bigdecimal the bigdecimal * @return the big decimal */ public static BigDecimal toBigDecimal(final String bigdecimal) { if (bigdecimal == null) { return null; } if (bigdecimal.length() < 1) { return null; } try { return new BigDecimal(bigdecimal); } catch (final Exception e) { return null; } } // 1 -> '0001' /** * Gets the number string. * * @param i the i * @param length the length * @return the number string */ public static String getNumberString(final int i, final int length) { String sret = String.valueOf(i); final int lack = length - sret.length(); if (lack == 0) { return sret; } if (lack > 0) { for (int x = 0; x < lack; x++) sret = "0" + sret; } else { sret = sret.substring(0 - lack, sret.length()); } return sret; } // 1 -> '0001' /** * Gets the number string. * * @param i the i * @param length the length * @return the number string */ public static String getNumberString(final long i, final int length) { String sret = String.valueOf(i); final int lack = length - sret.length(); if (lack == 0) { return sret; } if (lack > 0) { for (int x = 0; x < lack; x++) sret = "0" + sret; } else { sret = sret.substring(0 - lack, sret.length()); } return sret; } // 将字符串转换成符合HTML页面以及其表单显示的字符串 /** * To form input. * * @param oldValue the old value * @return the string */ public static String toFormInput(final String oldValue) { if (oldValue == null) { return null; } String szTemp = ""; final int len = oldValue.length(); for (int i = 0; i < len; i++) switch (oldValue.charAt(i)) { case 34: // '"' szTemp = szTemp + "&quot;"; break; default: szTemp = szTemp + oldValue.charAt(i); break; } return szTemp; } // 将字符串中的oldtext用newtext来替换掉 // 如:"hello world"中的" "用"_"替换,就成了:"hello_world" /** * Replace. * * @param source the source * @param oldtext the oldtext * @param newtext the newtext * @return the string */ public static String Replace(final String source, final String oldtext, final String newtext) { if ((source == null) || (oldtext == null) || (newtext == null)) { return null; } String temp1 = source; String temp = ""; for (int index = temp1.indexOf(oldtext); index >= 0; index = temp1.indexOf(oldtext)) { temp = temp + temp1.substring(0, index) + newtext; temp1 = temp1.substring(index + oldtext.length(), temp1.length()); } temp = temp + temp1; return temp; } // 将字符串形式的浮点数值转换成浮点数,如:"234.7"-->234.7 // 可以处理象"12,345.7"的形式 /** * To float. * * @param value the value * @return the float */ public static float toFloat(final String value) { if (value == null) { return 0.0F; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final float f = Float.parseFloat(szTemp); return f; } catch (final NumberFormatException e) { final float f1 = 0.0F; return f1; } } // 将字符串形式的浮点数值转换成浮点数,如:"234.7"-->234.7 // 可以处理象"12,345.7"的形式 /** * To double. * * @param value the value * @return the double */ public static double toDouble(final String value) { if (value == null) { return 0.0D; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final double d = Double.parseDouble(szTemp); return d; } catch (final NumberFormatException e) { final double d1 = 0.0D; return d1; } } // 将字符串形式的长整型值转换成长整数,如:"234"-->234 // 可以处理象"12,345"的形式 /** * To long. * * @param value the value * @return the long */ public static long toLong(final String value) { if (value == null) { return 0L; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final double dd = Double.parseDouble(szTemp); final long l1 = (long) dd; return l1; } catch (final NumberFormatException e) { final long l = 0L; return l; } } // 将字符串形式的整型值转换成整数,如:"234"-->234 // 可以处理象"12,345"的形式 /** * To int. * * @param value the value * @return the int */ public static int toInt(final String value) { return (int) toLong(value); } // 将对象转换成字符串 /** * To string. * * @param obj the obj * @return the string */ public static String toString(final Object obj) { if (obj == null) { return ""; } else { return obj.toString(); } } /** * 将数字转换成用'a'-'z'表示的字符串;1='a'...26='z',27='aa'...52='zz'等 * 等于将十进制转换成二十六进制 * * @param num the num * @return the string */ public static String toAbcNumber(final int num) { int i = num; final StringBuffer str = new StringBuffer(); if (i <= 0) { return ""; } do { str.insert(0, chr[(i - 1) % chr.length]); i = i / chr.length; if ((i > 0) && (i < chr.length)) { str.insert(0, chr[i - 1]); } } while (i > chr.length); return str.toString(); } /** * 缩简字符串的函数 * 例如:"abcdef,akd;adf" 变成 "abcdef,a..." * 可以指定长度和最后的字符串 * * @param source the source * @param lststr the lststr * @param length the length * @param iscodelen the iscodelen * @return the string */ public static String trimString(final String source, final String lststr, final int length, final boolean iscodelen) { if ((source == null) || (source.trim().length() == 0) || (length <= 0)) { return source; } final String endStr = (lststr != null) ? lststr : "..."; String result = source.trim(); final int len = (endStr.length() < length) ? (length - endStr.length()) : 2; final byte[] sbytes = result.getBytes(); if (length < (iscodelen ? sbytes.length : result.length())) { if (iscodelen) { if (new String(sbytes, 0, len).length() == 0) { result = new String(sbytes, 0, len - 1) + endStr; } else { result = new String(sbytes, 0, len) + endStr; } } else { result = source.substring(0, len) + endStr; } } return result; } /** * 将字符串转换成垂直显示的HTML格式代码 * 在每一个字符的后面加上一个<br>. * * @param source the source * @param lstline the lstline * @param length the length * @param iscodelen the iscodelen * @return the string */ public static String toTrimHtmlVerticalString(final String source, final String lstline, final int length, final boolean iscodelen) { if ((source == null) || (source.trim().length() == 0) || (length <= 0)) { return source; } String dst = source.trim(); final byte[] sbytes = dst.getBytes(); boolean istrim = false; if (length < (iscodelen ? sbytes.length : dst.length())) { istrim = true; if (iscodelen) { if (new String(sbytes, 0, length).length() == 0) { dst = new String(sbytes, 0, length - 1); } else { dst = new String(sbytes, 0, length); } } else { dst = dst.substring(0, length); } } final int len = dst.length(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < (len - 1); i++) { result.append(dst.charAt(i)).append("<br>"); } if (istrim && (lstline != null) && (lstline.trim().length() > 0)) { result.append(lstline.trim()); } else { result.append(dst.charAt(len - 1)); } return result.toString(); } /** * 将字符串转换成垂直显示的HTML格式代码 * 在每一个字符的后面加上一个<br>. * * @param source the source * @return the string */ public static String toHtmlVerticalString(final String source) { if ((source == null) || (source.trim().length() == 0)) { return source; } final String tmp = source.trim(); final int len = tmp.length(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < (len - 1); i++) { result.append(tmp.charAt(i)).append("<br>"); } result.append(tmp.charAt(len - 1)); return result.toString(); } /** * 缩简字符串的函数 * 例如:"abcdef,akd;adf" 变成 "abcdef,a..." * 可以指定长度和最后的字符串 * * @param source the source * @return the short string */ // 无参数,取缺省参数 public static String getShortString(final String source) { final int len = 10; final String endStr = "..."; String result = source; if ((source != null) && (source.length() > len)) { result = source.substring(0, len) + endStr; } return result; } // 指定长度 /** * Gets the short string. * * @param source the source * @param length the length * @return the short string */ public static String getShortString(final String source, final int length) { final int len = (length > 0) ? length : 10; final String endStr = "..."; String result = source; if ((source != null) && (source.length() > len)) { result = source.substring(0, len) + endStr; } return result; } // 指定长度与最后字符串 /** * Gets the short string. * * @param source the source * @param length the length * @param lastStr the last str * @return the short string */ public static String getShortString(final String source, final int length, final String lastStr) { final int len = (length > 0) ? length : 10; final String endStr = (lastStr != null) ? lastStr : "..."; String result = source; if ((source != null) && (source.length() > len)) { result = source.substring(0, len) + endStr; } return result; } // 计算次方 /** * P. * * @param a the a * @param b the b * @return the double */ public static double P(final int a, final int b) { int result = 1; for (int i = 0; i < b; i++) result = result * a; return result; } /** * P. * * @param a the a * @param b the b * @return the double */ public static double P(final float a, final int b) { float result = 1; for (int i = 0; i < b; i++) result = result * a; return result; } // 将整数值转换成二进制数组,如 13(10)=1101(2),即1,3,4位为真,第2位为假(假设第一位为1) // 输入参数:整数数值value,数组长度length /** * Gets the bin array. * * @param value the value * @param length the length * @return the bin array */ public static int[] getBinArray(final int value, final int length) { if ((value < 0) || (length <= 0)) { return null; } final int len = (length > 32) ? 32 : length; // 限定最多32位长度 int val = value; final int[] binbit = new int[len]; for (int i = 0; i < len; i++) { if ((val % 2) == 1) { binbit[i] = 1; } else { binbit[i] = 0; } val = val >> 1; } return binbit; } /** * 换行,空格字符的替换操作. * * @param in 要进行转换的字符串 * @return 替换后的字符串 */ public static String replaceNewLine(final String in) { if (in == null) { return null; } char ch; final char[] input = in.toCharArray(); final int len = input.length; final StringBuffer out = new StringBuffer((int) (len * 1.3)); for (int index = 0; index < len; index++) { ch = input[index]; if (ch == '\n') { out.append("<br>"); } else if (ch == ' ') { out.append("&nbsp;"); } else { out.append(ch); } } return out.toString(); } /** * 把字符串的字符集从ISO转换为gb2312. * * @param in 输入的ISO字符串 * @return GB2312字符串 */ public static String convertIso8859ToGb2312(final String in) { String out = null; byte[] ins = null; try { ins = in.getBytes("iso-8859-1"); } catch (final UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { out = new String(ins, "gb2312"); } catch (final UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return out; } /** * 把字符串的字符集从GB2312转换为ISO. * * @param in 输入的GB2312字符串 * @return ISO字符串 */ public static String convertGb2312ToIso8859(final String in) { String out = null; try { final byte[] ins = in.getBytes("gb2312"); out = new String(ins, "iso-8859-1"); } catch (final Exception e) { } return out; } /** * Convert utf to gbk. * * @param in the in * @return the string */ public static String convertUtfToGBK(final String in) { String out = null; try { final byte[] ins = in.getBytes("UTF-8"); out = new String(ins, "ISO-8859-1"); } catch (final Exception e) { } return out; } /** * 去掉字符串两头的空格. * * @param str 待处理的字符串 * @return 处理后的字符串 */ public static String convertNullToString(final String str) { if (str == null) { return ""; } else { final int len = str.length(); for (int i = 0; i < len; i++) { if (str.charAt(i) != ' ') break; } return str.trim(); } } /** * 检查电子邮件合法性. * * @param email 带验证的电子邮件地址 * @return true表示合法 false表示非法 */ public static boolean checkEmailIsValid(final String email) { boolean isok = false; if (email.equals("") || email == "" || email == null) isok = false; for (int i = 1; i < email.length(); i++) { final char s = email.charAt(i); if (s == '@') { isok = true; break; } } return isok; } /** * 替换字符串某些字符操作. * * @param str 原始的字符串 例如:bluesunny * @param pattern 配备的字符 例如:blue * @param replace 替换为的字符 例如:green * @return 返回处理结果 例如:greensunny */ public static String replace(final String str, final String pattern, String replace) { if (replace == null) { replace = ""; } int s = 0, e = 0; final StringBuffer result = new StringBuffer(str.length() * 2); while ((e = str.indexOf(pattern, s)) >= 0) { result.append(str.substring(s, e)); result.append(replace); s = e + pattern.length(); } result.append(str.substring(s)); return result.toString(); } /** * 判断字符串是否为数字类型. * * @param str 待处理的字符串 * @return true表示为数字类型 false表示为非数字类型 */ public static boolean isNumber(final String str) { if (str == null || str.equals("")) { return false; } String sStr = ""; int m = 0; m = str.indexOf("."); for (int j = 0; j < str.length(); j++) { if (m != j) sStr = sStr + str.charAt(j); } final byte[] btyeStr = sStr.getBytes(); for (int i = 0; i < btyeStr.length; i++) { if ((btyeStr[i] < 48) || (btyeStr[i] > 57)) { return false; } } return true; } /** * 把string型字符串转为整型. * * @param str 待处理的字符串 * @return 整数 */ public static int strToInt(final String str) { int i = 0; if (str != null && str.length() != 0) { try { i = Integer.parseInt(str.trim()); } catch (final NumberFormatException nfe) { nfe.printStackTrace(); } } return i; } /** * 把string型字符串转为Double. * * @param str 待处理的字符串 * @return double */ public static double strToDouble(final String str) { double i = 0; if (str != null && str.length() != 0) { try { i = Double.parseDouble(str.trim()); } catch (final NumberFormatException nfe) { nfe.printStackTrace(); } } return i; } /** * 产生随机字符串. * * @return the string */ public static String createRandomString() { String random = null; // 产生随机字符串 random = RandomStringUtils.randomAlphabetic(10); // 随机字符串再加上当前的日期时间 long random += DateUtils.getNowDateTimeToLong(); return random; } /** * 将Id数组转换成逗号分隔的字符串. * * @param fid the fid * @return the string */ public static final String comboIdStr(final String[] fid) { String IdStr = ""; for (int i = 0; i < fid.length; i++) { IdStr += fid[i]; if (i != fid.length - 1) IdStr += ","; } return IdStr; } /** * 将带特殊分隔符的字符串转换为按照指定替换符的字符串. * * @param oldValue the old value * @param separateChar the separate char * @param replaceStr the replace str * @return the tree level value */ public static final String getTreeLevelValue(final String oldValue, final String separateChar, final String replaceStr) { final String[] spStr = oldValue.split(separateChar); String tmp = ""; for (int i = 0; i < spStr.length - 1; i++) { tmp += replaceStr; } return tmp; } /** * 2006-1.11zhujw add * 把数组字符串转化成'1','2','3'格式 * * @param fid the fid * @return the string */ public static final String StrComboId(final String[] fid) { final StringBuffer str = new StringBuffer(""); for (int i = 0; i < fid.length; i++) { str.append("'").append(fid[i]).append('\''); if (i != fid.length - 1) str.append(','); } return str.toString(); } /** * String >> char[] >> byte[] >> String * 解决JSP中的中文问题. * * @param source the source * @return the string */ public static String toByteString(final String source) { if (source == null) { return null; } if (source.length() == 0) { return ""; } final char[] chars = source.toCharArray(); final byte[] bytes = new byte[source.length() * 2]; int index = 0; for (int i = 0, charValue = 0; (i < chars.length) && (index < (chars.length * 2)); i++) { charValue = chars[i]; if (charValue > 255) { try { final byte[] tmp = (new Character(chars[i])).toString().getBytes("GB2312"); for (int j = 0; j < tmp.length; j++) { bytes[index] = tmp[j]; index++; } } catch (final Exception e) { e.printStackTrace(); } } else { bytes[index] = (byte) chars[i]; index++; } } return new String(bytes, 0, index); } // unicode -> 8859-1 charset /** * To_iso_8859_1. * * @param source the source * @return the string */ public static String to_iso_8859_1(final String source) { if (source == null) { return null; } try { final String s = new String(source.getBytes(), "iso-8859-1"); return s; } catch (final Exception uee) { final String s1 = null; return s1; } } // 8859-1 -> unicode charset /** * From_iso_8859_1. * * @param source the source * @return the string */ public static String from_iso_8859_1(final String source) { if (source == null) { return null; } try { final String s = new String(source.getBytes("iso-8859-1")); return s; } catch (final Exception uee) { final String s1 = null; return s1; } } /** * 首字母大写. * * @param arg the arg * @return the string */ public static String fistCapital(String arg) { if (arg != null && !arg.trim().equals("")) { arg = arg.replaceFirst(String.valueOf(arg.charAt(0)), String.valueOf(arg.charAt(0)).toUpperCase()); } return arg; } /** * Index of ignore case. * * @param src the src * @param subS the sub s * @param startIndex the start index * @return the int */ public static int indexOfIgnoreCase(final String src, final String subS, final int startIndex) { final String sub = subS.toLowerCase(); final int sublen = sub.length(); final int total = src.length() - sublen + 1; for (int i = startIndex; i < total; i++) { int j = 0; while (j < sublen) { final char source = Character.toLowerCase(src.charAt(i + j)); if (sub.charAt(j) != source) { break; } j++; } if (j == sublen) { return i; } } return -1; } /** * Equals. * * @param obj1 the obj1 * @param obj2 the obj2 * @return true, if successful */ public static boolean equals(final Object obj1, final Object obj2) { if (obj1 == null && obj2 == null) { return true; } else if (obj1 != null) { return obj1.equals(obj2); } else { return obj2.equals(obj1); } } /** * 是否为空 * @param obj * @return * @author Xiaojf * @since 2011-5-24 */ public static boolean isNull(Object obj) { return obj == null || "".equals(obj); } /** * 是否非空 * @param obj * @return * @author Xiaojf * @since 2011-5-24 */ public static boolean notNull(Object obj) { return !isNull(obj); } /** * 将字符患的首字母大写 * @param source * @return * @author Xiaojf * @since 2011-6-24 */ public static String upperFirst(String source) { if (isNull(source)) return ""; return source.substring(0, 1).toUpperCase() + source.substring(1); } /** * 首字母小写 * @param source * @return * @author Xiaojf * @since 2011-9-14 */ public static String lowerFirst(String source) { if (isNull(source)) return source; return source.substring(0, 1).toLowerCase() + source.substring(1); } /** * 把集合中的某一字段用逗号连接起来,用来拼装SQL语句 * @param datas * @param field * @return * @author Xiaojf * @since 2011-9-14 */ public static String join(List<?> datas, String field) { return join(datas, ",", "'", field); } /** * 把集合中的某一字段用指定的符号连接起来,用来拼装SQL语句 * @param datas * @param field * @return * @author Xiaojf * @since 2011-9-14 */ public static String join(List<?> datas, String parttern, String wrapChar, String field) { if (datas == null || datas.isEmpty()) return wrapChar + wrapChar; String[] strs = new String[datas.size()]; Method getter = null; int index = 0; for (Object t : datas) { if (getter == null) { try { getter = t.getClass().getDeclaredMethod("get"+ upperFirst(field)); } catch (Exception e) {} } if (getter != null) { Object o = null; try { o = getter.invoke(t); } catch (Exception e) {} if (o == null) continue; strs[index++] = o.toString(); } } return join(strs, parttern, wrapChar); } /** * 把数组中的某一字段用逗号连接起来,用来拼装SQL语句 * @param ts * @return * @author Xiaojf * @since 2011-9-14 */ public static String join(Object[] ts) { return join(ts, ",", "'"); } /** * 把数组中的某一字段用指定的符号连接起来,用来拼装SQL语句 * @param ts * @param parttern * @param wrapChar * @return * @author Xiaojf * @since 2011-9-14 */ public static String join(Object[] ts, String parttern, String wrapChar) { StringBuffer s = new StringBuffer(); if (ts == null) return s.toString(); if (isNull(parttern)) parttern = ""; if (isNull(wrapChar)) wrapChar = ""; for (Object obj : ts) { if (isNull(obj)) continue; s.append(wrapChar + obj + wrapChar + parttern); } if (s.length() > 0) s.setLength(s.length() - 1); return s.toString(); } /** * 获取对象对应的表名,如对象名为TsysOrg,则转换的表名为:T_SYS_ORG * @param obj * @return * @author xjf721 * @since 2011-10-18 */ public static String getTableName(Class<?> clazz) { String root = ReflectUtil.getRootClassName(clazz); StringBuffer sb = new StringBuffer(); int count = 0; for (int i = 0; i < root.length(); i++) { char c = root.charAt(i); if (c >= 65 && c <=90) { if (count > 0) sb.append("_"); count++; } sb.append(c); } return sb.toString().toUpperCase(); } public static String encodeToUrl(String value) { try { String v = java.net.URLEncoder.encode(value, "UTF-8"); return v.replaceAll("\\+", "%20"); } catch (Exception e) {} return value; } }
9ace2ec8bdca0d3172282b168d8097f1dfb26500
b0a3f31816ad429c075c28d4f5e30d7ab42452a7
/backend/src/main/java/com/devsuperior/dscatalog/resources/exceptions/ValidationError.java
0b6ac5bdeb4f39090f12656ee75ee6468be28e3d
[]
no_license
Geraldo-git/dscatalog-devsuperior-aula
790c997b933a1660679591abd72b4de19d990062
0412292d60b1e1f25ed5250e6f4d8ef9d4257afa
refs/heads/main
2023-08-24T14:39:22.036893
2021-10-06T13:48:56
2021-10-06T13:48:56
406,493,760
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.devsuperior.dscatalog.resources.exceptions; import java.util.ArrayList; import java.util.List; public class ValidationError extends StandardError { private static final long serialVersionUID = 1L; private List<FieldMessage> errors = new ArrayList<>(); public List<FieldMessage> getErrors() { return errors; } public void addError(String fieldName, String message) { errors.add(new FieldMessage (fieldName,message)); } }
7b56eb22fa6f801e5470e3df9d60f7e2a8f711e8
cbdd81e6b9cf00859ce7169df36cf566417e4c8b
/3.JavaMultithreading/src/com/javarush/task/task28/task2805/MyThread_01.java
d2068ea5685aa846aa8af943ed5a1b35624daa45
[]
no_license
id2k1149/JavaRushTasks
3f13cd5d37977e38e8933e581f17fd48597f90d8
450a432649aa20608e6e9a46ada35123056480cf
refs/heads/master
2023-03-31T21:03:06.944109
2021-03-19T00:58:45
2021-03-19T00:58:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package com.javarush.task.task28.task2805; import java.util.concurrent.atomic.AtomicInteger; public class MyThread_01 extends Thread { private static final AtomicInteger number = new AtomicInteger(1); public MyThread_01() { if (number.get() == 11) { number.set(1); } setPriority(number.getAndIncrement()); } public MyThread_01(ThreadGroup group, String name) { if (number.get() == group.getMaxPriority() + 1) { number.set(1); } setPriority(number.getAndIncrement()); } public MyThread_01(Runnable target) { super(target); } public MyThread_01(ThreadGroup group, Runnable target) { super(group, target); } public MyThread_01(String name) { super(name); } public MyThread_01(Runnable target, String name) { super(target, name); } public MyThread_01(ThreadGroup group, Runnable target, String name) { super(group, target, name); } public MyThread_01(ThreadGroup group, Runnable target, String name, long stackSize) { super(group, target, name, stackSize); } }
2c118fe1075ccb1c09d66e644a8f29ad19747e93
606a53102e1c26c7422af6da8d28633ec2056267
/weevent-processor/src/main/java/com/webank/weevent/processor/utils/CommonUtil.java
c59aa0d861b73718e74ce845fce154b842c81b98
[ "Apache-2.0" ]
permissive
jevyma/WeEvent
3e3e08a36cc6a20ec79474c02f06f4ac9e00e5eb
76a39814e91c70f0e4fc271c1337e803981b9044
refs/heads/master
2020-08-27T16:15:25.402748
2019-10-25T03:08:31
2019-10-25T03:08:31
216,731,534
1
0
Apache-2.0
2019-10-22T05:40:06
2019-10-22T05:40:03
null
UTF-8
Java
false
false
4,812
java
package com.webank.weevent.processor.utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.util.StringUtils; @Slf4j public class CommonUtil { /** * check the database url * * @param databaseUrl data bae url * @return connection */ public static Connection getConnection(String databaseUrl) { String driver = "com.mysql.jdbc.Driver"; try { Class.forName(driver); return DriverManager.getConnection(databaseUrl); } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } catch (SQLException e) { e.printStackTrace(); return null; } } public static String urlPage(String url) { String page = null; String[] arrSplit; String urlTemp = url.trim().toLowerCase(); arrSplit = urlTemp.split("[?]"); if ((urlTemp.length()) > 0 && (arrSplit.length >=1) && (arrSplit[0] != null)) { page = arrSplit[0]; } return page; } private static String truncateUrlPage(String strURL) { String strAllParam = null; String url = strURL.trim().toLowerCase(); String[] arrSplit = url.split("[?]"); if ((url.length() > 1) && (arrSplit.length) > 1 && (arrSplit[1] != null)) { strAllParam = arrSplit[1]; } return strAllParam; } public static Map<String, String> uRLRequest(String URL) { Map<String, String> mapRequest = new HashMap<String, String>(); String[] arrSplit = null; String strUrlParam = truncateUrlPage(URL); if (strUrlParam == null) { return mapRequest; } arrSplit = strUrlParam.split("[&]"); for (String strSplit : arrSplit) { String[] arrSplitEqual = null; arrSplitEqual = strSplit.split("[=]"); if (arrSplitEqual.length > 1) { mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]); } else { if (!arrSplitEqual[0].equals("")) { mapRequest.put(arrSplitEqual[0], ""); } } } return mapRequest; } public static List<String> getKeys(String objJson) { List<String> keys = new ArrayList<>(); try { if (checkValidJson(objJson)) { for (Map.Entry<String, Object> entry : JSONObject.parseObject(objJson).entrySet()) { keys.add(entry.getKey()); } } else { keys = null; } } catch (JSONException e) { keys = null; log.info("json get key error"); } return keys; } /** * check valid json string * * @param test json string * @return true or false */ public final static boolean checkValidJson(String test) { try { JSONObject.parseObject(test); } catch (JSONException ex) { try { JSONObject.parseArray(test); } catch (JSONException ex1) { return false; } } return true; } public static boolean checkJson(String content, String objJson) { boolean tag = true; //parsing and match if (!StringUtils.isEmpty(content) && !StringUtils.isEmpty(objJson)) { List<String> contentKeys = getKeys(content); List<String> objJsonKeys = getKeys(objJson); // objJsonKeys must longer than the contentKeys if (contentKeys.size() > objJsonKeys.size()) { tag = false; } else { for (String contentKey : contentKeys) { if (!objJsonKeys.contains(contentKey)) { tag = false; } } } } log.info("checkJson tag:{}", tag); return tag; } public static Map<String, Integer> contactsql(String content, String objJson) { Map<String, Integer> sql = new HashMap<>(); if (!StringUtils.isEmpty(content) && !StringUtils.isEmpty(objJson)) { List<String> objJsonKeys = getKeys(objJson); for (String key : objJsonKeys) { sql.put(key, 0); if (!content.contains(key)) { sql.put(key, 1); } } } return sql; } }
7e81e8dc45496bb72a5af01be01e0cb347483a19
fbdb3a00076e895c190919081822feebc539db1e
/src/java/minhtn/tblCar/TblCarDTO.java
e7694ada675dd96714316d4f3bb53d4973da25a8
[]
no_license
minh2ws/J3LP0015_CarRental
c4cac9dee1c31339b60c6af18d7fd0d7fe277504
80ab8a8a0fdcf8791bdd3350cb59753ac3f4c17d
refs/heads/main
2023-04-03T02:46:28.868032
2021-04-11T07:39:06
2021-04-11T07:39:06
356,799,989
0
0
null
null
null
null
UTF-8
Java
false
false
3,260
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 minhtn.tblCar; import java.io.Serializable; import java.sql.Date; /** * * @author minhv */ public class TblCarDTO implements Serializable { private String carID; private String carName; private String image; private String color; private Date year; private double price; private int quantity; private String description; private String categoryId; public TblCarDTO() { } public TblCarDTO(String carID, String carName, String image, String color, Date year, double price, int quantity, String description, String categoryId) { this.carID = carID; this.carName = carName; this.image = image; this.color = color; this.year = year; this.price = price; this.quantity = quantity; this.description = description; this.categoryId = categoryId; } /** * @return the carID */ public String getCarID() { return carID; } /** * @param carID the carID to set */ public void setCarID(String carID) { this.carID = carID; } /** * @return the carName */ public String getCarName() { return carName; } /** * @param carName the carName to set */ public void setCarName(String carName) { this.carName = carName; } /** * @return the image */ public String getImage() { return image; } /** * @param image the image to set */ public void setImage(String image) { this.image = image; } /** * @return the color */ public String getColor() { return color; } /** * @param color the color to set */ public void setColor(String color) { this.color = color; } /** * @return the year */ public Date getYear() { return year; } /** * @param year the year to set */ public void setYear(Date year) { this.year = year; } /** * @return the price */ public double getPrice() { return price; } /** * @param price the price to set */ public void setPrice(double price) { this.price = price; } /** * @return the quantity */ public int getQuantity() { return quantity; } /** * @param quantity the quantity to set */ public void setQuantity(int quantity) { this.quantity = quantity; } /** * @return the description */ public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * @return the categoryId */ public String getCategoryId() { return categoryId; } /** * @param categoryId the categoryId to set */ public void setCategoryId(String categoryId) { this.categoryId = categoryId; } }
7c2fc35737f1b833731830e2cad6b46269afc255
59d50c6c2b093c68c877eaee2877537438562987
/app/src/main/java/com/bringin/iak/giziremaja/Kategori.java
c9e99269144a9f432de2f61db1dbe9daf264f204
[]
no_license
yogiyulianto/GiziRemaja
bef71ec4990d646bad377091c09711f8fd3d09f8
1d803ba99bd8d10d79774be975030c9fe8417136
refs/heads/master
2021-04-09T15:39:35.967497
2018-03-20T04:11:51
2018-03-20T04:11:51
125,723,609
0
1
null
2018-03-20T04:52:44
2018-03-18T12:40:51
Java
UTF-8
Java
false
false
770
java
package com.bringin.iak.giziremaja; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Kategori extends AppCompatActivity { Button btnNexti; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kategori); btnNexti = findViewById(R.id.btn_next_faktor); btnNexti.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent pindahActivity = new Intent(getApplicationContext(), indeks.class); startActivity(pindahActivity); } }); } }
dadf6bd0b846550d23122ac33f3c2248781d20c6
467d91329c0047a2c9eda3fd07d6c3cad05def5c
/src/test/java/com/qa/capturefailedscreenshot/CaptureFailedScreenShot.java
87170895970b9d40c9f28390f60dd7a718b55e23
[]
no_license
wilsonfernandes1991/TestngRetryLogic
0a50512a2e3cf1c12f3cd16fb1c07a3780f302ab
9d5a0078a6b245a524eff387aebb23e4143e5a34
refs/heads/master
2021-04-06T13:44:44.091485
2018-03-10T18:21:15
2018-03-10T18:21:15
124,650,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,220
java
package com.qa.capturefailedscreenshot; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import org.testng.Assert; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; public class CaptureFailedScreenShot { @Test public void sample1Test() { Assert.assertTrue(false); } @Test public void sample2Test() { Assert.assertTrue(true); } @AfterMethod public void afterMethod(ITestResult t) throws Exception { if(!t.isSuccess()) { System.out.println(""+t.getName()); captureScreenShot(t.getName()); } } public void captureScreenShot(String methodName) throws Exception { System.out.println("Capturing Screenshot for failed test '"+methodName+"'..."); String screenshotFilePath = "Resources\\Screenshot\\"+methodName+".png"; Robot robot = new Robot(); Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage screenFullImage = robot.createScreenCapture(screenRect); ImageIO.write(screenFullImage, "png", new File(screenshotFilePath)); } }
c276ffeccf38ed176b45123d6365d2b8e7e48a4a
0d8f2002f045a92f44569732fdd5ba202f514b02
/72/Solution.java
9ff76d4718a881880fc016ddaeb6c36af583de16
[]
no_license
LunaMing/LeetCodeRepo
5184fd7695e7502cb9e73affbba477ff7c3c258f
700fbc06c40daffa1bf306c0fabb86fe8f535bca
refs/heads/master
2021-05-24T09:07:58.271049
2020-05-07T11:01:11
2020-05-07T11:01:11
253,487,087
0
0
null
null
null
null
UTF-8
Java
false
false
10,697
java
import static java.lang.Math.max; import static java.lang.Math.min; public class Solution { public int minDistance(String word1, String word2) { return this.MyLeetcodeTry(word1, word2); } public int MyLeetcodeTry(String word1, String word2) { int len1 = word1.length(); int len2 = word2.length(); int[][] dp = new int[len1 + 1][len2 + 1]; for (int i = 0; i <= len1; i++) { dp[i][0] = i; } for (int i = 0; i <= len2; i++) { dp[0][i] = i; } int a, b, c; for (int i = 1; i <= len1; i++) { for (int j = 1; j <= len2; j++) { a = dp[i - 1][j - 1]; b = dp[i][j - 1]; c = dp[i - 1][j]; if (word1.charAt(i - 1) != word2.charAt(j - 1)) dp[i][j] = Math.min(a, Math.min(b, c)) + 1; else dp[i][j] = a; } } return dp[len1][len2]; } public int LeetcodeMinDis(String word1, String word2) { int n = word1.length(); int m = word2.length(); // 有一个字符串为空串 if (n * m == 0) return n + m; // DP 数组 int[][] D = new int[n + 1][m + 1]; // 边界状态初始化 for (int i = 0; i < n + 1; i++) { D[i][0] = i; } for (int j = 0; j < m + 1; j++) { D[0][j] = j; } // 计算所有 DP 值 for (int i = 1; i < n + 1; i++) { for (int j = 1; j < m + 1; j++) { int left = D[i - 1][j] + 1; int down = D[i][j - 1] + 1; int left_down = D[i - 1][j - 1]; if (word1.charAt(i - 1) != word2.charAt(j - 1)) left_down += 1; D[i][j] = Math.min(left, Math.min(down, left_down)); } } return D[n][m]; } public int MyMinDis(String word1, String word2) { if (word1.length() == 0) return word2.length(); if (word2.length() == 0) return word1.length(); if (word1.equals(word2)) return 0; int maxLength = Math.max(word1.length(), word2.length()); int lengthOfSubS = word1.length(); int start, end, indexContain; int distance = 0, minDis = maxLength; while (lengthOfSubS > 0) { start = 0; end = lengthOfSubS; for (int i = 0; i < word1.length() - lengthOfSubS + 1; i++) { String tempSubString = word1.substring(start, end); indexContain = word2.indexOf(tempSubString, 0); //有某一位相同,进入子串分支求和 if (indexContain >= 0) { distance = 0;//清空改动计数器 //前半部分 String tempWord1 = word1.substring(0, start); String tempWord2 = word2.substring(0, indexContain); distance += this.MyMinDis(tempWord1, tempWord2); //后半部分 tempWord1 = word1.substring(end); tempWord2 = word2.substring(indexContain + lengthOfSubS); distance += this.MyMinDis(tempWord1, tempWord2); //比较是不是最小改动 minDis = Math.min(minDis, distance); } while (indexContain > 0) { //查看剩余位是否相同 indexContain = word2.indexOf(tempSubString, indexContain + 1); //有某一位相同,进入子串分支求和 if (indexContain >= 0) { distance = 0;//清空改动计数器 //前半部分 String tempWord1 = word1.substring(0, start); String tempWord2 = word2.substring(0, indexContain); distance += this.MyMinDis(tempWord1, tempWord2); //后半部分 tempWord1 = word1.substring(end); tempWord2 = word2.substring(indexContain + lengthOfSubS); distance += this.MyMinDis(tempWord1, tempWord2); //比较是不是最小改动 minDis = Math.min(minDis, distance); } } //word1换一个子串查 start++; end++; } lengthOfSubS--; if (distance > 0 && lengthOfSubS > 3) { //如果在这个位数下面已经有结果了,还继续嘛? //试一下少一位,最多也就是差一位吧?? //嗯 个位就不用试了 没意义 start = 0; end = lengthOfSubS; for (int i = 0; i < word1.length() - lengthOfSubS + 1; i++) { String tempSubString = word1.substring(start, end); indexContain = word2.indexOf(tempSubString, 0); //有某一位相同,进入子串分支求和 if (indexContain >= 0) { distance = 0;//清空改动计数器 //前半部分 String tempWord1 = word1.substring(0, start); String tempWord2 = word2.substring(0, indexContain); distance += this.MyMinDis(tempWord1, tempWord2); //后半部分 tempWord1 = word1.substring(end); tempWord2 = word2.substring(indexContain + lengthOfSubS); distance += this.MyMinDis(tempWord1, tempWord2); //比较是不是最小改动 minDis = Math.min(minDis, distance); } //查看剩余位是否相同 while (indexContain > 0) { indexContain = word2.indexOf(tempSubString, indexContain + 1); //有某一位相同,进入子串分支求和 if (indexContain >= 0) { distance = 0;//清空改动计数器 //前半部分 String tempWord1 = word1.substring(0, start); String tempWord2 = word2.substring(0, indexContain); distance += this.MyMinDis(tempWord1, tempWord2); //后半部分 tempWord1 = word1.substring(end); tempWord2 = word2.substring(indexContain + lengthOfSubS); distance += this.MyMinDis(tempWord1, tempWord2); //比较是不是最小改动 minDis = Math.min(minDis, distance); } } //word1换一个子串查 start++; end++; } break; } } if (distance == 0) { //说明没有任意一位相同 return maxLength; } return minDis; } public int minDisWrong(String word1, String word2) { if (word1.length() == 0) return word2.length(); if (word2.length() == 0) return word1.length(); char chCompare; int index1 = 0, index2 = 0; int indexSame = 0, indexStart2 = 0; int dis2 = 0, dis1 = 0; int distance = 0;//按照本次长度比较得到的改动数 int minDis = Math.max(word1.length(), word2.length());//最终 while (indexStart2 < word2.length()) { //从头开始比较 index1 = 0; index2 = indexStart2; dis2 = indexStart2;//从第几位开始比较,之前的所有都算2的改动 distance = 0;//清空之前的dis while (index1 < word1.length() && index2 < word2.length()) { chCompare = word2.charAt(index2); indexSame = word1.indexOf(chCompare, index1); if (indexSame == -1) { dis2++;//如果没有相同字符,计入字符串2的改动 } else { //如果有相同,标记改动,计数 dis1 = indexSame - index1;//字符串1的改动数,是相同的字符之间的间隔 distance += Math.max(dis1, dis2);//计算总改动 dis1 = 0;//清空计数器 dis2 = 0;//清空计数器 index1 = indexSame + 1;//字符串1的指针移到字符相同的位置,的下一个位置 } index2++; if (index2 >= word2.length()) { //如果2比较结束,就结束整段比较 distance += Math.max(dis2, word1.length() - index1); } if (index1 >= word1.length()) { //如果1比较结束,就结束整段比较 distance += word2.length() - index2; } } minDis = Math.min(distance, minDis);//验证是最小的方案 indexStart2++;//每一轮比较都向后找一位word2 } return minDis; } public static void main(String[] args) { Solution s = new Solution(); int n; n = s.minDistance("horse", "ros");//3 System.out.println(n); n = s.minDistance("mart", "karma");//3 System.out.println(n); n = s.minDistance("intention", "execution");//5 System.out.println(n); n = s.minDistance("execution", "intention");//5 System.out.println(n); n = s.minDistance("", "a");//1 System.out.println(n); n = s.minDistance("a", "ab");//1 System.out.println(n); n = s.minDistance("ab", "bc");//2 System.out.println(n); n = s.minDistance("sea", "ate");//3 System.out.println(n); n = s.minDistance("industry", "interest");//6 System.out.println(n); n = s.minDistance("prosperity", "properties");//4 System.out.println(n); n = s.minDistance("a", "a");//0 System.out.println(n); n = s.minDistance("abcdxabcde", "abcdeabcdx");//2 System.out.println(n); n = s.minDistance("dinitrophenylhydrazine", "acetylphenylhydrazine");//6 System.out.println(n); } }
d8d68695030e9f3fb2cae1568e8ed2c2a5e2d5ba
1d15f8f60b8b76778f4f2316dab43f3a9c4b2d91
/app/src/main/java/tasmi/rouf/com/json/MyJSON.java
ebb057cced792424637834af718ecdd59ec1979f
[]
no_license
fajaralmu/android001-simple-scoring-app
5eaea1ec89002c2598be283225907e59dd6ab3d1
1386e7ed0fde3712b3f79ca619c47d09ab49f714
refs/heads/master
2020-04-25T15:40:27.270643
2019-08-19T04:29:55
2019-08-19T04:29:55
172,886,368
0
0
null
null
null
null
UTF-8
Java
false
false
7,604
java
package tasmi.rouf.com.json; import android.util.Log; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import tasmi.rouf.com.util.Constant; public class MyJSON { public static String[] getObjFromArray2(String arrayJSON) { String[] objs = {}; arrayJSON = arrayJSON.replace("},{", "ڑ"); System.out.println(arrayJSON); if (arrayJSON.charAt(0) == '[' && arrayJSON.charAt(arrayJSON.length() - 2) == ']') { objs = arrayJSON.split("ڑ"); } return objs; } public static int lastCharOfProp(int mulai, String s) { int x = 0; int y = 0; for (int i = mulai; i < s.length(); i++) { char c = s.charAt(i); if (c == '{') { x++; } if (c == '}' && x > 0) { x--; } if (c == '[') { y++; } if (c == ']' && y > 0) { y--; } if (x == 0 && y == 0) { return i; } } return mulai; } public static List<String> getObjFromArray(String json) { List<String> obj_list = new ArrayList<String>(); boolean inobj = false; String nowObj = ""; for (int i = 0; i < json.length() - 1; i++) { char c = json.charAt(i); if (c == '{') { nowObj = ""; int nextI = lastCharOfProp(i, json); for (int y = i + 2; y < nextI - 1; y++) { nowObj += json.charAt(y); } i = nextI++; obj_list.add(nowObj); continue; } } return obj_list; } public static List<String> getObjFromArra3y(String json) { List<String> obj_list = new ArrayList<>(); boolean inobj = false; String nowObj = ""; for (int i = 0; i < json.length() - 1; i++) { char c = json.charAt(i); if (c == '{' && !inobj) { inobj = true; continue; } if (inobj) { if (c == '}' && (json.charAt(i + 1) == ']' || (json.charAt(i + 1) == ',' && json .charAt(i + 2) == '{'))) { inobj = false; obj_list.add(nowObj); nowObj = ""; continue; } nowObj += c; } } return obj_list; } public static List<String> extractObj(String obj) { boolean inproperty = false; String nowProp = ""; String cleanQuotes = ""; StringBuilder sb = new StringBuilder(obj); if (sb.charAt(0) == '{') { sb.deleteCharAt(0); if (sb.charAt(sb.length() - 1) == '}') { sb.deleteCharAt(sb.length() - 1); } } // Log.i(Constant.tag,sb.toString()); obj = sb.toString(); Log.i(Constant.tag,"OBJ"+obj); for (int i = 0; i < obj.length(); i++) { char c = obj.charAt(i); if (c == '"') { if (i > 0 && obj.charAt(i - 1) == '\\') { cleanQuotes += c; } else { } } else { cleanQuotes += c; } } List<String> listProp = new ArrayList<String>(); inproperty = true; for (int i = 0; i < cleanQuotes.length(); i++) { char c = cleanQuotes.charAt(i); if (c == '{' || c == '[') { i = lastCharOfProp(i, cleanQuotes); continue; } if (c == ',') { listProp.add(nowProp); nowProp = ""; } else { nowProp += c; } if (i == cleanQuotes.length() - 1) { listProp.add(nowProp); } } return listProp; } public static String[] propVal(String s) { String[] cc = new String[]{"0", "0"}; String prop = ""; String val = ""; boolean nowPropName = true; if (s.contains(":")) { for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == ':') { nowPropName = false; continue; } if (nowPropName) { prop += c; } else { val += c; } } } cc[0] = prop; cc[1] = val; // if(cc[0].equals("nilai")) // Log.i(Constant.tag,"NILAI_PROP: "+ cc[1]); return cc; } private static String eliminateGet(String s) { s = s.substring(3); s = s.toLowerCase(); return s; } private static String eliminateSet(String s) { s = s.substring(3); s = s.toLowerCase(); return s; } private static boolean validate(String function) { if (function.contains("_")) { return false; } return true; } private static String capitalize(final String line) { return Character.toUpperCase(line.charAt(0)) + line.substring(1); } public static Object getObj(Object o, List<String[]> props) { Class<? extends Object> c = o.getClass(); Object obj = null; try { obj = c.newInstance(); Method[] methods = c.getDeclaredMethods(); for (String[] s : props) { String propName = capitalize(s[0]); for (int i = 0; i < methods.length; i++) { String methodName = methods[i].getName(); if (!validate(methodName)) continue; if (methodName.startsWith("get")) { String prop = eliminateGet(methodName); Class<?> returnType = methods[i].getReturnType(); final String functionName = "set" + capitalize(prop); Method set = c.getMethod(functionName, returnType); if(prop.equals("namakelas")) Log.i(Constant.tag,"RETURN TYPE:"+ returnType.getName()); if (prop.toLowerCase().equals(propName.toLowerCase())) { String propToSet = s[1]; // System.out.println(prop+":"+s[1]); if (prop.toLowerCase().equals("nilai")) Log.i(Constant.tag, "NILAI: " + s[1]); if (returnType.equals(Integer.class)) { Integer val = !propToSet.matches("-?\\d+") ? 0 : Integer.parseInt(propToSet); set.invoke(obj, val); } else set.invoke(obj, propToSet); } } } } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return obj; } }