blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
31d07acb41428b948851a9b817495869d4af0e5a
2c2634f55a8d75e60b015337b84af367b4761bba
/src/main/java/com/weis/startfun/chat/controller/ChatHandler.java
689d7fc00123df04439b9148dd5c3024377a1a1a
[]
no_license
hasunzo/startfun_v2
b73b0f3d6cc18317ca74e151a8b9e794b9e4ca38
4332af9583d4fcca30fb45adbdc8a9d407fdd21f
refs/heads/master
2023-06-19T22:42:45.349955
2021-07-15T08:05:34
2021-07-15T08:05:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,632
java
package com.weis.startfun.chat.controller; import java.util.ArrayList; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.catalina.tribes.MembershipService; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.TextWebSocketHandler; import com.fasterxml.jackson.databind.ObjectMapper; import com.weis.startfun.chat.model.ChatMessageVO; import com.weis.startfun.chat.model.ChatRoomVO; import com.weis.startfun.chat.service.ChatService; @Controller public class ChatHandler extends TextWebSocketHandler implements InitializingBean { @Autowired ChatService chatservice; private final ObjectMapper objectMapper = new ObjectMapper(); // session, 회원 이메일 private Map<WebSocketSession, String> memberSessionList = new ConcurrentHashMap<WebSocketSession, String>(); // 채팅방 목록 <방 번호, ArrayList<session> >이 들어간다. 해당 방번호에 접속해있는 세션(회원) private Map<Integer, ArrayList<WebSocketSession>> RoomList = new ConcurrentHashMap<Integer, ArrayList<WebSocketSession>>(); // session, 방 번호가 들어간다. 해당 세션(회원)이 가지고 있는 방번호 private Map<WebSocketSession, Integer> sessionList = new ConcurrentHashMap<WebSocketSession, Integer>(); private static int i; // websocket 연결 성공 시 @Override public void afterConnectionEstablished(WebSocketSession session) throws Exception { i++; } // websocket 연결 종료 시 @Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { i--; // sessionList에 session이 있다면 if(sessionList.get(session) != null) { // 해당 session의 방 번호를 가져와서, 방을 찾고, 그 방의 ArrayList<session>에서 해당 session을 지운다. RoomList.get(sessionList.get(session)).remove(session); sessionList.remove(session); } // memberSessionList에 session이 있다면 if(memberSessionList.get(session) != null) { memberSessionList.remove(session); } } // websocket 메세지 수신 및 송신 @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { // HandshakeInterceptor 에서 저장했던 회원 이메일 Map<String, Object> map = session.getAttributes(); String userEmail = (String) map.get("userEmail"); // 헤더에 저장 될 세션 - 알림용 if(message.getPayload().equals("alarm")) { memberSessionList.put(session, userEmail); } // 채팅 시 else { // 전달받은 메세지 String msg = message.getPayload(); // Json객체 -> Java객체 // 출력값 : [room_id=123, messageId=null, message=asd, name=홍길동, email=user01@gmail.com, unread_count=0] ChatMessageVO chatMessage = objectMapper.readValue(msg, ChatMessageVO.class); // 받은 메세지에 담긴 room_id로 해당 채팅방을 찾아온다. ChatRoomVO chatRoom = chatservice.selectChatRoom(chatMessage.getRoom_id()); // 채팅 세션 목록에 채팅방이 존재하지 않고, 처음 들어왔고(입장 시 message="ENTER_CHAT"로 보냄), DB에서의 채팅방이 있을 때 // 채팅 세션 목록에 채팅방 생성 if(RoomList.get(chatRoom.getRoom_id()) == null && chatMessage.getMessage().equals("ENTER-CHAT") && chatRoom != null) { // 채팅방에 들어갈 session들 // Map<String, ArrayList<WebSocketSession>> RoomList ArrayList<WebSocketSession> sessionTwo = new ArrayList<>(); // session 추가 sessionTwo.add(session); // RoomList에 추가 RoomList.put(chatRoom.getRoom_id(), sessionTwo); // sessionList에 추가 // Map<WebSocketSession, String> sessionList sessionList.put(session, chatRoom.getRoom_id()); } // 채팅방이 존재하고, 처음 들어왔고, DB에서의 채팅방이 있을 때 else if(RoomList.get(chatRoom.getRoom_id()) != null && chatMessage.getMessage().equals("ENTER-CHAT") && chatRoom != null) { // RoomList에서 해당 방번호를 가진 방이 있는지 확인하고 해당 방번호에 session(회원)을 add 시킨다. RoomList.get(chatRoom.getRoom_id()).add(session); // sessionList에 추가 sessionList.put(session, chatRoom.getRoom_id()); } // 채팅방이 존재하고, 채팅 메세지를 입력했고, DB에서의 채팅방이 있을 때 else if(RoomList.get(chatRoom.getRoom_id()) != null && !chatMessage.getMessage().equals("ENTER-CHAT") && chatRoom != null) { // 메세지에 이름, 이메일, 내용을 담는다. TextMessage textMessage = new TextMessage(chatRoom.getMaster_email() + "," +chatMessage.getName() + "," + chatMessage.getEmail() + "," + chatMessage.getMessage()+ ","+chatMessage.getRoom_id()); // 현재 session 수 int sessionCount = 0; // 해당 채팅방의 session에 뿌려준다. for(WebSocketSession sess : RoomList.get(chatRoom.getRoom_id())) { sess.sendMessage(textMessage); sessionCount++; } /* 알림 보내기 알림을 받는 사람(receiver) 지정하기 1. user가 보낸경우 - master 2. master가 답장한 경우 - user */ String receiver; if (chatRoom.getUser_email().equals(chatMessage.getEmail())) { receiver = chatRoom.getMaster_email(); } else { receiver = chatRoom.getUser_email(); } /* // value값만 알고있는 상태 -> value값으로 key값을 찾기 Set<Map.Entry<WebSocketSession, String>> entries = memberSessionList.entrySet(); for (Map.Entry<WebSocketSession, String> entry : entries) { if(entry.getValue()==receiver) { entry.getKey().sendMessage(new TextMessage("알림")); } } */ for ( WebSocketSession sess : memberSessionList.keySet() ) { if(memberSessionList.get(sess).equals(receiver)) { sess.sendMessage(textMessage); } } // 동적쿼리에서 사용할 sessionCount 저장 // sessionCount == 2 일 때는 unread_count = 0, // sessionCount == 1 일 때는 unread_count = 1 chatMessage.setSession_count(sessionCount); // DB에 저장한다. int a = chatservice.insertMessage(chatMessage); } } } @Override public void afterPropertiesSet() throws Exception {} }
[ "soob312@naver.com" ]
soob312@naver.com
04fe5a408a1a72077b38eedb01f9aae899ff6385
2de0a4d2d155596d216d50e08dd741eef98c2de1
/src/main/java/com/data/base/util/ConfigRef.java
b868e2255781a3d0fe0c132b8ed45e34c84551d9
[]
no_license
jinny-c/dataProcessing
8e49424a35cbd93ad26b13149b212be3908fb017
bb8a1f7ff3393eeb72213d05e441c64a2224e339
refs/heads/master
2021-06-11T05:57:38.458184
2021-03-04T06:33:35
2021-03-04T06:33:35
156,349,853
2
0
null
2021-03-04T07:37:06
2018-11-06T08:20:16
Java
UTF-8
Java
false
false
874
java
package com.data.base.util; public final class ConfigRef { /** 参数配置 */ public final static String ES_CLIENT_PORT = PropertiesUtil.getProperty("es.client.port"); public final static String ES_CLIENT_IP = PropertiesUtil.getProperty("es.client.ip"); public final static String ES_CLIENT_CLUSTER_NAME = PropertiesUtil.getProperty("es.client.cluster.name"); public final static String SPARK_ES_NODES = PropertiesUtil.getProperty("spark.es.nodes"); public final static String SPARK_ES_PORT = PropertiesUtil.getProperty("spark.es.port"); public final static String SPARK_ES_CLUSTER_NAME = PropertiesUtil.getProperty("spark.es.cluster.name"); public final static String ES_8583_INDEX_NAME = PropertiesUtil.getProperty("es.8583.index.name"); public final static String ES_8583_INDEX_TYPE = PropertiesUtil.getProperty("es.8583.index.type"); }
[ "jidd@DESKTOP-TOSRB4H" ]
jidd@DESKTOP-TOSRB4H
58247a1af94688f6e5700aa81ba6c1190f4ebc40
cffebcaf52fa01ad9fabd0a27cbe23932ece7b24
/BasicCode/src/ArrayListTest/ArrayListTest2.java
088cb7a9197380ecb2f943ea4a4e9d4bbe743688
[]
no_license
pupu12138/JavaStudy
09852a23c6dc80ec9450509a15ab015da097eee5
2385cd78f8993ccb07a3e24427209ae5dd2bbbf0
refs/heads/master
2023-08-22T13:32:53.569974
2021-09-21T11:21:21
2021-09-21T11:21:21
408,775,337
0
0
null
null
null
null
GB18030
Java
false
false
612
java
package ArrayListTest; import java.util.ArrayList; /** * @author WYZ * @creat 2021-06-15 13:57 */ public class ArrayListTest2 { public static void main(String[] args) { // ArrayList<String> arr = new ArrayList(); <>进行类型限制 ArrayList<String> arr = new ArrayList(); // 调用对象的add方法 // arr.add(123); arr.add("111"); arr.add("222"); arr.add("333"); arr.add("444"); // arr.add(int index,element:"000");指定插入位置。 arr.add(2,"000"); // arr.add(true); System.out.println(arr); } }
[ "990716wuyuzhu" ]
990716wuyuzhu
63ed59427d1c6c93a814d2646128d98b01e6e47f
40a852c145cb40ffcba2b3c031f16528ede1c7be
/src/vinea/pnode/Pnode.java
b750b09ee74d4d117dd9732c7b75e778e3a7574e
[ "LicenseRef-scancode-other-permissive" ]
permissive
gabrielecastellano/vinea
118b3c4ec63a0b54869a5abf9050b7f8b744c6e4
1235fa59797d79b04596d75d2d2cd1ad186bd34d
refs/heads/master
2020-03-24T18:57:41.155720
2013-12-08T19:43:33
2013-12-08T19:43:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
49,779
java
/** * @copyright 2013 Computer Science Department laboratory, Boston University. * All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation * for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all * copies and that both the copyright notice and this permission notice appear in supporting documentation. * The laboratory of the Computer Science Department at Boston University makes no * representations about the suitability of this software for any purpose. */ package vinea.pnode; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Set; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import rina.cdap.impl.googleprotobuf.CDAP; import rina.cdap.impl.googleprotobuf.CDAP.CDAPMessage; import rina.dap.Application; import rina.ipcProcess.impl.IPCProcessImpl; import rina.rib.impl.RIBImpl; import vinea.config.CADConfig; import vinea.impl.googleprotobuf.CAD; import vinea.message.impl.CADMessageImpl; import vinea.pnode.agreement.impl.NodeAgreementImpl; import vinea.pnode.bidding.impl.NodeBiddingImpl; import vinea.pnode.linkEmbedding.impl.LinkEmbeddingImpl; import vinea.pnode.util.BiddingData; import vinea.pnode.util.PnodeUtil; import vinea.slicespec.impl.googleprotobuf.SliceSpec; import vinea.slicespec.impl.googleprotobuf.SliceSpec.Slice; import vinea.sp.slicegenerator.SliceGenerator; //TODO: physical nodes needs to be aware of the physical topology or we can't bootstrap /** * core class of CADSys: physical nodes, gets authenticated and run the CAD protocol * * @author Flavio Esposito * @version 1.0 */ public class Pnode extends Application { /** * adjacent Links id */ private LinkedHashMap<Integer, LinkedList<Integer>> _adjacentLinksMap = null; /** * <sliceID, <adjecent link, bandwidth>> */ private LinkedHashMap<Integer, LinkedHashMap<Integer, Double> > _adjacentBandwidthMap= null; /** * allocation policy default MAD (SAD or MAD or write your own) */ private String _allocationPolicy= "MAD"; /** * list of pnodes reachable from this */ private LinkedList<String> _appsReachable = null; /** * allocation vector for each slice hosted or in hosting attempt <sliceID, <vnode, pnodeNameOrAddress>> */ private LinkedHashMap<Integer, LinkedHashMap<Integer,String>> _allocationVectorMap = null; /** * bid vector for each slice hosted or in hosting attempt */ private LinkedHashMap<Integer, LinkedList<Double>> _bidVectorMap = null; /** * <sliceID, <vNodeID, biddingTime>> */ private LinkedHashMap<Integer, LinkedHashMap<Integer,Long>> _biddingTimeMap = null; /** * pnode configuration file */ private CADConfig _CADconfig= null; /** * node identifier: for now this is redundant with applicationName */ private int _id = -1; /** * current adjacent incoming link capacity */ private double _incomingLinkCapacity = 0.0; /** * current adjacent incoming link capacity */ private double _outgoingLinkCapacity = 0.0; /** * bundle vector for each slice hosted or in hosting attempt */ private LinkedHashMap<Integer, LinkedList<Integer>> _mMap = null; /** * service providers can send requests for embedding */ private String _mySP = null; /** * InP manager (don't send bid message to him) */ private String _myManager = null; /** * <sliceID,<pnode id, vnode id>> known so far */ private LinkedHashMap<Integer,LinkedHashMap<Integer, Integer>> _nodeMappingMap = null; /** * to reset to this value when the bundle is reset */ private double _nodeStressBeforeThisSliceRequest = 0.01; /** * global node capacity */ private double _nodeStress = 0.01; /** * pnode utility function */ private PnodeUtil _NodeUtil= null; /** * ISP owner of this physical node */ private String _owner = null; /** * application name */ private String _pNodeName = null; /** * initial stress on physical node */ private double _stress = 0.01; /** * target node capacity */ private double _targetNodeCapacity = 100.0; /** * target adjacent link capacity */ private double _targetLinkCapacity = 500.0; /** * target stress */ private double _targetStress = 1.0; /** * <sliceID, iteration_t > */ private LinkedHashMap<Integer, Integer> _iterationMap =null; /** * node bidding utility function */ private String nodeUtility = null;//cad.utility = utility1 /** * assignment Vector: least or most informative (x or a) */ private String assignmentVectorPolicy = null; //# least or most cad.assignmentVector = least /** * bidVectorLength */ private int bidVectorLengthPolicy = 0;// cad.bidVectorLength = 1 /** * owner ISP */ private String ownerISP = null; /** * in case a pnode is an ISP */ private LinkedHashMap<Integer, Pnode> pnodeChildren = null; /** * <dest pnode ID, next hop pnode ID> */ private LinkedHashMap<Integer,Integer> fwTable = null; /** * kill this node's communication */ private boolean stop = false; /** * node bidding implementation */ private NodeBiddingImpl _biddingImpl = null; /** * node agreement implementation */ private NodeAgreementImpl _agreementImpl = null; /** * partial replica of RIB for bidding and agreement */ private BiddingData _currentBiddingData = null; /** * list of embedded sliceIDs seen so far by this pnode */ private LinkedList<Integer> _embeddedSlices = null; /** * instance to call message implementation */ private CADMessageImpl cadMsgImpl = new CADMessageImpl(); /** * ongoing slice to be embedded */ private LinkedHashMap<Integer,Slice> _onGoingEmbedding = new LinkedHashMap<Integer,Slice>(); /** * Link embedding implementation */ private LinkEmbeddingImpl _linkEmbeddingImpl = null; /** * this constructor should be used if the policies are given * to the node by the slice manager (SM) * @param appName */ public Pnode(String pNodeName, String IDDName) { super(pNodeName, IDDName); //initialize the pnode this.set_pNodeName(pNodeName); this.initPnode_noConfigFile(); this._biddingImpl = new NodeBiddingImpl(this.rib,pNodeName); this._agreementImpl = new NodeAgreementImpl(this.rib,pNodeName); this._currentBiddingData = new BiddingData(); this._linkEmbeddingImpl = new LinkEmbeddingImpl(super.rib); //TODO: load private policies from config file (those that cannot be given by InPManager) } /** * this constructor should be used if the policies are given * to the node by the CAD configuration file --- fully distributed architecture * without slice manager (controller) * @param appName * @param IDDName */ public Pnode(String pNodeName, String IDDName, String CADconfigFile) { super(pNodeName, IDDName); //load CAD config file this._CADconfig = new CADConfig(CADconfigFile); //initialize the pnode this.set_pNodeName(pNodeName); this.initPnode(); this._biddingImpl = new NodeBiddingImpl(this.rib, pNodeName); this._agreementImpl = new NodeAgreementImpl(this.rib,pNodeName); this._currentBiddingData = new BiddingData(); this._embeddedSlices = new LinkedList<Integer>(); this._onGoingEmbedding = new LinkedHashMap<Integer, SliceSpec.Slice>(); //TODO: discover the applications reachable // int subID = this.rib.getRibDaemon().createPub(3, "appsReachableApp"); // this._appsReachable = (LinkedList<String>) this.rib.getRibDaemon().readSub(subID); // this.rib.getRibDaemon().createSub(frequency, subName, publisher) // join the DIF of a InPManager using the RIBDaemon // subscribe to neighbor compute physical topology for routing // establish a flow with all your direct neighbors // String dstName = "pnode2"; // int handlePnode2 = this.irm.allocateFlow(this.getAppName(), dstName); //wait for slice request } /** * Handle pnode CDAP messages */ public void handleAppCDAPmessage(byte[] msg) { // this.rib.RIBlog.debugLog("Pnode::handleAppCDAPmessage: this.irm.getUnderlyingIPCs().get(pnode1).getRib().getMemberList(): "+this.irm.getUnderlyingIPCs().get("pnode1").getRib().getMemberList()); CDAP.CDAPMessage cdapMessage = null; try { cdapMessage = CDAP.CDAPMessage.parseFrom(msg); rib.RIBlog.infoLog("======= Pnode::handleAppCDAPmessage "+this.getAppName()+" ObjClass: " + cdapMessage.getObjClass()); rib.RIBlog.infoLog("======= Pnode::handleAppCDAPmessage "+this.getAppName()+" ObjName: "+ cdapMessage.getObjName()); rib.RIBlog.infoLog("======= Pnode::handleAppCDAPmessage "+this.getAppName()+" SrcAEName: " + cdapMessage.getSrcAEName()); if(cdapMessage.getObjClass().toLowerCase().equals("slice")) { handleSliceRequest(cdapMessage); } else if(cdapMessage.getObjName().toLowerCase().equals("first bid")) { handleFirstBidMessage(cdapMessage); } else if(cdapMessage.getObjName().toLowerCase().equals("bid")) { handleBidMessage(cdapMessage); } else if(cdapMessage.getObjClass().toLowerCase().equals("linkembedding")) { handleLinkEmbedding(cdapMessage); } else { rib.RIBlog.errorLog("======= Pnode: "+this.getAppName()+" ======= Object Class: "+cdapMessage.getObjClass()+" not handled yet"); } } catch (InvalidProtocolBufferException e) { e.printStackTrace(); } } /** * bids and send the bids over to all neighbors * @param cdapMessage */ protected void handleSliceRequest(CDAPMessage cdapMessage) { Slice sliceRequested = null; try { sliceRequested = SliceSpec.Slice.parseFrom(cdapMessage.getObjValue().getByteval()); } catch (InvalidProtocolBufferException e1) { rib.RIBlog.errorLog("Error Parsing Slice from Slice Provider"); e1.printStackTrace(); } //get sliceID int sliceID = sliceRequested.getSliceID(); //log new slice to be embedded if(this._embeddedSlices.contains(sliceID)) { rib.RIBlog.warnLog("Pnode::handleSliceRequest: slice: "+sliceID+ "already embedded"); }else if(!this._onGoingEmbedding.containsKey(sliceID)) { this._onGoingEmbedding.put(sliceID, sliceRequested); this.rib.addAttribute("onGoingEmbedding", _onGoingEmbedding); rib.RIBlog.infoLog("Pnode::handleSliceRequest: embedding slice: "+sliceID); } //initialize data structures for this slice initializeCADStructures(sliceRequested); // prepare data for bidding _currentBiddingData = generateBiddingData(); //bid BiddingData biddingData = _biddingImpl.nodeBidding(sliceRequested, _currentBiddingData); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: BEFORE updateBiddingData _currentBiddingData "+_currentBiddingData ); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: BEFORE updateBiddingData _currentBiddingData.get_allocationVectorMap() "+_currentBiddingData.get_allocationVectorMap() ); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: BEFORE updateBiddingData _currentBiddingData.get_allocationVector(sliceID) "+_currentBiddingData.get_allocationVector(sliceRequested.getSliceID()) ); //update local data structures _currentBiddingData = updateBiddingData(biddingData); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: AFTER updateBiddingData _currentBiddingData "+_currentBiddingData ); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: AFTER updateBiddingData _currentBiddingData.get_allocationVectorMap() "+_currentBiddingData.get_allocationVectorMap() ); // rib.RIBlog.debugLog("Pnode::handleSliceRequest: AFTER updateBiddingData _currentBiddingData.get_allocationVector(sliceID) "+_currentBiddingData.get_allocationVector(sliceRequested.getSliceID()) ); // prepare CAD payload CAD.CADMessage cadMessage = cadMsgImpl.generateFirstBidMessage( sliceRequested, // slice to piggyback sliceID, // mandatory slice ID get_allocationPolicy(), // SAD or MAD this._allocationVectorMap.get(sliceID), // allocation vector a this._bidVectorMap.get(sliceID), // bid Vector b, this._biddingTimeMap.get(sliceID), // bidding time vector this._mMap.get(sliceID)); // bundle m // null); // bundle m rib.RIBlog.debugLog("================================================"); rib.RIBlog.debugLog("================================================"); //TODO: fixme extending the RIBdaemonImpl at any application // this is wrong because we need to send the messages to the appName not to the underlying IPCs: // for now it's ok if they have the same name, but we need to create the subscription to gather // all the appReachable that are one hop away only rib.RIBlog.debugLog("Pnode::handleSliceRequest: this.getAppName()"+this.getAppName()); LinkedList<String> neighborList = this.irm.getUnderlyingIPCs().get(this.getAppName()).getRib().getMemberList(); rib.RIBlog.debugLog("Pnode::handleSliceRequest: neighborList BEFORE removing itself: "+neighborList); LinkedHashMap<String, IPCProcessImpl> myUnderlyingIPCs = this.irm.getUnderlyingIPCs(); Set<String> SetCurrentMaps = myUnderlyingIPCs.keySet(); Iterator<String> KeyIterMaps = SetCurrentMaps.iterator(); while(KeyIterMaps.hasNext()){//remove itself from the neighbors String underlyingIPCName = KeyIterMaps.next(); if(neighborList.contains(underlyingIPCName)) neighborList.remove(underlyingIPCName); } rib.RIBlog.debugLog("Pnode::handleSliceRequest: neighborList AFTER removing itself: "+neighborList); //it has the slice info in it as well rib.RIBlog.debugLog("Pnode::handleSliceRequest: sending first BID to neighborList: "+neighborList); sendFirstBIDMessage(cadMessage, neighborList ); //to neighbor } /** * handle message with slice info and bid * @param cdapMessage */ protected void handleFirstBidMessage(CDAPMessage cdapMessage) { //start a timeout after which send //this.sendResponseToSP(0, cadMessage.getSliceID()); CAD.CADMessage cadMessage = null; try { cadMessage = CAD.CADMessage.parseFrom(cdapMessage.getObjValue().getByteval()); } catch (InvalidProtocolBufferException e1) { rib.RIBlog.errorLog("Pnode::handleBidMessage: Error Parsing CAD message from Slice Provider"); e1.printStackTrace(); } rib.RIBlog.infoLog("Pnode::handleBidMessage: first Bid Message received by: "+cdapMessage.getSrcAEName()); // get slice from the message CAD.CADMessage.Slice piggyBackedSlice = null; if(cadMessage.hasSliceRequest()){ piggyBackedSlice = cadMessage.getSliceRequest(); }else{ rib.RIBlog.errorLog("Pnode::handleFirstBidMessage: there is no slice piggybacked "); } //reconstruct the SliceSpec.Slice slice SliceSpec.Slice sliceToEmbed = _NodeUtil.reconstructSlice(piggyBackedSlice); //////////////////////////////////////////BIDDING ////////////////////////////////////////// //initialize data structures for this slice initializeCADStructures(sliceToEmbed); // prepare data for bidding _currentBiddingData = generateBiddingData(); //bid first then check for agreement BiddingData biddingData = _biddingImpl.nodeBidding(sliceToEmbed, this._currentBiddingData); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: BEFORE updateBiddingData _currentBiddingData "+_currentBiddingData ); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: BEFORE updateBiddingData _currentBiddingData.get_allocationVectorMap() "+_currentBiddingData.get_allocationVectorMap() ); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: BEFORE updateBiddingData _currentBiddingData.get_allocationVector(sliceID) "+_currentBiddingData.get_allocationVector(sliceToEmbed.getSliceID()) ); //update local data structures _currentBiddingData = updateBiddingData(biddingData); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: AFTER updateBiddingData _currentBiddingData "+_currentBiddingData ); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: AFTER updateBiddingData _currentBiddingData.get_allocationVectorMap() "+_currentBiddingData.get_allocationVectorMap() ); rib.RIBlog.debugLog("Pnode::handleFirstBidMessage: AFTER updateBiddingData _currentBiddingData.get_allocationVector(sliceID) "+_currentBiddingData.get_allocationVector(sliceToEmbed.getSliceID()) ); //////////////////////////////////////////// AGREEMENT ////////////////////////////////////////// // now that the node has bid, it checks the incoming bid for agreement //bid biddingData = _agreementImpl.nodeAgreement(cadMessage, this._currentBiddingData, cdapMessage.getSrcAEName(), cdapMessage.getDestAEName()); //update local data structures updateDataAfterAgreement(biddingData); rib.RIBlog.infoLog("================================================"); rib.RIBlog.infoLog("================================================"); rib.RIBlog.infoLog("======= FIRST AGREEMENT PHASE COMPLETE ========="); rib.RIBlog.infoLog("================================================"); rib.RIBlog.infoLog("================================================"); rib.RIBlog.infoLog("Pnode::handleFirstBidMessage:: rebroadcast message?: "+biddingData.get_rebroadcast()); if(biddingData.get_rebroadcast()){ //rebroadcast int sliceID = cadMessage.getSliceID(); CAD.CADMessage cadMessageToBroadcast = cadMsgImpl.generateCADMessage( sliceID, // mandatory slice ID get_allocationPolicy(), // SAD or MAD this._allocationVectorMap.get(sliceID), // allocation vector a this._bidVectorMap.get(sliceID), // bid Vector b, this._biddingTimeMap.get(sliceID), // time stamp of bids this._mMap.get(sliceID)); // bundle m //null); // bundle m //TODO: extend the RIBdaemonImpl at any application // this is not clean as we need to send the messages to the appName not to the underlying IPCs: // for now it's ok if they have the same name, but we need to create the subscription to gather // all the appReachable that are one hop away only LinkedList<String> neighborList = this.irm.getUnderlyingIPCs().get(this._pNodeName).getRib().getMemberList(); rib.RIBlog.infoLog("Pnode::handleFirstBidMessage: neighborList BEFORE REMOVING: "+neighborList); LinkedHashMap<String, IPCProcessImpl> myUnderlyingIPCs = this.irm.getUnderlyingIPCs();// Set<String> SetCurrentMaps = myUnderlyingIPCs.keySet(); Iterator<String> KeyIterMaps = SetCurrentMaps.iterator(); while(KeyIterMaps.hasNext()){ String underlyingIPCName = KeyIterMaps.next(); if(neighborList.contains(underlyingIPCName) || neighborList.contains(this.get_owner())) neighborList.remove(underlyingIPCName); } rib.RIBlog.infoLog("Pnode::handleFirstBidMessage: neighborList AFTER REMOVING: "+neighborList); sendBIDMessage(cadMessageToBroadcast, neighborList); //to neighbor }else{ rib.RIBlog.infoLog("Pnode::handleFirstBidMessage: AGREEMENT: No need to send anything back "); rib.RIBlog.infoLog("Pnode::handleFirstBidMessage: sending Response To SP..."); this.sendResponseToSP(1, cadMessage.getSliceID()); } } /** * * @param cdapMessage */ protected void handleBidMessage(CDAPMessage cdapMessage) { CAD.CADMessage cadMessage = null; try { cadMessage = CAD.CADMessage.parseFrom(cdapMessage.getObjValue().getByteval()); } catch (InvalidProtocolBufferException e1) { rib.RIBlog.errorLog("Pnode::handleBidMessage: Error Parsing BID message"); e1.printStackTrace(); } // prepare data for agreement //in case the pnode has never heard about this slice, if(!this._embeddedSlices.contains(cadMessage.getSliceID())){ //this node should: // ask the slice provider for the slice details // bid first on the new slice without sending out the bid message, sendSliceRequestMessage(cadMessage.getSliceID()); // then come back here ,check for consensus and generate the response } //_currentBiddingData = generateBiddingData(); // prepare data for bidding rib.RIBlog.debugLog("Pnode::handleBidMessage: cdapMessage.getSrcAEName() = k: "+cdapMessage.getSrcAEName() ); rib.RIBlog.debugLog("Pnode::handleBidMessage: cdapMessage.getDestAEName() = i: "+cdapMessage.getDestAEName() ); rib.RIBlog.debugLog("Pnode::handleBidMessage:BEFORE AGREEMENT _currentBiddingData "+_currentBiddingData ); rib.RIBlog.debugLog("Pnode::handleBidMessage:BEFORE AGREEMENT _currentBiddingData.get_allocationVectorMap() "+_currentBiddingData.get_allocationVectorMap() ); //rib.RIBlog.debugLog("Pnode::handleBidMessage:BEFORE AGREEMENT _currentBiddingData.get_allocationVector(sliceID) "+_currentBiddingData.get_allocationVector(cadMessage.getSliceID()) ); //bid BiddingData biddingData = _agreementImpl.nodeAgreement(cadMessage, _currentBiddingData, cdapMessage.getSrcAEName(), cdapMessage.getDestAEName()); //update local data structures updateDataAfterAgreement(biddingData); //if a_i != a_k send otherwise don't send anything and log node agreement reached LinkedHashMap<Integer,String> a_i = _currentBiddingData.getA_i(); rib.RIBlog.debugLog("Pnode::handleBidMessage: a_i: "+a_i ); LinkedHashMap<Integer,String> a_k = _currentBiddingData.getA_k(); rib.RIBlog.debugLog("Pnode::handleBidMessage: a_k: "+a_k ); boolean agreementReached = true; Set<Integer> a_iKeys = a_i.keySet(); Iterator<Integer> aIter = a_iKeys.iterator(); while(aIter.hasNext()){ int vnodeID = aIter.next(); rib.RIBlog.debugLog("Pnode::handleBidMessage: a_k for vnodeID: "+vnodeID+" is "+a_k.get(vnodeID) ); rib.RIBlog.debugLog("Pnode::handleBidMessage: a_i for vnodeID: "+vnodeID+" is "+a_i.get(vnodeID) ); if(!a_k.get(vnodeID).equals(a_i.get(vnodeID))){ agreementReached = false; } rib.RIBlog.debugLog("Pnode::handleBidMessage: agreementReached "+agreementReached); } // even if the agreement is reached pnode may still have to rebroacast the current message if(biddingData.get_rebroadcast()){ //rebroadcast int sliceID = cadMessage.getSliceID(); CAD.CADMessage cadMessageToBroadcast = cadMsgImpl.generateCADMessage( sliceID, // mandatory slice ID get_allocationPolicy(), // SAD or MAD this._allocationVectorMap.get(sliceID), // allocation vector a this._bidVectorMap.get(sliceID), // bid Vector b, this._biddingTimeMap.get(sliceID), // time stamp of bids this._mMap.get(sliceID)); // bundle m //null); // bundle m rib.RIBlog.debugLog("================================================"); rib.RIBlog.debugLog("================================================"); //TODO: fixme extending the RIBdaemonImpl at any application // this is wrong because we need to send the messages to the appName not to the underlying IPCs: // for now it's ok if they have the same name, but we need to create the subscription to gather // all the appReachable that are one hop away only LinkedList<String> neighborList = this.irm.getUnderlyingIPCs().get(this._pNodeName).getRib().getMemberList(); LinkedHashMap<String, IPCProcessImpl> myUnderlyingIPCs = this.irm.getUnderlyingIPCs();// Set<String> SetCurrentMaps = myUnderlyingIPCs.keySet(); Iterator<String> KeyIterMaps = SetCurrentMaps.iterator(); while(KeyIterMaps.hasNext()){ String underlyingIPCName = KeyIterMaps.next(); if(neighborList.contains(underlyingIPCName)) neighborList.remove(underlyingIPCName); } this.sendBIDMessage(cadMessageToBroadcast, neighborList); //to neighbor } // end rebroadcast // maybe some other messsage is coming! how can we check that too? // we should set the bound based on the diameter, // or just check if all the pnodeID have responded and set a timeout id they haven't, // or we just create proactively respond as soon as we see agreement and in case we change it later updating the alloc if(agreementReached) { rib.RIBlog.infoLog("============================================================================================"); rib.RIBlog.infoLog("============================================================================================"); rib.RIBlog.infoLog("CADsys: Pnode: "+this.get_pNodeName()+" has REACHED AGREEMENT SO FAR ON VIRTUAL NETWORK ID: "+cadMessage.getSliceID()); rib.RIBlog.infoLog("============================================================================================"); rib.RIBlog.infoLog("============================================================================================"); //1 allocated, 0 not allocated after timeout //reset timeout rib.RIBlog.debugLog("Pnode::handleBidMessage: sending response to SP"); this.sendResponseToSP(1, cadMessage.getSliceID()); } // assignment.Builder a_ij = assignment.newBuilder(); // a_ij.setVNodeId(vnodeId); // a_ij.setHostingPnodeName(hostingPnodeName); // cadMessage.addA(a_ij); } /** * start virtual links and update capacities * @param cdapMessage */ protected void handleLinkEmbedding(CDAPMessage cdapMessage) { if(cdapMessage==null) rib.RIBlog.errorLog("Pnode::handleLinkEmbedding: cdapMessage is null"); Slice slice =null; int sliceID =-1; try { slice = SliceSpec.Slice.parseFrom(cdapMessage.getObjValue().getByteval()); sliceID = slice.getSliceID(); } catch (InvalidProtocolBufferException e1) { rib.RIBlog.errorLog("Error Parsing Slice from Slice Provider"); e1.printStackTrace(); } if(sliceID ==-1) return; else { rib.RIBlog.infoLog("==================================================================="); rib.RIBlog.infoLog("Pnode::handleLinkEmbedding: ------check if there are resources-----"); rib.RIBlog.infoLog("Pnode::handleLinkEmbedding: ------create vlink here ---------------"); rib.RIBlog.infoLog("==================================================================="); //TODO: log only if link embedding is successful // this is only for stats and should be moved after the link allocation is really done if(this._onGoingEmbedding.containsKey(sliceID)) { this._onGoingEmbedding.remove(sliceID); this._embeddedSlices.add(sliceID); //refresh if(this.rib.hasMember("onGoingEmbedding")) { this.rib.removeAttribute("onGoingEmbedding"); this.rib.addAttribute("_onGoingEmbedding", _onGoingEmbedding); rib.RIBlog.debugLog("Pnode::handleLinkEmbedding: _onGoingEmbedding updated"); } } if(slice != null) { //linkEmbeddingImpl.createTopology(slice); _linkEmbeddingImpl.createVNmultiInP(slice); }else { rib.RIBlog.warnLog("Pnode::handleLinkEmbedding: Slice empty: nothing to create!!!!!!!!!!!!"); return; } } // this.rib.addAttribute("onGoingEmbedding", _onGoingEmbedding); } /** * send to Service provider a message to communicate that an agreement has been reached * @param type 0 no agreement 1 agreement * @param sliceID */ private void sendResponseToSP(int type, int sliceID) { rib.RIBlog.debugLog("Pnode::sendResponseToSP: type: "+type); rib.RIBlog.debugLog("Pnode::sendResponseToSP: sliceID: "+sliceID); rib.RIBlog.debugLog("Pnode::sendResponseToSP: get_allocationPolicy(): "+get_allocationPolicy()); rib.RIBlog.debugLog("Pnode::sendResponseToSP: _allocationVectorMap.get(sliceID): "+this._allocationVectorMap.get(sliceID)); rib.RIBlog.debugLog("Pnode::sendResponseToSP: this._bidVectorMap.get(sliceID): "+this._bidVectorMap.get(sliceID)); CAD.CADMessage cadMessageResponseToSP = cadMsgImpl.generateSpResponse( sliceID, // mandatory slice ID get_allocationPolicy(), // SAD or MAD this._allocationVectorMap.get(sliceID), // allocation vector a this._bidVectorMap.get(sliceID), // bid Vector b, this._biddingTimeMap.get(sliceID) // time stamp of bids ); // generate new message in response //create the "object value" for the CDAP message from the cadMessage payload CDAP.objVal_t.Builder ObjValue = CDAP.objVal_t.newBuilder(); ByteString CADByteString = ByteString.copyFrom(cadMessageResponseToSP.toByteArray()); ObjValue.setByteval(CADByteString); //payload of the CDAP message CDAP.objVal_t objvalueCAD = ObjValue.buildPartial(); // send it to SP String dstName = this.getMySP(); rib.RIBlog.debugLog("Pnode::sendResponseToSP: preparing message for SP: "+dstName); //allocate a flow or get the handle of the previously allocated flow (RINA API) int handle = -1; handle = this.irm.getHandle(dstName); rib.RIBlog.debugLog("Pnode::sendResponseToSP: handle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); if (handle == -1){ this.irm.allocateFlow(this.getAppName(), dstName); } rib.RIBlog.debugLog("Pnode::sendResponseToSP: getHandle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); rib.RIBlog.debugLog("Pnode::sendResponseToSP: handle for flow with "+dstName+" is :"+handle); String PositiveOrNegative = "positive"; if (type ==0) { PositiveOrNegative = "negative"; } CDAP.CDAPMessage M_WRITE = message.CDAPMessage.generateM_WRITE( "response", //ObjClass PositiveOrNegative, // ObjName, objvalueCAD, // objvalue dstName,//destAEInst, dstName,//destAEName, dstName,//destApInst, dstName,//destApName, 00001, //invokeID, this.getAppName(),//srcAEInst this.getAppName(),//srcAEName this.getAppName(),//srcApInst this.getAppName()//srcApName ); rib.RIBlog.debugLog("Pnode::sendResponseToSP: sent to: "+M_WRITE.getDestApName()); int byteOverhead = M_WRITE.toByteArray().length; rib.RIBlog.debugLog("Pnode::sendResponseToSP: message overhead from: "+this._pNodeName+" to: "+dstName+" is "+byteOverhead); try { irm.sendCDAP(irm.getHandle(dstName), M_WRITE.toByteArray()); rib.RIBlog.debugLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); rib.RIBlog.debugLog("Pnode::sendResponseToSP: CDAP message with POSITIVE RESPONSE sent to "+dstName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void sendBIDMessage( vinea.impl.googleprotobuf.CAD.CADMessage cadMessageToBroadcast, LinkedList<String> neighborList) { rib.RIBlog.debugLog("==================== inside sendBIDMessage: cadMessageToBroadcast ============================="); rib.RIBlog.debugLog("Pnode::sendBIDMessage: neighborList: "+neighborList); //create the "object value" for the CDAP message from the cadMessage payload CDAP.objVal_t.Builder ObjValue = CDAP.objVal_t.newBuilder(); ByteString CADByteString = ByteString.copyFrom(cadMessageToBroadcast.toByteArray()); ObjValue.setByteval(CADByteString); //payload of the CDAP message CDAP.objVal_t objvalueCAD = ObjValue.buildPartial(); Iterator<String> neighborsIter = neighborList.iterator(); while (neighborsIter.hasNext()){ String dstName = neighborsIter.next(); rib.RIBlog.debugLog("Pnode::sendBIDMessage: dstName = "+dstName); if(dstName.equals(getMySP()) || dstName.equals("sliceManagerIPC") || dstName.equals("InPManagerIPC") || dstName.equals(this.get_owner()) ){ //this should be either "sliceManagerIPC" or "InPManagerIPC" but we never know rib.RIBlog.debugLog("Pnode::sendBIDMessage: not sending anything to: "+dstName); continue; } //int handle = this.irm.allocateFlow(this.getAppName(), dstName); //allocate a flow or get the handle of the previously allocated flow (RINA API) int handle = -1; handle = this.irm.getHandle(dstName); rib.RIBlog.debugLog("Pnode::sendCADMessage: handle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); if (handle == -1){ this.irm.allocateFlow(this.getAppName(), dstName); } rib.RIBlog.debugLog("Pnode::sendCADMessage: getHandle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); rib.RIBlog.debugLog("Pnode::sendBIDMessage: handle for flow with "+dstName+" is :"+handle); CDAP.CDAPMessage M_WRITE = message.CDAPMessage.generateM_WRITE( "bid", //objclass "bid", // ObjName, // objvalueCAD, // objvalue dstName,//destAEInst, dstName,//destAEName, dstName,//destApInst, dstName,//destApName, 00001, //invokeID, this.getAppName(),//srcAEInst this.getAppName(),//srcAEName this.getAppName(),//srcApInst this.getAppName()//srcApName ); int byteOverhead = M_WRITE.toByteArray().length; rib.RIBlog.debugLog("Pnode::sendBIDMessage: message overhead from: "+this._pNodeName+" to: "+dstName+" is "+byteOverhead); try { irm.sendCDAP(irm.getHandle(dstName), M_WRITE.toByteArray()); rib.RIBlog.debugLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); rib.RIBlog.debugLog("Pnode::sendBIDMessage: CDAP message with BID payload sent to "+dstName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //rib.RIBlog.debugLog("==================== nothing to do yet ============================="); rib.RIBlog.debugLog("==================== bid message rebroadcasted ============================="); } /** * update local data structure of pnode after the agreement phase * @param biddingData */ private void updateDataAfterAgreement(BiddingData biddingData) { this._allocationVectorMap = biddingData.get_allocationVectorMap(); this._bidVectorMap = biddingData.get_bidVectorMap(); this._biddingTimeMap = biddingData.get_biddingTimeMap(); this._mMap = biddingData.get_mMap(); } /** * create structure for nodeBidding * @return BiddingData */ private BiddingData updateBiddingData(BiddingData biddingData) { biddingData.set_pNodeName(_pNodeName); biddingData.set_allocationPolicy(_allocationPolicy); biddingData.set_allocationVectorMap(_allocationVectorMap); biddingData.set_bidVectorMap(_bidVectorMap); biddingData.set_biddingTimeMap(_biddingTimeMap); biddingData.set_iterationMap(_iterationMap); biddingData.set_mMap(_mMap); biddingData.set_mySP(_mySP); biddingData.set_nodeMappingMap(_nodeMappingMap); biddingData.set_nodeStress(_nodeStress); biddingData.set_nodeStressBeforeThisSliceRequest(_nodeStressBeforeThisSliceRequest); biddingData.set_NodeUtil(_NodeUtil); biddingData.set_stress(_stress); biddingData.set_targetLinkCapacity(_targetLinkCapacity); biddingData.set_targetNodeCapacity(_targetNodeCapacity); biddingData.set_targetStress(_targetStress); return biddingData; } /** * create structure for nodeBidding * @return BiddingData */ private BiddingData generateBiddingData() { BiddingData biddingData = new BiddingData(); biddingData.set_pNodeName(_pNodeName); biddingData.set_allocationPolicy(_allocationPolicy); biddingData.set_allocationVectorMap(_allocationVectorMap); biddingData.set_bidVectorMap(_bidVectorMap); biddingData.set_biddingTimeMap(_biddingTimeMap); biddingData.set_iterationMap(_iterationMap); biddingData.set_mMap(_mMap); biddingData.set_mySP(_mySP); biddingData.set_nodeMappingMap(_nodeMappingMap); biddingData.set_nodeStress(_nodeStress); biddingData.set_nodeStressBeforeThisSliceRequest(_nodeStressBeforeThisSliceRequest); biddingData.set_NodeUtil(_NodeUtil); biddingData.set_stress(_stress); biddingData.set_targetLinkCapacity(_targetLinkCapacity); biddingData.set_targetNodeCapacity(_targetNodeCapacity); biddingData.set_targetStress(_targetStress); return biddingData; } /** * send bids message to neighbors * @param cadMessage already built() with Google buffer protocol * @param neighborList */ private void sendFirstBIDMessage(CAD.CADMessage cadMessage, LinkedList<String> neighborList) { if(neighborList == null) { rib.RIBlog.warnLog(" "); rib.RIBlog.warnLog("*************************************************************"); rib.RIBlog.warnLog("Pnode::sendFirstBIDMessage: neighborList is empty: no message sent"); rib.RIBlog.warnLog("*************************************************************"); rib.RIBlog.warnLog(" "); return; } rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: neighborList BEFORE: "+neighborList); rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: getMySP() BEFORE: "+getMySP()); //create the "object value" for the CDAP message from the cadMessage payload CDAP.objVal_t.Builder ObjValue = CDAP.objVal_t.newBuilder(); ByteString CADByteString = ByteString.copyFrom(cadMessage.toByteArray()); ObjValue.setByteval(CADByteString); //payload of the CDAP message CDAP.objVal_t objvalueCAD = ObjValue.buildPartial(); Iterator<String> neighborsIter = neighborList.iterator(); while (neighborsIter.hasNext()){ String dstName = neighborsIter.next(); rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: dstName = "+dstName); if(dstName.equals(getMySP()) || dstName.equals("sliceManagerIPC") || dstName.equals("InPManagerIPC")){ rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: not sending anything to: "+dstName); continue; } int handle = this.irm.allocateFlow(this.getAppName(), dstName); rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: handle for flow with "+dstName+" is :"+handle); CDAP.CDAPMessage M_WRITE = message.CDAPMessage.generateM_WRITE( "bid", //objclass "first bid", // ObjName, // objvalueCAD, // objvalue dstName,//destAEInst, dstName,//destAEName, dstName,//destApInst, dstName,//destApName, 00001, //invokeID, this.getAppName(),//srcAEInst this.getAppName(),//srcAEName this.getAppName(),//srcApInst this.getAppName()//srcApName ); rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: handle for flow to destination "+dstName+" is :"+this.irm.getHandle(dstName)); int byteOverhead = M_WRITE.toByteArray().length; rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: message overhead from: "+this._pNodeName+" to: "+dstName+" is "+byteOverhead); try { irm.sendCDAP(irm.getHandle(dstName), M_WRITE.toByteArray()); rib.RIBlog.debugLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); rib.RIBlog.debugLog("Pnode::sendFirstBIDMessage: CDAP message with BID and Slice payload sent to "+dstName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * TODO: finish support for this (pulling requests in a p2p manner) * ask for this slice to any neighbor or to slice provider * @param sliceID */ private void sendSliceRequestMessage(int sliceID) { //TODO: replace with a subscription event to slice provider or to any pnode //create the "object value" for the CDAP message from the cadMessage payload //instantiate a generator //SliceGenerator sliceGenerator = new SliceGenerator(sliceID); //create and empty slice with the given id (payload of "slice request" message) // SliceSpec.Slice.Builder sliceToRequest = sliceGenerator.getSlice(); // sliceToRequest.buildPartial(); //generate CDAP object serializing payload of "slice request" message // CDAP.objVal_t.Builder ObjValue = CDAP.objVal_t.newBuilder(); // ByteString sliceByteString = ByteString.copyFrom(sliceToRequest.build().toByteArray()); // ObjValue.setByteval(sliceByteString); // CDAP.objVal_t objvalueSlice = ObjValue.buildPartial(); //set destination String dstName = this.getMySP(); //allocate a flow to the slice provider or get the handle of the previosuly allocated flow (RINA API) int handle = -1; handle = this.irm.getHandle(dstName); rib.RIBlog.debugLog("Pnode::sendCADMessage: handle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); if (handle == -1){ this.irm.allocateFlow(this.getAppName(), dstName); } rib.RIBlog.debugLog("Pnode::sendCADMessage: handle for flow with "+dstName+" is :"+this.irm.getHandle(dstName)); //rib.RIBlog.debugLog("Pnode::sendCADMessage: handle for flow with "+this.getMySP()+" is :"+handle); //build message CDAP.CDAPMessage M_READ = message.CDAPMessage.generateM_READ( "slice request", //objclass "slice request ", // ObjName, // null, // objvalue dstName,//destAEInst, dstName,//destAEName, dstName,//destApInst, dstName,//destApName, 00001, //invokeID, this.getAppName(),//srcAEInst this.getAppName(),//srcAEName this.getAppName(),//srcApInst this.getAppName()//srcApName ); try { irm.sendCDAP(irm.getHandle(dstName), M_READ.toByteArray()); rib.RIBlog.debugLog("Pnode::sendCADMessage: CDAP message with SLICE REQUEST payload sent to "+dstName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * all config is given by the sliceManager (controller) */ private void initPnode_noConfigFile() { this._adjacentBandwidthMap = new LinkedHashMap<Integer, LinkedHashMap<Integer,Double>>(); this._adjacentLinksMap = new LinkedHashMap<Integer,LinkedList<Integer>>(); this._nodeMappingMap = new LinkedHashMap<Integer,LinkedHashMap<Integer, Integer>>(); this._allocationVectorMap = new LinkedHashMap<Integer, LinkedHashMap<Integer,String>>(); this._bidVectorMap = new LinkedHashMap<Integer, LinkedList<Double>>(); this._mMap = new LinkedHashMap<Integer, LinkedList<Integer>>(); this._iterationMap = new LinkedHashMap<Integer, Integer>(); this._NodeUtil = new PnodeUtil("residual_node_capacity", this.rib); this._embeddedSlices = new LinkedList<Integer>(); } /** * Initialize physical node structures including parsing from * configuration file information on policies */ private void initPnode() { this._adjacentBandwidthMap = new LinkedHashMap<Integer, LinkedHashMap<Integer,Double>>(); this._adjacentLinksMap = new LinkedHashMap<Integer,LinkedList<Integer>>(); this._nodeMappingMap = new LinkedHashMap<Integer,LinkedHashMap<Integer, Integer>>(); this._allocationVectorMap = new LinkedHashMap<Integer, LinkedHashMap<Integer,String>>(); this._bidVectorMap = new LinkedHashMap<Integer, LinkedList<Double>>(); this._mMap = new LinkedHashMap<Integer, LinkedList<Integer>>(); this._iterationMap = new LinkedHashMap<Integer, Integer>(); this._embeddedSlices = new LinkedList<Integer>(); this._biddingTimeMap = new LinkedHashMap<Integer, LinkedHashMap<Integer,Long>>(); // this.pnodeChildren= new LinkedHashMap<Integer,Pnode>(); //unused for now // this.fwTable = new LinkedHashMap<Integer,Integer>(); //unused for now // Support for a fully Distributed Slice Architecture //get policies from config file this._id = Integer.parseInt(this._CADconfig.getProperty("cad.id")); this.assignmentVectorPolicy = this._CADconfig.getProperty("cad.assignmentVectorPolicy"); this.bidVectorLengthPolicy = Integer.parseInt(this._CADconfig.getProperty("cad.bidVectorLength")); this.nodeUtility = this._CADconfig.getProperty("cad.nodeUtility"); this.ownerISP = this._CADconfig.getProperty("cad.owner"); this._incomingLinkCapacity= Integer.parseInt(this._CADconfig.getProperty("cad.incomingLinkCapacity")); this._outgoingLinkCapacity= Integer.parseInt(this._CADconfig.getProperty("cad.outgoingLinkCapacity")); this._mySP = this._CADconfig.getProperty("cad.mySP"); this._myManager = this._CADconfig.getProperty("cad.owner"); this._allocationPolicy = this._CADconfig.getProperty("cad.allocationPolicy"); this._NodeUtil = new PnodeUtil(this._CADconfig.getProperty("cad.nodeUtility"), this.rib); } /** * initialize bidVector, allocation vector, bundle vector, and node mapping data structures * @param sliceRequested */ private void initializeCADStructures(Slice sliceRequested) { int sliceID= sliceRequested.getSliceID(); //register the slice as seen (add it to the known slices) if(!this._embeddedSlices.contains(sliceID)) this._embeddedSlices.add(sliceID); int sliceSize = sliceRequested.getVirtualnodeCount(); // initialize bid vector for all nodes to 0 LinkedList<Double> b = new LinkedList<Double>(); for(int i=1; i<=sliceSize; i++ ) { b.add(0.0); } this._bidVectorMap.put(sliceID, b); // initialize a LinkedHashMap<Integer,String> a = new LinkedHashMap<Integer,String>(); this._allocationVectorMap.put(sliceID, a); // initialize m LinkedList<Integer> m = new LinkedList<Integer>(); this._mMap.put(sliceID, m); // inizialize bidding time LinkedHashMap<Integer,Long> biddingTime = new LinkedHashMap<Integer,Long>(); this._biddingTimeMap.put(sliceID, biddingTime); // initialize nodeMapping LinkedHashMap<Integer,Integer> nodeMapping = new LinkedHashMap<Integer,Integer>(); this._nodeMappingMap.put(sliceID, nodeMapping); // store residual node capacity at this point this.set_nodeStressBeforeThisSliceRequest(this.get_nodeCapacity()); } /** * @return the _id */ public int get_pid() { return _id; } public NodeBiddingImpl getNodeBidding() { return this._biddingImpl; } public void setNodeBidding(NodeBiddingImpl biddingImpl) { this._biddingImpl = biddingImpl; } public NodeAgreementImpl getNodeAgreement() { return this._agreementImpl; } public void setNodeAgreement(NodeAgreementImpl nodeAgreement) { this._agreementImpl = nodeAgreement; } /** * @param _id the _id to set */ public void set_pid(int id) { this._id = id; } /** * @return the _targetNodeCapacity */ public double get_targetNodeCapacity() { return _targetNodeCapacity; } public double get_nodeStressBeforeThisSliceRequest() { return _nodeStressBeforeThisSliceRequest; } public void set_nodeStressBeforeThisSliceRequest( double _nodeStressBeforeThisSliceRequest) { this._nodeStressBeforeThisSliceRequest = _nodeStressBeforeThisSliceRequest; } /** * @param _targetNodeCapacity the _targetNodeCapacity to set */ public void set_targetNodeCapacity(double _targetNodeCapacity) { this._targetNodeCapacity = _targetNodeCapacity; } /** * @return the _targetLinkCapacity */ public double get_targetLinkCapacity() { return _targetLinkCapacity; } /** * @param _targetLinkCapacity the _targetLinkCapacity to set */ public void set_targetLinkCapacity(double _targetLinkCapacity) { this._targetLinkCapacity = _targetLinkCapacity; } /** * @return the _stress */ public double get_stress() { return _stress; } /** * @param _stress the _stress to set */ public void set_stress(double _stress) { this._stress = _stress; } /** * @return the _targetStrss */ public double get_targetStrss() { return _targetStress; } /** * @param _targetStrss the _targetStrss to set */ public void set_targetStrss(double _targetStress) { this._targetStress = _targetStress; } /** * @return the _allocationPolicy */ public String get_allocationPolicy() { return _allocationPolicy; } /** * @param _allocationPolicy the _allocationPolicy to set */ public void set_allocationPolicy(String _allocationPolicy) { this._allocationPolicy = _allocationPolicy; } /** * @return the _owner */ public String get_owner() { return _owner; } /** * @param _owner the _owner to set */ public void set_owner(String _owner) { this._owner = _owner; } /** * @return the mySP */ public String getMySP() { return this._mySP; } /** * @param mySP the mySP to set */ public void setMySP(String mySP) { this._mySP = mySP; } /** * @return the _nodeCapacity */ public double get_nodeCapacity() { return _nodeStress; } /** * @param _nodeCapacity the _nodeCapacity to set before sending the message out */ public void set_nodeCapacity(double _nodeStress) { this._nodeStress = _nodeStress; } public LinkedList<String> getAppsReachable() { return _appsReachable; } public void setAppsReachable(LinkedList<String> appsReachable) { this._appsReachable = appsReachable; } /** * @return the _pNodeName */ public String get_pNodeName() { return _pNodeName; } /** * @param _pNodeName the _pNodeName to set */ public void set_pNodeName(String _pNodeName) { this._pNodeName = _pNodeName; } /** * @return the _incomingLinkCapacity */ public double get_incomingLinkCapacity() { return _incomingLinkCapacity; } /** * @param _incomingLinkCapacity the _incomingLinkCapacity to set */ public void set_incomingLinkCapacity(double _incomingLinkCapacity) { this._incomingLinkCapacity = _incomingLinkCapacity; } /** * @return the _outgoingLinkCapacity */ public double get_outgoingLinkCapacity() { return _outgoingLinkCapacity; } /** * @param _outgoingLinkCapacity the _outgoingLinkCapacity to set */ public void set_outgoingLinkCapacity(double _outgoingLinkCapacity) { this._outgoingLinkCapacity = _outgoingLinkCapacity; } /** * @return the _myManager */ public synchronized String get_myManager() { return _myManager; } /** * @param _myManager the _myManager to set */ public synchronized void set_myManager(String _myManager) { this._myManager = _myManager; } public void printNodeStats(){ this.rib.RIBlog.infoLog("Pnode stats: ID: "+this._id); this.rib.RIBlog.infoLog("Pnode stats: owner ISP: "+this._owner); this.rib.RIBlog.infoLog("Pnode stats: Current stress: "+this._stress); this.rib.RIBlog.infoLog("Pnode stats: Target stress: "+this._targetStress); this.rib.RIBlog.infoLog("Pnode stats: Assignment Vector Policy: "+this.assignmentVectorPolicy); this.rib.RIBlog.infoLog("Pnode stats: Node Utility: "+this.nodeUtility); this.rib.RIBlog.infoLog("Pnode stats: Bid_Vector_Length Policy: "+this.bidVectorLengthPolicy); } }
[ "fake@email.com" ]
fake@email.com
1f3a99960ce719bbccbddda1f904a63216dcc514
f9967f3d22e9214da39833dc458a909ae7908f9f
/src/test/java/driverinitialization/Test.java
bdef7bef864b428987558aab60d3b3e27e45a7cc
[]
no_license
atulcse333/CucumberProjectParallel
4e4bdbceddc59854c6540071b1ce72256def523d
0091d1c7d33ec3c7ad1fe553fa03c8fcb4b69c02
refs/heads/master
2021-07-09T08:57:38.200561
2019-07-29T08:05:08
2019-07-29T08:05:08
199,407,289
0
0
null
2020-10-13T14:56:54
2019-07-29T08:04:34
Java
UTF-8
Java
false
false
2,364
java
package driverinitialization; /*import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;*/ import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class Test { static WebDriver driver; public static void main(String[] args) { /*try { WebElement addItem = new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("shell-hdr")))); addItem.click(); WebElement search = new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("searchFieldInShell-input-inner")))); search.sendKeys("Manage Statistical"); search.sendKeys(Keys.ENTER); WebElement manageStatistical = new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("__tile31-title-inner")))); Thread.sleep(8000); manageStatistical.click(); WebElement keyStatistics = new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("application-StatisticalKeyFigure-manageStatisticalKeyFigures-component---fullscreen--fin.co.statisticalkeyfigure.manage.SmartFilterBar-filterItemControl_BASIC-StatisticalKeyFigure-inner")))); } catch(Exception e) { e.printStackTrace(); }*/ System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"/src/test/resources/drivers/chromedriver.exe"); driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get(""); new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("")))).sendKeys(""); new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("")))).sendKeys(""); new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.xpath("")))).click(); try { String date = "10/05/2018"; new WebDriverWait(driver , 90).until(ExpectedConditions.visibilityOf(driver .findElement(By.id("")))).sendKeys(date); } catch(Exception e) { e.getMessage(); } } }
[ "I356384" ]
I356384
bbbad2e5fe77f3ea932e5571ab0a6679d0a24139
7e82078e86bb21f2ce4076d8665af49d27dfbbe2
/ChromosomeTest.java
b3c3ebe82d196cbed7480b5e16b88177fb9486a8
[]
no_license
rdgoodman/EvolutionaryNet
370dfc311edffc5a71f7eaf8921da639a7e5b413
8a5846bafd4b6520ee4714fbe2eb7af09cbbbab1
refs/heads/master
2021-01-10T05:03:58.784248
2015-10-26T01:03:03
2015-10-26T01:03:03
44,880,335
0
0
null
null
null
null
UTF-8
Java
false
false
2,204
java
package evol; import static org.junit.Assert.*; import java.util.ArrayList; import org.junit.Test; public class ChromosomeTest { @Test public void testChromosomeSize() { ArrayList<Double> inputs = new ArrayList<Double>(); inputs.add(3.0); inputs.add(2.0); inputs.add(.25); ArrayList<Double> expectedOutput = new ArrayList<Double>(); expectedOutput.add(.8); FeedForwardANN net1 = new FeedForwardANN(1, 2, inputs, expectedOutput, true, false); Chromosome c1 = new Chromosome(net1); FeedForwardANN net2 = new FeedForwardANN(1, 3, inputs, expectedOutput, true, false); Chromosome c2 = new Chromosome(net2); FeedForwardANN net3 = new FeedForwardANN(2, 2, inputs, expectedOutput, true, false); Chromosome c3 = new Chromosome(net3); assertEquals(11, c1.getNumGenes()); assertEquals(16, c2.getNumGenes()); assertEquals(17, c3.getNumGenes()); } @Test public void testEvalute(){ ArrayList<Double> inputs = new ArrayList<Double>(); inputs.add(3.0); inputs.add(2.0); inputs.add(.25); ArrayList<Double> expectedOutput = new ArrayList<Double>(); expectedOutput.add(.8); FeedForwardANN net1 = new FeedForwardANN(1, 2, inputs, expectedOutput, true, false); net1.generateOutput(); net1.clearInputs(); double output1 = net1.getOutputs().get(0); double error1 = net1.calcNetworkError(); Chromosome c1 = new Chromosome(net1); c1.evaluate(); double output2 = net1.getOutputs().get(0); double error2 = net1.calcNetworkError(); assertEquals(true, output2 != output1); assertEquals(true, error2 != error1); } @Test public void testCompare(){ ArrayList<Double> inputs = new ArrayList<Double>(); inputs.add(3.0); inputs.add(2.0); inputs.add(.25); ArrayList<Double> expectedOutput = new ArrayList<Double>(); expectedOutput.add(.8); FeedForwardANN net1 = new FeedForwardANN(1, 2, inputs, expectedOutput, true, false); Chromosome c1 = new Chromosome(net1); c1.evaluate(); Chromosome c2 = new Chromosome(net1); c2.evaluate(); if (c1.getFitness() > c2.getFitness()){ assertEquals(1, c1.compareTo(c2)); } else { assertEquals(-1, c1.compareTo(c2)); } } }
[ "rolliegoodman@gmail.com" ]
rolliegoodman@gmail.com
15575c172543ff59d10ffa3b365f460a83c91cb8
a4f17295a326d2506f937574bc9cbad1e4afb7d4
/app/src/main/java/com/example/marija/restoranstariprojekat/database/Order.java
53639bf2df8fe3c90c4a5566f25527a8d71fa764
[]
no_license
Mila1234/StariProjekatKonobar
a6dade2b0dedfe2afb3858e793163d08888e7907
2e7ec0a792c28bf4a3b4ccd7af650689d8fafa57
refs/heads/master
2021-01-11T16:11:08.608548
2017-01-25T17:03:21
2017-01-25T17:03:21
80,029,581
0
0
null
null
null
null
UTF-8
Java
false
false
1,401
java
package com.example.marija.restoranstariprojekat.database; /** * Created by marija on 22.5.16. */ public class Order implements Cloneable { private FoodMenuItem order; private int nuberOrder; private int id; //TODO id se dobija od backenda private static int ukid= 0; @Override public Order clone() throws CloneNotSupportedException { Order clone = new Order(); clone.id = this.id; clone.nuberOrder = this.nuberOrder; FoodMenuItem cloneFMT = this.getOrder().clone(); clone.order = cloneFMT; return clone; } public Order(){ } public Order(int id, FoodMenuItem order, int nuberOrder) { this.order = order; this.nuberOrder = nuberOrder; this.id = ukid++; } @Override public boolean equals(Object o) { Order rez = (Order)o; if(this.getId()== (rez.getId())) { return true; } return false; } public int getNuberOrder() { return nuberOrder; } public void setNuberOrder(int nuberOrder) { this.nuberOrder = nuberOrder; } public FoodMenuItem getOrder() { return order; } public void setOrder(FoodMenuItem order) { this.order = order; } public int getId() { return id; } private void setId(int id) { this.id = id; } }
[ "staford03@gmail.com" ]
staford03@gmail.com
2485f4602475c599bf12be8c672dc8b1792edf71
9f127cd00455d665f6cea0897cbf4c8f5db6e8c3
/DaWae/chapter3/section1/Exercise39_ActualTimings.java
75b33e2b41151ffd0ad576530311f034f7c4c6e9
[ "MIT" ]
permissive
NoticeMeDan/algo-exercises
9d1a218270dd47872bcc48d2ed1847a62b0a30eb
c97c4a61b19c1e75dae5f6c815bf12bbd22e1e7d
refs/heads/master
2021-09-13T11:47:51.979263
2018-04-29T10:36:25
2018-04-29T10:36:25
119,688,592
2
1
null
null
null
null
UTF-8
Java
false
false
3,914
java
package chapter3.section1; import edu.princeton.cs.algs4.Stopwatch; import util.Constants; import util.FileUtil; import util.VisualAccumulator; /** * Created by Rene Argento on 12/06/17. */ public class Exercise39_ActualTimings { private static final String TALE_FILE_PATH = Constants.FILES_PATH + "tale_of_two_cities.txt"; public static void main(String[] args) { String[] wordsInTale = FileUtil.getAllStringsFromFile(TALE_FILE_PATH); int minLength = 8; //Same as the book analysis Exercise39_ActualTimings actualTimings = new Exercise39_ActualTimings(); String title; //Sequential search symbol table // SequentialSearchSymbolTable<String, Integer> sequentialSearchSymbolTable = new SequentialSearchSymbolTable<>(); // title = "SequentialSearchST running time calling get() or put() in FrequencyCounter"; // actualTimings.frequencyCounter(sequentialSearchSymbolTable, wordsInTale, minLength, title); //Binary search symbol table BinarySearchSymbolTable<String, Integer> binarySearchSymbolTable = new BinarySearchSymbolTable<>(); title = "BinarySearchST running time calling get() or put() in FrequencyCounter"; actualTimings.frequencyCounter(binarySearchSymbolTable, wordsInTale, minLength, title); } private String frequencyCounter(SymbolTable<String, Integer> symbolTable, String[] words, int minLength, String title) { String xAxisLabel = "calls to get() or put()"; String yAxisLabel = "running time"; double maxNumberOfOperations = 45000; double maxRunningTime = 3000; int originValue = 0; VisualAccumulator visualAccumulator = new VisualAccumulator(originValue, maxNumberOfOperations, maxRunningTime, title, xAxisLabel, yAxisLabel); double totalRunningTime = 0; Stopwatch timer; for(String word : words) { if(word.length() < minLength) { continue; } if(!symbolTable.contains(word)) { timer = new Stopwatch(); symbolTable.put(word, 1); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); } else { timer = new Stopwatch(); int wordFrequency = symbolTable.get(word); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); timer = new Stopwatch(); symbolTable.put(word, wordFrequency + 1); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); } } String max = ""; timer = new Stopwatch(); symbolTable.put(max, 0); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); for(String word : symbolTable.keys()) { timer = new Stopwatch(); int wordFrequency = symbolTable.get(word); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); timer = new Stopwatch(); int maxWordFrequency = symbolTable.get(max); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); if(wordFrequency > maxWordFrequency) { max = word; } } timer = new Stopwatch(); int maxFrequency = symbolTable.get(max); totalRunningTime += timer.elapsedTime() * 1000; visualAccumulator.addDataValue(totalRunningTime, false); visualAccumulator.writeLastComputedValue(); return max + " " + maxFrequency; } }
[ "im.arnild@gmail.com" ]
im.arnild@gmail.com
f10e01575dbaf864d390e25c72fabd28bbe15d5d
2d30b224c42a1410f90d35628e58c5b3a06b8ac0
/Chapter_7_GCS/mdse.book.swml.diagram/src/swml/diagram/edit/policies/NCLinkItemSemanticEditPolicy.java
37fb860cfd92e98e88a6c00b166554dbfed54329
[]
no_license
soediro/MDSEBook
a4a4391c8bd5b455544be2559f38c159289c2787
14ed8230008051b7c22cf9f51df6b8caa7a6879e
refs/heads/master
2020-03-18T00:32:31.724606
2015-12-08T10:11:22
2015-12-08T10:11:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
/* * */ package swml.diagram.edit.policies; import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import swml.diagram.providers.SwmlElementTypes; /** * @generated */ public class NCLinkItemSemanticEditPolicy extends SwmlBaseItemSemanticEditPolicy { /** * @generated */ public NCLinkItemSemanticEditPolicy() { super(SwmlElementTypes.NCLink_4001); } /** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { return getGEFWrapper(new DestroyElementCommand(req)); } }
[ "wimmer@big.tuwien.ac.at" ]
wimmer@big.tuwien.ac.at
051c4b4047b7e80c140255e4fe1b9e10b90ffe3d
b575343c19b8b64e9b4127713ca465fcd791f91c
/JavaApplication8/src/project/AddList.java
c445b0dade6309c85918f44d9b13daa05402bb41
[]
no_license
MattawanMeeraksa/programming-ii-project-2016-2-SEC02-PROJ08-SANTEX-OLD
cde02d9700424195ea320586ae5223792669c235
add85d75923bbd0162334511dd6b1450c0456d16
refs/heads/master
2021-06-18T22:20:20.417881
2017-04-25T17:18:33
2017-04-25T17:18:33
85,385,713
0
1
null
null
null
null
UTF-8
Java
false
false
14,864
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 project; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; /** * * @author user */ public class AddList extends javax.swing.JFrame { int planId = 0 ; /** * Creates new form AddList */ public AddList() { initComponents(); setTitle("Add List"); setResizable(false); } public AddList(int planId) throws ClassNotFoundException, SQLException { this.planId = planId ; initComponents(); tt(); setTitle("Add List"); setResizable(false); jTextField5.setText(this.planId+""); jTextField5.setVisible(false); } /** * 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() { jLabel6 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jTextField4 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox<>(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel6.setText("Set"); jButton1.setText("Save"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N jLabel1.setText("Add List"); jButton2.setText(">"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel2.setText("Day"); jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel3.setText("List name"); jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel4.setText("Description"); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel5.setText("Reps"); jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jTextField5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField5ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jTextField2) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jButton2)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel2) .addGap(26, 26, 26) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel6) .addGap(28, 28, 28) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel5) .addGap(18, 18, 18) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(52, 52, 52) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGap(13, 13, 13) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField4) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jTextField3.getAccessibleContext().setAccessibleName(""); jTextField3.getAccessibleContext().setAccessibleDescription(""); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { DetailList dl = new DetailList(planId); dl.setVisible(true); dl.setSize(400, 400); System.out.println("List Plan created"); setVisible(false); dl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dl.setLocationRelativeTo(null); } catch (ClassNotFoundException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton2ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { ListPlan lp = new ListPlan(); String listPlanName = jTextField1.getText(); String description = jTextField2.getText(); String r = jTextField3.getText(); int reps = Integer.parseInt(r); String s = jTextField4.getText(); int set = Integer.parseInt(s); String l = jTextField5.getText(); int list = Integer.parseInt(l); try { lp.create(listPlanName, description, reps, set,list); } catch (ClassNotFoundException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } DetailList dl = new DetailList(planId) ; dl.setVisible(true); dl.setSize(400, 400); System.out.println("List Plan created"); setVisible(false); dl.setLocationRelativeTo(null); dl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } catch (ClassNotFoundException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(AddList.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton1ActionPerformed private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed }//GEN-LAST:event_jComboBox1ActionPerformed private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed }//GEN-LAST:event_jTextField5ActionPerformed private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AddList().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JComboBox<String> jComboBox1; 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.JLabel jLabel6; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; // End of variables declaration//GEN-END:variables public void tt() throws ClassNotFoundException, SQLException{ Connection conn = MySQLConnect.getMySQLConnection(); PreparedStatement pstm = conn.prepareStatement("SELECT dayperweek from PLAN where planID = "+planId); ResultSet rs = pstm.executeQuery(); while(rs.next()){ for(int i = 1 ; i <= rs.getInt("dayperweek") ; i++){ jComboBox1.addItem(""+i); } } } }
[ "vorachit.1998@mail.kmutt.ac.th" ]
vorachit.1998@mail.kmutt.ac.th
c797a4952d79c1f29d9134668516148bad061d37
c8cf34588ac061b5a9313c0b976be9d6412c8a0e
/runescape-api/src/main/java/net/runelite/rs/api/RSNPC.java
fc4bfcc7144558a2edc4e0bbbeff58eadf2b4770
[ "BSD-2-Clause" ]
permissive
boundl/runelite
eb296c66dcfbbb4f9b42eaf25a97bf7721a6959b
2d525e7c93e9658790be586b61867296661df4d1
refs/heads/master
2020-04-18T09:21:39.006738
2019-03-30T14:06:52
2019-03-30T14:06:52
167,431,476
13
6
BSD-2-Clause
2019-02-10T19:56:06
2019-01-24T20:19:41
Java
UTF-8
Java
false
false
1,684
java
/* * Copyright (c) 2016-2017, Adam <Adam@sigterm.info> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.rs.api; import net.runelite.api.NPC; import net.runelite.mapping.Import; public interface RSNPC extends RSActor, NPC { @Import("composition") @Override RSNPCComposition getComposition(); @Override int getIndex(); void setIndex(int id); void setDead(boolean dead); }
[ "Adam@anope.org" ]
Adam@anope.org
804055ee25d41dcd112ec2370e9f8b7d7f49ee74
2b47ce7b06ced2b2dfc2f817b9be653b2e470f37
/app/src/main/java/com/example/wuzhihan/finalwork/Util.java
748267144521f677492e2d6c6b7082062be0a3ef
[]
no_license
Cassxx/Attendance-demo
312d68891342131dffd6a23b87a50be22f785cfc
c88844860e9d36fe7c55fefc883cd62208c2e0d4
refs/heads/master
2021-01-20T02:42:14.298948
2017-05-06T14:06:24
2017-05-06T14:06:24
89,442,219
1
1
null
null
null
null
UTF-8
Java
false
false
1,264
java
package com.example.wuzhihan.finalwork; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created by Wuzhihan on 2017/4/12. */ public class Util { private static final String TAG = "Util"; /** * 启动拍照 */ public static final int REQUEST_CODE_FROM_CAMERA = 3; public static boolean isNetWorkAvailable(Context context) { ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); return info != null && info.isConnected(); } private static int mWidth = -1; private static int mHeight = -1; private static float mDensity = 2.0f; public static void setScreenWidth(int width) { mWidth = width; } public static void setScreenHeight(int height) { mHeight = height; } public static int getScreenWidth() { return mWidth; } public static int getScreenHeight() { return mHeight; } public static void setScreenDensity(float density) { mDensity = density; } public static float getScreenDensity() { return mDensity; } }
[ "359805690@qq.com" ]
359805690@qq.com
f12e094660d432dadcd09fd94a4e28b31102b402
c474b03758be154e43758220e47b3403eb7fc1fc
/apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/kotlin/collections/aj.java
5f8a0563879a423d56302266fac452896bebbba6
[]
no_license
EstebanDalelR/tinderAnalysis
f80fe1f43b3b9dba283b5db1781189a0dd592c24
941e2c634c40e5dbf5585c6876ef33f2a578b65c
refs/heads/master
2020-04-04T09:03:32.659099
2018-11-23T20:41:28
2018-11-23T20:41:28
155,805,042
0
0
null
2018-11-18T16:02:45
2018-11-02T02:44:34
null
UTF-8
Java
false
false
2,412
java
package kotlin.collections; import java.util.List; import kotlin.Metadata; import kotlin.jvm.internal.C2668g; import org.jetbrains.annotations.NotNull; @Metadata(bv = {1, 0, 2}, d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\n\b\u0002\u0018\u0000*\u0004\b\u0000\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\u0013\u0012\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u0004¢\u0006\u0002\u0010\u0005J\u001d\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u000eJ\b\u0010\u000f\u001a\u00020\u000bH\u0016J\u0016\u0010\u0010\u001a\u00028\u00002\u0006\u0010\f\u001a\u00020\u0007H–\u0002¢\u0006\u0002\u0010\u0011J\u0015\u0010\u0012\u001a\u00028\u00002\u0006\u0010\f\u001a\u00020\u0007H\u0016¢\u0006\u0002\u0010\u0011J\u001e\u0010\u0013\u001a\u00028\u00002\u0006\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00028\u0000H–\u0002¢\u0006\u0002\u0010\u0014R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u0004X‚\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\u00020\u00078VX–\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\t¨\u0006\u0015"}, d2 = {"Lkotlin/collections/ReversedList;", "T", "Lkotlin/collections/AbstractMutableList;", "delegate", "", "(Ljava/util/List;)V", "size", "", "getSize", "()I", "add", "", "index", "element", "(ILjava/lang/Object;)V", "clear", "get", "(I)Ljava/lang/Object;", "removeAt", "set", "(ILjava/lang/Object;)Ljava/lang/Object;", "kotlin-stdlib"}, k = 1, mv = {1, 1, 10}) final class aj<T> extends C19281d<T> { /* renamed from: a */ private final List<T> f59927a; public aj(@NotNull List<T> list) { C2668g.b(list, "delegate"); this.f59927a = list; } /* renamed from: a */ public int mo14283a() { return this.f59927a.size(); } public T get(int i) { return this.f59927a.get(C19293u.m68665c(this, i)); } public void clear() { this.f59927a.clear(); } /* renamed from: a */ public T mo14284a(int i) { return this.f59927a.remove(C19293u.m68665c(this, i)); } public T set(int i, T t) { return this.f59927a.set(C19293u.m68665c(this, i), t); } public void add(int i, T t) { this.f59927a.add(C19293u.m68666d(this, i), t); } }
[ "jdguzmans@hotmail.com" ]
jdguzmans@hotmail.com
a078825d111c0a2057544eb4bced399d41397865
00580131bca8f941f46ee2341a3fde843fe602af
/src/main/java/dao/CompradorDao.java
70308d59d6b3f1703b7c2a6a627fa454c44305c5
[]
no_license
marcelotrf/Pi4
63adc1677a3d327d18e49a47f82beef540407fec
6de00cad74125ea5bea775300ff00fba950095a7
refs/heads/master
2023-05-22T22:37:44.865171
2021-06-09T22:47:56
2021-06-09T22:47:56
350,388,478
0
0
null
null
null
null
UTF-8
Java
false
false
11,213
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 dao; import bd.ConexaoBD; import entidade.Comprador; import entidade.Usuario; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import servelet.ListarFuncionario; import servelet.LoginUsuario; /** * * @author marce */ public class CompradorDao { public static void addComprador(Comprador comprador) throws ClassNotFoundException, SQLException { Connection con = ConexaoBD.getConexao(); String query = "insert into comprador(nome,senha,cpf,email) values (?,?,?,?)"; PreparedStatement ps = con.prepareStatement(query); ps.setString(1, comprador.getNome()); ps.setString(2, comprador.getSenha()); ps.setString(3, comprador.getCpf()); ps.setString(4, comprador.getEmail()); ps.execute(); } public static boolean verificaDados(String email, String cpf) { // declarar o retorno // Usuario usuario = null; try { Connection con = ConexaoBD.getConexao(); // cuidado com nome repetido String query = "select * from comprador where email=? "; PreparedStatement ps = con.prepareStatement(query); // passando o parametro email para o banco ps.setString(1, email); // ps.setString(2, senha); // stmt.setString(2, usuario.getSenha()); ResultSet rs = ps.executeQuery(); if(rs.next()) { String cpfBanco = rs.getString("cpf"); // compara para ver se eh o mesmo cpf return cpfBanco.equals(cpf);// String nomeExtenso = rs.getString("nomeExtenso"); // int qtdEstoque = rs.getInt("qtdEstoque"); // String status = rs.getString("status"); // usuario = new Produto(nome,nomeExtenso,status,qtdEstoque); // retorna se cpf for igual do banco } else return false; } catch (ClassNotFoundException ex) { Logger.getLogger(LoginUsuario.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(LoginUsuario.class.getName()).log(Level.SEVERE, null, ex); } return false; } public static boolean verificaUsuario(String email, String senha) { // declarar o retorno // Comprador usuario = new Comprador(); try { Connection con = ConexaoBD.getConexao(); // cuidado com nome repetido String query = "select * from comprador where email=? and senha=?"; PreparedStatement ps = con.prepareStatement(query); // passando o parametro email para o banco ps.setString(1, email); ps.setString(2, senha); // stmt.setString(2, usuario.getSenha()); ResultSet rs = ps.executeQuery(); if(rs.next()) { // String tipo = rs.getString("tipo"); // String status = rs.getString("status"); // usuario.setTipo(tipo); // usuario.setStatus(status); // verifica se usuario esta ativo // return status.equals("Ativado"); // String nomeExtenso = rs.getString("nomeExtenso"); // int qtdEstoque = rs.getInt("qtdEstoque"); // String status = rs.getString("status"); // usuario = new Produto(nome,nomeExtenso,status,qtdEstoque); return true; } else return false; } catch (ClassNotFoundException ex) { Logger.getLogger(LoginUsuario.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(LoginUsuario.class.getName()).log(Level.SEVERE, null, ex); } return false; } public static Comprador getComprador(String email) { // declarar o retorno Comprador comprador = null; try { Connection con = ConexaoBD.getConexao(); // cuidado com nome repetido String query = "select * from comprador where email=?"; PreparedStatement ps = con.prepareStatement(query); ps.setString(1, email); ResultSet rs = ps.executeQuery(); if(rs.next()) { // String email = rs.getString("email"); String nome = rs.getString("nome"); String cpf = rs.getString("cpf"); String logradouro = rs.getString("logradouro"); String bairro = rs.getString("bairro"); String cidade = rs.getString("cidade"); String uf = rs.getString("uf"); comprador = new Comprador(nome,email,cpf,logradouro,bairro,cidade,uf); } } catch (ClassNotFoundException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } return comprador; } public static void atualizarComprador(Comprador comprador) throws ClassNotFoundException, SQLException { Connection con = ConexaoBD.getConexao(); String query = "update comprador set nome=?,cpf=?,logradouro=?,bairro=?,cidade=?,uf=? where email=? "; PreparedStatement ps = con.prepareStatement(query); ps.setString(1, comprador.getNome()); // ps.setString(2, comprador.getSenha()); ps.setString(2, comprador.getCpf()); ps.setString(3, comprador.getLogradouro()); ps.setString(4, comprador.getBairro()); ps.setString(5, comprador.getCidade()); ps.setString(6, comprador.getUf()); ps.setString(7, comprador.getEmail()); ps.execute(); } public static void addEnderecoEntrega(Comprador comprador) throws SQLException, ClassNotFoundException { Connection con = ConexaoBD.getConexao(); String query = "insert into enderecoentrega(cpf,logradouro,bairro,cidade,uf,cep,numeroL) values (?,?,?,?,?,?,?)"; PreparedStatement ps = con.prepareStatement(query); // ps.setString(1, comprador.getNome()); // ps.setString(2, comprador.getSenha()); ps.setString(1, comprador.getCpf()); ps.setString(2, comprador.getLogradouro()); ps.setString(3, comprador.getBairro()); ps.setString(4, comprador.getCidade()); ps.setString(5, comprador.getUf()); ps.setString(6, comprador.getCep()); ps.setInt(7, comprador.getNumeroL()); ps.execute(); } public static List<Comprador> getEnderecoE(String cpf) { // declarar o retorno List<Comprador> listaEnderecoE = new ArrayList(); // Comprador enderecoE = null; try { Connection con = ConexaoBD.getConexao(); // cuidado com nome repetido String query = "select * from enderecoEntrega where cpf=?"; PreparedStatement ps = con.prepareStatement(query); ps.setString(1, cpf); ResultSet rs = ps.executeQuery(); // acho que while pega valor repetido, if pega so o primeiro while(rs.next()) // if(rs.next()) { String logradouro = rs.getString("logradouro"); String bairro = rs.getString("bairro"); String cidade = rs.getString("cidade"); String uf = rs.getString("uf"); String cep = rs.getString("cep"); int numeroL = rs.getInt("numeroL"); listaEnderecoE.add(new Comprador(cpf,logradouro,bairro,cidade,uf,cep,numeroL)); // enderecoE = new Comprador(cpf,logradouro,bairro,cidade,uf); } } catch (ClassNotFoundException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } return listaEnderecoE; } public static Comprador getEnderecoCep(String cep) { // declarar o retorno Comprador comprador = null; // List<Comprador> listaEnderecoE = new ArrayList(); // Comprador enderecoE = null; try { Connection con = ConexaoBD.getConexao(); // cuidado com nome repetido String query = "select * from enderecoEntrega where cep=?"; PreparedStatement ps = con.prepareStatement(query); ps.setString(1, cep); ResultSet rs = ps.executeQuery(); // acho que while pega valor repetido, if pega so o primeiro if(rs.next()) // if(rs.next()) { String logradouro = rs.getString("logradouro"); String bairro = rs.getString("bairro"); String cidade = rs.getString("cidade"); String uf = rs.getString("uf"); int numeroL = rs.getInt("numeroL"); //talvez de errado por causa do cep // listaEnderecoE.add(new Comprador(logradouro,bairro,cidade,uf,cep)); comprador = new Comprador(logradouro,bairro,cidade,uf,cep,numeroL); // enderecoE = new Comprador(cpf,logradouro,bairro,cidade,uf); } } catch (ClassNotFoundException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(ListarFuncionario.class.getName()).log(Level.SEVERE, null, ex); } return comprador; } }
[ "marcelotrf2@users.noreply.github.com" ]
marcelotrf2@users.noreply.github.com
7103665b3aef4d377f522978714d96ecef9d12e1
1456c0bf814beaa531bbc42d9a9261bde2556275
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/utils/StringUtils.java
3311efa015d571f484281737ffdb2528b90c517e
[ "Apache-2.0" ]
permissive
datastax/dsbulk
11448a6baab1c0fe5b35002d5d9a58837888cdea
9ab83053a839f4897c73a4c21b7ca496a221b20e
refs/heads/1.x
2023-07-21T09:39:51.361234
2023-07-13T20:10:59
2023-07-13T20:10:59
97,133,378
61
28
Apache-2.0
2023-07-13T22:03:51
2017-07-13T14:42:53
Java
UTF-8
Java
false
false
1,547
java
/* * Copyright DataStax, Inc. * * 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.datastax.oss.dsbulk.codecs.text.utils; public class StringUtils { /** * If the given string is surrounded by square brackets, return it intact, otherwise trim it and * surround it with square brackets. * * @param value The string to check. * @return A string surrounded by square brackets. */ public static String ensureBrackets(String value) { value = value.trim(); if (value.startsWith("[") && value.endsWith("]")) { return value; } return "[" + value + "]"; } /** * If the given string is surrounded by curly braces, return it intact, otherwise trim it and * surround it with curly braces. * * @param value The string to check. * @return A string surrounded by curly braces. */ public static String ensureBraces(String value) { value = value.trim(); if (value.startsWith("{") && value.endsWith("}")) { return value; } return "{" + value + "}"; } }
[ "adutra@users.noreply.github.com" ]
adutra@users.noreply.github.com
7e1167c8e434ec2c914f6152022cd8a7ab176c0c
5baf0bb95557093281e045813cdd27c4e60b13eb
/app/src/test/java/id/or/codelabs/loginwithgmail/ExampleUnitTest.java
4be84dbcc577b8ec699aecb4b937696b01d36595
[]
no_license
bayupaoh/LoginWithGmail
89739af746a84e21e09738aef74d12d08f839a49
613021186d76a0bfd23e8e3bfce6940ba3eca0fa
refs/heads/master
2020-12-14T09:51:31.874889
2016-01-05T10:44:56
2016-01-05T10:44:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package id.or.codelabs.loginwithgmail; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "bayupaoh@gmail.com" ]
bayupaoh@gmail.com
7b90a3728626b76a8278f0c72aff3d18168f170b
66fc2acc4f126d8e62d381e38faf073a4770acc9
/src/extra/Vault.java
38df74a1828ff353cabb4383ac76349b6124bd76
[]
no_license
League-Level1-Student/level1-module2-Jwaltb
902251c29b01c269bad46a8b5489151de81355a7
cc6dcd008fc6e7b51d0cdd6a022a3ea88d38fa6e
refs/heads/master
2020-03-23T06:32:49.912480
2018-07-24T02:24:59
2018-07-24T02:24:59
141,215,195
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package extra; import java.util.Random; public class Vault { Vault() { Random r = new Random(); secretCode = r.nextInt(1_000_000); } int secretCode; boolean tryCode(int guess) { if (guess == secretCode) { return true; } else { return false; } } }
[ "league@wts9.attlocal.net" ]
league@wts9.attlocal.net
6ad239908a130d89b6c38e9b2cb138e2dd38de48
36520a3fab6c350725a1a66974b0f971daf512eb
/Lec9/LoginPleaseWork/app/src/main/java/edu/stanford/cs193a/loginpleasework/LoginPleaseActivity.java
37a3c3a28c7e2c9f3017c1be46f602b3fe696124
[]
no_license
j-avdeev/MobileApplicationsDevelopment
d4bb10f07968a7de0a15e9a0e8243c0e864b8131
77c29a48adef242007780cf0fb1ead13a35f5c5d
refs/heads/master
2021-09-11T20:22:11.433488
2018-01-21T17:51:42
2018-01-21T17:51:42
110,207,595
1
0
null
null
null
null
UTF-8
Java
false
false
5,477
java
/* * CS 193A, Winter 2017, Marty Stepp * This activity is a small demonstration of adding Google Sign-in to an Android app. * It is tricky to set up, but this gives us the powerful feature of allowing logins * and user information in our app. * * We also demonstrate text-to-speech and speech-to-text here, though it is not really * related to signing in a user. */ package edu.stanford.cs193a.loginpleasework; import android.content.*; import android.speech.tts.TextToSpeech; import android.os.Bundle; import android.view.*; import android.widget.*; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.*; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.*; import stanford.androidlib.*; public class LoginPleaseActivity extends SimpleActivity implements GoogleApiClient.OnConnectionFailedListener, GoogleApiClient.ConnectionCallbacks { private static final int REQ_CODE_GOOGLE_SIGNIN = 32767 / 2; private GoogleApiClient google; private TextToSpeech tts; private boolean isTTSinitialized; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_please); isTTSinitialized = false; tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { isTTSinitialized = true; } }); SignInButton button = (SignInButton) findViewById(R.id.signin_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { signInClick(v); } }); // request the user's ID, email address, and basic profile GoogleSignInOptions options = new GoogleSignInOptions.Builder( GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); // build API client with access to Sign-In API and options above google = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, options) .addConnectionCallbacks(this) .build(); } /* * This method is called when the Sign in with Google button is clicked. * It launches the Google Sign-in activity and waits for a result. */ public void signInClick(View view) { Toast.makeText(this, "Sign in was clicked!", Toast.LENGTH_SHORT).show(); // speak some words if (isTTSinitialized) { tts.speak("Hey idiot, you need to log in now. Booyah!", TextToSpeech.QUEUE_FLUSH, null); } // connect to Google server to log in Intent intent = Auth.GoogleSignInApi.getSignInIntent(google); startActivityForResult(intent, REQ_CODE_GOOGLE_SIGNIN); } /* * This method is called when the user has finished speaking from a speech-to-text action. * We just display the spoken text on the screen in a text view. */ @Override public void onSpeechToTextReady(String spokenText) { $TV(R.id.results).setText("User's favorite color is: " + spokenText); } /* * This method is called when Google Sign-in comes back to my activity. * We grab the sign-in results and display the user's name and email address. */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (requestCode == REQ_CODE_GOOGLE_SIGNIN) { // google sign-in has returned GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent); if (result.isSuccess()) { // yay; user logged in successfully GoogleSignInAccount acct = result.getSignInAccount(); $TV(R.id.results).setText("You signed in as: " + acct.getDisplayName() + " " + acct.getEmail()); } else { $TV(R.id.results).setText("Login fail. :("); } } } /* * Called when the Speech to Text button is clicked. * Initiates a speech-to-text activity. */ public void speechToTextClick(View view) { speechToText("Say your favorite color:"); // Stanford Android library method } /* * Called when the Text to Speech button is clicked. * Causes the app to speak aloud. */ public void textToSpeechClick(View view) { if (isTTSinitialized) { tts.speak("Congratulations. You clicked a button, genius.", TextToSpeech.QUEUE_FLUSH, null); } } // this method is required for the GoogleApiClient.OnConnectionFailedListener above public void onConnectionFailed(ConnectionResult connectionResult) { log("onConnectionFailed"); } // this method is required for the GoogleApiClient.ConnectionCallbacks above public void onConnected(Bundle bundle) { log("onConnected"); } // this method is required for the GoogleApiClient.ConnectionCallbacks above public void onConnectionSuspended(int i) { log("onConnectionSuspended"); } }
[ "j-avdeev@ya.ru" ]
j-avdeev@ya.ru
58260643bb006c1e16241085597065eb9425bb15
3526196f89d1b05591f3f3f95e34d33360e14a0d
/framework-client/src/main/java/com/github/framework/client/metries/Meter.java
803aa84a3e4746cb4948cc695a7ab15345e0f918
[]
no_license
lhrimperial/framework-rpc
93cc4e0ed8aa134c25298e389e52eb6e36a04596
e8a557d6fbeb427036631daa5391b39481a11756
refs/heads/master
2021-01-24T08:48:16.468394
2018-03-19T10:02:28
2018-03-19T10:02:28
122,995,084
0
0
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.github.framework.client.metries; import java.util.concurrent.atomic.AtomicLong; /** * RPC调用统计 */ public class Meter { private String serviceName; //服务名 private AtomicLong callCount = new AtomicLong(0l); //调用次数 private AtomicLong failedCount = new AtomicLong(0l); //失败次数 private AtomicLong totalCallTime = new AtomicLong(0l); //总的调用时间 private AtomicLong totalRequestSize = new AtomicLong(0l);//入参大小 public Meter(String serviceName) { this.serviceName = serviceName; } public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public AtomicLong getCallCount() { return callCount; } public void setCallCount(AtomicLong callCount) { this.callCount = callCount; } public AtomicLong getFailedCount() { return failedCount; } public void setFailedCount(AtomicLong failedCount) { this.failedCount = failedCount; } public AtomicLong getTotalCallTime() { return totalCallTime; } public void setTotalCallTime(AtomicLong totalCallTime) { this.totalCallTime = totalCallTime; } public AtomicLong getTotalRequestSize() { return totalRequestSize; } public void setTotalRequestSize(AtomicLong totalRequestSize) { this.totalRequestSize = totalRequestSize; } }
[ "longhairen@lvmama.com" ]
longhairen@lvmama.com
628bf3afdd21009e0ffcb54e3a0cdf827aa0ebaf
499ed7fd1ff68e88594f8ed6c7ef556023082184
/Evoting/Common/src/main/java/view/ViewManager.java
53b47b3735db995ce97b6fbb7c7af4457b7e7938
[]
no_license
ndslab-unipa/SecureBallot
ecf046cec96220b69a917787babfb142bd8d70c0
1efd581143e0779da32b170c07c08101c83015ef
refs/heads/main
2023-01-27T17:45:34.037180
2020-11-27T17:57:50
2020-11-27T17:57:50
316,567,876
1
0
null
null
null
null
UTF-8
Java
false
false
2,558
java
package view; import controller.AbstrController; import exceptions.PEException; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; import java.net.URL; public abstract class ViewManager implements ViewInterface { protected Stage stage; protected AbstrController mainController; public ViewManager(Stage stage){ this.stage = stage; } public void setControllerAndShowStage(AbstrController controller){ this.mainController = controller; stage.show(); } @Override public void update(){ Platform.runLater(new Runnable() { @Override public void run() { updateFromView(); } }); } @Override public void println(String msg) { Dialogs.printSuccess("Operazione Riuscita", "Messaggio Generico", msg); } @Override public void printMessage(String message) { System.out.println(message); } public void printSuccess(String message, String content) { Dialogs.printSuccess("Operazione Riuscita", message, content); } @Override public void printError(String message, String content) { Dialogs.printError("Operazione Fallita", message, content); } @Override public void printError(PEException pee) { Dialogs.printException(pee); } @Override public void printWarning(String message, String content) { Dialogs.printWarning("Attenzione", message, content); } @Override public boolean printConfirmation(String msg, String content) { return Dialogs.printConfirmation("Conferma Operazione", msg, content); } protected ViewAbstrController loadScene(URL xmlUrl, AbstrController controller) { FXMLLoader loader = new FXMLLoader(xmlUrl); try { Parent sceneRoot = loader.load(); ViewAbstrController viewController = loader.getController(); viewController.setMainController(controller); setScene(sceneRoot); return viewController; } catch (IOException e) { e.printStackTrace(); return null; } } private void setScene(Parent root) { if (stage.getScene() == null) { Scene scene = new Scene(root); stage.setScene(scene); } else { stage.getScene().setRoot(root); } } }
[ "ndslab.unipa@gmail.com" ]
ndslab.unipa@gmail.com
4c83f3583fc4109cfdfbac992b796ab53a3e5c00
d39529211f3eddf260a9e1f15a9207bba2355408
/src/main/java/com/czp/demo/Servlet/FirstServlet.java
5d8a7da0a1ca80c387fe822043f8d80b345488c0
[]
no_license
czp704571044/SpringBootBase
6dcc6bb286ab4227e5da89ec55708e52130d2342
8beb01df0285bb7aae6a70dadc26160faec9c294
refs/heads/master
2020-12-08T09:45:37.254318
2020-01-10T02:36:50
2020-01-10T02:36:50
232,227,489
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.czp.demo.Servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name = "firstServlet", urlPatterns = "/firstServlet") //标记为servlet,以便启动器扫描。 public class FirstServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.getWriter().append("firstServlet"); } }
[ "1054630390@qq.com" ]
1054630390@qq.com
a28ad65bb9778824af026b32bd92ac43ca92201e
e0f0cbfec89ba178816a36864a0ef085a825236e
/blade-core/src/main/java/com/blade/CoreFilter.java
68b0d0df1d82fd4cc40fa88bea30fd869bd2fd69
[ "Apache-2.0" ]
permissive
dakabang/blade
e6fa8ef9d021bc6a15c23f6c2bb987024a4b5ad7
29f0da2d59415a9ee0354220ebde1b6e262de697
refs/heads/master
2020-04-01T17:59:07.086611
2015-11-30T11:40:37
2015-11-30T11:40:37
47,091,333
0
0
null
2015-11-30T02:43:44
2015-11-30T02:43:43
null
UTF-8
Java
false
false
4,544
java
/** * Copyright (c) 2015, biezhi 王爵 (biezhi.me@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.blade; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.blade.context.BladeWebContext; import com.blade.route.RouteBuilder; import blade.kit.StringKit; import blade.kit.TaskKit; import blade.kit.log.Logger; /** * blade核心过滤器,mvc总线 * 匹配所有请求过滤 * * @author <a href="mailto:biezhi.me@gmail.com" target="_blank">biezhi</a> * @since 1.0 */ public class CoreFilter implements Filter { private static final Logger LOGGER = Logger.getLogger(CoreFilter.class); /** * blade全局初始化类 */ private static final String BOOSTRAP_CLASS = "bootstrapClass"; /** * Blade单例对象 */ private Blade blade; /** * 执行所有请求的处理器 */ private ActionHandler actionHandler; @Override public void init(FilterConfig filterConfig) throws ServletException { // 防止重复初始化 try { blade = Blade.me(); if(!blade.isInit){ blade.webRoot(filterConfig.getServletContext().getRealPath("/")); Bootstrap bootstrap = blade.bootstrap(); String bootStrapClassName = filterConfig.getInitParameter(BOOSTRAP_CLASS); if(StringKit.isNotBlank(bootStrapClassName)){ bootstrap = getBootstrap(filterConfig.getInitParameter(BOOSTRAP_CLASS)); bootstrap.init(); blade.app(bootstrap); } // 构建路由 new RouteBuilder(blade).building(); // 初始化IOC IocApplication.init(blade); bootstrap.contextInitialized(blade); blade.setInit(true); actionHandler = new ActionHandler(filterConfig.getServletContext(), blade); LOGGER.info("blade init complete!"); } } catch (Exception e) { e.printStackTrace(); System.exit(0); } } /** * 获取全局初始化对象,初始化应用 * * @param botstrapClassName 全局初始化类名 * @return 一个全局初始化对象 * @throws ServletException */ private Bootstrap getBootstrap(String botstrapClassName) throws ServletException { Bootstrap bootstrapClass = null; try { if(null != botstrapClassName){ Class<?> applicationClass = Class.forName(botstrapClassName); if(null != applicationClass){ bootstrapClass = (Bootstrap) applicationClass.newInstance(); } } else { throw new ServletException("bootstrapClass is null !"); } } catch (Exception e) { throw new ServletException(e); } return bootstrapClass; } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException{ HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; httpRequest.setCharacterEncoding(blade.encoding()); httpResponse.setCharacterEncoding(blade.encoding()); /** * 是否被RequestHandler执行 */ boolean isHandler = actionHandler.handle(httpRequest, httpResponse); if(!isHandler){ chain.doFilter(httpRequest, httpResponse); } } @Override public void destroy() { LOGGER.info("blade destroy!"); BladeWebContext.remove(); IocApplication.destroy(); TaskKit.depose(); } }
[ "biezhi.me@gmail.com" ]
biezhi.me@gmail.com
e29f9b776cbb5cb16a3dcaf1fbdc5c2bd599395d
7a3782945044ec06eafd798ebe14fa3de6f618e8
/src/main/java/pl/wiktor/management/controller/NewPatientController.java
e06f9e162195bab21457bc526359f257b4807802
[]
no_license
victorio99891/SpringBootJavaFX
5ca385d67f7f0628d50c1870e91d039132517e2c
ae8ba0c06bdc864437aab04c865e9a9afe42a9d5
refs/heads/development
2021-06-26T20:47:11.711533
2020-04-24T20:45:19
2020-04-24T20:45:19
173,629,481
0
0
null
2019-05-26T12:16:46
2019-03-03T21:02:17
Java
UTF-8
Java
false
false
7,307
java
package pl.wiktor.management.controller; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.AnchorPane; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Controller; import pl.wiktor.management.exceptions.ExceptionInfo; import pl.wiktor.management.exceptions.ExceptionResolverService; import pl.wiktor.management.model.PatientBO; import pl.wiktor.management.service.AppContext; import pl.wiktor.management.service.PatientService; import pl.wiktor.management.utils.StageManager; import java.io.IOException; import java.util.HashMap; import java.util.Map; @Controller public class NewPatientController { private final AppContext appContext; private final PatientService patientService; private final StageManager stageManager; @FXML public AnchorPane window; @FXML public TextField firstNameLabel; @FXML public Label nameValidationLabel; @FXML public TextField lastNameLabel; @FXML public Label lastNameValidationLabel; @FXML public ChoiceBox<String> genderChoiceBox; @FXML public TextField peselLabel; @FXML public Label peselValidationLabel; @FXML public Button registerButton; private MainController mainController; private Map<String, Boolean> genderMap = new HashMap<>(); private PatientBO newPatient = new PatientBO(); @Autowired public NewPatientController(@Lazy StageManager stageManager, AppContext appContext, PatientService patientService, MainController mainController) { this.patientService = patientService; this.appContext = appContext; this.stageManager = stageManager; this.mainController = mainController; } public void register(ActionEvent event) throws IOException { if (!this.appContext.isPatientToEditAction()) { if (!patientService.checkIfPatientExist(newPatient.getPesel())) { patientService.savePatient(newPatient); stageManager.closeStageOnEvent(event); mainController.switchToPatientManagement(); } else { ExceptionResolverService.resolve(ExceptionInfo.PATIENT_EXIST); } } else { patientService.savePatient(newPatient); mainController.switchToPatientManagement(); appContext.setPatientToEditAction(false); stageManager.closeStageOnEvent(event); newPatient = new PatientBO(); } } public void validatePatientData() { boolean isNameCorrect = false; boolean isLastNameCorrect = false; boolean isPeselCorrect = false; if (this.firstNameLabel.getText().length() >= 2) { this.nameValidationLabel.setText("ACCEPTED!"); this.nameValidationLabel.setStyle("-fx-text-fill: green; -fx-font-weight: bold"); isNameCorrect = true; this.newPatient.setFirstName( this.firstNameLabel.getText().substring(0, 1).toUpperCase() + this.firstNameLabel.getText().substring(1).toLowerCase()); } else { this.nameValidationLabel.setText("Should contains min. 2 characters"); this.nameValidationLabel.setStyle("-fx-text-fill: red; -fx-font-weight: bold"); } if (this.lastNameLabel.getText().length() >= 2) { this.lastNameValidationLabel.setText("ACCEPTED!"); this.lastNameValidationLabel.setStyle("-fx-text-fill: green; -fx-font-weight: bold"); isLastNameCorrect = true; this.newPatient.setLastName( this.lastNameLabel.getText().substring(0, 1).toUpperCase() + this.lastNameLabel.getText().substring(1).toLowerCase()); } else { this.lastNameValidationLabel.setText("Should contains min. 2 characters"); this.lastNameValidationLabel.setStyle("-fx-text-fill: red; -fx-font-weight: bold"); } if (checkIsPeselCorrect()) { this.peselValidationLabel.setText("ACCEPTED!"); this.peselValidationLabel.setStyle("-fx-text-fill: green; -fx-font-weight: bold"); this.newPatient.setPesel(this.peselLabel.getText()); isPeselCorrect = true; } else { this.peselValidationLabel.setText("Wrong PESEL number."); this.peselValidationLabel.setStyle("-fx-text-fill: red; -fx-font-weight: bold"); } if (isNameCorrect && isLastNameCorrect && isPeselCorrect) { this.registerButton.setDisable(false); } else { this.registerButton.setDisable(true); } } private boolean checkIsPeselCorrect() { if (this.peselLabel.getLength() == 11) { if (!this.peselLabel.getText().substring(4, 6).matches("^(0[1-9]|1[0-9]|2[0-9]|3[01])$")) { return false; } int genderNumber = Integer.valueOf(this.peselLabel.getText().substring(9, 10)); if (genderNumber % 2 == 0 && this.genderChoiceBox.getValue().equals("FEMALE")) { this.newPatient.setWomen(true); return true; } else if (genderNumber % 2 != 0 && this.genderChoiceBox.getValue().equals("MALE")) { this.newPatient.setWomen(false); return true; } } return false; } @FXML public void initialize() { this.registerButton.setDisable(true); makeTextFieldNumericWithSetLength(); ChangeListener<String> changeListener = (observable, oldValue, newValue) -> { if (!newValue.equals(oldValue)) { validatePatientData(); } }; genderMap.put("MALE", false); genderMap.put("FEMALE", true); this.genderChoiceBox.setItems(FXCollections.observableArrayList(genderMap.keySet())); this.genderChoiceBox.setValue("MALE"); this.genderChoiceBox.getSelectionModel().selectedItemProperty().addListener(changeListener); if (this.appContext.isPatientToEditAction()) { PatientBO patientBO = this.appContext.getPatientToEdit(); this.newPatient = patientService.findByPesel(patientBO.getPesel()); this.firstNameLabel.setText(patientBO.getFirstName()); this.lastNameLabel.setText(patientBO.getLastName()); this.peselLabel.setText(patientBO.getPesel()); this.genderChoiceBox.setValue(patientBO.isWomen() ? "FEMALE" : "MALE"); validatePatientData(); } } private void makeTextFieldNumericWithSetLength() { this.peselLabel.textProperty().addListener((observable, oldValue, newValue) -> { if (!newValue.matches("[0-9]*")) { this.peselLabel.setText(oldValue); } if (!newValue.matches("\\w{0,11}")) { this.peselLabel.setText(oldValue); } }); } }
[ "wiktor.krzyzanowski1@gmail.com" ]
wiktor.krzyzanowski1@gmail.com
2139b6cf3bfd7aafb1b075bf6a22027f6be451c1
e217974bafd473de2be6babbaafeaf8fbc0ba0e3
/src/main/java/com/demo/offline/hive/log/OtaAppLog.java
1c914636d6c5cb4c32988601feaa688693647286
[]
no_license
Robotlwl/big-data-analysis
5dffbcd6d863d9e3a0165a4616904d3bf3298d09
73c90344ac41090da65b00d1b4a93c97acd16e8b
refs/heads/master
2022-01-30T17:12:45.186759
2019-01-30T09:51:08
2019-01-30T09:51:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,671
java
package com.demo.offline.hive.log; import com.demo.base.AbstractSparkSql; import com.demo.config.FlumePath; import com.demo.util.DateUtil; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; import org.apache.spark.sql.types.DataTypes; import org.apache.spark.sql.types.StructField; import org.apache.spark.sql.types.StructType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * @author allen * Created by allen on 04/08/2017. */ public class OtaAppLog extends AbstractSparkSql { private Logger logger = LoggerFactory.getLogger(OtaAppLog.class); @Override public void executeProgram(String pt, String path, SparkSession spark) throws IOException { int partitionNum = 4; String ptWithPre= DateUtil.pathPtWithPre(pt); String appLogPath= FlumePath.APP_LOG_PATH+ptWithPre; if(!existsPath(appLogPath)){ return; } Dataset<Row> otaAppLog= spark.read().schema(produceSchema()).json(appLogPath).distinct().repartition(partitionNum); otaAppLog.createOrReplaceTempView("OtaAppLog"); beforePartition(spark); String sql = "insert overwrite table ota_app_log partition(pt='"+pt+"') " + "select mid,ip,version,deviceId,productId,continentEn,continentZh,countryEn,countryZh,provinceEn,provinceZh,cityEn,cityZh," + "networktype,lac,cid,mcc,mnc,rxlev,num,goType,createTime,dataType from OtaAppLog"; logger.warn("executing sql is :" + sql); spark.sql(sql); } public StructType produceSchema(){ List<StructField> inputFields=new ArrayList<>(); String splitSeq=","; String stringType="mid,ip,version,continentEn,continentZh,countryEn,countryZh,provinceEn,provinceZh," + "cityEn,cityZh,networktype,deviceId,lac,cid,mcc,mnc,rxlev,dataType"; String timeType="createTime"; String longType="productId"; String integerType="num,goType"; for(String stringTmp:stringType.split(splitSeq)){ inputFields.add(DataTypes.createStructField(stringTmp,DataTypes.StringType,true)); } inputFields.add(DataTypes.createStructField(timeType,DataTypes.TimestampType,false)); for(String integerTmp:integerType.split(splitSeq)){ inputFields.add(DataTypes.createStructField(integerTmp,DataTypes.IntegerType,true)); } for(String longTmp:longType.split(splitSeq)){ inputFields.add(DataTypes.createStructField(longTmp,DataTypes.LongType,false)); } return DataTypes.createStructType(inputFields); } public static void main(String[] args) throws Exception { String pt= DateUtil.producePtOrYesterday(args); OtaAppLog otaAppLog =new OtaAppLog(); otaAppLog.runAll(pt); } }
[ "baifan@adups.com" ]
baifan@adups.com
0cccb783cbbe4e26c46f1bad3eadebf129d7305c
05ce1e4057a269ef35e9f2e3f55b404dc72eda70
/src/types/TArr.java
307673555a10bbdc840b054686fc761c819ce5fa
[]
no_license
Schkrabi/HindleyMiller
d37039b818ad38f1a8750361ed7408281eb005af
45269a26a2c879eac627eeb83d13466fdc306eee
refs/heads/master
2021-01-02T23:11:24.582721
2017-08-17T11:02:07
2017-08-17T11:02:07
99,487,443
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
/** * */ package types; import java.util.Set; import java.util.TreeSet; import inference.Subst; /** * @author schkrabi * */ public class TArr extends Type { private Type ltype; private Type rtype; public TArr(Type ltype, Type rtype){ this.ltype = ltype; this.rtype = rtype; } public Type getLtype() { return ltype; } public Type getRtype() { return rtype; } @Override public String toString(){ return ltype.toString() + " -> " + rtype.toString(); } @Override public Type apply(Subst subst) { TArr tarr = (TArr)this; return new TArr(tarr.getLtype().apply(subst), tarr.getRtype().apply(subst)); } public Set<TVar> ftv(){ Type l = ((TArr)this).getLtype(); Type r = ((TArr)this).getRtype(); Set<TVar> s = new TreeSet<TVar>(); s.addAll(l.ftv()); s.addAll(r.ftv()); return s; } public int compareTo(Type o) { if(o instanceof TArr) { int n = this.ltype.compareTo(((TArr)o).getLtype()); return n != 0 ? n : this.rtype.compareTo(((TArr) o).getRtype()) ; } return super.compareTo(o); } }
[ "skrabal_Radomir@centrum.cz" ]
skrabal_Radomir@centrum.cz
97063fbb7025a9229735e0820373791b80fb41b8
f609cb34b3538f6dac07d2d8144ce45b14ca8ac2
/src/coding/temp/_0399_Evaluate_Division.java
d42389ff199d5874fdf9756b3606a6a2afc91f08
[]
no_license
sahilmutreja/Algorithms
ca8f6f59039b01ea2c0ea7f7f6e51de7e9982141
a24f6e73c1ad4c863c67e957fcba781c4953ac80
refs/heads/master
2023-02-10T08:00:13.729659
2021-01-04T08:02:12
2021-01-04T08:02:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,335
java
/** * @author Yunxiang He * @date 06/27/2018 */ package coding.temp; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /* Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0. Example: Given a / b = 2.0, b / c = 3.0. queries are: a / c = ?, b / a = ?, a / equations = ?, a / a = ?, x / x = ? . return [6.0, 0.5, -1.0, 1.0, -1.0 ]. The input is: vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries , where equations.size() == values.size(), and the values are positive. This represents the equations. Return vector<double>. According to the example above: equations = [ ["a", "b"], ["b", "c"] ], values = [2.0, 3.0], queries = [ ["a", "c"], ["b", "a"], ["a", "equations"], ["a", "a"], ["x", "x"] ]. The input is always valid. You may assume that evaluating the queries will result in no division by zero and there is no contradiction. */ public class _0399_Evaluate_Division { public static void main(String[] args) { _0399_Evaluate_Division _0399_Evaluate_Division = new _0399_Evaluate_Division(); _0399_Evaluate_Division.calcEquation_DFS(new String[][] { { "a", "b" }, { "b", "c" }, }, new double[] { 2.0, 3.0, }, new String[][] { { "a", "c" }, }); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Map<String, String> root = new HashMap<>(); Map<String, Double> ratio2root = new HashMap<>(); public double[] calcEquation(String[][] equations, double[] values, String[][] queries) { String r1; String r2; for (int i = 0; i < equations.length; ++i) { r1 = find(equations[i][0]); r2 = find(equations[i][1]); if (!r1.equals(r2)) { root.put(r1, r2); ratio2root.put(r1, values[i] * ratio2root.get(equations[i][1]) / ratio2root.get(equations[i][0])); } } double[] res = new double[queries.length]; for (int i = 0; i < queries.length; ++i) { if (ratio2root.containsKey(queries[i][0]) && ratio2root.containsKey(queries[i][1])) { if (queries[i][0].equals(queries[i][1])) { res[i] = 1.0; } else if (find(queries[i][0]).equals(find(queries[i][1]))) { res[i] = ratio2root.get(queries[i][0]) / ratio2root.get(queries[i][1]); } else { res[i] = -1.0; } } else { res[i] = -1.0; } } return res; } private String find(String index) { if (!root.containsKey(index)) { root.put(index, index); ratio2root.put(index, 1.0); } if (root.get(index).equals(index)) { return index; } String temp = find(root.get(index)); ratio2root.put(index, ratio2root.get(index) * ratio2root.get(root.get(index))); root.put(index, temp); return temp; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Map<String, Map<String, Double>> graph = new HashMap<>(); public double[] calcEquation_DFS(String[][] equations, double[] values, String[][] queries) { buildGraph(equations, values); double[] res = new double[queries.length]; for (int i = 0; i < queries.length; ++i) { if (!graph.containsKey(queries[i][0]) || !graph.containsKey(queries[i][1])) { res[i] = -1.0; } else if (queries[i][0] == queries[i][1]) { res[i] = 1.0; } else { res[i] = DFS(queries[i][0], queries[i][1], new HashSet<>(), 1.0); } } return res; } private double DFS(String from, String to, Set<String> visited, double curr) { if (from.equals(to)) { return curr; } else if (!visited.contains(from)) { visited.add(from); for (Map.Entry<String, Double> next : graph.get(from).entrySet()) { double temp = DFS(next.getKey(), to, visited, curr * next.getValue()); if (temp != -1.0) { return temp; } } } return -1.0; } private Map<String, Map<String, Double>> buildGraph(String[][] equations, double[] values) { Map<String, Map<String, Double>> graph = new HashMap<>(); for (int i = 0; i < equations.length; i++) { graph.putIfAbsent(equations[i][0], new HashMap<>()); graph.get(equations[i][0]).put(equations[i][1], values[i]); graph.putIfAbsent(equations[i][1], new HashMap<>()); graph.get(equations[i][1]).put(equations[i][0], 1.0 / values[i]); } return graph; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private boolean isFound; private double temp; public double[] calcEquation_DFS2(String[][] equations, double[] values, String[][] queries) { graph = buildGraph(equations, values); double[] res = new double[queries.length]; for (int i = 0; i < queries.length; i++) { if (!graph.containsKey(queries[i][0]) || !graph.containsKey(queries[i][1])) { res[i] = -1.0; } else if (queries[i][0] == queries[i][1]) { res[i] = 1.0; } else { temp = 1.0; isFound = false; DFS2(queries[i][0], queries[i][1], new HashSet<>(), 1.0); if (isFound) { res[i] = temp; } else { res[i] = -1.0; } } } return res; } private void DFS2(String root, String target, Set<String> visited, double curr) { if (!isFound) { if (root.equals(target)) { isFound = true; temp = curr; } if (!visited.contains(root)) { visited.add(root); for (Map.Entry<String, Double> node : graph.get(root).entrySet()) { DFS2(node.getKey(), target, visited, curr * node.getValue()); } } } } }
[ "155028525@qq.com" ]
155028525@qq.com
5fc8d4d412da6a8ff8d4e84f1379ca363f5de169
dd28b7989c4eeacbe7f8dd2e7d239cbbd80beb39
/src/factory/pattern/Hyundai.java
5ef10479b6355787b93cd21bf31a79cd8713cb0f
[]
no_license
Japes1121/design-patterns
a560009c9822e1f64bff4ca6282177b5e255e998
e2a598af870bb78f3a47babfd36367c70d3193a1
refs/heads/master
2021-01-01T06:07:24.847312
2017-07-16T13:34:48
2017-07-16T13:34:48
97,360,539
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
/** * */ package factory.pattern; /** * @author Jayaprakash * */ public class Hyundai implements Cars { private String carColor, carModel; private Double carPrice; public Hyundai(){} public Hyundai(String color,String modal, Double price){ this.carColor=color; this.carModel=modal; this.carPrice=price; } @Override public void setColor(String color) { this.carColor=color; } @Override public void setModal(String modal) { this.carModel=modal; } @Override public void setPrice(Double price) { this.carPrice=price; } @Override public String getColor() { return this.carColor; } @Override public String getModal() { return this.carModel; } @Override public Double getPrice() { return this.carPrice; } }
[ "jayaaprakashjp@gmail.com" ]
jayaaprakashjp@gmail.com
4d0870c13a91319cd7ad46094f593c7826abaa49
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSnackbarController.java
baa33935bf8c4d13b750c71707d0425010013c68
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
Java
false
false
2,393
java
// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.privacy_sandbox; import android.content.Context; import org.chromium.base.ThreadUtils; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.components.browser_ui.settings.SettingsLauncher; /** * Shows the snackbar for Privacy Sandbox settings, allowing the user to quickly navigate there. */ public class PrivacySandboxSnackbarController implements SnackbarManager.SnackbarController { private Context mContext; private SettingsLauncher mSettingsLauncher; private SnackbarManager mSnackbarManager; /** * Creates an instance of the controller given a SnackbarManager and a SettingsLauncher. */ public PrivacySandboxSnackbarController( Context context, SnackbarManager manager, SettingsLauncher launcher) { ThreadUtils.assertOnUiThread(); assert manager != null; mContext = context; mSnackbarManager = manager; mSettingsLauncher = launcher; } /** * Displays a snackbar, showing the user an option to go to Privacy Sandbox settings. */ public void showSnackbar() { RecordUserAction.record("Settings.PrivacySandbox.Block3PCookies"); mSnackbarManager.dismissSnackbars(this); mSnackbarManager.showSnackbar( Snackbar.make(mContext.getString(R.string.privacy_sandbox_snackbar_message), this, Snackbar.TYPE_PERSISTENT, Snackbar.UMA_PRIVACY_SANDBOX_PAGE_OPEN) .setAction(mContext.getString(R.string.more), null) .setSingleLine(false)); } /** * Dismisses the snackbar, if it is active. */ public void dismissSnackbar() { mSnackbarManager.dismissSnackbars(this); } // Implement SnackbarController. @Override public void onAction(Object actionData) { PrivacySandboxSettingsBaseFragment.launchPrivacySandboxSettings( mContext, mSettingsLauncher, PrivacySandboxReferrer.COOKIES_SNACKBAR); } @Override public void onDismissNoAction(Object actionData) {} }
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
18b0aa5f6c85f344a7a85f06ab8b42cfc6166eaf
36e825854bd149db16dcc567bc05b31f49ba902c
/java_practice/workspace2/src/ex2/Ex4_DataOutputStream.java
171464c011e3bdc46e684953653b77ceb75ae4d4
[]
no_license
KMtheStarter/bit_java
c43eda9e0ed662d2b65ccd1f076a8f56b70c5c48
eadf0737daa5b602900d325a95b919cdaf42e6d0
refs/heads/master
2021-06-17T01:14:59.231457
2019-07-16T00:12:14
2019-07-16T00:12:14
194,573,099
0
0
null
2021-04-22T18:27:01
2019-07-01T00:07:27
Java
UHC
Java
false
false
983
java
package ex2; import java.io.DataOutputStream; import java.io.FileOutputStream; // 데이터의 자료형까지 함께 저장. // 저장된 순서대로 InputStream에 읽어 들여야 한다. public class Ex4_DataOutputStream { private String path; public Ex4_DataOutputStream() { path = "D:\\javabook\\demo\\ex4_data.txt"; } // dataType과 함께 입력을 처리하는 메서드 public void dataWrite() { //자동으로 close 수행한다. jdk 7버전부터 지원. try(DataOutputStream dos = new DataOutputStream(new FileOutputStream(path))){ // 입력 순서가 매우 중요함. // 자료형까지 들어가있기 때문에 텍스트가 깨져보임. dos.writeInt(10); dos.writeBoolean(true); dos.writeChar('A'); dos.writeFloat(10.5f); dos.writeUTF("MyTest"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } public static void main(String[] args) { new Ex4_DataOutputStream().dataWrite(); } }
[ "ikhong72@naver.com" ]
ikhong72@naver.com
d092cccab8b0ca40b1794e4ca32d25a91e1c62f2
e7078be247fa6ecb205d152a2dbf81ba8b3d07fe
/apps8/src/main/java/com/mantoo/yican/GlideImageLoader.java
2c241cb7a3e8df741641cb00de38e9da2128b4e7
[]
no_license
bluad/S8
c925094a5578075293e936eda1b9476ce50f161e
da0e14cd489bbb8b12ae842ccba9208bd7628890
refs/heads/master
2021-10-24T19:18:13.427995
2019-03-28T05:49:26
2019-03-28T05:49:26
178,114,056
0
0
null
null
null
null
UTF-8
Java
false
false
2,209
java
package com.mantoo.yican; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.lzy.imagepicker.loader.ImageLoader; import com.mantoo.yican.s8.R; import android.app.Activity; import android.content.Context; import android.net.Uri; import android.widget.ImageView; import java.io.File; /** * Created by Administrator on 2017/10/12. */ public class GlideImageLoader implements ImageLoader { public void displayImage(Context context, Object path, ImageView imageView) { //具体方法内容自己去选择,次方法是为了减少banner过多的依赖第三方包,所以将这个权限开放给使用者去选择 // Glide.with(context).load(path).into(imageView); Glide.with(context). load(path). asBitmap(). placeholder(R.mipmap.no_photo).//加载中显示的图片 diskCacheStrategy(DiskCacheStrategy.SOURCE). error(R.mipmap.plugin_camera_no_pictures).//加载失败时显示的图片 into(imageView); } @Override public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) { Glide.with(activity) //配置上下文 .load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示) .error(R.drawable.ic_default_image) //设置错误图片 .placeholder(R.drawable.ic_default_image) //设置占位图片 .diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸 .into(imageView); } @Override public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) { Glide.with(activity) //配置上下文 .load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示) .diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸 .into(imageView); } @Override public void clearMemoryCache() { } }
[ "1239459167@qq.com" ]
1239459167@qq.com
660d8ed8df5ac09138769b23b0113b11de738f7d
10354c9d5e478562263a5f52194a91bdc252126d
/TestApp1/app/src/test/java/com/example/sofia/testapp1/ExampleUnitTest.java
3c7822286c6c024fa3714127e240a80e0b947546
[]
no_license
zaifoski/android-exercises
dd0ba86c866c3179fb9feb9077df4a3d4956dd30
d234c1ba252130e577e9bdec33b4197f328f5a68
refs/heads/master
2021-01-21T12:54:02.523592
2016-04-12T16:00:59
2016-04-12T16:00:59
52,524,661
0
0
null
2016-04-12T15:24:40
2016-02-25T13:02:26
Java
UTF-8
Java
false
false
319
java
package com.example.sofia.testapp1; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "sofiachimirri@gmailcom" ]
sofiachimirri@gmailcom
d635b94f848e04f95d41b5f98056b39ba0efd216
96d5d3809d9610b31eed3bf514b6632c9e839559
/src/main/java/service/dataClasses/CountryDTO.java
a777efbe6baec57f66f64e6233936b71bf87a01a
[ "CC-BY-4.0" ]
permissive
ArminBeda/myTravelator
56692d1c5a3ef03952f8f5cb9a6e436fb84ccf6a
31c404b4b88dd2f4f3544934a99ec598ea6400aa
refs/heads/master
2020-05-17T17:10:03.690836
2019-04-07T13:01:46
2019-04-07T13:01:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
/* * Copyright © 2019 Dennis Schulmeister-Zimolong * * E-Mail: dhbw@windows3.de * Webseite: https://www.wpvs.de/ * * Dieser Quellcode ist lizenziert unter einer * Creative Commons Namensnennung 4.0 International Lizenz. */ package service.dataClasses; import dhbwka.wwi.vertsys.javaee.myTravelator.trips.jpa.Country; /** * * @author jka */ public class CountryDTO { private long id; private String name; public CountryDTO(Country country){ this.id = country.getId(); this.name = country.getName(); } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "43843195+Cahllagerfeld@users.noreply.github.com" ]
43843195+Cahllagerfeld@users.noreply.github.com
16e77bc084dc8ab2a6143ded1376f91fe2055de7
6e540d54b36e983d30e11f84d8dc9d2ae5152656
/Day16/src/lv/madara/TestThrow.java
e06513dd166d719ca95804cb1ce5f93d70063900
[]
no_license
Madara89/Java_80h
9be48f32ea1d07bd10de72c7ae02f561bf563164
8df01ee09d6bfa9080b9b6e05cfc5e580e2160e3
refs/heads/master
2022-08-25T14:52:09.748527
2020-05-25T18:35:22
2020-05-25T18:35:22
266,851,731
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package lv.madara; public class TestThrow { public static void main(String[] args) { checkAge(19); } public static void checkAge(int age){ //ar public static var main metodē uzreiz izsaukt checkAge if(age < 21){ throw new ArithmeticException("Your age is below 21."); //ar throw new iemet erroru }else{ System.out.println("Your age is "+age); } } }
[ "you@example.com" ]
you@example.com
775d4fecdc1626ae12b109d33b352f7158d93b5f
3c1b5745a76a7b401b1c4574188baa325571b276
/Leetcode/src/xyz/zhoupf/primary_algorithm/chuji07_designquestion/chuji01_daluanshuzu.java
48445f2bcd3d2ea20b75c16f8bf440b46b6ddce0
[]
no_license
zpffly001/DataStructuresandAlgorithms
62bec43191d5ae59e5b8373194fa0da7157dab76
3c42c3292a70b7abbff82d9ce5be785f8ec89c88
refs/heads/master
2023-03-05T19:48:02.145558
2021-02-17T16:01:58
2021-02-17T16:01:58
281,387,258
2
0
null
null
null
null
UTF-8
Java
false
false
2,286
java
package xyz.zhoupf.primary_algorithm.chuji07_designquestion; import java.util.Random; /** * 打乱数组 * 打乱一个没有重复元素的数组。 * 示例: * // 以数字集合 1, 2 和 3 初始化数组。 * int[] nums = {1,2,3}; * Solution solution = new Solution(nums); * // 打乱数组 [1,2,3] 并返回结果。任何 [1,2,3]的排列返回的概率应该相同。 * solution.shuffle(); * // 重设数组到它的初始状态[1,2,3]。 * solution.reset(); * // 随机返回数组[1,2,3]打乱后的结果。 * solution.shuffle(); */ public class chuji01_daluanshuzu { //暴力解法 // private int[] array; // private int[] original; // // private Random rand = new Random(); // // private List<Integer> getArrayCopy() { // List<Integer> asList = new ArrayList<Integer>(); // for (int i = 0; i < array.length; i++) { // asList.add(array[i]); // } // return asList; // } // // public chuji01_daluanshuzu(int[] nums) { // array = nums; // original = nums.clone(); // } // // public int[] reset() { // array = original; // original = original.clone(); // return array; // } // // public int[] shuffle() { // List<Integer> aux = getArrayCopy(); // // for (int i = 0; i < array.length; i++) { // int removeIdx = rand.nextInt(aux.size()); // array[i] = aux.get(removeIdx); // aux.remove(removeIdx); // } // // return array; // } //方法二: Fisher-Yates 洗牌算法 private int[] array; private int[] original; Random rand = new Random(); private int randRange(int min, int max) { return rand.nextInt(max - min) + min; } private void swapAt(int i, int j) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } public chuji01_daluanshuzu(int[] nums) { array = nums; original = nums.clone(); } public int[] reset() { array = original; original = original.clone(); return original; } public int[] shuffle() { for (int i = 0; i < array.length; i++) { swapAt(i, randRange(i, array.length)); } return array; } }
[ "1813763637@qq.com" ]
1813763637@qq.com
8036d92b788a887b3477ee2dcc7115368f448219
7c20e36b535f41f86b2e21367d687ea33d0cb329
/Capricornus/src/com/gopawpaw/erp/hibernate/m/AbstractMpdDetId.java
348883b1af536e6a765ba7c454c16dcd032be817
[]
no_license
fazoolmail89/gopawpaw
50c95b924039fa4da8f309e2a6b2ebe063d48159
b23ccffce768a3d58d7d71833f30b85186a50cc5
refs/heads/master
2016-09-08T02:00:37.052781
2014-05-14T11:46:18
2014-05-14T11:46:18
35,091,153
1
1
null
null
null
null
UTF-8
Java
false
false
2,283
java
package com.gopawpaw.erp.hibernate.m; /** * AbstractMpdDetId entity provides the base persistence definition of the * MpdDetId entity. @author MyEclipse Persistence Tools */ public abstract class AbstractMpdDetId implements java.io.Serializable { // Fields private String mpdDomain; private String mpdNbr; private String mpdType; // Constructors /** default constructor */ public AbstractMpdDetId() { } /** minimal constructor */ public AbstractMpdDetId(String mpdDomain) { this.mpdDomain = mpdDomain; } /** full constructor */ public AbstractMpdDetId(String mpdDomain, String mpdNbr, String mpdType) { this.mpdDomain = mpdDomain; this.mpdNbr = mpdNbr; this.mpdType = mpdType; } // Property accessors public String getMpdDomain() { return this.mpdDomain; } public void setMpdDomain(String mpdDomain) { this.mpdDomain = mpdDomain; } public String getMpdNbr() { return this.mpdNbr; } public void setMpdNbr(String mpdNbr) { this.mpdNbr = mpdNbr; } public String getMpdType() { return this.mpdType; } public void setMpdType(String mpdType) { this.mpdType = mpdType; } public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof AbstractMpdDetId)) return false; AbstractMpdDetId castOther = (AbstractMpdDetId) other; return ((this.getMpdDomain() == castOther.getMpdDomain()) || (this .getMpdDomain() != null && castOther.getMpdDomain() != null && this.getMpdDomain() .equals(castOther.getMpdDomain()))) && ((this.getMpdNbr() == castOther.getMpdNbr()) || (this .getMpdNbr() != null && castOther.getMpdNbr() != null && this.getMpdNbr() .equals(castOther.getMpdNbr()))) && ((this.getMpdType() == castOther.getMpdType()) || (this .getMpdType() != null && castOther.getMpdType() != null && this.getMpdType() .equals(castOther.getMpdType()))); } public int hashCode() { int result = 17; result = 37 * result + (getMpdDomain() == null ? 0 : this.getMpdDomain().hashCode()); result = 37 * result + (getMpdNbr() == null ? 0 : this.getMpdNbr().hashCode()); result = 37 * result + (getMpdType() == null ? 0 : this.getMpdType().hashCode()); return result; } }
[ "ahuaness@b3021582-c689-11de-ba9a-9db95b2bc6c5" ]
ahuaness@b3021582-c689-11de-ba9a-9db95b2bc6c5
f40bced17607db9dbff09cdf575f28a690a360e9
2368339c34e4059ac56318f13b56cff5088a029a
/app/src/androidTest/java/com/example/calculator_marshall/ExampleInstrumentedTest.java
ca96c6cd394715261f9469e40486814b1457eb4b
[]
no_license
Blychro/Calculator-project
5ac681bc94ee89a1a52720e2fafead114b1c5570
10e355a4ec97117bc347b8e3125ab8667dcccbf6
refs/heads/master
2021-03-05T15:35:13.669959
2020-04-27T20:00:42
2020-04-27T20:00:42
246,130,895
0
0
null
2020-03-09T20:05:03
2020-03-09T20:05:02
null
UTF-8
Java
false
false
778
java
package com.example.calculator_marshall; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.calculator_marshall", appContext.getPackageName()); } }
[ "tbmarshalljr@gmail.com" ]
tbmarshalljr@gmail.com
f0177c5df80e755fc66dfefa03462fbb60570e09
89f9da6c0bb99b654f6cb06073fe38f1de2af658
/java/com/google/gerrit/acceptance/VerifyNoPiiInChangeNotes.java
1bdaa6efdb6bc4b8c420960ff0fc094d93569fe2
[ "Apache-2.0" ]
permissive
GerritCodeReview/gerrit
01449252ef9b8ee519ab33661cec1229cce1f92d
19f3f45ee1c6c245070563529889cb511bcd4b99
refs/heads/master
2023-08-10T14:01:21.811497
2023-08-10T10:57:39
2023-08-10T10:58:02
47,751,755
858
210
Apache-2.0
2023-05-12T18:09:50
2015-12-10T09:32:48
Java
UTF-8
Java
false
false
1,341
java
// Copyright (C) 2021 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.google.gerrit.acceptance; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Annotation for the acceptance tests, inherited from {@link AbstractDaemonTest}, to enable * verification that NoteDB commits do not persist user-sensitive information. See {@link * AbstractDaemonTest#verifyNoAccountDetailsInChangeNotes}. * * <p>Disabled by default, can be enabled per test class/test method. */ @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface VerifyNoPiiInChangeNotes { boolean value() default false; }
[ "mariasavtchouk@google.com" ]
mariasavtchouk@google.com
a162c59e4679d60f9e3802be2c5c57186a9861de
f2a5398b84cfaa46fde61a6e180c9abeb92c1a5f
/modules/index/geotk-spatial-lucene/src/main/java/org/geotoolkit/lucene/index/ExtendedQueryParser.java
542a157c1de0aa3a052414f4c242462ddb51d701
[]
no_license
glascaleia/geotoolkit-pending
32b3a15ff0c82508af6fc3ee99033724bf0bc85e
e3908e9dfefc415169f80787cff8c94af4afce17
refs/heads/master
2020-05-20T11:09:44.894361
2012-03-29T14:43:34
2012-03-29T14:43:34
3,219,051
0
0
null
null
null
null
UTF-8
Java
false
false
3,626
java
/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2011, Geomatys * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotoolkit.lucene.index; import java.util.List; import java.util.Map; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.queryParser.ParseException; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.util.Version; /** * * @author Guilhem Legal (Geomatys) */ public class ExtendedQueryParser extends QueryParser { private final Map<String, Character> numericFields; public ExtendedQueryParser(final Version matchVersion, final String field, final Analyzer a, final Map<String, Character> numericFields) { super(matchVersion, field, a); this.numericFields = numericFields; } @Override public Query getRangeQuery(final String field, final String part1, final String part2, final boolean inclusive) throws ParseException { final TermRangeQuery query = (TermRangeQuery) super.getRangeQuery(field, part1, part2, inclusive); final Character fieldType = numericFields.get(field); if (fieldType != null) { switch (fieldType) { case 'd': return NumericRangeQuery.newDoubleRange(field, Double.parseDouble(query.getLowerTerm()), Double.parseDouble(query.getUpperTerm()), query.includesLower(), query.includesUpper()); case 'i': return NumericRangeQuery.newIntRange(field, Integer.parseInt(query.getLowerTerm()), Integer.parseInt(query.getUpperTerm()), query.includesLower(), query.includesUpper()); case 'f': return NumericRangeQuery.newFloatRange(field, Float.parseFloat(query.getLowerTerm()), Float.parseFloat(query.getUpperTerm()), query.includesLower(), query.includesUpper()); case 'l': return NumericRangeQuery.newLongRange(field, Long.parseLong(query.getLowerTerm()), Long.parseLong(query.getUpperTerm()), query.includesLower(), query.includesUpper()); default: throw new IllegalArgumentException("Unexpected field type:" + field); } } else { return query; } } }
[ "guilhem.legal@geomatys.fr" ]
guilhem.legal@geomatys.fr
76d944f3c389d8126b02405e8d2f0d57bf85c8c8
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_50814.java
c1eac4ed0e46a11a2870ed4e9f311a198adee037
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
public void setMaxRuleViolations(int max){ if (max >= 0) { this.maxRuleViolations=max; this.failOnRuleViolation=true; } }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
d993d901c57c078780821bb97e7ccabcb9a89950
c9cd4dfdcf03add31773feb31e8115dd4f502ff9
/app/src/main/java/cn/wydewy/medicalapp/util/VersionUtil.java
32030c67f3a631ef0df4b9a66566a469e2112dac
[]
no_license
BuptCAD/Medical_Android
e5d3f37af3625f0a3c6e34bd593a6db674f1a867
daf6d67f041716267a1d940adc6b0b22caa29834
refs/heads/master
2021-05-04T06:28:00.061787
2016-11-13T13:54:32
2016-11-13T13:54:32
70,470,477
1
0
null
2016-10-17T03:36:12
2016-10-10T09:00:38
Java
UTF-8
Java
false
false
1,378
java
package cn.wydewy.medicalapp.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; /** * Created by wydewy on 2016/6/7. */ public class VersionUtil { private static int versioncode; private static String versionName; /** * 返回当前程序版本名 */ public static int getAppVersionCode(Context context) { try { // ---get the package info--- PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versioncode = pi.versionCode; } catch (Exception e) { Log.e("VersionInfo", "Exception", e); } return versioncode; } /** * 返回当前程序版本名 */ public static String getAppVersionName(Context context) { try { // ---get the package info--- PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versionName = pi.versionName; if (versionName == null || versionName.length() <= 0) { return ""; } } catch (Exception e) { Log.e("VersionInfo", "Exception", e); } return versionName; } }
[ "2631069976@qq.com" ]
2631069976@qq.com
32217a940935f1470727edb49ce81e4e346c1255
201201bdeb28cd03c3aafec7ed8c56f2dc31bbb7
/module-main/src/main/java/com/dabin/module_main/view/CustomNoTouchViewPager.java
a1dfdf36fbeedbb7514465d4d23b5d091449fcd9
[]
no_license
Dabinai/Modules
4c0960e7de40a737eeeb40f858b115c880ccb4ac
692b5037072459a828ccd6a5547712649d76da73
refs/heads/master
2022-10-11T01:47:29.172469
2020-06-09T06:49:34
2020-06-09T06:49:34
263,298,568
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package com.dabin.module_main.view; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.viewpager.widget.ViewPager; public class CustomNoTouchViewPager extends ViewPager { public CustomNoTouchViewPager(@NonNull Context context) { super(context); } public CustomNoTouchViewPager(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptHoverEvent(MotionEvent event) { return false; } @Override public boolean onTouchEvent(MotionEvent ev) { return false; } }
[ "820040739@qq.com" ]
820040739@qq.com
16c8bf5aa9171ca7fbe87933832b1e725e709da0
17101b8a76d8f9566cb22c50be70857d388ea749
/src/main/java/com/qq/weixin/mp/aes/SHA1.java
04bdd9fa66f9db5211c633fec6c79c4cc0215d22
[]
no_license
wangchuan911/wx
07edba8f2fa3b270ff40e25e6579162b6298b75d
79bc74d77fa9f6f963f25de60b31e601ec54b2f5
refs/heads/master
2021-01-19T00:25:27.448165
2016-12-03T07:49:34
2016-12-03T07:49:34
73,036,563
0
0
null
null
null
null
UTF-8
Java
false
false
2,396
java
/** * 对公众平台发送给公众账号的消息加解密示例代码. * * @copyright Copyright (c) 1998-2014 Tencent Inc. */ // ------------------------------------------------------------------------ package com.qq.weixin.mp.aes; import java.security.MessageDigest; import java.util.Arrays; /** * SHA1 class * * 计算公众平台的消息签名接口. */ public class SHA1 { /** * 用SHA1算法生成安全签名 * @param token 票据 * @param timestamp 时间戳 * @param nonce 随机字符串 * @param encrypt 密文 * @return 安全签名 * @throws AesException */ public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException { try { String[] array = new String[] { token, timestamp, nonce, encrypt }; StringBuffer sb = new StringBuffer(); // 字符串排序 Arrays.sort(array); for (int i = 0; i < 4; i++) { sb.append(array[i]); } String str = sb.toString(); // SHA1签名生成 MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(str.getBytes()); byte[] digest = md.digest(); StringBuffer hexstr = new StringBuffer(); String shaHex = ""; for (int i = 0; i < digest.length; i++) { shaHex = Integer.toHexString(digest[i] & 0xFF); if (shaHex.length() < 2) { hexstr.append(0); } hexstr.append(shaHex); } return hexstr.toString(); } catch (Exception e) { e.printStackTrace(); throw new AesException(AesException.ComputeSignatureError); } } public static String getSHA1(String... value ) throws AesException { try { StringBuffer sb = new StringBuffer(); // 字符串排序 Arrays.sort(value); for (int i = 0; i < value.length; i++) { sb.append(value[i]); } String str = sb.toString(); // SHA1签名生成 MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(str.getBytes()); byte[] digest = md.digest(); StringBuffer hexstr = new StringBuffer(); String shaHex = ""; for (int i = 0; i < digest.length; i++) { shaHex = Integer.toHexString(digest[i] & 0xFF); if (shaHex.length() < 2) { hexstr.append(0); } hexstr.append(shaHex); } return hexstr.toString(); } catch (Exception e) { e.printStackTrace(); throw new AesException(AesException.ComputeSignatureError); } } }
[ "gat@Lenovo-PC" ]
gat@Lenovo-PC
a58d0dc206d949a489144867f04436023738d786
b7f3edb5b7c62174bed808079c3b21fb9ea51d52
/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/NativeBackgroundTask.java
d0850e9d625ce1c72d3ded460a60f3c505089307
[ "BSD-3-Clause" ]
permissive
otcshare/chromium-src
26a7372773b53b236784c51677c566dc0ad839e4
64bee65c921db7e78e25d08f1e98da2668b57be5
refs/heads/webml
2023-03-21T03:20:15.377034
2020-11-16T01:40:14
2020-11-16T01:40:14
209,262,645
18
21
BSD-3-Clause
2023-03-23T06:20:07
2019-09-18T08:52:07
null
UTF-8
Java
false
false
10,629
java
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.background_task_scheduler; import android.content.Context; import androidx.annotation.IntDef; import androidx.annotation.VisibleForTesting; import org.chromium.base.ThreadUtils; import org.chromium.base.task.PostTask; import org.chromium.content_public.browser.BrowserStartupController; import org.chromium.content_public.browser.UiThreadTaskTraits; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Base class implementing {@link BackgroundTask} that adds native initialization, ensuring that * tasks are run after Chrome is successfully started. */ public abstract class NativeBackgroundTask implements BackgroundTask { /** Specifies which action to take following onStartTaskBeforeNativeLoaded. */ @IntDef({StartBeforeNativeResult.LOAD_NATIVE, StartBeforeNativeResult.RESCHEDULE, StartBeforeNativeResult.DONE}) @Retention(RetentionPolicy.SOURCE) public @interface StartBeforeNativeResult { /** Task should continue to load native parts of browser. */ int LOAD_NATIVE = 0; /** Task should request rescheduling, without loading native parts of browser. */ int RESCHEDULE = 1; /** Task should neither load native parts of browser nor reschedule. */ int DONE = 2; } /** The id of the task from {@link TaskParameters}. */ protected int mTaskId; /** Indicates that the task has already been stopped. Should only be accessed on UI Thread. */ private boolean mTaskStopped; /** * If true, the task runs in Service Manager Only Mode. If false, the task runs in Full Browser * Mode. */ private boolean mRunningInServiceManagerOnlyMode; /** Make sure that we do not double record task finished metric */ private boolean mFinishMetricRecorded; /** Loads native and handles initialization. */ private NativeBackgroundTaskDelegate mDelegate; protected NativeBackgroundTask() {} /** * Sets the delegate. Must be called before any other public method is invoked. * @param delegate The delegate to handle native initialization. */ public void setDelegate(NativeBackgroundTaskDelegate delegate) { mDelegate = delegate; } @Override public final boolean onStartTask( Context context, TaskParameters taskParameters, TaskFinishedCallback callback) { ThreadUtils.assertOnUiThread(); assert mDelegate != null; mTaskId = taskParameters.getTaskId(); TaskFinishedCallback wrappedCallback = needsReschedule -> { recordTaskFinishedMetric(); callback.taskFinished(needsReschedule); }; // WrappedCallback will only be called when the work is done or in onStopTask. If the task // is short-circuited early (by returning DONE or RESCHEDULE as a StartBeforeNativeResult), // the wrappedCallback is not called. Thus task-finished metrics are only recorded if // task-started metrics are. @StartBeforeNativeResult int beforeNativeResult = onStartTaskBeforeNativeLoaded(context, taskParameters, wrappedCallback); if (beforeNativeResult == StartBeforeNativeResult.DONE) return false; if (beforeNativeResult == StartBeforeNativeResult.RESCHEDULE) { // Do not pass in wrappedCallback because this is a short-circuit reschedule. For UMA // purposes, tasks are started when runWithNative is called and does not consider // short-circuit reschedules such as this. PostTask.postTask(UiThreadTaskTraits.DEFAULT, buildRescheduleRunnable(callback)); return true; } assert beforeNativeResult == StartBeforeNativeResult.LOAD_NATIVE; runWithNative(buildStartWithNativeRunnable(context, taskParameters, wrappedCallback), buildRescheduleRunnable(wrappedCallback)); return true; } @Override public final boolean onStopTask(Context context, TaskParameters taskParameters) { ThreadUtils.assertOnUiThread(); assert mDelegate != null; mTaskStopped = true; recordTaskFinishedMetric(); if (isNativeLoadedInFullBrowserMode()) { return onStopTaskWithNative(context, taskParameters); } else { return onStopTaskBeforeNativeLoaded(context, taskParameters); } } /** * Ensure that native is started before running the task. If native fails to start, the task is * going to be rescheduled, by issuing a {@see TaskFinishedCallback} with parameter set to * <c>true</c>. * * @param startWithNativeRunnable A runnable that will execute #onStartTaskWithNative, after the * native is loaded. * @param rescheduleRunnable A runnable that will be called to reschedule the task in case * native initialization fails. */ private final void runWithNative( final Runnable startWithNativeRunnable, final Runnable rescheduleRunnable) { if (isNativeLoadedInFullBrowserMode()) { mRunningInServiceManagerOnlyMode = false; getUmaReporter().reportNativeTaskStarted(mTaskId, mRunningInServiceManagerOnlyMode); mDelegate.recordMemoryUsageWithRandomDelay(mTaskId, mRunningInServiceManagerOnlyMode); PostTask.postTask(UiThreadTaskTraits.DEFAULT, startWithNativeRunnable); return; } boolean wasInServiceManagerOnlyMode = isNativeLoadedInServiceManagerOnlyMode(); mRunningInServiceManagerOnlyMode = supportsServiceManagerOnly(); getUmaReporter().reportNativeTaskStarted(mTaskId, mRunningInServiceManagerOnlyMode); PostTask.postTask(UiThreadTaskTraits.DEFAULT, new Runnable() { @Override public void run() { // If task was stopped before we got here, don't start native initialization. if (mTaskStopped) return; // Record transitions from No Native to Service Manager Only Mode and from No Native // to Full Browser mode, but not cases in which Service Manager Only Mode was // already started. if (!wasInServiceManagerOnlyMode) { getUmaReporter().reportTaskStartedNative( mTaskId, mRunningInServiceManagerOnlyMode); } // Start native initialization. mDelegate.initializeNativeAsync(mTaskId, mRunningInServiceManagerOnlyMode, startWithNativeRunnable, rescheduleRunnable); } }); } /** * Descendant classes should override this method if they support running in service manager * only mode. * * @return if the task supports running in service manager only mode. */ protected boolean supportsServiceManagerOnly() { return false; } /** * Method that should be implemented in derived classes to provide implementation of {@link * BackgroundTask#onStartTask(Context, TaskParameters, TaskFinishedCallback)} run before native * is loaded. Task implementing the method may decide to not load native if it hasn't been * loaded yet, by returning DONE, meaning no more work is required for the task, or RESCHEDULE, * meaning task needs to be immediately rescheduled. * This method is guaranteed to be called before {@link #onStartTaskWithNative}. */ @StartBeforeNativeResult protected abstract int onStartTaskBeforeNativeLoaded( Context context, TaskParameters taskParameters, TaskFinishedCallback callback); /** * Method that should be implemented in derived classes to provide implementation of {@link * BackgroundTask#onStartTask(Context, TaskParameters, TaskFinishedCallback)} when native is * loaded. * This method will not be called unless {@link #onStartTaskBeforeNativeLoaded} returns * LOAD_NATIVE. */ protected abstract void onStartTaskWithNative( Context context, TaskParameters taskParameters, TaskFinishedCallback callback); /** Called by {@link #onStopTask} if native part of browser was not loaded. */ protected abstract boolean onStopTaskBeforeNativeLoaded( Context context, TaskParameters taskParameters); /** Called by {@link #onStopTask} if native part of browser was loaded. */ protected abstract boolean onStopTaskWithNative(Context context, TaskParameters taskParameters); /** Builds a runnable rescheduling task. */ private Runnable buildRescheduleRunnable(final TaskFinishedCallback callback) { return new Runnable() { @Override public void run() { ThreadUtils.assertOnUiThread(); if (mTaskStopped) return; callback.taskFinished(true); } }; } /** Builds a runnable starting task with native portion. */ private Runnable buildStartWithNativeRunnable(final Context context, final TaskParameters taskParameters, final TaskFinishedCallback callback) { return new Runnable() { @Override public void run() { ThreadUtils.assertOnUiThread(); if (mTaskStopped) return; onStartTaskWithNative(context, taskParameters, callback); } }; } /** Whether the native part of the browser is loaded in Full Browser Mode. */ private boolean isNativeLoadedInFullBrowserMode() { return getBrowserStartupController().isFullBrowserStarted(); } /** Whether the native part of the browser is loaded in Service Manager Only Mode. */ private boolean isNativeLoadedInServiceManagerOnlyMode() { return getBrowserStartupController().isRunningInServiceManagerMode(); } @VisibleForTesting protected BrowserStartupController getBrowserStartupController() { return BrowserStartupController.getInstance(); } private void recordTaskFinishedMetric() { ThreadUtils.assertOnUiThread(); if (!mFinishMetricRecorded) { mFinishMetricRecorded = true; getUmaReporter().reportNativeTaskFinished(mTaskId, mRunningInServiceManagerOnlyMode); } } private BackgroundTaskSchedulerExternalUma getUmaReporter() { return mDelegate.getUmaReporter(); } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
ab698bd62c7e0404918454394d93e6cf4f78ac8b
638cd2415d0439202ec09f8eba7926a46daecd06
/src/com/yichen/action/ShowMyOrder.java
e04e47f354549804a06d706b42390de87246d6f3
[]
no_license
LiuYiChen0704/OnlineShop
7dee526925c1225e13b22711190b6a802435cae6
1c6deb1fdd613e3f8dbea318ec04876d829be75a
refs/heads/master
2021-09-14T07:42:22.685862
2018-05-10T03:06:45
2018-05-10T03:06:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package com.yichen.action; import java.text.DecimalFormat; import java.util.Date; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.yichen.dao.OrderDao; import com.yichen.entity.Product; import com.yichen.entity.User; import com.yichen.entity.UserOrder; import com.yichen.service.ShowMyOrderService; import com.yichen.util.ConstVar; import com.yichen.util.DateTool; public class ShowMyOrder extends ActionSupport { private List<UserOrder> uoList; private Map<String,Object> session; private Map<String,List<String>> imgsMap; private Map<String,List<Product>> pmap; private Map<String,String> cneeMap; public List<UserOrder> getUoList() { return uoList; } public void setSession(Map<String, Object> session) { this.session = session; } public Map<String, List<String>> getImgsMap() { return imgsMap; } public Map<String, String> getCneeMap() { return cneeMap; } public Map<String, List<Product>> getPmap() { return pmap; } //格式化数字显示 public String formatDouble(double s){ DecimalFormat fmt = new DecimalFormat("\u00A4##0.00"); return fmt.format(s); } @Override public String execute() throws Exception { ActionContext actionContext=ActionContext.getContext(); session=actionContext.getSession(); User u=(User) session.get("onlineUser"); if(u!=null){ String uid=u.getU_id(); OrderDao od=new OrderDao(); uoList=od.selectAUserOrders(uid); DateTool dt=new DateTool(); Date date; for(UserOrder o:uoList){ date=dt.parseDateTime(o.getO_time()); o.setO_time(ConstVar.DATE_FORMAT_DATETIME_PRINT.format(date)); } ShowMyOrderService smos=new ShowMyOrderService(uid); imgsMap=smos.selectAUserOrdersImgs(); pmap=smos.selectAUserOrdersProducts(); cneeMap=smos.selectAUserOrdersCnee(); dt=null; return SUCCESS; }else return LOGIN; } }
[ "597429882@qq.com" ]
597429882@qq.com
a73edfcd9a4d73688810712a5f6cb7b0054927e6
513d006470bbedca5733fa878c8f3b1291ab1216
/src/main/java/org/pyj/exception/IllegalPathDuplicatedException.java
f5771fe4ecd2ae78e91e6f99586d5365de295319
[ "Apache-2.0" ]
permissive
josephcrypto/netty-websocket-http-spring-boot-starter
264f3671e20108ac0a6038247a91c283490a5b1b
ce7be5ad4f6f3702e2bcb1a325374e9684de2eb0
refs/heads/master
2023-04-06T16:52:58.031288
2021-04-06T08:16:13
2021-04-06T08:16:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package org.pyj.exception; /** * @Description: 路径映射重复异常 * @Author: pengyongjian * @Date: 2020-04-05 10:14 */ public class IllegalPathDuplicatedException extends Exception { }
[ "pengyjd@seentao.com" ]
pengyjd@seentao.com
2190e47c3cb8d2256c4b145290b217cb2eeb11ac
38f663447aa4ac931685885c9e5a865f2ec54eea
/app/src/main/java/com/example/android/azkya_1202153371_modul6/Splash.java
59ce16e82d7b01643c28c8478baf944eac0fabb7
[]
no_license
azkyath/AZKYA_1202153371_MODUL6
585aa4eecc901acbd238bc82696e7fe8c6dc2770
11c71bff3aef08afdc5b0ba34be97188cfac7647
refs/heads/master
2020-03-07T17:51:53.119189
2018-04-01T16:52:24
2018-04-01T16:52:24
127,623,013
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.example.android.azkya_1202153371_modul6; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class Splash extends AppCompatActivity { private final int SPLASH_DISPLAY_LENGTH = 4000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); setTitle("Foodie"); new Handler().postDelayed(new Runnable(){ @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent intent = new Intent(Splash.this, MainActivity.class); Splash.this.startActivity(intent); Splash.this.finish(); } }, SPLASH_DISPLAY_LENGTH); } }
[ "azkyatelisha@gmail.com" ]
azkyatelisha@gmail.com
bba3d95b4010ea3fad711ca3c74036eff69a173e
0abf4f9ab038a74b4afe960ade39cdd6b8f4be13
/ReciclemosReciclador/app/src/main/java/com/upc/reciclemosreciclador/Inicio/BolsaRechazadaFragment.java
e4a2368bb4862cf384b7fd96247bace18fee321d
[]
no_license
JALG99/ReciclemosReciclador
403b4e1910f73804cc82608523f43825d0cdac08
74536ce52f8d14a85cb09ec590cad9ad6f54577b
refs/heads/master
2022-11-23T21:48:28.109265
2020-08-03T00:16:21
2020-08-03T00:16:21
284,565,131
0
0
null
null
null
null
UTF-8
Java
false
false
4,296
java
package com.upc.reciclemosreciclador.Inicio; import android.app.ProgressDialog; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.AsyncTask; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.upc.reciclemosreciclador.Adicionales.dbHelper; import com.upc.reciclemosreciclador.Entities.Bolsa; import com.upc.reciclemosreciclador.Entities.JsonPlaceHolderApi; import com.upc.reciclemosreciclador.R; import java.io.IOException; import retrofit2.Call; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class BolsaRechazadaFragment extends Fragment { Button btnRechazar; EditText txtObservacion; int bolsa; private Retrofit retrofit; private ProgressDialog progressDialog; private Handler mHandler = new Handler(Looper.getMainLooper()){ @Override public void handleMessage(Message message) { switch (message.what){ case 1: progressDialog.show(); progressDialog.setCancelable(false); break; case 2: progressDialog.cancel(); startActivity(new Intent(getActivity().getApplicationContext(), ValidacionActivity.class)); break; } } }; public BolsaRechazadaFragment(int bolsa){ this.bolsa = bolsa; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_bolsa_aceptada, container, false); btnRechazar = v.findViewById(R.id.btnRechazar); txtObservacion = v.findViewById(R.id.txtObservacion); retrofit = new Retrofit.Builder() .baseUrl("https://recyclerapiresttdp.herokuapp.com/") .addConverterFactory(GsonConverterFactory.create()) .build(); progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Registrando observación..."); btnRechazar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(txtObservacion.getText().toString().compareTo("") != 0) new BackgroundJob(txtObservacion.getText().toString(), 1).execute(); else new BackgroundJob(txtObservacion.getText().toString(), 0).execute(); } }); return v; } public void enviar(String observacion, int c) throws IOException { JsonPlaceHolderApi jsonPlaceHolderApi = retrofit.create(JsonPlaceHolderApi.class); if(c == 1) { Call<Bolsa> call2 = jsonPlaceHolderApi.agregarObservacion("bolsa/observacion/" + bolsa + "/" + observacion); Response<Bolsa> response2 = call2.execute(); Log.e("TAG", "onResponse:" + response2.toString()); } } private class BackgroundJob extends AsyncTask<Void,Void,Void> { String obs; int c; BackgroundJob(String obs, int c){ this.obs = obs; this.c = c; } @Override protected Void doInBackground(Void... voids) { try { enviar(obs, c); Message msg = new Message(); msg.what = 1; mHandler.sendMessage(msg); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void avoid){ Message msg = new Message(); msg.what = 2; mHandler.sendMessage(msg); } } }
[ "jorgelandaverry@hotmail.com" ]
jorgelandaverry@hotmail.com
ac424dd0e42b1f21b338a66ad19c85260abfb74d
1aaea96b3bbbd7741686c78c17dda0f43c749b14
/knowledge-core/src/main/java/com/knowledge/wx/WxRedirectController.java
f0f74a29dd97ddce390d37e2f4ec1d0054f055a2
[]
no_license
lijun516888/admin-service
fb6674c634f9829bb7f968b19b45e98e825afb5e
719a2058629f2ad426f98dc44182e29d958496d3
refs/heads/master
2021-07-07T23:24:39.343771
2020-09-14T06:31:09
2020-09-14T06:31:09
188,919,560
0
0
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.knowledge.wx; import lombok.AllArgsConstructor; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; /** * @author Edward */ @AllArgsConstructor @Controller @RequestMapping("/wx/redirect/{appid}") public class WxRedirectController { private final WxMpService wxService; @RequestMapping("/greet") public String greetUser(@PathVariable String appid, @RequestParam String code, ModelMap map) { if (!this.wxService.switchover(appid)) { throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); } try { WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code); WxMpUser user = wxService.oauth2getUserInfo(accessToken, null); map.put("user", user); } catch (WxErrorException e) { e.printStackTrace(); } return "greet_user"; } }
[ "1978665672@qq.com" ]
1978665672@qq.com
075dfb8fa03755966be00cf2f69832fd1b114f8d
1deb90b5995c8e251a91105cb157974a3fbbb476
/CrossPare/src/main/java/de/ugoe/cs/cpdp/dataselection/PointWiseEMClusterSelection.java
d7bd5f24c585071b2f3632846d42d9ddc6b782b7
[ "Apache-2.0" ]
permissive
sagarwhu/CrossPare
128a7af3542632cea2e18c96c58e5cbd5d97df69
071a19b52b14f1fb400894d87b72410b11d8f519
refs/heads/master
2022-11-24T08:07:44.254914
2020-07-14T16:35:39
2020-07-14T16:35:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,304
java
// Copyright 2015 Georg-August-Universität Göttingen, Germany // // 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 de.ugoe.cs.cpdp.dataselection; import java.util.LinkedList; import java.util.List; import org.apache.commons.collections4.list.SetUniqueList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import weka.clusterers.EM; import weka.core.Instances; import weka.filters.Filter; import weka.filters.unsupervised.attribute.AddCluster; import weka.filters.unsupervised.attribute.Remove; /** * Use in Config: * * Specify number of clusters -N = Num Clusters * <pointwiseselector name="PointWiseEMClusterSelection" param="-N 10"/> * * Try to determine the number of clusters: -I 10 = max iterations -X 5 = 5 folds for cross * evaluation -max = max number of clusters * <pointwiseselector name="PointWiseEMClusterSelection" param="-I 10 -X 5 -max 300"/> * * Don't forget to add: <preprocessor name="Normalization" param=""/> */ public class PointWiseEMClusterSelection implements IPointWiseDataselectionStrategy { /** * Reference to the logger */ private static final Logger LOGGER = LogManager.getLogger("main"); /** * paramters passed to the selection */ private String[] params; /* * (non-Javadoc) * * @see de.ugoe.cs.cpdp.IParameterizable#setParameter(java.lang.String) */ @Override public void setParameter(String parameters) { this.params = parameters.split(" "); } /** * 1. Cluster the traindata 2. for each instance in the testdata find the assigned cluster 3. * select only traindata from the clusters we found in our testdata * * @returns the selected training data */ @SuppressWarnings("boxing") @Override public Instances apply(Instances testdata, Instances traindata) { // final Attribute classAttribute = testdata.classAttribute(); final List<Integer> selectedCluster = SetUniqueList.setUniqueList(new LinkedList<Integer>()); // 1. copy train- and testdata Instances train = new Instances(traindata); Instances test = new Instances(testdata); Instances selected = null; try { // remove class attribute from traindata Remove filter = new Remove(); filter.setAttributeIndices("" + (train.classIndex() + 1)); filter.setInputFormat(train); train = Filter.useFilter(train, filter); LOGGER.debug(String.format("starting clustering")); // 3. cluster data EM clusterer = new EM(); clusterer.setOptions(this.params); clusterer.buildClusterer(train); int numClusters = clusterer.getNumClusters(); if (numClusters == -1) { LOGGER.debug(String.format("we have unlimited clusters")); } else { LOGGER.debug(String.format("we have: " + numClusters + " clusters")); } // 4. classify testdata, save cluster int // remove class attribute from testdata? Remove filter2 = new Remove(); filter2.setAttributeIndices("" + (test.classIndex() + 1)); filter2.setInputFormat(test); test = Filter.useFilter(test, filter2); int cnum; for (int i = 0; i < test.numInstances(); i++) { cnum = clusterer.clusterInstance(test.get(i)); // we dont want doubles (maybe use a hashset instead of list?) if (!selectedCluster.contains(cnum)) { selectedCluster.add(cnum); // Console.traceln(Level.INFO, String.format("assigned to cluster: "+cnum)); } } LOGGER.debug(String.format("our testdata is in: " + selectedCluster.size() + " different clusters")); // 5. get cluster membership of our traindata AddCluster cfilter = new AddCluster(); cfilter.setClusterer(clusterer); cfilter.setInputFormat(train); Instances ctrain = Filter.useFilter(train, cfilter); // 6. for all traindata get the cluster int, if it is in our list of testdata cluster // int add the traindata // of this cluster to our returned traindata int cnumber; selected = new Instances(traindata); selected.delete(); for (int j = 0; j < ctrain.numInstances(); j++) { // get the cluster number from the attributes cnumber = Integer.parseInt(ctrain.get(j) .stringValue(ctrain.get(j).numAttributes() - 1).replace("cluster", "")); // Console.traceln(Level.INFO, // String.format("instance "+j+" is in cluster: "+cnumber)); if (selectedCluster.contains(cnumber)) { // this only works if the index does not change selected.add(traindata.get(j)); // check for differences, just one attribute, we are pretty sure the index does // not change if (traindata.get(j).value(3) != ctrain.get(j).value(3)) { LOGGER.warn(String .format("we have a difference between train an ctrain!")); } } } LOGGER.debug(String.format("that leaves us with: " + selected.numInstances() + " traindata instances from " + traindata.numInstances())); } catch (Exception e) { throw new RuntimeException("error in pointwise em", e); } return selected; } }
[ "herbold@cs.uni-goettingen.de" ]
herbold@cs.uni-goettingen.de
f439c46b0c71f92e37a87078872ce05c4a7ca9e0
fecac9328e2b33160725d79889a7555153b15462
/src/test/java/com/gmail/danslclo/CalculatorTest.java
e830fb0e7f6dd5d845237feb62af9b635e4e6379
[]
no_license
lewisgrass/ezo
186ddaf95c0d87ce062426287e7794f6f5222520
9a3e2276c777c6a932776aa8d5523fba70dafc52
refs/heads/master
2020-04-10T17:42:49.574277
2018-12-19T03:53:37
2018-12-19T03:53:37
161,181,640
0
0
null
null
null
null
UTF-8
Java
false
false
2,621
java
package com.gmail.danslclo; import static org.junit.jupiter.api.Assertions.*; import static com.gmail.danslclo.Calculator.Operator.*; import org.junit.jupiter.api.Test; import com.gmail.danslclo.error.IncompleteOperationError; import com.gmail.danslclo.error.ZeroDivisionError; class CalculatorTest { @Test void testAdd(){ String addResult = Calculator.parseSimpleOperation("1.5+2"); assertEquals("3.5", addResult); } @Test void testSubstract() { String minusResult = Calculator.parseSimpleOperation("1.5-2"); assertEquals("-0.5", minusResult); } @Test void testDiviseByZero(){ assertThrows(ZeroDivisionError.class, ()->{ Calculator.parseSimpleOperation("2/0"); }); } @Test void testDiviseByZeroComplex(){ assertThrows(ZeroDivisionError.class, ()->{ Calculator.parseSimpleOperation("1-1+4*2/0"); }); } @Test void testWithRedundantOperators(){ String result = Calculator.parseSimpleOperation("1--1+-4*2"); assertEquals("-4", result); } @Test void testDivise() { String divResult = Calculator.parseSimpleOperation("4/2"); assertEquals("2", divResult); } @Test void testMultiply() { String divResult = Calculator.parseSimpleOperation("4*2"); assertEquals("8", divResult); } @Test void testExecuteStringAddition() { String addResult = Calculator.parseSimpleOperation(" 4 + 2 "); assertEquals("6", addResult); } @Test void testExecuteStringSubstraction() { String addResult = Calculator.parseSimpleOperation(" 4 - 2 "); assertEquals("2", addResult); } @Test void testExecuteStringDivision() { String addResult = Calculator.parseSimpleOperation(" 4 / 2 "); assertEquals("2", addResult); } @Test void testExecuteStringMultiply() { String addResult = Calculator.parseSimpleOperation(" 4 * 2 "); assertEquals("8", addResult); } @Test void testExecuteStringMultiplyNegative() { String addResult = Calculator.parseSimpleOperation(" 4 * - 2 "); assertEquals("-8", addResult); } @Test void testExecuteThreeOperations() { String addResult = Calculator.parseSimpleOperation(" 4 * 2 -7"); assertEquals("1", addResult); } @Test void testExecuteIncompleteOperation() { assertThrows(IncompleteOperationError.class, ()->{ Calculator.parseSimpleOperation("1"); }); } @Test void testExecuteIncompleteOperationWithOperator() { assertThrows(IncompleteOperationError.class, ()->{ Calculator.parseSimpleOperation("1*"); }); } @Test void testExecuteWithComa() { String result = Calculator.parseSimpleOperation("1,1+2.1"); assertEquals("3.1999998", result); } }
[ "danslclo@gmail.com" ]
danslclo@gmail.com
0eb2f410e912fb3c20902b92decbbcefd3e03a96
8fdab545df9ff70a01db3522f174324e2f7c77c8
/ProjectOne/src/main/java/com/revature/dao/EmployeesDAOImpl.java
7fe0405a31e6286fe6c5349e1b53ce6effd607fd
[]
no_license
1810Oct29SPARK/RuizR
df124befe606f6227c9b2150dd4b3a6134670085
8bed7fae0afa989f67a2bdef4b5bca45e20ed7c4
refs/heads/master
2020-04-04T11:58:08.778182
2018-12-23T21:52:20
2018-12-23T21:52:20
155,909,796
0
0
null
null
null
null
UTF-8
Java
false
false
4,255
java
package com.revature.dao; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.revature.beans.Employees; import com.revature.util.ConnectionUtil; public class EmployeesDAOImpl implements EmployeesDAO { private static final String filename = "connection.properties"; @Override public Employees getEmployeesByUsername(String username) { Employees g = new Employees(); try(Connection con = ConnectionUtil.getConnection(filename)) { String sql = "SELECT * " + "FROM EMPLOYEES E " + "FULL JOIN LOGIN ON E.ID = LOGIN.ID " + "WHERE USERNAME = ?"; PreparedStatement pstmt = con.prepareStatement(sql); pstmt.setString(1, username); ResultSet rs = pstmt.executeQuery(); while(rs.next()) { int Id = rs.getInt("ID"); String firstName = rs.getString("FIRSTNAME"); String lastName = rs.getString("LASTNAME"); String title = rs.getString("TITLE"); String reportTo = rs.getString("REPORTTO"); String email = rs.getString("EMAIL"); g = new Employees(Id, firstName, lastName, title, reportTo, email); // g for gemployees -- the g is silent. } } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return g; } @Override public void addEmployees(String firstName, String lastName, String title, String reportTo, String email) { try(Connection con = ConnectionUtil.getConnection(filename)) { String sql = "INSERT INTO EMPLOYEES(FIRSTNAME, LASTNAME, TITLE, REPORTTO, EMAIL) VALUES (?, ?, ?, ?, ?)"; PreparedStatement pstmt = con.prepareStatement(sql); pstmt.setString(1, firstName); pstmt.setString(2, lastName); pstmt.setString(3, title); pstmt.setString(4, reportTo); pstmt.setString(5, email); pstmt.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } @Override public void updateEmployees(int id, String newFirstName, String newLastName, String newTitle, String newReportTo, String newEmail) { try(Connection con = ConnectionUtil.getConnection(filename)) { //do I have to join stuff? //write a join which unifies Employee into a ResultSet //map the ResultSet's entries onto a Employee String sql = "UPDATE EMPLOYEES " + "SET FIRSTNAME = ?, LASTNAME = ?, TITLE = ?, REPORTTO = ?, EMAIL = ? " + "WHERE ID = ?"; PreparedStatement pstmt = con.prepareStatement(sql); pstmt.setString(1, newFirstName); pstmt.setString(2, newLastName); pstmt.setString(3, newTitle); pstmt.setString(4, newReportTo); pstmt.setString(5, newEmail); pstmt.setInt(6, id); pstmt.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } @Override public void removeEmployees(int Id) { try(Connection con = ConnectionUtil.getConnection(filename)) { //do I need a join? //write a join which unifies Employee into a ResultSet //map the ResultSet's entries onto a Employee String sql = "DELETE FROM EMPLOYEES WHERE ID = ?"; PreparedStatement pstmt = con.prepareStatement(sql); pstmt.setInt(1, Id); pstmt.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } @Override public List<Employees> getEmployees() { List<Employees> emps = new ArrayList<>(); try(Connection con = ConnectionUtil.getConnection(filename)) { String sql = "SELECT * " + "FROM EMPLOYEES "; Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { int Id = rs.getInt("ID"); String firstName = rs.getString("FIRSTNAME"); String lastName = rs.getString("LASTNAME"); String title = rs.getString("TITLE"); String reportTo = rs.getString("REPORTTO"); String email = rs.getString("EMAIL"); emps.add(new Employees(Id, firstName, lastName, title, reportTo, email)); } } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return emps; } }
[ "aln.rzv@gmail.com" ]
aln.rzv@gmail.com
72b17d5644016e6728a5ccb35a91a759b7dffd65
4dd0be356be8cadf928d5c836d52006e720ceec2
/src/controller/ListItemHelper.java
4a887c31558880c373a5812f958a0773bdc1233d
[]
no_license
triluong21/Online-Car-Shopping-List
11acd9006f941ba8e3fb546b9d8631ec75356f11
17360983e477cd03a9a57a6c6512631457465ba3
refs/heads/master
2020-03-30T14:10:51.723220
2018-10-02T18:40:30
2018-10-02T18:40:30
151,304,668
0
0
null
null
null
null
UTF-8
Java
false
false
3,449
java
package controller; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.TypedQuery; import model.ListItem; public class ListItemHelper { static EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("OnlineCarShoppingList"); public void insertCar(ListItem li) { EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); em.persist(li); em.getTransaction().commit(); em.close(); } public void deleteCar(ListItem toDelete) { // TODO Auto-generated method stub EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); TypedQuery<ListItem> typedQuery = em.createQuery("select li from ListItem li where li.make = :selectedMake and li.model = :selectedModel and li.year = :selectedYear", ListItem.class); typedQuery.setParameter("selectedMake", toDelete.getMake()); typedQuery.setParameter("selectedModel", toDelete.getModel()); typedQuery.setParameter("selectedYear", toDelete.getYear()); typedQuery.setMaxResults(1); ListItem result = typedQuery.getSingleResult(); em.remove(result); em.getTransaction().commit(); em.close(); } public List<ListItem> searchForCarByYear(String yearName) { // TODO Auto-generated method stub EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); TypedQuery<ListItem> typedQuery = em.createQuery("select li from ListItem li where li.year = :selectedYear", ListItem.class); typedQuery.setParameter("selectedYear", yearName); List<ListItem> foundItems = typedQuery.getResultList(); em.close(); return foundItems; } public List<ListItem> searchForCarByModel(String modelName) { // TODO Auto-generated method stub EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); TypedQuery<ListItem> typedQuery = em.createQuery("select li from ListItem li where li.model = :selectedModel", ListItem.class); typedQuery.setParameter("selectedModel", modelName); List<ListItem> foundItems = typedQuery.getResultList(); em.close(); return foundItems; } public List<ListItem> searchForCarByMake(String makeName) { // TODO Auto-generated method stub EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); TypedQuery<ListItem> typedQuery = em.createQuery("select li from ListItem li where li.make = :selectedMake", ListItem.class); typedQuery.setParameter("selectedMake", makeName); List<ListItem> foundItems = typedQuery.getResultList(); em.close(); return foundItems; } public ListItem searchForCarById(int id){ EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); ListItem found = em.find(ListItem.class, id); em.close(); return found; } public List<ListItem> showAllCars(){ EntityManager em = emfactory.createEntityManager(); TypedQuery<ListItem> typedQuery = em.createQuery("select li from ListItem li", ListItem.class); List<ListItem> allCars = typedQuery.getResultList(); em.close(); return allCars; } public void updateCar(ListItem toEdit) { // TODO Auto-generated method stub EntityManager em = emfactory.createEntityManager(); em.getTransaction().begin(); em.merge(toEdit); em.getTransaction().commit(); em.close(); } public void cleanUp(){ emfactory.close(); } }
[ "triluong21@gmail.com" ]
triluong21@gmail.com
b873c1c93ac4d81048a64c1fd3b602b28e83121d
d133fffddfba6783f4cf9403a04269e7955a74b0
/src/osmedile/intellij/stringmanip/styles/AbstractCaseConvertingAction.java
46431df624aa217d2694e38f1dcbb0894c472df8
[ "Apache-2.0" ]
permissive
hatip5656/StringManipulation
2d94b13f36b3b59d2c26d90c50a01ed0fa4b42d4
6ea59b84fde34d806874516a1dc37a3bd889e6aa
refs/heads/master
2023-08-22T04:45:14.361417
2021-10-27T09:43:32
2021-10-27T09:43:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,609
java
package osmedile.intellij.stringmanip.styles; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.LeafPsiElement; import com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiUtilBase; import osmedile.intellij.stringmanip.AbstractStringManipAction; import osmedile.intellij.stringmanip.utils.StringUtil; import java.util.Map; /** * todo write some tests */ public abstract class AbstractCaseConvertingAction extends AbstractStringManipAction<Object> { public static final String FROM = "from"; private final Logger LOG = Logger.getInstance("#" + getClass().getCanonicalName()); public AbstractCaseConvertingAction() { } public AbstractCaseConvertingAction(boolean setupHandler) { super(setupHandler); } @Override protected boolean selectSomethingUnderCaret(Editor editor, DataContext dataContext, SelectionModel selectionModel) { try { Project project = editor.getProject(); if (project == null) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile == null) {// select whole line in plaintext return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } FileType fileType = psiFile.getFileType(); boolean handled = false; if (isJava(fileType)) { handled = javaHandling(editor, dataContext, selectionModel, psiFile); } if (!handled && isProperties(fileType)) { handled = propertiesHandling(editor, dataContext, selectionModel, psiFile); } if (!handled && fileType.equals(PlainTextFileType.INSTANCE)) { handled = super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } if (!handled) { handled = genericHandling(editor, dataContext, selectionModel, psiFile); } return handled; } catch (Throwable e) { LOG.error("please report this, so I can fix it :(", e); return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } } private boolean isProperties(FileType fileType) { try { return "Properties".equals(fileType.getName()); } catch (Throwable exception) { return false; } } private boolean isJava(FileType fileType) { try { //noinspection ConstantConditions return "JAVA".equals(fileType.getName()) && Class.forName("com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl") != null; } catch (Throwable e) { return false; } } private boolean propertiesHandling(Editor editor, DataContext dataContext, SelectionModel selectionModel, PsiFile psiFile) { PsiElement elementAtCaret = PsiUtilBase.getElementAtCaret(editor); if (elementAtCaret instanceof PsiWhiteSpace) { return false; } else if (elementAtCaret instanceof LeafPsiElement) { IElementType elementType = ((LeafPsiElement) elementAtCaret).getElementType(); if (elementType.toString().equals("Properties:VALUE_CHARACTERS") || elementType.toString().equals("Properties:KEY_CHARACTERS")) { TextRange textRange = elementAtCaret.getTextRange(); if (textRange.getLength() == 0) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } selectionModel.setSelection(textRange.getStartOffset(), textRange.getEndOffset()); return true; } } return false; } private boolean javaHandling(Editor editor, DataContext dataContext, SelectionModel selectionModel, PsiFile psiFile) { boolean steppedLeft = false; int caretOffset = editor.getCaretModel().getOffset(); PsiElement elementAtCaret = PsiUtilBase.getElementAtCaret(editor); if (elementAtCaret instanceof PsiWhiteSpace) { elementAtCaret = PsiUtilBase.getElementAtOffset(psiFile, caretOffset - 1); steppedLeft = true; } else if (elementAtCaret instanceof PsiJavaTokenImpl) { PsiJavaToken javaToken = (PsiJavaToken) elementAtCaret; if (javaToken.getTokenType() != JavaTokenType.STRING_LITERAL) { elementAtCaret = PsiUtilBase.getElementAtOffset(psiFile, caretOffset - 1); steppedLeft = true; } } if (steppedLeft && !(elementAtCaret instanceof PsiJavaToken)) { return false; } if (steppedLeft && elementAtCaret instanceof PsiJavaTokenImpl) { PsiJavaToken javaToken = (PsiJavaToken) elementAtCaret; if (javaToken.getTokenType() != JavaTokenType.STRING_LITERAL) { return false; } } if (elementAtCaret instanceof PsiJavaToken) { int offset = 0; PsiJavaToken javaToken = (PsiJavaToken) elementAtCaret; if (javaToken.getTokenType() == JavaTokenType.STRING_LITERAL) { offset = 1; } TextRange textRange = elementAtCaret.getTextRange(); if (textRange.getLength() == 0) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } selectionModel.setSelection(textRange.getStartOffset() + offset, textRange.getEndOffset() - offset); if (caretOffset < selectionModel.getSelectionStart()) { editor.getCaretModel().moveToOffset(selectionModel.getSelectionStart()); } if (caretOffset > selectionModel.getSelectionEnd()) { editor.getCaretModel().moveToOffset(selectionModel.getSelectionEnd()); } return true; } else { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } } private boolean genericHandling(Editor editor, DataContext dataContext, SelectionModel selectionModel, PsiFile psiFile) { int caretOffset = editor.getCaretModel().getOffset(); PsiElement elementAtCaret = PsiUtilBase.getElementAtCaret(editor); if (elementAtCaret instanceof PsiPlainText) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } else if (elementAtCaret instanceof PsiWhiteSpace) { elementAtCaret = PsiUtilBase.getElementAtOffset(psiFile, caretOffset - 1); } if (elementAtCaret == null || elementAtCaret instanceof PsiWhiteSpace) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } else { TextRange textRange = elementAtCaret.getTextRange(); if (textRange.getLength() == 0) { return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } selectionModel.setSelection(textRange.getStartOffset(), textRange.getEndOffset()); String selectedText = selectionModel.getSelectedText(); if (selectedText != null && selectedText.contains("\n")) { selectionModel.removeSelection(); return super.selectSomethingUnderCaret(editor, dataContext, selectionModel); } if (StringUtil.isQuoted(selectedText)) { selectionModel.setSelection(selectionModel.getSelectionStart() + 1, selectionModel.getSelectionEnd() - 1); } if (caretOffset < selectionModel.getSelectionStart()) { editor.getCaretModel().moveToOffset(selectionModel.getSelectionStart()); } if (caretOffset > selectionModel.getSelectionEnd()) { editor.getCaretModel().moveToOffset(selectionModel.getSelectionEnd()); } return true; } } protected Style getStyle(Map<String, Object> actionContext, String s) { Style from = (Style) actionContext.get(FROM); if (from == null) { from = Style.from(s); actionContext.put(FROM, from); } return from; } }
[ "vojta.krasa@gmail.com" ]
vojta.krasa@gmail.com
11e6d9eec58f1b7f177fd530a89aeafd754a7ac3
6347ce28067e711e39ba666d4021ed0ce8a17d38
/.svn/pristine/11/11e6d9eec58f1b7f177fd530a89aeafd754a7ac3.svn-base
403fec18fe071cc56878295ca2cb5e99fc080585
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-generic-cla" ]
permissive
SpotifyUsedOpenSourceCode/avro
24f621f04ab488ba4a829d8afa2e9fd1a03f0a2b
fbc9cc2bbfa17742a51b5b85c06b0ab0e3fed885
refs/heads/master
2020-04-09T21:15:23.416883
2018-12-06T01:11:21
2018-12-06T01:11:21
160,596,566
0
0
null
null
null
null
UTF-8
Java
false
false
5,778
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.avro; import java.nio.ByteBuffer; import java.util.Map; import junit.framework.Assert; import org.apache.avro.ipc.RPCContext; import org.apache.avro.ipc.RPCPlugin; import org.apache.avro.util.Utf8; /** * An implementation of an RPC metadata plugin API designed for unit testing. * This plugin tests handshake and call state by passing a string as metadata, * slowly building it up at each instrumentation point, testing it as it goes. * Finally, after the call or handshake is complete, the constructed string is * tested. */ public final class RPCMetaTestPlugin extends RPCPlugin { protected final Utf8 key; public RPCMetaTestPlugin(String keyname) { key = new Utf8(keyname); } @Override public void clientStartConnect(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestHandshakeMeta().put(key, buf); } @Override public void serverConnecting(RPCContext context) { Assert.assertNotNull(context.requestHandshakeMeta()); Assert.assertNotNull(context.responseHandshakeMeta()); if (!context.requestHandshakeMeta().containsKey(key)) return; ByteBuffer buf = context.requestHandshakeMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); buf = ByteBuffer.wrap((partialstr + "ac").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseHandshakeMeta().put(key, buf); } @Override public void clientFinishConnect(RPCContext context) { Map<Utf8,ByteBuffer> handshakeMeta = context.responseHandshakeMeta(); Assert.assertNotNull(handshakeMeta); if (!handshakeMeta.containsKey(key)) return; ByteBuffer buf = handshakeMeta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); handshakeMeta.put(key, buf); checkRPCMetaMap(handshakeMeta); } @Override public void clientSendRequest(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestCallMeta().put(key, buf); } @Override public void serverReceiveRequest(RPCContext context) { Map<Utf8,ByteBuffer> meta = context.requestCallMeta(); Assert.assertNotNull(meta); if (!meta.containsKey(key)) return; ByteBuffer buf = meta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); buf = ByteBuffer.wrap((partialstr + "a").getBytes()); Assert.assertTrue(buf.remaining() > 0); meta.put(key, buf); } @Override public void serverSendResponse(RPCContext context) { Assert.assertNotNull(context.requestCallMeta()); Assert.assertNotNull(context.responseCallMeta()); if (!context.requestCallMeta().containsKey(key)) return; ByteBuffer buf = context.requestCallMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apa", partialstr); buf = ByteBuffer.wrap((partialstr + "c").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseCallMeta().put(key, buf); } @Override public void clientReceiveResponse(RPCContext context) { Assert.assertNotNull(context.responseCallMeta()); if (!context.responseCallMeta().containsKey(key)) return; ByteBuffer buf = context.responseCallMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseCallMeta().put(key, buf); checkRPCMetaMap(context.responseCallMeta()); } protected void checkRPCMetaMap(Map<Utf8,ByteBuffer> rpcMeta) { Assert.assertNotNull(rpcMeta); Assert.assertTrue("key not present in map", rpcMeta.containsKey(key)); ByteBuffer keybuf = rpcMeta.get(key); Assert.assertNotNull(keybuf); Assert.assertTrue("key BB had nothing remaining", keybuf.remaining() > 0); String str = new String(keybuf.array()); Assert.assertEquals("apache", str); } }
[ "yangruixiang1025@163.com" ]
yangruixiang1025@163.com
3d58fdf90ae83a05a775cf6d00b4cfaa025ea0ac
b71a7ead976ff0147bcc9430cab97ae8819c96e9
/app/src/androidTest/java/com/vipulfb/hn/ApplicationTest.java
58671550d32b3eafebcf7e6fa427983aabbcb73a
[]
no_license
vipulfb/hn_cool
a204d24d2e8512907b4320a791baa9122badc2b4
7a4f667b5780bc06a26dd60af731fa891be6f024
refs/heads/master
2020-12-31T07:32:15.978887
2016-05-07T09:05:28
2016-05-07T09:05:28
58,258,328
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.vipulfb.hn; 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); } }
[ "vipul.sharma2008@gmail.com" ]
vipul.sharma2008@gmail.com
3baced5a0df00f1c430093f39f9bd84b7a3bf74a
d5b2415241aacfeaf4fcac2f92d79efc5a276b96
/crawer-biz/src/main/java/com/mk/crawer/biz/servcie/CrawGdHotelTelService.java
6ce5c47fb7084297c539cf885628147a953fc8d8
[]
no_license
mice08/crawer
40e995eecc79cfe645f06ac046bd34cd1e7b6f0d
9781f3c04c9916af80723420e3c75efa47f8c685
refs/heads/master
2021-01-10T06:28:38.467533
2016-03-24T05:11:25
2016-03-24T05:11:25
54,618,725
1
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.mk.crawer.biz.servcie; import com.mk.crawer.biz.model.crawer.GdHotel; import java.util.concurrent.LinkedBlockingQueue; /** * Created by chenqi on 16/3/23. */ public interface CrawGdHotelTelService { void executeUpdateHotelTelToDb(LinkedBlockingQueue queue); void crawGdHotelTel(GdHotel bean, LinkedBlockingQueue queue); }
[ "qi.chen@imike.com" ]
qi.chen@imike.com
8cab728edcec4dde84f25618e886b37edcff46c0
2fd313331a5adab2f0b1ed34eaf252e708fae2e4
/plants-form-configuration-service/src/main/java/uk/gov/defra/plants/formconfiguration/helper/QuestionScopeHelper.java
0427df6bf382c27d1de53a3bba14b46cd55d8fc6
[ "LicenseRef-scancode-unknown-license-reference", "OGL-UK-3.0" ]
permissive
DEFRA/trade-phes
db685bb6794f6b3ae1a733ca591db35cba36a503
604c051a6aebcf227fc49856ca37a1994cdf38a8
refs/heads/master
2023-07-12T10:34:53.003186
2021-08-13T13:57:33
2021-08-13T13:57:33
381,072,668
3
2
NOASSERTION
2021-08-13T13:57:34
2021-06-28T15:06:53
Java
UTF-8
Java
false
false
1,189
java
package uk.gov.defra.plants.formconfiguration.helper; import javax.inject.Inject; import javax.inject.Named; import uk.gov.defra.plants.common.constants.UserRole; import uk.gov.defra.plants.formconfiguration.representation.question.QuestionScope; public class QuestionScopeHelper { private UserRole userRoleApplicant; private UserRole userRoleAdmin; private UserRole userRoleCaseworker; @Inject public QuestionScopeHelper( @Named("userRoleApplicant") UserRole userRoleApplicant, @Named("userRoleAdmin") UserRole userRoleAdmin, @Named("userRoleCaseworker") UserRole userRoleCaseworker) { this.userRoleApplicant = userRoleApplicant; this.userRoleAdmin = userRoleAdmin; this.userRoleCaseworker = userRoleCaseworker; } public QuestionScope fromRole(String roleId) { if (roleId.equals(userRoleApplicant.getRoleId())) { return QuestionScope.APPLICANT; } if (roleId.equals(userRoleAdmin.getRoleId())) { return QuestionScope.BOTH; } if (roleId.equals(userRoleCaseworker.getRoleId())) { return QuestionScope.BOTH; } throw new IllegalArgumentException(String.format("Unknown role '%s'.", roleId)); } }
[ "david.jones3@defra.gov.uk" ]
david.jones3@defra.gov.uk
51fe0425591994babf6723fc5934fd866c561523
50322832a80e603e5bea0350813f0d31a388bac9
/WebContent/src/main/entity/PIZZA_PRICE.java
35a876ed3e8fc76885c40d15fd1e7c7e82114f1b
[]
no_license
banhcamvinh/DA_PizzaWeb
5ffc2f8f1c1b7594e92f47114c3fa18b8c22b61b
d498f0ceffcdf02ba97d156a1b69875683b47bb8
refs/heads/master
2023-02-20T12:45:03.506293
2021-01-16T23:48:35
2021-01-16T23:48:35
330,280,032
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package main.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.springframework.format.annotation.DateTimeFormat; @Entity public class PIZZA_PRICE implements Serializable{ @Id private Integer IDPizza; @Id @Temporal(TemporalType.DATE) @DateTimeFormat(pattern = "MM/dd/yyyy") private Date PriceDate; private Float Price; @ManyToOne @JoinColumn(name="IDPizza") private PIZZA PIZZA; public Integer getIDPizza() { return IDPizza; } public void setIDPizza(Integer iDPizza) { IDPizza = iDPizza; } public Date getPriceDate() { return PriceDate; } public void setPriceDate(Date priceDate) { PriceDate = priceDate; } public Float getPrice() { return Price; } public void setPrice(Float price) { Price = price; } public PIZZA getPIZZA() { return PIZZA; } public void setPIZZA(PIZZA pIZZA) { PIZZA = pIZZA; } }
[ "47003204+banhcamvinh@users.noreply.github.com" ]
47003204+banhcamvinh@users.noreply.github.com
052a173ebba552b8bf180a4868d00dd776c04aca
9b1f75afe3a4f11d61da3ee773a4a3e15329cc67
/DrivingTony/src/main/java/ch/epfl/cs107/play/math/Vector.java
6b8e6a29682e9d9e3e32c096ace659734eee0659
[]
no_license
xopheS/DrivingTony
655188c3e76e64d8996fd171bc8799e7d2ef2eb8
a5f8946942702223e930db556c2503c628499a06
refs/heads/master
2020-04-05T16:05:37.994185
2018-11-11T08:09:56
2018-11-11T08:09:56
156,996,527
0
0
null
null
null
null
UTF-8
Java
false
false
6,110
java
package ch.epfl.cs107.play.math; import java.io.Serializable; /** * Represents an immutable 2D floating-point vector. */ public final class Vector implements Serializable { /** The zero vector (0, 0) */ public static final Vector ZERO = new Vector(0.0f, 0.0f); /** The unit X vector (1, 0) */ public static final Vector X = new Vector(1.0f, 0.0f); /** The unit Y vector (0, 1) */ public static final Vector Y = new Vector(0.0f, 1.0f); public final float x; public final float y; /** * Creates a new vector. * * @param x * abscissa * @param y * ordinate */ public Vector(float x, float y) { this.x = x; this.y = y; } /** @return abscissa */ public float getX() { return x; } /** @return ordinate */ public float getY() { return y; } /** @return euclidian length */ public float getLength() { return (float) Math.sqrt(x * x + y * y); } /** @return angle in standard trigonometrical system, in radians */ public float getAngle() { return (float) Math.atan2(y, x); } /** @return negated vector */ public Vector opposite() { return new Vector(-x, -y); } /** * @param other * right-hand operand, not null * @return sum, not null */ public Vector add(Vector other) { return new Vector(x + other.x, y + other.y); } /** * @param x * right-hand abcissa * @param y * right-hand ordinate * @return sum, not null */ public Vector add(float x, float y) { return new Vector(this.x + x, this.y + y); } /** * @param other * right-hand operand, not null * @return difference, not null */ public Vector sub(Vector other) { return new Vector(x - other.x, y - other.y); } /** * @param x * right-hand abcissa * @param y * right-hand ordinate * @return difference, not null */ public Vector sub(float x, float y) { return new Vector(this.x - x, this.y - y); } /** * @param other * right-hand operand, not null * @return component-wise multiplication, not null */ public Vector mul(Vector other) { return new Vector(x * other.x, y * other.y); } /** * @param x * right-hand abcissa * @param y * right-hand ordinate * @return component-wise multiplication, not null */ public Vector mul(float x, float y) { return new Vector(this.x * x, this.y * y); } /** * @param s * right-hand operand * @return scaled vector, not null */ public Vector mul(float s) { return new Vector(this.x * s, this.y * s); } /** * @param other * right-hand operand, not null * @return component-wise division, not null */ public Vector div(Vector other) { return new Vector(x / other.x, y / other.y); } /** * @param x * right-hand abcissa * @param y * right-hand ordinate * @return component-wise division, not null */ public Vector div(float x, float y) { return new Vector(this.x / x, this.y / y); } /** * @param s * right-hand operand * @return scaled vector, not null */ public Vector div(float s) { return new Vector(this.x / s, this.y / s); } /** * @param other * right-hand operand, not null * @return dot product */ public float dot(Vector other) { return x * other.x + y * other.y; } /** * @param other * right-hand operand, not null * @return component-wise minimum, not null */ public Vector min(Vector other) { return new Vector(Math.min(x, other.x), Math.min(y, other.y)); } /** @return smallest component */ public float min() { return Math.min(x, y); } /** * @param other * right-hand operand, not null * @return component-wise maximum, not null */ public Vector max(Vector other) { return new Vector(Math.max(x, other.x), Math.max(y, other.y)); } /** @return largest component */ public float max() { return Math.max(x, y); } /** * Computes unit vector of same direction, or (1, 0) if zero. * * @return rescaled vector, not null */ public Vector normalized() { float length = getLength(); if (length > 1e-6) return div(length); return Vector.X; } /** * Resizes vector to specified length, or (<code>length</code>, 0) if zero. * * @param length * new length * @return rescaled vector, not null */ public Vector resized(float length) { return normalized().mul(length); } /** * Computes mirrored vector, with respect to specified normal. * * @param normal * vector perpendicular to the symmetry plane, not null * @return rotated vector, not null */ public Vector mirrored(Vector normal) { normal = normal.normalized(); return sub(normal.mul(2.0f * dot(normal))); } /** * Computes rotated vector, in a counter-clockwise manner. * * @param angle * rotation, in radians * @return rotated vector, not null */ public Vector rotated(double angle) { float c = (float) Math.cos(angle); float s = (float) Math.sin(angle); return new Vector(x * c - y * s, x * s + y * c); } /** @return vector rotated by -90°, not null */ public Vector clockwise() { return new Vector(-y, x); } /** @return vector rotated by 90°, not null */ public Vector counterClockwise() { return new Vector(y, -x); } /** * Computes linear interpolation between two vectors. * * @param other * second vector, not null * @param factor * weight of the second vector * @return interpolated vector, not null */ public Vector mixed(Vector other, float factor) { return new Vector(x * (1.0f - factor) + other.x * factor, y * (1.0f - factor) + other.y * factor); } @Override public int hashCode() { return Float.hashCode(x) ^ Float.hashCode(y); } @Override public boolean equals(Object object) { if (object == null || !(object instanceof Vector)) return false; Vector other = (Vector) object; return x == other.x && y == other.y; } @Override public String toString() { return "(" + x + "," + y + ")"; } }
[ "xophesaad@gmail.com" ]
xophesaad@gmail.com
9c846139fd0d2f9d0e00895b9ab8dd36e55321dc
6ce792b9814723300728fbc1c4396e9e1c1e0292
/src/Day24.java
f95f09a6ceeaba21d6d2afdc098c60bbda1878db
[]
no_license
zskamljic/aoc-2020
43ff81b1c594804d03a1bfbda1a0cd2a07d3bb9f
c10282a5c43a3cc9f11c7c81f61a4aca58360b71
refs/heads/master
2023-02-02T02:35:42.733203
2020-12-25T07:49:18
2020-12-25T07:49:18
318,100,225
0
0
null
null
null
null
UTF-8
Java
false
false
4,043
java
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; public class Day24 { public static void main(String[] args) throws IOException { var input = Files.readAllLines(Paths.get("input24.txt")); part01(input); part02(input); } private static void part01(List<String> input) { var colored = parseInput(input); System.out.println(colored.size()); } private static void part02(List<String> input) { var colored = parseInput(input); for (int i = 0; i < 100; i++) { colored = gameOfLifeStep(colored); } System.out.println(colored.size()); } private static Set<HexCoordinate> parseInput(List<String> input) { var colored = new HashSet<HexCoordinate>(); input.stream() .map(HexCoordinate::parse) .forEach(coordinate -> { if (colored.contains(coordinate)) { colored.remove(coordinate); } else { colored.add(coordinate); } }); return colored; } private static Set<HexCoordinate> gameOfLifeStep(Set<HexCoordinate> colored) { return colored.parallelStream() .map(HexCoordinate::neighboursAndSelf) .flatMap(Collection::stream) .distinct() .map(coordinate -> { var neighbourCount = coordinate.neighbours().parallelStream().filter(colored::contains).count(); if (colored.contains(coordinate)) { if (neighbourCount == 0 || neighbourCount > 2) { return null; } return coordinate; } else if (neighbourCount == 2) { return coordinate; } else { return null; } }) .filter(Objects::nonNull) .collect(Collectors.toSet()); } record HexCoordinate(int x, int y, int z) { List<HexCoordinate> neighbours() { var result = new ArrayList<HexCoordinate>(); result.add(new HexCoordinate(x, y + 1, z - 1)); result.add(new HexCoordinate(x + 1, y, z - 1)); result.add(new HexCoordinate(x + 1, y - 1, z)); result.add(new HexCoordinate(x, y - 1, z + 1)); result.add(new HexCoordinate(x - 1, y, z + 1)); result.add(new HexCoordinate(x - 1, y + 1, z)); return result; } List<HexCoordinate> neighboursAndSelf() { var result = neighbours(); result.add(new HexCoordinate(x, y, z)); return result; } static HexCoordinate parse(String line) { var scanner = new Scanner(line); scanner.useDelimiter(""); var x = 0; var y = 0; var z = 0; while (scanner.hasNext()) { var coordinate = scanner.next(); if (coordinate.equals("s") || coordinate.equals("n")) { coordinate += scanner.next(); } switch (coordinate) { case "e" -> { x++; y--; } case "w" -> { x--; y++; } case "ne" -> { x++; z--; } case "nw" -> { y++; z--; } case "se" -> { z++; y--; } case "sw" -> { x--; z++; } } } return new HexCoordinate(x, y, z); } } }
[ "zan.skamljic@equaleyes.com" ]
zan.skamljic@equaleyes.com
847ff508096a5595322aee0d63da36e75fdf2123
c2996b18a6f02d0b0ac872ff483fa9290e79c81a
/src/main/java/com/tangledcode/lang8/client/event/UserLoggedOutHandler.java
1305efe2057099c7e0b25d03476527d77a620091
[]
no_license
VijayEluri/lang8
8d1d07388964074e424929b17d0aec820e0b15e1
5f5b4a200a2776e052d9b60a40e5b7e1c96e5f01
refs/heads/master
2020-05-20T11:04:10.506446
2014-11-15T10:08:10
2014-11-15T10:08:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.tangledcode.lang8.client.event; import com.google.gwt.event.shared.EventHandler; public interface UserLoggedOutHandler extends EventHandler { void onUserLoggout(UserLoggedOutEvent event); }
[ "daniel.malone@gmx.de" ]
daniel.malone@gmx.de
dd7dc54dcf72587a5d9683abf06e3011da5cd88f
5772f7a9302247f78668d6266c259a80e6d83884
/src/main/java/thirdExample/MyChatClient.java
06cd78e6723118a7f36e2f46a4d487953409c4a7
[]
no_license
Bears852/netty_study
10796a46e3c08b85b24833a43ff5f55c6052c4bc
cae23a539c373977fc5e1cfed0d4172e20c4a60b
refs/heads/master
2022-02-14T00:33:19.084203
2019-08-11T03:36:47
2019-08-11T03:36:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package thirdExample; import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioSocketChannel; import secondExample.MyClientInitallizer; import java.io.BufferedReader; import java.io.InputStreamReader; //聊天客户端 public class MyChatClient { public static void main(String []args)throws Exception{ EventLoopGroup eventExecutors= new NioEventLoopGroup(); try{ Bootstrap bootstrap=new Bootstrap(); bootstrap.group(eventExecutors).channel(NioSocketChannel.class). handler(new MyChatClientInitalizer()); //连接 Channel channel= bootstrap.connect("localhost",5000).sync().channel(); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); for(;;){ channel.writeAndFlush(br.readLine()+"\r\n"); } }finally { eventExecutors.shutdownGracefully(); } } }
[ "332870852@qq.com" ]
332870852@qq.com
34d9b64b48e7933df6224f0a723663848cd10e30
11c6c66d9f00108141dffb156406c67d7897a0f2
/output/src/gervill/com/sun/media/sound/SoftLimiter.java
67ccf811f7d3c290cb3509a6db7530f3f106293b
[]
no_license
HectorRicardo/gervill-control
7cef5e8ddf165f975462cb57f622de5c97dbd38a
6209c00ac2f196bb640a326babd76bbe2680ad80
refs/heads/master
2022-12-10T03:47:06.173067
2020-09-10T01:36:28
2020-09-10T01:36:28
285,385,478
0
0
null
null
null
null
UTF-8
Java
false
false
6,284
java
/* * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package gervill.com.sun.media.sound; /** * A simple look-ahead volume limiter with very fast attack and fast release. * This filter is used for preventing clipping. * * @author Karl Helgason */ public final class SoftLimiter implements SoftAudioProcessor { float lastmax = 0; float gain = 1; float[] temp_bufferL; float[] temp_bufferR; boolean mix = false; SoftAudioBuffer bufferL; SoftAudioBuffer bufferR; SoftAudioBuffer bufferLout; SoftAudioBuffer bufferRout; float controlrate; public void init(float samplerate, float controlrate) { this.controlrate = controlrate; } public void setInput(int pin, SoftAudioBuffer input) { if (pin == 0) bufferL = input; if (pin == 1) bufferR = input; } public void setOutput(int pin, SoftAudioBuffer output) { if (pin == 0) bufferLout = output; if (pin == 1) bufferRout = output; } public void setMixMode(boolean mix) { this.mix = mix; } public void globalParameterControlChange(int[] slothpath, long param, long value) { } double silentcounter = 0; public void processAudio() { if (this.bufferL.isSilent() && (this.bufferR == null || this.bufferR.isSilent())) { silentcounter += 1 / controlrate; if (silentcounter > 60) { if (!mix) { bufferLout.clear(); if (bufferRout != null) bufferRout.clear(); } return; } } else silentcounter = 0; float[] bufferL = this.bufferL.array(); float[] bufferR = this.bufferR == null ? null : this.bufferR.array(); float[] bufferLout = this.bufferLout.array(); float[] bufferRout = this.bufferRout == null ? null : this.bufferRout.array(); if (temp_bufferL == null || temp_bufferL.length < bufferL.length) temp_bufferL = new float[bufferL.length]; if (bufferR != null) if (temp_bufferR == null || temp_bufferR.length < bufferR.length) temp_bufferR = new float[bufferR.length]; float max = 0; int len = bufferL.length; if (bufferR == null) { for (int i = 0; i < len; i++) { if (bufferL[i] > max) max = bufferL[i]; if (-bufferL[i] > max) max = -bufferL[i]; } } else { for (int i = 0; i < len; i++) { if (bufferL[i] > max) max = bufferL[i]; if (bufferR[i] > max) max = bufferR[i]; if (-bufferL[i] > max) max = -bufferL[i]; if (-bufferR[i] > max) max = -bufferR[i]; } } float lmax = lastmax; lastmax = max; if (lmax > max) max = lmax; float newgain = 1; if (max > 0.99f) newgain = 0.99f / max; else newgain = 1; if (newgain > gain) newgain = (newgain + gain * 9) / 10f; float gaindelta = (newgain - gain) / len; if (mix) { if (bufferR == null) { for (int i = 0; i < len; i++) { gain += gaindelta; float bL = bufferL[i]; float tL = temp_bufferL[i]; temp_bufferL[i] = bL; bufferLout[i] += tL * gain; } } else { for (int i = 0; i < len; i++) { gain += gaindelta; float bL = bufferL[i]; float bR = bufferR[i]; float tL = temp_bufferL[i]; float tR = temp_bufferR[i]; temp_bufferL[i] = bL; temp_bufferR[i] = bR; bufferLout[i] += tL * gain; bufferRout[i] += tR * gain; } } } else { if (bufferR == null) { for (int i = 0; i < len; i++) { gain += gaindelta; float bL = bufferL[i]; float tL = temp_bufferL[i]; temp_bufferL[i] = bL; bufferLout[i] = tL * gain; } } else { for (int i = 0; i < len; i++) { gain += gaindelta; float bL = bufferL[i]; float bR = bufferR[i]; float tL = temp_bufferL[i]; float tR = temp_bufferR[i]; temp_bufferL[i] = bL; temp_bufferR[i] = bR; bufferLout[i] = tL * gain; bufferRout[i] = tR * gain; } } } gain = newgain; } public void processControlLogic() { } }
[ "hectorricardomendez@gmail.com" ]
hectorricardomendez@gmail.com
a919280a36693685b3d461e151bdddda3e848937
3e1b49db6500ab0a5cbd0ae014b7d6d1dc54c07a
/app/src/main/java/com/example/android/happybirthday/MainActivity.java
e749a662b36162bcf70665d3a843e27e28d450bf
[]
no_license
puseletso/happybirthday
f5fc4194ba77439ea0b1b5f9ac3f44c96831e64c
bea6d8632d6f9a700b184b5485d33cb397c97256
refs/heads/master
2021-01-10T18:11:01.950395
2016-10-26T09:47:50
2016-10-26T09:47:50
71,988,241
0
0
null
null
null
null
UTF-8
Java
false
false
1,775
java
package com.example.android.happybirthday; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText editTextFrom=(EditText)findViewById(R.id.fromname_edittext); editTextFrom.setText("From :"+ editTextFrom.getText()); editTextFrom.setSelection(6); final EditText editTextTo=(EditText)findViewById(R.id.toname_edittext); editTextTo.setText("To :"+ editTextTo.getText()); editTextTo.setSelection(4); editTextTo.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if(actionId==EditorInfo.IME_ACTION_DONE){ //Clear focus here from edittext editTextTo.clearFocus(); } return false; } }); editTextFrom.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if(actionId==EditorInfo.IME_ACTION_DONE){ //Clear focus here from edittext editTextFrom.clearFocus(); editTextFrom.setCursorVisible(false); } return false; } }); } }
[ "puseletsomaraba@gmail.com" ]
puseletsomaraba@gmail.com
4ad16d3148ae7f9fa80eae8769b0a6a370e6870c
bdd54ca29d852a204907fc493a3687f4f865e170
/src/main/java/com/discord/services/SteamService.java
4673a27c8d8e9cc76ca4cd22096a92e5ccc3ad28
[]
no_license
benoitantelme/jdiscbot
282db1bdd9852874a83e684ab129aa833fe3ab3d
7ab31a84114dec1f6145ccc9301c449fdbec2e10
refs/heads/master
2023-03-03T15:37:23.048252
2021-02-07T16:05:31
2021-02-07T16:05:31
107,171,852
0
0
null
null
null
null
UTF-8
Java
false
false
1,569
java
package com.discord.services; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import org.json.JSONException; import org.json.JSONObject; public class SteamService { protected static final String STEAM_API = "http://api.steampowered.com/"; protected static final String SLASHN = "\n"; protected SteamAppNewsService newsService = new SteamAppNewsService(); protected SteamPlayerInfoService playerInfoService = new SteamPlayerInfoService(); protected SteamStoreFeaturedService storeFeaturedService = new SteamStoreFeaturedService(); public String getGameNews(String gameName) throws JSONException { return newsService.getGameNews(gameName); } public String getPlayerInfo(String playerId) throws JSONException { return playerInfoService.getPlayerInfo(playerId); } public String getStoreFeatured() { return storeFeaturedService.getStoreFeatured(); } protected static JSONObject getJsonObjectResponse(String uri) { JSONObject result; HttpResponse<JsonNode> response = null; try { response = Unirest.get(uri).asJson(); } catch (UnirestException e) { e.printStackTrace(); } if (response != null && response.getBody() != null) { result = response.getBody().getObject(); } else { result = new JSONObject(); } return result; } }
[ "benoitantelme@gmail.com" ]
benoitantelme@gmail.com
fb47a3f0fa9436a4bfa8163c4faf22da5d09ba91
022382284d94fb3e5f08955181793c817bb79d12
/app/src/androidTest/java/ch/findahl/dev/easyspanchat/ApplicationTest.java
b83a63b9eee7667f5f6ea1cde5aad48274fd6484
[]
no_license
jeppe-style/EasySPAN
0b04e9148a931cd4ddebe44c964e515eeb5792ed
1ae25847b57016f8f6db94ee39f1230d02da973a
refs/heads/master
2021-01-10T09:00:28.681875
2015-06-06T17:55:08
2015-06-06T17:55:08
36,988,824
1
2
null
null
null
null
UTF-8
Java
false
false
358
java
package ch.findahl.dev.easyspanchat; 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); } }
[ "jesper.findahl@gmail.com" ]
jesper.findahl@gmail.com
66962e681a554b2ef095aa6873aecc5fdd91b71f
d8837e9cd2dd637e6791cc101cfd88de19dc34ea
/planning-core/src/main/java/eu/scape_project/planning/taverna/generator/model/Datalink.java
f2f3083c108b508865c0854f8aebfc8636cb95a7
[ "Apache-2.0" ]
permissive
pooja6693/plato
fc82f9d9228e2eb0206382197f2537c4c29d1b90
550d3ffbcad429b35303d64ff6d59a646a5e33d0
refs/heads/master
2020-12-26T21:37:54.114341
2013-12-20T12:01:51
2013-12-20T12:01:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,784
java
/******************************************************************************* * Copyright 2006 - 2012 Vienna University of Technology, * Department of Software Technology and Interactive Systems, IFS * * 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 eu.scape_project.planning.taverna.generator.model; /** * A datalink definition. */ public class Datalink { private static final String WORKFLOW_TYPE = "dataflow"; private String sourceType; private String sourcePort; private String sourceProcessor; private String sinkType; private String sinkPort; private String sinkProcessor; /** * Creates a new datalink from the provided source to the sink. * * @param source * the source object * @param sourcePort * the port of the source object * @param sink * the sink object * @param sinkPort * the port of the sink object */ public Datalink(LinkableElement source, String sourcePort, LinkableElement sink, String sinkPort) { if (!source.hasSource(sourcePort)) { throw new IllegalArgumentException("The source has no port with name " + sourcePort); } if (!sink.hasSink(sinkPort)) { throw new IllegalArgumentException("The sink has no port with name " + sinkPort); } this.sourceType = source.getType(); this.sourcePort = sourcePort; this.sourceProcessor = WORKFLOW_TYPE.equals(source.getType()) ? null : source.getName(); this.sinkType = sink.getType(); this.sinkPort = sinkPort; this.sinkProcessor = WORKFLOW_TYPE.equals(sink.getType()) ? null : sink.getName(); } // ---------- getter/setter ---------- public String getSourceType() { return sourceType; } public String getSourcePort() { return sourcePort; } public String getSourceProcessor() { return sourceProcessor; } public String getSinkType() { return sinkType; } public String getSinkPort() { return sinkPort; } public String getSinkProcessor() { return sinkProcessor; } }
[ "plangg@ifs.tuwien.ac.at" ]
plangg@ifs.tuwien.ac.at
a2f939f05f290cf392c0b35510b3826e227d352f
822a591aaa5449879c088e5f030695d4c12e4a91
/src/main/java/com/idan/sampleapp/SampleAppApplication.java
ad0e9b2ca4767e8f8b569e953451a19807dec9dc
[]
no_license
ibidani/springboot-app
dec64cb40111ab8f2e4fd62f035a2997a03a89ff
74a31868cc326beec787485ec48b8dcad44da79d
refs/heads/master
2021-08-15T01:30:04.096611
2017-11-17T04:14:11
2017-11-17T04:14:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.idan.sampleapp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SampleAppApplication { public static void main(String[] args) { SpringApplication.run(SampleAppApplication.class, args); } }
[ "iplaman@gmail.com" ]
iplaman@gmail.com
6697302955540eb28d413c8e98985b5b5f2c95b2
2074f1faad684f66ebe46341a4553859578b640e
/myphotos-model/src/main/java/org/myphotos/validation/EnglishLanguage.java
adf1ac0733767a2c2c4f233354ac886a4fec4a89
[]
no_license
VitaliyDragun1990/mp
3a7b0fbd8e21fa0f03be7972d4c3bcca7f54da81
08f3c40e5a4857d0e9c56e91269a8ba85276bdd1
refs/heads/master
2022-02-18T12:03:12.724620
2019-08-21T14:36:26
2019-08-21T14:36:26
198,579,904
0
0
null
2022-02-09T22:10:10
2019-07-24T07:15:35
Java
UTF-8
Java
false
false
1,431
java
package org.myphotos.validation; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; import org.myphotos.validation.validator.EnglishLanguageConstraintValidator; /** * Validation annotation to check whether some text value written in Enlish * language with some specified constrains. * * @author Vitaliy Dragun * */ @Documented @Retention(RUNTIME) @Target({ FIELD, METHOD, PARAMETER, CONSTRUCTOR, ANNOTATION_TYPE }) @Constraint(validatedBy = EnglishLanguageConstraintValidator.class) public @interface EnglishLanguage { String message() default "{javax.validation.constraints.EnglishLanguage.message}"; // 0123456789 boolean withNumbers() default true; // .,?!-:()'"[]{}; \t\n boolean withPunctuations() default true; // ~#$%^&*-+=_\\|/@`!'\";:><,.?{} boolean withSpecSymbols() default true; Class<? extends Payload>[] payload() default {}; Class<?>[] groups() default {}; }
[ "vdrag00n90@gmail.com" ]
vdrag00n90@gmail.com
379bd708f1a6d69e9176d96acdd5b57b2bded9eb
3553933976f1ce43c66fe33281f3f75ec0cfdc98
/drawit/tests/shapegroups2/ShapeGroupTest_Nonleaves_2Levels.java
9810d36e9074e4abfe89cbdd2f44143cc5632fa0
[]
no_license
AdiBad/drawit
048768f5101b6bb0f3ef021552c2f5207bf12d9e
ad95ea5729d18107a7d9c830dfd83fdac1b12cc7
refs/heads/master
2023-06-17T03:00:53.904887
2021-07-14T12:56:58
2021-07-14T12:56:58
262,285,709
1
0
null
null
null
null
UTF-8
Java
false
false
10,241
java
package drawit.tests.shapegroups2; import java.awt.Color; import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.Test; import drawit.IntPoint; import drawit.IntVector; import drawit.RoundedPolygon; import drawit.shapegroups2.Extent; import drawit.shapegroups2.LeafShapeGroup; import drawit.shapegroups2.NonleafShapeGroup; import drawit.shapegroups2.ShapeGroup; class ShapeGroupTest_Nonleaves_2Levels { static IntPoint p(int x, int y) { return new IntPoint(x, y); } static IntPoint[] scale(int sx, int sy, IntPoint[] ps) { return Arrays.stream(ps).map(p -> new IntPoint(p.getX() * sx, p.getY() * sy)).toArray(n -> new IntPoint[n]); } static IntPoint[] translate(int dx, int dy, IntPoint[] ps) { IntVector v = new IntVector(dx, dy); return Arrays.stream(ps).map(p -> p.plus(v)).toArray(n -> new IntPoint[n]); } IntPoint[] triangleRight = {p(-1, -1), p(-1, 1), p(1, 0)}; IntPoint[] diamond = {p(-1, 0), p(0, -1), p(1, 0), p(0, 1)}; IntPoint[] pentagon = {p(-1, -1), p(-2, 0), p(0, 1), p(2, 0), p(1, -1)}; IntPoint[] vertices1 = translate(400, 250, scale(10, 10, triangleRight)); RoundedPolygon poly1 = new RoundedPolygon(); { poly1.setVertices(vertices1); poly1.setRadius(2); } LeafShapeGroup leaf1 = new LeafShapeGroup(poly1); { //assertEquals(390, 240, 20, 20, leaf1.getOriginalExtent()); leaf1.scale(new IntPoint(390, 240), 3.0/2, 1.0/2); leaf1.translate(new IntVector(10, 15)); // scale by 3/2, 1/2 // translate by 10, 15 } IntPoint[] vertices2 = translate(400, 250, scale(5, 20, diamond)); RoundedPolygon poly2 = new RoundedPolygon(); { poly2.setVertices(vertices2); poly2.setRadius(1); } LeafShapeGroup leaf2 = new LeafShapeGroup(poly2); { //assertEquals(395, 230, 10, 40, leaf2.getOriginalExtent()); leaf2.scale(new IntPoint(395, 230), 2, 1); leaf2.translate(new IntVector(-5, 5)); // scale by 2, 1 // translate by -5, 5 } IntPoint[] vertices3 = translate(400, 250, scale(10, 5, pentagon)); RoundedPolygon poly3 = new RoundedPolygon(); { poly3.setVertices(vertices3); poly3.setRadius(2); } LeafShapeGroup leaf3 = new LeafShapeGroup(poly3); { //assertEquals(380, 245, 40, 10, leaf3.getOriginalExtent()); leaf3.scale(new IntPoint(380, 245), 2.0/5, 2); // scale by 2/5, 2 // translate by 0, 0 } NonleafShapeGroup group1 = new NonleafShapeGroup(new ShapeGroup[] {leaf1, leaf2, leaf3}); { //assertEquals(380, 235, 50, 40, group1.getOriginalExtent()); group1.scale(new IntPoint(380, 235), 20, 10); group1.translate(new IntVector(1000, 500)); // scale by 20, 10 // translate by 1000, 500 } IntPoint[] vertices4 = translate(200, 100, scale(-5, 5, triangleRight)); RoundedPolygon poly4 = new RoundedPolygon(); { poly4.setVertices(vertices4); poly4.setRadius(1); } LeafShapeGroup leaf4 = new LeafShapeGroup(poly4); IntPoint[] vertices5 = translate(200, 200, scale(10, -10, pentagon)); RoundedPolygon poly5 = new RoundedPolygon(); { poly5.setVertices(vertices5); poly5.setRadius(3); } LeafShapeGroup leaf5 = new LeafShapeGroup(poly5); NonleafShapeGroup group2 = new NonleafShapeGroup(new ShapeGroup[] {leaf4, leaf5}); NonleafShapeGroup group3 = new NonleafShapeGroup(new ShapeGroup[] {group1, group2}); static void assertEquals(int left, int top, int width, int height, Extent actual) { assert actual.getLeft() == left; assert actual.getTop() == top; assert actual.getWidth() == width; assert actual.getHeight() == height; } static void assertEquals(int x, int y, IntPoint p) { assert p.getX() == x; assert p.getY() == y; } static void assertEquals(int x, int y, IntVector v) { assert v.getX() == x; assert v.getY() == y; } @Test void testGetShape() { assert leaf1.getShape() == poly1; assert leaf2.getShape() == poly2; assert leaf3.getShape() == poly3; } @Test void testGetBoundingBox() { assertEquals(1380, 735, 1000, 400, group1.getBoundingBox()); assertEquals(195, 95, 10, 10, leaf4.getBoundingBox()); assertEquals(180, 190, 40, 20, leaf5.getBoundingBox()); assertEquals(180, 95, 40, 115, group2.getBoundingBox()); assertEquals(180, 95, 2200, 1040, group3.getBoundingBox()); } @Test void testGetParentGroup() { assert leaf1.getParentGroup() == group1; assert leaf2.getParentGroup() == group1; assert leaf3.getParentGroup() == group1; assert group1.getParentGroup() == group3; assert leaf4.getParentGroup() == group2; assert leaf5.getParentGroup() == group2; assert group2.getParentGroup() == group3; assert group3.getParentGroup() == null; } @Test void testGetSubgroups() { assert List.of(leaf1, leaf2, leaf3).equals(group1.getSubgroups()); assert List.of(leaf4, leaf5).equals(group2.getSubgroups()); assert List.of(group1, group2).equals(group3.getSubgroups()); } @Test void testGetSubgroupCount() { assert group1.getSubgroupCount() == 3; assert group2.getSubgroupCount() == 2; assert group3.getSubgroupCount() == 2; } @Test void testGetSubgroup() { assert group1.getSubgroup(0) == leaf1; assert group1.getSubgroup(1) == leaf2; assert group1.getSubgroup(2) == leaf3; assert group2.getSubgroup(0) == leaf4; assert group2.getSubgroup(1) == leaf5; assert group3.getSubgroup(0) == group1; assert group3.getSubgroup(1) == group2; } @Test void testBringToFront1() { group1.bringToFront(); assert List.of(group1, group2).equals(group3.getSubgroups()); group2.bringToFront(); assert List.of(group2, group1).equals(group3.getSubgroups()); leaf1.bringToFront(); assert List.of(leaf1, leaf2, leaf3).equals(group1.getSubgroups()); leaf1.bringToFront(); assert List.of(leaf1, leaf2, leaf3).equals(group1.getSubgroups()); leaf2.bringToFront(); assert List.of(leaf2, leaf1, leaf3).equals(group1.getSubgroups()); leaf1.bringToFront(); assert List.of(leaf1, leaf2, leaf3).equals(group1.getSubgroups()); leaf3.bringToFront(); assert List.of(leaf3, leaf1, leaf2).equals(group1.getSubgroups()); leaf3.bringToFront(); assert List.of(leaf3, leaf1, leaf2).equals(group1.getSubgroups()); leaf2.bringToFront(); assert List.of(leaf2, leaf3, leaf1).equals(group1.getSubgroups()); } @Test void testBringToFront2() { leaf4.bringToFront(); assert List.of(leaf4, leaf5).equals(group2.getSubgroups()); leaf4.bringToFront(); assert List.of(leaf4, leaf5).equals(group2.getSubgroups()); leaf5.bringToFront(); assert List.of(leaf5, leaf4).equals(group2.getSubgroups()); leaf5.bringToFront(); assert List.of(leaf5, leaf4).equals(group2.getSubgroups()); leaf4.bringToFront(); assert List.of(leaf4, leaf5).equals(group2.getSubgroups()); } @Test void testSendToBack1() { group1.sendToBack(); assert List.of(group2, group1).equals(group3.getSubgroups()); group1.sendToBack(); assert List.of(group2, group1).equals(group3.getSubgroups()); group2.sendToBack(); assert List.of(group1, group2).equals(group3.getSubgroups()); leaf1.sendToBack(); assert List.of(leaf2, leaf3, leaf1).equals(group1.getSubgroups()); leaf1.sendToBack(); assert List.of(leaf2, leaf3, leaf1).equals(group1.getSubgroups()); leaf3.sendToBack(); assert List.of(leaf2, leaf1, leaf3).equals(group1.getSubgroups()); leaf1.sendToBack(); assert List.of(leaf2, leaf3, leaf1).equals(group1.getSubgroups()); } @Test void testSendToBack2() { leaf4.sendToBack(); assert List.of(leaf5, leaf4).equals(group2.getSubgroups()); leaf4.sendToBack(); assert List.of(leaf5, leaf4).equals(group2.getSubgroups()); leaf5.sendToBack(); assert List.of(leaf4, leaf5).equals(group2.getSubgroups()); } @Test void testSendToBack_bringToFront() { leaf1.sendToBack(); assert List.of(leaf2, leaf3, leaf1).equals(group1.getSubgroups()); leaf3.bringToFront(); assert List.of(leaf3, leaf2, leaf1).equals(group1.getSubgroups()); } @Test void testGetDrawingCommands() { poly1.setColor(Color.red); poly2.setColor(Color.green); poly3.setColor(Color.blue); poly4.setColor(Color.red); String cmds = group3.getDrawingCommands(); class DrawingCommandsSyntaxChecker { String[] tokens = cmds.split("\\s+"); int nbLines = 0; int nbArcs = 0; int nbFills = 0; int stackSize = 0; int i = 0; double parseArgument() { return Double.parseDouble(tokens[i++]); } int parseIntArgument() { return Integer.parseInt(tokens[i++]); } int parseColorComponent() { int result = parseIntArgument(); assert 0 <= result && result <= 255; return result; } void parseColor() { parseColorComponent(); parseColorComponent(); parseColorComponent(); } void parseAndCheckCoordinates() { parseArgument(); parseArgument(); } void parseAndCheckArcRadius() { parseArgument(); } void checkPopTransform() { assert stackSize > 0; stackSize--; } void check() { while (i < tokens.length) { String operator = tokens[i++]; switch (operator) { case "": break; case "line": parseAndCheckCoordinates(); parseAndCheckCoordinates(); nbLines++; break; case "arc": parseAndCheckCoordinates(); parseAndCheckArcRadius(); parseArgument(); parseArgument(); nbArcs++; break; case "fill": parseColor(); nbFills++; break; case "pushTranslate": parseArgument(); parseArgument(); stackSize++; break; case "pushScale": parseArgument(); parseArgument(); stackSize++; break; case "popTransform": checkPopTransform(); break; default: throw new AssertionError("No such drawing operator: '" + operator + "'"); } } } } assert cmds != null; var checker = new DrawingCommandsSyntaxChecker(); checker.check(); assert checker.nbLines >= 3 + 4 + 5 + 3 + 5 : "Result of getDrawingCommands() should have at least one line per polygon edge."; assert checker.nbArcs >= 3 + 4 + 5 + 3 + 5 : "Result of getDrawingCommands() should have at least one arc per polygon corner."; assert checker.nbFills >= 5 : "Result of getDrawingCommands() should have at least one fill per polygon."; // Obviously, this is a very incomplete test and should be complemented by interactive testing through the GUI. } }
[ "badola.adi@gmail.com" ]
badola.adi@gmail.com
4a5fa88026365088071be78c955ef9b4955490cf
ad95fd771603ed918f11b8e35806de8688d91da1
/src/main/java/ci/projects/rci/model/security/AuthenticationParam.java
717f7947ed565d5c1ab311d04ecbe90ebf5fc9bd
[]
no_license
HamedKaramoko/RCI-Back
e826958292fe008b8e8149bb37980767b7935ec4
f959cc45905766bed86e0bd1a5a117296e2b6000
refs/heads/master
2020-03-08T17:22:19.794239
2018-06-13T06:32:53
2018-06-13T06:32:53
128,266,799
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
/** * */ package ci.projects.rci.model.security; /** * @author hamedkaramoko * */ public class AuthenticationParam { private String login; private String password; public AuthenticationParam() { } public AuthenticationParam(String login, String password) { super(); this.login = login; this.password = password; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "mydalmajor18@gmail.com" ]
mydalmajor18@gmail.com
c43b0f642a0afadf4a9f8bc3db3142dca7dd9c1f
d28df8531baa096f68e87aa9e3e3d18a2f67384f
/Visual/src/Capitulo4/TestCircle.java
b9e5d8a1dbce02d0dcb14ec2cda174d8d85e2329
[]
no_license
FMadness/PVIS_P1_01
fb405339b8a76e2c9c83317715d5e5ac0401144a
1b009e1a023b28645a37a64971a34ae218ebdb72
refs/heads/master
2021-04-27T11:13:19.331491
2018-03-05T04:03:00
2018-03-05T04:03:00
122,558,191
0
0
null
null
null
null
UTF-8
Java
false
false
562
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 Capitulo4; /** * * @author josem */ public class TestCircle { public static void main(String[]args){ Circle c1 = new Circle(2); Circle c2 = new Circle(20); c2.setRadio(20); Circle c3 = new Circle(1); c3.setRadio(1); System.out.println(c1); System.out.println(c2); System.out.println(c3); } }
[ "jyma2596@gmail.com" ]
jyma2596@gmail.com
eba4612117ff55e3cc9059e98419aab614d0b495
a8e7217ed80875b9e9e08710113a19224d213d61
/generatedsources/com/acme/mypackage/OPAResultType.java
6d341a938819ea9184c6fa70de54a884811fccf8
[]
no_license
ministryofjustice/laa-decision-automation-model
727dcc94fe88a410a1f77189313e9d9136d9eefd
01d0989951a0e13621371c26d15d99912be48c6a
refs/heads/master
2020-03-06T17:35:30.846060
2018-05-24T12:33:03
2018-05-24T12:33:03
126,992,407
0
1
null
2021-04-08T07:43:49
2018-03-27T13:41:48
Java
UTF-8
Java
false
false
1,950
java
package com.acme.mypackage; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for OPAResultType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="OPAResultType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="Goal" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}OPAGoalType" maxOccurs="unbounded"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "OPAResultType", namespace = "http://legalservices.gov.uk/Enterprise/Common/1.0/Common", propOrder = { "goal" }) public class OPAResultType { @XmlElement(name = "Goal", required = true) protected List<OPAGoalType> goal; /** * Gets the value of the goal property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the goal property. * * <p> * For example, to add a new item, do as follows: * <pre> * getGoal().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link OPAGoalType } * * */ public List<OPAGoalType> getGoal() { if (goal == null) { goal = new ArrayList<OPAGoalType>(); } return this.goal; } }
[ "asra.hussain@digital.justice.gov.uk" ]
asra.hussain@digital.justice.gov.uk
7e21e092616edc59b849750dd5a75844d1fb5382
3e6b6ee6e7583085be479dbf9c9e96be3e54474e
/MC_Python_Andriod/lab2/McLabApp_2in1_ForAndroid 6/app/src/test/java/test/hy/mclabapp/ExampleUnitTest.java
01ab79ed94a7f605222d6eb26176ac5d8565d685
[]
no_license
HuangYe12/past_lab_projects
0fa05134a66a983c001174715a1480986525629a
2aa5fa71e3eb68538b4bbb5d41336fc8cf5a09be
refs/heads/master
2021-06-01T07:17:58.202825
2016-07-31T22:23:28
2016-07-31T22:23:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package test.hy.mclabapp; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "will.henry14@gmail.com" ]
will.henry14@gmail.com
54774a704f67b75e6d9f399c13ac958c82bad3fe
00bcd19c4d237afdf9bb20e57f4a494517603d5f
/src/main/java/io/spring/calendar/jira/JiraVersion.java
369ce3b87b0fd85f2fe2f7757355c270abe31c4d
[]
no_license
bclozel/spring-calendar
2cd3c3558b6a0188ea5699919638310a4e9f22e9
cee27f82e3882cee43d18ac4b07138f68287fe35
refs/heads/master
2021-01-11T05:24:29.957621
2017-10-20T08:07:59
2017-10-20T08:07:59
71,802,628
0
1
null
2016-10-24T15:23:46
2016-10-24T15:23:45
null
UTF-8
Java
false
false
1,489
java
/* * Copyright 2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.spring.calendar.jira; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; /** * A minimal representation of a Jira version. * * @author Andy Wilkinson */ class JiraVersion { private final String id; private final String name; private final String releaseDate; private final boolean released; @JsonCreator JiraVersion(@JsonProperty("id") String id, @JsonProperty("name") String name, @JsonProperty("releaseDate") String releaseDate, @JsonProperty("released") boolean released) { this.id = id; this.name = name; this.releaseDate = releaseDate; this.released = released; } String getId() { return this.id; } String getName() { return this.name; } String getReleaseDate() { return this.releaseDate; } public boolean isReleased() { return this.released; } }
[ "awilkinson@pivotal.io" ]
awilkinson@pivotal.io
0dee23bf8e7f968d891bb9e44af7422ea656f457
a741f2ad3aa2a4656f5b8ec730091ec4a84a6f07
/app/src/main/java/com/kaungmyatmin/haulio/helper/PreferenceHelper.java
9cf8bfb43c2c10fe34830f794211a0f8db87c5d0
[]
no_license
KaungMyat-Min/haulio
e3984a0f128ab10177087dfe61862e9f2bff771c
0bddf5e14b518dd12254d8963867426c9450467b
refs/heads/master
2020-12-14T18:05:36.409414
2020-01-21T14:59:14
2020-01-21T14:59:14
234,834,178
0
0
null
null
null
null
UTF-8
Java
false
false
1,657
java
package com.kaungmyatmin.haulio.helper; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import javax.inject.Inject; public class PreferenceHelper { private static PreferenceHelper instance; private SharedPreferences SP; @Inject public PreferenceHelper(Context mContext) { SP = PreferenceManager.getDefaultSharedPreferences(mContext); } public static PreferenceHelper getInstance(Context context) { if (instance == null) { synchronized (PreferenceHelper.class) { if (instance == null) instance = new PreferenceHelper(context); } } return instance; } private SharedPreferences.Editor getEditor() { return SP.edit(); } public void putString(String key, String value) { getEditor().putString(key, value).commit(); } public String getString(String key, String defValue) { return SP.getString(key, defValue); } public void putInt(String key, int value) { getEditor().putInt(key, value).commit(); } public int getInt(String key, int defValue) { return SP.getInt(key, defValue); } public void putBoolean(String key, boolean value) { getEditor().putBoolean(key, value).commit(); } public boolean getBoolean(String key, boolean defValue) { return SP.getBoolean(key, defValue); } public void remove(String key) { getEditor().remove(key).commit(); } public void clearPreferences() { getEditor().clear().commit(); } }
[ "kaungmyatmin.biz@gmail.com" ]
kaungmyatmin.biz@gmail.com
e4e1eb00591adaa7c4143c4112b1d92964e27c6a
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/javax_swing_JButton_setVerticalAlignment_int.java
025c3642060f4ce2252cb72914642062fdea0f49
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
174
java
class javax_swing_JButton_setVerticalAlignment_int{ public static void function() {javax.swing.JButton obj = new javax.swing.JButton();obj.setVerticalAlignment(1428320485);}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
c41011ffc55a05ab4db9efb85b21f8bd332e11c6
57df763fa1d5e410004908882d6b8875ad321745
/src/advertisementFileFactory/FileAdvertisement.java
f5fbbfd434ca0709c07265b3962139e9715f6411
[]
no_license
lucasaoki/sd0642-t3-g5
7e1f593e70fb742d29e0f7e9f5f5f52fd337bf47
4d28039c32c755c9baddc1e950b43f099db2a96f
refs/heads/master
2021-01-10T22:05:07.458712
2012-12-08T17:41:46
2012-12-08T17:41:46
33,701,850
0
0
null
null
null
null
UTF-8
Java
false
false
3,833
java
package advertisementFileFactory; import java.net.URI; import java.net.URISyntaxException; import java.util.Enumeration; import net.jxta.document.Advertisement; import net.jxta.document.AdvertisementFactory; import net.jxta.document.Document; import net.jxta.document.Element; import net.jxta.document.MimeMediaType; import net.jxta.document.StructuredDocument; import net.jxta.document.StructuredDocumentFactory; import net.jxta.document.TextElement; import net.jxta.id.ID; import net.jxta.id.IDFactory; public class FileAdvertisement extends Advertisement { public final static String AdvertisementType = "jxta:FileAdvertisement"; private ID AdvertisementID = ID.nullID; private String TheName = ""; private String Owner = ""; private final static String IDTag = "FileID"; private final static String NameTag = "FileName"; private final static String OwnerTag = "Owner"; private final static String[] IndexableFields = { IDTag, NameTag, OwnerTag }; public FileAdvertisement() { } public FileAdvertisement(Element Root) { TextElement MyTextElement = (TextElement) Root; Enumeration TheElements = MyTextElement.getChildren(); while (TheElements.hasMoreElements()) { TextElement TheElement = (TextElement) TheElements.nextElement(); ProcessElement(TheElement); } } public void ProcessElement(TextElement TheElement) { String TheElementName = TheElement.getName(); String TheTextValue = TheElement.getTextValue(); if (TheElementName.compareTo(IDTag) == 0) { try { URI ReadID = new URI(TheTextValue); AdvertisementID = IDFactory.fromURI(ReadID); return; } catch (URISyntaxException Ex) { // Issue with ID format Ex.printStackTrace(); } catch (ClassCastException Ex) { // Issue with ID type Ex.printStackTrace(); } } if (TheElementName.compareTo(NameTag) == 0) { TheName = TheTextValue; return; } if (TheElementName.compareTo(OwnerTag) == 0) { Owner = TheTextValue; return; } } @Override public Document getDocument(MimeMediaType TheMimeMediaType) { // TODO Auto-generated method stub StructuredDocument TheResult = StructuredDocumentFactory .newStructuredDocument(TheMimeMediaType, AdvertisementType); Element MyTempElement; MyTempElement = TheResult.createElement(NameTag, TheName); TheResult.appendChild(MyTempElement); MyTempElement = TheResult.createElement(OwnerTag, Owner); TheResult.appendChild(MyTempElement); return TheResult; } @Override public ID getID() { // TODO Auto-generated method stub return AdvertisementID; } public void setAdvertisementID(ID advertisementID) { AdvertisementID = advertisementID; } public String getTheName() { return TheName; } public void setTheName(String theName) { TheName = theName; } public String getOwner() { return Owner; } public void setOwner(String owner) { Owner = owner; } @Override public String[] getIndexFields() { // TODO Auto-generated method stub return IndexableFields; } @Override public FileAdvertisement clone() throws CloneNotSupportedException { FileAdvertisement Result = (FileAdvertisement) super.clone(); Result.AdvertisementID = this.AdvertisementID; Result.TheName = this.TheName; Result.Owner = this.Owner; return Result; } public static String getAdvertisementType() { return AdvertisementType; } @Override public String getAdvType() { return FileAdvertisement.class.getName(); } public static class Instantiator implements AdvertisementFactory.Instantiator { public String getAdvertisementType() { return FileAdvertisement.getAdvertisementType(); } public Advertisement newInstance() { return new FileAdvertisement(); } public Advertisement newInstance(net.jxta.document.Element root) { return new FileAdvertisement(root); } } }
[ "gilberto.vollpe@e62d20bf-c889-5b44-0442-1266973be8b9" ]
gilberto.vollpe@e62d20bf-c889-5b44-0442-1266973be8b9
5f5d547abdeae3c4d5261ca7e9985c0dcd959cb7
a4501e97c6e01d78ba8400885fa908bfb8ebdb9e
/src/browsertesting/FireFoxBrowserTesting.java
b630a6eac3e65225b32161dc388ac82fea0104fb
[]
no_license
bpatel25022012/nopcommerce
1147dcf1e9ff8687b16315eb4df41a7be7d25035
34d7f8fbb40c509bb8b403eb29a9a1355f835398
refs/heads/master
2021-03-04T00:58:12.404300
2020-03-09T20:47:43
2020-03-09T20:47:43
246,000,091
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package browsertesting; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class FireFoxBrowserTesting { public static void main(String[] args) {// do it by heart // to open the url with String baseUrl = "https://demo.nopcommerce.com/demo"; System.setProperty("webdriver.gecko.driver","drivers/geckodriver.exe" ); WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); // maximize the window driver.get(baseUrl); String title = driver.getTitle(); // get the page System.out.println("Main page " + title); driver.quit(); } }
[ "bpatel2502012@gmail.com" ]
bpatel2502012@gmail.com
cc52dde195fb22e3d0420ce78c01909ed5a5d7b0
ac82c09fd704b2288cef8342bde6d66f200eeb0d
/projects/OG-Engine/src/test/java/com/opengamma/engine/fudgemsg/CompiledViewCalculationConfigurationFudgeBuilderTest.java
3a8ed02fca310d02a1db6eb5669b6b1670f7ef09
[ "Apache-2.0" ]
permissive
cobaltblueocean/OG-Platform
88f1a6a94f76d7f589fb8fbacb3f26502835d7bb
9b78891139503d8c6aecdeadc4d583b23a0cc0f2
refs/heads/master
2021-08-26T00:44:27.315546
2018-02-23T20:12:08
2018-02-23T20:12:08
241,467,299
0
2
Apache-2.0
2021-08-02T17:20:41
2020-02-18T21:05:35
Java
UTF-8
Java
false
false
4,613
java
/** * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.engine.fudgemsg; import static org.testng.Assert.assertEquals; import java.util.Collection; import java.util.Collections; import java.util.Set; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.opengamma.engine.ComputationTargetSpecification; import com.opengamma.engine.target.ComputationTargetRequirement; import com.opengamma.engine.value.ValueProperties; import com.opengamma.engine.value.ValuePropertyNames; import com.opengamma.engine.value.ValueRequirement; import com.opengamma.engine.value.ValueSpecification; import com.opengamma.engine.view.compilation.CompiledViewCalculationConfiguration; import com.opengamma.engine.view.compilation.CompiledViewCalculationConfigurationImpl; import com.opengamma.id.ExternalId; import com.opengamma.id.UniqueId; import com.opengamma.util.test.AbstractFudgeBuilderTestCase; import com.opengamma.util.test.TestGroup; /** * Tests the {@link CompiledViewCalculationConfigurationFudgeBuilder} class. */ @Test(groups = TestGroup.UNIT) public class CompiledViewCalculationConfigurationFudgeBuilderTest extends AbstractFudgeBuilderTestCase { public void testEmpty() { final CompiledViewCalculationConfiguration in = new CompiledViewCalculationConfigurationImpl("1", Collections.<ComputationTargetSpecification>emptySet(), Collections.<ValueSpecification, Set<ValueRequirement>>emptyMap(), Collections.<ValueSpecification, Collection<ValueSpecification>>emptyMap()); final CompiledViewCalculationConfiguration out = cycleObject(CompiledViewCalculationConfiguration.class, in); assertEquals(out.getName(), in.getName()); assertEquals(out.getComputationTargets(), in.getComputationTargets()); assertEquals(out.getMarketDataRequirements(), in.getMarketDataRequirements()); assertEquals(out.getTerminalOutputSpecifications(), in.getTerminalOutputSpecifications()); } public void testBasic() { final ComputationTargetRequirement targetReq = ComputationTargetRequirement.of(ExternalId.of("Foo", "Bar")); final ComputationTargetSpecification targetSpec = ComputationTargetSpecification.of(UniqueId.of("Sec", "123")); final ValueSpecification valueSpecification = new ValueSpecification("Value", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Foo").get()); final ValueRequirement valueRequirement = new ValueRequirement("Value", targetReq); final ValueSpecification dataSpecification1 = new ValueSpecification("Data1", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final ValueSpecification dataSpecification2a = new ValueSpecification("Data2a", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final ValueSpecification dataSpecification2b = new ValueSpecification("Data2b", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final ValueSpecification dataSpecification3a = new ValueSpecification("Data3a", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final ValueSpecification dataSpecification3b = new ValueSpecification("Data3b", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final ValueSpecification dataSpecification3c = new ValueSpecification("Data3c", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get()); final CompiledViewCalculationConfiguration in = new CompiledViewCalculationConfigurationImpl("2", ImmutableSet.of(ComputationTargetSpecification.NULL, targetSpec), ImmutableMap.<ValueSpecification, Set<ValueRequirement>>of(valueSpecification, ImmutableSet.of(valueRequirement)), ImmutableMap.<ValueSpecification, Collection<ValueSpecification>>of( dataSpecification1, Collections.singleton(dataSpecification1), dataSpecification2a, Collections.singleton(dataSpecification2b), dataSpecification3a, ImmutableSet.of(dataSpecification3a, dataSpecification3b, dataSpecification3c))); final CompiledViewCalculationConfiguration out = cycleObject(CompiledViewCalculationConfiguration.class, in); assertEquals(out.getName(), in.getName()); assertEquals(out.getComputationTargets(), in.getComputationTargets()); assertEquals(out.getTerminalOutputSpecifications(), in.getTerminalOutputSpecifications()); assertEquals(out.getMarketDataRequirements(), in.getMarketDataRequirements()); } }
[ "cobaltblue.ocean@gmail.com" ]
cobaltblue.ocean@gmail.com
aa5b0d7cddd07e78bb8aab2f67a5e40f4522b3fc
51cbfdb9691a6118fdc3dca98f60fa487934724f
/day7/seam/SeamCarver.java
9999a9f1fa5feb9b68b41110f90b9e4f61bfa645
[]
no_license
akhilalla94/ADS-2_2019501041
bcb234fce8f7b2ad19bd8ac90e9d4a0310064328
005db9b2933acb59556e6e63e01fd4c3ae7614c3
refs/heads/master
2022-04-03T06:44:18.463919
2020-02-16T13:40:23
2020-02-16T13:40:23
232,394,311
0
0
null
null
null
null
UTF-8
Java
false
false
1,313
java
import java.awt.Color; public class SeamCarver { private Picture pic; private int width; private int height; public SeamCarver(Picture picture){ pic = new Picture(picture); width = picture.width(); height = picture.height(); } public Picture picture(){ return pic; } public int width(){ return width; } public int height(){ return height; } public double energy(int x ,int y){ if(x < 0 || x >width() -1 || y <0 || y >height() -1) { throw new IndexOutOfBoundsException(); } if(x == 0 || x == width() -1 || y == 0 || y == height() -1) { return 0; } double xDiff =0.0; double yDiff =0.0; Color a,b,c,d; a = pic.get(x-1,y); b = pic.get(x+1,y); c = pic.get(x,y-1); d = pic.get(x,y+1); xDiff = Math.pow((a.getRed() - b.getRed()),2) + Math.pow((a.getGreen() - b.getGreen()),2) + Math.pow((a.getBlue() - b.getBlue()),2); yDiff = Math.pow((c.getRed() - d.getRed()),2) + Math.pow((c.getGreen() - d.getGreen()),2) + Math.pow((c.getBlue() - d.getBlue()),2); double energy = Math.sqrt(xDiff + yDiff); return energy; } }
[ "akhilalla1994@msitprogram.net" ]
akhilalla1994@msitprogram.net
bbfd45153b914825b49ea74424978cfaf7c9193a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/15/15_e60c688fb9ae3274bb1fd14d64a0aff53ed9743f/WikiParser/15_e60c688fb9ae3274bb1fd14d64a0aff53ed9743f_WikiParser_s.java
3107226d554641a5bca138b55418c266e3221b98
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,217
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.util.Properties; import java.util.Vector; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.jdom.Content; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; import org.jdom.output.XMLOutputter; import org.wyona.jspwiki.Html2WikiXmlTransformer; import com.ecyrd.jspwiki.WikiContext; import com.ecyrd.jspwiki.WikiEngine; import com.ecyrd.jspwiki.WikiException; import com.ecyrd.jspwiki.WikiPage; public class WikiParser { private Properties properties = null; private String pathToWikiFile = "examples/test.txt"; private String pathToProperties = "jar/parser.properties"; private Element bodyElement = null; public static void main(String[] args) { new TestJspWikiParser(); } public TestJspWikiParser() { loadProperties(); testParser(); } public void loadProperties() { //loading properties properties = new Properties(); try { properties.load(new FileInputStream(pathToProperties)); } catch (IOException e) { e.printStackTrace(); } } public void testParser() { InputStream inputStream = convertFileToInputStream(); WikiEngine engine = null; try { engine = new WikiEngine(properties); } catch (WikiException e) { e.printStackTrace(); } WikiPage page = new WikiPage(engine, "PAGE"); WikiContext context = new WikiContext(engine, page); BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new FileReader(new File(pathToWikiFile))); String line = null; StringBuffer stringBuffer = new StringBuffer(); while ((line = bufferedReader.readLine()) != null) { stringBuffer.append(line + "\n"); } String test = engine.textToHTML(context, stringBuffer.toString()); //System.out.println(test + "\n\n"); StringBuffer html = new StringBuffer(); html.append("<html><body>"); html.append(test); html.append("</body></html>"); System.out.println(html.toString()); File temp = File.createTempFile("pattern", ".suffix"); // Delete temp file when program exits. temp.deleteOnExit(); // Write to temp file BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(html.toString()); out.close(); SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(temp); Element root = doc.getRootElement(); bodyElement = root.getChild("body"); List listRootElements = bodyElement.getChildren(); for(int i=0; i<listRootElements.size(); i++) { Element element = (Element)(listRootElements.get(i)); if(element.getName().equalsIgnoreCase("ul") || element.getName().equalsIgnoreCase("ol")) { treeWalker(element, 1); } } XMLOutputter outputter = new XMLOutputter(); String modifiedHtml = outputter.outputString(doc); System.out.println("#####################################\n" + modifiedHtml + "\n\n"); Html2WikiXmlTransformer html2WikiXml = new Html2WikiXmlTransformer(); SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); //saxParser.parse(new java.io.ByteArrayInputStream(createdHtml.toString().getBytes()), html2WikiXml); saxParser.parse(new java.io.ByteArrayInputStream(modifiedHtml.getBytes()), html2WikiXml); //setResultAsInputStream(html2WikiXml.getInputStream()); } catch(Exception e) { e.printStackTrace(); } } public void treeWalker(Content node, int counter) { if(node instanceof Element) { Element element = (Element) node; if(!("true").equals(element.getAttributeValue("moved"))) { if(element.getName().equals("li")) { element.setAttribute("depth", "" + counter); counter++; } List listChildren = element.getChildren(); for(int i=0; i<listChildren.size(); i++) { treeWalker((Element) listChildren.get(i), counter); } if(element.getName().equals("ul")) { moveElement(element, "ul"); } if(element.getName().equals("ol")) { moveElement(element, "ol"); } element.setAttribute("moved", "true"); } } } public void moveElement(Element element, String name) { int position = 0; Vector keepThisKids = new Vector(); Element grandParentElement = element.getParentElement().getParentElement(); if(grandParentElement.getName().equals(name)) { Element temp = element.getParentElement(); List movingChildren = element.getChildren(); for(int i=0; i<movingChildren.size(); i++) { keepThisKids.add(movingChildren.get(i)); ((Element)(movingChildren.get(i))).detach(); } element.detach(); position = grandParentElement.indexOf(temp) + 1; grandParentElement.addContent(position, keepThisKids); } else if(name.equals("ol") && grandParentElement.getName().equals("ul") || name.equals("ul") && grandParentElement.getName().equals("ol")) { Element subRoot = getActualRootsChild(element); List movingChildren = element.getChildren(); for(int i=0; i<movingChildren.size(); i++) { keepThisKids.add(movingChildren.get(i)); ((Element)(movingChildren.get(i))).detach(); } element.detach(); position = bodyElement.indexOf(subRoot) + 1; bodyElement.addContent(position, keepThisKids); } //TODO handle this bug DONT know where to attach this } public Element getActualRootsChild(Element element) { if(element.getParentElement().equals(bodyElement)) return element; else return getActualRootsChild(element.getParentElement()); } public void debugInputStream(InputStream inputStream) { try { InputStreamReader inR = new InputStreamReader(inputStream); BufferedReader buf = new BufferedReader(inR); String line; while ((line = buf.readLine()) != null) { System.out.println(line); } } catch (Exception e) { e.printStackTrace(); } } private InputStream convertFileToInputStream() { String record = null; StringBuffer fileData = new StringBuffer(); try { BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(pathToWikiFile))); while ((record = bufferedReader.readLine()) != null) { fileData.append(record + "\n"); //System.out.println(record); } } catch (IOException e) { System.out.println("Uh oh, got an IOException error!" + e.getMessage()); } return new ByteArrayInputStream(fileData.toString().getBytes()); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
847a838de4687b6a6d5b49dbc8a5501aed10e417
d8772960b3b2b07dddc8a77595397cb2618ec7b0
/rhServer/src/main/java/com/rhlinkcon/repository/periciaMedica/PericiaMedicaRepository.java
58513bedb0983e49bb7ab76f9afa6291f52ace1d
[]
no_license
vctrmarques/interno-rh-sistema
c0f49a17923b5cdfaeb148c6f6da48236055cf29
7a7a5d9c36c50ec967cb40a347ec0ad3744d896e
refs/heads/main
2023-03-17T02:07:10.089496
2021-03-12T19:06:05
2021-03-12T19:06:05
347,168,924
0
1
null
null
null
null
UTF-8
Java
false
false
841
java
package com.rhlinkcon.repository.periciaMedica; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import com.rhlinkcon.model.ConsultaPericiaMedica; import com.rhlinkcon.model.PacientePericiaMedica; @Repository public interface PericiaMedicaRepository extends JpaRepository<ConsultaPericiaMedica, Long> { @Query("SELECT cpm FROM ConsultaPericiaMedica cpm" + " WHERE cpm.pacientePericiaMedica.id = :id " + " AND cpm.compareceu = false " + " AND DATENAME(YEAR, CURRENT_TIMESTAMP) >= DATENAME(YEAR, cpm.agendaMedicaData.data)") List<ConsultaPericiaMedica> getConsultaPericiaMedicaByPacientePericiaMedicaId(@Param("id") Long id); }
[ "vctmarques@gmail.com" ]
vctmarques@gmail.com
0d796cc471f27406762479a98a3878d0cd3953c2
0081faf2e24801a4f3878ebdfde51c74ea5ff303
/Tarea3/src/tarea3/Arista.java
0b50ffe82a9f2b1c499559098ba4da6413773a0d
[]
no_license
MarxArturo/PintadoGrafo
f8e236049172ce3dfe162d8995d67542ce83aace
d89c7c8b4818abd5408107e24d829be1a7ecec89
refs/heads/master
2016-08-04T06:40:08.650796
2013-12-20T05:48:10
2013-12-20T05:48:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,124
java
package tarea3; import java.io.*; import java.awt.*; import java.lang.Math; public class Arista { private Point coords1, coords2, coordsMedias; //private Point [] coordsFlecha; //private String simbolo; public Arista(Point inCoords1, Point inCoords2) { coords1=inCoords1; coords2=inCoords2; //simbolo=inSimbolo; //cambiar a simbolo de epsilon // if(simbolo.equals("_")) // { // simbolo="E"; // } //coordsMedias (punto para que la arista no sea una linea recta) int diferenciaX=(int)(Math.random()*41-20);//para que se diferencien visualmente las aristas int diferenciaY=(int)(Math.random()*41-20);//para que se diferencien visualmente las aristas coordsMedias=new Point(((coords1.x-coords2.x)/2)*-1+coords1.x+diferenciaX, ((coords1.y-coords2.y)/2)*-1+coords1.y+diferenciaY); //Longitud de la arista desde coordsMedias double longitud=Math.sqrt(Math.pow(coordsMedias.x-coords2.x, 2)+Math.pow(coordsMedias.y-coords2.y, 2)); //Puntos de la flecha //coordsFlecha=new Point [2]; int longitudFlecha=18;//longitud de la flecha double diferenciaAngulos=0.04;//para la anchura de la flecha double teta;//angulo try { teta=Math.atan2(coords2.y-coordsMedias.y, coords2.x-coordsMedias.x); } catch(ArithmeticException e) { teta=Math.PI/2; } //coordsFlecha[0]=new Point((int)Math.round(coordsMedias.x+(Math.cos(teta+diferenciaAngulos)*(longitud-longitudFlecha))), (int)Math.round(coordsMedias.y+(Math.sin(teta+diferenciaAngulos)*(longitud-longitudFlecha))));//calculo del punto1 de la flecha //coordsFlecha[1]=new Point((int)Math.round(coordsMedias.x+(Math.cos(teta-diferenciaAngulos)*(longitud-longitudFlecha))), (int)Math.round(coordsMedias.y+(Math.sin(teta-diferenciaAngulos)*(longitud-longitudFlecha))));//calculo del punto2 de la flecha } // public Point [] getCoordsFlecha() // { // return coordsFlecha; // } public Point getCoords1() { return coords1; } public Point getCoords2() { return coords2; } public Point getCoordsMedias() { return coordsMedias; } // public String getSimbolo() // { // return simbolo; // } }
[ "Marx@192.168.0.10" ]
Marx@192.168.0.10
19199ef6631d7caf50359a33eff4a6c4b0f0624d
a0b5d2911665e5e4e673c1bf732bc82ea336e797
/mooc/Array/src/stack/ArrayStack.java
ffad3b8b493e24189d88aebbe52b804e3bcf7a79
[]
no_license
Shendy2017/datastrutures
201e2df0d56d24a46de5292601c20e04a81cc87a
a648f57b66ef1a1830b31d7f673b68b4c3a39785
refs/heads/master
2022-03-07T07:45:48.293614
2019-10-08T09:54:52
2019-10-08T09:54:52
258,414,637
0
0
null
2020-04-24T05:27:52
2020-04-24T05:27:52
null
UTF-8
Java
false
false
1,132
java
package stack; /** * 数组实现 * @param <E> */ public class ArrayStack<E> implements Stack<E> { private Array<E> array; public ArrayStack(int capacity){ array = new Array<>(capacity); } public ArrayStack(){ array = new Array<>(); } @Override public int getSize(){ return array.getSize(); } @Override public boolean isEmpty(){ return array.isEmpty(); } public int getCapacity(){ return array.getCapacity(); } @Override public void push(E e){ array.addLast(e); } @Override public E pop(){ return array.removeLast(); } @Override public E peek(){ return array.getLast(); } @Override public String toString(){ StringBuilder res = new StringBuilder(); res.append("Stack: "); res.append('['); for(int i = 0 ; i < array.getSize() ; i ++){ res.append(array.get(i)); if(i != array.getSize() - 1) res.append(", "); } res.append("] top"); return res.toString(); } }
[ "244160321@qq.com" ]
244160321@qq.com
f291524b5c16e688c25678a0284d6e027ebee873
c1ebce0d621633c784b1093191999d5d25875f24
/semana 1/RepasoVideosSemana1/app/src/main/java/com/example/repasovideossemana1/MainActivity.java
5c84727c32eb78d93a1fc8561d988ed57acfd1cc
[]
no_license
sebastianRebolledo/Apps-Moviles
cf83c79dab2ba6e2351d26f532f4d5812f5dd9e6
015542cc05e5c8103225bdff57aa187f706f659d
refs/heads/main
2023-03-30T07:26:00.266006
2021-03-30T15:45:44
2021-03-30T15:45:44
351,577,968
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package com.example.repasovideossemana1; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "issareme@hotmail.com" ]
issareme@hotmail.com
2a57c2f7cc89653093a9a1ce608d13f972af2293
09649412e12bdc15cf61607e881203735cfafa50
/src/test/java/com/microsoft/bingads/v10/api/test/entities/account/write/BulkAccountWriteToRowValuesCustomerIdTest.java
8b5f2526cc76ac58f69fcc6dd306b12c3b92490d
[ "MIT" ]
permissive
yosefarr/BingAds-Java-SDK
cec603b74a921e71c6173ce112caccdf7c1fdbc8
d1c333d0ba5b7e434c85a92c7a80dad0add0d634
refs/heads/master
2021-01-18T15:02:53.945816
2016-03-06T13:18:32
2016-03-06T13:18:32
51,738,651
0
1
null
2016-02-15T07:38:14
2016-02-15T07:38:13
null
UTF-8
Java
false
false
1,481
java
package com.microsoft.bingads.v10.api.test.entities.account.write; import com.microsoft.bingads.v10.api.test.entities.account.BulkAccountTest; import com.microsoft.bingads.v10.bulk.entities.BulkAccount; import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer; import java.util.Arrays; import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class BulkAccountWriteToRowValuesCustomerIdTest extends BulkAccountTest { @Parameter(value = 1) public Long propertyValue; @Parameters public static Collection<Object[]> data() { // In this example, the parameter generator returns a List of // arrays. Each array has two elements: { datum, expected }. // These data are hard-coded into the class, but they could be // generated or loaded in any way you like. return Arrays.asList(new Object[][]{ {"123", 123L}, {"9223372036854775807", 9223372036854775807L} }); } @Test public void testWrite() { this.<Long>testWriteProperty("Parent Id", this.datum, this.propertyValue, new BiConsumer<BulkAccount, Long>() { @Override public void accept(BulkAccount c, Long v) { c.setCustomerId(v); } }); } }
[ "jiaj@microsoft.com" ]
jiaj@microsoft.com
12ad614a9c1e913d0fa7a48f3065929209a130de
a7e8e204cb44c7a199fa3097f13fd281340cd512
/src/main/java/com/inetpsa/pct00/pct00demo/security/jwt/TokenProvider.java
127dd5dd8e23eb2c3b636da8b627e98227881c01
[]
no_license
hartmanjan/jhipsterSampleApplication
8e69d9718c7ef34f9ce6572512380253be669e6d
fdacc26a6a8fd495e043b007ece3174966291746
refs/heads/master
2020-03-17T15:32:32.764375
2018-05-16T19:37:39
2018-05-16T19:37:39
133,714,671
0
0
null
null
null
null
UTF-8
Java
false
false
4,052
java
package com.inetpsa.pct00.pct00demo.security.jwt; import io.github.jhipster.config.JHipsterProperties; import java.util.*; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.stereotype.Component; import io.jsonwebtoken.*; @Component public class TokenProvider { private final Logger log = LoggerFactory.getLogger(TokenProvider.class); private static final String AUTHORITIES_KEY = "auth"; private String secretKey; private long tokenValidityInMilliseconds; private long tokenValidityInMillisecondsForRememberMe; private final JHipsterProperties jHipsterProperties; public TokenProvider(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @PostConstruct public void init() { this.secretKey = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret(); this.tokenValidityInMilliseconds = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds(); this.tokenValidityInMillisecondsForRememberMe = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSecondsForRememberMe(); } public String createToken(Authentication authentication, boolean rememberMe) { String authorities = authentication.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); long now = (new Date()).getTime(); Date validity; if (rememberMe) { validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe); } else { validity = new Date(now + this.tokenValidityInMilliseconds); } return Jwts.builder() .setSubject(authentication.getName()) .claim(AUTHORITIES_KEY, authorities) .signWith(SignatureAlgorithm.HS512, secretKey) .setExpiration(validity) .compact(); } public Authentication getAuthentication(String token) { Claims claims = Jwts.parser() .setSigningKey(secretKey) .parseClaimsJws(token) .getBody(); Collection<? extends GrantedAuthority> authorities = Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(",")) .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); User principal = new User(claims.getSubject(), "", authorities); return new UsernamePasswordAuthenticationToken(principal, token, authorities); } public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invalid JWT token."); log.trace("Invalid JWT token trace: {}", e); } catch (ExpiredJwtException e) { log.info("Expired JWT token."); log.trace("Expired JWT token trace: {}", e); } catch (UnsupportedJwtException e) { log.info("Unsupported JWT token."); log.trace("Unsupported JWT token trace: {}", e); } catch (IllegalArgumentException e) { log.info("JWT token compact of handler are invalid."); log.trace("JWT token compact of handler are invalid trace: {}", e); } return false; } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
377d619ac6123fc1c15019680284fa011995d8fe
17f3338ea9a6ae6c4e19f5c53d1e419aa12383f2
/src/controller/Util.java
23eb716321170a24913acd3297f6517a8c330933
[]
no_license
roneetkumar/temp
d2085a3efeda04c8a9b6d3f1feb2cfcfa541269c
66c58d684ff1e77d2a6a69257cb7e8133d212f29
refs/heads/master
2023-06-07T16:04:26.091768
2021-06-19T19:32:05
2021-06-19T19:32:05
337,066,177
0
7
null
2021-03-24T18:36:14
2021-02-08T12:18:19
null
UTF-8
Java
false
false
405
java
package controller; import java.util.ArrayList; public class Util { public static String printList(ArrayList<String> list){ String str = ""; for (int i = 0; i < list.size(); i++) { str += list.get(i); if (i != list.size() - 1){ str += ", "; }else{ str += "."; } } return str; } }
[ "roneetparida@gmail.com" ]
roneetparida@gmail.com
15ebafa2a02dd1641ab662c603d2ecb88234755e
bdf28391864f024cb841ea4a9e0182c45836500e
/api/src/main/java/com/yanzhenjie/andserver/error/ServerInternalException.java
058004b30d01b9f21646856cf8a679a9ba83a56d
[ "Apache-2.0" ]
permissive
yanzhenjie/AndServer
3d48624d8fecc7f27e24c31c6a6ef85ba6add974
23a7c15512f5a70a9ce517710a5d04c06a4d57c9
refs/heads/master
2023-09-02T01:10:18.569605
2023-06-07T07:58:41
2023-06-07T07:58:41
61,079,960
3,675
795
Apache-2.0
2023-06-07T07:58:42
2016-06-14T00:52:52
Java
UTF-8
Java
false
false
1,367
java
/* * Copyright © 2018 Zhenjie Yan. * * 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.yanzhenjie.andserver.error; import com.yanzhenjie.andserver.http.StatusCode; /** * Created by Zhenjie Yan on 2018/9/4. */ public class ServerInternalException extends HttpException { private static final String MESSAGE = "Server internal error"; public ServerInternalException(String subMessage) { super(StatusCode.SC_INTERNAL_SERVER_ERROR, String.format("%s, %s.", MESSAGE, subMessage)); } public ServerInternalException(String subMessage, Throwable cause) { super(StatusCode.SC_INTERNAL_SERVER_ERROR, String.format("%s, %s.", MESSAGE, subMessage), cause); } public ServerInternalException(Throwable cause) { super(StatusCode.SC_INTERNAL_SERVER_ERROR, String.format("%s.", MESSAGE), cause); } }
[ "im.yanzhenjie@gmail.com" ]
im.yanzhenjie@gmail.com
8a4f01509f7eb641366105d0c0fc28b78b74668e
b5001ffb582ff3c4963272990616164c3a155973
/CTDL_SPOJ/SPOJ_PRELIMINAR/SPOJ_Preliminar_STRF/src/Main.java
bb1207e8fd10e7174db90a265e7769d647285bea
[]
no_license
nguyenhungcuong100698/Solution-Code-2017-2019
eacce5af14891087d0a7b8d48465256ef35781b8
ef56c8558640c717935655f669b38d6c628be848
refs/heads/master
2022-04-12T13:59:53.755057
2020-04-07T05:55:04
2020-04-07T05:55:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,085
java
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.PriorityQueue; import java.util.StringTokenizer; /* * 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 LENOVO */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { InputReader scan = new InputReader(System.in); int number = scan.nextInt(); PriorityQueue<task> processing = new PriorityQueue<>(); PriorityQueue<task> waiting = new PriorityQueue<>(); for (int i = 0; i < number; i++) { int time = scan.nextInt(); int duaration = scan.nextInt(); waiting.add(new task(time, duaration)); } int time = 0; int maxTime =0; while (!waiting.isEmpty()) { if (processing.isEmpty()) { task res = waiting.poll(); processing.add(res); if (waiting.isEmpty()) { time = res.time + res.duration - 1; } else { time = res.time; } } else { task a = waiting.peek(); task b = processing.peek(); if (a.time == b.time) { maxTime+=a.time+a.duration-1; processing.add(new task(maxTime, a.duration)); waiting.remove(); } else if (b.time + b.duration > a.time && a.duration < b.duration + b.time - a.time) { time = a.time; b.duration-=a.time-b.time; b.time = time; processing.add(a); waiting.remove(); } else { time = b.time + b.duration - 1; processing.remove(); } } } while (!processing.isEmpty()) { task a = processing.poll(); time = a.time + a.duration-1; } System.out.println(time); } static class task implements Comparable<task> { int time; int duration; public task(int time, int duration) { this.time = time; this.duration = duration; } @Override public int compareTo(task t) { if (this.time == t.time) { return this.duration - t.duration; } return this.time - t.time; } } static class InputReader { StringTokenizer tokenizer; BufferedReader reader; String token; String temp; public InputReader(InputStream stream) { tokenizer = null; reader = new BufferedReader(new InputStreamReader(stream)); } public InputReader(FileInputStream stream) { tokenizer = null; reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine() throws IOException { return reader.readLine(); } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { if (temp != null) { tokenizer = new StringTokenizer(temp); temp = null; } else { tokenizer = new StringTokenizer(reader.readLine()); } } catch (IOException e) { } } return tokenizer.nextToken(); } public double nextDouble() { return Double.parseDouble(next()); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }
[ "38639936+LenovoT460s@users.noreply.github.com" ]
38639936+LenovoT460s@users.noreply.github.com
0744ad584dc13870d235ff64f99e94608ff821ab
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/4697213.java
71ee8cd3d4e5a50fc85258a461665146f098ba0c
[]
no_license
whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254688
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,354
java
import java.io.UncheckedIOException; import java.io.UncheckedIOException; class c4697213 { protected void downloadJar(URL downloadURL, File jarFile, IProgressListener pl) { BufferedOutputStream out = null; InputStream in = null; URLConnection urlConnection = null; try { urlConnection =(URLConnection)(Object) downloadURL.openConnection(); out = new BufferedOutputStream(new FileOutputStream(jarFile)); in =(InputStream)(Object) urlConnection.getInputStream(); int len =(int)(Object) in.available(); MyHelperClass Log = new MyHelperClass(); Log.log("downloading jar with size: " + urlConnection.getContentLength()); if (len < 1) len = 1024; byte[] buffer = new byte[len]; while ((len =(int)(Object) in.read(buffer)) > 0) { out.write(buffer, 0, len); } out.close(); in.close(); } catch (Exception e) { } finally { if (out != null) { try { out.close(); } catch (UncheckedIOException ignore) { } } if (in != null) { try { in.close(); } catch (UncheckedIOException ignore) { } } } } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass log(String o0){ return null; }} class URL { public MyHelperClass openConnection(){ return null; }} class File { } class IProgressListener { } class BufferedOutputStream { BufferedOutputStream(FileOutputStream o0){} BufferedOutputStream(){} public MyHelperClass write(byte[] o0, int o1, int o2){ return null; } public MyHelperClass close(){ return null; }} class InputStream { public MyHelperClass read(byte[] o0){ return null; } public MyHelperClass close(){ return null; } public MyHelperClass available(){ return null; }} class URLConnection { public MyHelperClass getContentLength(){ return null; } public MyHelperClass getInputStream(){ return null; }} class FileOutputStream { FileOutputStream(File o0){} FileOutputStream(){}} class IOException extends Exception{ public IOException(String errorMessage) { super(errorMessage); } }
[ "piyush16066@iiitd.ac.in" ]
piyush16066@iiitd.ac.in
27d7ff2d8c96fceabeb1dda7d0ba50fc201d5d33
967fb843c99912124fe92341636913a06f8cb318
/blog-keji-web/src/main/java/com/keji/blog/controller/solr/SolrController.java
541abd883fa80bc966750caf36c916daf98bef97
[]
no_license
keji94/blog-keji
ff46a8bcac3cf6724ee148e14bd2b9261f555fbb
5020d61bb86942f5c0693e53d54e14fd2cd9d9cc
refs/heads/master
2020-11-30T00:33:56.007220
2017-09-04T01:57:01
2017-09-04T01:57:01
95,870,687
0
0
null
null
null
null
UTF-8
Java
false
false
5,776
java
package com.keji.blog.controller.solr; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.impl.HttpSolrServer; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrInputDocument; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; import java.util.Map; /** * Created by wb-ny291824 on 2017/8/14. */ @Controller public class SolrController { //向索引库中添加索引 public void addDocument() throws Exception { //和solr服务器创建连接 //参数:solr服务器的地址 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); //创建一个文档对象 SolrInputDocument document = new SolrInputDocument(); //向文档中添加域 //第一个参数:域的名称,域的名称必须是在schema.xml中定义的 //第二个参数:域的值 document.addField("id", "c0001"); document.addField("title_ik", "使用solrJ添加的文档"); document.addField("content_ik", "文档的内容"); document.addField("product_name", "商品名称"); //把document对象添加到索引库中 solrServer.add(document); //提交修改 solrServer.commit(); } //删除文档,根据id删除 public void deleteDocumentByid() throws Exception { //创建连接 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); //根据id删除文档 solrServer.deleteById("c0001"); //提交修改 solrServer.commit(); } //根据查询条件删除文档 public void deleteDocumentByQuery() throws Exception { //创建连接 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); //根据查询条件删除文档 solrServer.deleteByQuery("*:*"); //提交修改 solrServer.commit(); } /** * 关于修改:在solrJ中修改没有对应的update方法,只有add方法,只需要添加一条新的文档,和被修改的文档id一致就,可以修改了。本质上就是先删除后添加。 */ //查询索引 public void queryIndex() throws Exception { //创建连接 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); //创建一个query对象 SolrQuery query = new SolrQuery(); //设置查询条件 query.setQuery("*:*"); //执行查询 QueryResponse queryResponse = solrServer.query(query); //取查询结果 SolrDocumentList solrDocumentList = queryResponse.getResults(); //共查询到商品数量 System.out.println("共查询到商品数量:" + solrDocumentList.getNumFound()); //遍历查询的结果 for (SolrDocument solrDocument : solrDocumentList) { System.out.println(solrDocument.get("id")); System.out.println(solrDocument.get("product_name")); System.out.println(solrDocument.get("product_price")); System.out.println(solrDocument.get("product_catalog_name")); System.out.println(solrDocument.get("product_picture")); } } //复杂查询索引 public void queryIndex2() throws Exception { //创建连接 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); //创建一个query对象 SolrQuery query = new SolrQuery(); //设置查询条件 query.setQuery("钻石"); //过滤条件 query.setFilterQueries("product_catalog_name:幽默杂货"); //排序条件 query.setSort("product_price", SolrQuery.ORDER.asc); //分页处理 query.setStart(0); query.setRows(10); //结果中域的列表 query.setFields("id","product_name","product_price","product_catalog_name","product_picture"); //设置默认搜索域 query.set("df", "product_keywords"); //高亮显示 query.setHighlight(true); //高亮显示的域 query.addHighlightField("product_name"); //高亮显示的前缀 query.setHighlightSimplePre("<em>"); //高亮显示的后缀 query.setHighlightSimplePost("</em>"); //执行查询 QueryResponse queryResponse = solrServer.query(query); //取查询结果 SolrDocumentList solrDocumentList = queryResponse.getResults(); //共查询到商品数量 System.out.println("共查询到商品数量:" + solrDocumentList.getNumFound()); //遍历查询的结果 for (SolrDocument solrDocument : solrDocumentList) { System.out.println(solrDocument.get("id")); //取高亮显示 String productName = ""; Map<String, Map<String, List<String>>> highlighting = queryResponse.getHighlighting(); List<String> list = highlighting.get(solrDocument.get("id")).get("product_name"); //判断是否有高亮内容 if (null != list) { productName = list.get(0); } else { productName = (String) solrDocument.get("product_name"); } System.out.println(productName); System.out.println(solrDocument.get("product_price")); System.out.println(solrDocument.get("product_catalog_name")); System.out.println(solrDocument.get("product_picture")); } } }
[ "wb-ny291824@alibaba-inc.com" ]
wb-ny291824@alibaba-inc.com
fe34c8ca4a803af96d1c930223497ff124fa0be9
682c7314976056915e5ddd4da9e2c1e508494249
/src/test/java/example/SpringDataNeo4jRestExampleApplicationTests.java
5c5b9660c04b3f518f5520e282ebb1215e005d76
[]
no_license
endrec/sdnr-issue
86f8cef515bc8a93475b1218072ad8c3fb447efc
53c0d0b5eb8991c28775e1e5a8b08a5f3dee504e
refs/heads/master
2020-06-06T01:54:28.143602
2015-05-18T14:17:48
2015-05-18T14:17:48
35,821,710
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package example; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SpringDataNeo4jRestExampleApplication.class) public class SpringDataNeo4jRestExampleApplicationTests { @Test public void contextLoads() { } }
[ "endre.czirbesz@rungway.com" ]
endre.czirbesz@rungway.com
39b501707f75d376ff6b109ae2b03add1f549b19
c78f9c1139a6ddaa3ccbd00cb6cb84b1fe09e5c0
/app/src/main/java/com/ahsan/a51_cwm_classifiedsadsapp/SearchActivity.java
246c9d9f563614ffdb0ada66c43bef2717aea938
[]
no_license
johnyhawkahsan/51-CWM-ClassifiedsAdsApp
1af4a0b4f7e5e94b4856dd350327b00951f98a27
247d570b9d9d177e000f9adbec83c8fee987f84c
refs/heads/master
2023-01-21T03:14:05.843773
2019-12-18T09:50:39
2019-12-18T09:50:39
142,728,467
0
0
null
2023-01-09T11:23:13
2018-07-29T03:43:12
Java
UTF-8
Java
false
false
4,506
java
package com.ahsan.a51_cwm_classifiedsadsapp; //=========================================This is our MainActivity===============================================// import android.Manifest; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.util.Log; import com.ahsan.a51_cwm_classifiedsadsapp.util.SectionsPagerAdapter; public class SearchActivity extends AppCompatActivity { private static final String TAG = "SearchActivity"; private static final int REQUEST_CODE = 222; //Widgets private TabLayout mTabLayout; public ViewPager mViewPager; //vars public SectionsPagerAdapter mPagerAdapter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); mTabLayout = (TabLayout) findViewById(R.id.tabs); mViewPager = (ViewPager) findViewById(R.id.viewpager_container); //setupViewPager(); //Now moved to verifyPermissions() verifyPermissions(); } private void setupViewPager(){ mPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); //Add all fragments to our SectionsPagerAdapter mPagerAdapter.addFragment(new SearchFragment()); //Position 0 mPagerAdapter.addFragment(new WatchListFragment()); //Position 1 mPagerAdapter.addFragment(new PostFragment()); //Position 2 mPagerAdapter.addFragment(new AccountFragment()); //Position 3 mViewPager.setAdapter(mPagerAdapter); //set adapter for ViewPager in activity_search mTabLayout.setupWithViewPager(mViewPager); //We are setting up tabs according to ViewPager //Set tabs text according to their corresponding position mTabLayout.getTabAt(0).setText(getString(R.string.fragment_search)); mTabLayout.getTabAt(1).setText(getString(R.string.fragment_watch_list)); mTabLayout.getTabAt(2).setText(getString(R.string.fragment_post)); mTabLayout.getTabAt(3).setText(getString(R.string.fragment_account)); } //For API 21 and above, we incorporated Permission in Manifest, but for MARSHMALLOW, We need to ask for permissions explicitly private void verifyPermissions(){ Log.d(TAG, "verifyPermissions()"); //Permissions are stored in String array String[] permissions = { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA }; //if permissions are granted if ( ContextCompat.checkSelfPermission(this.getApplicationContext(), permissions[0]) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this.getApplicationContext(), permissions[1]) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this.getApplicationContext(), permissions[2]) == PackageManager.PERMISSION_GRANTED) { //If those 3 permissions are granted, setup view pager Log.d(TAG, "verifyPermissions: if those 3 permissions are granted, run setup view pager" ); setupViewPager(); } //else if permissions are not granted, ask for those 3 permissions. else{ Log.d(TAG, "verifyPermissions: else ask for 3 permissions" ); ActivityCompat.requestPermissions( SearchActivity.this, permissions, REQUEST_CODE); } } //Do task based on REQUEST_CODE- Here we have only one task to execute, so we can omit if else statement based on requestCode and directly call verifyPermissions() @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { //Here request code doesn't matter because we've already asked for permission above but to confirm, I log requestCode here Log.d(TAG, "onRequestPermissionsResult: requestCode: " + requestCode); verifyPermissions(); } }
[ "johnyhawkahsan@gmail.com" ]
johnyhawkahsan@gmail.com
e979b5938ed84ea3a326dbe99ca60643024a026f
23b155d6cb82066d8267d6dfe920d998b9e36e5b
/geoservice-common/src/main/java/org/schoellerfamily/geoservice/exception/package-info.java
a1ab705a696f9cfc542e9e5203c46c6c8b6b0585
[ "Apache-2.0" ]
permissive
dickschoeller/gedbrowser
d64291e21594026e1ccab9e7557487a0e1fa3731
eb15573af066550c7c73b37aeb2b6a1a201ae8ca
refs/heads/development
2023-07-26T14:05:58.405659
2021-01-24T02:05:02
2021-01-24T02:05:02
51,677,959
1
2
Apache-2.0
2023-07-13T17:05:12
2016-02-14T03:30:44
Java
UTF-8
Java
false
false
130
java
/** * Copyright 2016 Richard Schoeller * Common exceptions for geocoding. */ package org.schoellerfamily.geoservice.exception;
[ "schoeller@comcast.net" ]
schoeller@comcast.net
a9e18ba91791735c9e54037894e987f41e76e42f
08bb35629d05b247703b2ec1360102a11e234baf
/src/main/java/com/jwkim/study/springboot/web/dto/HelloResponseDto.java
20dd44b16dadfa5a4b6c26500bf74ad58f8e165f
[]
no_license
JennyJiwonKim/springTestPrj
d9dda87ad1216c47db0a6f4f6260f5bbe084e7f5
dfaedc71db992eb520d1c619900989c94ccc60a7
refs/heads/master
2023-07-06T11:14:43.096462
2021-08-04T14:14:14
2021-08-04T14:14:14
392,301,489
0
0
null
null
null
null
UTF-8
Java
false
false
235
java
package com.jwkim.study.springboot.web.dto; import lombok.Getter; import lombok.RequiredArgsConstructor; @Getter @RequiredArgsConstructor public class HelloResponseDto { private final String name; private final int amount; }
[ "jwk1215@kccworld.net" ]
jwk1215@kccworld.net
4efe2c931b410d50ea05de480f3d18c24b65a458
8a1be00995a308826af110a107b3e1befb17423b
/CoraDocCSS/src/main/java/com/coradec/coradoc/cssdecl/FontFamilyDeclaration.java
b0ae219e416cb4f1d651df33fb76d26c60d692f5
[]
no_license
freedio/coradeck
8014de125cdf96803fd9141a533a6ce22dc5572d
0fb39d616688e360356bda091f53eea55a0db007
refs/heads/master
2021-01-22T04:18:09.306493
2017-10-22T20:00:39
2017-10-22T20:00:39
92,449,506
0
0
null
null
null
null
UTF-8
Java
false
false
3,348
java
/* * Copyright ⓒ 2017 by Coradec GmbH. * * This file is part of the Coradeck. * * Coradeck is free software: you can redistribute it under the the terms of the GNU General * Public License as published by the Free Software Foundation, either version 3 of the License, * or any later version. * * Coradeck is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR ANY PARTICULAR PURPOSE. See the * GNU General Public License for further details. * * The GNU General Public License is available from <http://www.gnu.org/licenses/>. * * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> * @author Dominik Wezel <dom@coradec.com> * */ package com.coradec.coradoc.cssdecl; import com.coradec.coradoc.model.ModifiableDeclaration; import com.coradec.coradoc.model.ParserToken; import com.coradec.coradoc.model.Style; import com.coradec.coradoc.state.ProcessingState; import com.coradec.coradoc.struct.BasicCssDeclaration; import com.coradec.coradoc.token.Comma; import com.coradec.coradoc.token.Identifier; import com.coradec.coradoc.token.StringToken; import com.coradec.coradoc.trouble.FontFamilyInvalidException; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * ​​Implementation of the CSS font-family declaration. */ @SuppressWarnings("ClassHasNoToStringMethod") public class FontFamilyDeclaration extends BasicCssDeclaration { static boolean isFamily(final ParserToken token) { return token instanceof Identifier || token instanceof StringToken; } private List<String> families; /** * Initializes a new instance of FontFamilyDeclaration from the specified declaration. * * @param source the declaration. */ public FontFamilyDeclaration(final ModifiableDeclaration source) { super(source); } /** * Initializes an new instance of FontFamilyDeclaration with the specified family token. * * @param family the family identifier. * @throws IllegalArgumentException if the specified token is not a valid font family. */ FontFamilyDeclaration(final ParserToken family) { super("font-family"); addFamily(family); } public void addFamily(final ParserToken family) { if (family instanceof Identifier) families().add(((Identifier)family).getName()); else if (family instanceof StringToken) families().add(((StringToken)family).getValue()); else throw new FontFamilyInvalidException(family); } private List<String> families() { if (families == null) families = new ArrayList<>(); return families; } @Override protected ProcessingState getInitialState() { return this::base; } private ProcessingState base(final ParserToken token) { if (isFamily(token)) addFamily(token); else end(token); return this::afterFamily; } private ProcessingState afterFamily(final ParserToken token) { if (token instanceof Comma) return this::base; return end(token); } public List<String> getFamily() { return Collections.unmodifiableList(families); } @Override public void apply(final Style style) { style.setFontFamily(getFamily()); } }
[ "dom@coradec.com" ]
dom@coradec.com
910176c89fd9c73ff934b49ee94fee1a7f55ba7c
f641fe9a107026a7748efbf25a120b7e6a07b5f7
/src/Tess.java
5317d6ea7a3048047fbd2ee5ca036330da5c84b6
[]
no_license
NightOnewith/mybatisgenerator
376a66d78df4e94e3895533a1229457b8185420e
fd626b5171281dd439323959ab38584db58de75f
refs/heads/master
2021-06-30T06:26:30.808688
2017-09-18T13:33:02
2017-09-18T13:33:02
103,943,202
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
import java.util.ArrayList; import java.util.List; import javax.swing.text.html.HTMLDocument.Iterator; public class Tess { // Tess fool=new Tess(); // fool.num++; // fool.x++; // Tess fool2=new Tess(); // fool2.num++; // fool2.x++; // Tess fool3=new Tess(); // fool3.num++; // fool3.x++; // Tess.x++; // System.out.println(fool3.num); // System.out.println(fool3.x); // List list=new ArrayList(10); // Iterator it=list.iterator(); // int index=0; // while(((java.util.Iterator) it).hasNext()){ // Object obj=it.next(); // } }
[ "y347951803@outlook.com" ]
y347951803@outlook.com
b4d419ee6e81920ab4d4fcd38bc82e8d8a7c5f24
2d503e7941a45e25114f7b54f2b0aa649f47870f
/springbootdemo-foundation/src/test/java/com/example/springbootdemofoundation/entity/InterfaceEntity2.java
a5b02d6446fa65c706c6b9c281618c5327139ae5
[]
no_license
kangyiyi/bootcloud
12b41fe1f8d048ee4f4b69710f39cdee7ad8d03a
2dce0873f8c56f28cc0e86cbf6e017865cac8bbe
refs/heads/master
2022-06-21T09:33:45.051839
2019-10-09T07:31:20
2019-10-09T07:35:00
213,843,158
0
0
null
2022-06-17T02:33:40
2019-10-09T06:53:17
Java
UTF-8
Java
false
false
329
java
package com.example.springbootdemofoundation.entity; /** * @Title: InterfaceEntity2 * @ProjectName springbootdemo * @Description: TODO * @author YangPeng * @company ccxcredit * @date 2019/5/17-14:35 */ public interface InterfaceEntity2 { String interfaceMethod(); }
[ "846471893@qq.com" ]
846471893@qq.com